[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:15:49 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=4b439cb

The following commit has been merged in the master branch:
commit 4b439cbee6af79a23a83b0b31e2aebc8cd83284c
Author: Peter Amidon <peter at picnicpark.org>
Date:   Tue Dec 4 19:47:24 2012 -0800

    Add plasma-themeability to the menu on the presence applet
    
    The Presence applet will show a Plasma-themed icon now if
    available. However, the context menu items for statuses are still
    all Oxygen, so the user experience is inconsistent -- if the
    user clicks on an icon for status, they won't get that icon
    on the plasmoid. This patch will make it so that those menu items
    are also Plasma-themed.
    
    REVIEW: 107545
---
 presence/src/presence-applet.cpp | 38 ++++++++++++++++++++++----------------
 presence/src/presence-applet.h   |  4 ++++
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/presence/src/presence-applet.cpp b/presence/src/presence-applet.cpp
index 291cde4..fa9e47f 100644
--- a/presence/src/presence-applet.cpp
+++ b/presence/src/presence-applet.cpp
@@ -130,16 +130,31 @@ void TelepathyPresenceApplet::init()
     connect(m_accountManager->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onAccountManagerReady(Tp::PendingOperation*)));
 }
 
+KIcon TelepathyPresenceApplet::getThemedIcon(const QString &iconBaseName) const
+{
+    Plasma::Svg svgIcon;
+    svgIcon.setImagePath("icons/presence-applet");
+
+    QString iconPlasmaName = iconBaseName + "-plasma";
+
+    if (svgIcon.hasElement(iconPlasmaName)) {
+	svgIcon.resize(150, 150);
+	return KIcon(svgIcon.pixmap(iconPlasmaName));
+    } else {
+	return KIcon(iconBaseName);
+    }
+}
+
 void TelepathyPresenceApplet::setupContextMenuActions()
 {
     KActionMenu *moreMenu = new KActionMenu(i18n("More"), this);
 
-    KAction *goOnlineAction = new KAction(KIcon("user-online"), i18n("Online"), this);
-    KAction *goBusyAction = new KAction(KIcon("user-busy"), i18n("Busy"), this);
-    KAction *goAwayAction = new KAction(KIcon("user-away"), i18n("Away"), this);
-    KAction *goExtendedAwayAction = new KAction(KIcon("user-away-extended"), i18n("Not Available"), this);
-    KAction *goHiddenAction = new KAction(KIcon("user-invisible"), i18n("Invisible"), this);
-    KAction *goOfflineAction = new KAction(KIcon("user-offline"), i18n("Offline"), this);
+    KAction *goOnlineAction = new KAction(getThemedIcon("user-online"), i18n("Online"), this);
+    KAction *goBusyAction = new KAction(getThemedIcon("user-busy"), i18n("Busy"), this);
+    KAction *goAwayAction = new KAction(getThemedIcon("user-away"), i18n("Away"), this);
+    KAction *goExtendedAwayAction = new KAction(getThemedIcon("user-away-extended"), i18n("Not Available"), this);
+    KAction *goHiddenAction = new KAction(getThemedIcon("user-invisible"), i18n("Invisible"), this);
+    KAction *goOfflineAction = new KAction(getThemedIcon("user-offline"), i18n("Offline"), this);
     KAction *joinChatroomAction = new KAction(KIcon("user-group-new"), i18n("Join Chat Room"), this);
 
     goOnlineAction->setData(QVariant::fromValue(KTp::Presence(Tp::Presence::available())));
@@ -268,16 +283,7 @@ void TelepathyPresenceApplet::onMakeCallRequest()
 void TelepathyPresenceApplet::onPresenceChanged(KTp::Presence presence)
 {
     QString iconBaseName = presence.iconName(false);
-
-    Plasma::Svg svgIcon;
-    svgIcon.setImagePath("icons/presence-applet");
-    if (svgIcon.hasElement(iconBaseName+"-plasma")) {
-        svgIcon.resize(150,150);
-        KIcon icon = KIcon(svgIcon.pixmap(iconBaseName+"-plasma"));
-        m_icon->setIcon(icon);
-    } else {
-        m_icon->setIcon(presence.icon());
-    }
+    m_icon->setIcon(getThemedIcon(iconBaseName));
 }
 
 void TelepathyPresenceApplet::onPresenceActionClicked()
diff --git a/presence/src/presence-applet.h b/presence/src/presence-applet.h
index 78ccfbd..3ae55cb 100644
--- a/presence/src/presence-applet.h
+++ b/presence/src/presence-applet.h
@@ -69,6 +69,10 @@ private Q_SLOTS:
     void onMakeCallRequest();
 
 private:
+
+    /** used to get the correct icon from either the Plasma theme or the Oxygen icon set */
+    KIcon getThemedIcon(const QString &iconBaseName) const;
+
     /** used only upon creation to setup a list of actions for the context menu */
     void setupContextMenuActions();
 

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list