48 #include <gpgme++/key.h>
49 #include <gpgme++/keylistresult.h>
54 #include <kiconloader.h>
56 #include <kwindowsystem.h>
58 #include <kmessagebox.h>
59 #include <kpushbutton.h>
60 #include <kconfiggroup.h>
62 #include <klineedit.h>
67 #include <QToolButton>
77 #include <QPushButton>
79 #include <QApplication>
80 #include <QHBoxLayout>
81 #include <QVBoxLayout>
88 #include <qscrollbar.h>
90 static bool checkKeyUsage(
const GpgME::Key & key,
unsigned int keyUsage ) {
93 if ( key.isInvalid() ) {
94 if ( key.keyListMode() & GpgME::Validate ) {
95 kDebug(5150) <<
"key is invalid";
98 kDebug(5150) <<
"key is invalid - ignoring";
101 if ( key.isExpired() ) {
102 kDebug(5150) <<
"key is expired";
104 }
else if ( key.isRevoked() ) {
105 kDebug(5150) <<
"key is revoked";
107 }
else if ( key.isDisabled() ) {
108 kDebug(5150) <<
"key is disabled";
114 !key.canEncrypt() ) {
115 kDebug(5150) <<
"key can't encrypt";
120 kDebug(5150) <<
"key can't sign";
124 !key.canCertify() ) {
125 kDebug(5150) <<
"key can't certify";
129 !key.canAuthenticate() ) {
130 kDebug(5150) <<
"key can't authenticate";
137 kDebug(5150) <<
"key isn't secret";
142 key.protocol() == GpgME::OpenPGP &&
146 std::vector<GpgME::UserID> uids = key.userIDs();
147 for ( std::vector<GpgME::UserID>::const_iterator it = uids.begin() ; it != uids.end() ; ++it )
148 if ( !it->isRevoked() && it->validity() >= GpgME::UserID::Marginal )
150 kDebug(5150) <<
"key has no UIDs with validity >= Marginal";
159 static bool checkKeyUsage(
const std::vector<GpgME::Key> & keys,
unsigned int keyUsage ) {
160 for ( std::vector<GpgME::Key>::const_iterator it = keys.begin() ; it != keys.end() ; ++it )
169 return dt.toString();
176 ColumnStrategy(
unsigned int keyUsage );
178 QString title(
int col )
const;
179 int width(
int col,
const QFontMetrics & fm )
const;
181 QString text(
const GpgME::Key & key,
int col )
const;
182 QString toolTip(
const GpgME::Key & key,
int col )
const;
183 KIcon icon(
const GpgME::Key & key,
int col )
const;
186 const KIcon mKeyGoodPix, mKeyBadPix, mKeyUnknownPix, mKeyValidPix;
187 const unsigned int mKeyUsage;
190 ColumnStrategy::ColumnStrategy(
unsigned int keyUsage )
191 : Kleo::KeyListView::ColumnStrategy(),
192 mKeyGoodPix( QLatin1String(
"key_ok") ),
193 mKeyBadPix( QLatin1String(
"key_bad") ),
194 mKeyUnknownPix( QLatin1String(
"key_unknown") ),
195 mKeyValidPix( QLatin1String(
"key") ),
196 mKeyUsage( keyUsage )
198 kWarning( keyUsage == 0, 5150 )
199 <<
"KeySelectionDialog: keyUsage == 0. You want to use AllKeys instead.";
202 QString ColumnStrategy::title(
int col )
const {
204 case 0:
return i18n(
"Key ID");
205 case 1:
return i18n(
"User ID");
210 int ColumnStrategy::width(
int col,
const QFontMetrics & fm )
const {
212 static const char hexchars[] =
"0123456789ABCDEF";
214 for (
unsigned int i = 0 ; i < 16 ; ++i )
215 maxWidth = qMax( fm.width( QLatin1Char( hexchars[i] ) ), maxWidth );
216 return 8 * maxWidth + 2 * KIconLoader::SizeSmall;
221 QString ColumnStrategy::text(
const GpgME::Key & key,
int col )
const {
225 if ( key.shortKeyID() )
226 return QString::fromUtf8( key.shortKeyID() );
228 return i18n(
"<placeholder>unknown</placeholder>");
233 const char * uid = key.userID(0).id();
234 if ( key.protocol() == GpgME::OpenPGP )
235 return uid && *uid ? QString::fromUtf8( uid ) :
QString() ;
244 QString ColumnStrategy::toolTip(
const GpgME::Key & key,
int )
const {
245 const char * uid = key.userID(0).id();
246 const char * fpr = key.primaryFingerprint();
247 const char * issuer = key.issuerName();
248 const GpgME::Subkey subkey = key.subkey(0);
249 const QString expiry = subkey.neverExpires() ? i18n(
"never") :
time_t2string( subkey.expirationTime() ) ;
251 if ( key.protocol() == GpgME::OpenPGP )
252 return i18n(
"OpenPGP key for %1\n"
256 uid ? QString::fromUtf8( uid ) : i18n(
"unknown"),
258 fpr ? QString::fromLatin1( fpr ) : i18n(
"unknown") );
260 return i18n(
"S/MIME key for %1\n"
265 uid ?
Kleo::DN( uid ).prettyDN() : i18n(
"unknown"),
267 fpr ? QString::fromLatin1( fpr ) : i18n(
"unknown"),
268 issuer ?
Kleo::DN( issuer ).prettyDN() : i18n(
"unknown") );
271 KIcon ColumnStrategy::icon(
const GpgME::Key & key,
int col )
const {
275 if ( !( key.keyListMode() & GpgME::Validate ) )
276 return mKeyUnknownPix;
281 if ( key.protocol() == GpgME::CMS )
284 switch ( key.userID(0).validity() ) {
286 case GpgME::UserID::Unknown:
287 case GpgME::UserID::Undefined:
288 return mKeyUnknownPix;
289 case GpgME::UserID::Never:
291 case GpgME::UserID::Marginal:
292 case GpgME::UserID::Full:
293 case GpgME::UserID::Ultimate:
305 const std::vector<GpgME::Key> & selectedKeys,
306 unsigned int keyUsage,
307 bool extendedSelection,
312 mOpenPGPBackend( 0 ),
315 mSelectedKeys( selectedKeys ),
316 mKeyUsage( keyUsage ),
317 mCurrentContextMenuItem( 0 )
320 setButtons( User1|User2|Ok|Cancel );
321 setDefaultButton( Ok );
323 init( rememberChoice, extendedSelection, text,
QString() );
329 const std::vector<GpgME::Key> & selectedKeys,
330 unsigned int keyUsage,
331 bool extendedSelection,
336 mOpenPGPBackend( 0 ),
339 mSelectedKeys( selectedKeys ),
340 mKeyUsage( keyUsage ),
341 mSearchText( initialQuery ),
342 mInitialQuery( initialQuery ),
343 mCurrentContextMenuItem( 0 )
346 setButtons( User1|User2|Ok|Cancel );
347 setDefaultButton( Ok );
349 init( rememberChoice, extendedSelection, text, initialQuery );
355 unsigned int keyUsage,
356 bool extendedSelection,
361 mOpenPGPBackend( 0 ),
364 mKeyUsage( keyUsage ),
365 mSearchText( initialQuery ),
366 mInitialQuery( initialQuery ),
367 mCurrentContextMenuItem( 0 )
370 setButtons( User1|User2|Ok|Cancel );
371 setDefaultButton( Ok );
373 init( rememberChoice, extendedSelection, text, initialQuery );
376 void Kleo::KeySelectionDialog::init(
bool rememberChoice,
bool extendedSelection,
378 if ( mKeyUsage & OpenPGPKeys )
380 if ( mKeyUsage & SMIMEKeys )
383 mCheckSelectionTimer =
new QTimer(
this );
384 mStartSearchTimer =
new QTimer(
this );
387 setMainWidget( page );
388 mTopLayout =
new QVBoxLayout( page );
389 mTopLayout->setMargin( 0 );
390 mTopLayout->setSpacing( spacingHint() );
392 if ( !text.isEmpty() ) {
393 #ifndef KDEPIM_MOBILE_UI
394 QLabel* textLabel =
new QLabel( text, page );
395 textLabel->setWordWrap(
true );
399 textLabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
400 connect( textLabel, SIGNAL(linkActivated(
QString)), SLOT(slotStartCertificateManager(
QString)) );
401 mTopLayout->addWidget( textLabel );
405 #ifndef KDEPIM_MOBILE_UI
406 QPushButton *
const searchExternalPB =
407 new QPushButton( i18n(
"Search for &External Certificates" ), page );
408 mTopLayout->addWidget( searchExternalPB, 0, Qt::AlignLeft );
409 connect( searchExternalPB, SIGNAL(clicked()),
410 this, SLOT(slotStartSearchForExternalCertificates()) );
411 if ( initialQuery.isEmpty() ) {
412 searchExternalPB->hide();
416 QHBoxLayout * hlay =
new QHBoxLayout();
417 mTopLayout->addLayout( hlay );
419 KLineEdit * le =
new KLineEdit( page );
420 le->setClearButtonShown(
true);
421 le->setText( initialQuery );
423 QLabel* lbSearchFor =
new QLabel( i18n(
"&Search for:"), page ) ;
424 lbSearchFor->setBuddy(le);
426 hlay->addWidget(lbSearchFor);
427 hlay->addWidget( le, 1 );
430 connect( le, SIGNAL(textChanged(
QString)),
431 this, SLOT(slotSearch(
QString)) );
432 connect( mStartSearchTimer, SIGNAL(timeout()), SLOT(slotFilter()) );
434 mKeyListView =
new KeyListView(
new ColumnStrategy( mKeyUsage ), 0, page );
435 mKeyListView->setObjectName( QLatin1String(
"mKeyListView") );
436 mKeyListView->header()->stretchLastSection();
437 mKeyListView->setRootIsDecorated(
true );
438 mKeyListView->setSortingEnabled(
true );
439 mKeyListView->header()->setSortIndicatorShown(
true );
440 mKeyListView->header()->setSortIndicator( 1, Qt::AscendingOrder );
441 if ( extendedSelection )
442 mKeyListView->setSelectionMode( QAbstractItemView::ExtendedSelection );
443 mTopLayout->addWidget( mKeyListView, 10 );
445 if ( rememberChoice ) {
446 #ifndef KDEPIM_MOBILE_UI
447 mRememberCB =
new QCheckBox( i18n(
"&Remember choice"), page );
448 mTopLayout->addWidget( mRememberCB );
449 mRememberCB->setWhatsThis(
450 i18n(
"<qt><p>If you check this box your choice will "
451 "be stored and you will not be asked again."
456 connect( mCheckSelectionTimer, SIGNAL(timeout()),
457 SLOT(slotCheckSelection()) );
460 connect( mKeyListView,
463 connect( mKeyListView,
467 setButtonText( KDialog::User1, i18n(
"&Reread Keys") );
468 setButtonText( KDialog::User2, i18n(
"&Start Certificate Manager") );
469 connect(
this, SIGNAL(user1Clicked()),
this, SLOT(slotRereadKeys()) );
470 connect(
this, SIGNAL(user2Clicked()),
this, SLOT(slotStartCertificateManager()) );
471 connect(
this, SIGNAL(okClicked()),
this, SLOT(slotOk()));
472 connect(
this, SIGNAL(cancelClicked()),
this,SLOT(slotCancel()));
474 mTopLayout->activate();
477 QSize dialogSize( sizeHint() );
478 int iconSize = IconSize(KIconLoader::Desktop);
479 int miniSize = IconSize(KIconLoader::Small);
480 KWindowSystem::setIcons( winId(), qApp->windowIcon().pixmap(iconSize, iconSize),
481 qApp->windowIcon().pixmap(miniSize, miniSize) );
483 KConfigGroup dialogConfig( KGlobal::config(),
"Key Selection Dialog" );
484 dialogSize = dialogConfig.readEntry(
"Dialog size", dialogSize );
485 resize( dialogSize );
490 KConfigGroup dialogConfig( KGlobal::config(),
"Key Selection Dialog" );
491 dialogConfig.writeEntry(
"Dialog size", size() );
496 void Kleo::KeySelectionDialog::connectSignals() {
497 if ( mKeyListView->isMultiSelection() )
498 connect( mKeyListView, SIGNAL(itemSelectionChanged()),
499 SLOT(slotSelectionChanged()) );
505 void Kleo::KeySelectionDialog::disconnectSignals() {
506 if ( mKeyListView->isMultiSelection() )
507 disconnect( mKeyListView, SIGNAL(itemSelectionChanged()),
508 this, SLOT(slotSelectionChanged()) );
515 static const GpgME::Key null = GpgME::Key::null;
516 if ( mKeyListView->isMultiSelection() || !mKeyListView->selectedItem() )
518 return mKeyListView->selectedItem()->key();
522 return QLatin1String(selectedKey().primaryFingerprint());
527 for ( std::vector<GpgME::Key>::const_iterator it = mSelectedKeys.begin() ; it != mSelectedKeys.end() ; ++it )
528 if (
const char * fpr = it->primaryFingerprint() )
529 result.push_back( QLatin1String(fpr) );
535 for ( std::vector<GpgME::Key>::const_iterator it = mSelectedKeys.begin() ; it != mSelectedKeys.end() ; ++it )
536 if ( it->protocol() == GpgME::OpenPGP )
537 if (
const char * fpr = it->primaryFingerprint() )
538 result.push_back( QLatin1String(fpr) );
544 for ( std::vector<GpgME::Key>::const_iterator it = mSelectedKeys.begin() ; it != mSelectedKeys.end() ; ++it )
545 if ( it->protocol() == GpgME::CMS )
546 if (
const char * fpr = it->primaryFingerprint() )
547 result.push_back( QLatin1String(fpr) );
551 void Kleo::KeySelectionDialog::slotRereadKeys() {
552 mKeyListView->clear();
555 mSavedOffsetY = mKeyListView->verticalScrollBar()->value();
558 mKeyListView->setEnabled(
false );
561 if ( mOpenPGPBackend )
562 startKeyListJobForBackend( mOpenPGPBackend, std::vector<GpgME::Key>(),
false );
564 startKeyListJobForBackend( mSMIMEBackend, std::vector<GpgME::Key>(),
false );
566 if ( mListJobCount == 0 ) {
567 mKeyListView->setEnabled(
true );
568 KMessageBox::information(
this,
569 i18n(
"No backends found for listing keys. "
570 "Check your installation."),
571 i18n(
"Key Listing Failed") );
576 void Kleo::KeySelectionDialog::slotStartCertificateManager(
const QString &query )
582 if ( !query.isEmpty() )
583 args << QLatin1String(
"--external") << QLatin1String(
"--query") << KUrl::decode_string( query );
586 if( !QProcess::startDetached( QLatin1String(
"kleopatra"), args ) )
587 KMessageBox::error(
this,
588 i18n(
"Could not start certificate manager; "
589 "please check your installation." ),
590 i18n(
"Certificate Manager Error" ) );
592 kDebug(5150) <<
"\nslotStartCertManager(): certificate manager started.";
595 #ifndef __KLEO_UI_SHOW_KEY_LIST_ERROR_H__
596 #define __KLEO_UI_SHOW_KEY_LIST_ERROR_H__
599 const QString msg = i18n(
"<qt><p>An error occurred while fetching "
600 "the keys from the backend:</p>"
601 "<p><b>%1</b></p></qt>" ,
602 QString::fromLocal8Bit( err.asString() ) );
604 KMessageBox::error( parent, msg, i18n(
"Key Listing Failed" ) );
606 #endif // __KLEO_UI_SHOW_KEY_LIST_ERROR_H__
609 struct ExtractFingerprint {
610 QString operator()(
const GpgME::Key & key ) {
611 return QLatin1String(key.primaryFingerprint());
616 void Kleo::KeySelectionDialog::startKeyListJobForBackend(
const CryptoBackend::Protocol * backend,
const std::vector<GpgME::Key> & keys,
bool validate ) {
618 KeyListJob * job = backend->keyListJob(
false,
false, validate );
622 connect( job, SIGNAL(result(GpgME::KeyListResult)),
623 SLOT(slotKeyListResult(GpgME::KeyListResult)) );
625 connect( job, SIGNAL(nextKey(GpgME::Key)),
626 mKeyListView, SLOT(slotRefreshKey(GpgME::Key)) );
628 connect( job, SIGNAL(nextKey(GpgME::Key)),
629 mKeyListView, SLOT(slotAddKey(GpgME::Key)) );
632 std::transform( keys.begin(), keys.end(), std::back_inserter( fprs ), ExtractFingerprint() );
633 const GpgME::Error err = job->start( fprs, mKeyUsage & SecretKeys && !( mKeyUsage & PublicKeys ) );
638 #ifndef LIBKLEO_NO_PROGRESSDIALOG
640 (void)
new ProgressDialog( job, validate ? i18n(
"Checking selected keys..." ) : i18n(
"Fetching keys..." ), this );
646 klv->clearSelection();
647 if ( selectedKeys.empty() )
649 for ( std::vector<GpgME::Key>::const_iterator it = selectedKeys.begin() ; it != selectedKeys.end() ; ++it )
651 item->setSelected(
true );
654 void Kleo::KeySelectionDialog::slotKeyListResult(
const GpgME::KeyListResult & res ) {
657 else if ( res.isTruncated() )
660 if ( --mListJobCount > 0 )
663 if ( mTruncated > 0 )
664 KMessageBox::information(
this,
665 i18np(
"<qt>One backend returned truncated output.<p>"
666 "Not all available keys are shown</p></qt>",
667 "<qt>%1 backends returned truncated output.<p>"
668 "Not all available keys are shown</p></qt>",
670 i18n(
"Key List Result") );
672 mKeyListView->flushKeys();
674 mKeyListView->setEnabled(
true );
675 mListJobCount = mTruncated = 0;
676 mKeysToCheck.clear();
684 slotSelectionChanged();
687 mKeyListView->verticalScrollBar()->setValue( mSavedOffsetY ); mSavedOffsetY = 0;
690 void Kleo::KeySelectionDialog::slotSelectionChanged() {
691 kDebug(5150) <<
"KeySelectionDialog::slotSelectionChanged()";
696 mCheckSelectionTimer->start( sCheckSelectionDelay );
700 struct AlreadyChecked {
701 bool operator()(
const GpgME::Key & key )
const {
702 return key.keyListMode() & GpgME::Validate ;
707 void Kleo::KeySelectionDialog::slotCheckSelection( KeyListViewItem * item ) {
708 kDebug(5150) <<
"KeySelectionDialog::slotCheckSelection()";
710 mCheckSelectionTimer->stop();
712 mSelectedKeys.clear();
714 if ( !mKeyListView->isMultiSelection() ) {
716 mSelectedKeys.push_back( item->key() );
719 for ( KeyListViewItem * it = mKeyListView->firstChild() ; it ; it = it->nextSibling() )
720 if ( it->isSelected() )
721 mSelectedKeys.push_back( it->key() );
723 mKeysToCheck.clear();
724 std::remove_copy_if( mSelectedKeys.begin(), mSelectedKeys.end(),
725 std::back_inserter( mKeysToCheck ),
727 if ( mKeysToCheck.empty() ) {
728 enableButton( Ok, !mSelectedKeys.empty() &&
734 startValidatingKeyListing();
737 void Kleo::KeySelectionDialog::startValidatingKeyListing() {
738 if ( mKeysToCheck.empty() )
743 mSavedOffsetY = mKeyListView->verticalScrollBar()->value();
746 mKeyListView->setEnabled(
false );
748 std::vector<GpgME::Key> smime, openpgp;
749 for ( std::vector<GpgME::Key>::const_iterator it = mKeysToCheck.begin() ; it != mKeysToCheck.end() ; ++it )
750 if ( it->protocol() == GpgME::OpenPGP )
751 openpgp.push_back( *it );
753 smime.push_back( *it );
755 if ( !openpgp.empty() ) {
756 assert( mOpenPGPBackend );
757 startKeyListJobForBackend( mOpenPGPBackend, openpgp,
true );
759 if ( !smime.empty() ) {
760 assert( mSMIMEBackend );
761 startKeyListJobForBackend( mSMIMEBackend, smime,
true );
764 assert( mListJobCount > 0 );
768 return mRememberCB && mRememberCB->isChecked() ;
774 mCurrentContextMenuItem = item;
777 menu.addAction( i18n(
"Recheck Key" ),
this, SLOT(slotRecheckKey()) );
781 void Kleo::KeySelectionDialog::slotRecheckKey() {
782 if ( !mCurrentContextMenuItem || mCurrentContextMenuItem->key().isNull() )
785 mKeysToCheck.clear();
786 mKeysToCheck.push_back( mCurrentContextMenuItem->key() );
789 void Kleo::KeySelectionDialog::slotTryOk() {
790 if ( !mSelectedKeys.empty() &&
checkKeyUsage( mSelectedKeys, mKeyUsage ) )
794 void Kleo::KeySelectionDialog::slotOk() {
795 if ( mCheckSelectionTimer->isActive() )
796 slotCheckSelection();
799 if ( !mSelectedKeys.empty() &&
checkKeyUsage( mSelectedKeys, mKeyUsage ) )
802 mStartSearchTimer->stop();
807 void Kleo::KeySelectionDialog::slotCancel() {
808 mCheckSelectionTimer->stop();
809 mStartSearchTimer->stop();
813 void Kleo::KeySelectionDialog::slotSearch(
const QString & text ) {
814 mSearchText = text.trimmed().toUpper();
818 void Kleo::KeySelectionDialog::slotSearch() {
819 mStartSearchTimer->setSingleShot(
true );
820 mStartSearchTimer->start( sCheckSelectionDelay );
823 void Kleo::KeySelectionDialog::slotFilter() {
824 if ( mSearchText.isEmpty() ) {
830 QRegExp keyIdRegExp( QLatin1String(
"(?:0x)?[A-F0-9]{1,8}"), Qt::CaseInsensitive );
831 if ( keyIdRegExp.exactMatch( mSearchText ) ) {
832 if ( mSearchText.startsWith( QLatin1String(
"0X") ) )
834 filterByKeyID( mSearchText.mid( 2 ) );
837 filterByKeyIDOrUID( mSearchText );
840 filterByUID( mSearchText );
844 void Kleo::KeySelectionDialog::filterByKeyID(
const QString & keyID ) {
845 assert( keyID.length() <= 8 );
846 assert( !keyID.isEmpty() );
847 if ( keyID.isEmpty() )
850 for ( KeyListViewItem * item = mKeyListView->firstChild() ; item ; item = item->
nextSibling() )
851 item->setHidden( !item->text( 0 ).toUpper().startsWith( keyID ) );
858 const std::vector<GpgME::UserID> uids = item->
key().userIDs();
859 for ( std::vector<GpgME::UserID>::const_iterator it = uids.begin() ; it != uids.end() ; ++it )
860 if ( it->id() && rx.indexIn( QString::fromUtf8( it->id() ) ) >= 0 )
865 void Kleo::KeySelectionDialog::filterByKeyIDOrUID(
const QString & str ) {
866 assert( !str.isEmpty() );
869 QRegExp rx( QLatin1String(
"\\b") + QRegExp::escape( str ), Qt::CaseInsensitive );
871 for ( KeyListViewItem * item = mKeyListView->firstChild() ; item ; item = item->
nextSibling() )
872 item->setHidden( !item->text( 0 ).toUpper().startsWith( str ) && !
anyUIDMatches( item, rx ) );
876 void Kleo::KeySelectionDialog::filterByUID(
const QString & str ) {
877 assert( !str.isEmpty() );
880 QRegExp rx( QLatin1String(
"\\b") + QRegExp::escape( str ), Qt::CaseInsensitive );
882 for ( KeyListViewItem * item = mKeyListView->firstChild() ; item ; item = item->
nextSibling() )
887 void Kleo::KeySelectionDialog::showAllItems() {
888 for ( KeyListViewItem * item = mKeyListView->firstChild() ; item ; item = item->
nextSibling() )
889 item->setHidden(
false );
892 #include "keyselectiondialog.moc"
static QString time_t2string(time_t t)
QStringList smimeFingerprints() const
Return the selected smime fingerprints.
static void selectKeys(Kleo::KeyListView *klv, const std::vector< GpgME::Key > &selectedKeys)
virtual int width(int column, const QFontMetrics &fm) const
const CryptoBackend::Protocol * smime() const
QString fingerprint() const
static CryptoBackendFactory * instance()
static void showKeyListError(QWidget *parent, const GpgME::Error &err)
const GpgME::Key & selectedKey() const
Returns the key ID of the selected key in single selection mode.
static const int sCheckSelectionDelay
KeyListViewItem * nextSibling() const
bool rememberSelection() const
QStringList fingerprints() const
Return all the selected fingerprints.
KeySelectionDialog(const QString &title, const QString &text, const std::vector< GpgME::Key > &selectedKeys=std::vector< GpgME::Key >(), unsigned int keyUsage=AllKeys, bool extendedSelection=false, bool rememberChoice=false, QWidget *parent=0, bool modal=true)
KeyListViewItem * itemByFingerprint(const QByteArray &) const
const GpgME::Key & key() const
static bool checkKeyUsage(const GpgME::Key &key, unsigned int keyUsage)
QStringList pgpKeyFingerprints() const
Return the selected openpgp fingerprints.
static bool anyUIDMatches(const Kleo::KeyListViewItem *item, QRegExp &rx)
const CryptoBackend::Protocol * openpgp() const