[SCM] ktp-contact-runner packaging branch, master, updated. debian/15.12.1-2-244-g38a1f58

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 17:50:24 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-runner.git;a=commitdiff;h=271a2c0

The following commit has been merged in the master branch:
commit 271a2c0bfb976bbff78407b84d26a42763adb8cf
Author: Dan Vrátil <dan at progdan.cz>
Date:   Mon Mar 12 00:47:05 2012 +0100

    Use KTp::Presence to get valid presence icon
---
 CMakeLists.txt    |  3 ++-
 contactrunner.cpp | 26 ++++++++------------------
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4cf3da..70df05c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,8 @@ target_link_libraries(krunner_ktp_contacts
                       ${KDE4_KDEUI_LIBS}
                       ${KDE4_KIO_LIBS}
                       ${TELEPATHY_QT4_LIBRARIES}
-                      ${KTP_MODELS_LIBRARIES})
+                      ${KTP_MODELS_LIBRARIES}
+                      ${KTP_LIBRARIES})
 
 install(TARGETS krunner_ktp_contacts
         DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/contactrunner.cpp b/contactrunner.cpp
index ed9e840..e53f16f 100644
--- a/contactrunner.cpp
+++ b/contactrunner.cpp
@@ -37,6 +37,7 @@
 
 #include <KTp/Models/accounts-model-item.h>
 #include <KTp/Models/contact-model-item.h>
+#include <KTp/presence.h>
 
 #include <QAction>
 
@@ -214,31 +215,25 @@ void ContactRunner::match(Plasma::RunnerContext& context)
                         contactIndex.data(AccountsModel::IdRole).toString());
             match.setType(Plasma::QueryMatch::ExactMatch);
 
-            QString iconName;
-            switch (contactIndex.data(AccountsModel::PresenceTypeRole).toInt()) {
+            KTp::Presence presence = contactIndex.data(AccountsModel::PresenceRole).value< KTp::Presence >();
+            switch (presence.type()) {
                 case Tp::ConnectionPresenceTypeAvailable:
-                    iconName = "im-user";
                     relevance *= 10;
                     break;
                 case Tp::ConnectionPresenceTypeBusy:
-                    iconName = "im-user-busy";
                     relevance *= 8;
                     break;
                 case Tp::ConnectionPresenceTypeAway:
                 case Tp::ConnectionPresenceTypeExtendedAway:
-                    iconName = "im-user-away";
                     relevance *= 6;
                     break;
                 case Tp::ConnectionPresenceTypeHidden:
-                    iconName = "im-invisible-user";
                     relevance *= 4;
                     break;
                 case Tp::ConnectionPresenceTypeOffline:
-                    iconName = "im-user-offline";
                     relevance *= 1;
                     break;
                 default:
-                    iconName = "im-user-offline";
                     relevance *= 1;
                     break;
             }
@@ -247,18 +242,13 @@ void ContactRunner::match(Plasma::RunnerContext& context)
             if (!iconFile.isEmpty() && QFile::exists(iconFile)) {
                 match.setIcon(QIcon(iconFile));
             } else {
-                match.setIcon(QIcon::fromTheme(iconName));
+                match.setIcon(presence.icon());
             }
 
-            QString status = contactIndex.data(AccountsModel::PresenceStatusRole).toString();
-            QString statusMessage = contactIndex.data(AccountsModel::PresenceMessageRole).toString();
-
-            if (status.isEmpty() && !statusMessage.isEmpty())
-                match.setSubtext(statusMessage);
-            else if (!status.isEmpty() && !statusMessage.isEmpty())
-                match.setSubtext(status.replace(0, 1, status.left(1).toUpper()) + " | " + statusMessage);
-            else if (!status.isEmpty() && statusMessage.isEmpty())
-                match.setSubtext(status.replace(0, 1, status.left(1).toUpper()));
+            if (!presence.statusMessage().isEmpty())
+                match.setSubtext(presence.displayString() + " | " + presence.statusMessage());
+            else
+                match.setSubtext(presence.displayString());
 
             match.setSelectedAction(defaultAction);
             match.setRelevance(relevance);

-- 
ktp-contact-runner packaging



More information about the pkg-kde-commits mailing list