diff --git a/src/lib/common/Settings.cpp b/src/lib/common/Settings.cpp index 60970cfb2..e36809ce7 100644 --- a/src/lib/common/Settings.cpp +++ b/src/lib/common/Settings.cpp @@ -81,7 +81,7 @@ QVariant Settings::defaultValue(const QString &key) if ((key == Gui::CloseToTray) || (key == Gui::LogExpanded) || (key == Gui::SymbolicTrayIcon) || (key == Gui::CloseReminder) || (key == Security::TlsEnabled) || (key == Security::CheckPeers) || - (key == Client::LanguageSync)) { + (key == Client::LanguageSync) || (key == Gui::ShowGenericClientFailureDialog)) { return true; } diff --git a/src/lib/common/Settings.h b/src/lib/common/Settings.h index 8fa7c0d41..339779d73 100644 --- a/src/lib/common/Settings.h +++ b/src/lib/common/Settings.h @@ -67,6 +67,7 @@ public: inline static const auto LogExpanded = QStringLiteral("gui/logExpanded"); inline static const auto SymbolicTrayIcon = QStringLiteral("gui/symbolicTrayIcon"); inline static const auto WindowGeometry = QStringLiteral("gui/windowGeometry"); + inline static const auto ShowGenericClientFailureDialog = QStringLiteral("gui/showGenericClientFailureDialog"); }; struct Log { @@ -185,6 +186,7 @@ private: , Settings::Gui::LogExpanded , Settings::Gui::SymbolicTrayIcon , Settings::Gui::WindowGeometry + , Settings::Gui::ShowGenericClientFailureDialog , Settings::Security::Certificate , Settings::Security::CheckPeers , Settings::Security::KeySize diff --git a/src/lib/gui/Messages.cpp b/src/lib/gui/Messages.cpp index a8a285f3d..45ad3998e 100644 --- a/src/lib/gui/Messages.cpp +++ b/src/lib/gui/Messages.cpp @@ -13,6 +13,7 @@ #include "common/Settings.h" #include "common/UrlConstants.h" +#include #include #include #include @@ -213,7 +214,29 @@ void showClientConnectError(QWidget *parent, ClientError error, const QString &a auto title = QObject::tr("%1 Connection Error").arg(kAppName); - QMessageBox::warning(parent, title, message); + if (error != ClientError::HostnameError) { + QMessageBox::warning(parent, title, message); + return; + } + + if (!Settings::value(Settings::Gui::ShowGenericClientFailureDialog).toBool()) + return; + + auto dialog = QMessageBox(parent); + dialog.setWindowTitle(title); + dialog.setText(message); + dialog.setWindowModality(Qt::ApplicationModal); + dialog.setIcon(QMessageBox::Information); + + auto cbNoShowAgain = new QCheckBox(QObject::tr("Do not show this message again")); + + QObject::connect(cbNoShowAgain, &QCheckBox::toggled, [&](bool enabled) { + Settings::setValue(Settings::Gui::ShowGenericClientFailureDialog, !enabled); + }); + + dialog.setCheckBox(cbNoShowAgain); + dialog.setDefaultButton(QMessageBox::Ok); + dialog.exec(); } NewClientPromptResult showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)