diff options
author | saturneric <[email protected]> | 2025-04-12 10:33:06 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-04-12 10:33:06 +0000 |
commit | 2c84a775f444300cad8911ceb8e742fe138b5f6d (patch) | |
tree | fb6dbed1230a5497808c504d77a3e71dfbf43e80 | |
parent | feat: add ui support for adsk features (diff) | |
download | GpgFrontend-2c84a775f444300cad8911ceb8e742fe138b5f6d.tar.gz GpgFrontend-2c84a775f444300cad8911ceb8e742fe138b5f6d.zip |
fix: wrong ui dialog order after switching apps
-rw-r--r-- | src/ui/dialog/ADSKsPicker.cpp (renamed from src/ui/dialog/SubKeysPicker.cpp) | 36 | ||||
-rw-r--r-- | src/ui/dialog/ADSKsPicker.h (renamed from src/ui/dialog/SubKeysPicker.h) | 6 | ||||
-rw-r--r-- | src/ui/dialog/SignersPicker.cpp | 3 | ||||
-rw-r--r-- | src/ui/dialog/WaitingDialog.cpp | 3 | ||||
-rw-r--r-- | src/ui/dialog/help/AboutDialog.cpp | 4 | ||||
-rw-r--r-- | src/ui/dialog/import_export/KeyImportDetailDialog.cpp | 3 | ||||
-rw-r--r-- | src/ui/dialog/keypair_details/KeyDetailsDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp | 10 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsDialog.cpp | 3 |
10 files changed, 49 insertions, 23 deletions
diff --git a/src/ui/dialog/SubKeysPicker.cpp b/src/ui/dialog/ADSKsPicker.cpp index af9c5c6d..a3589a91 100644 --- a/src/ui/dialog/SubKeysPicker.cpp +++ b/src/ui/dialog/ADSKsPicker.cpp @@ -26,17 +26,17 @@ * */ -#include "SubKeysPicker.h" +#include "ADSKsPicker.h" #include "core/GpgModel.h" #include "ui/widgets/KeyTreeView.h" namespace GpgFrontend::UI { -SubKeysPicker::SubKeysPicker(int channel, - const GpgKeyTreeModel::Detector& enable_detector, - QWidget* parent) - : GeneralDialog(typeid(SubKeysPicker).name(), parent), +ADSKsPicker::ADSKsPicker(int channel, + const GpgKeyTreeModel::Detector& enable_detector, + QWidget* parent) + : GeneralDialog(typeid(ADSKsPicker).name(), parent), tree_view_(new KeyTreeView( channel, [](GpgAbstractKey* k) { return k->IsSubKey(); }, [=](GpgAbstractKey* k) { @@ -52,31 +52,41 @@ SubKeysPicker::SubKeysPicker(int channel, connect(confirm_button, &QPushButton::clicked, this, &QDialog::accept); connect(cancel_button, &QPushButton::clicked, this, &QDialog::reject); + tree_view_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + auto* vbox2 = new QVBoxLayout(); - vbox2->addWidget(new QLabel(tr("Select Subkey(s)") + ": ")); + vbox2->addWidget(new QLabel(tr("Select ADSK(s)") + ": ")); vbox2->addWidget(tree_view_); - vbox2->addWidget(new QLabel( - tr("Please select one or more subkeys you use for operation."))); + + auto* tips_label = new QLabel( + tr("ADSK (Additional Decryption Subkey) allows others to encrypt data " + "for you without having access to your private key. You are only " + "allow to check subkeys with encryption capability.")); + tips_label->setWordWrap(true); + tips_label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); + + vbox2->addWidget(tips_label); vbox2->addWidget(confirm_button); vbox2->addWidget(cancel_button); setLayout(vbox2); - tree_view_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); this->setModal(true); - this->setWindowTitle(tr("Subkeys Picker")); + this->setWindowTitle(tr("ADSKs Picker")); movePosition2CenterOfParent(); + this->show(); + this->raise(); + this->activateWindow(); } -auto SubKeysPicker::GetCheckedSubkeys() -> QContainer<GpgSubKey> { +auto ADSKsPicker::GetCheckedSubkeys() -> QContainer<GpgSubKey> { return tree_view_->GetAllCheckedSubKey(); } -auto SubKeysPicker::GetStatus() const -> bool { return this->accepted_; } +auto ADSKsPicker::GetStatus() const -> bool { return this->accepted_; } } // namespace GpgFrontend::UI diff --git a/src/ui/dialog/SubKeysPicker.h b/src/ui/dialog/ADSKsPicker.h index a7a1b200..9c431209 100644 --- a/src/ui/dialog/SubKeysPicker.h +++ b/src/ui/dialog/ADSKsPicker.h @@ -41,7 +41,7 @@ class KeyTreeView; * @brief * */ -class SubKeysPicker : public GeneralDialog { +class ADSKsPicker : public GeneralDialog { Q_OBJECT public: @@ -50,8 +50,8 @@ class SubKeysPicker : public GeneralDialog { * * @param parent */ - explicit SubKeysPicker(int channel, const GpgKeyTreeModel::Detector& enable, - QWidget* parent = nullptr); + explicit ADSKsPicker(int channel, const GpgKeyTreeModel::Detector& enable, + QWidget* parent = nullptr); /** * @brief Get the Checked Signers object diff --git a/src/ui/dialog/SignersPicker.cpp b/src/ui/dialog/SignersPicker.cpp index 61a31606..fa72287e 100644 --- a/src/ui/dialog/SignersPicker.cpp +++ b/src/ui/dialog/SignersPicker.cpp @@ -73,7 +73,10 @@ SignersPicker::SignersPicker(int channel, QWidget* parent) this->setMinimumWidth(480); movePosition2CenterOfParent(); + this->show(); + this->raise(); + this->activateWindow(); } auto SignersPicker::GetCheckedSigners() -> GpgFrontend::KeyIdArgsList { diff --git a/src/ui/dialog/WaitingDialog.cpp b/src/ui/dialog/WaitingDialog.cpp index e9d28f26..792949fd 100644 --- a/src/ui/dialog/WaitingDialog.cpp +++ b/src/ui/dialog/WaitingDialog.cpp @@ -53,7 +53,10 @@ WaitingDialog::WaitingDialog(const QString& title, bool range, QWidget* parent) &WaitingDialog::SlotUpdateValue); this->movePosition2CenterOfParent(); + this->show(); + this->raise(); + this->activateWindow(); } void WaitingDialog::SlotUpdateValue(int value) { diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index cca89b9e..ea678a0e 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -76,9 +76,9 @@ AboutDialog::AboutDialog(const QString& default_tab_name, QWidget* parent) main_layout->setContentsMargins(QMargins{5, 0, 5, 0}); setLayout(main_layout); - this->resize(520, 620); - this->setMinimumWidth(450); this->show(); + this->raise(); + this->activateWindow(); } void AboutDialog::showEvent(QShowEvent* ev) { QDialog::showEvent(ev); } diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp index 6d93c796..0a5f5005 100644 --- a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp +++ b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp @@ -66,7 +66,10 @@ KeyImportDetailDialog::KeyImportDetailDialog( setPosCenterOfScreen(); this->setModal(true); + this->show(); + this->raise(); + this->activateWindow(); } void KeyImportDetailDialog::create_general_info_box() { diff --git a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp index f71465c9..d48cbdb7 100644 --- a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp +++ b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp @@ -78,5 +78,7 @@ KeyDetailsDialog::KeyDetailsDialog(int channel, const GpgKey& key, this->setModal(true); this->show(); + this->raise(); + this->activateWindow(); } } // namespace GpgFrontend::UI diff --git a/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp b/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp index 6cd423fc..754999a2 100644 --- a/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp +++ b/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp @@ -114,6 +114,8 @@ void KeyNewUIDDialog::slot_create_new_uid() { error_label_->setText(error_string); this->show(); + this->raise(); + this->activateWindow(); } } diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp index 526b9dd5..a85f05f5 100644 --- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp @@ -38,8 +38,8 @@ #include "core/utils/IOUtils.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" +#include "ui/dialog/ADSKsPicker.h" #include "ui/dialog/RevocationOptionsDialog.h" -#include "ui/dialog/SubKeysPicker.h" namespace GpgFrontend::UI { @@ -59,7 +59,7 @@ KeyPairSubkeyTab::KeyPairSubkeyTab(int channel, const QString& key_id, auto* uid_buttons_layout = new QGridLayout(); - auto* add_subkey_button = new QPushButton(tr("Generate A New Subkey")); + auto* add_subkey_button = new QPushButton(tr("New Subkey")); auto* add_adsk_button = new QPushButton(tr("Add ADSK(s)")); if (!key_.IsPrivateKey() || !key_.IsHasMasterKey()) { add_subkey_button->setDisabled(true); @@ -69,8 +69,8 @@ KeyPairSubkeyTab::KeyPairSubkeyTab(int channel, const QString& key_id, add_adsk_button->hide(); } - uid_buttons_layout->addWidget(add_subkey_button, 0, 1); - uid_buttons_layout->addWidget(add_adsk_button, 1, 1); + uid_buttons_layout->addWidget(add_subkey_button, 0, 0); + uid_buttons_layout->addWidget(add_adsk_button, 0, 1); auto* base_layout = new QVBoxLayout(); @@ -295,7 +295,7 @@ void KeyPairSubkeyTab::slot_add_adsk() { except_key_ids.append(sub_key.GetID()); } - auto* dialog = new SubKeysPicker( + auto* dialog = new ADSKsPicker( current_gpg_context_channel_, [=](GpgAbstractKey* key) { return !except_key_ids.contains(key->ID()); }, this); diff --git a/src/ui/dialog/settings/SettingsDialog.cpp b/src/ui/dialog/settings/SettingsDialog.cpp index 0c38d372..87868eb4 100644 --- a/src/ui/dialog/settings/SettingsDialog.cpp +++ b/src/ui/dialog/settings/SettingsDialog.cpp @@ -91,7 +91,10 @@ SettingsDialog::SettingsDialog(QWidget* parent) this->setMinimumWidth(500); this->adjustSize(); + this->show(); + this->raise(); + this->activateWindow(); } void SettingsDialog::slot_declare_a_restart() { |