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


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

The following commit has been merged in the master branch:
commit 4bc749a79027fda4f7d6f66823dcef69c3d8c9bf
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Sat Apr 12 14:39:40 2014 +0200

    Propagate TextChannelWatcherProxyModel data from subcontacts to persons
    
    FIXED-IN: 0.8.1
    BUG: 332898
---
 KTp/Models/text-channel-watcher-proxy-model.cpp | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/KTp/Models/text-channel-watcher-proxy-model.cpp b/KTp/Models/text-channel-watcher-proxy-model.cpp
index 7171697..6e69c59 100644
--- a/KTp/Models/text-channel-watcher-proxy-model.cpp
+++ b/KTp/Models/text-channel-watcher-proxy-model.cpp
@@ -174,7 +174,25 @@ void KTp::TextChannelWatcherProxyModel::observeChannels(const Tp::MethodInvocati
 
 QVariant KTp::TextChannelWatcherProxyModel::data(const QModelIndex &proxyIndex, int role) const
 {
+    // if we're processing a person and either of those two roles,
+    // we propagate the data from sub contacts
+    if (proxyIndex.model()->rowCount(proxyIndex) > 0
+        && (role == KTp::ContactHasTextChannelRole || role == KTp::ContactUnreadMessageCountRole)) {
+        QVariant personData;
+
+        for (int i = 0; i < proxyIndex.model()->rowCount(proxyIndex); i++) {
+            QVariant data = proxyIndex.child(i, 0).data(role);
+            if (!data.isNull()) {
+                personData = data;
+                break;
+            }
+        }
+
+        return personData;
+    }
+
     const QModelIndex sourceIndex = mapToSource(proxyIndex);
+
     if (role == KTp::ContactHasTextChannelRole) {
         KTp::ContactPtr contact = sourceIndex.data(KTp::ContactRole).value<KTp::ContactPtr>();
         if (contact) {
@@ -182,7 +200,7 @@ QVariant KTp::TextChannelWatcherProxyModel::data(const QModelIndex &proxyIndex,
                 return true;
             }
         }
-        return false;
+        return QVariant();
     }
 
     if (role == KTp::ContactUnreadMessageCountRole) {
@@ -192,7 +210,7 @@ QVariant KTp::TextChannelWatcherProxyModel::data(const QModelIndex &proxyIndex,
                 return d->currentChannels[contact]->unreadMessageCount();
             }
         }
-        return 0;
+        return QVariant();
     }
     if (role == KTp::ContactLastMessageRole) {
         KTp::ContactPtr contact = sourceIndex.data(KTp::ContactRole).value<KTp::ContactPtr>();

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list