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

List:       kde-commits
Subject:    kdepim/certmanager/lib
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2004-04-19 12:58:04
Message-ID: 20040419125804.ECB199A38 () office ! kde ! org
[Download RAW message or body]

CVS commit by mutz: 

Fix error reporting in the reader. This one still used the gpgme 0.3.x error codes, \
which wouldn't be that bad is it was used only for finding the error message. But who \
would've thought that the isPassphraseError bool to be filled in here actually \
decides whether the message in question is encrypted or merely signed?? This is a \
very poor hack, but gpgme doesn't return this information in the first place...


  M +6 -41     cryptplugwrapper.cpp   1.16


--- kdepim/certmanager/lib/cryptplugwrapper.cpp  #1.15:1.16
@@ -846,45 +846,9 @@ QString CryptPlugWrapper::libVersion() c
 
 QString CryptPlugWrapper::errorIdToText( int errId, bool & isPassphraseError ) {
-  /* The error numbers used by GPGME.  */
-  /*
-    typedef enum
-    {
-      GPGME_EOF                = -1,
-      GPGME_No_Error           = 0,
-      GPGME_General_Error      = 1,
-      GPGME_Out_Of_Core        = 2,
-      GPGME_Invalid_Value      = 3,
-      GPGME_Busy               = 4,
-      GPGME_No_Request         = 5,
-      GPGME_Exec_Error         = 6,
-      GPGME_Too_Many_Procs     = 7,
-      GPGME_Pipe_Error         = 8,
-      GPGME_No_Recipients      = 9,
-      GPGME_No_Data            = 10,
-      GPGME_Conflict           = 11,
-      GPGME_Not_Implemented    = 12,
-      GPGME_Read_Error         = 13,
-      GPGME_Write_Error        = 14,
-      GPGME_Invalid_Type       = 15,
-      GPGME_Invalid_Mode       = 16,
-      GPGME_File_Error         = 17,  // errno is set in this case.
-      GPGME_Decryption_Failed  = 18,
-      GPGME_No_Passphrase      = 19,
-      GPGME_Canceled           = 20,
-      GPGME_Invalid_Key        = 21,
-      GPGME_Invalid_Engine     = 22,
-      GPGME_Invalid_Recipients = 23
-    }
-  */
-
-  /*
-    NOTE:
-    The following hack *must* be changed into something
-    using an extra enum specified in the CryptPlug API
-    *and* the file error number (case 17) must be taken
-    into account.                     (khz, 2002/27/06)
-  */
-
-  isPassphraseError = false;
+  const GpgME::Error err( errId );
+  isPassphraseError = err.isCanceled()
+    || gpgme_err_code( errId ) == GPG_ERR_NO_SECKEY ; // FIXME: more?
+  return QString::fromLocal8Bit( err.asString() );
+#if 0
   switch( errId ){
   case /*GPGME_EOF                = */-1:
@@ -944,4 +908,5 @@ QString CryptPlugWrapper::errorIdToText(
     return(i18n("Unknown error."));
   }
+#endif
 }
 


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

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