[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:15:04 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-kded-module.git;a=commitdiff;h=9b8f174
The following commit has been merged in the master branch:
commit 9b8f17433a7b14b256c1eb9272186c0f00ab416f
Author: Dominik Cermak <d.cermak at arcor.de>
Date: Sun Mar 31 19:53:09 2013 +0200
Stop using mission-control for autoconnect
Instead use our kded-module.
BUG: 307175
FIXED-IN: 0.7.0
REVIEW: 109807
---
autoconnect.cpp | 40 ++++++++++++++--------------------------
autoconnect.h | 10 ++++++----
telepathy-module.cpp | 17 +++--------------
3 files changed, 23 insertions(+), 44 deletions(-)
diff --git a/autoconnect.cpp b/autoconnect.cpp
index 526b060..b779426 100644
--- a/autoconnect.cpp
+++ b/autoconnect.cpp
@@ -21,11 +21,14 @@
#include <KConfig>
+#include <KTp/presence.h>
+
AutoConnect::AutoConnect(QObject *parent)
: QObject(parent)
{
KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
m_kdedConfig = config->group("KDED");
+ m_presenceConfig = config->group("LastPresence");
}
AutoConnect::~AutoConnect()
@@ -35,41 +38,26 @@ AutoConnect::~AutoConnect()
void AutoConnect::setAccountManager(const Tp::AccountManagerPtr &accountManager)
{
m_accountManager = accountManager;
- onSettingsChanged();
-}
-void AutoConnect::setAutomaticPresence(const Tp::Presence &presence)
-{
+ uint presenceType = m_presenceConfig.readEntry<uint>(QLatin1String("PresenceType"), (uint)Tp::ConnectionPresenceTypeOffline);
+ QString presenceStatus = m_presenceConfig.readEntry(QLatin1String("PresenceStatus"), QString());
+ QString presenceMessage = m_presenceConfig.readEntry(QLatin1String("PresenceMessage"), QString());
+
QString autoConnectString = m_kdedConfig.readEntry(QLatin1String("autoConnect"), modeToString(AutoConnect::Manual));
Mode autoConnectMode = stringToMode(autoConnectString);
- // Don't interfere if the user set it to manual.
- if (autoConnectMode != AutoConnect::Manual) {
+ if (autoConnectMode == AutoConnect::Enabled) {
Q_FOREACH(Tp::AccountPtr account, m_accountManager->allAccounts()) {
- if ((autoConnectMode == AutoConnect::Enabled) && (account->automaticPresence() != presence)) {
- account->setAutomaticPresence(presence);
- } else if ((autoConnectMode == AutoConnect::Disabled) && (account->automaticPresence() != Tp::Presence::available())) {
- // The user disabled it, so reset the automatic presence to its default value (available).
- account->setAutomaticPresence(Tp::Presence::available());
- }
+ account->setRequestedPresence(Tp::Presence((Tp::ConnectionPresenceType)presenceType, presenceStatus, presenceMessage));
}
}
}
-void AutoConnect::onSettingsChanged()
+void AutoConnect::savePresence(const KTp::Presence &presence)
{
- if (m_accountManager) {
- QString autoConnect = m_kdedConfig.readEntry(QLatin1String("autoConnect"), modeToString(AutoConnect::Manual));
+ m_presenceConfig.writeEntry(QLatin1String("PresenceType"), (uint)presence.type());
+ m_presenceConfig.writeEntry(QLatin1String("PresenceStatus"), presence.status());
+ m_presenceConfig.writeEntry(QLatin1String("PresenceMessage"), presence.statusMessage());
- // Don't interfere if the user set it to manual.
- if (autoConnect != modeToString(AutoConnect::Manual)) {
- Q_FOREACH(Tp::AccountPtr account, m_accountManager->allAccounts()) {
- if ((autoConnect == modeToString(AutoConnect::Enabled)) && (!account->connectsAutomatically())) {
- account->setConnectsAutomatically(true);
- } else if ((autoConnect == modeToString(AutoConnect::Disabled)) && (account->connectsAutomatically())) {
- account->setConnectsAutomatically(false);
- }
- }
- }
- }
+ m_presenceConfig.sync();
}
diff --git a/autoconnect.h b/autoconnect.h
index e296012..aeb4b54 100644
--- a/autoconnect.h
+++ b/autoconnect.h
@@ -25,6 +25,10 @@
#include <KConfigGroup>
#include <KDebug>
+namespace KTp {
+ class Presence;
+}
+
class AutoConnect : public QObject
{
Q_OBJECT
@@ -40,6 +44,7 @@ public:
~AutoConnect();
void setAccountManager(const Tp::AccountManagerPtr &accountManager);
+ void savePresence(const KTp::Presence &presence);
/**
* rief Returns a string for the given enum value.
@@ -85,14 +90,11 @@ public:
}
};
-public Q_SLOTS:
- void onSettingsChanged();
- void setAutomaticPresence(const Tp::Presence &presence);
-
private:
Tp::AccountManagerPtr m_accountManager;
Tp::Presence m_presence;
KConfigGroup m_kdedConfig;
+ KConfigGroup m_presenceConfig;
};
#endif // AUTOCONNECT_H
diff --git a/telepathy-module.cpp b/telepathy-module.cpp
index a28bca8..c7a01b5 100644
--- a/telepathy-module.cpp
+++ b/telepathy-module.cpp
@@ -115,16 +115,13 @@ void TelepathyModule::onAccountManagerReady(Tp::PendingOperation* op)
m_autoConnect = new AutoConnect(this);
m_autoConnect->setAccountManager(m_accountManager);
- connect(this, SIGNAL(settingsChanged()),
- m_autoConnect, SLOT(onSettingsChanged()));
-
//earlier in list = higher priority
m_pluginStack << m_autoAway << m_mpris;
m_errorHandler = new ErrorHandler(m_accountManager, this);
m_contactHandler = new ContactRequestHandler(m_accountManager, this);
m_contactNotify = new ContactNotify(m_accountManager, this);
-
+
m_lastUserPresence = m_globalPresence->requestedPresence();
}
@@ -138,16 +135,8 @@ void TelepathyModule::onRequestedPresenceChanged(const KTp::Presence &presence)
//user is manually setting the presnece.
m_lastUserPresence = presence;
- KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
- KConfigGroup presenceConfig = config->group("LastPresence");
-
- presenceConfig.writeEntry(QLatin1String("PresenceType"), (uint)presence.type());
- presenceConfig.writeEntry(QLatin1String("PresenceStatus"), presence.status());
- presenceConfig.writeEntry(QLatin1String("PresenceMessage"), presence.statusMessage());
-
- presenceConfig.sync();
-
- m_autoConnect->setAutomaticPresence(presence);
+ //save presence (needed for autoconnect)
+ m_autoConnect->savePresence(presence);
}
void TelepathyModule::onPluginActivated(bool active)
--
ktp-kded-integration-module packaging
More information about the pkg-kde-commits
mailing list