From kde-commits Wed Feb 25 17:43:54 2009 From: Siraj Razick Date: Wed, 25 Feb 2009 17:43:54 +0000 To: kde-commits Subject: playground/base/plasma/dataengines/presence Message-Id: <1235583834.385662.17068.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123558384403640 SVN commit 931710 by siraj: Add currentPresenceChanged slot so icon updates when presnce of the account changes M +12 -2 presence.cpp M +4 -1 presence.h --- trunk/playground/base/plasma/dataengines/presence/presence.cpp #931709:931710 @@ -18,7 +18,6 @@ #include "presence.h" -#include #include #include #include @@ -202,7 +201,8 @@ kDebug(); kDebug() << path; QSharedPointer account = accountFromPath(path); - + QObject::connect(account.data(), SIGNAL(currentPresenceChanged(const Telepathy::SimplePresence &)), this + , SLOT(currentPresenceChanged(const Telepathy::SimplePresence &))); QObject::connect(account->becomeReady(), SIGNAL(finished(Telepathy::Client::PendingOperation *)), this, SLOT(onExistingAccountReady(Telepathy::Client::PendingOperation *))); } @@ -256,5 +256,15 @@ return false; } +void PresenceEngine::currentPresenceChanged(const Telepathy::SimplePresence & presence) +{ + QVariant vsp; + vsp.setValue(presence); + foreach (QString source, sources()) { + setData(source, "current_presence", vsp); + } + updateAllSources(); +} + #include "presence.moc" --- trunk/playground/base/plasma/dataengines/presence/presence.h #931709:931710 @@ -21,7 +21,9 @@ #include #include +#include + #include class QDBusObjectPath; @@ -47,12 +49,13 @@ bool sourceRequestEvent(const QString & name); private slots: - void onAccountReady(Telepathy::Client::PendingOperation *operation); + void onAccountReady(Telepathy::Client::PendingOperation *operation); void onExistingAccountReady(Telepathy::Client::PendingOperation *); bool isOperationError(Telepathy::Client::PendingOperation *); void accountCreated(const QString &path); void accountRemoved(const QString &path); void accountValidityChanged(const QString &path, bool valid); + void currentPresenceChanged(const Telepathy::SimplePresence &); private: QSharedPointer accountFromPath(const QString &path);