urihandler.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "urihandler.h"
00026
00027 #ifndef KORG_NODCOP
00028 #include <dcopclient.h>
00029 #include "kmailIface_stub.h"
00030 #endif
00031
00032 #include <kiconloader.h>
00033 #include <krun.h>
00034 #include <kapplication.h>
00035 #include <kprocess.h>
00036 #include <kdebug.h>
00037
00038 bool UriHandler::process( const QString &uri )
00039 {
00040 kdDebug(5850) << "UriHandler::process(): " << uri << endl;
00041
00042 #ifndef KORG_NODCOP
00043 if ( uri.startsWith( "kmail:" ) ) {
00044
00045 kapp->startServiceByDesktopPath("kmail");
00046 int pos = uri.find( "/", 6 );
00047 if ( pos > 6 ) {
00048 QString messageId = uri.mid( 6, pos - 6 );
00049 Q_UINT32 serialNumber = messageId.toUInt();
00050 kdDebug() << "SERIALNUMBERSTR: " << serialNumber << " MESSAGEID: "
00051 << messageId << endl;
00052 KMailIface_stub kmailIface( "kmail", "KMailIface" );
00053 kmailIface.showMail( serialNumber, messageId );
00054 return true;
00055 }
00056 } else if ( uri.lower().startsWith( "mailto:" ) ) {
00057 KApplication::kApplication()->invokeMailer( uri.mid(7), QString::null );
00058 return true;
00059 } else if ( uri.startsWith( "uid:" ) ) {
00060 DCOPClient *client = KApplication::kApplication()->dcopClient();
00061 const QByteArray noParamData;
00062 const QByteArray paramData;
00063 QByteArray replyData;
00064 QCString replyTypeStr;
00065 bool foundAbbrowser = client->call( "kaddressbook", "KAddressBookIface",
00066 "interfaces()", noParamData,
00067 replyTypeStr, replyData );
00068 if ( foundAbbrowser ) {
00069
00070 #if KDE_IS_VERSION( 3, 2, 90 )
00071 kapp->updateRemoteUserTimestamp("kaddressbook");
00072 #endif
00073 DCOPRef kaddressbook( "kaddressbook", "KAddressBookIface" );
00074 kaddressbook.send( "showContactEditor", uri.mid( 6 ) );
00075 return true;
00076 } else {
00077
00078
00079
00080
00081 KIconLoader *iconLoader = new KIconLoader();
00082 QString iconPath = iconLoader->iconPath( "go", KIcon::Small );
00083 QString tmpStr = "kaddressbook --editor-only --uid ";
00084 tmpStr += KProcess::quote( uri.mid( 6 ) );
00085 KRun::runCommand( tmpStr, "KAddressBook", iconPath );
00086 return true;
00087 }
00088 }
00089 else {
00090 new KRun(KURL( uri ));
00091 }
00092 #endif
00093
00094 return false;
00095 }
This file is part of the documentation for korganizer Library Version 3.3.2.