Index: exception.cpp
===================================================================
--- exception.cpp	(revision 746016)
+++ exception.cpp	(working copy)
@@ -36,12 +36,12 @@
 string Exception::make_message( const Error & err, const string & msg ) {
     char error_string[128];
     error_string[0] = '\0';
-    gpg_strerror_r( err, error_string, sizeof error_string );
+    gpg_strerror_r( err.toErrorCode(), error_string, sizeof error_string );
     error_string[sizeof error_string - 1] = '\0';
     stringstream ss;
-    ss << gpg_strsource( err ) << ": ";
+    ss << gpg_strsource( err.toErrorCode() ) << ": ";
     if ( !msg.empty() )
         ss << msg << ": ";
-    ss << error_string << " (" << static_cast<unsigned long>( err ) << ')';
+    ss << error_string << " (" << static_cast<unsigned long>( err.toErrorCode() ) << ')';
     return ss.str();
 }
Index: result_p.h
===================================================================
--- result_p.h	(revision 746016)
+++ result_p.h	(working copy)
@@ -33,7 +33,7 @@
 
 #define make_error_ctor(x) \
 GpgME::x::x( const Error & error ) \
-  : GpgME::Result( error ), d( 0 ) \
+  : GpgME::Result( error.toErrorCode() ), d( 0 ) \
 { \
  \
 }
Index: gpgsetownertrusteditinteractor.cpp
===================================================================
--- gpgsetownertrusteditinteractor.cpp	(revision 746016)
+++ gpgsetownertrusteditinteractor.cpp	(working copy)
@@ -25,6 +25,8 @@
 
 #include <gpgme.h>
 
+#undef ERROR
+
 using namespace GpgME;
 
 GpgSetOwnerTrustEditInteractor::GpgSetOwnerTrustEditInteractor( Key::OwnerTrust ot )
Index: context.cpp
===================================================================
--- context.cpp	(revision 746016)
+++ context.cpp	(working copy)
@@ -553,7 +553,9 @@
     return Error( d->lasterr = gpgme_op_getauditlog_start( d->ctx, odp ? odp->data : 0, to_auditlog_flags( flags ) ) );
 #else
     (void)output; (void)flags;
-    return Error( d->lasterr = makeError( GPG_ERR_NOT_IMPLEMENTED ) );
+    Error error( makeError( GPG_ERR_NOT_IMPLEMENTED ) );
+    d->lasterr = error.toErrorCode();
+    return error;
 #endif
   }
 
@@ -564,7 +566,9 @@
     return Error( d->lasterr = gpgme_op_getauditlog( d->ctx, odp ? odp->data : 0, to_auditlog_flags( flags ) ) );
 #else
     (void)output; (void)flags;
-    return Error( d->lasterr = makeError( GPG_ERR_NOT_IMPLEMENTED ) );
+    Error error( makeError( GPG_ERR_NOT_IMPLEMENTED ) );
+    d->lasterr = error.toErrorCode();
+    return error;
 #endif
   }
 
Index: error.h
===================================================================
--- error.h	(revision 746016)
+++ error.h	(working copy)
@@ -41,7 +41,7 @@
 
     bool isCanceled() const;
 
-    operator unsigned int() const { return mErr; }
+    int toErrorCode() const { return mErr; }
 
   private:
     struct __safe_bool_dummy__ { void nonnull() {} };
Index: editinteractor.cpp
===================================================================
--- editinteractor.cpp	(revision 746016)
+++ editinteractor.cpp	(working copy)
@@ -59,7 +59,7 @@
             
             if ( ei->state != oldState &&
                  // if there was an error from before, we stop here (### this looks weird, can this happen at all?)
-                 gpg_err_code( ei->error ) == GPG_ERR_NO_ERROR ) {
+                 gpg_err_code( ei->error.toErrorCode() ) == GPG_ERR_NO_ERROR ) {
 
                 // successful state change -> call action
                 if ( const char * const result = ei->q->action() ) {
@@ -85,9 +85,9 @@
 
         if ( ei->debug )
             std::fprintf( ei->debug, "EditInteractor: error now %u (%s)\n",
-                          (unsigned int)ei->error, gpg_strerror( ei->error ) );
+                          ei->error.toErrorCode(), gpg_strerror( ei->error.toErrorCode() ) );
 
-        return ei->error;
+        return ei->error.toErrorCode();
     }
 
 private:
Index: keylistresult.cpp
===================================================================
--- keylistresult.cpp	(revision 746016)
+++ keylistresult.cpp	(working copy)
@@ -51,7 +51,7 @@
 }
 
 GpgME::KeyListResult::KeyListResult( const Error & error, const _gpgme_op_keylist_result & res )
-  : GpgME::Result( error ), d( 0 )
+  : GpgME::Result( error.toErrorCode() ), d( 0 )
 {
   d = new Private( res );
   d->ref();
