[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:20:51 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=dc0ff2d

The following commit has been merged in the master branch:
commit dc0ff2dcb665ec8a6200c1a7548891aa1bec5fc6
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.
---
 lib/conversations-model.cpp | 16 ++++++++++------
 lib/messages-model.cpp      | 19 +++++++++----------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/lib/conversations-model.cpp b/lib/conversations-model.cpp
index 5cf1c44..6f230f2 100644
--- a/lib/conversations-model.cpp
+++ b/lib/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/lib/messages-model.cpp b/lib/messages-model.cpp
index eb2c912..e81c5af 100644
--- a/lib/messages-model.cpp
+++ b/lib/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-text-ui packaging



More information about the pkg-kde-commits mailing list