diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/system/libkvisystem.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/modules/system/libkvisystem.cpp b/src/modules/system/libkvisystem.cpp index 3dd02cbb7..9958c1a9f 100644 --- a/src/modules/system/libkvisystem.cpp +++ b/src/modules/system/libkvisystem.cpp @@ -433,7 +433,7 @@ static bool system_kvs_fnc_hostname(KviKvsModuleFunctionCall *c) The returned value is the string rappresentation of the returned data if the return type is known, otherwise it is the name of the data type returned. [br] - If the application name is prefixed with "?" then the call is performed in "remote test" + If the service name is prefixed with "?" then the call is performed in "remote test" mode: no "remote" errors are printed and the function returns 1 if the call executed successfully and 0 if the call failed. This can be used with the very first call to programmaticaly test if the remote application is running. @@ -454,13 +454,14 @@ static bool system_kvs_fnc_dbus(KviKvsModuleFunctionCall *c) { QString szService, szPath, szInterface, szMethod, szBusType; QStringList parms; + bool bRemoteTest=false; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("service",KVS_PT_NONEMPTYSTRING,0,szService) KVSM_PARAMETER("path",KVS_PT_NONEMPTYSTRING,0,szPath) KVSM_PARAMETER("interface",KVS_PT_NONEMPTYSTRING,0,szInterface) KVSM_PARAMETER("method",KVS_PT_NONEMPTYSTRING,0,szMethod) - KVSM_PARAMETER("bus_type",KVS_PT_STRING,0,szBusType) + KVSM_PARAMETER("bus_type",KVS_PT_STRING,KVS_PF_OPTIONAL,szBusType) KVSM_PARAMETER("parameter_list",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,parms) KVSM_PARAMETERS_END(c) @@ -481,11 +482,29 @@ static bool system_kvs_fnc_dbus(KviKvsModuleFunctionCall *c) return false; } + if(szService.left(1).compare("?")==0) + { + szService.remove(0,1); + bRemoteTest=true; + } + QDBusInterface remoteApp(szService, szPath, szInterface, busType); if(!remoteApp.isValid()) { - c->warning(__tr2qs("Invalid DBus interface")); - return false; + if(bRemoteTest) + { + c->returnValue()->setInteger(0); + return true; + } else { + c->warning(__tr2qs("Invalid DBus interface")); + return false; + } + } + + if(bRemoteTest) + { + c->returnValue()->setInteger(1); + return true; } QList<QVariant> ds; |
