kmail

dcoptest.cpp

Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <kdebug.h>
00006 #include <kapplication.h>
00007 #include <dcopclient.h>
00008 #include <kcmdlineargs.h>
00009 #include "aboutdata.h"
00010 
00011 #include <kmailIface_stub.h>
00012 #include <mailcomposerIface_stub.h>
00013 
00014 int main(int argc,char **argv)
00015 {
00016   kdDebug(5006) << "Test KMail DCOP interface." << endl;
00017 
00018   KAboutData aboutData( "testKMailDCOP",
00019    "Test for KMail DCOP interface", "0.0" );
00020   KCmdLineArgs::init(argc, argv, &aboutData);
00021   KApplication app;
00022   app.dcopClient()->attach();
00023 
00024   KMailIface_stub kmailStub("kmail","KMailIface");
00025   
00026   kmailStub.openComposer("to 1","","","First test","simple openComp call",0,
00027                          KURL());
00028 
00029   DCOPRef ref = kmailStub.openComposer("to 2","","","Second test",
00030                                        "DCOP ref call",0);
00031   MailComposerIface_stub composerStub(ref.app(),ref.object());
00032   QCString data = "BEGIN:VCALENDAR\nEND:VCALENDAR";
00033   composerStub.addAttachment("test.ics","7bit",data,"text","calendar","method",
00034                              "publish","attachement;");
00035   composerStub.send(2);
00036 
00037   kdDebug(5006) << "testDCOP done." << endl;
00038 
00039   return 0;
00040 }