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


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

The following commit has been merged in the master branch:
commit 05ab6ed4aa85438dd5fb7342ffcf4ad837d15182
Author: Aleix Pol <aleixpol at kde.org>
Date:   Thu Feb 21 01:39:19 2013 +0100

    Properly close conversations before delegating them to ktp-text-ui
    
    Helps to make a more coherent behavior upon the detaching feature.
    
    Reviewed by David Edmundson (reviewboard is not working properly... :/)
    
    BUG: 302602
    BUG: 308130
---
 KTp/Declarative/conversation.cpp        |  1 +
 KTp/Declarative/conversation.h          |  1 +
 KTp/Declarative/conversations-model.cpp | 30 ++++++++++++++++++++----------
 KTp/Declarative/conversations-model.h   |  3 +++
 4 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/KTp/Declarative/conversation.cpp b/KTp/Declarative/conversation.cpp
index 37df438..6359c2a 100644
--- a/KTp/Declarative/conversation.cpp
+++ b/KTp/Declarative/conversation.cpp
@@ -88,6 +88,7 @@ void Conversation::onChannelInvalidated(Tp::DBusProxy *proxy, const QString &err
 void Conversation::delegateToProperClient()
 {
     ChannelDelegator::delegateChannel(d->account, d->messages->textChannel());
+    Q_EMIT conversationDelegated();
 }
 
 void Conversation::requestClose()
diff --git a/KTp/Declarative/conversation.h b/KTp/Declarative/conversation.h
index dff1dad..09263ee 100644
--- a/KTp/Declarative/conversation.h
+++ b/KTp/Declarative/conversation.h
@@ -52,6 +52,7 @@ class Conversation : public QObject
 
   Q_SIGNALS:
     void validityChanged(bool isValid);
+    void conversationDelegated();
 
   public Q_SLOTS:
     void delegateToProperClient();
diff --git a/KTp/Declarative/conversations-model.cpp b/KTp/Declarative/conversations-model.cpp
index 8d63f16..c013241 100644
--- a/KTp/Declarative/conversations-model.cpp
+++ b/KTp/Declarative/conversations-model.cpp
@@ -134,6 +134,7 @@ void ConversationsModel::handleChannels(const Tp::MethodInvocationContextPtr<> &
         Conversation *newConvo = new Conversation(textChannel, account, this);
         d->conversations.append(newConvo);
         connect(newConvo, SIGNAL(validityChanged(bool)), SLOT(handleValidityChange(bool)));
+        connect(newConvo, SIGNAL(conversationDelegated()), SLOT(conversationDelegated()));
         endInsertRows();
         context->setFinished();
     }
@@ -155,16 +156,25 @@ void ConversationsModel::startChat(const Tp::AccountPtr &account, const KTp::Con
 void ConversationsModel::handleValidityChange(bool valid)
 {
     if (!valid) {
-        Conversation *sender = qobject_cast<Conversation*>(QObject::sender());
-        int index = d->conversations.indexOf(sender);
-        if (index != -1) {
-            beginRemoveRows(QModelIndex(), index, index);
-            d->conversations.removeAt(index);
-            sender->deleteLater();
-            endRemoveRows();
-        } else {
-            kError() << "attempting to delete non-existent conversation";
-        }
+        removeConversation(qobject_cast<Conversation*>(QObject::sender()));
+    }
+}
+
+void ConversationsModel::conversationDelegated()
+{
+    removeConversation(qobject_cast<Conversation*>(QObject::sender()));
+}
+
+void ConversationsModel::removeConversation(Conversation* conv)
+{
+    int index = d->conversations.indexOf(conv);
+    if (index != -1) {
+        beginRemoveRows(QModelIndex(), index, index);
+        d->conversations.removeAt(index);
+        conv->deleteLater();
+        endRemoveRows();
+    } else {
+        kError() << "attempting to delete non-existent conversation";
     }
 }
 
diff --git a/KTp/Declarative/conversations-model.h b/KTp/Declarative/conversations-model.h
index bf5d437..5cf626c 100644
--- a/KTp/Declarative/conversations-model.h
+++ b/KTp/Declarative/conversations-model.h
@@ -56,11 +56,14 @@ class ConversationsModel : public QAbstractListModel, public Tp::AbstractClientH
     int nextActiveConversation(int first);
 
   private:
+    void removeConversation(Conversation* conversation);
+
     class ConversationsModelPrivate;
     ConversationsModelPrivate *d;
 
   private Q_SLOTS:
     void handleValidityChange(bool);
+    void conversationDelegated();
 };
 
 #endif // CONVERSATIONS_MODEL_H

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list