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


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

The following commit has been merged in the master branch:
commit ad0d92a3ca38ef3deab88b3e021d962ad7dc5e24
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Nov 20 23:15:24 2012 +0900

    Phase out use of ContactModelItem
    
    REVIEW: 107396
---
 KTp/Declarative/contact-list.cpp | 26 +++++++++++++-------------
 KTp/Declarative/contact-list.h   |  3 ++-
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/KTp/Declarative/contact-list.cpp b/KTp/Declarative/contact-list.cpp
index 92a6022..52ee06b 100644
--- a/KTp/Declarative/contact-list.cpp
+++ b/KTp/Declarative/contact-list.cpp
@@ -23,13 +23,13 @@
 #include <TelepathyQt/ConnectionFactory>
 #include <TelepathyQt/AccountManager>
 #include <TelepathyQt/PendingReady>
+#include <TelepathyQt/PendingChannelRequest>
 
 #include <KDebug>
 
 #include <KTp/Models/contact-model-item.h>
 #include <KTp/Models/accounts-model-item.h>
-
-#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KTp.TextUi"
+#include <KTp/actions.h>
 
 ContactList::ContactList(QObject *parent)
     : QObject(parent),
@@ -97,20 +97,20 @@ AccountsFilterModel * ContactList::filterModel() const
     return m_filterModel;
 }
 
-void ContactList::startChat(ContactModelItem *contactItem)
+void ContactList::startChat(const Tp::AccountPtr &account, const Tp::ContactPtr &contact)
 {
-
-    Tp::ContactPtr contact = contactItem->contact();
-
     kDebug() << "Requesting chat for contact" << contact->alias();
-    Tp::AccountPtr account = m_contactsModel->accountForContactItem(contactItem);
+    kDebug() << "account is" << account->normalizedName();
 
-    Tp::ChannelRequestHints hints;
-    hints.setHint("org.freedesktop.Telepathy.ChannelRequest","DelegateToPreferredHandler", QVariant(true));
+    Tp::PendingOperation *op = KTp::Actions::startChat(account, contact, true);
+    connect(op, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+}
 
-    Tp::PendingChannelRequest *channelRequest = account->ensureTextChat(contact,
-                                                                        QDateTime::currentDateTime(),
-                                                                        PREFERRED_TEXTCHAT_HANDLER,
-                                                                        hints);
+void ContactList::onGenericOperationFinished(Tp::PendingOperation *op)
+{
+    if (op->isError()) {
+        kDebug() << op->errorName();
+        kDebug() << op->errorMessage();
+    }
 }
 
diff --git a/KTp/Declarative/contact-list.h b/KTp/Declarative/contact-list.h
index dee39ee..5997ec3 100644
--- a/KTp/Declarative/contact-list.h
+++ b/KTp/Declarative/contact-list.h
@@ -41,10 +41,11 @@ public:
 
 
 public slots:
-    void startChat(ContactModelItem *contact);
+    void startChat(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
 
 private slots:
     void onAccountManagerReady(Tp::PendingOperation *op);
+    void onGenericOperationFinished(Tp::PendingOperation *op);
 
 private:
     ContactsModel* m_contactsModel;

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list