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


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

The following commit has been merged in the master branch:
commit 4a1c478ca45753807c0f0975589acd9e0a8e6590
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Wed Sep 28 13:40:55 2011 +0200

    Add config change propagation over dbus, makes sure the plugins are informed about changes in KCM
    
    Reviewed-by: George Kiagiadakis
---
 autoaway.cpp                     | 44 ++++++++++++++++++++++++++--------------
 autoaway.h                       |  5 +++++
 config/telepathy-kded-config.cpp |  5 +++++
 telepathy-module.cpp             | 14 +++++++++++--
 telepathy-module.h               |  3 +++
 telepathy-mpris.cpp              |  5 +++++
 telepathy-mpris.h                |  1 +
 7 files changed, 60 insertions(+), 17 deletions(-)

diff --git a/autoaway.cpp b/autoaway.cpp
index 28f6d46..22bab24 100644
--- a/autoaway.cpp
+++ b/autoaway.cpp
@@ -28,23 +28,12 @@
 #include <KConfigGroup>
 
 AutoAway::AutoAway(const Tp::AccountManagerPtr& am, QObject* parent)
-    : QObject(parent)
+    : QObject(parent),
+      m_awayTimeoutId(-1),
+      m_extAwayTimeoutId(-1)
 {
-    KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
-    KConfigGroup kdedConfig = config->group("KDED");
-
-    bool autoAwayEnabled = kdedConfig.readEntry("autoAwayEnabled", true);
-    bool autoXAEnabled = kdedConfig.readEntry("autoXAEnabled", true);
-
+    readConfig();
     m_accountManager = am;
-    if (autoAwayEnabled) {
-        int awayTime = kdedConfig.readEntry("awayAfter", 5);
-        m_awayTimeoutId = KIdleTime::instance()->addIdleTimeout(awayTime * 60 * 1000);
-    }
-    if (autoAwayEnabled && autoXAEnabled) {
-        int xaTime = kdedConfig.readEntry("xaAfter", 15);
-        m_extAwayTimeoutId = KIdleTime::instance()->addIdleTimeout(xaTime * 60 * 1000);
-    }
     m_prevPresence = Tp::Presence::available();
 
     connect(KIdleTime::instance(), SIGNAL(timeoutReached(int)),
@@ -86,3 +75,28 @@ void AutoAway::backFromIdle()
     kDebug();
     emit setPresence(m_prevPresence);
 }
+
+void AutoAway::readConfig()
+{
+    KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+    KConfigGroup kdedConfig = config->group("KDED");
+
+    bool autoAwayEnabled = kdedConfig.readEntry("autoAwayEnabled", true);
+    bool autoXAEnabled = kdedConfig.readEntry("autoXAEnabled", true);
+
+    if (autoAwayEnabled) {
+        int awayTime = kdedConfig.readEntry("awayAfter", 5);
+        m_awayTimeoutId = KIdleTime::instance()->addIdleTimeout(awayTime * 60 * 1000);
+    } else if (!autoAwayEnabled && m_awayTimeoutId != -1) {
+        KIdleTime::instance()->removeAllIdleTimeouts();
+    }
+    if (autoAwayEnabled && autoXAEnabled) {
+        int xaTime = kdedConfig.readEntry("xaAfter", 15);
+        m_extAwayTimeoutId = KIdleTime::instance()->addIdleTimeout(xaTime * 60 * 1000);
+    }
+}
+
+void AutoAway::onSettingsChanged()
+{
+    readConfig();
+}
diff --git a/autoaway.h b/autoaway.h
index 4b716fa..a95f49a 100644
--- a/autoaway.h
+++ b/autoaway.h
@@ -34,9 +34,14 @@ public:
     AutoAway(const Tp::AccountManagerPtr& am, QObject* parent = 0);
     ~AutoAway();
 
+    void readConfig();
+
 Q_SIGNALS:
     void setPresence(const Tp::Presence &presence);
 
+public Q_SLOTS:
+    void onSettingsChanged();
+
 private Q_SLOTS:
     void timeoutReached(int);
     void backFromIdle();
diff --git a/config/telepathy-kded-config.cpp b/config/telepathy-kded-config.cpp
index 8b17aa4..a36f632 100644
--- a/config/telepathy-kded-config.cpp
+++ b/config/telepathy-kded-config.cpp
@@ -23,6 +23,8 @@
 
 #include <KPluginFactory>
 #include <KLocalizedString>
+#include <QDBusMessage>
+#include <QDBusConnection>
 
 K_PLUGIN_FACTORY(KCMTelepathyKDEDModuleConfigFactory, registerPlugin<TelepathyKDEDConfig>();)
 K_EXPORT_PLUGIN(KCMTelepathyKDEDModuleConfigFactory("telepathy_kded_module_config", "kcm_telepathy_kded_module_config"))
@@ -105,6 +107,9 @@ void TelepathyKDEDConfig::save()
     kdedConfig.writeEntry("xaAfter", ui->m_xaMins->value());
     kdedConfig.writeEntry("nowPlayingEnabled", ui->m_nowPlayingCheckBox->isChecked());
     kdedConfig.sync();
+
+    QDBusMessage message = QDBusMessage::createSignal("/Telepathy", "org.kde.Telepathy", "settingsChange");
+    QDBusConnection::sessionBus().send(message);
 }
 
 void TelepathyKDEDConfig::autoAwayChecked(bool checked)
