[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:06:58 UTC 2016


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

The following commit has been merged in the master branch:
commit 9cc7ea57c830d345bab5377208058fb47b428b69
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sun Jul 7 21:57:46 2013 +0100

    Upgrade the Tp::Connection to upgrade FeatureRoster inside GlobalContactManager
    
    GlobalContactManager is useless without FeatureRoster so it makes sense
    that if one instantiates this class, we upgrade the connection.
    
    This will allow apps that only occasionally need a full contact list
    such as contact-applet and text-ui to not rely on FeatureRoster and thus
    will can a connection object without loading details on every contact ever.
    
    This is an important step towards a singleton AccountManager, in addition
    text-ui will load substantially faster.
    
    REVIEW: 111440
---
 KTp/global-contact-manager.cpp | 14 ++++++++++++++
 KTp/global-contact-manager.h   |  1 +
 KTp/types.h                    |  1 +
 3 files changed, 16 insertions(+)

diff --git a/KTp/global-contact-manager.cpp b/KTp/global-contact-manager.cpp
index c293e00..f8be0b5 100644
--- a/KTp/global-contact-manager.cpp
+++ b/KTp/global-contact-manager.cpp
@@ -25,6 +25,8 @@
 #include <TelepathyQt/ContactManager>
 #include <TelepathyQt/PendingReady>
 
+#include "KTp/types.h"
+
 #include <KDebug>
 
 
@@ -90,6 +92,18 @@ void GlobalContactManager::onConnectionChanged(const Tp::ConnectionPtr &connecti
     if (connection.isNull()) {
         return;
     }
+    Tp::PendingReady *op = connection->becomeReady(Tp::Features() << Tp::Connection::FeatureRoster << Tp::Connection::FeatureRosterGroups);
+    op->setProperty("connection", QVariant::fromValue<Tp::ConnectionPtr>(connection));
+    connect(op, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onConnectionReady(Tp::PendingOperation*)));
+}
+
+void GlobalContactManager::onConnectionReady(Tp::PendingOperation *op)
+{
+    Tp::ConnectionPtr connection = op->property("connection").value<Tp::ConnectionPtr>();
+    if (!connection) {
+        return;
+    }
+
     onContactManagerStateChanged(connection->contactManager(), connection->contactManager()->state());
     connect(connection->contactManager().data(), SIGNAL(stateChanged(Tp::ContactListState)), SLOT(onContactManagerStateChanged(Tp::ContactListState)));
 }
diff --git a/KTp/global-contact-manager.h b/KTp/global-contact-manager.h
index 1c903c1..49055ba 100644
--- a/KTp/global-contact-manager.h
+++ b/KTp/global-contact-manager.h
@@ -52,6 +52,7 @@ private Q_SLOTS:
     void onAccountManagerReady(Tp::PendingOperation *op);
     void onNewAccount(const Tp::AccountPtr &account);
     void onConnectionChanged(const Tp::ConnectionPtr &connection);
+    void onConnectionReady(Tp::PendingOperation *op);
     void onContactManagerStateChanged(Tp::ContactListState state);
 
 private:
diff --git a/KTp/types.h b/KTp/types.h
index 652a7ea..7980c3c 100644
--- a/KTp/types.h
+++ b/KTp/types.h
@@ -86,6 +86,7 @@ namespace KTp
 Q_DECLARE_METATYPE(Tp::AccountPtr)
 Q_DECLARE_METATYPE(KTp::ContactPtr)
 Q_DECLARE_METATYPE(Tp::AccountManagerPtr);
+Q_DECLARE_METATYPE(Tp::ConnectionPtr);
 
 
 #endif // KTP_TYPES_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list