Commit 556beb82 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Create UI of Result page in code

GnuPG-bug-id: 5969
parent e43270eb
......@@ -343,7 +343,6 @@ ki18n_wrap_ui(_kleopatra_SRCS
dialogs/subkeyswidget.ui
newcertificatewizard/listwidget.ui
newcertificatewizard/keycreationpage.ui
newcertificatewizard/resultpage.ui
newcertificatewizard/advancedsettingsdialog.ui
)
......
......@@ -13,8 +13,6 @@
#include "resultpage_p.h"
#include <ui_resultpage.h>
#include "commands/exportcertificatecommand.h"
#include "commands/exportopenpgpcertstoservercommand.h"
#ifdef QGPGME_SUPPORTS_SECRET_KEY_EXPORT
......@@ -22,17 +20,24 @@
#else
# include "commands/exportsecretkeycommand_old.h"
#endif
#include "utils/dragqueen.h"
#include "utils/filedialog.h"
#include <Libkleo/KeyCache>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#include <KSharedConfig>
#include <QDesktopServices>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QTextBrowser>
#include <QUrlQuery>
#include <QVBoxLayout>
#include <gpgme++/key.h>
......@@ -46,14 +51,95 @@ using namespace GpgME;
using Kleo::Commands::Compat::ExportSecretKeyCommand;
#endif
struct ResultPage::UI
{
QTextBrowser *resultTB = nullptr;
QTextBrowser *errorTB = nullptr;
DragQueen *dragQueen = nullptr;
QPushButton *restartWizardPB = nullptr;
QGroupBox *nextStepsGB = nullptr;
QPushButton *saveRequestToFilePB = nullptr;
QPushButton *sendRequestByEMailPB = nullptr;
QPushButton *makeBackupPB = nullptr;
QPushButton *sendCertificateByEMailPB = nullptr;
QPushButton *uploadToKeyserverPB = nullptr;
QPushButton *createRevocationRequestPB = nullptr;
QPushButton *createSigningCertificatePB = nullptr;
QPushButton *createEncryptionCertificatePB = nullptr;
UI(QWizardPage *parent)
{
auto mainLayout = new QVBoxLayout{parent};
auto resultGB = new QGroupBox{i18nc("@title:group", "Result"), parent};
auto resultGBLayout = new QHBoxLayout{resultGB};
resultTB = new QTextBrowser{resultGB};
resultGBLayout->addWidget(resultTB);
errorTB = new QTextBrowser{resultGB};
resultGBLayout->addWidget(errorTB);
dragQueen = new Kleo::DragQueen{resultGB};
dragQueen->setToolTip(i18n("Drag this icon to your mail application's composer to attach the request to a mail."));
dragQueen->setAlignment(Qt::AlignCenter);
resultGBLayout->addWidget(dragQueen);
mainLayout->addWidget(resultGB);
restartWizardPB = new QPushButton{i18n("Restart This Wizard (Keeps Your Parameters)"), parent};
mainLayout->addWidget(restartWizardPB);
nextStepsGB = new QGroupBox{i18nc("@title:group", "Next Steps"), parent};
auto nextStepsGBLayout = new QVBoxLayout{nextStepsGB};
saveRequestToFilePB = new QPushButton{i18n("Save Certificate Request To File..."), nextStepsGB};
nextStepsGBLayout->addWidget(saveRequestToFilePB);
sendRequestByEMailPB = new QPushButton{i18n("Send Certificate Request By EMail..."), nextStepsGB};
nextStepsGBLayout->addWidget(sendRequestByEMailPB);
makeBackupPB = new QPushButton{i18n("Make a Backup Of Your Key Pair..."), nextStepsGB};
nextStepsGBLayout->addWidget(makeBackupPB);
sendCertificateByEMailPB = new QPushButton{i18n("Send Public Key By EMail..."), nextStepsGB};
nextStepsGBLayout->addWidget(sendCertificateByEMailPB);
uploadToKeyserverPB = new QPushButton{i18n("Upload Public Key To Directory Service..."), nextStepsGB};
nextStepsGBLayout->addWidget(uploadToKeyserverPB);
createRevocationRequestPB = new QPushButton{i18n("Create Revocation Request..."), nextStepsGB};
nextStepsGBLayout->addWidget(createRevocationRequestPB);
createSigningCertificatePB = new QPushButton{i18n("Create Signing Certificate With Same Parameters"), nextStepsGB};
nextStepsGBLayout->addWidget(createSigningCertificatePB);
createEncryptionCertificatePB = new QPushButton{i18n("Create Encryption Certificate With Same Parameters"), nextStepsGB};
nextStepsGBLayout->addWidget(createEncryptionCertificatePB);
mainLayout->addWidget(nextStepsGB);
}
};
ResultPage::ResultPage(QWidget *p)
: WizardPage{p}
, ui{new Ui_ResultPage}
, ui{new UI{this}}
, initialized{false}
, successfullyCreatedSigningCertificate{false}
, successfullyCreatedEncryptionCertificate{false}
{
ui->setupUi(this);
setObjectName(QString::fromUtf8("Kleo__NewCertificateUi__ResultPage"));
connect(ui->saveRequestToFilePB, &QPushButton::clicked, this, &ResultPage::slotSaveRequestToFile);
connect(ui->sendRequestByEMailPB, &QPushButton::clicked, this, &ResultPage::slotSendRequestByEMail);
connect(ui->sendCertificateByEMailPB, &QPushButton::clicked, this, &ResultPage::slotSendCertificateByEMail);
connect(ui->uploadToKeyserverPB, &QPushButton::clicked, this, &ResultPage::slotUploadCertificateToDirectoryServer);
connect(ui->makeBackupPB, &QPushButton::clicked, this, &ResultPage::slotBackupCertificate);
connect(ui->createRevocationRequestPB, &QPushButton::clicked, this, &ResultPage::slotCreateRevocationRequest);
connect(ui->createSigningCertificatePB, &QPushButton::clicked, this, &ResultPage::slotCreateSigningCertificate);
connect(ui->createEncryptionCertificatePB, &QPushButton::clicked, this, &ResultPage::slotCreateEncryptionCertificate);
ui->dragQueen->setPixmap(QIcon::fromTheme(QStringLiteral("kleopatra")).pixmap(64, 64));
registerField(QStringLiteral("error"), ui->errorTB, "plainText");
registerField(QStringLiteral("result"), ui->resultTB, "plainText");
......
<ui version="4.0" >
<class>Kleo::NewCertificateUi::ResultPage</class>
<widget class="QWizardPage" name="Kleo::NewCertificateUi::ResultPage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>685</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QGroupBox" name="resultGB" >
<property name="title" >
<string>Result</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QTextBrowser" name="resultTB" />
</item>
<item>
<widget class="QTextBrowser" name="errorTB" />
</item>
<item>
<widget class="Kleo::DragQueen" name="dragQueen" >
<property name="toolTip" >
<string>Drag this icon to your mail application's composer to attach the request to a mail.</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="restartWizardPB" >
<property name="text" >
<string>Restart This Wizard (Keeps Your Parameters)</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="nextStepsGB" >
<property name="title" >
<string>Next Steps</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QPushButton" name="saveRequestToFilePB" >
<property name="text" >
<string>Save Certificate Request To File...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sendRequestByEMailPB" >
<property name="text" >
<string>Send Certificate Request By EMail...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="makeBackupPB" >
<property name="text" >
<string>Make a Backup Of Your Key Pair...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sendCertificateByEMailPB" >
<property name="text" >
<string>Send Public Key By EMail...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uploadToKeyserverPB" >
<property name="text" >
<string>Upload Public Key To Directory Service...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createRevocationRequestPB" >
<property name="text" >
<string>Create Revocation Request...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createSigningCertificatePB" >
<property name="text" >
<string>Create Signing Certificate With Same Parameters</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createEncryptionCertificatePB" >
<property name="text" >
<string>Create Encryption Certificate With Same Parameters</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Kleo::DragQueen</class>
<extends>QLabel</extends>
<header>utils/dragqueen.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>saveRequestToFilePB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotSaveRequestToFile()</slot>
<hints>
<hint type="sourcelabel" >
<x>34</x>
<y>268</y>
</hint>
<hint type="destinationlabel" >
<x>2</x>
<y>348</y>
</hint>
</hints>
</connection>
<connection>
<sender>sendRequestByEMailPB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotSendRequestByEMail()</slot>
<hints>
<hint type="sourcelabel" >
<x>32</x>
<y>304</y>
</hint>
<hint type="destinationlabel" >
<x>6</x>
<y>390</y>
</hint>
</hints>
</connection>
<connection>
<sender>sendCertificateByEMailPB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotSendCertificateByEMail()</slot>
<hints>
<hint type="sourcelabel" >
<x>48</x>
<y>406</y>
</hint>
<hint type="destinationlabel" >
<x>4</x>
<y>438</y>
</hint>
</hints>
</connection>
<connection>
<sender>uploadToKeyserverPB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotUploadCertificateToDirectoryServer()</slot>
<hints>
<hint type="sourcelabel" >
<x>50</x>
<y>449</y>
</hint>
<hint type="destinationlabel" >
<x>2</x>
<y>478</y>
</hint>
</hints>
</connection>
<connection>
<sender>makeBackupPB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotBackupCertificate()</slot>
<hints>
<hint type="sourcelabel" >
<x>52</x>
<y>363</y>
</hint>
<hint type="destinationlabel" >
<x>4</x>
<y>518</y>
</hint>
</hints>
</connection>
<connection>
<sender>createRevocationRequestPB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotCreateRevocationRequest()</slot>
<hints>
<hint type="sourcelabel" >
<x>32</x>
<y>472</y>
</hint>
<hint type="destinationlabel" >
<x>2</x>
<y>560</y>
</hint>
</hints>
</connection>
<connection>
<sender>createSigningCertificatePB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotCreateSigningCertificate()</slot>
<hints>
<hint type="sourcelabel" >
<x>33</x>
<y>528</y>
</hint>
<hint type="destinationlabel" >
<x>7</x>
<y>510</y>
</hint>
</hints>
</connection>
<connection>
<sender>createEncryptionCertificatePB</sender>
<signal>clicked()</signal>
<receiver>Kleo::NewCertificateUi::ResultPage</receiver>
<slot>slotCreateEncryptionCertificate()</slot>
<hints>
<hint type="sourcelabel" >
<x>37</x>
<y>560</y>
</hint>
<hint type="destinationlabel" >
<x>5</x>
<y>556</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>slotSaveRequestToFile()</slot>
<slot>slotSendRequestByEMail()</slot>
<slot>slotSendCertificateByEMail()</slot>
<slot>slotUploadCertificateToDirectoryServer()</slot>
<slot>slotBackupCertificate()</slot>
<slot>slotCreateRevocationRequest()</slot>
<slot>slotCreateEncryptionCertificate()</slot>
<slot>slotCreateSigningCertificate()</slot>
</slots>
</ui>
......@@ -23,7 +23,6 @@ class ExportCertificateCommand;
}
namespace Kleo::NewCertificateUi
{
class Ui_ResultPage;
class ResultPage : public WizardPage
{
......@@ -55,7 +54,9 @@ private:
void toggleSignEncryptAndRestart();
private:
std::unique_ptr<Kleo::NewCertificateUi::Ui_ResultPage> ui;
struct UI;
std::unique_ptr<UI> ui;
bool initialized : 1;
bool successfullyCreatedSigningCertificate : 1;
bool successfullyCreatedEncryptionCertificate : 1;
......
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