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>
41#include <tdefiledialog.h>
42#include <tdemessagebox.h>
44#include <tdeprocess.h>
46#include <tdetempfile.h>
48#include <tdeio/netaccess.h>
52TQString UriHandler::attachmentNameFromUri( const TQString &uri )
55 if ( uri.startsWith( "ATTACH:" ) ) {
56 tmp = uri.mid( 9 ).section( ':', -1, -1 );
61TQString UriHandler::uidFromUri( const TQString &uri )
64 if ( uri.startsWith( "ATTACH:" ) ) {
65 tmp = uri.mid( 9 ).section( ':', 0, 0 );
66 } else if ( uri.startsWith( "uid:" ) ) {
72bool UriHandler::process( TQWidget *parent, const TQString &uri )
74 kdDebug(5850) << "UriHandler::process(): " << uri << endl;
77 if ( uri.startsWith( "kmail:" ) ) {
80 tdeApp->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 tdeApp->invokeMailer( uri.mid(7), TQString() );
97 } else if ( uri.startsWith( "uid:" ) ) {
99 TQString uid = uidFromUri( uri );
100 DCOPClient *client = tdeApp->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 tdeApp->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:" ) ) {
130 return AttachmentHandler::view( parent, attachmentNameFromUri( uri ), uidFromUri( uri ) );
133 new KRun( KURL( uri ) );
|