Commit 34f54202 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Move protocol to options helper to CertificateSelectionDialog

GnuPG-bug-id: 5332
parent c5803459
......@@ -220,15 +220,6 @@ bool ResolveRecipientsPage::ItemWidget::isSelected() const
return m_selected;
}
static CertificateSelectionDialog::Option protocol2option(GpgME::Protocol proto)
{
switch (proto) {
case OpenPGP: return CertificateSelectionDialog::OpenPGPFormat;
case CMS: return CertificateSelectionDialog::CMSFormat;
default: return CertificateSelectionDialog::AnyFormat;
}
}
static CertificateSelectionDialog *createCertificateSelectionDialog(QWidget *parent, GpgME::Protocol prot)
{
CertificateSelectionDialog *const dlg = new CertificateSelectionDialog(parent);
......@@ -236,7 +227,7 @@ static CertificateSelectionDialog *createCertificateSelectionDialog(QWidget *par
CertificateSelectionDialog::SingleSelection |
CertificateSelectionDialog::EncryptOnly |
CertificateSelectionDialog::MultiSelection |
protocol2option(prot);
CertificateSelectionDialog::optionsFromProtocol(prot);
dlg->setOptions(options);
return dlg;
}
......
......@@ -57,6 +57,16 @@ using namespace Kleo::Dialogs;
using namespace Kleo::Commands;
using namespace GpgME;
CertificateSelectionDialog::Option CertificateSelectionDialog::optionsFromProtocol(Protocol proto)
{
switch (proto) {
case OpenPGP: return CertificateSelectionDialog::OpenPGPFormat;
case CMS: return CertificateSelectionDialog::CMSFormat;
default: return CertificateSelectionDialog::AnyFormat;
}
}
class CertificateSelectionDialog::Private
{
friend class ::Kleo::Dialogs::CertificateSelectionDialog;
......
......@@ -14,6 +14,8 @@
#include <utils/pimpl_ptr.h>
#include <gpgme++/global.h>
#include <memory>
#include <vector>
......@@ -57,6 +59,8 @@ public:
};
Q_DECLARE_FLAGS(Options, Option)
static Option optionsFromProtocol(GpgME::Protocol proto);
explicit CertificateSelectionDialog(QWidget *parent = nullptr);
~CertificateSelectionDialog() override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment