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

List:       kde-pim
Subject:    [Kde-pim] [PATCH] Easy download of unknown gpg keys from KMail
From:       bj () altern ! org
Date:       2004-05-21 17:23:18
Message-ID: 200405211926.30368.bj () altern ! org
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I made a small patch against KMail cvs that adds a few dcop calls to KGpg.
With the patch, in the reader window, unknown signature keys become clickable.
Clicking on an unknown key brings up KGpg's key import dialog, and when the 
key is downloaded, the KMail window automatically updated to relfect the new 
state.

Clicking on a known key brings up a key info dialog.

This would fix wishlist item 80066 
(http://bugs.kde.org/show_bug.cgi?id=80066).

Any comments ? Do you think the patch could eventually make its way to cvs ?

regards

Jean-Baptiste Mardelle
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFArlfjB+BYfnGUHkURAilEAJ9qz6SjSKppzCNhnNZZRSUVHwxtLgCdFz8k
suvDPsBVU1URGxIpexWSsVo=
=QU2c
-----END PGP SIGNATURE-----

["kmail.patch" (text/x-diff)]

? kmail/patches
Index: kmail/kmailIface.h
===================================================================
RCS file: /home/kde/kdepim/kmail/kmailIface.h,v
retrieving revision 1.28
diff -u -3 -r1.28 kmailIface.h
--- kmail/kmailIface.h	12 Mar 2004 09:42:20 -0000	1.28
+++ kmail/kmailIface.h	21 May 2004 17:04:11 -0000
@@ -23,6 +23,7 @@
   virtual QStringList accounts() = 0;
   virtual void checkAccount(const QString &account) = 0;
   virtual void openReader() = 0;
+  virtual void reloadReader() =0;
   virtual int openComposer(const QString &to, const QString &cc,
                            const QString &bcc, const QString &subject,
                            const QString &body, int hidden,
Index: kmail/kmkernel.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmkernel.cpp,v
retrieving revision 1.278
diff -u -3 -r1.278 kmkernel.cpp
--- kmail/kmkernel.cpp	20 May 2004 13:36:01 -0000	1.278
+++ kmail/kmkernel.cpp	21 May 2004 17:04:12 -0000
@@ -156,6 +156,8 @@
 
   connectDCOPSignal( 0, 0, "kmailSelectFolder(QString)",
                      "selectFolder(QString)", false );
+		     
+   connectDCOPSignal(0,0,"keyImported(bool)","reloadReader()", false);
 }
 
 KMKernel::~KMKernel ()
@@ -283,6 +285,12 @@
 /********************************************************************/
 /*             DCOP-callable, and command line actions              */
 /********************************************************************/
+void KMKernel::reloadReader()
+{
+emit updateReader();
+}
+
+
 void KMKernel::checkMail () //might create a new reader but won't show!!
 {
   kmkernel->acctMgr()->checkMail(false);
Index: kmail/kmkernel.h
===================================================================
RCS file: /home/kde/kdepim/kmail/kmkernel.h,v
retrieving revision 1.105
diff -u -3 -r1.105 kmkernel.h
--- kmail/kmkernel.h	20 May 2004 13:36:01 -0000	1.105
+++ kmail/kmkernel.h	21 May 2004 17:04:12 -0000
@@ -70,6 +70,7 @@
   /** dcop callable stuff */
 
   void checkMail ();
+
   QStringList accounts();
   void checkAccount (const QString &account);
   /** returns id of composer if more are opened */
@@ -108,6 +109,7 @@
   int sendCertificate( const QString& to, const QByteArray& certData );
 
   void openReader() { openReader( false ); }
+  void reloadReader();
   void compactAllFolders();
   int dcopAddMessage(const QString & foldername, const QString & messageFile);
   int dcopAddMessage(const QString & foldername, const KURL & messageFile);
@@ -254,6 +256,7 @@
 
 signals:
   void configChanged();
+  void updateReader();
 
 private:
   void openReader( bool onlyCheck );
Index: kmail/kmmainwin.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmmainwin.cpp,v
retrieving revision 1.588
diff -u -3 -r1.588 kmmainwin.cpp
--- kmail/kmmainwin.cpp	11 May 2004 10:27:44 -0000	1.588
+++ kmail/kmmainwin.cpp	21 May 2004 17:04:13 -0000
@@ -53,6 +53,8 @@
 	  SLOT(setCaption(const QString&)) );
   connect(mKMMainWidget, SIGNAL(modifiedToolBarConfig()),
 	   SLOT(slotUpdateToolbars()) );
+  connect(kmkernel,SIGNAL(updateReader()),mKMMainWidget->messageView(),SLOT(updateReaderWin()));
 +
 
   // Enable mail checks again (see destructor)
   KMBroadcastStatus::instance()->reset();
Index: kmail/objecttreeparser.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/objecttreeparser.cpp,v
retrieving revision 1.105
diff -u -3 -r1.105 objecttreeparser.cpp
--- kmail/objecttreeparser.cpp	18 May 2004 19:38:30 -0000	1.105
+++ kmail/objecttreeparser.cpp	21 May 2004 17:04:14 -0000
@@ -2147,8 +2147,8 @@
                                 .arg( KGlobal::locale()->formatDateTime( created ) )
                                 .arg( keyWithWithoutURL );
                     else
-                        htmlStr += i18n( "Message was signed with unknown key %1." )
-                                .arg( keyWithWithoutURL );
+                        htmlStr += i18n( "Message was signed with unknown key <a \
href=\"kmail:importKey=%1\">%1</a>." ) +                                .arg( \
keyWithWithoutURL).arg( keyWithWithoutURL);  }
                   else
                     htmlStr += i18n( "Message was signed with unknown key." );
