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

List:       kde-commits
Subject:    playground/base/plasma/dataengines/presence
From:       Dariusz Mikulski <dariusz.mikulski () gmail ! com>
Date:       2009-01-09 18:27:17
Message-ID: 1231525637.585713.21018.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 908450 by mikulski:

change Decibel accountmanager to Telepathy-Qt4

 M  +21 -1     CMakeLists.txt  
 M  +34 -30    presence.cpp  
 M  +7 -7      presence.h  


--- trunk/playground/base/plasma/dataengines/presence/CMakeLists.txt #908449:908450
@@ -1,3 +1,19 @@
+SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
+
+find_package (KDE4 REQUIRED)
+find_package (TelepathyQt4 REQUIRED)
+
+#include (KDE4Defaults)
+
+add_definitions(${KDE4_DEFINITIONS})
+
+include_directories(
+	${CMAKE_CURRENT_SOURCE_DIR}
+	${CMAKE_CURRENT_BINARY_DIR}
+	${KDE4_INCLUDES}
+	${TELEPATHY_QT4_INCLUDE_DIR}
+)
+
 set(presence_engine_SRCS
     presence.cpp
 )
@@ -3,5 +19,9 @@
 
 kde4_add_plugin(plasma_engine_presence ${presence_engine_SRCS})
-target_link_libraries(plasma_engine_presence ${KDE4_KDECORE_LIBS} decibel ${KDE4_PLASMA_LIBS} QtTapioca)
+target_link_libraries(plasma_engine_presence
+	${KDE4_KDECORE_LIBS}
+	${KDE4_PLASMA_LIBS}
+	${TELEPATHY_QT4_LIBRARIES}
+	)
 
 install(TARGETS plasma_engine_presence DESTINATION ${PLUGIN_INSTALL_DIR})
--- trunk/playground/base/plasma/dataengines/presence/presence.cpp #908449:908450
@@ -18,30 +18,34 @@
 
 #include "presence.h"
 
-#include <Decibel/AccountData>
-#include <Decibel/DBusNames>
-#include <Decibel/Types>
+#include <TelepathyQt4/Client/Account>
+#include <TelepathyQt4/Client/AccountManager>
 
 #include <KDebug>
 #include <KLocale>
 #include <KUrl>
 
-#include <QtTapioca/PresenceState>
-
 #include <QtCore/QDateTime>
 #include <QtCore/QTimer>
 
-#include <QtDBus/QDBusConnection>
+class PresenceEngine::PresenceEnginePrivate
+{
+public:
+	Telepathy::Client::AccountManager * m_accountManager;
+};
 
 PresenceEngine::PresenceEngine(QObject * parent, const QVariantList & args)
-  : Plasma::DataEngine(parent, args)
+  : Plasma::DataEngine(parent, args),
+  d(new PresenceEnginePrivate())
 {
     // Register custom types:
-    Decibel::registerTypes();
+    Telepathy::registerTypes();
 }
 
 PresenceEngine::~PresenceEngine()
 {
+	delete d->m_accountManager;
+	delete d;
 }
 
 void
@@ -62,15 +66,14 @@
     * which will provide all the data to this
     * data engine.
     */
-    m_accountManager = new org::kde::Decibel::AccountManager
-                                (Decibel::daemon_service,
-                                 Decibel::daemon_accountmanager_path,
-                                 QDBusConnection::sessionBus());
+    d->m_accountManager = 
+    	new Telepathy::Client::AccountManager(QDBusConnection::sessionBus());
+    
     /*
      * get a list of all the accounts that
      * are all ready there
      */
-    QList<uint> accounts = m_accountManager->listAccounts();
+    QList<Telepathy::Client::Account *> accounts = d->m_accountManager->allAccounts();
 
     /*
      * connect signals from the account manager
@@ -81,21 +84,20 @@
      * that if another is created while we are
      * processing them, we don't miss out on it.
      */
