[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/korganizer
From:       Daniel Molkentin <molkentin () kde ! org>
Date:       2004-09-21 15:14:21
Message-ID: 20040921151421.E5523126E0 () office ! kde ! org
[Download RAW message or body]

CVS commit by danimo: 

-if we click on a mail url: make sure kmail is in foreground / on top and correctly \
pass serialNumber and messageId.

-fix a warning


  M +17 -11    urihandler.cpp   1.10


--- kdepim/korganizer/urihandler.cpp  #1.9:1.10
@@ -42,14 +42,20 @@ bool UriHandler::process( const QString 
 #ifndef KORG_NODCOP
   if ( uri.startsWith( "kmail:" ) ) {
-    int pos = uri.find( "/", 8 );
-    if ( pos > 8 ) {
-      QString messageId = uri.mid( 8, pos - 8 );
-      Q_UINT32 serialNumber = messageId.toUInt();
-      kdDebug(5850) << "SERIALNUMBERSTR: " << serialNumber << " MESSAGEID: "
+    // make sure kmail is running or the part is shown
+    KProcess proc;
+    proc << "kmail";
+    proc.start( KProcess::Block );
+
+    // parse string, show
+    int start = uri.find( ':' ) + 1;
+    int delimiter = uri.find( '/', start );
+    QString serialNumberStr = uri.mid( start, delimiter-start );
+    Q_UINT32 serialNumber = serialNumberStr.toUInt();
+    QString messageId = uri.mid( delimiter+1 );
+    kdDebug(5850) << "SERIALNUMBERSTR: " << serialNumberStr << " MESSAGEID: "
                 << messageId << endl;
       KMailIface_stub kmailIface( "kmail", "KMailIface" );
       kmailIface.showMail( serialNumber, messageId );
       return true;
-    }
   } else if ( uri.startsWith( "mailto:" ) ) {
     KApplication::kApplication()->invokeMailer( uri.mid(7), QString::null );
@@ -89,5 +95,5 @@ bool UriHandler::process( const QString 
   }
   else {  // no special URI, let KDE handle it
-    KRun *run = new KRun(KURL( uri ));
+    new KRun(KURL( uri ));
   }
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic