12#include <config-libkleo.h>
14#include "newkeyapprovaldialog.h"
16#include "keyselectioncombo.h"
17#include "progressdialog.h"
19#include <libkleo/adjustingscrollarea.h>
20#include <libkleo/algorithm.h>
21#include <libkleo/compliance.h>
22#include <libkleo/debug.h>
23#include <libkleo/defaultkeyfilter.h>
24#include <libkleo/formatting.h>
25#include <libkleo/gnupg.h>
26#include <libkleo/keyhelpers.h>
27#include <libkleo/systeminfo.h>
29#include <libkleo_debug.h>
31#include <KColorScheme>
32#include <KLocalizedString>
35#include <QGpgME/Protocol>
36#include <QGpgME/QuickJob>
38#include <QButtonGroup>
40#include <QDialogButtonBox>
46#include <QRadioButton>
51#include <gpgme++/context.h>
52#include <gpgme++/key.h>
53#include <gpgme++/keygenerationresult.h>
66 setHasEncrypt(DefaultKeyFilter::Set);
69static std::shared_ptr<KeyFilter> s_encryptFilter = std::shared_ptr<KeyFilter>(
new EncryptFilter);
77 setIsOpenPGP(DefaultKeyFilter::Set);
78 setHasEncrypt(DefaultKeyFilter::Set);
81static std::shared_ptr<KeyFilter> s_pgpEncryptFilter = std::shared_ptr<KeyFilter>(
new OpenPGPFilter);
90 setDisabled(DefaultKeyFilter::NotSet);
91 setRevoked(DefaultKeyFilter::NotSet);
92 setExpired(DefaultKeyFilter::NotSet);
93 setCanSign(DefaultKeyFilter::Set);
94 setHasSecret(DefaultKeyFilter::Set);
95 setIsOpenPGP(DefaultKeyFilter::Set);
98static std::shared_ptr<KeyFilter> s_pgpSignFilter = std::shared_ptr<KeyFilter>(
new OpenPGPSignFilter);
106 setIsOpenPGP(DefaultKeyFilter::NotSet);
107 setHasEncrypt(DefaultKeyFilter::Set);
110static std::shared_ptr<KeyFilter> s_smimeEncryptFilter = std::shared_ptr<KeyFilter>(
new SMIMEFilter);
118 setDisabled(DefaultKeyFilter::NotSet);
119 setRevoked(DefaultKeyFilter::NotSet);
120 setExpired(DefaultKeyFilter::NotSet);
121 setCanSign(DefaultKeyFilter::Set);
122 setIsOpenPGP(DefaultKeyFilter::NotSet);
123 setHasSecret(DefaultKeyFilter::Set);
126static std::shared_ptr<KeyFilter> s_smimeSignFilter = std::shared_ptr<KeyFilter>(
new SMIMESignFilter);
129class ComboWidget :
public QWidget
133 explicit ComboWidget(KeySelectionCombo *combo)
140 infoBtn->setIconSize(
QSize(22, 22));
141 infoBtn->setFlat(
true);
142 infoBtn->setAccessibleName(
i18nc(
"@action:button",
"Show Details"));
143 hLay->addWidget(infoBtn);
144 hLay->addWidget(combo, 1);
145 hLay->addWidget(mFilterBtn, 0);
158 mFilterBtn->setMinimumHeight(23);
160 updateFilterButton();
163 const QString curFilter = mCombo->idFilter();
165 setIdFilter(mLastIdFilter);
169 mLastIdFilter = curFilter;
174 void setIdFilter(
const QString &
id)
176 mCombo->setIdFilter(
id);
177 updateFilterButton();
180 void updateFilterButton()
182 if (mCombo->idFilter().isEmpty()) {
184 mFilterBtn->setAccessibleName(
i18nc(
"@action:button",
"Show Matching Keys"));
185 mFilterBtn->setToolTip(
i18nc(
"@info:tooltip",
"Show keys matching the email address"));
188 mFilterBtn->setAccessibleName(
i18nc(
"@action:button short for 'Show all keys'",
"Show All"));
189 mFilterBtn->setToolTip(
i18nc(
"@info:tooltip",
"Show all keys"));
193 KeySelectionCombo *combo()
198 GpgME::Protocol fixedProtocol()
const
200 return mFixedProtocol;
203 void setFixedProtocol(GpgME::Protocol proto)
205 mFixedProtocol = proto;
209 KeySelectionCombo *mCombo;
212 GpgME::Protocol mFixedProtocol = GpgME::UnknownProtocol;
215static bool key_has_addr(
const GpgME::Key &key,
const QString &addr)
217 for (
const auto &uid : key.userIDs()) {
225Key findfirstKeyOfType(
const std::vector<Key> &keys, GpgME::Protocol protocol)
227 const auto it = std::find_if(std::begin(keys), std::end(keys), [protocol](
const auto &key) {
228 return key.protocol() == protocol;
230 return it != std::end(keys) ? *it : Key();
235class NewKeyApprovalDialog::Private
253 GpgME::Protocol forcedProtocol,
254 GpgME::Protocol presetProtocol,
257 : mForcedProtocol{forcedProtocol}
261 , mAllowMixed{allowMixed}
264 Q_ASSERT(forcedProtocol == GpgME::UnknownProtocol || presetProtocol == GpgME::UnknownProtocol || presetProtocol == forcedProtocol);
265 Q_ASSERT(!allowMixed || (allowMixed && forcedProtocol == GpgME::UnknownProtocol));
266 Q_ASSERT(!(!allowMixed && presetProtocol == GpgME::UnknownProtocol));
269 mGenerateTooltip =
i18nc(
270 "@info:tooltip for a 'Generate new key pair' action "
271 "in a combobox when a user does not yet have an OpenPGP or S/MIME key.",
272 "Generate a new key using your email address.<br/><br/>"
273 "The key is necessary to decrypt and sign emails. "
274 "You will be asked for a passphrase to protect this key and the protected key "
275 "will be stored in your home directory.");
314 mFormatBtns->
addButton(pgpBtn, OpenPGPButtonId);
315 mFormatBtns->
addButton(smimeBtn, SMIMEButtonId);
322 fmtLayout->addStretch(-1);
323 fmtLayout->addWidget(pgpBtn);
324 fmtLayout->addWidget(smimeBtn);
327 if (mForcedProtocol != GpgME::UnknownProtocol) {
328 pgpBtn->
setChecked(mForcedProtocol == GpgME::OpenPGP);
329 smimeBtn->
setChecked(mForcedProtocol == GpgME::CMS);
333 pgpBtn->
setChecked(presetProtocol == GpgME::OpenPGP || presetProtocol == GpgME::UnknownProtocol);
334 smimeBtn->
setChecked(presetProtocol == GpgME::CMS || presetProtocol == GpgME::UnknownProtocol);
340 mFormatBtns->
button(buttonId == OpenPGPButtonId ? SMIMEButtonId : OpenPGPButtonId)->
setChecked(
true);
347 mComplianceLbl =
new QLabel;
355 btnLayout->addWidget(btnBox);
361 ~Private() =
default;
363 GpgME::Protocol currentProtocol()
365 const bool openPGPButtonChecked = mFormatBtns->
button(OpenPGPButtonId)->
isChecked();
366 const bool smimeButtonChecked = mFormatBtns->
button(SMIMEButtonId)->
isChecked();
368 if (openPGPButtonChecked && !smimeButtonChecked) {
369 return GpgME::OpenPGP;
371 if (!openPGPButtonChecked && smimeButtonChecked) {
374 }
else if (openPGPButtonChecked) {
375 return GpgME::OpenPGP;
376 }
else if (smimeButtonChecked) {
379 return GpgME::UnknownProtocol;
382 auto findVisibleKeySelectionComboWithGenerateKey()
384 const auto it = std::find_if(std::begin(mAllCombos), std::end(mAllCombos), [](
auto combo) {
387 return it != std::end(mAllCombos) ? *it :
nullptr;
390 void generateKey(KeySelectionCombo *combo)
392 if (!mRunningJobs.
empty()) {
396 auto job = QGpgME::openpgp()->quickJob();
398 new Kleo::ProgressDialog(job,
i18n(
"Generating key for '%1'...", addr) + QStringLiteral(
"\n\n") +
i18n(
"This can take several minutes."), q);
400 progress->setWindowTitle(
i18nc(
"@title:window",
"Key generation"));
401 progress->setModal(
true);
402 progress->setAutoClose(
true);
403 progress->setMinimumDuration(0);
404 progress->setValue(0);
407 if (!
connect(job, &QGpgME::QuickJob::result, q, [
this, job, combo]() {
408 handleKeyGenResult(QGpgME::Job::context(job)->keyGenerationResult(), job, combo);
410 qCWarning(LIBKLEO_LOG) <<
"new-style connect failed; connecting to QGpgME::QuickJob::result the old way";
411 connect(job, SIGNAL(
result(
const GpgME::Error &)), q, SLOT(handleKeyGenResult()));
413 job->startCreate(addr,
nullptr);
417 void handleKeyGenResult(
const GpgME::KeyGenerationResult &
result, QGpgME::Job *job, KeySelectionCombo *combo)
419 mLastError =
result.error();
421 connect(combo, &KeySelectionCombo::keyListingFinished, q, [
this, job]() {
425 for (
auto c : std::as_const(mAllCombos)) {
426 if (c->currentData(
Qt::UserRole).toInt() == GenerateKey) {
440 mRunningJobs.
clear();
444 if (!mRunningJobs.
empty()) {
449 mAcceptedResult.
protocol = currentProtocol();
450 for (
const auto combo : std::as_const(mEncCombos)) {
452 const auto key = combo->currentKey();
453 if (!combo->
isVisible() || key.isNull()) {
458 for (
const auto combo : std::as_const(mSigningCombos)) {
459 const auto key = combo->currentKey();
460 if (!combo->
isVisible() || key.isNull()) {
474 if (
auto combo = findVisibleKeySelectionComboWithGenerateKey()) {
481 auto encryptionKeyFilter(GpgME::Protocol protocol)
485 return s_pgpEncryptFilter;
487 return s_smimeEncryptFilter;
489 return s_encryptFilter;
495 const GpgME::Protocol protocol = currentProtocol();
496 const auto encryptionFilter = encryptionKeyFilter(protocol);
498 for (
auto combo : std::as_const(mSigningCombos)) {
501 qCDebug(LIBKLEO_LOG) <<
"Failed to find signature combo widget";
504 widget->setVisible(protocol == GpgME::UnknownProtocol || widget->fixedProtocol() == GpgME::UnknownProtocol || widget->fixedProtocol() == protocol);
506 for (
auto combo : std::as_const(mEncCombos)) {
509 qCDebug(LIBKLEO_LOG) <<
"Failed to find combo widget";
512 widget->setVisible(protocol == GpgME::UnknownProtocol || widget->fixedProtocol() == GpgME::UnknownProtocol || widget->fixedProtocol() == protocol);
513 if (widget->isVisible() && combo->
property(
"address") != mSender) {
514 combo->setKeyFilter(encryptionFilter);
518 const auto protocolLabels = q->
findChildren<
QLabel *>(QStringLiteral(
"protocol label"));
519 for (
auto label : protocolLabels) {
520 label->setVisible(protocol == GpgME::UnknownProtocol);
524 auto createProtocolLabel(GpgME::Protocol protocol)
526 auto label =
new QLabel(Formatting::displayName(protocol));
531 ComboWidget *createSigningCombo(
const QString &addr,
const GpgME::Key &key, GpgME::Protocol protocol = GpgME::UnknownProtocol)
533 Q_ASSERT(!key.isNull() || protocol != UnknownProtocol);
534 protocol = !key.isNull() ? key.protocol() : protocol;
536 auto combo =
new KeySelectionCombo{
true, KeyUsage::Sign};
537 auto comboWidget =
new ComboWidget(combo);
541 if (protocol == GpgME::OpenPGP) {
542 combo->setKeyFilter(s_pgpSignFilter);
543 }
else if (protocol == GpgME::CMS) {
544 combo->setKeyFilter(s_smimeSignFilter);
546 if (key.isNull() || key_has_addr(key, mSender)) {
547 comboWidget->setIdFilter(mSender);
549 comboWidget->setFixedProtocol(protocol);
553 if (key.isNull() && protocol == OpenPGP) {
554 combo->appendCustomItem(
QIcon::fromTheme(QStringLiteral(
"document-new")),
i18n(
"Generate a new key pair"), GenerateKey, mGenerateTooltip);
556 combo->appendCustomItem(Formatting::unavailableIcon(),
557 i18n(
"Do not sign this email"),
559 i18nc(
"@info:tooltip for not selecting a key for signing.",
"The email will not be cryptographically signed."));
561 mSigningCombos << combo;
563 combo->setProperty(
"address", addr);
565 connect(combo, &KeySelectionCombo::currentKeyChanged, q, [
this]() {
575 void setSigningKeys(
const std::vector<GpgME::Key> &preferredKeys,
const std::vector<GpgME::Key> &alternativeKeys)
577 auto group =
new QGroupBox(
i18nc(
"Caption for signing key selection",
"Confirm identity '%1' as:", mSender));
581 const bool mayNeedOpenPGP = mForcedProtocol != CMS;
582 const bool mayNeedCMS = mForcedProtocol != OpenPGP;
583 if (mayNeedOpenPGP) {
585 sigLayout->addWidget(createProtocolLabel(OpenPGP));
587 const Key preferredKey = findfirstKeyOfType(preferredKeys, OpenPGP);
588 const Key alternativeKey = findfirstKeyOfType(alternativeKeys, OpenPGP);
589 if (!preferredKey.isNull()) {
590 qCDebug(LIBKLEO_LOG) <<
"setSigningKeys - creating signing combo for" << preferredKey;
591 auto comboWidget = createSigningCombo(mSender, preferredKey);
592 sigLayout->addWidget(comboWidget);
593 }
else if (!alternativeKey.isNull()) {
594 qCDebug(LIBKLEO_LOG) <<
"setSigningKeys - creating signing combo for" << alternativeKey;
595 auto comboWidget = createSigningCombo(mSender, alternativeKey);
596 sigLayout->addWidget(comboWidget);
598 qCDebug(LIBKLEO_LOG) <<
"setSigningKeys - creating signing combo for OpenPGP key";
599 auto comboWidget = createSigningCombo(mSender, Key(), OpenPGP);
600 sigLayout->addWidget(comboWidget);
605 sigLayout->addWidget(createProtocolLabel(CMS));
607 const Key preferredKey = findfirstKeyOfType(preferredKeys, CMS);
608 const Key alternativeKey = findfirstKeyOfType(alternativeKeys, CMS);
609 if (!preferredKey.isNull()) {
610 qCDebug(LIBKLEO_LOG) <<
"setSigningKeys - creating signing combo for" << preferredKey;
611 auto comboWidget = createSigningCombo(mSender, preferredKey);
612 sigLayout->addWidget(comboWidget);
613 }
else if (!alternativeKey.isNull()) {
614 qCDebug(LIBKLEO_LOG) <<
"setSigningKeys - creating signing combo for" << alternativeKey;
615 auto comboWidget = createSigningCombo(mSender, alternativeKey);
616 sigLayout->addWidget(comboWidget);
618 qCDebug(LIBKLEO_LOG) <<
"setSigningKeys - creating signing combo for S/MIME key";
619 auto comboWidget = createSigningCombo(mSender, Key(), CMS);
620 sigLayout->addWidget(comboWidget);
627 ComboWidget *createEncryptionCombo(
const QString &addr,
const GpgME::Key &key, GpgME::Protocol fixedProtocol)
629 auto combo =
new KeySelectionCombo{
false, KeyUsage::Encrypt};
630 auto comboWidget =
new ComboWidget(combo);
634 if (fixedProtocol == GpgME::OpenPGP) {
635 combo->setKeyFilter(s_pgpEncryptFilter);
636 }
else if (fixedProtocol == GpgME::CMS) {
637 combo->setKeyFilter(s_smimeEncryptFilter);
639 combo->setKeyFilter(s_encryptFilter);
641 if (key.isNull() || key_has_addr(key, addr)) {
642 comboWidget->setIdFilter(addr);
644 comboWidget->setFixedProtocol(fixedProtocol);
649 if (addr == mSender && key.isNull() && fixedProtocol == OpenPGP) {
650 combo->appendCustomItem(
QIcon::fromTheme(QStringLiteral(
"document-new")),
i18n(
"Generate a new key pair"), GenerateKey, mGenerateTooltip);
653 combo->appendCustomItem(Formatting::unavailableIcon(),
654 i18n(
"No key. Recipient will be unable to decrypt."),
656 i18nc(
"@info:tooltip for No Key selected for a specific recipient.",
657 "Do not select a key for this recipient.<br/><br/>"
658 "The recipient will receive the encrypted email, but it can only "
659 "be decrypted with the other keys selected in this dialog."));
661 connect(combo, &KeySelectionCombo::currentKeyChanged, q, [
this]() {
670 combo->setProperty(
"address", addr);
674 void addEncryptionAddr(
const QString &addr,
675 GpgME::Protocol preferredKeysProtocol,
676 const std::vector<GpgME::Key> &preferredKeys,
677 GpgME::Protocol alternativeKeysProtocol,
678 const std::vector<GpgME::Key> &alternativeKeys,
681 if (addr == mSender) {
682 const bool mayNeedOpenPGP = mForcedProtocol != CMS;
683 const bool mayNeedCMS = mForcedProtocol != OpenPGP;
684 if (mayNeedOpenPGP) {
688 for (
const auto &key : preferredKeys) {
689 if (key.protocol() == OpenPGP) {
690 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << key;
691 auto comboWidget = createEncryptionCombo(addr, key, OpenPGP);
695 for (
const auto &key : alternativeKeys) {
696 if (key.protocol() == OpenPGP) {
697 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << key;
698 auto comboWidget = createEncryptionCombo(addr, key, OpenPGP);
702 if (!anyKeyHasProtocol(preferredKeys, OpenPGP) && !anyKeyHasProtocol(alternativeKeys, OpenPGP)) {
703 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for OpenPGP key";
704 auto comboWidget = createEncryptionCombo(addr, GpgME::Key(), OpenPGP);
712 for (
const auto &key : preferredKeys) {
713 if (key.protocol() == CMS) {
714 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << key;
715 auto comboWidget = createEncryptionCombo(addr, key, CMS);
719 for (
const auto &key : alternativeKeys) {
720 if (key.protocol() == CMS) {
721 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << key;
722 auto comboWidget = createEncryptionCombo(addr, key, CMS);
726 if (!anyKeyHasProtocol(preferredKeys, CMS) && !anyKeyHasProtocol(alternativeKeys, CMS)) {
727 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for S/MIME key";
728 auto comboWidget = createEncryptionCombo(addr, GpgME::Key(), CMS);
735 for (
const auto &key : preferredKeys) {
736 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << key;
737 auto comboWidget = createEncryptionCombo(addr, key, preferredKeysProtocol);
740 for (
const auto &key : alternativeKeys) {
741 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << key;
742 auto comboWidget = createEncryptionCombo(addr, key, alternativeKeysProtocol);
746 if (preferredKeys.empty()) {
747 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for" << Formatting::displayName(preferredKeysProtocol)
749 auto comboWidget = createEncryptionCombo(addr, GpgME::Key(), preferredKeysProtocol);
752 if (alternativeKeys.empty() && alternativeKeysProtocol != UnknownProtocol) {
753 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for"
754 << Formatting::displayName(alternativeKeysProtocol) <<
"key";
755 auto comboWidget = createEncryptionCombo(addr, GpgME::Key(), alternativeKeysProtocol);
759 if (preferredKeys.empty() && alternativeKeys.empty()) {
760 qCDebug(LIBKLEO_LOG) <<
"setEncryptionKeys -" << addr <<
"- creating encryption combo for any key";
761 auto comboWidget = createEncryptionCombo(addr, GpgME::Key(), UnknownProtocol);
768 void setEncryptionKeys(GpgME::Protocol preferredKeysProtocol,
769 const QMap<
QString, std::vector<GpgME::Key>> &preferredKeys,
770 GpgME::Protocol alternativeKeysProtocol,
771 const QMap<
QString, std::vector<GpgME::Key>> &alternativeKeys)
774 auto group =
new QGroupBox(
i18nc(
"Encrypt to self (email address):",
"Encrypt to self (%1):", mSender));
781 addEncryptionAddr(mSender, preferredKeysProtocol, preferredKeys.value(mSender), alternativeKeysProtocol, alternativeKeys.value(mSender), encGrid);
787 const bool hasOtherRecipients = std::any_of(preferredKeys.keyBegin(), preferredKeys.keyEnd(), [
this](
const auto &recipient) {
788 return recipient != mSender;
790 if (hasOtherRecipients) {
798 for (
auto it = std::begin(preferredKeys); it != std::end(preferredKeys); ++it) {
799 const auto &
address = it.key();
800 const auto &keys = it.value();
801 if (address != mSender) {
802 addEncryptionAddr(address, preferredKeysProtocol, keys, alternativeKeysProtocol, alternativeKeys.value(address), encGrid);
813 void updateOkButton()
816 const bool isGenerate = bool(findVisibleKeySelectionComboWithGenerateKey());
817 const bool allVisibleEncryptionKeysAreIgnored = Kleo::all_of(mEncCombos, [](
auto combo) {
818 return !combo->isVisible() || combo->currentData(
Qt::UserRole).toInt() == IgnoreKey;
820 const bool allVisibleEncryptionKeysAreUsable = Kleo::all_of(mEncCombos, [](
auto combo) {
821 return !combo->isVisible() || combo->currentKey().isNull() || Kleo::canBeUsedForEncryption(combo->currentKey());
827 mOkButton->
setEnabled(isGenerate || !mEncrypt || (!allVisibleEncryptionKeysAreIgnored && allVisibleEncryptionKeysAreUsable));
829 mOkButton->
setText(isGenerate ?
i18n(
"Generate") : origOkText);
831 if (!DeVSCompliance::isActive()) {
836 bool de_vs = DeVSCompliance::isCompliant();
839 const GpgME::Protocol protocol = currentProtocol();
841 for (
const auto combo : std::as_const(mAllCombos)) {
842 if (!combo->isVisible()) {
845 const auto key = combo->currentKey();
849 if (protocol != GpgME::UnknownProtocol && key.protocol() != protocol) {
852 if (!DeVSCompliance::keyIsCompliant(key)) {
859 const auto doNotSign = Kleo::any_of(mSigningCombos, [](
const auto &combo) {
860 return combo->isVisible() && combo->currentData() == IgnoreKey;
866 DeVSCompliance::decorate(mOkButton, de_vs);
868 mComplianceLbl->
setText(DeVSCompliance::name(de_vs));
872 GpgME::Protocol mForcedProtocol;
887 GpgME::Error mLastError;
899 GpgME::Protocol forcedProtocol,
903 , d{std::make_unique<Private>(this, encrypt, sign, forcedProtocol, preferredSolution.protocol, sender, allowMixed)}
909 d->setEncryptionKeys(allowMixed ? UnknownProtocol : preferredSolution.
protocol,
911 allowMixed ? UnknownProtocol : alternativeSolution.
protocol,
919 resize(
QSize(desk.width() / 3, qMin(
size.height(), desk.height() / 2)));
922Kleo::NewKeyApprovalDialog::~NewKeyApprovalDialog() =
default;
926 return d->mAcceptedResult;
929void NewKeyApprovalDialog::handleKeyGenResult()
931 if (d->mRunningJobs.empty()) {
932 qCWarning(LIBKLEO_LOG) << __func__ <<
"No running job";
934 const auto job = d->mRunningJobs.front();
935 const auto result = QGpgME::Job::context(job)->keyGenerationResult();
936 const auto combo = d->findVisibleKeySelectionComboWithGenerateKey();
937 d->handleKeyGenResult(
result, job, combo);
940#include "newkeyapprovaldialog.moc"
942#include "moc_newkeyapprovaldialog.cpp"
Default implementation of key filter class.
A dialog to show for encryption / signing key approval or selection.
NewKeyApprovalDialog(bool encrypt, bool sign, const QString &sender, KeyResolver::Solution preferredSolution, KeyResolver::Solution alternativeSolution, bool allowMixed, GpgME::Protocol forcedProtocol, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Create a new Key Approval Dialog.
KeyResolver::Solution result()
The selected signing and/or encryption keys.
A progress dialog for Kleo::Jobs.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
PostalAddress address(const QVariant &location)
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
void addLayout(QLayout *layout, int stretch)
void addStretch(int stretch)
void currentIndexChanged(int index)
virtual QSize sizeHint() const const override
void setFrameStyle(int style)
int rowCount() const const
void setColumnStretch(int column, int stretch)
QIcon fromTheme(const QString &name)
void setText(const QString &)
void setContentsMargins(const QMargins &margins)
qsizetype removeAll(const AT &t)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QList< T > findChildren(Qt::FindChildOptions options) const const
QVariant property(const char *name) const const
T qobject_cast(QObject *object)
QObject * sender() const const
void setObjectName(QAnyStringView name)
QString fromLatin1(QByteArrayView str)
QString fromStdString(const std::string &str)
bool isEmpty() const const
QString toLower() const const
WindowContextHelpButtonHint
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime)
QString toString() const const
Solution represents the solution found by the KeyResolver.
GpgME::Protocol protocol
This property holds a hint at the protocol of the signing and encryption keys, i.e.
QMap< QString, std::vector< GpgME::Key > > encryptionKeys
This property contains the encryption keys to use for the different recipients.
std::vector< GpgME::Key > signingKeys
This property contains the signing keys to use.