kmail
korghelper.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "korghelper.h"
00021
00022 #include <dcopclient.h>
00023 #include <dcopref.h>
00024 #include <kapplication.h>
00025 #include <kdebug.h>
00026 #include <kdcopservicestarter.h>
00027
00028 void KMail::KorgHelper::ensureRunning()
00029 {
00030 QString error;
00031 QCString dcopService;
00032 int result = KDCOPServiceStarter::self()->findServiceFor( "DCOP/Organizer", QString::null, QString::null, &error, &dcopService );
00033 if ( result == 0 ) {
00034
00035
00036 static const char* const dcopObjectId = "KOrganizerIface";
00037 QCString dummy;
00038 if ( !kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ) {
00039 DCOPRef ref( dcopService, dcopService );
00040 DCOPReply reply = ref.call( "load()" );
00041 if ( reply.isValid() && (bool)reply ) {
00042 kdDebug() << "Loaded " << dcopService << " successfully" << endl;
00043 Q_ASSERT( kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) );
00044 } else
00045 kdWarning() << "Error loading " << dcopService << endl;
00046 }
00047
00048
00049
00050 }
00051 else
00052 kdWarning() << "Couldn't start DCOP/Organizer: " << dcopService << " " << error << endl;
00053 }
|