summaryrefslogtreecommitdiffstats
path: root/certmanager
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-28 16:44:42 -0500
committerSlávek Banko <slavek.banko@axis.cz>2013-04-29 02:15:18 +0200
commit5b94ddbf7213238bb173f30359c61bf2f9b13522 (patch)
treead4f042ca49fb81809744d80bd60d0945f75be81 /certmanager
parent0cd571409611487bb7798e2e3868f3d35e5f4297 (diff)
downloadtdepim-5b94ddbf7213238bb173f30359c61bf2f9b13522.tar.gz
tdepim-5b94ddbf7213238bb173f30359c61bf2f9b13522.zip
Fix retriggering of GPGMe socket notifiers in nested event loops
This resolves Bug 825 Add missing GPGMe feature checks to CMake (cherry picked from commit 7bd54f5a796f6f1276bbd310deaf1f2ac673954d)
Diffstat (limited to 'certmanager')
-rw-r--r--certmanager/lib/ui/keylistview.cpp9
-rw-r--r--certmanager/lib/ui/keyselectiondialog.cpp71
2 files changed, 50 insertions, 30 deletions
diff --git a/certmanager/lib/ui/keylistview.cpp b/certmanager/lib/ui/keylistview.cpp
index 100334f20..96cca8f11 100644
--- a/certmanager/lib/ui/keylistview.cpp
+++ b/certmanager/lib/ui/keylistview.cpp
@@ -333,13 +333,16 @@ Kleo::KeyListViewItem * Kleo::KeyListView::itemByFingerprint( const TQCString &
void Kleo::KeyListView::slotRefreshKey( const GpgME::Key & key ) {
const char * fpr = key.primaryFingerprint();
- if ( !fpr )
+ if ( !fpr ) {
return;
- if ( KeyListViewItem * item = itemByFingerprint( fpr ) )
+ }
+ if ( KeyListViewItem * item = itemByFingerprint( fpr ) ) {
item->setKey ( key );
- else
+ }
+ else {
// none found -> add it
slotAddKey( key );
+ }
}
// slots for the emission of covariant signals:
diff --git a/certmanager/lib/ui/keyselectiondialog.cpp b/certmanager/lib/ui/keyselectiondialog.cpp
index edb7ef201..7835c601f 100644
--- a/certmanager/lib/ui/keyselectiondialog.cpp
+++ b/certmanager/lib/ui/keyselectiondialog.cpp
@@ -265,29 +265,33 @@ namespace {
}
const TQPixmap * ColumnStrategy::pixmap( const GpgME::Key & key, int col ) const {
- if ( col != 0 )
+ if ( col != 0 ) {
return 0;
+ }
// this key did not undergo a validating keylisting yet:
- if ( !( key.keyListMode() & GpgME::Context::Validate ) )
+ if ( !( key.keyListMode() & GpgME::Context::Validate ) ) {
return &mKeyUnknownPix;
+ }
- if ( !checkKeyUsage( key, mKeyUsage ) )
+ if ( !checkKeyUsage( key, mKeyUsage ) ) {
return &mKeyBadPix;
+ }
- if ( key.protocol() == GpgME::Context::CMS )
+ if ( key.protocol() == GpgME::Context::CMS ) {
return &mKeyGoodPix;
+ }
switch ( key.userID(0).validity() ) {
- default:
- case GpgME::UserID::Unknown:
- case GpgME::UserID::Undefined:
- return &mKeyUnknownPix;
- case GpgME::UserID::Never:
- return &mKeyValidPix;
- case GpgME::UserID::Marginal:
- case GpgME::UserID::Full:
- case GpgME::UserID::Ultimate:
- return &mKeyGoodPix;
+ default:
+ case GpgME::UserID::Unknown:
+ case GpgME::UserID::Undefined:
+ return &mKeyUnknownPix;
+ case GpgME::UserID::Never:
+ return &mKeyValidPix;
+ case GpgME::UserID::Marginal:
+ case GpgME::UserID::Full:
+ case GpgME::UserID::Ultimate:
+ return &mKeyGoodPix;
}
}
@@ -585,8 +589,9 @@ namespace {
void Kleo::KeySelectionDialog::startKeyListJobForBackend( const CryptoBackend::Protocol * backend, const std::vector<GpgME::Key> & keys, bool validate ) {
assert( backend );
KeyListJob * job = backend->keyListJob( false, false, validate ); // local, w/o sigs, validation as givem
- if ( !job )
+ if ( !job ) {
return;
+ }
connect( job, TQT_SIGNAL(result(const GpgME::KeyListResult&)),
TQT_SLOT(slotKeyListResult(const GpgME::KeyListResult&)) );
@@ -599,8 +604,9 @@ void Kleo::KeySelectionDialog::startKeyListJobForBackend( const CryptoBackend::P
std::transform( keys.begin(), keys.end(), std::back_inserter( fprs ), ExtractFingerprint() );
const GpgME::Error err = job->start( fprs, mKeyUsage & SecretKeys && !( mKeyUsage & PublicKeys ) );
- if ( err )
+ if ( err ) {
return showKeyListError( this, err );
+ }
// FIXME: create a MultiProgressDialog:
(void)new ProgressDialog( job, validate ? i18n( "Checking selected keys..." ) : i18n( "Fetching keys..." ), this );
@@ -617,15 +623,18 @@ static void selectKeys( Kleo::KeyListView * klv, const std::vector<GpgME::Key> &
}
void Kleo::KeySelectionDialog::slotKeyListResult( const GpgME::KeyListResult & res ) {
- if ( res.error() )
+ if ( res.error() ) {
showKeyListError( this, res.error() );
- else if ( res.isTruncated() )
+ }
+ else if ( res.isTruncated() ) {
++mTruncated;
+ }
- if ( --mListJobCount > 0 )
+ if ( --mListJobCount > 0 ) {
return; // not yet finished...
+ }
- if ( mTruncated > 0 )
+ if ( mTruncated > 0 ) {
KMessageBox::information( this,
i18n("<qt>One backend returned truncated output.<br>"
"Not all available keys are shown</qt>",
@@ -633,6 +642,7 @@ void Kleo::KeySelectionDialog::slotKeyListResult( const GpgME::KeyListResult & r
"Not all available keys are shown</qt>",
mTruncated),
i18n("Key List Result") );
+ }
mKeyListView->flushKeys();
@@ -677,13 +687,16 @@ void Kleo::KeySelectionDialog::slotCheckSelection( KeyListViewItem * item ) {
mSelectedKeys.clear();
if ( !mKeyListView->isMultiSelection() ) {
- if ( item )
+ if ( item ) {
mSelectedKeys.push_back( item->key() );
+ }
}
- for ( KeyListViewItem * it = mKeyListView->firstChild() ; it ; it = it->nextSibling() )
- if ( it->isSelected() )
+ for ( KeyListViewItem * it = mKeyListView->firstChild() ; it ; it = it->nextSibling() ) {
+ if ( it->isSelected() ) {
mSelectedKeys.push_back( it->key() );
+ }
+ }
mKeysToCheck.clear();
std::remove_copy_if( mSelectedKeys.begin(), mSelectedKeys.end(),
@@ -700,8 +713,9 @@ void Kleo::KeySelectionDialog::slotCheckSelection( KeyListViewItem * item ) {
}
void Kleo::KeySelectionDialog::startValidatingKeyListing() {
- if ( mKeysToCheck.empty() )
+ if ( mKeysToCheck.empty() ) {
return;
+ }
mListJobCount = 0;
mTruncated = 0;
@@ -711,11 +725,14 @@ void Kleo::KeySelectionDialog::startValidatingKeyListing() {
mKeyListView->setEnabled( false );
std::vector<GpgME::Key> smime, openpgp;
- for ( std::vector<GpgME::Key>::const_iterator it = mKeysToCheck.begin() ; it != mKeysToCheck.end() ; ++it )
- if ( it->protocol() == GpgME::Context::OpenPGP )
+ for ( std::vector<GpgME::Key>::const_iterator it = mKeysToCheck.begin() ; it != mKeysToCheck.end() ; ++it ) {
+ if ( it->protocol() == GpgME::Context::OpenPGP ) {
openpgp.push_back( *it );
- else
+ }
+ else {
smime.push_back( *it );
+ }
+ }
if ( !openpgp.empty() ) {
assert( mOpenPGPBackend );