diff --git a/telepathy-module.cpp b/telepathy-module.cpp
index 6f2f44c..a355d84 100644
--- a/telepathy-module.cpp
+++ b/telepathy-module.cpp
@@ -20,15 +20,15 @@
 #include "telepathy-module.h"
 
 #include <KPluginFactory>
+#include <KDebug>
 
 #include <TelepathyQt4/AccountFactory>
 #include <TelepathyQt4/PendingOperation>
 #include <TelepathyQt4/PendingReady>
+#include <TelepathyQt4/Debug>
 
 #include "telepathy-mpris.h"
 #include "autoaway.h"
-#include <KDebug>
-#include <TelepathyQt4/Debug>
 
 K_PLUGIN_FACTORY(TelepathyModuleFactory, registerPlugin<TelepathyModule>(); )
 K_EXPORT_PLUGIN(TelepathyModuleFactory("telepathy_module"))
@@ -58,6 +58,10 @@ TelepathyModule::TelepathyModule(QObject* parent, const QList<QVariant>& args)
     connect(m_accountManager->becomeReady(),
             SIGNAL(finished(Tp::PendingOperation*)),
             SLOT(onAccountManagerReady(Tp::PendingOperation*)));
+
+    QDBusConnection::sessionBus().connect(QString(), "/Telepathy", "org.kde.Telepathy",
+                                          "settingsChange", this, SIGNAL(settingsChanged()) );
+
 }
 
 TelepathyModule::~TelepathyModule()
@@ -74,9 +78,15 @@ void TelepathyModule::onAccountManagerReady(Tp::PendingOperation* op)
     connect(m_autoAway, SIGNAL(setPresence(Tp::Presence)),
             this, SLOT(setPresence(Tp::Presence)));
 
+    connect(this, SIGNAL(settingsChanged()),
+            m_autoAway, SLOT(onSettingsChanged()));
+
     m_mpris = new TelepathyMPRIS(m_accountManager, this);
     connect(m_mpris, SIGNAL(setPresence(Tp::Presence)),
             this, SLOT(setPresence(Tp::Presence)));
+
+    connect(this, SIGNAL(settingsChanged()),
+            m_mpris, SLOT(onSettingsChanged()));
 }
 
 void TelepathyModule::setPresence(const Tp::Presence &presence)
diff --git a/telepathy-module.h b/telepathy-module.h
index 61128a2..474b67f 100644
--- a/telepathy-module.h
+++ b/telepathy-module.h
@@ -39,6 +39,9 @@ public:
     TelepathyModule(QObject *parent, const QList<QVariant> &args);
     ~TelepathyModule();
 
+Q_SIGNALS:
+    void settingsChanged();
+
 public Q_SLOTS:
     void setPresence(const Tp::Presence& presence);
 
diff --git a/telepathy-mpris.cpp b/telepathy-mpris.cpp
index 036df5a..4752b80 100644
--- a/telepathy-mpris.cpp
+++ b/telepathy-mpris.cpp
@@ -125,3 +125,8 @@ void TelepathyMPRIS::onPlayerSignalReceived(const QString &interface, const QVar
     }
 
 }
+
+void TelepathyMPRIS::onSettingsChanged()
+{
+
+}
diff --git a/telepathy-mpris.h b/telepathy-mpris.h
index 334616d..5dd596f 100644
--- a/telepathy-mpris.h
+++ b/telepathy-mpris.h
@@ -35,6 +35,7 @@ public:
 
 public Q_SLOTS:
     void onPlayerSignalReceived(const QString &interface, const QVariantMap &changedProperties, const QStringList &invalidatedProperties);
+    void onSettingsChanged();
 
 Q_SIGNALS:
     void setPresence(const Tp::Presence &presence);

-- 
ktp-kded-integration-module packaging



More information about the pkg-kde-commits mailing list