Commit 18ed69ed authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Create UI of Key Creation page in code

GnuPG-bug-id: 5969
parent 6be4d3df
......@@ -342,7 +342,6 @@ ki18n_wrap_ui(_kleopatra_SRCS
dialogs/trustchainwidget.ui
dialogs/subkeyswidget.ui
newcertificatewizard/listwidget.ui
newcertificatewizard/keycreationpage.ui
newcertificatewizard/advancedsettingsdialog.ui
)
......
......@@ -5,6 +5,8 @@
SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2016, 2017 Bundesamt für Sicherheit in der Informationstechnik
SPDX-FileContributor: Intevation GmbH
SPDX-FileCopyrightText: 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -19,18 +21,19 @@
#include "utils/keyparameters.h"
#include <ui_keycreationpage.h>
#include <Libkleo/Formatting>
#include <Libkleo/KeyCache>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <QGpgME/KeyGenerationJob>
#include <QGpgME/Protocol>
#include <QLabel>
#include <QUrl>
#include <QVBoxLayout>
#include <gpgme++/context.h>
#include <gpgme++/interfaces/passphraseprovider.h>
......@@ -46,18 +49,32 @@ class KeyCreationPage::EmptyPassphraseProvider: public PassphraseProvider
{
public:
char *getPassphrase(const char * /*useridHint*/, const char * /*description*/,
bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE
bool /*previousWasBad*/, bool &/*canceled*/) override
{
return gpgrt_strdup ("");
}
};
struct KeyCreationPage::UI
{
UI(QWizardPage *parent)
{
parent->setTitle(i18nc("@title", "Creating Key Pair..."));
auto mainLayout = new QVBoxLayout{parent};
auto label = new QLabel{i18n("The process of creating a key requires large amounts of random numbers. This may require several minutes..."), parent};
label->setWordWrap(true);
mainLayout->addWidget(label);
}
};
KeyCreationPage::KeyCreationPage(QWidget *p)
: WizardPage{p}
, ui{new UI{this}}
, mEmptyPWProvider{new EmptyPassphraseProvider}
, ui{new Ui_KeyCreationPage}
{
ui->setupUi(this);
setObjectName(QString::fromUtf8("Kleo__NewCertificateUi__KeyCreationPage"));
}
KeyCreationPage::~KeyCreationPage() = default;
......
<ui version="4.0" >
<class>Kleo::NewCertificateUi::KeyCreationPage</class>
<widget class="QWizardPage" name="Kleo::NewCertificateUi::KeyCreationPage" >
<property name="title" >
<string comment="@title" >Creating Key Pair...</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>The process of creating a key requires large amounts of random numbers. This may require several minutes...</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -5,6 +5,8 @@
SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2016, 2017 Bundesamt für Sicherheit in der Informationstechnik
SPDX-FileContributor: Intevation GmbH
SPDX-FileCopyrightText: 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -21,10 +23,6 @@ namespace QGpgME
{
class KeyGenerationJob;
}
namespace Kleo::NewCertificateUi
{
class Ui_KeyCreationPage;
}
class KeyCreationPage : public Kleo::NewCertificateUi::WizardPage
{
......@@ -47,8 +45,10 @@ private Q_SLOTS:
void slotResult(const GpgME::KeyGenerationResult &result, const QByteArray &request, const QString &auditLog);
private:
struct UI;
std::unique_ptr<UI> ui;
class EmptyPassphraseProvider;
std::unique_ptr<EmptyPassphraseProvider> mEmptyPWProvider;
std::unique_ptr<Kleo::NewCertificateUi::Ui_KeyCreationPage> ui;
QPointer<QGpgME::KeyGenerationJob> job;
};
Supports Markdown
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