aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/gpg/GpgKey.h72
-rw-r--r--include/gpg/Signature.h67
-rw-r--r--include/gpg/UID.h60
-rwxr-xr-xinclude/ui/KeyMgmt.h2
-rw-r--r--include/ui/keypair_details/KeyDetailsDialog.h (renamed from include/ui/KeyDetailsDialog.h)3
-rw-r--r--include/ui/keypair_details/KeyPairDetailTab.h (renamed from include/ui/KeyPairDetailTab.h)1
-rw-r--r--include/ui/keypair_details/KeyPairSubkeyTab.h56
-rw-r--r--include/ui/keypair_details/KeyPairUIDTab.h64
-rw-r--r--src/gpg/GpgKey.cpp72
-rw-r--r--src/gpg/Signature.cpp25
-rw-r--r--src/ui/CMakeLists.txt3
-rw-r--r--src/ui/Wizard.cpp32
-rw-r--r--src/ui/keypair_details/KeyDetailsDialog.cpp (renamed from src/ui/KeyDetailsDialog.cpp)8
-rw-r--r--src/ui/keypair_details/KeyPairDetailTab.cpp (renamed from src/ui/KeyPairDetailTab.cpp)2
-rw-r--r--src/ui/keypair_details/KeyPairSubkeyTab.cpp52
-rw-r--r--src/ui/keypair_details/KeyPairUIDTab.cpp144
16 files changed, 571 insertions, 92 deletions
diff --git a/include/gpg/GpgKey.h b/include/gpg/GpgKey.h
index 2dc4f8c8..5d244510 100644
--- a/include/gpg/GpgKey.h
+++ b/include/gpg/GpgKey.h
@@ -25,8 +25,7 @@
#ifndef GPGFRONTEND_GPGKEY_H
#define GPGFRONTEND_GPGKEY_H
-#include <gpgme.h>
-
+#include "UID.h"
#include "GpgSubKey.h"
class GpgKey {
@@ -44,7 +43,7 @@ public:
QDateTime expires;
QDateTime create_time;
- int length;
+ unsigned int length;
bool can_encrypt{};
bool can_sign{};
@@ -61,6 +60,8 @@ public:
QVector<GpgSubKey> subKeys;
+ QVector<UID> uids;
+
explicit GpgKey(gpgme_key_t key) {
parse(key);
}
@@ -69,70 +70,7 @@ public:
is_private_key = false;
}
- void parse(gpgme_key_t key) {
- if(key != nullptr) {
- good = true;
- is_private_key = key->secret;
- fpr = key->fpr;
- protocol = key->protocol;
- expired = (key->expired != 0u);
- revoked = (key->revoked != 0u);
-
- disabled = key->disabled;
-
- can_authenticate = key->can_authenticate;
- can_certify = key->can_certify;
- can_encrypt = key->can_encrypt;
- can_sign = key->can_sign;
-
- last_update = QDateTime(QDateTime::fromTime_t(key->last_update));
-
- switch (key->owner_trust) {
- case GPGME_VALIDITY_UNKNOWN:
- owner_trust = "Unknown";
- break;
- case GPGME_VALIDITY_UNDEFINED:
- owner_trust = "Undefined";
- break;
- case GPGME_VALIDITY_NEVER:
- owner_trust = "Never";
- break;
- case GPGME_VALIDITY_MARGINAL:
- owner_trust = "Marginal";
- break;
- case GPGME_VALIDITY_FULL:
- owner_trust = "FULL";
- break;
- case GPGME_VALIDITY_ULTIMATE:
- owner_trust = "Ultimate";
- break;
- }
-
-
- if (key->uids) {
- name = QString::fromUtf8(key->uids->name);
- email = QString::fromUtf8(key->uids->email);
- comment = QString::fromUtf8(key->uids->comment);
- }
-
- gpgme_subkey_t next = key->subkeys;
-
- while (next != nullptr) {
- subKeys.push_back(GpgSubKey(next));
- next = next->next;
- }
-
- if (!subKeys.isEmpty()) {
- id = subKeys.first().id;
- expires = subKeys.first().expires;
- pubkey_algo = subKeys.first().pubkey_algo;
- create_time = subKeys.first().timestamp;
- length = subKeys.first().length;
- } else {
- id = "";
- }
- }
- }
+ void parse(gpgme_key_t key);
};
diff --git a/include/gpg/Signature.h b/include/gpg/Signature.h
new file mode 100644
index 00000000..d361453d
--- /dev/null
+++ b/include/gpg/Signature.h
@@ -0,0 +1,67 @@
+/**
+ * This file is part of GPGFrontend.
+ *
+ * GPGFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#ifndef GPGFRONTEND_SIGNATURE_H
+#define GPGFRONTEND_SIGNATURE_H
+
+#include "GpgFrontend.h"
+
+struct Signature {
+
+ bool revoked{};
+
+ bool expired{};
+
+ bool invalid{};
+
+ bool exportable{};
+
+ QString pubkey_algo;
+
+ QDateTime create_time;
+
+ QDateTime expire_time;
+
+ QString uid;
+
+ QString name;
+
+ QString email;
+
+ QString comment;
+
+ Signature() = default;
+
+ explicit Signature(gpgme_key_sig_t key_sig):
+ revoked(key_sig->revoked), expired(key_sig->expired), invalid(key_sig->invalid),
+ exportable(key_sig->exportable), pubkey_algo(gpgme_pubkey_algo_name(key_sig->pubkey_algo)),
+ name(key_sig->name), email(key_sig->email), comment(key_sig->comment),
+ create_time(QDateTime::fromTime_t(key_sig->timestamp)), expire_time(QDateTime::fromTime_t(key_sig->expires)){
+
+ }
+
+};
+
+
+#endif //GPGFRONTEND_SIGNATURE_H
diff --git a/include/gpg/UID.h b/include/gpg/UID.h
new file mode 100644
index 00000000..ecd361fd
--- /dev/null
+++ b/include/gpg/UID.h
@@ -0,0 +1,60 @@
+/**
+ * This file is part of GPGFrontend.
+ *
+ * GPGFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#ifndef GPGFRONTEND_UID_H
+#define GPGFRONTEND_UID_H
+
+#include <utility>
+
+#include "GpgFrontend.h"
+
+#include "Signature.h"
+
+struct UID {
+
+ QString name{};
+
+ QString email{};
+
+ QString comment{};
+
+ QString uid{};
+
+ QVector<Signature> signatures;
+
+ UID() = default;
+
+ explicit UID(gpgme_user_id_t user_id):
+ uid(user_id->uid), name(user_id->name), email(user_id->email), comment(user_id->comment) {
+
+ auto sig = user_id->signatures;
+
+ while (sig != nullptr) {
+ signatures.push_back(Signature(sig));
+ }
+
+ }
+};
+
+#endif //GPGFRONTEND_UID_H \ No newline at end of file
diff --git a/include/ui/KeyMgmt.h b/include/ui/KeyMgmt.h
index e3f438c2..d98bf084 100755
--- a/include/ui/KeyMgmt.h
+++ b/include/ui/KeyMgmt.h
@@ -27,7 +27,7 @@
#include "KeyList.h"
#include "KeygenThread.h"
-#include "KeyDetailsDialog.h"
+#include "ui/keypair_details/KeyDetailsDialog.h"
#include "KeyImportDetailDialog.h"
#include "KeyServerImportDialog.h"
#include "KeygenDialog.h"
diff --git a/include/ui/KeyDetailsDialog.h b/include/ui/keypair_details/KeyDetailsDialog.h
index 1ad2d133..94fb1223 100644
--- a/include/ui/KeyDetailsDialog.h
+++ b/include/ui/keypair_details/KeyDetailsDialog.h
@@ -27,7 +27,8 @@
#include "gpg/GpgContext.h"
#include "KeyPairDetailTab.h"
-#include <gpgme.h>
+#include "KeyPairUIDTab.h"
+#include "KeyPairSubkeyTab.h"
class KeyDetailsDialog : public QDialog {
Q_OBJECT
diff --git a/include/ui/KeyPairDetailTab.h b/include/ui/keypair_details/KeyPairDetailTab.h
index 5ed40dac..61de4c06 100644
--- a/include/ui/KeyPairDetailTab.h
+++ b/include/ui/keypair_details/KeyPairDetailTab.h
@@ -51,7 +51,6 @@ private:
QLabel *algorithmVarLabel; /** Label containng the keys algorithm */
QLabel *keyidVarLabel; /** Label containng the keys keyid */
QLabel *fingerPrintVarLabel; /** Label containng the keys fingerprint */
- QLabel *addUserIdsVarLabel{}; /** Label containng info about keys additional uids */
QLabel *usageVarLabel;
public:
diff --git a/include/ui/keypair_details/KeyPairSubkeyTab.h b/include/ui/keypair_details/KeyPairSubkeyTab.h
new file mode 100644
index 00000000..11a9ab41
--- /dev/null
+++ b/include/ui/keypair_details/KeyPairSubkeyTab.h
@@ -0,0 +1,56 @@
+/**
+ * This file is part of GPGFrontend.
+ *
+ * GPGFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#ifndef GPGFRONTEND_KEYPAIRSUBKEYTAB_H
+#define GPGFRONTEND_KEYPAIRSUBKEYTAB_H
+
+#include "GpgFrontend.h"
+
+#include "gpg/GpgContext.h"
+
+class KeyPairSubkeyTab : public QWidget {
+Q_OBJECT
+
+public:
+
+ KeyPairSubkeyTab(GpgME::GpgContext *ctx, const GpgKey &key, QWidget *parent);
+
+private:
+
+ void creatSubkeyList();
+
+ GpgME::GpgContext *mCtx;
+
+ const GpgKey &key;
+
+ QTableWidget *subkeyList;
+
+
+private slots:
+
+
+};
+
+
+#endif //GPGFRONTEND_KEYPAIRSUBKEYTAB_H
diff --git a/include/ui/keypair_details/KeyPairUIDTab.h b/include/ui/keypair_details/KeyPairUIDTab.h
new file mode 100644
index 00000000..ae476a1f
--- /dev/null
+++ b/include/ui/keypair_details/KeyPairUIDTab.h
@@ -0,0 +1,64 @@
+/**
+ * This file is part of GPGFrontend.
+ *
+ * GPGFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#ifndef GPGFRONTEND_KEYPAIRUIDTAB_H
+#define GPGFRONTEND_KEYPAIRUIDTAB_H
+
+#include "GpgFrontend.h"
+#include "gpg/GpgContext.h"
+
+class KeyPairUIDTab : public QWidget {
+Q_OBJECT
+
+public:
+
+ KeyPairUIDTab(GpgME::GpgContext *ctx, const GpgKey& key, QWidget *parent);
+
+private:
+
+ void createUIDList();
+
+ void createSignList();
+
+ GpgME::GpgContext *mCtx;
+
+ const GpgKey &key;
+
+ QTableWidget *uidList;
+
+ QTableWidget *sigList;
+
+
+
+private slots:
+
+ void slotRefreshUIDList();
+
+ void slotRefreshSigList();
+
+
+};
+
+
+#endif //GPGFRONTEND_KEYPAIRUIDTAB_H
diff --git a/src/gpg/GpgKey.cpp b/src/gpg/GpgKey.cpp
index 5d474327..c1116f24 100644
--- a/src/gpg/GpgKey.cpp
+++ b/src/gpg/GpgKey.cpp
@@ -23,3 +23,75 @@
*/
#include "gpg/GpgKey.h"
+
+void GpgKey::parse(gpgme_key_t key) {
+ if(key != nullptr) {
+ good = true;
+ is_private_key = key->secret;
+ fpr = key->fpr;
+ protocol = key->protocol;
+ expired = (key->expired != 0u);
+ revoked = (key->revoked != 0u);
+
+ disabled = key->disabled;
+
+ can_authenticate = key->can_authenticate;
+ can_certify = key->can_certify;
+ can_encrypt = key->can_encrypt;
+ can_sign = key->can_sign;
+
+ last_update = QDateTime(QDateTime::fromTime_t(key->last_update));
+
+ switch (key->owner_trust) {
+ case GPGME_VALIDITY_UNKNOWN:
+ owner_trust = "Unknown";
+ break;
+ case GPGME_VALIDITY_UNDEFINED:
+ owner_trust = "Undefined";
+ break;
+ case GPGME_VALIDITY_NEVER:
+ owner_trust = "Never";
+ break;
+ case GPGME_VALIDITY_MARGINAL:
+ owner_trust = "Marginal";
+ break;
+ case GPGME_VALIDITY_FULL:
+ owner_trust = "FULL";
+ break;
+ case GPGME_VALIDITY_ULTIMATE:
+ owner_trust = "Ultimate";
+ break;
+ }
+
+ auto uid = key->uids;
+
+ while(uid != nullptr) {
+ uids.push_back(UID(uid));
+ uid = uid->next;
+ }
+
+
+ if (!uids.isEmpty()) {
+ name = uids.first().name;
+ email = uids.first().email;
+ comment = uids.first().comment;
+ }
+
+ auto next = key->subkeys;
+
+ while (next != nullptr) {
+ subKeys.push_back(GpgSubKey(next));
+ next = next->next;
+ }
+
+ if (!subKeys.isEmpty()) {
+ id = subKeys.first().id;
+ expires = subKeys.first().expires;
+ pubkey_algo = subKeys.first().pubkey_algo;
+ create_time = subKeys.first().timestamp;
+ length = subKeys.first().length;
+ } else {
+ id = "";
+ }
+ }
+}
diff --git a/src/gpg/Signature.cpp b/src/gpg/Signature.cpp
new file mode 100644
index 00000000..9e7f0574
--- /dev/null
+++ b/src/gpg/Signature.cpp
@@ -0,0 +1,25 @@
+/**
+ * This file is part of GPGFrontend.
+ *
+ * GPGFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#include "gpg/Signature.h"
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 8398740b..c319b294 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,6 +1,7 @@
aux_source_directory(. QTUI_SOURCE)
+aux_source_directory(./keypair_details QTUI_KEYPAIR_DETAILS_SOURCE)
-add_library(qtui STATIC ${QTUI_SOURCE})
+add_library(qtui STATIC ${QTUI_SOURCE} ${QTUI_KEYPAIR_DETAILS_SOURCE})
target_link_libraries(qtui
Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) \ No newline at end of file
diff --git a/src/ui/Wizard.cpp b/src/ui/Wizard.cpp
index 71d26cd0..f7d8b717 100644
--- a/src/ui/Wizard.cpp
+++ b/src/ui/Wizard.cpp
@@ -109,9 +109,9 @@ bool Wizard::importPubAndSecKeysFromDir(const QString &dir, KeyMgmt *keyMgmt) {
IntroPage::IntroPage(QWidget *parent)
: QWizardPage(parent) {
setTitle(tr("Getting started..."));
- setSubTitle(tr("... with gpg4usb"));
+ setSubTitle(tr("... with GPGFrontend"));
- auto *topLabel = new QLabel(tr("To use gpg4usb for decrypting and signing messages, you need a "
+ auto *topLabel = new QLabel(tr("To use GPGFrontend for decrypting and signing messages, you need a "
"private key. The next page will help you with "
"key generation or import.<br><br>"
"For more information have a look at the <a href='docu_concepts.html'>concepts</a> "
@@ -161,17 +161,17 @@ int IntroPage::nextId() const {
ChoosePage::ChoosePage(QWidget *parent)
: QWizardPage(parent) {
setTitle(tr("Choose your action..."));
- setSubTitle(tr("...by clicking on the apropriate link."));
+ setSubTitle(tr("...by clicking on the appropriate link."));
- auto *keygenLabel = new QLabel(tr("If you have never used gpg4usb before and also don't own a gpg key yet you "
+ auto *keygenLabel = new QLabel(tr("If you have never used GPGFrontend before and also don't own a gpg key yet you "
"may possibly want to ") + "<a href=""Wizard::Page_GenKey"">"
+ tr("create a new keypair") + "</a><hr>");
keygenLabel->setWordWrap(true);
connect(keygenLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotJumpPage(Qtring)));
- auto *importGpg4usbLabel = new QLabel(tr("If you upgrade from an older version of gpg4usb you may want to ")
+ auto *importGpg4usbLabel = new QLabel(tr("If you upgrade from an older version of GPGFrontend you may want to ")
+ "<a href=""Wizard::Page_ImportFromGpg4usb"">"
- + tr("import settings and/or keys from gpg4usb") + "</a>");
+ + tr("import settings and/or keys from GPGFrontend") + "</a>");
importGpg4usbLabel->setWordWrap(true);
connect(importGpg4usbLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotJumpPage(QString)));
@@ -207,11 +207,11 @@ ImportFromGpg4usbPage::ImportFromGpg4usbPage(GpgME::GpgContext *ctx, KeyMgmt *ke
mCtx = ctx;
mKeyMgmt = keyMgmt;
setTitle(tr("Import from..."));
- setSubTitle(tr("...existing gpg4usb"));
+ setSubTitle(tr("...existing GPGFrontend"));
- auto *topLabel = new QLabel(tr("You can import keys and/or settings from existing gpg4usb. <br><br>"
+ auto *topLabel = new QLabel(tr("You can import keys and/or settings from existing GPGFrontend. <br><br>"
"Just check what you want to import, click the import button and choose "
- "the directory of your other gpg4usb in the appearing file dialog."), this);
+ "the directory of your other GPGFrontend in the appearing file dialog."), this);
topLabel->setWordWrap(true);
gpg4usbKeyCheckBox = new QCheckBox();
@@ -222,7 +222,7 @@ ImportFromGpg4usbPage::ImportFromGpg4usbPage(GpgME::GpgContext *ctx, KeyMgmt *ke
gpg4usbConfigCheckBox->setChecked(true);
auto *configLabel = new QLabel(tr("Configuration"));
- auto *importFromGpg4usbButton = new QPushButton(tr("Import from gpg4usb"));
+ auto *importFromGpg4usbButton = new QPushButton(tr("Import from GPGFrontend"));
connect(importFromGpg4usbButton, SIGNAL(clicked()), this, SLOT(slotImportFromOlderGpg4usb()));
auto *gpg4usbLayout = new QGridLayout();
@@ -237,7 +237,7 @@ ImportFromGpg4usbPage::ImportFromGpg4usbPage(GpgME::GpgContext *ctx, KeyMgmt *ke
}
void ImportFromGpg4usbPage::slotImportFromOlderGpg4usb() {
- QString dir = QFileDialog::getExistingDirectory(this, tr("Other gpg4usb directory"));
+ QString dir = QFileDialog::getExistingDirectory(this, tr("Other GPGFrontend directory"));
// Return, if cancel was hit
if (dir.isEmpty()) {
@@ -258,7 +258,7 @@ void ImportFromGpg4usbPage::slotImportFromOlderGpg4usb() {
QSettings settings;
settings.setValue("wizard/nextPage", this->nextId());
QMessageBox::information(nullptr, tr("Configuration Imported"),
- tr("Imported Configuration from old gpg4usb.<br>"
+ tr("Imported Configuration from old GPGFrontend.<br>"
"Will now restart to activate the configuration."));
// TODO: edit->maybesave?
qApp->exit(RESTART_CODE);
@@ -267,7 +267,7 @@ void ImportFromGpg4usbPage::slotImportFromOlderGpg4usb() {
}
bool ImportFromGpg4usbPage::slotImportConfFromGpg4usb(const QString &dir) {
- QString path = dir + "/conf/gpg4usb.ini";
+ QString path = dir + "/conf/GPGFrontend.ini";
QSettings oldconf(path, QSettings::IniFormat, this);
QSettings actualConf;
foreach(QString key, oldconf.allKeys()) {
@@ -389,10 +389,10 @@ void KeyGenPage::slotGenerateKeyDialog() {
ConclusionPage::ConclusionPage(QWidget *parent)
: QWizardPage(parent) {
setTitle(tr("Ready."));
- setSubTitle(tr("Have fun with gpg4usb!"));
+ setSubTitle(tr("Have fun with GPGFrontend!"));
- auto *bottomLabel = new QLabel(tr("You are ready to use gpg4usb now.<br><br>"
- "The offline help will get you started with gpg4usb. "
+ auto *bottomLabel = new QLabel(tr("You are ready to use GPGFrontend now.<br><br>"
+ "The offline help will get you started with GPGFrontend. "
"It will open in the main window.<br>"));
bottomLabel->setWordWrap(true);
diff --git a/src/ui/KeyDetailsDialog.cpp b/src/ui/keypair_details/KeyDetailsDialog.cpp
index 3be333a1..7b09471b 100644
--- a/src/ui/KeyDetailsDialog.cpp
+++ b/src/ui/keypair_details/KeyDetailsDialog.cpp
@@ -22,14 +22,16 @@
*
*/
-#include "ui/KeyDetailsDialog.h"
+#include "ui/keypair_details/KeyDetailsDialog.h"
KeyDetailsDialog::KeyDetailsDialog(GpgME::GpgContext *ctx, const GpgKey& key, QWidget *parent)
: QDialog(parent) {
tabWidget = new QTabWidget(this);
- tabWidget->addTab(new KeyPairDetailTab(ctx, key, this), tr("KeyPair Details"));
+ tabWidget->addTab(new KeyPairDetailTab(ctx, key, this), tr("KeyPair"));
+ tabWidget->addTab(new KeyPairUIDTab(ctx, key, this), tr("UIDs"));
+ tabWidget->addTab(new KeyPairSubkeyTab(ctx, key, this), tr("Subkeys"));
auto *mainLayout = new QVBoxLayout;
mainLayout->addWidget(tabWidget);
@@ -38,6 +40,4 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::GpgContext *ctx, const GpgKey& key, QW
this->setWindowTitle(tr("Key Details"));
this->setModal(true);
this->show();
-
- exec();
} \ No newline at end of file
diff --git a/src/ui/KeyPairDetailTab.cpp b/src/ui/keypair_details/KeyPairDetailTab.cpp
index 30be2a77..6974157f 100644
--- a/src/ui/KeyPairDetailTab.cpp
+++ b/src/ui/keypair_details/KeyPairDetailTab.cpp
@@ -2,7 +2,7 @@
// Created by eric on 2021/5/21.
//
-#include "ui/KeyPairDetailTab.h"
+#include "ui/keypair_details/KeyPairDetailTab.h"
KeyPairDetailTab::KeyPairDetailTab(GpgME::GpgContext *ctx, const GpgKey &key, QWidget *parent) : QWidget(parent) {
diff --git a/src/ui/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/keypair_details/KeyPairSubkeyTab.cpp
new file mode 100644
index 00000000..1c112609
--- /dev/null
+++ b/src/ui/keypair_details/KeyPairSubkeyTab.cpp
@@ -0,0 +1,52 @@
+/**
+ * This file is part of GPGFrontend.
+ *
+ * GPGFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#include "ui/keypair_details/KeyPairSubkeyTab.h"
+
+KeyPairSubkeyTab::KeyPairSubkeyTab(GpgME::GpgContext *ctx, const GpgKey &key, QWidget *parent) : mCtx(ctx), key(key), QWidget(parent) {
+
+}
+
+void KeyPairSubkeyTab::creatSubkeyList() {
+ subkeyList = new QTableWidget(this);
+ subkeyList->setColumnCount(5);
+ subkeyList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ subkeyList->verticalHeader()->hide();
+ subkeyList->setShowGrid(false);
+ subkeyList->setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ // tableitems not editable
+ subkeyList->setEditTriggers(QAbstractItemView::NoEditTriggers);
+
+ // no focus (rectangle around tableitems)
+ // may be it should focus on whole row
+ subkeyList->setFocusPolicy(Qt::NoFocus);
+ subkeyList->setAlternatingRowColors(true);
+
+ QStringList labels;
+ labels << tr("Subkey ID") << tr("Key Size") << tr("Algo") << tr("Create Time") << tr("Expire Time");
+
+ subkeyList->setHorizontalHeaderLabels(labels);
+ subkeyList->horizontalHeader()->setStretchLastSection(true);
+}
diff --git a/src/ui/keypair_details/KeyPairUIDTab.cpp b/src/ui/keypair_details/KeyPairUIDTab.cpp
new file mode 100644
index 00000000..e0128b55
--- /dev/null
+++ b/src/ui/keypair_details/KeyPairUIDTab.cpp
@@ -0,0 +1,144 @@
+//
+// Created by eric on 2021/5/22.
+//
+
+#include "ui/keypair_details/KeyPairUIDTab.h"
+
+KeyPairUIDTab::KeyPairUIDTab(GpgME::GpgContext *ctx, const GpgKey &key, QWidget *parent) : QWidget(parent), key(key) {
+
+ mCtx = ctx;
+
+ createUIDList();
+ createSignList();
+
+ auto uidButtonsLayout = new QGridLayout();
+
+ auto addUIDButton = new QPushButton(tr("New UID"));
+ auto manageUIDButton = new QPushButton(tr("Manage UID"));
+
+ uidButtonsLayout->addWidget(addUIDButton, 0, 1);
+ uidButtonsLayout->addWidget(manageUIDButton, 0, 2);
+
+
+ auto sigButtonsLayout = new QGridLayout();
+
+ auto addSigButton = new QPushButton("New Signature");
+ auto manageSigButton = new QPushButton(tr("Manage Signature"));
+
+ sigButtonsLayout->addWidget(addSigButton, 0, 1);
+ sigButtonsLayout->addWidget(manageSigButton, 0, 2);
+
+ auto gridLayout = new QGridLayout();
+ gridLayout->addWidget(uidList, 0, 0);
+ gridLayout->addLayout(uidButtonsLayout, 1, 0);
+
+ gridLayout->addWidget(sigList, 2, 0);
+ gridLayout->addLayout(sigButtonsLayout, 3, 0);
+
+ setLayout(gridLayout);
+
+ connect(mCtx, SIGNAL(signalKeyDBChanged()), this, SLOT(slotRefreshUIDList()));
+ connect(mCtx, SIGNAL(signalKeyDBChanged()), this, SLOT(slotRefreshSigList()));
+
+ slotRefreshUIDList();
+ slotRefreshSigList();
+}
+
+void KeyPairUIDTab::createUIDList() {
+ uidList = new QTableWidget(this);
+ uidList->setColumnCount(3);
+ uidList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ uidList->verticalHeader()->hide();
+ uidList->setShowGrid(false);
+ uidList->setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ // tableitems not editable
+ uidList->setEditTriggers(QAbstractItemView::NoEditTriggers);
+
+ // no focus (rectangle around tableitems)
+ // may be it should focus on whole row
+ uidList->setFocusPolicy(Qt::NoFocus);
+ uidList->setAlternatingRowColors(true);
+
+ QStringList labels;
+ labels << tr("Name") << tr("Email") << tr("Comment");
+ uidList->setHorizontalHeaderLabels(labels);
+ uidList->horizontalHeader()->setStretchLastSection(true);
+}
+
+void KeyPairUIDTab::createSignList() {
+ sigList = new QTableWidget(this);
+ sigList->setColumnCount(5);
+ sigList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ sigList->verticalHeader()->hide();
+ sigList->setShowGrid(false);
+ sigList->setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ // tableitems not editable
+ sigList->setEditTriggers(QAbstractItemView::NoEditTriggers);
+
+ // no focus (rectangle around tableitems)
+ // may be it should focus on whole row
+ sigList->setFocusPolicy(Qt::NoFocus);
+ sigList->setAlternatingRowColors(true);
+
+ QStringList labels;
+ labels << tr("Type") << tr("Name") << tr("Pubkey Id") << tr("Create Time") << tr("Valid Time");
+ sigList->setHorizontalHeaderLabels(labels);
+ sigList->horizontalHeader()->setStretchLastSection(true);
+}
+
+void KeyPairUIDTab::slotRefreshUIDList() {
+ int row = 0;
+
+ uidList->clearContents();
+ uidList->setRowCount(key.uids.size());
+
+ for(const auto& uid : key.uids) {
+ auto *tmp0 = new QTableWidgetItem(uid.name);
+ uidList->setItem(row, 0, tmp0);
+
+ auto *tmp1 = new QTableWidgetItem(uid.email);
+ uidList->setItem(row, 1, tmp1);
+
+ auto *tmp2 = new QTableWidgetItem(uid.comment);
+ uidList->setItem(row, 2, tmp2);
+
+ row++;
+ }
+
+
+}
+
+void KeyPairUIDTab::slotRefreshSigList() {
+ int row = 0;
+
+ sigList->clearContents();
+
+ for(const auto& uid : key.uids) {
+ row += uid.signatures.size();
+ }
+ sigList->setRowCount(row);
+
+ row = 0;
+ for(const auto& uid : key.uids) {
+ for(const auto &sig : uid.signatures) {
+ auto *tmp0 = new QTableWidgetItem(sig.pubkey_algo);
+ uidList->setItem(row, 0, tmp0);
+
+ auto *tmp1 = new QTableWidgetItem(sig.name);
+ uidList->setItem(row, 1, tmp1);
+
+ auto *tmp2 = new QTableWidgetItem(sig.uid);
+ uidList->setItem(row, 2, tmp2);
+
+ auto *tmp3 = new QTableWidgetItem(sig.create_time.toString());
+ uidList->setItem(row, 3, tmp3);
+
+ auto *tmp4 = new QTableWidgetItem(sig.expire_time.toString());
+ uidList->setItem(row, 4, tmp4);
+
+ row++;
+ }
+ }
+}