diff options
author | saturneric <[email protected]> | 2024-12-21 03:12:07 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-12-21 03:12:07 +0000 |
commit | 8ddcf78c103037ccd1e4b5f3115164583d410aef (patch) | |
tree | 0835ea88dec76abe2ad6c62167989d0d7d27918a | |
parent | fix: ResizeToContents behaviors of key list (diff) | |
download | GpgFrontend-8ddcf78c103037ccd1e4b5f3115164583d410aef.tar.gz GpgFrontend-8ddcf78c103037ccd1e4b5f3115164583d410aef.zip |
fix: avoid check action triggering the show of key detail dialog
-rw-r--r-- | src/ui/main_window/KeyMgmt.cpp | 4 | ||||
-rw-r--r-- | src/ui/widgets/KeyList.cpp | 18 | ||||
-rw-r--r-- | src/ui/widgets/KeyList.h | 15 | ||||
-rw-r--r-- | src/ui/widgets/KeyTable.cpp | 2 |
4 files changed, 2 insertions, 37 deletions
diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp index d6530c64..f7fabb92 100644 --- a/src/ui/main_window/KeyMgmt.cpp +++ b/src/ui/main_window/KeyMgmt.cpp @@ -97,10 +97,6 @@ KeyMgmt::KeyMgmt(QWidget* parent) [](const GpgKey& key) -> bool { return key.IsExpired(); }); setCentralWidget(key_list_); - key_list_->SetDoubleClickedAction([this](const GpgKey& key, - QWidget* /*parent*/) { - new KeyDetailsDialog(key_list_->GetCurrentGpgContextChannel(), key, this); - }); key_list_->SlotRefresh(); diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index 9498480e..ca06cf95 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -33,7 +33,6 @@ #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgKeyGetter.h" -#include "core/module/ModuleManager.h" #include "core/utils/GpgUtils.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" @@ -539,23 +538,6 @@ void KeyList::import_keys(const QByteArray& in_buffer) { (new KeyImportDetailDialog(current_gpg_context_channel_, result, this)); } -void KeyList::slot_double_clicked(const QModelIndex& index) { - if (ui_->keyGroupTab->size().isEmpty()) return; - - auto* key_table = qobject_cast<KeyTable*>(ui_->keyGroupTab->currentWidget()); - if (m_action_ != nullptr) { - const auto key = GpgKeyGetter::GetInstance(current_gpg_context_channel_) - .GetKey(key_table->GetKeyIdByRow(index.row())); - assert(key.IsGood()); - m_action_(key, this); - } -} - -void KeyList::SetDoubleClickedAction( - std::function<void(const GpgKey&, QWidget*)> action) { - this->m_action_ = std::move(action); -} - auto KeyList::GetSelectedKey() -> QString { if (ui_->keyGroupTab->size().isEmpty()) return {}; diff --git a/src/ui/widgets/KeyList.h b/src/ui/widgets/KeyList.h index 490da86d..920e7607 100644 --- a/src/ui/widgets/KeyList.h +++ b/src/ui/widgets/KeyList.h @@ -109,14 +109,6 @@ class KeyList : public QWidget { GpgKeyTableColumn custom_columns_filter = GpgKeyTableColumn::kALL); /** - * @brief Set the Double Clicked Action object - * - * @param action - */ - void SetDoubleClickedAction( - std::function<void(const GpgKey&, QWidget*)> action); - - /** * @brief Set the Column Width object * * @param row @@ -312,13 +304,6 @@ class KeyList : public QWidget { /** * @brief * - * @param index - */ - void slot_double_clicked(const QModelIndex& index); - - /** - * @brief - * */ void slot_sync_with_key_server(); diff --git a/src/ui/widgets/KeyTable.cpp b/src/ui/widgets/KeyTable.cpp index 542382cf..a1f5db07 100644 --- a/src/ui/widgets/KeyTable.cpp +++ b/src/ui/widgets/KeyTable.cpp @@ -76,6 +76,8 @@ KeyTable::KeyTable(QWidget* parent, QSharedPointer<GpgKeyTableModel> model, }); connect(this, &QTableView::doubleClicked, this, [this](const QModelIndex& index) { + if (!index.isValid() || index.column() == 0) return; + auto key = GpgKeyGetter::GetInstance(model_->GetGpgContextChannel()) .GetKey(GetKeyIdByRow(index.row())); if (!key.IsGood()) { |