[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-05 13:41:59
Message-ID: 1215265319.323517.9712.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 828349 by gberg:
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.
M +42 -2 presence.cpp
--- trunk/playground/base/plasma/applets/presence/presence.cpp #828348:828349
@@ -266,8 +266,48 @@
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"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic