aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2023-03-31 08:28:09 +0000
committerSaturneric <[email protected]>2023-03-31 08:28:09 +0000
commita9a809931209125034567c18245ccec936d2e991 (patch)
treebbe3fa53133d7df0f4eb0ab466d3a29fe6693bbd /src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
parentfix: solve some ui and logic issues in keymgt (diff)
downloadGpgFrontend-a9a809931209125034567c18245ccec936d2e991.tar.gz
GpgFrontend-a9a809931209125034567c18245ccec936d2e991.zip
feat: improve ui when gnupg is offline
Diffstat (limited to '')
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index 59f3f7cf..9be77923 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -27,6 +27,7 @@
#include "KeyPairOperaTab.h"
#include "KeySetExpireDateDialog.h"
+#include "core/function/GlobalSettingStation.h"
#include "core/function/gpg/GpgKeyImportExporter.h"
#include "core/function/gpg/GpgKeyOpera.h"
#include "ui/SignalStation.h"
@@ -73,10 +74,23 @@ KeyPairOperaTab::KeyPairOperaTab(const std::string& key_id, QWidget* parent)
}
auto advance_h_box_layout = new QHBoxLayout();
+
+ // get settings
+ auto& settings = GlobalSettingStation::GetInstance().GetUISettings();
+ // read settings
+ bool forbid_all_gnupg_connection = false;
+ try {
+ forbid_all_gnupg_connection =
+ settings.lookup("network.forbid_all_gnupg_connection");
+ } catch (...) {
+ SPDLOG_ERROR("setting operation error: forbid_all_gnupg_connection");
+ }
+
auto* key_server_opera_button =
new QPushButton(_("Key Server Operation (Pubkey)"));
key_server_opera_button->setStyleSheet("text-align:center;");
key_server_opera_button->setMenu(key_server_opera_menu_);
+ key_server_opera_button->setDisabled(forbid_all_gnupg_connection);
advance_h_box_layout->addWidget(key_server_opera_button);
if (m_key_.IsPrivateKey() && m_key_.IsHasMasterKey()) {