dbus access problem
Ralf Habacker
ralf.habacker at freenet.de
Wed Jul 16 16:17:27 CEST 2008
Jaroslaw Staniek schrieb:
> 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?
>
After digging more into this issue it looks that this problem stays
alredy some time
- at least in the version i tried, 4.0.73,4.0.80, 4.0.83 and recent svn
source some interfaces (org.kde and com.trolltech) in the Object Path
/MainApplication are not accessable.
This problem could be verifed by running the following commands on a
command shell
C:\Programme\kde-4\bin>kdeinit4 --verbose
kdeinit4: Launched dbus-launch.exe, pid = 2464
kdeinit4: Launched klauncher, pid = 3964
create process "C:\Programme\kde-4.0.0\bin\dbus-daemon.exe"
"C:\Programme\kde-4.0.0\bin\dbus-daemon.exe" --session
org.kde.klauncher is registered in dbus
kdeinit4: Launched kded4, pid = 1824
org.kde.kded is registered in dbus
C:\Programme\kde-4\bin>qdbus
:1.0
:1.1
org.kde.klauncher
:1.2
org.kde.kded
:1.4
org.freedesktop.DBus
C:\Programme\kde-4\bin>qdbus org.kde.kded
/
/MainApplication
/kbuildsycoca
/kded
/modules
/modules/winstartmenu
C:\Programme\kde-4\bin>qdbus org.kde.kded /MainApplication
method void org.kde.KApplication.quit()
method void org.kde.KApplication.reparseConfiguration()
method void org.kde.KApplication.updateUserTimestamp()
method void org.kde.KApplication.updateUserTimestamp(int time)
property readwrite int com.trolltech.Qt.QApplication.cursorFlashTime
property readwrite int com.trolltech.Qt.QApplication.doubleClickInterval
property readwrite QSize com.trolltech.Qt.QApplication.globalStrut
property readwrite int com.trolltech.Qt.QApplication.keyboardInputInterval
property readwrite bool com.trolltech.Qt.QApplication.quitOnLastWindowClosed
property readwrite int com.trolltech.Qt.QApplication.startDragDistance
property readwrite int com.trolltech.Qt.QApplication.startDragTime
property readwrite QString com.trolltech.Qt.QApplication.styleSheet
property readwrite int com.trolltech.Qt.QApplication.wheelScrollLines
property readwrite QString com.trolltech.Qt.QCoreApplication.applicationName
property readwrite QString
com.trolltech.Qt.QCoreApplication.applicationVersion
property readwrite QString
com.trolltech.Qt.QCoreApplication.organizationDomain
property readwrite QString
com.trolltech.Qt.QCoreApplication.organizationName
method int org.kde.KUniqueApplication.newInstance()
method int org.kde.KUniqueApplication.newInstance(QByteArray asn_id)
method int org.kde.KUniqueApplication.newInstance(QByteArray asn_id,
QByteArray args)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString
interface_name, QString property_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name,
QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
C:\Programme\kde-4\bin>qdbus org.kde.kded /MainApplication
org.freedesktop.DBus.Introspectable.Introspect
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.KApplication">
<method name="updateUserTimestamp">
<arg name="time" type="i" direction="in"/>
</method>
<method name="updateUserTimestamp">
</method>
<method name="reparseConfiguration">
</method>
<method name="quit">
</method>
</interface>
<interface name="com.trolltech.Qt.QApplication">
<property name="cursorFlashTime" type="i" access="readwrite"/>
<property name="doubleClickInterval" type="i" access="readwrite"/>
<property name="keyboardInputInterval" type="i" access="readwrite"/>
<property name="wheelScrollLines" type="i" access="readwrite"/>
<property name="globalStrut" type="(ii)" access="readwrite">
<annotation name="com.trolltech.QtDBus.QtTypeName" value="QSize"/>
</property>
<property name="startDragTime" type="i" access="readwrite"/>
<property name="startDragDistance" type="i" access="readwrite"/>
<property name="quitOnLastWindowClosed" type="b" access="readwrite"/>
<property name="styleSheet" type="s" access="readwrite"/>
</interface>
<interface name="com.trolltech.Qt.QCoreApplication">
<property name="applicationName" type="s" access="readwrite"/>
<property name="applicationVersion" type="s" access="readwrite"/>
<property name="organizationName" type="s" access="readwrite"/>
<property name="organizationDomain" type="s" access="readwrite"/>
</interface>
<interface name="org.kde.KUniqueApplication">
<method name="newInstance">
<arg type="i" direction="out"/>
<arg name="asn_id" type="ay" direction="in"/>
<arg name="args" type="ay" direction="in"/>
</method>
<method name="newInstance">
<arg type="i" direction="out"/>
<arg name="asn_id" type="ay" direction="in"/>
</method>
<method name="newInstance">
<arg type="i" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml_data" type="s" direction="out"/>
</method>
</interface>
</node>
C:\Programme\kde-4\bin>qdbus org.kde.kded /MainApplication
org.kde.KApplication.quit
Error: org.freedesktop.DBus.Error.UnknownInterface
No such interface 'org.kde.KApplication' at object path '/MainApplication'
Does anyone can give me some hints who to find the problem ?
> 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.
>
>
I will come later to this after the main problem is finished.
Regards
Ralf
More information about the Kde-windows
mailing list