diff --git a/keyresolver.cpp b/keyresolver.cpp index 8c450fa28..13bb9d33d 100644 --- a/keyresolver.cpp +++ b/keyresolver.cpp @@ -1487,9 +1487,14 @@ std::vector Kleo::KeyResolver::signingKeys( CryptoMessageFormat f ) std::vector Kleo::KeyResolver::selectKeys( const QString & person, const QString & msg, const std::vector & selectedKeys ) const { + const bool opgp = containsOpenPGP( mCryptoMessageFormats ); + const bool x509 = containsSMIME( mCryptoMessageFormats ); + Kleo::KeySelectionDialog dlg( i18n("Encryption Key Selection"), msg, selectedKeys, - Kleo::KeySelectionDialog::ValidEncryptionKeys, + Kleo::KeySelectionDialog::ValidEncryptionKeys + & ~(opgp ? 0 : Kleo::KeySelectionDialog::OpenPGPKeys) + & ~(x509 ? 0 : Kleo::KeySelectionDialog::SMIMEKeys), true, true ); // multi-selection and "remember choice" box if ( dlg.exec() != QDialog::Accepted ) diff --git a/kleo_util.h b/kleo_util.h index 1bdb3219c..3aa5205a0 100644 --- a/kleo_util.h +++ b/kleo_util.h @@ -77,5 +77,12 @@ static inline bool isOpenPGP( Kleo::CryptoMessageFormat f ) { return f == Kleo::InlineOpenPGPFormat || f == Kleo::OpenPGPMIMEFormat ; } +static inline bool containsSMIME( unsigned int f ) { + return f & (Kleo::SMIMEFormat|Kleo::SMIMEOpaqueFormat) ; +} + +static inline bool containsOpenPGP( unsigned int f ) { + return f & (Kleo::OpenPGPMIMEFormat|Kleo::InlineOpenPGPFormat) ; +} #endif // __KDEPIM_KMAIL_KLEO_UTIL_H__