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
=== modified file 'src/statusnotifieritem.cpp'
--- src/statusnotifieritem.cpp 2011-09-27 10:31:01 +0000
+++ src/statusnotifieritem.cpp 2015-07-04 13:56:32 +0000
@@ -64,11 +64,15 @@
64 registerMetaTypes();64 registerMetaTypes();
6565
66 static int id = 1;66 static int id = 1;
67 m_objectPath = QString("/org/kde/statusnotifieritem/%1").arg(id++);67 m_serviceName = QString("org.kde.StatusNotifierItem-%1-%2").arg(QCoreApplication::applicationPid()).arg(id++);
68 SNI_VAR(m_serviceName);
69
70 m_objectPath = QString("/StatusNotifierItem");
68 SNI_VAR(m_objectPath);71 SNI_VAR(m_objectPath);
6972
70 new StatusNotifierItemAdaptor(this);73 new StatusNotifierItemAdaptor(this);
71 QDBusConnection bus = QDBusConnection::sessionBus();74 QDBusConnection bus = QDBusConnection::sessionBus();
75 bus.registerService(m_serviceName);
72 bus.registerObject(m_objectPath, this, QDBusConnection::ExportAdaptors);76 bus.registerObject(m_objectPath, this, QDBusConnection::ExportAdaptors);
7377
74 updateMenu();78 updateMenu();
@@ -77,6 +81,11 @@
77StatusNotifierItem::~StatusNotifierItem()81StatusNotifierItem::~StatusNotifierItem()
78{82{
79 SNI_VAR(this);83 SNI_VAR(this);
84
85 QDBusConnection bus = QDBusConnection::sessionBus();
86 bus.unregisterObject(m_objectPath, QDBusConnection::UnregisterTree);
87 bus.unregisterService(m_serviceName);
88
80 // m_dbusMenuExporter is a child of the menu it exports, so we need to use89 // m_dbusMenuExporter is a child of the menu it exports, so we need to use
81 // a QWeakPointer to track it:90 // a QWeakPointer to track it:
82 //91 //
@@ -208,6 +217,11 @@
208 return m_iconCache->nameForIcon(icon);217 return m_iconCache->nameForIcon(icon);
209}218}
210219
220QString StatusNotifierItem::serviceName() const
221{
222 return m_serviceName;
223}
224
211QString StatusNotifierItem::objectPath() const225QString StatusNotifierItem::objectPath() const
212{226{
213 return m_objectPath;227 return m_objectPath;
214228
=== modified file 'src/statusnotifieritem.h'
--- src/statusnotifieritem.h 2011-09-27 10:31:01 +0000
+++ src/statusnotifieritem.h 2015-07-04 13:56:32 +0000
@@ -56,6 +56,7 @@
56 StatusNotifierItem(QSystemTrayIcon*, IconCache*);56 StatusNotifierItem(QSystemTrayIcon*, IconCache*);
57 ~StatusNotifierItem();57 ~StatusNotifierItem();
5858
59 QString serviceName() const;
59 QString objectPath() const;60 QString objectPath() const;
6061
61 // QAbstractSystemTrayIconSys62 // QAbstractSystemTrayIconSys
@@ -101,6 +102,7 @@
101 void sendActivatedByTrigger();102 void sendActivatedByTrigger();
102103
103private:104private:
105 QString m_serviceName;
104 QString m_objectPath;106 QString m_objectPath;
105 IconCache* m_iconCache;107 IconCache* m_iconCache;
106 QWeakPointer<DBusMenuExporter> m_dbusMenuExporter;108 QWeakPointer<DBusMenuExporter> m_dbusMenuExporter;
107109
=== modified file 'src/statusnotifieritemfactory.cpp'
--- src/statusnotifieritemfactory.cpp 2011-10-14 21:41:08 +0000
+++ src/statusnotifieritemfactory.cpp 2015-07-04 13:56:32 +0000
@@ -145,7 +145,7 @@
145{145{
146 SNI_DEBUG;146 SNI_DEBUG;
147 QDBusInterface snw(SNW_SERVICE, SNW_PATH, SNW_IFACE);147 QDBusInterface snw(SNW_SERVICE, SNW_PATH, SNW_IFACE);
148 snw.asyncCall("RegisterStatusNotifierItem", item->objectPath());148 snw.asyncCall("RegisterStatusNotifierItem", item->serviceName());
149}149}
150150
151151

Subscribers

People subscribed via source and target branches