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


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

The following commit has been merged in the master branch:
commit a88fec10e0ef2dd73f08c6ef3c912a16cf2f85c7
Author: Aleix Pol <aleixpol at kde.org>
Date:   Fri Mar 22 19:49:50 2013 +0100

    Use ContactsModel from the ContactList (in declarative)
    
    A suggested by David, use KTp::ContactsModel instead of
    KTp::ContactsFilterModel.
    
    REVIEW: 109641
---
 KTp/Declarative/contact-list.cpp | 24 ++++++------------------
 KTp/Declarative/contact-list.h   | 15 +++++++--------
 KTp/Declarative/qml-plugins.cpp  |  3 +++
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/KTp/Declarative/contact-list.cpp b/KTp/Declarative/contact-list.cpp
index 18b1332..d469f2c 100644
--- a/KTp/Declarative/contact-list.cpp
+++ b/KTp/Declarative/contact-list.cpp
@@ -29,16 +29,13 @@
 #include <KTp/contact-factory.h>
 
 #include <KTp/actions.h>
+#include <Models/contacts-model.h>
+#include <Models/contacts-list-model.h>
 
 ContactList::ContactList(QObject *parent)
     : QObject(parent),
-      m_contactsModel(new KTp::ContactsListModel(this)),
-      m_filterModel(new KTp::ContactsFilterModel(this))
+      m_filterModel(new KTp::ContactsModel(this))
 {
-    m_filterModel->setSourceModel(m_contactsModel);
-    //flat model takes the source as a constructor parameter, the other's don't.
-    //due to a bug somewhere creating the flat model proxy with the filter model as a source before the filter model has a source means the rolenames do not get propgated up
-
     Tp::registerTypes();
 
     // Start setting up the Telepathy AccountManager.
@@ -64,25 +61,16 @@ ContactList::ContactList(QObject *parent)
 
     Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
 
-    m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
+    Tp::AccountManagerPtr accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
                                                   accountFactory,
                                                   connectionFactory,
                                                   channelFactory,
                                                   contactFactory);
 
-    connect(m_accountManager->becomeReady(),
-            SIGNAL(finished(Tp::PendingOperation*)),
-            SLOT(onAccountManagerReady(Tp::PendingOperation*)));
-}
-
-
-void ContactList::onAccountManagerReady(Tp::PendingOperation *op)
-{
-    Q_UNUSED(op);
-    m_contactsModel->setAccountManager(m_accountManager);
+    m_filterModel->setAccountManager(accountManager);
 }
 
-KTp::ContactsFilterModel* ContactList::filterModel() const
+KTp::ContactsModel* ContactList::filterModel() const
 {
     return m_filterModel;
 }
diff --git a/KTp/Declarative/contact-list.h b/KTp/Declarative/contact-list.h
index a598144..ff8fc1b 100644
--- a/KTp/Declarative/contact-list.h
+++ b/KTp/Declarative/contact-list.h
@@ -19,33 +19,32 @@
 #ifndef CONTACT_LIST_H
 #define CONTACT_LIST_H
 
-#include <KTp/Models/contacts-list-model.h>
-#include <KTp/Models/contacts-filter-model.h>
 #include <KTp/contact.h>
 
 #include <TelepathyQt/Types>
 
+namespace KTp {
+class ContactsModel;
+}
+
 /** Exposes general contact list stuff to QML*/
 class ContactList : public QObject
 {
     Q_OBJECT
-    Q_PROPERTY(QObject* model READ filterModel CONSTANT)
+    Q_PROPERTY(KTp::ContactsModel* model READ filterModel CONSTANT)
 
   public:
     ContactList(QObject *parent=0);
-    KTp::ContactsFilterModel* filterModel() const;
+    KTp::ContactsModel* filterModel() const;
 
   public Q_SLOTS:
     void startChat(const Tp::AccountPtr &account, const KTp::ContactPtr &contact);
 
   private Q_SLOTS:
-    void onAccountManagerReady(Tp::PendingOperation *op);
     void onGenericOperationFinished(Tp::PendingOperation *op);
 
   private:
-    KTp::ContactsListModel* m_contactsModel;
-    KTp::ContactsFilterModel* m_filterModel;
-    Tp::AccountManagerPtr m_accountManager;
+    KTp::ContactsModel* m_filterModel;
 };
 
 #endif
diff --git a/KTp/Declarative/qml-plugins.cpp b/KTp/Declarative/qml-plugins.cpp
index e754b25..ec7c8af 100644
--- a/KTp/Declarative/qml-plugins.cpp
+++ b/KTp/Declarative/qml-plugins.cpp
@@ -36,6 +36,7 @@
 #include "declarative-ktp-actions.h"
 
 #include "Models/contacts-filter-model.h"
+#include <Models/contacts-model.h>
 
 void QmlPlugins::registerTypes(const char *uri)
 {
@@ -52,6 +53,8 @@ void QmlPlugins::registerTypes(const char *uri)
         QLatin1String("Filter cannot be created. Access through ContactList.filter"));
     qmlRegisterUncreatableType<MessagesModel> (uri, 0, 1, "MessagesModel",
         QLatin1String("It will be created once the conversation is created"));
+    qmlRegisterUncreatableType<KTp::ContactsModel> (uri, 0, 1, "ContactsModel",
+        QLatin1String("It will be created through ContactList"));
 
     qmlRegisterType<ConversationTarget>();
     qmlRegisterType<ConversationsModel>();

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list