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


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

The following commit has been merged in the master branch:
commit 55cd2d7152e9530da6f10490f881ebe134b438f1
Author: Lasath Fernando <kde at lasath.org>
Date:   Tue Jan 10 13:31:41 2012 +1100

    Fixed a bug with ConversationsModel where it wasn't actually setting the textChannel on revalidated chats.
    Fixed a bug with MessagesModel where signals weren't getting set up properly when textChannel was changed.
---
 KTp/Declarative/conversations-model.cpp | 16 ++++++++++------
 KTp/Declarative/messages-model.cpp      | 19 +++++++++----------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/KTp/Declarative/conversations-model.cpp b/KTp/Declarative/conversations-model.cpp
index 5cf1c44..6f230f2 100644
--- a/KTp/Declarative/conversations-model.cpp
+++ b/KTp/Declarative/conversations-model.cpp
@@ -59,21 +59,25 @@ ConversationsModel::ConversationsModel() :
 
 void ConversationsModel::onInconmingConversation ( Conversation* newConvo )
 {
-    bool found = false;
+    //check if conversation's channel is already being handled, if so replace it
+    bool handled = false;
     Tp::TextChannelPtr newChannel = newConvo->model()->textChannel();
     if (!newChannel->targetHandleType() == Tp::HandleTypeNone) {
 
-        //loop through all tabs checking for matches
+        //loop through all conversations checking for matches
         Q_FOREACH(Conversation *convo, d->conversations) {
-            if (convo->target()->id() == newChannel->targetId()
-            && convo->model()->textChannel()->targetHandleType() == newChannel->targetHandleType()) {
-                found = true;
+            if (convo->target()->id() == newChannel->targetId() &&
+                convo->model()->textChannel()->targetHandleType() == newChannel->targetHandleType()) {
+
+                convo->model()->setTextChannel(newChannel);
+                newConvo->deleteLater();
+                handled = true;
                 break;
             }
         }
     }
 
-    if(!found) {
+    if(!handled) {
         beginInsertRows(QModelIndex(), rowCount(), rowCount());
         d->conversations.append(newConvo);
         endInsertRows();
diff --git a/KTp/Declarative/messages-model.cpp b/KTp/Declarative/messages-model.cpp
index eb2c912..e81c5af 100644
--- a/KTp/Declarative/messages-model.cpp
+++ b/KTp/Declarative/messages-model.cpp
@@ -99,19 +99,18 @@ void MessagesModel::setTextChannel(Tp::TextChannelPtr channel)
     setupChannelSignals(channel);
 
     if (d->textChannel) {
-        removeChannelSignals(channel);
+        removeChannelSignals(d->textChannel);
     }
-    //FIXME: check messageQue for any lost messages
-    d->textChannel = channel;
 
-    Q_EMIT textChannelChanged(channel);
+    d->textChannel = channel;
+    Q_EMIT textChannelChanged(d->textChannel);
 
-    QList<Tp::ReceivedMessage> queue
-    = channel->messageQueue();
-    Q_FOREACH(Tp::ReceivedMessage message, queue
-             ) {
+    QList<Tp::ReceivedMessage> messageQueue = channel->messageQueue();
+    Q_FOREACH(Tp::ReceivedMessage message, messageQueue) {
         bool messageAlreadyInModel = false;
         Q_FOREACH(MessageItem current, d->messages) {
+            //FIXME: docs say messageToken can return an empty string. What to do if that happens?
+            //Tp::Message has an == operator. maybe I can use that?
             if (current.id == message.messageToken()) {
                 messageAlreadyInModel = true;
             }
@@ -127,6 +126,7 @@ void MessagesModel::onMessageReceived(Tp::ReceivedMessage message)
     int unreadCount = d->textChannel->messageQueue().size();
     kDebug() << "unreadMessagesCount =" << unreadCount;
     kDebug() << "text =" << message.text();
+    kDebug() << "messageToken =" << message.messageToken();
 
     if (message.messageType() == Tp::ChannelTextMessageTypeNormal) {
         int length = rowCount();
@@ -287,9 +287,8 @@ void MessagesModel::printallmessages()
         kDebug() << msg.text;
     }
     beginResetModel();
-    d->messages.clear();
+//     d->messages.clear();
     endResetModel();
 }
 
 #include "moc_messages-model.cpp"
-// kate: indent-mode cstyle; space-indent on; indent-width 4; replace-tabs on; 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list