From kde-commits Mon Mar 31 21:49:16 2014 From: David Faure Date: Mon, 31 Mar 2014 21:49:16 +0000 To: kde-commits Subject: [kdbusaddons] src: Resolve TODO: we can get the startup id from the env var here Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=139630256516971 Git commit e998c7ebbef0a7143b58123d0991af044b596015 by David Faure. Committed on 31/03/2014 at 13:57. Pushed by dfaure into branch 'master'. Resolve TODO: we can get the startup id from the env var here Also: call Activate rather than CommandLine, if no args; more standard. M +7 -4 src/kdbusservice.cpp http://commits.kde.org/kdbusaddons/e998c7ebbef0a7143b58123d0991af044b596015 diff --git a/src/kdbusservice.cpp b/src/kdbusservice.cpp index aada2c6..497c774 100644 --- a/src/kdbusservice.cpp +++ b/src/kdbusservice.cpp @@ -104,10 +104,13 @@ KDBusService::KDBusService(StartupOptions options, QO= bject *parent) QDBusInterface iface(d->serviceName, objectPath); iface.setTimeout(5 * 60 * 1000); // Application can take t= ime to answer QVariantMap platform_data; - - // TODO getter for startup id in qapp (documented to be em= pty after showing the first window) - // platform_data.insert("desktop-startup-id", ?); - QDBusReply reply =3D iface.call(QLatin1String("Comman= dLine"), QCoreApplication::arguments(), platform_data); + platform_data.insert(QStringLiteral("desktop-startup-id"),= QString::fromUtf8(qgetenv("DESKTOP_STARTUP_ID"))); + QDBusReply reply; + if (QCoreApplication::arguments().count() > 1) { + reply =3D iface.call(QLatin1String("CommandLine"), QCo= reApplication::arguments(), platform_data); + } else { + reply =3D iface.call(QLatin1String("Activate"), platfo= rm_data); + } if (reply.isValid()) { exit(reply.value()); } else {