37 #include "multideletejob.h"
38 #include "cryptobackend.h"
39 #include "deletejob.h"
41 #include <tdelocale.h>
43 #include <gpgmepp/key.h>
44 #include <gpgmepp/context.h>
45 #include <gpgmepp/data.h>
51 Kleo::MultiDeleteJob::MultiDeleteJob(
const CryptoBackend::Protocol * protocol )
52 : Job( 0,
"Kleo::MultiDeleteJob" ),
53 mProtocol( protocol ),
59 Kleo::MultiDeleteJob::~MultiDeleteJob() {
65 mAllowSecretKeyDeletion = allowSecretKeyDeletion;
68 const GpgME::Error err = startAJob();
75 void Kleo::MultiDeleteJob::slotCancel() {
76 if ( mJob ) mJob->slotCancel();
80 void Kleo::MultiDeleteJob::slotResult(
const GpgME::Error & err ) {
82 GpgME::Error error = err;
85 ++mIt == mKeys.end() ||
86 (error = startAJob()) ) {
88 emit result( error, error && mIt != mKeys.end() ? *mIt : GpgME::Key::null );
93 const int current = mIt - mKeys.begin();
94 const int total = mKeys.size();
95 emit progress( i18n(
"progress info: \"%1 of %2\"",
"%1/%2").arg( current ).arg( total ), current, total );
98 GpgME::Error Kleo::MultiDeleteJob::startAJob() {
99 if ( mIt == mKeys.end() )
101 mJob = mProtocol->deleteJob();
105 connect( mJob, TQ_SIGNAL(result(
const GpgME::Error&)), TQ_SLOT(slotResult(
const GpgME::Error&)) );
107 return mJob->start( *mIt, mAllowSecretKeyDeletion );
110 #include "multideletejob.moc"
GpgME::Error start(const std::vector< GpgME::Key > &keys, bool allowSecretKeyDeletion=false)
Starts the delete operation.