[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:07:45 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=b1294bb

The following commit has been merged in the master branch:
commit b1294bbfff7f1bd5a8b5d695608b95a6454f01c5
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sun Oct 13 15:38:56 2013 +0000

    Expose singleton accountmanager
    
    REVIEW: 113231
---
 KTp/core.cpp                   | 34 +++++++++++++++++++++++++++++++++-
 KTp/core.h                     | 15 ++++++++++++++-
 KTp/im-persons-data-source.cpp | 25 +------------------------
 3 files changed, 48 insertions(+), 26 deletions(-)

diff --git a/KTp/core.cpp b/KTp/core.cpp
index a0458f9..df16443 100644
--- a/KTp/core.cpp
+++ b/KTp/core.cpp
@@ -28,11 +28,15 @@
 
 #include <KGlobal>
 
+#include <TelepathyQt/AccountManager>
+#include "contact-factory.h"
+
 class CorePrivate
 {
 public:
     CorePrivate();
     bool m_kPeopleEnabled;
+    Tp::AccountManagerPtr m_accountManager;
 };
 
 CorePrivate::CorePrivate()
@@ -49,8 +53,31 @@ CorePrivate::CorePrivate()
             }
         }
     }
-    //else if it can't be started, or nepomukServer doesn't reply lave it disabled.
+    //else if it can't be started, or nepomukServer doesn't reply leave it disabled.
     #endif
+
+    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
+                                                                    Tp::Features() << Tp::Account::FeatureCore
+                                                                                   << Tp::Account::FeatureCapabilities
+                                                                                   << Tp::Account::FeatureProtocolInfo
+                                                                                   << Tp::Account::FeatureProfile);
+
+    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
+                                                                               Tp::Features() << Tp::Connection::FeatureCore
+                                                                                              << Tp::Connection::FeatureSelfContact);
+
+    Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(Tp::Features()  << Tp::Contact::FeatureAlias
+                                                                                       << Tp::Contact::FeatureSimplePresence
+                                                                                       << Tp::Contact::FeatureCapabilities
+                                                                                       << Tp::Contact::FeatureClientTypes);
+
+    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
+
+    m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
+                                                   accountFactory,
+                                                   connectionFactory,
+                                                   channelFactory,
+                                                   contactFactory);
 }
 
 K_GLOBAL_STATIC(CorePrivate, s_instance)
@@ -59,3 +86,8 @@ bool KTp::kpeopleEnabled()
 {
     return s_instance->m_kPeopleEnabled;
 }
+
+Tp::AccountManagerPtr KTp::accountManager()
+{
+    return s_instance->m_accountManager;
+}
diff --git a/KTp/core.h b/KTp/core.h
index 3402fe7..a1ccd02 100644
--- a/KTp/core.h
+++ b/KTp/core.h
@@ -25,4 +25,17 @@
 namespace KTp
 {
     KTP_EXPORT bool kpeopleEnabled();
-}
\ No newline at end of file
+
+
+    //FIXME for 0.8
+    /*  For 0.8 we have a plan to have a singleton accountManager
+        (or accountFactory/contactFactory/channelFactory/connectionFactory).
+
+        We didn't get this done for everyone to use this in time for 0.7.
+        However we still need the contact list and kpeople to share the connectionFactory
+        This is an initial half-completed version.
+
+        It is best not to use this method. It's only half complete.
+     */
+    KTP_EXPORT Tp::AccountManagerPtr accountManager();
+}
diff --git a/KTp/im-persons-data-source.cpp b/KTp/im-persons-data-source.cpp
index ebd01ba..f81781c 100644
--- a/KTp/im-persons-data-source.cpp
+++ b/KTp/im-persons-data-source.cpp
@@ -86,31 +86,8 @@ IMPersonsDataSource::IMPersonsDataSource(QObject *parent, const QVariantList &da
 {
     d->q = this;
     Tp::registerTypes();
-    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
-                                                                       Tp::Features() << Tp::Account::FeatureCore
-                                                                       << Tp::Account::FeatureCapabilities
-                                                                       << Tp::Account::FeatureProtocolInfo
-                                                                       << Tp::Account::FeatureProfile);
-
-    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
-                                                                               Tp::Features() << Tp::Connection::FeatureCore
-                                                                               << Tp::Connection::FeatureRoster
-                                                                               << Tp::Connection::FeatureRosterGroups
-                                                                               << Tp::Connection::FeatureSelfContact);
-
-    Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(Tp::Features()  << Tp::Contact::FeatureAlias
-    << Tp::Contact::FeatureSimplePresence
-    << Tp::Contact::FeatureCapabilities
-    << Tp::Contact::FeatureClientTypes);
-
-    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
-
-    d->accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
-                                                   accountFactory,
-                                                   connectionFactory,
-                                                   channelFactory,
-                                                   contactFactory);
 
+    d->accountManager = KTp::accountManager();
     connect(d->accountManager->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)),
             this, SLOT(onAccountManagerReady(Tp::PendingOperation*)));
 }

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list