[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:       2009-04-06 22:18:41
Message-ID: 1239056321.783269.30854.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 950363 by gberg:

Fix up master presence display and available state icon display.

 M  +50 -31    presence.cpp  
 M  +4 -0      presenceitemdelegate.cpp  


--- trunk/playground/base/plasma/applets/presence/presence.cpp #950362:950363
@@ -341,78 +341,96 @@
     int accountsHidden = 0;
     int accountsBusy = 0;
 
-    bool okOffline = false;
-    bool okAway = false;
-    bool okExtendedAway = false;
-    bool okHidden = false;
-    bool okBusy = false;
+    bool okOffline = true;
+    bool okAway = true;
+    bool okExtendedAway = true;
+    bool okHidden = true;
+    bool okBusy = true;
 
     // Iterate over all the accounts in the model, and total up how many are
     // in each type of presence state.
-    /* // FIXME: Port to new method
     for(int i=0; i<rowCount; i++)
     {
-        Telepathy::ConnectionPresenceType status_type =
-            static_cast<Telepathy::ConnectionPresenceType>(m_accountsModel->data(m_accountsModel->index(i, \
1)).toUInt()); +        QString status_type = \
m_accountsModel->data(m_accountsModel->index(i, 1)).toString();  
-        switch(status_type)
+        if((status_type == "offline") || (status_type == "unknown") || (status_type \
== "error") || (status_type == "unset"))  {
-        case Telepathy::ConnectionPresenceTypeOffline:
-        case Telepathy::ConnectionPresenceTypeUnknown:
             accountsOffline++;
-            okOffline = true;
-            break;
-        case Telepathy::ConnectionPresenceTypeAvailable:
+        }
+        else if(status_type == "available")
+        {
             accountsAvailable++;
-            break;
-        case Telepathy::ConnectionPresenceTypeAway:
+            okOffline = false;
+            okHidden = false;
+            okExtendedAway = false;
+            okAway = false;
+            okBusy = false;
+        }
+        else if(status_type == "away")
+        {
             accountsAway++;
-            okAway = true;
-            break;
-        case Telepathy::ConnectionPresenceTypeExtendedAway:
+            okOffline = false;
+            okHidden = false;
+            okExtendedAway = false;
+            okBusy = false;
+        }
+        else if(status_type == "xa")
+        {
             accountsExtendedAway++;
-            okExtendedAway = true;
-            break;
-        case Telepathy::ConnectionPresenceTypeHidden:
+            okOffline = false;
+            okHidden = false;
+            okBusy = false;
+        }
+        else if(status_type == "invisible")
+        {
             accountsHidden++;
-            okHidden = true;
-            break;
-        case Telepathy::ConnectionPresenceTypeBusy:
+            okOffline = false;
+            okExtendedAway = false;
+            okAway = false;
+            okBusy = false;
+        }
+        else if(status_type == "busy")
+        {
             accountsBusy++;
-            okBusy = true;
-            break;
-        case Telepathy::ConnectionPresenceTypeUnset:
-        case Telepathy::ConnectionPresenceTypeError:
-        	break;
+            okOffline = false;
+            okHidden = false;
+            okExtendedAway = false;
+            okAway = false;
         }
     }
-*/
+
     // Chose a master presence state from this.
     // FIXME: What should be the logic for choosing a master presence state?
     //        Should this be user customisable?
     //        Currently follows the kopete approach.
     if(okOffline == true)
     {
+        kDebug() << "okOffline true.";
         m_icon->setIcon(KIcon("user-offline"));
     }
     else if(okHidden == true)
     {
+        kDebug() << "okHidden true.";
         m_icon->setIcon(KIcon("user-invisible"));
     }
     else if(okBusy == true)
     {
+        kDebug() << "okBusy true.";
         m_icon->setIcon(KIcon("user-busy"));
     }
     else if(okExtendedAway == true)
     {
+        kDebug() << "okXA true.";
         m_icon->setIcon(KIcon("user-away-extended"));
     }
     else if(okAway == true)
     {
+        kDebug() << "okAway true.";
         m_icon->setIcon(KIcon("user-away"));
     }
     else
     {
+        kDebug() << "okNONE true.";
         m_icon->setIcon(KIcon("user-online"));
     }
 
@@ -443,5 +461,6 @@
     m_masterStatusMessage = message;
 }
 
+
 #include "presence.moc"
 
--- trunk/playground/base/plasma/applets/presence/presenceitemdelegate.cpp \
#950362:950363 @@ -50,6 +50,10 @@
         {
             icon = KIcon("user-offline");
         }
+        else if(type == "available")
+        {
+            icon = KIcon("user-online");
+        }
         else if(type == "away")
         {
             icon = KIcon("user-away");


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

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