[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/applets/presence
From:       George Goldberg <grundleborg () googlemail ! com>
Date:       2008-07-08 8:18:53
Message-ID: 1215505133.646977.21064.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 829346 by gberg:

Show the master presence icon on the main widget, not just the taskbar.


 M  +24 -1     presence.cpp  
 M  +7 -1      presence.h  


--- trunk/playground/base/plasma/applets/presence/presence.cpp #829345:829346
@@ -26,6 +26,7 @@
 
 #include <Decibel/Types>
 
+#include <QLabel>
 #include <QString>
 #include <QStandardItemModel>
 #include <QTreeView>
@@ -45,7 +46,8 @@
     m_accountsModel(0),
     m_accountsView(0),
     m_messageEdit(0),
-    m_colorScheme(0)
+    m_colorScheme(0),
+    m_masterIconLabel(0)
 {
     m_layout = 0;
     m_widget = 0;
@@ -61,6 +63,9 @@
     // Set up the icon.
     m_icon = new Plasma::Icon(KIcon("user-offline"), QString(), this);
 
+    // The icon has been changed.
+    iconChanged();
+
     // Set up the accounts model.
     m_accountsModel = new QStandardItemModel(this);
     m_accountsModel->setColumnCount(4);
@@ -90,11 +95,16 @@
         m_accountsView->header()->setVisible(true);
         m_accountsView->setColumnHidden(0, true);   //Hide the source id column
 
+        // Make sure we have a masterIconPixmap.
+        m_masterIconLabel = new QLabel;
+        iconChanged();
+
         // 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_masterIconLabel);
         m_layout->addWidget(m_accountsView);
         m_layout->addWidget(m_messageEdit);
         m_widget->setLayout(m_layout);
@@ -352,6 +362,19 @@
     {
         m_icon->setIcon(KIcon("user-online"));
     }
+
+    // Call the method to update the masterPresenceIcon.
+    iconChanged();
 }
 
+void Presence::iconChanged()
+{
+    // The icon has been changed. We must update the pixmap of the icon for
+    // display in the main widget.
+    if(m_masterIconLabel)
+    {
+        m_masterIconLabel->setPixmap(m_icon->icon().pixmap(QSize(22, 22)));
+    }
+}
+
 #include "presence.moc"
--- trunk/playground/base/plasma/applets/presence/presence.h #829345:829346
@@ -30,6 +30,7 @@
 class QTreeView;
 class QVBoxLayout;
 class QWidget;
+class QLabel;
 
 class KLineEdit;
 class KColorScheme;
@@ -51,9 +52,13 @@
 
     protected:
         void initialize();
+
+    private Q_SLOTS:
+        void iconChanged();
+
     private:
         void updateMasterPresence();
-    
+
         QVBoxLayout* m_layout;
         Plasma::DataEngine* m_engine;
         QStandardItemModel *m_accountsModel;
@@ -61,6 +66,7 @@
         QWidget * m_widget;
         KLineEdit *m_messageEdit;
         KColorScheme *m_colorScheme;
+        QLabel *m_masterIconLabel;
 };
 
 K_EXPORT_PLASMA_APPLET(presence, Presence)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic