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


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

The following commit has been merged in the master branch:
commit 9b0faf61543290c4a1fe46b25888ff4e06313bc8
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Mon Nov 26 07:52:23 2012 +0000

    Check clientTypes when ordering by presence
    
    Consider online + on phone as being less 'available' as someone who is just 'online'.
---
 KTp/Models/accounts-filter-model.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/KTp/Models/accounts-filter-model.cpp b/KTp/Models/accounts-filter-model.cpp
index 95afc85..882b134 100644
--- a/KTp/Models/accounts-filter-model.cpp
+++ b/KTp/Models/accounts-filter-model.cpp
@@ -918,10 +918,22 @@ bool AccountsFilterModel::lessThan(const QModelIndex &left, const QModelIndex &r
     switch (sortRole()) {
     case ContactsModel::PresenceTypeRole:
     {
-        Tp::ConnectionPresenceType leftPresence = (Tp::ConnectionPresenceType)sourceModel()->data(left, ContactsModel::PresenceTypeRole).toUInt();
-        Tp::ConnectionPresenceType rightPresence = (Tp::ConnectionPresenceType)sourceModel()->data(right, ContactsModel::PresenceTypeRole).toUInt();
+        Tp::ConnectionPresenceType leftPresence = (Tp::ConnectionPresenceType)left.data(ContactsModel::PresenceTypeRole).toUInt();
+        Tp::ConnectionPresenceType rightPresence = (Tp::ConnectionPresenceType)right.data(ContactsModel::PresenceTypeRole).toUInt();
 
         if (leftPresence == rightPresence) {
+            //presences are the same, compare client types
+
+            bool leftPhone = left.data(ContactsModel::ClientTypesRole).toStringList().contains(QLatin1String("phone"));
+            bool rightPhone = right.data(ContactsModel::ClientTypesRole).toStringList().contains(QLatin1String("phone"));
+
+            if (leftPhone && ! rightPhone) {
+                return false;
+            }
+            else if (rightPhone && !leftPhone) {
+                return true;
+            }
+
             return QString::localeAwareCompare(leftDisplayedName, rightDisplayedName) < 0;
         } else {
             if (leftPresence == Tp::ConnectionPresenceTypeAvailable) {

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list