25 #include "urihandler.h" 27 #include <libkcal/attachment.h> 30 #include <libkcal/incidence.h> 34 #include <dcopclient.h> 35 #include "kmailIface_stub.h" 38 #include <tdeapplication.h> 39 #include <kiconloader.h> 40 #include <tdelocale.h> 41 #include <tdefiledialog.h> 42 #include <tdemessagebox.h> 43 #include <kmimetype.h> 44 #include <tdeprocess.h> 46 #include <tdetempfile.h> 48 #include <tdeio/netaccess.h> 52 TQString UriHandler::attachmentNameFromUri( const TQString &uri ) 55 if ( uri.startsWith( "ATTACH:" ) ) { 56 tmp = uri.mid( 9 ).section( ':', -1, -1 ); 61 TQString UriHandler::uidFromUri( const TQString &uri ) 64 if ( uri.startsWith( "ATTACH:" ) ) { 65 tmp = uri.mid( 9 ).section( ':', 0, 0 ); 66 } else if ( uri.startsWith( "uid:" ) ) { 72 bool UriHandler::process( TQWidget *parent, const TQString &uri ) 74 kdDebug(5850) << "UriHandler::process(): " << uri << endl; 77 if ( uri.startsWith( "kmail:" ) ) { 80 kapp->startServiceByDesktopPath( "kmail"); 83 int colon = uri.find( ':' ); 85 TQString serialNumberStr = uri.mid( colon + 1 ); 86 serialNumberStr = serialNumberStr.left( serialNumberStr.find( '/' ) ); 88 KMailIface_stub kmailIface( "kmail", "KMailIface" ); 89 kmailIface.showMail( serialNumberStr.toUInt(), TQString() ); 92 } else if ( uri.startsWith( "mailto:" ) ) { 94 TDEApplication::kApplication()->invokeMailer( uri.mid(7), TQString() ); 97 } else if ( uri.startsWith( "uid:" ) ) { 99 TQString uid = uidFromUri( uri ); 100 DCOPClient *client = TDEApplication::kApplication()->dcopClient(); 101 const TQByteArray noParamData; 102 const TQByteArray paramData; 103 TQByteArray replyData; 104 TQCString replyTypeStr; 105 bool foundAbbrowser = client->call( "kaddressbook", "KAddressBookIface", 106 "interfaces()", noParamData, 107 replyTypeStr, replyData ); 108 if ( foundAbbrowser ) { 110 #if KDE_IS_VERSION( 3, 2, 90 ) 111 kapp->updateRemoteUserTimestamp( "kaddressbook"); 113 DCOPRef kaddressbook( "kaddressbook", "KAddressBookIface" ); 114 kaddressbook.send( "showContactEditor", uid ); 120 TQString iconPath = TDEGlobal::iconLoader()->iconPath( "go", TDEIcon::Small ); 121 TQString tmpStr = "kaddressbook --editor-only --uid "; 122 tmpStr += TDEProcess::quote( uid ); 123 KRun::runCommand( tmpStr, "KAddressBook", iconPath ); 127 } else if ( uri.startsWith( "ATTACH:" ) ) { 133 new KRun( KURL( uri ) ); bool view(TQWidget *parent, Attachment *attachment)
|