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

List:       kde-commits
Subject:    playground/base/plasma/applets/presence
From:       Abner Silva <abner.silva () kdemail ! net>
Date:       2009-07-21 22:56:13
Message-ID: 1248216973.617158.18022.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1000750 by abnerf:

Implemented presence status updating.

 M  +14 -0     accountwidget.cpp  
 M  +2 -0      accountwidget.h  
 M  +4 -0      presence.cpp  


--- trunk/playground/base/plasma/applets/presence/accountwidget.cpp #1000749:1000750
@@ -31,6 +31,7 @@
 #include <KColorScheme>
 #include <KDebug>
 #include <KIconLoader>
+#include <KComboBox>
 
 //Qt
 #include <QGraphicsGridLayout>
@@ -94,6 +95,7 @@
     m_presenceStatus->addItem("Online - Available");
     m_presenceStatus->addItem("Away - I am gone right now");
     m_presenceStatus->addItem("Busy - Sorry, I'm busy right now");
+    m_presenceStatus->addItem("Invisible - Hidden");
     m_presenceStatus->addItem("Offline - Offline");
     m_layout->addItem(m_presenceStatus, 2, 0, 1, 3, Qt::AlignTop);
 
@@ -134,4 +136,16 @@
 {
     m_image->setPixmap(image);
 }
+
+void AccountWidget::setPresence(const QString &presence, const QString &msg)
+{
+    Q_UNUSED(msg);
+
+    int pos = m_presenceStatus->nativeWidget()->findText(presence, Qt::MatchContains);
+
+    if (pos == -1)
+        pos = m_presenceStatus->nativeWidget()->findText("Offline", Qt::MatchContains);
+
+    m_presenceStatus->nativeWidget()->setCurrentIndex(pos);
+}
 //#include "contactwidget.moc"
--- trunk/playground/base/plasma/applets/presence/accountwidget.h #1000749:1000750
@@ -54,6 +54,8 @@
     QString alias() const;
 
     void setImage(const QPixmap &image);
+
+    void setPresence(const QString &presence, const QString &msg);
 private:
     QString m_id;
     AccountImage *m_image;
--- trunk/playground/base/plasma/applets/presence/presence.cpp #1000749:1000750
@@ -140,6 +140,10 @@
         QPixmap avatar;
         avatar.loadFromData(data["AccountAvatar"].toByteArray());
         account->setImage(avatar);
+
+        // Set the presence and presence msg
+        account->setPresence(data["PresenceType"].toString(),
+                data["PresenceMessage"].toString());
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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