aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/ADSKsPicker.cpp11
-rw-r--r--src/ui/dialog/ADSKsPicker.h5
-rw-r--r--src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp9
3 files changed, 14 insertions, 11 deletions
diff --git a/src/ui/dialog/ADSKsPicker.cpp b/src/ui/dialog/ADSKsPicker.cpp
index a3589a91..f10a936a 100644
--- a/src/ui/dialog/ADSKsPicker.cpp
+++ b/src/ui/dialog/ADSKsPicker.cpp
@@ -34,15 +34,14 @@
namespace GpgFrontend::UI {
ADSKsPicker::ADSKsPicker(int channel,
- const GpgKeyTreeModel::Detector& enable_detector,
+ const GpgKeyTreeProxyModel::KeyFilter& filter,
QWidget* parent)
: GeneralDialog(typeid(ADSKsPicker).name(), parent),
tree_view_(new KeyTreeView(
channel, [](GpgAbstractKey* k) { return k->IsSubKey(); },
- [=](GpgAbstractKey* k) {
- return (!k->IsSubKey() || (k->IsSubKey() && !k->IsPrimaryKey() &&
- k->IsHasEncrCap())) &&
- enable_detector(k);
+ [=](const GpgAbstractKey* k) {
+ return (!k->IsSubKey() || (k->IsSubKey() && k->IsHasEncrCap())) &&
+ filter(k);
})) {
auto* confirm_button = new QPushButton(tr("Confirm"));
auto* cancel_button = new QPushButton(tr("Cancel"));
@@ -77,7 +76,7 @@ ADSKsPicker::ADSKsPicker(int channel,
this->setWindowTitle(tr("ADSKs Picker"));
movePosition2CenterOfParent();
-
+
this->show();
this->raise();
this->activateWindow();
diff --git a/src/ui/dialog/ADSKsPicker.h b/src/ui/dialog/ADSKsPicker.h
index 9c431209..e5c08c9c 100644
--- a/src/ui/dialog/ADSKsPicker.h
+++ b/src/ui/dialog/ADSKsPicker.h
@@ -29,9 +29,9 @@
#pragma once
#include "GpgFrontendUI.h"
-#include "core/model/GpgKeyTreeModel.h"
#include "core/typedef/GpgTypedef.h"
#include "ui/dialog//GeneralDialog.h"
+#include "ui/model/GpgKeyTreeProxyModel.h"
namespace GpgFrontend::UI {
@@ -50,7 +50,8 @@ class ADSKsPicker : public GeneralDialog {
*
* @param parent
*/
- explicit ADSKsPicker(int channel, const GpgKeyTreeModel::Detector& enable,
+ explicit ADSKsPicker(int channel,
+ const GpgKeyTreeProxyModel::KeyFilter& filter,
QWidget* parent = nullptr);
/**
diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp
index ea175f3e..79a28176 100644
--- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp
@@ -294,7 +294,9 @@ void KeyPairSubkeyTab::slot_add_adsk() {
auto* dialog = new ADSKsPicker(
current_gpg_context_channel_,
- [=](GpgAbstractKey* key) { return !except_key_ids.contains(key->ID()); },
+ [=](const GpgAbstractKey* key) {
+ return !except_key_ids.contains(key->ID());
+ },
this);
dialog->exec();
@@ -474,8 +476,9 @@ void KeyPairSubkeyTab::contextMenuEvent(QContextMenuEvent* event) {
export_subkey_act_->setDisabled(!s_key.IsSecretKey());
edit_subkey_act_->setDisabled(!s_key.IsSecretKey());
- delete_subkey_act_->setDisabled(!s_key.IsSecretKey());
- revoke_subkey_act_->setDisabled(!s_key.IsSecretKey() || s_key.IsRevoked());
+ delete_subkey_act_->setDisabled(!s_key.IsSecretKey() && !s_key.IsADSK());
+ revoke_subkey_act_->setDisabled((!s_key.IsSecretKey() && !s_key.IsADSK()) ||
+ s_key.IsRevoked());
subkey_opera_menu_->exec(event->globalPos());
}