dbus access problem

Jaroslaw Staniek js at iidea.pl
Mon Jul 14 11:37:26 CEST 2008


Ralf Habacker said the following, On 2008-07-14 10:28:
> Hi,
> 
> currently I'm extending kdeinit4 with a save application close feature 
> which calls the quit() method of /MainApplication over dbus using the 
> following code:
> 
>     QDBusConnection connection = QDBusConnection::sessionBus();
>     QDBusConnectionInterface *bus = connection.interface();
>     const QStringList services = bus->registeredServiceNames();
>     foreach(const QString &service, services) {
>         if (!service.startsWith("org.kde"))
>             continue;
>         QDBusInterface *iface = new QDBusInterface(service,
>                                QLatin1String("/MainApplication"),
>                                QLatin1String("org.kde.KApplication"),
>                                QDBusConnection::sessionBus());
>         qDebug() << "killing " << service;
>         iface->call("quit");
>         qDebug() << iface->lastError();                                   
> 
> This code worked until yesterday without any problems.  Yesterday I 
> updated to recent dbus svn source and now this code does not work anymore.
> 
> [3804] Debug:killing  "org.kde.kate-4724"
> [3804] Debug:QDBusError("org.freedesktop.DBus.Error.UnknownInterface", 
> "No such interface 'org.kde.KApplication' at object path 
> '/MainApplication'")
> 
> The same behavior could be reproduced with qdbusviewer.

Did you use the original dbus (without my changes) before yesterday?

What I changed is the internal service name for unique applications.

See bool KUniqueApplication::start(StartFlags flags).

E.g. org.kde.kmail changed to org.kde.kmail.unique-{pid}. But if you query for 
org.kde.kmail, dbus returns true, since internally it strips out the 
.unique{pid} suffix.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)


More information about the Kde-windows mailing list