diff options
author | saturneric <[email protected]> | 2024-11-22 22:06:30 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-11-22 22:06:30 +0000 |
commit | e16e15db09d89a997db73e313b966f95e6c59f56 (patch) | |
tree | 4f6be7375b983eda33b5faa37b9c7a3af0a57ed6 /src/ui/UserInterfaceUtils.cpp | |
parent | fix: correct the path to the executable of app image mode (diff) | |
download | GpgFrontend-e16e15db09d89a997db73e313b966f95e6c59f56.tar.gz GpgFrontend-e16e15db09d89a997db73e313b966f95e6c59f56.zip |
feat: rewrite core init processes and add env option
Diffstat (limited to 'src/ui/UserInterfaceUtils.cpp')
-rw-r--r-- | src/ui/UserInterfaceUtils.cpp | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index ba3c323b..5c07e009 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -182,43 +182,45 @@ CommonUtils::CommonUtils() : QWidget(nullptr) { &UISignalStation::SignalRestartApplication, this, &CommonUtils::SlotRestartApplication); - connect(this, &CommonUtils::SignalBadGnupgEnv, this, - [=](const QString &reason) { - QMessageBox msg_box; - msg_box.setText(tr("GnuPG Context Loading Failed")); - msg_box.setInformativeText( - tr("Gnupg(gpg) is not installed correctly, please follow " - "<a href='https://www.gpgfrontend.bktus.com/#/" - "faq?id=how-to-deal-with-39env-loading-failed39'>this " - "notes</a> in FAQ to install Gnupg and then open " - "GpgFrontend. <br />" - "Or, you can open GnuPG Controller to set a " - "custom GnuPG which GpgFrontend should use. Then, " - "GpgFrontend will restart. <br /><br />" - "Breif Reason: %1") - .arg(reason)); - msg_box.setStandardButtons(QMessageBox::Open | QMessageBox::Cancel); - msg_box.setDefaultButton(QMessageBox::Save); - int ret = msg_box.exec(); - - switch (ret) { - case QMessageBox::Open: - (new GnuPGControllerDialog(this))->exec(); - // restart application when loop start - application_need_to_restart_at_once_ = true; - // restart application, core and ui - emit SignalRestartApplication(kDeepRestartCode); - break; - case QMessageBox::Cancel: - // close application - emit SignalRestartApplication(0); - break; - default: - // close application - emit SignalRestartApplication(0); - break; - } - }); + connect( + this, &CommonUtils::SignalBadGnupgEnv, this, [=](const QString &reason) { + QMessageBox msg_box; + msg_box.setText(tr("Failed to Load GnuPG Context")); + msg_box.setInformativeText( + tr("It seems that GnuPG (gpg) is not properly installed. " + "Please refer to the <a " + "href='https://www.gpgfrontend.bktus.com/overview/faq/" + "#troubleshooting-gnupg-installation-issues'>FAQ</a> for " + "instructions on fixing the installation. After resolving the " + "issue, " + "relaunch GpgFrontend.<br /><br />" + "Alternatively, you can open the GnuPG Controller to configure " + "a custom GnuPG installation for GpgFrontend to use. Once set, " + "GpgFrontend will restart automatically.<br /><br />" + "Details: %1") + .arg(reason)); + msg_box.setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel); + msg_box.setDefaultButton(QMessageBox::Retry); + int ret = msg_box.exec(); + + switch (ret) { + case QMessageBox::Retry: + (new GnuPGControllerDialog(this))->exec(); + // Mark application for immediate restart + application_need_to_restart_at_once_ = true; + // Trigger application restart with deep restart code + emit SignalRestartApplication(kDeepRestartCode); + break; + case QMessageBox::Cancel: + // Close application + emit SignalRestartApplication(0); + break; + default: + // Default action: close application + emit SignalRestartApplication(0); + break; + } + }); } void CommonUtils::WaitForOpera(QWidget *parent, |