kmail

dcoptest.cpp
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4 
5 #include <kdebug.h>
6 #include <tdeapplication.h>
7 #include <dcopclient.h>
8 #include <tdecmdlineargs.h>
9 #include "aboutdata.h"
10 
11 #include <kmailIface_stub.h>
12 #include <mailcomposerIface_stub.h>
13 
14 int main(int argc,char **argv)
15 {
16  kdDebug(5006) << "Test KMail DCOP interface." << endl;
17 
18  TDEAboutData aboutData( "testKMailDCOP",
19  "Test for KMail DCOP interface", "0.0" );
20  TDECmdLineArgs::init(argc, argv, &aboutData);
21  TDEApplication app;
22  app.dcopClient()->attach();
23 
24  KMailIface_stub kmailStub("kmail","KMailIface");
25 
26  kmailStub.openComposer("to 1","","","First test","simple openComp call",0,
27  KURL());
28 
29  DCOPRef ref = kmailStub.openComposer("to 2","","","Second test",
30  "DCOP ref call",0);
31  MailComposerIface_stub composerStub(ref.app(),ref.object());
32  TQCString data = "BEGIN:VCALENDAR\nEND:VCALENDAR";
33  composerStub.addAttachment("test.ics","7bit",data,"text","calendar","method",
34  "publish","attachement;");
35  composerStub.send(2);
36 
37  kdDebug(5006) << "testDCOP done." << endl;
38 
39  return 0;
40 }