[Telepathy-commits] [telepathy-qt4/master] TpPrototype::AccountManager: add a Properties interface and a helper for ValidAccounts

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Dec 10 08:56:40 PST 2008


---
 TelepathyQt4/Prototype/AccountManager.cpp |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/TelepathyQt4/Prototype/AccountManager.cpp b/TelepathyQt4/Prototype/AccountManager.cpp
index 92994a2..3d3f941 100644
--- a/TelepathyQt4/Prototype/AccountManager.cpp
+++ b/TelepathyQt4/Prototype/AccountManager.cpp
@@ -30,6 +30,7 @@
 #include <QPointer>
 
 #include <TelepathyQt4/Client/AccountManager>
+#include <TelepathyQt4/Client/DBus>
 #include <TelepathyQt4/Types>
 
 #include <TelepathyQt4/Prototype/Account.h>
@@ -47,6 +48,7 @@ public:
     { init(); }
 
     Telepathy::Client::AccountManagerInterface* m_pInterface;
+    Telepathy::Client::DBus::PropertiesInterface* m_propertiesInterface;
     QMap<QString, QPointer<Account> >  m_validAccountHandles;
 
     void init()
@@ -54,6 +56,13 @@ public:
         m_pInterface = NULL;
     }
 
+    Telepathy::ObjectPathList validAccounts()
+    {
+        Q_ASSERT(m_propertiesInterface);
+
+        return m_pInterface->ValidAccounts();
+    }
+
     void removeAccount( const QString& handle )
     {
         if ( m_validAccountHandles.contains( handle ) )
@@ -285,9 +294,16 @@ void AccountManager::init()
         qWarning() << "Unable to connect to AccountManagerInterface: MissionControl seems to be missing!";
     }
     //Q_ASSERT( d->m_pInterface->isValid() );
-                                                                           
+
+    d->m_propertiesInterface = new Telepathy::Client::DBus::PropertiesInterface(
+            "org.freedesktop.Telepathy.AccountManager",
+            "/org/freedesktop/Telepathy/AccountManager",
+            this);
+    Q_ASSERT( d->m_propertiesInterface );
+
     // It might be better to use layzy initializing here.. (ses)
-    Telepathy::ObjectPathList account_handles = d->m_pInterface->ValidAccounts();
+    Telepathy::ObjectPathList account_handles = d->validAccounts();
+
     foreach( const QDBusObjectPath& account_handle, account_handles )
     {
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list