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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/certmanager/lib/backends/qgpgme
From:       Marc Mutz <mutz () kde ! org>
Date:       2008-11-20 10:01:30
Message-ID: 1227175290.547255.13482.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 886843 by mutz:

Fake a successful (but empty) keylisting result when the operation fails with \
GPG_ERR_EOF. Happens when no .gnupg exists (kolab/issue2620).

 M  +16 -0     qgpgmekeylistjob.cpp  
 M  +1 -0      qgpgmekeylistjob.h  


--- branches/kdepim/enterprise/kdepim/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp \
#886842:886843 @@ -48,6 +48,7 @@
 #include <kdebug.h>
 
 #include <qstringlist.h>
+#include <qtimer.h>
 
 #include <algorithm>
 
@@ -97,6 +98,10 @@
 	kdDebug(5150) << "QGpgMEKeyListJob::start(): retrying keylisting with chunksize " \
<< chunkSize() << endl;  continue;
       }
+    } else if ( err.code() == GPG_ERR_EOF ) {
+        kdDebug(5150) << "QGpgMEKeyListJob::start(): early end of keylisting, trying \
to fake an empty result" << endl; +        QTimer::singleShot( 10, this, \
SLOT(slotFakeOperationDoneEvent()) ); +        return GpgME::Error();
     }
     deleteLater();
     mResult = GpgME::KeyListResult( 0, err );
@@ -158,6 +163,17 @@
     emit nextKey( key );
 }
 
+void Kleo::QGpgMEKeyListJob::slotFakeOperationDoneEvent() {
+  const GpgME::KeyListResult res = mCtx->keyListResult();
+  if ( !res.error().code() == GPG_ERR_EOF )
+    kdDebug(5150) << "QGpgMEKeyListJob::slotFakeOperationDoneEvent: expected EOF, \
got " +                  << res.error().asString() << endl;
+  mResult = GpgME::KeyListResult();
+  emit done();
+  emit result( mResult );
+  deleteLater();
+}
+
 void Kleo::QGpgMEKeyListJob::slotOperationDoneEvent( GpgME::Context * context, const \
GpgME::Error & ) {  if ( context != mCtx )
     return;
--- branches/kdepim/enterprise/kdepim/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h \
#886842:886843 @@ -65,6 +65,7 @@
   private slots:
     void slotNextKeyEvent( GpgME::Context * context, const GpgME::Key & key );
     void slotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & e );
+    void slotFakeOperationDoneEvent();
 
   private:
     void doOperationDoneEvent( const GpgME::Error &) {} // unused, we implement \
slotOperationDoneEvent ourselves.


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

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