23 #include "../kdatastream.h"
24 #include "../dcopclient.h"
29 #include <tqstringlist.h>
33 void startApp(
const char *_app,
int argc,
const char **args)
35 const char *
function = 0;
36 TQString app = TQString::fromLatin1(_app);
37 if (app.endsWith(
".desktop"))
38 function =
"start_service_by_desktop_path(TQString,TQStringList)";
40 function =
"start_service_by_desktop_name(TQString,TQStringList)";
42 for(
int i = 0; i < argc; i++)
44 URLs.append(TQString::fromLocal8Bit(args[i]));
47 TQByteArray data, replyData;
49 TQDataStream arg(data, IO_WriteOnly);
52 if ( !dcop->
call(
"tdelauncher",
"tdelauncher",
function, data, replyType, replyData) ) {
53 tqWarning(
"call failed");
56 TQDataStream reply(replyData, IO_ReadOnly);
58 if ( replyType !=
"serviceResult" )
60 tqWarning(
"unexpected result '%s'", replyType.data());
66 reply >> result >> dcopName >> error;
69 tqWarning(
"Error: %s", error.local8Bit().data());
72 if (!dcopName.isEmpty())
73 puts(dcopName.data());
81 int main(
int argc,
char** argv )
83 if (( argc < 2) || (argv[1][0] ==
'-' )) {
84 fprintf( stderr,
"Usage: dcopstart <application> [url1] [url2] ...\n" );
96 startApp( argv[1], argc - 2, (
const char**)&argv[2] );
Inter-process communication and remote procedure calls for KDE applications.
bool attach()
Attaches to the DCOP server.
bool call(const TQCString &remApp, const TQCString &remObj, const TQCString &remFun, const TQByteArray &data, TQCString &replyType, TQByteArray &replyData, bool useEventLoop, int timeout, bool forceRemote)
Performs a synchronous send and receive.