aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/controller')
-rw-r--r--src/ui/dialog/controller/GnuPGControllerDialog.h2
-rw-r--r--src/ui/dialog/controller/ModuleControllerDialog.cpp2
-rw-r--r--src/ui/dialog/controller/ModuleControllerDialog.h2
-rw-r--r--src/ui/dialog/controller/SmartCardControllerDialog.cpp18
4 files changed, 18 insertions, 6 deletions
diff --git a/src/ui/dialog/controller/GnuPGControllerDialog.h b/src/ui/dialog/controller/GnuPGControllerDialog.h
index 3ee129b9..0337b141 100644
--- a/src/ui/dialog/controller/GnuPGControllerDialog.h
+++ b/src/ui/dialog/controller/GnuPGControllerDialog.h
@@ -126,7 +126,7 @@ class GnuPGControllerDialog : public GeneralDialog {
void slot_edit_key_database();
private:
- std::shared_ptr<Ui_GnuPGControllerDialog> ui_; ///<
+ QSharedPointer<Ui_GnuPGControllerDialog> ui_; ///<
const QString app_path_;
int restart_mode_{0}; ///<
QString custom_key_database_path_;
diff --git a/src/ui/dialog/controller/ModuleControllerDialog.cpp b/src/ui/dialog/controller/ModuleControllerDialog.cpp
index 2ad13151..f9b8e58f 100644
--- a/src/ui/dialog/controller/ModuleControllerDialog.cpp
+++ b/src/ui/dialog/controller/ModuleControllerDialog.cpp
@@ -41,7 +41,7 @@ namespace GpgFrontend::UI {
ModuleControllerDialog::ModuleControllerDialog(QWidget* parent)
: GeneralDialog("ModuleControllerDialog", parent),
- ui_(std::make_shared<Ui_ModuleControllerDialog>()),
+ ui_(QSharedPointer<Ui_ModuleControllerDialog>::create()),
module_manager_(&Module::ModuleManager::GetInstance()) {
ui_->setupUi(this);
ui_->actionsGroupBox->hide();
diff --git a/src/ui/dialog/controller/ModuleControllerDialog.h b/src/ui/dialog/controller/ModuleControllerDialog.h
index 94520a76..455a39c8 100644
--- a/src/ui/dialog/controller/ModuleControllerDialog.h
+++ b/src/ui/dialog/controller/ModuleControllerDialog.h
@@ -55,7 +55,7 @@ class ModuleControllerDialog : public GeneralDialog {
void slot_load_module_details(Module::ModuleIdentifier);
private:
- std::shared_ptr<Ui_ModuleControllerDialog> ui_; ///<
+ QSharedPointer<Ui_ModuleControllerDialog> ui_; ///<
Module::ModuleManager* module_manager_;
};
diff --git a/src/ui/dialog/controller/SmartCardControllerDialog.cpp b/src/ui/dialog/controller/SmartCardControllerDialog.cpp
index b48d49af..fb812ad6 100644
--- a/src/ui/dialog/controller/SmartCardControllerDialog.cpp
+++ b/src/ui/dialog/controller/SmartCardControllerDialog.cpp
@@ -29,12 +29,11 @@
#include "SmartCardControllerDialog.h"
#include "core/function/gpg/GpgAdvancedOperator.h"
-#include "core/function/gpg/GpgAssuanHelper.h"
#include "core/function/gpg/GpgCommandExecutor.h"
#include "core/function/gpg/GpgSmartCardManager.h"
-#include "core/module/ModuleManager.h"
#include "core/utils/GpgUtils.h"
#include "ui/UISignalStation.h"
+#include "ui/dialog/key_generate/GenerateCardKeyDialog.h"
//
#include "ui_SmartCardControllerDialog.h"
@@ -59,6 +58,7 @@ SmartCardControllerDialog::SmartCardControllerDialog(QWidget* parent)
ui_->cResetCodeButton->setText(tr("Change Reset Code"));
ui_->fetchButton->setText(tr("Fetch"));
ui_->restartGpgAgentButton->setText(tr("Restart All Gpg-Agents"));
+ ui_->generateKeysButton->setText(tr("Generate Card Keys"));
ui_->refreshButton->setText(tr("Refresh"));
ui_->operationGroupBox->setTitle(tr("Operations"));
@@ -122,6 +122,16 @@ SmartCardControllerDialog::SmartCardControllerDialog(QWidget* parent)
});
});
+ connect(ui_->generateKeysButton, &QPushButton::clicked, this, [=](bool) {
+ auto serial_number = ui_->currentCardComboBox->currentText();
+ auto* d = new GenerateCardKeyDialog(channel_, serial_number, this);
+ connect(d, &GenerateCardKeyDialog::finished, this, [=](int ret) {
+ if (ret == 1) {
+ fetch_smart_card_info(serial_number);
+ }
+ });
+ });
+
connect(UISignalStation::GetInstance(),
&UISignalStation::SignalKeyDatabaseRefreshDone, this, [=]() {
refresh_key_tree_view(ui_->keyDBIndexComboBox->currentIndex());
@@ -325,17 +335,19 @@ void SmartCardControllerDialog::slot_refresh() {
void SmartCardControllerDialog::refresh_key_tree_view(int channel) {
if (!has_card_) return;
+ ui_->cardKeysTreeView->SetChannel(channel);
+
QStringList card_fprs;
for (const auto& key_info : card_info_.card_keys_info.values()) {
card_fprs.append(key_info.fingerprint);
}
+ LOG_D() << "card key fingerprints:" << card_fprs;
if (card_fprs.isEmpty()) {
ui_->cardKeysTreeView->SetKeyFilter([](auto) { return false; });
return;
}
- ui_->cardKeysTreeView->SetChannel(channel);
ui_->cardKeysTreeView->SetKeyFilter([=](const GpgAbstractKey* k) {
return card_fprs.contains(k->Fingerprint());
});