[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:12:55 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=24c862b

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

    Use our contact model, rather than nepomuk
---
 CMakeLists.txt                              | 14 ++---
 src/declarative/contents/ui/ContactList.qml | 22 +++++---
 src/declarative/contents/ui/main.qml        |  5 +-
 src/telepathyContactList.cpp                | 80 ++++++++++++++++++++++-------
 src/telepathyContactList.h                  | 13 ++++-
 5 files changed, 96 insertions(+), 38 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5681b6..f0d151c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,13 +6,14 @@ set(CMAKE_MODULE_PATH
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
     ${CMAKE_MODULE_PATH}
 )
-
+set(IS_TELEPATHY_KDE_INTERNAL_MODULE TRUE)
 set(KDE_MIN_VERSION "4.7.0")
 
 find_package(KDE4 ${KDE_MIN_VERSION} REQUIRED)
 find_package(KDE4Workspace REQUIRED)
-find_package(TelepathyQt4 0.7.1 REQUIRED)
-# find_package(Nepomuk REQUIRED)
+find_package(TelepathyQt4 0.7.3 REQUIRED)
+find_package (KTelepathy REQUIRED)
+
 
 include(KDE4Defaults)
 
@@ -24,11 +25,12 @@ include_directories(${CMAKE_SOURCE_DIR}
                     ${CMAKE_BINARY_DIR}
                     ${KDE4_INCLUDES}
                     ${TELEPATHY_QT4_INCLUDE_DIR}
-#                     ${NEPOMUK_INCLUDE_DIR}
+                    ${KTELEPATHY_INCLUDE_DIR}
 )
 
 set(telepathy_contact_list_applet_SRCS
     src/telepathyContactList.cpp
+    src/flat-model-proxy.cpp
 )
 
 kde4_add_plugin(plasma_applet_telepathy_contact_list ${telepathy_contact_list_applet_SRCS})
@@ -37,8 +39,8 @@ target_link_libraries(plasma_applet_telepathy_contact_list
                         ${KDE4_PLASMA_LIBS}
                         ${KDE4_KDEUI_LIBS}
                         ${TELEPATHY_QT4_LIBRARIES}
-                        ${QT_QTDECLARATIVE_LIBRARY})
-#                         ${NEPOMUK_LIBRARIES})
+                        ${QT_QTDECLARATIVE_LIBRARY}
+                        ${KTELEPATHY_MODELS_LIBRARIES})
 
 install(DIRECTORY src/declarative/ DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/org.kde.telepathy-contact-list)
 install(TARGETS plasma_applet_telepathy_contact_list DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/src/declarative/contents/ui/ContactList.qml b/src/declarative/contents/ui/ContactList.qml
index 5a97011..227763e 100644
--- a/src/declarative/contents/ui/ContactList.qml
+++ b/src/declarative/contents/ui/ContactList.qml
@@ -20,8 +20,6 @@
 import Qt 4.7
 import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 
-// import nepomuk models
-import org.kde.telepathy.declarativeplugins 0.1 as TelepathyDeclarative
 
 /// TODO
 // - connect buttons in toolbar to switch view
@@ -30,18 +28,23 @@ import org.kde.telepathy.declarativeplugins 0.1 as TelepathyDeclarative
 // - get contact list to load nepomuk:/bla/foo/bar images as contact avatars
 // - add side panel with common contact actions
 // - highlight contacts on click
+// - Use properties properly and get rid of all the stupid onSomethingChagned methods.
+
 
 Item {
     id: contactListContainer;
     anchors.fill: parent;
 
+
+    
+    
     // TOOLBAR
     ToolBar {
         id: toolbar;
         height: 20;
 
         anchors {
-            top: parent;
+//             top: parent;
             left: parent.left;
             right: parent.right;
         }
@@ -71,11 +74,11 @@ Item {
         }
 
         clip: true;
-        model: TelepathyDeclarative.ContactListModel{}
+        model: contactListModel;
 
         delegate:
             ListContactDelegate {
-                delegateDisplayName: displayName;
+                delegateDisplayName: aliasName;
                 delegateAvatar: avatar;
 //                delegatePresenceIcon: presenceIcon;
                 delegatePresenceMessage: presenceMessage;
@@ -98,7 +101,7 @@ Item {
             bottomMargin: 20;
         }
 
-        model: TelepathyDeclarative.ContactListModel{}
+        model: contactListModel;
 
         cellWidth: 48;
         cellHeight: 48;
@@ -106,12 +109,15 @@ Item {
         delegate:
             GridContactDelegate {
                 id: gridDelegate;
-                delegateDisplayName: displayName;
+                
+                //Dave - why does any of this exist just use the correct fucking names in the delegate.???
+                delegateDisplayName: aliasName;
                 delegateAvatar: avatar;
 //                delegatePresenceIcon: presenceIcon;
-                delegatePresenceName: presenceName;
+                delegatePresenceName: presenceType;
                 delegatePresenceMessage: presenceMessage;
 
+                //Dave - this is a stupid name for the method. Be careful when using words like "set"
                 onSetGridContactDisplayName: {
                     console.log("SETTING NAME TO: " + gridContactDisplayName + " with presence msg: " + gridPresenceMessage);
                     contactDisplay.contactNickToShow = gridContactDisplayName;
diff --git a/src/declarative/contents/ui/main.qml b/src/declarative/contents/ui/main.qml
index 7472a28..92f3628 100644
--- a/src/declarative/contents/ui/main.qml
+++ b/src/declarative/contents/ui/main.qml
@@ -31,15 +31,12 @@ Item {
     width: 230;
     height: 380;
 
-    // TODO make plasmoid busy when loading contacts on startup to avoid the user
-    // complaining about sluggish plasmoid. The "slowness" is caused by nepomuk storing 1000000000000 contacts
-    // need to make model faster (talk to david)
 
     // contact listview
     ContactList {
         id: contactList;
         anchors.fill: parent;
-        state: "gridView";//"listView";      // start with list view
+        state: "listView";   // start with list view
     }
 
     Rectangle {
diff --git a/src/telepathyContactList.cpp b/src/telepathyContactList.cpp
index cfb968b..c5c7e29 100644
--- a/src/telepathyContactList.cpp
+++ b/src/telepathyContactList.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/src/telepathyContactList.h b/src/telepathyContactList.h
index 55b9ea7..ae095a1 100644
--- a/src/telepathyContactList.h
+++ b/src/telepathyContactList.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-contact-applet packaging



More information about the pkg-kde-commits mailing list