aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/KeyMgmt.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-05-29 19:28:40 +0000
committerSaturneric <[email protected]>2021-05-29 19:28:40 +0000
commitfe67bfb777a79b25149efa3e045dc043dc144ad0 (patch)
tree4d75a10f210b86d7e116d188569bc08e4e72adb7 /src/ui/KeyMgmt.cpp
parentMake eligible keys enter the signature candidate list. (diff)
downloadGpgFrontend-fe67bfb777a79b25149efa3e045dc043dc144ad0.tar.gz
GpgFrontend-fe67bfb777a79b25149efa3e045dc043dc144ad0.zip
New page and function for generating subkeys.
Define the interface and functions of the subkey management tab. When there is an item in the UID list, the first item is selected by default. Compile the API for generating sub-keys and the corresponding calling thread. Set GpgGenKeyInfo to apply to the subkey Generate a subkey for the selected key pair of the management key pair interface. Adjust the project structure and add a new classification key generation category. Double-click the item in KeyList in the key pair management interface to enter the key details page. Adjust the title of the key pair management interface. Optimize part of the code of KeyGenThread. Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to '')
-rwxr-xr-xsrc/ui/KeyMgmt.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/ui/KeyMgmt.cpp b/src/ui/KeyMgmt.cpp
index d40928ee..3b04a22f 100755
--- a/src/ui/KeyMgmt.cpp
+++ b/src/ui/KeyMgmt.cpp
@@ -35,6 +35,9 @@ KeyMgmt::KeyMgmt(GpgME::GpgContext *ctx, QWidget *parent ) : QMainWindow(parent
mKeyList->setColumnWidth(2, 250);
mKeyList->setColumnWidth(3, 250);
setCentralWidget(mKeyList);
+ mKeyList->setDoubleClickedAction([this] (const GpgKey &key, QWidget *parent) {
+ new KeyDetailsDialog(mCtx, key, parent);
+ });
createActions();
createMenus();
@@ -62,7 +65,7 @@ KeyMgmt::KeyMgmt(GpgME::GpgContext *ctx, QWidget *parent ) : QMainWindow(parent
this->resize(QSize(800, 400));
}
- setWindowTitle(tr("Keymanagement"));
+ setWindowTitle(tr("KeyPairs Management"));
mKeyList->addMenuAction(deleteSelectedKeysAct);
mKeyList->addMenuAction(showKeyDetailsAct);
}
@@ -80,9 +83,9 @@ void KeyMgmt::createActions()
generateKeyPairAct->setToolTip(tr("Generate KeyPair"));
connect(generateKeyPairAct, SIGNAL(triggered()), this, SLOT(slotGenerateKeyDialog()));
- generateSubKeyAct = new QAction(tr("Generate SubKey"), this);
+ generateSubKeyAct = new QAction(tr("Generate Subkey For Selected"), this);
generateSubKeyAct->setIcon(QIcon(":key_generate.png"));
- generateSubKeyAct->setToolTip(tr("Generate SubKey Of KeyPair"));
+ generateSubKeyAct->setToolTip(tr("Generate Subkey For Selected KeyPair"));
connect(generateSubKeyAct, SIGNAL(triggered()), this, SLOT(slotGenerateSubKey()));
importKeyFromFileAct = new QAction(tr("&File"), this);
@@ -311,5 +314,21 @@ void KeyMgmt::closeEvent(QCloseEvent *event)
}
void KeyMgmt::slotGenerateSubKey() {
+ auto selectedList = mKeyList->getSelected();
+ if(selectedList->empty()) {
+ QMessageBox::information(nullptr,
+ tr("Invalid Operation"),
+ tr("Please select one KeyPair before doing this operation."));
+ return;
+ }
+ const auto &key = mCtx->getKeyById(selectedList->first());
+ if(!key.is_private_key) {
+ QMessageBox::critical(nullptr,
+ tr("Invalid Operation"),
+ tr("If a key pair does not have a private key then it will not be able to generate sub-keys."));
+ return;
+ }
+ auto dialog = new SubkeyGenerateDialog(mCtx, key, this);
+ dialog->show();
}