[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:10 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-kded-module.git;a=commitdiff;h=498fc29
The following commit has been merged in the master branch:
commit 498fc29bddebfeb3d5a4bf824bad14c901f025ce
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Sat May 4 13:13:36 2013 +0200
Add missing files
---
screensaveraway.cpp | 91 +++++++++++++++++++++++++++++++++++++++++
autoaway.h => screensaveraway.h | 25 +++++------
2 files changed, 101 insertions(+), 15 deletions(-)
diff --git a/screensaveraway.cpp b/screensaveraway.cpp
new file mode 100644
index 0000000..c7fdd75
--- /dev/null
+++ b/screensaveraway.cpp
@@ -0,0 +1,91 @@
+/*
+ Set away - option when screen saver activated-class
+ Copyright (C) 2013 Lucas Betschart <lucasbetschart at gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "screensaveraway.h"
+
+#include <QDBusConnectionInterface>
+#include <QDBusInterface>
+
+#include <TelepathyQt/AccountManager>
+#include <TelepathyQt/AccountSet>
+#include <KDebug>
+#include <KConfig>
+#include <KConfigGroup>
+#include <KTp/global-presence.h>
+
+ScreenSaverAway::ScreenSaverAway(KTp::GlobalPresence *globalPresence, QObject *parent)
+ : TelepathyKDEDModulePlugin(globalPresence, parent)
+{
+ readConfig();
+
+ //watch for screen locked
+ QDBusConnection::sessionBus().connect(QString(),
+ QLatin1String("/ScreenSaver"),
+ QLatin1String("org.freedesktop.ScreenSaver"),
+ QLatin1String("ActiveChanged"),
+ this,
+ SLOT(onActiveChanged(bool)) );
+}
+
+ScreenSaverAway::~ScreenSaverAway()
+{
+}
+
+QString ScreenSaverAway::pluginName() const
+{
+ return QString::fromLatin1("screen-saver-away");
+}
+
+void ScreenSaverAway::onActiveChanged(bool newState)
+{
+ if (!isEnabled()) {
+ return;
+ }
+
+ if (newState) {
+ setRequestedPresence(Tp::Presence::away(m_screenSaverAwayMessage));
+ setActive(true);
+ } else {
+ kDebug();
+ setActive(false);
+ }
+}
+
+void ScreenSaverAway::readConfig()
+{
+ KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+ config.data()->reparseConfiguration();
+
+ KConfigGroup kdedConfig = config->group("KDED");
+
+ bool screenSaverAwayEnabled = kdedConfig.readEntry("screenSaverAwayEnabled", true);
+
+ m_screenSaverAwayMessage = kdedConfig.readEntry(QLatin1String("screenSaverAwayMessage"), QString());
+
+ if (screenSaverAwayEnabled) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+}
+
+void ScreenSaverAway::onSettingsChanged()
+{
+ readConfig();
+}
diff --git a/autoaway.h b/screensaveraway.h
similarity index 69%
copy from autoaway.h
copy to screensaveraway.h
index 9496047..9332953 100644
--- a/autoaway.h
+++ b/screensaveraway.h
@@ -1,6 +1,6 @@
/*
- Auto away-presence setter-class
- Copyright (C) 2011 Martin Klapetek <martin.klapetek at gmail.com>
+ Set away - option when screen saver activated-class
+ Copyright (C) 2013 Lucas Betschart <lucasbetschart at gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,8 +18,8 @@
*/
-#ifndef AUTOAWAY_H
-#define AUTOAWAY_H
+#ifndef SCREENSAVERAWAY_H
+#define SCREENSAVERAWAY_H
#include "telepathy-kded-module-plugin.h"
@@ -30,13 +30,13 @@ namespace KTp {
class GlobalPresence;
}
-class AutoAway : public TelepathyKDEDModulePlugin
+class ScreenSaverAway : public TelepathyKDEDModulePlugin
{
Q_OBJECT
public:
- explicit AutoAway(KTp::GlobalPresence *globalPresence, QObject* parent = 0);
- ~AutoAway();
+ explicit ScreenSaverAway(KTp::GlobalPresence *globalPresence, QObject *parent = 0);
+ ~ScreenSaverAway();
void readConfig();
QString pluginName() const;
@@ -45,15 +45,10 @@ public Q_SLOTS:
void onSettingsChanged();
private Q_SLOTS:
- void timeoutReached(int);
- void backFromIdle();
+ void onActiveChanged(bool newState);
private:
- int m_awayTimeoutId;
- int m_extAwayTimeoutId;
-
- QString m_awayMessage;
- QString m_xaMessage;
+ QString m_screenSaverAwayMessage;
};
-#endif // AUTOAWAY_H
+#endif // SCREENSAVERAWAY_H
--
ktp-kded-integration-module packaging
More information about the pkg-kde-commits
mailing list