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

List:       kde-commits
Subject:    KDE/kdepim/libkleo
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-11-29 16:25:21
Message-ID: 20101129162521.A514EAC8A5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202090 by mutz:

(new) Kleo::ListAllKeysJob

This job class is used when all keys are to be listed, esp. public and secret ones.
By re-using the GpgME::Context for the secret key listing, we use less resources
and are potentially faster.

Doing this also means we can move the pub/sec key merge code into the Job,
which means it executes outside of the GUI thread, keeping Kleopatra a little bit
more responsive during keylistings.

It also helps on antiquated OSs that have only 32 process slots :)

 M  +1 -0      CMakeLists.txt  
 M  +1 -0      backends/chiasmus/chiasmusbackend.cpp  
 M  +15 -0     backends/qgpgme/qgpgmebackend.cpp  
 A             backends/qgpgme/qgpgmelistallkeysjob.cpp   [License: GPL (v2+) (+Qt \
exception)]  A             backends/qgpgme/qgpgmelistallkeysjob.h   [License: GPL \
(v2+) (+Qt exception)]  M  +2 -0      kleo/cryptobackend.h  
 M  +3 -0      kleo/job.cpp  
 A             kleo/listallkeysjob.h   [License: GPL (v2+) (+Qt exception)]


--- trunk/KDE/kdepim/libkleo/CMakeLists.txt #1202089:1202090
@@ -21,6 +21,7 @@
     backends/qgpgme/qgpgmebackend.cpp
     backends/qgpgme/threadedjobmixin.cpp
     backends/qgpgme/qgpgmekeylistjob.cpp
+    backends/qgpgme/qgpgmelistallkeysjob.cpp
     backends/qgpgme/qgpgmekeygenerationjob.cpp
     backends/qgpgme/qgpgmeimportjob.cpp
     backends/qgpgme/qgpgmeimportfromkeyserverjob.cpp
--- trunk/KDE/kdepim/libkleo/backends/chiasmus/chiasmusbackend.cpp #1202089:1202090
@@ -385,6 +385,7 @@
   QString name() const { return "Chiasmus"; }
   QString displayName() const { return i18n( "Chiasmus command line tool" ); }
   KeyListJob * keyListJob( bool, bool, bool ) const { return 0; }
+  ListAllKeysJob * listAllKeysJob( bool, bool ) const { return 0; }
   EncryptJob * encryptJob( bool, bool ) const { return 0; }
   DecryptJob * decryptJob() const { return 0; }
   SignJob * signJob( bool, bool ) const { return 0; }
--- trunk/KDE/kdepim/libkleo/backends/qgpgme/qgpgmebackend.cpp #1202089:1202090
@@ -37,6 +37,7 @@
 
 #include "qgpgmekeygenerationjob.h"
 #include "qgpgmekeylistjob.h"
+#include "qgpgmelistallkeysjob.h"
 #include "qgpgmedecryptjob.h"
 #include "qgpgmedecryptverifyjob.h"
 #include "qgpgmerefreshkeysjob.h"
@@ -110,6 +111,20 @@
       return new Kleo::QGpgMEKeyListJob( context );
     }
 
+    Kleo::ListAllKeysJob * listAllKeysJob( bool includeSigs, bool validate ) const {
+      GpgME::Context * context = GpgME::Context::createForProtocol( mProtocol );
+      if ( !context )
+        return 0;
+
+      unsigned int mode = context->keyListMode();
+      mode |= GpgME::Local;
+      mode &= ~GpgME::Extern;
+      if ( includeSigs ) mode |= GpgME::Signatures;
+      if ( validate ) mode |= GpgME::Validate;
+      context->setKeyListMode( mode );
+      return new Kleo::QGpgMEListAllKeysJob( context );
+    }
+
     Kleo::EncryptJob * encryptJob( bool armor, bool textmode ) const {
       GpgME::Context * context = GpgME::Context::createForProtocol( mProtocol );
       if ( !context )
--- trunk/KDE/kdepim/libkleo/kleo/cryptobackend.h #1202089:1202090
@@ -38,6 +38,7 @@
 namespace Kleo {
   class CryptoConfig;
   class KeyListJob;
+  class ListAllKeysJob;
   class KeyGenerationJob;
   class ImportJob;
   class ImportFromKeyserverJob;
@@ -104,6 +105,7 @@
     virtual QString displayName() const = 0;
 
     virtual KeyListJob          * keyListJob( bool remote=false, bool \
includeSigs=false, bool validate=false ) const = 0; +    virtual ListAllKeysJob      \
                * listAllKeysJob( bool includeSigs=false, bool validate=false ) const \
                = 0;
     virtual EncryptJob          * encryptJob( bool armor=false, bool textmode=false \
) const = 0;  virtual DecryptJob          * decryptJob() const = 0;
     virtual SignJob             * signJob( bool armor=false, bool textMode=false ) \
                const = 0;
--- trunk/KDE/kdepim/libkleo/kleo/job.cpp #1202089:1202090
@@ -34,6 +34,7 @@
 #include "job.h"
 
 #include "keylistjob.h"
+#include "listallkeysjob.h"
 #include "encryptjob.h"
 #include "decryptjob.h"
 #include "decryptverifyjob.h"
@@ -98,6 +99,7 @@
 #define make_job_subclass(x) make_job_subclass_ext(x,Job)
 
 make_job_subclass(KeyListJob)
+make_job_subclass(ListAllKeysJob)
 make_job_subclass(EncryptJob)
 make_job_subclass(DecryptJob)
 make_job_subclass(DecryptVerifyJob)
@@ -125,6 +127,7 @@
 #include "job.moc"
 
 #include "keylistjob.moc"
+#include "listallkeysjob.moc"
 #include "encryptjob.moc"
 #include "decryptjob.moc"
 #include "decryptverifyjob.moc"


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

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