feat: Allow suppression of generic client connection dialog
fixes 8907
This commit is contained in:
parent
f0e02724ee
commit
9cf25c4caf
3 changed files with 27 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ QVariant Settings::defaultValue(const QString &key)
|
||||||
|
|
||||||
if ((key == Gui::CloseToTray) || (key == Gui::LogExpanded) || (key == Gui::SymbolicTrayIcon) ||
|
if ((key == Gui::CloseToTray) || (key == Gui::LogExpanded) || (key == Gui::SymbolicTrayIcon) ||
|
||||||
(key == Gui::CloseReminder) || (key == Security::TlsEnabled) || (key == Security::CheckPeers) ||
|
(key == Gui::CloseReminder) || (key == Security::TlsEnabled) || (key == Security::CheckPeers) ||
|
||||||
(key == Client::LanguageSync)) {
|
(key == Client::LanguageSync) || (key == Gui::ShowGenericClientFailureDialog)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ public:
|
||||||
inline static const auto LogExpanded = QStringLiteral("gui/logExpanded");
|
inline static const auto LogExpanded = QStringLiteral("gui/logExpanded");
|
||||||
inline static const auto SymbolicTrayIcon = QStringLiteral("gui/symbolicTrayIcon");
|
inline static const auto SymbolicTrayIcon = QStringLiteral("gui/symbolicTrayIcon");
|
||||||
inline static const auto WindowGeometry = QStringLiteral("gui/windowGeometry");
|
inline static const auto WindowGeometry = QStringLiteral("gui/windowGeometry");
|
||||||
|
inline static const auto ShowGenericClientFailureDialog = QStringLiteral("gui/showGenericClientFailureDialog");
|
||||||
};
|
};
|
||||||
struct Log
|
struct Log
|
||||||
{
|
{
|
||||||
|
|
@ -185,6 +186,7 @@ private:
|
||||||
, Settings::Gui::LogExpanded
|
, Settings::Gui::LogExpanded
|
||||||
, Settings::Gui::SymbolicTrayIcon
|
, Settings::Gui::SymbolicTrayIcon
|
||||||
, Settings::Gui::WindowGeometry
|
, Settings::Gui::WindowGeometry
|
||||||
|
, Settings::Gui::ShowGenericClientFailureDialog
|
||||||
, Settings::Security::Certificate
|
, Settings::Security::Certificate
|
||||||
, Settings::Security::CheckPeers
|
, Settings::Security::CheckPeers
|
||||||
, Settings::Security::KeySize
|
, Settings::Security::KeySize
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "common/Settings.h"
|
#include "common/Settings.h"
|
||||||
#include "common/UrlConstants.h"
|
#include "common/UrlConstants.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
@ -213,7 +214,29 @@ void showClientConnectError(QWidget *parent, ClientError error, const QString &a
|
||||||
|
|
||||||
auto title = QObject::tr("%1 Connection Error").arg(kAppName);
|
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)
|
NewClientPromptResult showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue