[SCM] ktp-kded-integration-module packaging branch, master, updated. debian/15.12.1-2-382-gbd961c2

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:12:50 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-kded-module.git;a=commitdiff;h=36a1545

The following commit has been merged in the master branch:
commit 36a1545df531d725127a641b29e0515c166a788c
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Sun Oct 23 22:12:30 2011 +0200

    Activate 'Now playing...' plugin only when requested from contact list
    
    Reviewed-by: David Edmundson
    REVIEW: 102949
---
 telepathy-mpris.cpp | 27 +++++++++++++++++++++++++--
 telepathy-mpris.h   |  3 +++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/telepathy-mpris.cpp b/telepathy-mpris.cpp
index f35bce8..b6c530b 100644
--- a/telepathy-mpris.cpp
+++ b/telepathy-mpris.cpp
@@ -30,7 +30,8 @@
 #include "global-presence.h"
 
 TelepathyMPRIS::TelepathyMPRIS(GlobalPresence* globalPresence, QObject* parent)
-    : TelepathyKDEDModulePlugin(globalPresence, parent)
+    : TelepathyKDEDModulePlugin(globalPresence, parent),
+      m_presenceActivated(false)
 {
     setPluginPriority(50);
 
@@ -40,6 +41,12 @@ TelepathyMPRIS::TelepathyMPRIS(GlobalPresence* globalPresence, QObject* parent)
     //watch for new mpris-enabled players
     connect(QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
             this, SLOT(serviceOwnerChanged(QString,QString,QString)));
+
+    QDBusConnection::sessionBus().connect(QString(), QLatin1String("/Telepathy"), QLatin1String("org.kde.Telepathy"),
+                                          QLatin1String("activateNowPlaying"), this, SLOT(onActivateNowPlaying()) );
+
+    QDBusConnection::sessionBus().connect(QString(), QLatin1String("/Telepathy"), QLatin1String("org.kde.Telepathy"),
+                                          QLatin1String("deactivateNowPlaying"), this, SLOT(onDeactivateNowPlaying()) );
 }
 
 TelepathyMPRIS::~TelepathyMPRIS()
@@ -120,7 +127,9 @@ void TelepathyMPRIS::onPlayerSignalReceived(const QString &interface, const QVar
         presence.statusMessage = QString(QLatin1String("Now listening to %1 by %2 from album %3")).arg(title, artist, album);
 
         setRequestedPresence(Tp::Presence(presence));
-        setActive(true);
+        if (m_presenceActivated) {
+            setActive(true);
+        }
     } else {
         setActive(false);
     }
@@ -187,3 +196,17 @@ void TelepathyMPRIS::serviceOwnerChanged(const QString& a, const QString& b, con
         detectPlayers();
     }
 }
+
+void TelepathyMPRIS::onActivateNowPlaying()
+{
+    kDebug() << "Plugin activated";
+    m_presenceActivated = true;
+    detectPlayers();
+}
+
+void TelepathyMPRIS::onDeactivateNowPlaying()
+{
+    kDebug() << "Plugin deactivated on CL request";
+    m_presenceActivated = false;
+    setActive(false);
+}
diff --git a/telepathy-mpris.h b/telepathy-mpris.h
index 8504a8b..fbcd237 100644
--- a/telepathy-mpris.h
+++ b/telepathy-mpris.h
@@ -38,12 +38,15 @@ public Q_SLOTS:
     void onSettingsChanged();
     void detectPlayers();
     void serviceOwnerChanged(const QString &a, const QString &b, const QString &c);
+    void onActivateNowPlaying();
+    void onDeactivateNowPlaying();
 
 Q_SIGNALS:
     void togglePlaybackActive(bool);
 
 private:
     QStringList m_knownPlayers;
+    bool m_presenceActivated;
 };
 
 #endif // TELEPATHY_MPRIS_H

-- 
ktp-kded-integration-module packaging



More information about the pkg-kde-commits mailing list