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


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

The following commit has been merged in the master branch:
commit 7da6d4d38296ee487e6c4fa929c2408013137018
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Mon Dec 19 14:32:40 2011 +0100

    Add DBus exporter
---
 presence/src/presence-applet.cpp | 24 ++++++++++++++++++++++++
 presence/src/presence-applet.h   | 12 +++++++-----
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/presence/src/presence-applet.cpp b/presence/src/presence-applet.cpp
index 4417b62..417a11a 100644
--- a/presence/src/presence-applet.cpp
+++ b/presence/src/presence-applet.cpp
@@ -20,6 +20,8 @@
 #include "generalsettings.h"
 #include "presenceapplet.h"
 
+#include <QDBusAbstractAdaptor>
+
 #include <KAction>
 #include <KActionMenu>
 #include <KConfigDialog>
@@ -34,6 +36,20 @@
 #include <TelepathyQt/PendingOperation>
 #include <TelepathyQt/PendingReady>
 
+//-----------------------------------------------------------------------------------------
+
+class DBusExporter : public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.kde.Telepathy.PresenceApplet")
+
+public:
+    DBusExporter(QObject *parent = 0) : QDBusAbstractAdaptor(parent) {}
+    ~DBusExporter() {};
+};
+
+//-----------------------------------------------------------------------------------------
+
 TelepathyPresenceApplet::TelepathyPresenceApplet(QObject* parent, const QVariantList& args)
     : Plasma::PopupApplet(parent, args)
     , m_globalPresence(new KTp::GlobalPresence(this))
@@ -58,6 +74,8 @@ TelepathyPresenceApplet::TelepathyPresenceApplet(QObject* parent, const QVariant
 TelepathyPresenceApplet::~TelepathyPresenceApplet()
 {
     m_contextActions.clear();
+    QDBusConnection::sessionBus().unregisterObject("/PresenceAppletActive");
+    QDBusConnection::sessionBus().unregisterService("org.kde.Telepathy.PresenceAppletActive");
 }
 
 QList<QAction*> TelepathyPresenceApplet::contextualActions()
@@ -91,6 +109,10 @@ void TelepathyPresenceApplet::init()
     } else {
         m_onClickAction = DO_NOTHING;
     }
+
+    m_dbusExporter = new DBusExporter(this);
+    QDBusConnection::sessionBus().registerObject("/PresenceAppletActive", this, QDBusConnection::ExportAdaptors);
+    QDBusConnection::sessionBus().registerService("org.kde.Telepathy.PresenceAppletActive");
 }
 
 void TelepathyPresenceApplet::paintInterface(QPainter* p, const QStyleOptionGraphicsItem* option, const QRect& contentsRect)
@@ -248,6 +270,8 @@ void TelepathyPresenceApplet::updateClickAction(TelepathyPresenceApplet::OnClick
     m_onClickAction = clickAction;
 }
 
+#include "presenceapplet.moc"
+#include "moc_presenceapplet.cpp" //hack because we have two QObejcts in teh same file
 
 // This is the command that links your applet to the .desktop file
 K_EXPORT_PLASMA_APPLET(telepathy-kde-presence-applet, TelepathyPresenceApplet)
diff --git a/presence/src/presence-applet.h b/presence/src/presence-applet.h
index a6d76b1..1cc944d 100644
--- a/presence/src/presence-applet.h
+++ b/presence/src/presence-applet.h
@@ -39,6 +39,7 @@ namespace Tp {
 class GlobalPresenceWrapper;
 class KConfigDialog;
 class QAction;
+class DBusExporter;
 
 class TelepathyPresenceApplet: public Plasma::PopupApplet
 {
@@ -54,10 +55,10 @@ public:
     TelepathyPresenceApplet(QObject *parent, const QVariantList &args);
     ~TelepathyPresenceApplet();
 
-    QList<QAction*>contextualActions();
+    QList<QAction*> contextualActions();
     void createConfigurationInterface(KConfigDialog *parentDialog);
     void init();
-    void paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect& contentsRect);
+    void paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
 
 private Q_SLOTS:
     void onAccountManagerReady(Tp::PendingOperation *op);
@@ -78,11 +79,12 @@ private:
     /** used only upon creation to setup a list of actions for the context menu */
     void setupContextMenuActions();
 
-    QList<QAction*>m_contextActions;
+    QList<QAction*>       m_contextActions;
 
     Tp::AccountManagerPtr m_accountManager;
-    KTp::GlobalPresence *m_globalPresence;
-    OnClickAction m_onClickAction;
+    KTp::GlobalPresence  *m_globalPresence;
+    OnClickAction         m_onClickAction;
+    DBusExporter         *m_dbusExporter;
 };
 
 #endif  // TELEPATHY_KDE_PRESENCE_APPLET_H

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list