Merge lp:~muktupavels/sni-qt/fix-register-item-call into lp:sni-qt

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: 99
Merged at revision: 100
Proposed branch: lp:~muktupavels/sni-qt/fix-register-item-call
Merge into: lp:sni-qt
Diff against target: 75 lines (+18/-2)
3 files modified
src/statusnotifieritem.cpp (+15/-1)
src/statusnotifieritem.h (+2/-0)
src/statusnotifieritemfactory.cpp (+1/-1)
To merge this branch: bzr merge lp:~muktupavels/sni-qt/fix-register-item-call
Reviewer Review Type Date Requested Status
Dmitry Shachnev Approve
Łukasz Zemczak Approve
Renato Araujo Oliveira Filho Pending
Review via email: mp+263828@code.launchpad.net

Commit message

Fix RegisterStatusNotifier method call to match specification.

Description of the change

Fix RegisterStatusNotifier method call to match specification.

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Looks good to me, although I didn't test it thoroughly as I would like to test it. I approved the very same change in appmenu-qt5 though, but would be nice if someone else would also give it a spin before top-approving.

review: Approve
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/statusnotifieritem.cpp'
2--- src/statusnotifieritem.cpp 2011-09-27 10:31:01 +0000
3+++ src/statusnotifieritem.cpp 2015-07-04 13:56:32 +0000
4@@ -64,11 +64,15 @@
5 registerMetaTypes();
6
7 static int id = 1;
8- m_objectPath = QString("/org/kde/statusnotifieritem/%1").arg(id++);
9+ m_serviceName = QString("org.kde.StatusNotifierItem-%1-%2").arg(QCoreApplication::applicationPid()).arg(id++);
10+ SNI_VAR(m_serviceName);
11+
12+ m_objectPath = QString("/StatusNotifierItem");
13 SNI_VAR(m_objectPath);
14
15 new StatusNotifierItemAdaptor(this);
16 QDBusConnection bus = QDBusConnection::sessionBus();
17+ bus.registerService(m_serviceName);
18 bus.registerObject(m_objectPath, this, QDBusConnection::ExportAdaptors);
19
20 updateMenu();
21@@ -77,6 +81,11 @@
22 StatusNotifierItem::~StatusNotifierItem()
23 {
24 SNI_VAR(this);
25+
26+ QDBusConnection bus = QDBusConnection::sessionBus();
27+ bus.unregisterObject(m_objectPath, QDBusConnection::UnregisterTree);
28+ bus.unregisterService(m_serviceName);
29+
30 // m_dbusMenuExporter is a child of the menu it exports, so we need to use
31 // a QWeakPointer to track it:
32 //
33@@ -208,6 +217,11 @@
34 return m_iconCache->nameForIcon(icon);
35 }
36
37+QString StatusNotifierItem::serviceName() const
38+{
39+ return m_serviceName;
40+}
41+
42 QString StatusNotifierItem::objectPath() const
43 {
44 return m_objectPath;
45
46=== modified file 'src/statusnotifieritem.h'
47--- src/statusnotifieritem.h 2011-09-27 10:31:01 +0000
48+++ src/statusnotifieritem.h 2015-07-04 13:56:32 +0000
49@@ -56,6 +56,7 @@
50 StatusNotifierItem(QSystemTrayIcon*, IconCache*);
51 ~StatusNotifierItem();
52
53+ QString serviceName() const;
54 QString objectPath() const;
55
56 // QAbstractSystemTrayIconSys
57@@ -101,6 +102,7 @@
58 void sendActivatedByTrigger();
59
60 private:
61+ QString m_serviceName;
62 QString m_objectPath;
63 IconCache* m_iconCache;
64 QWeakPointer<DBusMenuExporter> m_dbusMenuExporter;
65
66=== modified file 'src/statusnotifieritemfactory.cpp'
67--- src/statusnotifieritemfactory.cpp 2011-10-14 21:41:08 +0000
68+++ src/statusnotifieritemfactory.cpp 2015-07-04 13:56:32 +0000
69@@ -145,7 +145,7 @@
70 {
71 SNI_DEBUG;
72 QDBusInterface snw(SNW_SERVICE, SNW_PATH, SNW_IFACE);
73- snw.asyncCall("RegisterStatusNotifierItem", item->objectPath());
74+ snw.asyncCall("RegisterStatusNotifierItem", item->serviceName());
75 }
76
77

Subscribers

People subscribed via source and target branches