[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:26 UTC 2016


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

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

    Basic implementation of changing master icon. If one or more accounts are offline, it now displays the offline icon, otherwise the online icon. Needs some serious thought about when to use which icon.
    
    svn path=/trunk/playground/base/plasma/applets/presence/; revision=828349
---
 presence/src/presence.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/presence/src/presence.cpp b/presence/src/presence.cpp
index 4cca3eb..fb92b48 100644
--- a/presence/src/presence.cpp
+++ b/presence/src/presence.cpp
@@ -266,8 +266,48 @@ void Presence::updateMasterPresence()
     int accountsHidden = 0;
     int accountsBusy = 0;
 
-    // TODO: complete this bit once the decibel AccountManager provides a
-    // QtTapioca::PresenceState object for the presence state.
+    // Iterate over all the accounts in the model, and total up how many are
+    // in each type of presence state.
+    for(int i=0; i<rowCount; i++)
+    {
+        QtTapioca::PresenceState::Type status_type = 
+            static_cast<QtTapioca::PresenceState::Type>(m_accountsModel->data(m_accountsModel->index(i, 1)).toInt());
+
+        switch(status_type)
+        {
+        case QtTapioca::PresenceState::OfflineType:
+        case QtTapioca::PresenceState::UnsetType:
+            accountsOffline++;
+            break;
+        case QtTapioca::PresenceState::AvailableType:
+            accountsAvailable++;
+            break;
+        case QtTapioca::PresenceState::AwayType:
+            accountsAway++;
+            break;
+        case QtTapioca::PresenceState::ExtendedAwayType:
+            accountsExtendedAway++;
+            break;
+        case QtTapioca::PresenceState::HiddenType:
+            accountsHidden++;
+            break;
+        case QtTapioca::PresenceState::BusyType:
+            accountsBusy++;
+            break;
+        }
+    }
+
+    // Chose a master presence state from this.
+    // FIXME: What should be the logic for choosing a master presence state?
+    //        Shoud this be user customisable?
+    if(accountsOffline >= 1)
+    {
+        m_icon->setIcon(KIcon("user-offline"));
+    }
+    else
+    {
+        m_icon->setIcon(KIcon("user-online"));
+    }
 }
 
 #include "presence.moc"

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list