aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/UserInterfaceUtils.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-04 13:43:03 +0000
committersaturneric <[email protected]>2023-12-04 13:43:33 +0000
commit33544f343df4e834730d9b0c0916433a51738d55 (patch)
treefdab9c9971e041aacf9ddf4269c3def512c0f627 /src/ui/UserInterfaceUtils.cpp
parentfix: common utils should be created before core initialization (diff)
downloadGpgFrontend-33544f343df4e834730d9b0c0916433a51738d55.tar.gz
GpgFrontend-33544f343df4e834730d9b0c0916433a51738d55.zip
feat: add reasons explanation to env loading failed message box
Diffstat (limited to 'src/ui/UserInterfaceUtils.cpp')
-rw-r--r--src/ui/UserInterfaceUtils.cpp71
1 files changed, 38 insertions, 33 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index 7c42e86d..cebd4854 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -32,6 +32,7 @@
#include <qdialog.h>
#include <QtNetwork>
+#include <boost/format/format_fwd.hpp>
#include <string>
#include <utility>
#include <vector>
@@ -184,39 +185,43 @@ CommonUtils::CommonUtils() : QWidget(nullptr) {
&UISignalStation::SignalRestartApplication, this,
&CommonUtils::SlotRestartApplication);
- connect(this, &CommonUtils::SignalBadGnupgEnv, this, [=]() {
- QMessageBox msg_box;
- msg_box.setText(_("GnuPG Context Loading Failed"));
- msg_box.setInformativeText(
- _("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. Or, you can open GnuPG Controller to set a custom "
- "GnuPG "
- "which GpgFrontend should use. Then, GpgFrontend will restart."));
- 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(_("GnuPG Context Loading Failed"));
+ msg_box.setInformativeText(
+ QString(_("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;
+ }
+ });
}
void CommonUtils::WaitForOpera(QWidget *parent,