on xenial help sign in
Fixed launcher-model unit-test.
5a5162cMirco Müller
plugins/Unity/Launcher/dbusinterface.cpp+8−3
@@ -128,13 +128,14 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
128 }
128 }
129
129
130 /* Break down the path to just the app id */
130 /* Break down the path to just the app id */
131+ bool validpath = true;
131 QString pathtemp = message.path();
132 QString pathtemp = message.path();
132 if (!pathtemp.startsWith("/com/canonical/Unity/Launcher/")) {
133 if (!pathtemp.startsWith("/com/canonical/Unity/Launcher/")) {
133− return false;
134+ validpath = false;
134 }
135 }
135 pathtemp.remove("/com/canonical/Unity/Launcher/");
136 pathtemp.remove("/com/canonical/Unity/Launcher/");
136 if (pathtemp.indexOf('/') >= 0) {
137 if (pathtemp.indexOf('/') >= 0) {
137− return false;
138+ validpath = false;
138 }
139 }
139
140
140 /* Find ourselves an appid */
141 /* Find ourselves an appid */
@@ -149,7 +150,7 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
149 }
150 }
150 } else if (message.interface() == "com.canonical.Unity.Launcher.Item") {
151 } else if (message.interface() == "com.canonical.Unity.Launcher.Item") {
151 // Handle methods of the Launcher-Item interface
152 // Handle methods of the Launcher-Item interface
152− if (message.member() == "Alert") {
153+ if (message.member() == "Alert" && validpath) {
153 QDBusMessage reply = message.createReply();
154 QDBusMessage reply = message.createReply();
154 Q_EMIT alertCalled(appid);
155 Q_EMIT alertCalled(appid);
155 return connection.send(reply);
156 return connection.send(reply);
@@ -165,6 +166,10 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
165 return false;
166 return false;
166 }
167 }
167
168
169+ if (!validpath) {
170+ return false;
171+ }
172+
168 int index = m_launcherModel->findApplication(appid);
173 int index = m_launcherModel->findApplication(appid);
169 LauncherItem *item = static_cast<LauncherItem*>(m_launcherModel->get(index));
174 LauncherItem *item = static_cast<LauncherItem*>(m_launcherModel->get(index));
170
175