|
|
|
@ -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 );
|
|
|
|
|