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


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

The following commit has been merged in the master branch:
commit a33bee82c1e8b2fcdaee8729c4c8c0cb220f2ad5
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Thu Feb 2 20:25:42 2012 +0000

    Use our contact model, rather than nepomuk
---
 KTp/Declarative/contact-list.cpp | 80 ++++++++++++++++++++++++++++++----------
 KTp/Declarative/contact-list.h   | 13 ++++++-
 2 files changed, 73 insertions(+), 20 deletions(-)

diff --git a/KTp/Declarative/contact-list.cpp b/KTp/Declarative/contact-list.cpp
index cfb968b..c5c7e29 100644
--- a/KTp/Declarative/contact-list.cpp
+++ b/KTp/Declarative/contact-list.cpp
@@ -20,16 +20,22 @@
 #include "telepathyContactList.h"
 
 #include <KStandardDirs>
-// #include <KUrl>
-//
-// #include <Nepomuk/File>
-// #include <Nepomuk/Vocabulary/NIE>
-// #include <Nepomuk/ResourceManager>
-// #include <Nepomuk/Variant>
 
 #include <QtDeclarative/QDeclarativeEngine>
 #include <QtDeclarative/QDeclarativeContext>
 
+#include <TelepathyQt4/AccountFactory>
+#include <TelepathyQt4/ContactFactory>
+#include <TelepathyQt4/ConnectionFactory>
+#include <TelepathyQt4/AccountManager>
+#include <TelepathyQt4/PendingReady>
+
+#include "flat-model-proxy.h"
+
+#include <KTelepathy/Models/accounts-model.h>
+
+
+
 TelepathyContactList::TelepathyContactList(QObject* parent, const QVariantList& args)
     : Applet(parent, args)
     , m_declarative(new Plasma::DeclarativeWidget(this))
@@ -38,6 +44,45 @@ TelepathyContactList::TelepathyContactList(QObject* parent, const QVariantList&
     // set plasmoid size
     setMinimumSize(250, 400);
     setAspectRatioMode(Plasma::IgnoreAspectRatio);
+    
+    Tp::registerTypes();
+
+        // Start setting up the Telepathy AccountManager.
+    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
+                                                                       Tp::Features() << Tp::Account::FeatureCore
+                                                                       << Tp::Account::FeatureAvatar
+                                                                       << Tp::Account::FeatureCapabilities
+                                                                       << Tp::Account::FeatureProtocolInfo
+                                                                       << Tp::Account::FeatureProfile);
+
+    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
+                                                                               Tp::Features() << Tp::Connection::FeatureCore
+                                                                               << Tp::Connection::FeatureRosterGroups
+                                                                               << Tp::Connection::FeatureRoster
+                                                                               << Tp::Connection::FeatureSelfContact);
+
+    Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(Tp::Features()  << Tp::Contact::FeatureAlias
+                                                                      << Tp::Contact::FeatureAvatarData
+                                                                      << Tp::Contact::FeatureSimplePresence
+                                                                      << Tp::Contact::FeatureCapabilities);
+    
+    
+    
+    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
+
+     m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
+                                                   accountFactory,
+                                                   connectionFactory,
+                                                   channelFactory,
+                                                   contactFactory);
+
+    connect(m_accountManager->becomeReady(),
+            SIGNAL(finished(Tp::PendingOperation*)),
+            SLOT(onAccountManagerReady(Tp::PendingOperation*)));
+
+    m_model = new AccountsModel(m_accountManager, this);
+
+    
 }
 
 TelepathyContactList::~TelepathyContactList()
@@ -55,19 +100,6 @@ int TelepathyContactList::appletWidth() const
     return geometry().width();
 }
 
-// QString TelepathyContactList::extractAvatarPathFromNepomuk(const QString &nepomukUri)
-// {
-//     /// TODO The resource doesn't have a file url
-//     /// The Telepathy Nepomuk service isn't pushing the data properly. So wait till this is done for avatar support
-//     Nepomuk::Resource asd(nepomukUri.toUrl());
-//     qDebug() << "REsourCE is FILE: " << asd.isFile();
-//     qDebug() << "INCOMING URI is: " << nepomukUri.toString();
-//     Nepomuk::File file(KUrl(nepomukUri.toString()));
-//     qDebug() << "VALID: " << file.isValid();
-//     qDebug() << "TEST 2 NIE: " << asd.property(Nepomuk::Vocabulary::NIE::url()).toString();
-//
-//     return nepomukUri.toString();
-// }
 
 void TelepathyContactList::init()
 {
@@ -80,6 +112,9 @@ void TelepathyContactList::init()
         // make C++ Plasma::Applet available to QML for resize signal
         m_declarative->engine()->rootContext()->setContextProperty("TelepathyContactList", this);
 
+        FlatModelProxy *proxyModel = new FlatModelProxy(m_model);
+        m_declarative->engine()->rootContext()->setContextProperty("contactListModel", proxyModel);
+
         // setup qml object so that we can talk to the declarative part
         m_qmlObject = dynamic_cast<QObject*>(m_declarative->rootObject());
 
@@ -87,9 +122,16 @@ void TelepathyContactList::init()
         // these two signals are for the plasmoid resize. QML can't determine the Plasma::DeclarativeWidget's boundaries
         connect(this, SIGNAL(widthChanged()), m_qmlObject, SLOT(onWidthChanged()));
         connect(this, SIGNAL(heightChanged()), m_qmlObject, SLOT(onHeightChanged()));
+
+        //FIXME this code is messy, steal from qmlsplashscreen
     }
 }
 
 
 // This is the command that links your applet to the .desktop file
 K_EXPORT_PLASMA_APPLET(telepathy-contact-list, TelepathyContactList)
+
+void TelepathyContactList::onAccountManagerReady(Tp::PendingOperation *op)
+{
+    m_model->init();
+}
diff --git a/KTp/Declarative/contact-list.h b/KTp/Declarative/contact-list.h
index 55b9ea7..ae095a1 100644
--- a/KTp/Declarative/contact-list.h
+++ b/KTp/Declarative/contact-list.h
@@ -23,6 +23,14 @@
 #include <Plasma/Applet>
 #include <Plasma/DeclarativeWidget>
 
+#include <TelepathyQt4/Types>
+
+class AccountsModel;
+
+namespace Tp {
+class PendingOperation;
+}
+
 class TelepathyContactList : public Plasma::Applet
 {
     Q_OBJECT
@@ -37,12 +45,15 @@ public:
     int appletWidth() const;      /** returns plasma applet's width */
     void init();
 
-public slots:
+private slots:
+    void onAccountManagerReady(Tp::PendingOperation *op);
 //     QString extractAvatarPathFromNepomuk(const QString &nepomukUri);
 
 private:
     Plasma::DeclarativeWidget *m_declarative;
     QObject *m_qmlObject;
+    Tp::AccountManagerPtr m_accountManager;
+    AccountsModel *m_model;
 };
 
 #endif  // TELEPATHY_CONTACT_LIST_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list