on xenial help sign in
{ braces }
commit8008dfb2fd4e346b6ddebc2116c1772a7784501d authorTed Gould <ted@gould.cx> dateTue 29 Apr 2014, 10:35 (12 years ago) parentc27da63
1 file changed+20−11
plugins/Unity/Launcher/backend/launcherbackend.cpp+20−11
plugins/Unity/Launcher/backend/launcherbackend.cpp+20−11
@@ -50,10 +50,12 @@ LauncherBackend::LauncherBackend(QObject *parent):
5050
5151 /* Set up ourselves on DBus */
5252 QDBusConnection con = QDBusConnection::sessionBus();
53− if (!con.registerService("com.canonical.Unity.Launcher"))
53+ if (!con.registerService("com.canonical.Unity.Launcher")) {
5454 qDebug() << "Unable to register launcher name";
55− if (!con.registerVirtualObject("/com/canonical/Unity/Launcher", this, QDBusConnection::VirtualObjectRegisterOption::SubPath))
55+ }
56+ if (!con.registerVirtualObject("/com/canonical/Unity/Launcher", this, QDBusConnection::VirtualObjectRegisterOption::SubPath)) {
5657 qDebug() << "Unable to register launcher object";
58+ }
5759}
5860
5961LauncherBackend::~LauncherBackend()
@@ -423,35 +425,42 @@ bool LauncherBackend::isDefaultsItem(const QList<QVariantMap> &apps) const
423425bool LauncherBackend::handleMessage(const QDBusMessage& message, const QDBusConnection& connection)
424426{
425427 /* Check to make sure we're getting properties on our interface */
426− if (message.type() != QDBusMessage::MessageType::MethodCallMessage)
428+ if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
427429 return false;
428− if (message.interface() != "org.freedesktop.DBus.Properties")
430+ }
431+ if (message.interface() != "org.freedesktop.DBus.Properties") {
429432 return false;
430− if (message.arguments()[0].toString() != "com.canonical.Unity.Launcher.Item")
433+ }
434+ if (message.arguments()[0].toString() != "com.canonical.Unity.Launcher.Item") {
431435 return false;
436+ }
432437
433438 /* Break down the path to just the app id */
434439 QString pathtemp = message.path();
435− if (!pathtemp.startsWith("/com/canonical/Unity/Launcher/"))
440+ if (!pathtemp.startsWith("/com/canonical/Unity/Launcher/")) {
436441 return false;
442+ }
437443 pathtemp.remove("/com/canonical/Unity/Launcher/");
438− if (pathtemp.indexOf('/') >= 0)
444+ if (pathtemp.indexOf('/') >= 0) {
439445 return false;
446+ }
440447
441448 /* Find ourselves an appid */
442449 QString appid = decodeAppId(pathtemp);
443450 QVariantList retval;
444451
445452 if (message.member() == "Get") {
446− if (message.arguments()[1].toString() == "count")
453+ if (message.arguments()[1].toString() == "count") {
447454 retval.append(QVariant::fromValue(QDBusVariant(this->count(appid))));
448− else if (message.arguments()[1].toString() == "countVisible")
455+ } else if (message.arguments()[1].toString() == "countVisible") {
449456 retval.append(QVariant::fromValue(QDBusVariant(this->countVisible(appid))));
457+ }
450458 } else if (message.member() == "Set") {
451− if (message.arguments()[1].toString() == "count")
459+ if (message.arguments()[1].toString() == "count") {
452460 this->setCount(appid, message.arguments()[2].value<QDBusVariant>().variant().toInt());
453− else if (message.arguments()[1].toString() == "countVisible")
461+ } else if (message.arguments()[1].toString() == "countVisible") {
454462 this->setCountVisible(appid, message.arguments()[2].value<QDBusVariant>().variant().toBool());
463+ }
455464 } else if (message.member() == "GetAll") {
456465 retval.append(this->itemToVariant(appid));
457466 } else {