summaryrefslogtreecommitdiffstats
path: root/korganizer/urihandler.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /korganizer/urihandler.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korganizer/urihandler.cpp')
-rw-r--r--korganizer/urihandler.cpp70
1 files changed, 57 insertions, 13 deletions
diff --git a/korganizer/urihandler.cpp b/korganizer/urihandler.cpp
index 4b7c7bdff..0c406318e 100644
--- a/korganizer/urihandler.cpp
+++ b/korganizer/urihandler.cpp
@@ -24,23 +24,58 @@
#include "urihandler.h"
+#include <libkcal/attachment.h>
+#include <libkcal/attachmenthandler.h>
+#include <libkcal/calendarresources.h>
+#include <libkcal/incidence.h>
+using namespace KCal;
+
#ifndef KORG_NODCOP
#include <dcopclient.h>
#include "kmailIface_stub.h"
#endif
-#include <kiconloader.h>
-#include <krun.h>
#include <kapplication.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+#include <kmimetype.h>
#include <kprocess.h>
+#include <krun.h>
+#include <ktempfile.h>
#include <kdebug.h>
+#include <kio/netaccess.h>
+
+#include <tqfile.h>
+
+TQString UriHandler::attachmentNameFromUri( const TQString &uri )
+{
+ TQString tmp;
+ if ( uri.startsWith( "ATTACH:" ) ) {
+ tmp = uri.mid( 9 ).section( ':', -1, -1 );
+ }
+ return tmp;
+}
+
+TQString UriHandler::uidFromUri( const TQString &uri )
+{
+ TQString tmp;
+ if ( uri.startsWith( "ATTACH:" ) ) {
+ tmp = uri.mid( 9 ).section( ':', 0, 0 );
+ } else if ( uri.startsWith( "uid:" ) ) {
+ tmp = uri.mid( 6 );
+ }
+ return tmp;
+}
-bool UriHandler::process( const TQString &uri )
+bool UriHandler::process( TQWidget *parent, const TQString &uri )
{
kdDebug(5850) << "UriHandler::process(): " << uri << endl;
#ifndef KORG_NODCOP
if ( uri.startsWith( "kmail:" ) ) {
+
// make sure kmail is running or the part is shown
kapp->startServiceByDesktopPath("kmail");
@@ -53,10 +88,15 @@ bool UriHandler::process( const TQString &uri )
KMailIface_stub kmailIface( "kmail", "KMailIface" );
kmailIface.showMail( serialNumberStr.toUInt(), TQString() );
return true;
+
} else if ( uri.startsWith( "mailto:" ) ) {
+
KApplication::kApplication()->invokeMailer( uri.mid(7), TQString::null );
return true;
+
} else if ( uri.startsWith( "uid:" ) ) {
+
+ TQString uid = uidFromUri( uri );
DCOPClient *client = KApplication::kApplication()->dcopClient();
const TQByteArray noParamData;
const TQByteArray paramData;
@@ -66,27 +106,31 @@ bool UriHandler::process( const TQString &uri )
"interfaces()", noParamData,
replyTypeStr, replyData );
if ( foundAbbrowser ) {
- //KAddressbook is already running, so just DCOP to it to bring up the contact editor
+ // KAddressbook is already running, so just DCOP to it to bring up the contact editor
#if KDE_IS_VERSION( 3, 2, 90 )
kapp->updateRemoteUserTimestamp("kaddressbook");
#endif
DCOPRef kaddressbook( "kaddressbook", "KAddressBookIface" );
- kaddressbook.send( "showContactEditor", uri.mid( 6 ) );
+ kaddressbook.send( "showContactEditor", uid );
return true;
} else {
- /*
- KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
- We start it without its main interface
- */
+ // KaddressBook is not already running.
+ // Pass it the UID of the contact via the command line while starting it - its neater.
+ // We start it without its main interface
TQString iconPath = KGlobal::iconLoader()->iconPath( "go", KIcon::Small );
TQString tmpStr = "kaddressbook --editor-only --uid ";
- tmpStr += KProcess::quote( uri.mid( 6 ) );
+ tmpStr += KProcess::quote( uid );
KRun::runCommand( tmpStr, "KAddressBook", iconPath );
return true;
}
- }
- else { // no special URI, let KDE handle it
- new KRun(KURL( uri ));
+
+ } else if ( uri.startsWith( "ATTACH:" ) ) {
+
+ // a calendar incidence attachment
+ return AttachmentHandler::view( parent, attachmentNameFromUri( uri ), uidFromUri( uri ) );
+
+ } else { // no special URI, let KDE handle it
+ new KRun( KURL( uri ) );
}
#endif