@@ -2180,9 +2180,10 @@
                         "class=\"" + block.signClass + "\">"
                         "<tr class=\"" + block.signClass + "H\"><td dir=\"" + dir + \
"\">";  if( !block.keyId.isEmpty() )
-                        htmlStr += i18n( "Message was signed by %2 (Key ID: %1)." )
+                        htmlStr += i18n( "Message was signed by %2 (Key ID: <a \
                href=\"kmail:showKey=%3\">%1</a>)." )
                                    .arg( keyWithWithoutURL )
-                                   .arg( signer );
+                                   .arg( signer )
+				   .arg( keyWithWithoutURL );
                     else
                         htmlStr += i18n( "Message was signed by %1." ).arg( signer \
);  htmlStr += "<br />";
Index: kmail/urlhandlermanager.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/urlhandlermanager.cpp,v
retrieving revision 1.10
diff -u -3 -r1.10 urlhandlermanager.cpp
--- kmail/urlhandlermanager.cpp	12 May 2004 08:36:03 -0000	1.10
+++ kmail/urlhandlermanager.cpp	21 May 2004 17:04:15 -0000
@@ -50,6 +50,8 @@
 using std::remove;
 using std::find;
 
+
+
 KMail::URLHandlerManager * KMail::URLHandlerManager::self = 0;
 
 namespace {
@@ -337,20 +339,50 @@
 #include <kprocess.h>
 #include <kmessagebox.h>
 #include <khtml_part.h>
+#include <dcopclient.h>
+#include <kapplication.h>
 
 #include <qstring.h>
 
 namespace {
   bool ShowHtmlSwitchURLHandler::handleClick( const KURL & url, KMReaderWin * w ) \
                const {
-    if ( url.protocol() != "kmail" || url.path() != "showHTML" )
+    if ( url.protocol() != "kmail") 
       return false;
+      if (url.path() == "showHTML") 
+      {
     if ( w ) {
       w->setHtmlOverride( !w->htmlOverride() );
       w->update( true );
     }
     return true;
+    }
+    if (url.path().startsWith("showKey"))
+    {
+    
+    			QByteArray params;
+    			QDataStream stream(params, IO_WriteOnly);
+    			stream << url.path().section('=',1,1);
+
+    			if (!kapp->dcopClient()->send("kgpg", "KeyInterface", "showKeyInfo(QString)", \
params))  +       			KMessageBox::information(w,i18n("You need KGpg to enable the key \
info dialog")); +			return true;
+	}
+    
+    if (url.path().startsWith("importKey"))
+    {
+    
+    			QByteArray params;
+    			QDataStream stream(params, IO_WriteOnly);
+    			stream << url.path().section('=',1,1);
+
+    			if (!kapp->dcopClient()->send("kgpg", "KeyInterface", \
"importRemoteKey(QString)", params))  +       			KMessageBox::information(w,i18n("You \
need KGpg to enable key import")); +    return true;
+    }
+    return false; 
   }
 
+  
   QString ShowHtmlSwitchURLHandler::statusBarMessage( const KURL & url, KMReaderWin \
* ) const {  return url.url() == "kmail:showHTML"
       ? i18n("Turn on HTML rendering for this message.")



_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

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

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