[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/dataengines/presence
From: George Goldberg <grundleborg () googlemail ! com>
Date: 2009-04-04 23:51:40
Message-ID: 1238889100.445929.25366.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 949339 by gberg:
Add support for setting the presence of an account through the plasma services \
mechanism.
Everything seems to work OK (through plasmaengineexplorer), but its not stress \
tested, so don't be surprised if you break it. There are still some smallish issues \
that need sorting out, but that will require a bit of talk with the telepathy mailing \
list to clarify some points. Code cleanup and consistency checking of parameter \
naming will also come soon.
M +3 -0 CMakeLists.txt
M +21 -0 presence.cpp
M +7 -1 presence.h
A presence.operations
AM presenceservice.cpp [License: LGPL (v2)]
AM presenceservice.h [License: LGPL (v2)]
M +14 -0 presencesource.cpp
M +8 -0 presencesource.h
AM setrequestedpresencejob.cpp [License: LGPL (v2)]
AM setrequestedpresencejob.h [License: LGPL (v2)]
--- trunk/playground/base/plasma/dataengines/presence/CMakeLists.txt #949338:949339
@@ -19,6 +19,8 @@
set(presence_engine_SRCS
presence.cpp
presencesource.cpp
+ presenceservice.cpp
+ setrequestedpresencejob.cpp
)
kde4_add_plugin(plasma_engine_presence ${presence_engine_SRCS})
@@ -30,3 +32,4 @@
install(TARGETS plasma_engine_presence DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-dataengine-presence.desktop DESTINATION ${SERVICES_INSTALL_DIR} \
) +install(FILES presence.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
--- trunk/playground/base/plasma/dataengines/presence/presence.cpp #949338:949339
@@ -23,6 +23,8 @@
#include <KDebug>
+#include <Plasma/Service>
+
#include <TelepathyQt4/Client/Account>
#include <TelepathyQt4/Client/AccountManager>
#include <TelepathyQt4/Client/Feature>
@@ -54,6 +56,25 @@
}
}
+Plasma::Service * PresenceEngine::serviceForSource(const QString &name)
+{
+ kDebug(); // Output which method we are in.
+
+ // Get the data source and then from that, we can get the service
+ PresenceSource *source = \
dynamic_cast<PresenceSource*>(containerForSource(name)); +
+ if(!source)
+ {
+ kWarning() << "Service does not exist for the source with name:" << name;
+ return Plasma::DataEngine::serviceForSource(name);
+ }
+
+ Plasma::Service *service = source->createService();
+ service->setParent(this);
+ return service;
+}
+
+
void PresenceEngine::init()
{
kDebug(); // Output the method we are in.
--- trunk/playground/base/plasma/dataengines/presence/presence.h #949338:949339
@@ -20,8 +20,12 @@
#ifndef PLASMA_DATAENGINE_PRESENCE_PRESENCE_H
#define PLASMA_DATAENGINE_PRESENCE_PRESENCE_H
-#include <plasma/dataengine.h>
+#include <Plasma/DataEngine>
+namespace Plasma {
+ class Service;
+}
+
namespace Telepathy
{
namespace Client
@@ -39,6 +43,8 @@
PresenceEngine(QObject * parent, const QVariantList & args);
~PresenceEngine();
+ Plasma::Service * serviceForSource(const QString& name);
+
protected:
void init();
bool sourceRequestEvent(const QString & name);
** trunk/playground/base/plasma/dataengines/presence/presenceservice.cpp #property \
svn:eol-style + native
** trunk/playground/base/plasma/dataengines/presence/presenceservice.h #property \
svn:eol-style + native
--- trunk/playground/base/plasma/dataengines/presence/presencesource.cpp \
#949338:949339 @@ -18,6 +18,8 @@
#include "presencesource.h"
+#include "presenceservice.h"
+
#include <kdebug.h>
#include <TelepathyQt4/Client/Feature>
@@ -53,6 +55,18 @@
kDebug() << "Destroying source for Account:" << objectName();
}
+Plasma::Service * PresenceSource::createService()
+{
+ kDebug(); // Output the method we are in.
+
+ return new PresenceService(this);
+}
+
+Telepathy::Client::AccountPtr PresenceSource::account()
+{
+ return m_account;
+}
+
void PresenceSource::onAccountReady(Telepathy::Client::PendingOperation *op)
{
kDebug(); // Output the method we are in.
--- trunk/playground/base/plasma/dataengines/presence/presencesource.h #949338:949339
@@ -25,6 +25,10 @@
#include <TelepathyQt4/Client/Account>
+namespace Plasma {
+ class Service;
+}
+
namespace Telepathy {
namespace Client {
class PendingOperation;
@@ -39,6 +43,10 @@
PresenceSource(Telepathy::Client::AccountPtr account, QObject *parent = 0);
~PresenceSource();
+ Plasma::Service * createService();
+
+ Telepathy::Client::AccountPtr account();
+
private Q_SLOTS:
void onAccountReady(Telepathy::Client::PendingOperation *op);
void onAccountCurrentPresenceChanged(const Telepathy::SimplePresence &);
** trunk/playground/base/plasma/dataengines/presence/setrequestedpresencejob.cpp \
#property svn:eol-style + native
** trunk/playground/base/plasma/dataengines/presence/setrequestedpresencejob.h \
#property svn:eol-style + native
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic