Add internal errors to menu/dialog even if the notification is disabled

This commit is contained in:
Martchus 2022-05-04 00:24:26 +02:00
parent 2f861fed5a
commit be9d963a82
3 changed files with 16 additions and 17 deletions

View File

@ -496,9 +496,11 @@ void SyncthingApplet::handleInternalError(
if (!InternalError::isRelevant(m_connection, category, networkError)) {
return;
}
InternalError error(errorMsg, request.url(), response);
m_dbusNotifier.showInternalError(error);
InternalErrorsDialog::addError(move(error));
auto error = InternalError(errorMsg, request.url(), response);
if (Settings::values().notifyOn.internalErrors) {
m_dbusNotifier.showInternalError(error);
}
InternalErrorsDialog::addError(std::move(error));
if (!m_hasInternalErrors) {
emit hasInternalErrorsChanged(m_hasInternalErrors = true);
}

View File

@ -202,17 +202,19 @@ void TrayIcon::showInternalError(
if (!InternalError::isRelevant(trayMenu().widget().connection(), category, networkError)) {
return;
}
InternalError error(errorMessage, request.url(), response);
auto error = InternalError(errorMessage, request.url(), response);
if (Settings::values().notifyOn.internalErrors) {
#ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS
if (m_dbusNotificationsEnabled) {
m_dbusNotifier.showInternalError(error);
} else
if (m_dbusNotificationsEnabled) {
m_dbusNotifier.showInternalError(error);
} else
#endif
{
m_messageClickedAction = TrayIconMessageClickedAction::ShowInternalErrors;
showMessage(tr("Error"), errorMessage, QSystemTrayIcon::Critical);
{
m_messageClickedAction = TrayIconMessageClickedAction::ShowInternalErrors;
showMessage(tr("Error"), errorMessage, QSystemTrayIcon::Critical);
}
}
InternalErrorsDialog::addError(move(error));
InternalErrorsDialog::addError(std::move(error));
#ifdef SYNCTHINGTRAY_UNIFY_TRAY_MENUS
trayMenu().widget().showInternalErrorsButton();
#else

View File

@ -23,12 +23,6 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
return false;
}
// ignore errors when disabled in settings
const auto &settings = Settings::values();
if (!settings.notifyOn.internalErrors) {
return false;
}
// skip further considerations if connection is remote
if (!connection.isLocal()) {
return true;
@ -38,6 +32,7 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
const auto remoteHostClosed(networkError == QNetworkReply::RemoteHostClosedError || networkError == QNetworkReply::ProxyConnectionClosedError);
// ignore "remote host closed" error if we've just stopped Syncthing ourselves
const auto *launcher(SyncthingLauncher::mainInstance());
const auto &settings = Settings::values();
if (settings.launcher.considerForReconnect && remoteHostClosed && launcher && launcher->isManuallyStopped()) {
return false;
}