-    connect(m_accountManager, SIGNAL(accountCreated(const uint)),
-            this, SLOT(accountCreated(const uint)));
-    connect(m_accountManager, SIGNAL(accountUpdated(const uint)),
-            this, SLOT(accountUpdated(const uint)));
-    connect(m_accountManager, SIGNAL(accountDeleted(const uint)),
-            this, SLOT(accountDeleted(const uint)));
+    connect(d->m_accountManager, SIGNAL(accountCreated(const QDBusObjectPath &)),
+            this, SLOT(accountCreated(const QDBusObjectPath &)));
+    connect(d->m_accountManager, SIGNAL(accountValidityChanged(const QDBusObjectPath &, bool)),
+            this, SLOT(accountValidityChanged(const QDBusObjectPath &, bool)));
+    connect(d->m_accountManager, SIGNAL(accountRemoved(const QDBusObjectPath &)),
+            this, SLOT(accountRemoved(const QDBusObjectPath &)));
 
     /*
      * create a datasource for each
      * of the accounts we got in the list.
      */
-    uint handle;
-    foreach(handle, accounts)
+    foreach(Telepathy::Client::Account *account, accounts)
     {
-        accountCreated(handle);
+        //accountCreated(account);
     }
 }
 
@@ -113,24 +115,24 @@
 }
 
 void
-PresenceEngine::accountCreated(const uint handle)
+PresenceEngine::accountCreated(const QDBusObjectPath &path)
 {
     kDebug() << "accountCreated() called";
     // Load the data for the new account. To avoid duplicating code, we treat
     // this just as if an account was updated, and call the method to handle
     // that.
-    accountUpdated(handle);
+    accountValidityChanged(path, true);
 }
 
 void
-PresenceEngine::accountUpdated(const uint handle)
+PresenceEngine::accountValidityChanged(const QDBusObjectPath &path, bool valid)
 {
-    kDebug() << "accountUpdated() called";
+    kDebug() << "accountValidityChanged() called";
     /*
      * slot called when an account has
      * been updated.
      */
-    QString source;
+/*    QString source;
     source.setNum(handle);
     QVariantMap accountData = m_accountManager->queryAccount(handle);
     QMap<QString, QVariant>::const_iterator end( accountData.constEnd() );
@@ -148,21 +150,23 @@
         {
             setData(source, "status_message", itr.value().toMap().value("status_message").toString());
         }
-    }
+    }*/
 }
 
 void
-PresenceEngine::accountDeleted(const uint handle)
+PresenceEngine::accountRemoved(const QDBusObjectPath &path)
 {
-    kDebug() << "accountDeleted() called";
+    kDebug() << "uint handle() called";
     /*
      * slot called when an account has been deleted
      *
      * remove that source.
      */
+/*
     QString source;
     source.setNum(handle);
     removeSource(source);
+*/
 }
 
 
--- trunk/playground/base/plasma/dataengines/presence/presence.h #908449:908450
@@ -21,7 +21,7 @@
 
 #include <plasma/dataengine.h>
 
-#include <Decibel/AccountManager>
+class QDBusObjectPath;
 
 class PresenceEngine : public Plasma::DataEngine
 {
@@ -35,14 +35,14 @@
     void init();
     bool sourceRequestEvent(const QString & name);
 
-private slots:
-    void accountCreated(const uint handle);
-    void accountDeleted(const uint handle);
-    void accountUpdated(const uint handle);
+private Q_SLOTS:
+    void accountCreated(const QDBusObjectPath &path);
+    void accountRemoved(const QDBusObjectPath &path);
+    void accountValidityChanged(const QDBusObjectPath &path, bool valid);
 
 private:
-    org::kde::Decibel::AccountManager * m_accountManager;
-
+	class PresenceEnginePrivate;
+	PresenceEnginePrivate * const d;
 };
 
 K_EXPORT_PLASMA_DATAENGINE(presence, PresenceEngine)
[prev in list] [next in list] [prev in thread] [next in thread] 

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