DCOPRef, call method
Waldo Bastian
bastian at kde.org
Mon Apr 8 04:54:32 BST 2002
On Saturday 06 April 2002 04:00 am, Robert JACOLIN wrote:
> Hi,
>
> I'm currently working on an application to make automatic tests for koffice
> application (to test filter). I read your HOWTO to understand dcop, dcop
> command and kdcop application.
>
> I want to call the "file_open" kword method from my application.
> its signature is :
> file_open(QCString)
>
> the parameter is the url to open the file.
This doesn't seem to be possible at the moment.
What you try to do is the equivalent of:
dcop kword-<pid> kword-mainwindow#1 action file_open
This will returns a DCOP-reference to the "file_open" action. Typically:
DCOPRef(kword-17583,kword-mainwindow#1/action/file_open)
You can then "activate" that action by calling
dcop kword-17583 kword-mainwindow#1/action/file_open activate
Unfortunately there is no way to pass the filename to this file_open action.
So all you get is a file-open dialog.
> To call this method I use call method (class DCopClient) :
>
> QByteArray data, returnData;
> QDataStream arg(data, IO_WriteOnly);
> QCString returnType;
>
> arg <<
> "file://home/bobby/projets/devel/cvs/koffice/filters/kword/latex/test/para.
>kwd";
Use arg << "file_open"; instead.
> if (!kapp->dcopClient()->call("kword", (QCString)
> "kword-mainwindow#1", (QCString) "action(QCString)",
> data, returnType, returnData))
> {
> qDebug("there was some error using DCOP.");
> cout << "erreur" << endl;
> }
> cout << "type : " << returnType << endl;
> if(returnType == "DCOPRef")
> {
> QDataStream reply(returnData, IO_ReadOnly);
> DCOPRef ref;
> reply >> ref;
> cout << "data : " << ref.type() << endl;
> cout << "data : " << ref.object() << endl;
> }
> ############# OUTPUT ##################################
> data : (null)
> data :
> kword-mainwindow#1/action/file://home/bobby/projets/devel/cvs/koffice/filte
>rs/kword/latex/test/para.kwd
> #######################################################
>
> My problem is that KWord doesn't open the file and I don't know what to do
> with this dcopref.
The dcopref that is returned here doesn't make sense at all. It shouldn't
return anything at all because there is no action
"file://home/bobby/projets/devel/cvs/koffice/filters/kword/latex/test/para.kwd"
Cheers,
Waldo
--
bastian at kde.org | SuSE Labs KDE Developer | bastian at suse.com
More information about the kde-core-devel
mailing list