[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:10:22 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=629bb6c

The following commit has been merged in the master branch:
commit 629bb6cde94c39fa8a4c0cf6771f271b0de5b0d5
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Sat Jul 5 13:40:39 2008 +0000

    Get the presence applet working again with current plasma API.
    
    svn path=/trunk/playground/base/plasma/applets/presence/; revision=828344
---
 presence/CMakeLists.txt   |   2 +-
 presence/src/presence.cpp | 103 +++++++++++++++++++++++-----------------------
 presence/src/presence.h   |  31 +++++++-------
 3 files changed, 67 insertions(+), 69 deletions(-)

diff --git a/presence/CMakeLists.txt b/presence/CMakeLists.txt
index da09ad2..2a908c5 100644
--- a/presence/CMakeLists.txt
+++ b/presence/CMakeLists.txt
@@ -8,7 +8,7 @@ set(presence_SRCS
     presence.cpp)
 
 kde4_add_plugin(plasma_applet_presence ${presence_SRCS})
-target_link_libraries(plasma_applet_presence  ${PLASMA_LIBS} decibel ${KDE4_KDEUI_LIBS})
+target_link_libraries(plasma_applet_presence plasmaappletdialog ${PLASMA_LIBS} decibel ${KDE4_KDEUI_LIBS})
 
 install(TARGETS plasma_applet_presence DESTINATION ${PLUGIN_INSTALL_DIR})
 install(FILES plasma-applet-presence.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/presence/src/presence.cpp b/presence/src/presence.cpp
index f2830db..664d4c3 100644
--- a/presence/src/presence.cpp
+++ b/presence/src/presence.cpp
@@ -20,86 +20,84 @@
 #include "presence.h"
 
 #include <plasma/theme.h>
+#include <plasma/widgets/icon.h>
 
-#include <QPainter>
 #include <QString>
 #include <QStandardItemModel>
 #include <QTreeView>
 #include <QHeaderView>
-#include <QGraphicsProxyWidget>
-#include <QGraphicsLinearLayout>
-#include <QGraphicsWidget>
+#include <QWidget>
 #include <QList>
+#include <QVBoxLayout>
 
 #include <KLineEdit>
 #include <KDebug>
 #include <KColorScheme>
+#include <KIcon>
 
 Presence::Presence(QObject *parent, const QVariantList &args)
-    : Plasma::Applet(parent, args),
+    : PlasmaAppletDialog(parent, args),
     m_accountsModel(0),
     m_accountsView(0),
-    m_accountsViewProxyWidget(0),
-    m_messageEditProxyWidget(0),
     m_messageEdit(0)
 {
     m_layout = 0;
-    m_form = 0;
+    m_widget = 0;
 }
 
-void Presence::init() 
+void Presence::initialize()
 {
-    setHasConfigurationInterface(false);
+    kDebug() << "Initializing applet.";
+    // Set up the icon.
+    m_icon = new Plasma::Icon(KIcon("utilities-terminal"), QString(), this);
 
-    /*
-     * set up the accounts model.
-     */
+    // Set up the accounts model.
     m_accountsModel = new QStandardItemModel(this);
     m_accountsModel->setColumnCount(4);
     m_accountsModel->setHeaderData(1, Qt::Horizontal, QVariant("online?"), Qt::DisplayRole);
     m_accountsModel->setHeaderData(2, Qt::Horizontal, QVariant("status"), Qt::DisplayRole);
     m_accountsModel->setHeaderData(3, Qt::Horizontal, QVariant("message"), Qt::DisplayRole);
 
-    /*
-     * set up the accounts view.
-     */
-    m_accountsView = new QTreeView;
-    m_accountsView->setModel(m_accountsModel);
-    m_accountsView->header()->setVisible(true);
-    m_accountsView->setColumnHidden(0, true);   //Hide the source id column
-
-    /*
-     * set up the rest of the view/layout etc. stuff
-     */
-    m_accountsViewProxyWidget = new QGraphicsProxyWidget(this);
-    m_accountsViewProxyWidget->setWidget(m_accountsView);
-    m_accountsView->show();
-    m_accountsViewProxyWidget->show();
-    m_messageEdit = new KLineEdit;
-    m_messageEditProxyWidget = new QGraphicsProxyWidget(this);
-    m_messageEditProxyWidget->setWidget(m_messageEdit);
-    m_messageEdit->show();
-    m_messageEditProxyWidget->show();
-
-    m_form = new QGraphicsWidget(this);
-    m_layout = new QGraphicsLinearLayout(Qt::Vertical, m_form);
-    m_layout->addItem(m_accountsViewProxyWidget);
-    m_layout->addItem(m_messageEditProxyWidget);
-    m_form->setLayout(m_layout);
-
-    updateGeometry();
-
     m_engine = dataEngine("presence");
 
+    QStringList sources = m_engine->sources();
+    foreach(const QString & source, sources)
+    {
+        sourceAdded(source);
+    }
+
     connect(m_engine, SIGNAL(sourceAdded(QString)), this, SLOT(sourceAdded(QString)));
     connect(m_engine, SIGNAL(sourceRemoved(QString)), this, SLOT(sourceRemoved(QString)));
 }
 
-Presence::~Presence()
+QWidget * Presence::widget()
 {
+    if(!m_widget)
+    {
+        // Set up the accounts view.
+        m_accountsView = new QTreeView;
+        m_accountsView->setModel(m_accountsModel);
+        m_accountsView->header()->setVisible(true);
+        m_accountsView->setColumnHidden(0, true);   //Hide the source id column
+
+        // Set up the rest of the view/layout etc. stuff.
+        m_messageEdit = new KLineEdit;
+
+        m_widget = new QWidget();
+        m_layout = new QVBoxLayout(m_widget);
+        m_layout->addWidget(m_accountsView);
+        m_layout->addWidget(m_messageEdit);
+        m_widget->setLayout(m_layout);
+    }
 
+    return m_widget;
 }
 
+Presence::~Presence()
+{
+
+}
+/*
 void Presence::constraintsEvent(Plasma::Constraints constraints)
 {
     if (constraints & Plasma::SizeConstraint) {
@@ -111,22 +109,23 @@ void Presence::constraintsEvent(Plasma::Constraints constraints)
             update();
         }
     }
-}
-
+}*/
+/*
 QSizeF Presence::contentSizeHint() const
 {
     if (m_layout) {
         kDebug() << "Returning the m_form size geometry";
         return m_form->effectiveSizeHint(Qt::PreferredSize, contentSize());
-    }
+    }*/
     /*
      * this is the hardcoded default size
      * of the plasmoid. (apparently not...)
      */
     // FIXME: change this to be a good size...
+    /*
     return QSizeF(300, 300);
 }
-
+*/
 
 void Presence::sourceAdded(const QString& source)
 {
@@ -155,9 +154,9 @@ void Presence::dataUpdated(const QString &source, const Plasma::DataEngine::Data
     QStandardItem *online = new QStandardItem;
     QStandardItem *status = new QStandardItem;
     QStandardItem *message = new QStandardItem;
-    online->setData(Plasma::Theme::self()->textColor(), Qt::ForegroundRole);
-    status->setData(Plasma::Theme::self()->textColor(), Qt::ForegroundRole);
-    message->setData(Plasma::Theme::self()->textColor(), Qt::ForegroundRole);
+    //online->setData(Plasma::Theme::self()->textColor(), Qt::ForegroundRole);
+    //status->setData(Plasma::Theme::self()->textColor(), Qt::ForegroundRole);
+    //message->setData(Plasma::Theme::self()->textColor(), Qt::ForegroundRole);
     QString decibelCurrentPresence = data.value("decibel_current_presence").toString();
     if(decibelCurrentPresence == "1")
     {
@@ -222,12 +221,12 @@ void Presence::dataUpdated(const QString &source, const Plasma::DataEngine::Data
         kDebug() << "ERROR: two or more rows for the same data source in the model!";
     }
 }
-
+/*
 void Presence::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
 {
     Q_UNUSED(p);
     Q_UNUSED(option);
     Q_UNUSED(contentsRect);
 }
-
+*/
 #include "presence.moc"
diff --git a/presence/src/presence.h b/presence/src/presence.h
index 6063506..d7769b9 100644
--- a/presence/src/presence.h
+++ b/presence/src/presence.h
@@ -17,10 +17,10 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-#ifndef PRESENCE_H
-#define PRESENCE_H
+#ifndef PLASMA_APPLET_PRESENCE_H
+#define PLASMA_APPLET_PRESENCE_H
 
-#include <plasma/applet.h>
+#include <plasmaappletdialog.h>
 #include <plasma/dataengine.h>
 
 #include <QGraphicsItem>
@@ -28,22 +28,22 @@
 class QString;
 class QStandardItemModel;
 class QTreeView;
-class QGraphicsProxyWidget;
-class QGraphicsLinearLayout;
-class QGraphicsWidget;
+class QVBoxLayout;
+class QWidget;
 
 class KLineEdit;
 
-class Presence : public Plasma::Applet
+class Presence : public PlasmaAppletDialog
 {
         Q_OBJECT
     public:
         Presence(QObject *parent, const QVariantList &args);
         ~Presence();
 
-        QSizeF contentSizeHint() const;
-        virtual void init(void);
-        void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
+     //   QSizeF contentSizeHint() const;
+      //  virtual void init(void);
+     //   void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
+        QWidget * widget();
 
     private slots:
         void sourceAdded(const QString& source);
@@ -51,17 +51,16 @@ class Presence : public Plasma::Applet
         void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);
 
     protected:
-        void constraintsEvent(Plasma::Constraints constraints);
-
+     //   void constraintsEvent(Plasma::Constraints constraints);
+        void initialize();
     private:
-        QGraphicsLinearLayout* m_layout;
+        QVBoxLayout* m_layout;
         Plasma::DataEngine* m_engine;
         QStandardItemModel *m_accountsModel;
         QTreeView *m_accountsView;
-        QGraphicsProxyWidget *m_accountsViewProxyWidget;
-        QGraphicsProxyWidget *m_messageEditProxyWidget;
-        QGraphicsWidget *m_form;
+        QWidget * m_widget;
         KLineEdit *m_messageEdit;
+
 };
 
 K_EXPORT_PLASMA_APPLET(presence, Presence)

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list