File r883863.diff of Package kdepimlibs4

Subject: gpgme: use better error codes
From: wstephenson@suse.de
Bug: 
Patch-upstream: 883863
--- gpgme++/ConfigureChecks.cmake	(revision 883862)
+++ gpgme++/ConfigureChecks.cmake	(revision 883863)
@@ -261,6 +261,24 @@ check_cxx_source_compiles ("
 # check if gpgme has gpgme_cancel_async
 check_function_exists ("gpgme_cancel_async" HAVE_GPGME_CANCEL_ASYNC )
 
+# check if gpg-error has GPG_ERR_NO_PASSPHRASE
+check_cxx_source_compiles ("
+  #include <gpg-error.h>
+  int main() {
+    gpg_error_t err = GPG_ERR_NO_PASSPHRASE;
+    return 0;
+  }
+" HAVE_GPG_ERR_NO_PASSPHRASE )
+
+# check if gpg-error has GPG_ERR_ALREADY_SIGNED
+check_cxx_source_compiles ("
+  #include <gpg-error.h>
+  int main() {
+    gpg_error_t err = GPG_ERR_ALREADY_SIGNED;
+    return 0;
+  }
+" HAVE_GPG_ERR_ALREADY_SIGNED )
+
 set(CMAKE_REQUIRED_INCLUDES)
 set(CMAKE_REQUIRED_LIBRARIES)
 
--- gpgme++/config-gpgme++.h.cmake	(revision 883862)
+++ gpgme++/config-gpgme++.h.cmake	(revision 883863)
@@ -60,3 +60,17 @@
 
 /* Define to 1 if your gpgme has gpgme_cancel_async */
 #cmakedefine HAVE_GPGME_CANCEL_ASYNC 1
+
+/* Define to 1 if your gpg-error has GPG_ERR_NO_PASSPHRASE */
+#cmakedefine HAVE_GPG_ERR_NO_PASSPHRASE 1
+
+/* Define to 1 if your gpg-error has GPG_ERR_ALREADY_SIGNED */
+#cmakedefine HAVE_GPG_ERR_ALREADY_SIGNED 1
+
+#ifndef HAVE_GPG_ERR_NO_PASSPHRASE
+# define GPG_ERR_NO_PASSPHRASE GPG_ERR_INV_PASSPHRASE
+#endif
+
+#ifndef HAVE_GPG_ERR_ALREADY_SIGNED
+# define GPG_ERR_ALREADY_SIGNED GPG_ERR_CONFLICT
+#endif
--- gpgme++/editinteractor.cpp	(revision 883862)
+++ gpgme++/editinteractor.cpp	(revision 883863)
@@ -20,6 +20,8 @@
   Boston, MA 02110-1301, USA.
 */
 
+#include <config-gpgme++.h>
+
 #include "editinteractor.h"
 #include "callbacks.h"
 #include "error.h"
@@ -204,9 +206,9 @@ bool EditInteractor::needsNoResponse( un
 Error status_to_error( unsigned int status ) {
     switch ( status ) {
     case GPGME_STATUS_MISSING_PASSPHRASE:
-        return Error( gpg_error( GPG_ERR_INV_PASSPHRASE ) ); // should be GPG_ERR_MISSING_PASSPHRASE
+        return Error( gpg_error( GPG_ERR_NO_PASSPHRASE ) );
     case GPGME_STATUS_ALREADY_SIGNED:
-        return Error( gpg_error( GPG_ERR_CONFLICT ) ); // should be GPG_ERR_ALREADY_SIGNED
+        return Error( gpg_error( GPG_ERR_ALREADY_SIGNED ) );
     }
     return Error();
 }
Index: gpgme++/ConfigureChecks.cmake
===================================================================
Index: gpgme++/config-gpgme++.h.cmake
===================================================================
Index: gpgme++/editinteractor.cpp
===================================================================
openSUSE Build Service is sponsored by