aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2023-07-13 03:02:28 +0000
committerSaturneric <[email protected]>2023-07-13 03:02:28 +0000
commit5b635cf78c679f36cf47d18d8ba4e6967a7297f9 (patch)
treecbe42823440bcadd39572c4c19dee66d8d8c5b1e /src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
parentfeat: support owner trust level settings of gpg key (diff)
downloadGpgFrontend-5b635cf78c679f36cf47d18d8ba4e6967a7297f9.tar.gz
GpgFrontend-5b635cf78c679f36cf47d18d8ba4e6967a7297f9.zip
feat: improve ui of owner trust function
Diffstat (limited to 'src/ui/dialog/keypair_details/KeyPairOperaTab.cpp')
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index 34bd8534..13c857a0 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -405,13 +405,13 @@ void KeyPairOperaTab::slot_modify_tofu_policy() {
void KeyPairOperaTab::slot_set_owner_trust_level() {
QStringList items;
- items << _("Ultimate") << _("Full") << _("Marginal") << _("Never")
- << _("Undefined") << _("Unknown");
-
+ items << _("Unknown") << _("Undefined") << _("Never") << _("Marginal")
+ << _("Full") << _("Ultimate");
bool ok;
- QString item =
- QInputDialog::getItem(this, _("Modify Owner Trust Level"),
- _("Trust for the Key Pair:"), items, 0, false, &ok);
+ QString item = QInputDialog::getItem(this, _("Modify Owner Trust Level"),
+ _("Trust for the Key Pair:"), items,
+ m_key_.GetOwnerTrustLevel(), false, &ok);
+
if (ok && !item.isEmpty()) {
SPDLOG_DEBUG("selected policy: {}", item.toStdString());
int trust_level = 0; // Unknown Level
@@ -426,12 +426,23 @@ void KeyPairOperaTab::slot_set_owner_trust_level() {
} else if (item == _("Undefined")) {
trust_level = 1;
}
+
+ if (trust_level == 0) {
+ QMessageBox::warning(
+ this, _("Warning"),
+ QString(_("Owner Trust Level cannot set to Unknown level, automately "
+ "changing it into Undefined level.")));
+ trust_level = 1;
+ }
+
bool status =
GpgKeyManager::GetInstance().SetOwnerTrustLevel(m_key_, trust_level);
if (!status) {
QMessageBox::critical(this, _("Failed"),
QString(_("Modify Owner Trust Level failed.")));
} else {
+ QMessageBox::information(this, _("Success"),
+ QString(_("Set Owner Trust Level successful.")));
// update key database and refresh ui
emit SignalKeyDatabaseRefresh();
}