diff --git a/connector/syncthingservice.h b/connector/syncthingservice.h index 97ec39e..c0f2cfc 100644 --- a/connector/syncthingservice.h +++ b/connector/syncthingservice.h @@ -54,7 +54,7 @@ public: const QString &activeState() const; const QString &subState() const; ChronoUtilities::DateTime activeSince() const; - bool isActiveFor(unsigned int atleastSeconds) const; + bool isActiveFor(unsigned int atLeastSeconds) const; const QString &unitFileState() const; const QString &description() const; bool isRunning() const; @@ -171,9 +171,9 @@ inline ChronoUtilities::DateTime SyncthingService::activeSince() const return m_activeSince; } -inline bool SyncthingService::isActiveFor(unsigned int atleastSeconds) const +inline bool SyncthingService::isActiveFor(unsigned int atLeastSeconds) const { - return !m_activeSince.isNull() && (ChronoUtilities::DateTime::now() - m_activeSince).totalSeconds() > atleastSeconds; + return !m_activeSince.isNull() && (ChronoUtilities::DateTime::gmtNow() - m_activeSince).totalSeconds() > atLeastSeconds; } inline void SyncthingService::enable() diff --git a/connector/translations/syncthingconnector_de_DE.ts b/connector/translations/syncthingconnector_de_DE.ts index fd9c49d..ad63649 100644 --- a/connector/translations/syncthingconnector_de_DE.ts +++ b/connector/translations/syncthingconnector_de_DE.ts @@ -85,77 +85,77 @@ Fehler beim Abfragen des Syncthing-Status: - + Unable to parse connections: Fehler beim Auslesen der Verbindungen: - + Unable to request connections: Fehler beim Abfragen der Verbindungen: - + Unable to parse directory statistics: Fehler beim Auslesen der Verzeichnisstatistiken: - + Unable to request directory statistics: Fehler beim Abfragen der Verzeichnisstatistiken: - + Unable to parse device statistics: Fehler beim Auslesen der Gerätestatistiken: - + Unable to request device statistics: Fehler beim Abfragen der Gerätestatistiken: - + Unable to parse errors: Fehler beim Auslesen der Syncthing-Fehlermeldungen: - + Unable to request errors: Fehler beim Abfragen der Syncthing-Fehlermeldungen: - + Unable to request clearing errors: - + Unable to parse Syncthing events: Fehler beim Auslesen der Syncthing-Ereignisse: - + Unable to request Syncthing events: Fehler beim Abfragen der Syncthing-Ereignisse: - + Unable to request rescan: Fehler beim Anfordern eines Verzeichnis-Rescans: - + Unable to request pause/resume: Fehler beim Anfordern Gerät zu Pausieren/Fortzusetzen: - + Unable to request restart: Fehler beim Anfordern eines Neustarts: - + Unable to request shutdown: Fehler beim Anfordern Syncthing zu beenden: diff --git a/connector/translations/syncthingconnector_en_US.ts b/connector/translations/syncthingconnector_en_US.ts index 9724ba1..83b3a0a 100644 --- a/connector/translations/syncthingconnector_en_US.ts +++ b/connector/translations/syncthingconnector_en_US.ts @@ -85,77 +85,77 @@ - + Unable to parse connections: - + Unable to request connections: - + Unable to parse directory statistics: - + Unable to request directory statistics: - + Unable to parse device statistics: - + Unable to request device statistics: - + Unable to parse errors: - + Unable to request errors: - + Unable to request clearing errors: - + Unable to parse Syncthing events: - + Unable to request Syncthing events: - + Unable to request rescan: - + Unable to request pause/resume: - + Unable to request restart: - + Unable to request shutdown: diff --git a/tray/application/settings.cpp b/tray/application/settings.cpp index d1d2b18..6736a94 100644 --- a/tray/application/settings.cpp +++ b/tray/application/settings.cpp @@ -84,6 +84,7 @@ void restore() #ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS v.dbusNotifications = settings.value(QStringLiteral("dbusNotifications"), DBusNotification::isAvailable()).toBool(); #endif + v.ignoreInavailabilityAfterStart = settings.value(QStringLiteral("ignoreInavailabilityAfterStart"), v.ignoreInavailabilityAfterStart).toUInt(); auto &appearance = v.appearance; appearance.showTraffic = settings.value(QStringLiteral("showTraffic"), appearance.showTraffic).toBool(); appearance.trayMenuSize = settings.value(QStringLiteral("trayMenuSize"), appearance.trayMenuSize).toSize(); @@ -153,6 +154,7 @@ void save() #ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS settings.setValue(QStringLiteral("dbusNotifications"), v.dbusNotifications); #endif + settings.setValue(QStringLiteral("ignoreInavailabilityAfterStart"), v.ignoreInavailabilityAfterStart); const auto &appearance = v.appearance; settings.setValue(QStringLiteral("showTraffic"), appearance.showTraffic); settings.setValue(QStringLiteral("trayMenuSize"), appearance.trayMenuSize); diff --git a/tray/application/settings.h b/tray/application/settings.h index 7aeb6ff..b5dab3d 100644 --- a/tray/application/settings.h +++ b/tray/application/settings.h @@ -89,6 +89,7 @@ struct Settings #ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS bool dbusNotifications = false; #endif + unsigned int ignoreInavailabilityAfterStart = 15; Appearance appearance; Launcher launcher; #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD diff --git a/tray/gui/notificationsoptionpage.ui b/tray/gui/notificationsoptionpage.ui index eef8c9f..0e3bccc 100644 --- a/tray/gui/notificationsoptionpage.ui +++ b/tray/gui/notificationsoptionpage.ui @@ -70,6 +70,35 @@ + + + + Misc + + + + + + Ignore inavailability of Syncthing the specified number of seconds after Syncthing has been started; has only effect if the Syncthing start can be determined which is currently only supported for the local instance by checking Systemd unit status + + + true + + + + + + + don't ignore + + + s + + + + + + diff --git a/tray/gui/settingsdialog.cpp b/tray/gui/settingsdialog.cpp index 1c3e7ca..a60d788 100644 --- a/tray/gui/settingsdialog.cpp +++ b/tray/gui/settingsdialog.cpp @@ -268,6 +268,8 @@ bool NotificationsOptionPage::apply() ok = false; } #endif + values().ignoreInavailabilityAfterStart = static_cast(ui()->ignoreInavailabilityAfterStartSpinBox->value()); + } return ok; } @@ -286,6 +288,7 @@ void NotificationsOptionPage::reset() ui()->dbusRadioButton->setEnabled(false); ui()->qtRadioButton->setChecked(true); #endif + ui()->ignoreInavailabilityAfterStartSpinBox->setValue(static_cast(values().ignoreInavailabilityAfterStart)); } } diff --git a/tray/gui/trayicon.cpp b/tray/gui/trayicon.cpp index 32752f2..da8f5cd 100644 --- a/tray/gui/trayicon.cpp +++ b/tray/gui/trayicon.cpp @@ -6,6 +6,7 @@ #include "../../connector/syncthingconnection.h" #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD # include "../../connector/syncthingservice.h" +# include "../../connector/utils.h" #endif #include @@ -134,10 +135,16 @@ void TrayIcon::handleSyncthingNotificationAction(const QString &action) void TrayIcon::showInternalError(const QString &errorMsg, SyncthingErrorCategory category, int networkError) { const auto &settings = Settings::values(); +#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD + const SyncthingService &service = syncthingService(); + const bool serviceRelevant = service.isSystemdAvailable() && isLocal(QUrl(m_trayMenu.widget()->connection().syncthingUrl())); +#endif if(settings.notifyOn.internalErrors && (m_trayMenu.widget()->connection().autoReconnectTries() < 1 || category != SyncthingErrorCategory::OverallConnection) #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD - && (networkError != QNetworkReply::RemoteHostClosedError || !syncthingService().isManuallyStopped()) + && (!settings.systemd.considerForReconnect || !serviceRelevant || !(networkError == QNetworkReply::RemoteHostClosedError && service.isManuallyStopped())) + && (settings.ignoreInavailabilityAfterStart == 0 + || !(networkError == QNetworkReply::ConnectionRefusedError && service.isRunning() && !service.isActiveFor(settings.ignoreInavailabilityAfterStart))) #endif ) { #ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS diff --git a/tray/translations/syncthingtray_de_DE.ts b/tray/translations/syncthingtray_de_DE.ts index 700aaae..4bdf545 100644 --- a/tray/translations/syncthingtray_de_DE.ts +++ b/tray/translations/syncthingtray_de_DE.ts @@ -127,22 +127,22 @@ Tray-Icon beim Starten der Desktopumgebung automatisch starten - + This is achieved by adding a *.desktop file under <i>~/.config/autostart</i> so the setting only affects the current user. Durch das Hinzufügen einer *.desktop-Datei unter <i>~/.config/autostart</i> realisiert - betrifft also nur den aktuellen Benutzer. - + This is achieved by adding a registry key under <i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</i> so the setting only affects the current user. Note that the startup entry is invalidated when moving <i>syncthingtray.exe</i>. Durch das Hinzufügen eines Registry-Schlüssels unter <i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</i> realisiert - betrifft also nur den aktuellen Benutzer. - + This feature has not been implemented for your platform (yet). Diese Funktion wurde für die aktuelle Plattform nicht nicht implementiert. - + unable to modify startup entry Fehler beim aktualisieren des Auto-Start-Eintrags @@ -390,13 +390,13 @@ Log folgen - + Syncthing exited with exit code %1 Syncthing wurde mit dem Statuscode %1 beendet - + Syncthing crashed with exit code %1 Syncthing ist mit dem Statuscode %1 abgestürzt @@ -449,6 +449,26 @@ &Method provided by Qt (might be overridden by QPA plugin) Methode die von Qt verwendet wird (kann vom QPA-Plugin überschrieben werden) + + + Misc + Verschiedenes + + + + Ignore inavailability of Syncthing the specified number of seconds after Syncthing has been started; has only effect if the Syncthing start can be determined which is currently only supported for the local instance by checking Systemd unit status + Ignoriere, dass Syncthing ein paar Sekunden nach dem Start noch nicht verfügbar ist. Hat nur Auswirkungen, wenn der Syncthing-Startzeitpunkt ermittelt werden kann, was aktuell nur für die lokale Instanz via Systemd unterstützt wird. + + + + don't ignore + nicht ignorieren + + + + s + + Configured to use D-Bus notifications but D-Bus notification daemon seems unavailabe. @@ -458,22 +478,22 @@ QtGui::SettingsDialog - + Tray - + Web view Weboberfläche - + Startup Starten - + Settings Einstellungen @@ -514,8 +534,8 @@ - - + + unknown unbekannt @@ -549,12 +569,12 @@ Stoppen - + specified unit is either inactive or doesn't exist angegebene Unit ist entweder nicht geladen oder existiert nicht - + since seit @@ -562,133 +582,133 @@ QtGui::TrayIcon - + - internal error - interner Fehler - + Syncthing notification Syncthing-Benachrichtigung - + Web UI Weboberfäche - + Settings Einstellungen - + Rescan all Alle neu scannen - + About Über Syncthing Tray - + Close Beenden - + Error Fehler - + Syncthing notification - click to dismiss Neue Syncthing-Benachrichtigung - + Not connected to Syncthing - trying to reconnect every %1 ms Nicht mit Syncthing verbunden - versuche alle %1 ms zu verbinden - + Not connected to Syncthing Nicht mit Syncthing verbunden - - + + Disconnected from Syncthing Verbindung zu Syncthing getrennt - + Log - + Try to reconnect Versuche Verbindung wieder herzustellen - + Dismiss Ignorieren - + Show Zeigen - + Reconnecting ... Neu verbinden ... - + Synchronization is ongoing but at least one directory is out of sync Synchronisiert, aber mind. ein Verzeichnis hat Fehler - + At least one directory is out of sync Mind. ein Verzeichnis hat Fehler - + Notifications available Es gibt neue Benachrichtigungen - + Syncthing is idling Syncthing ist im Leerlauf - + Syncthing is scanning Syncthing scannt - + At least one device is paused Mind. ein Gerät ist pausiert - + Synchronization is ongoing Syncthing synchronisiert - + Synchronization of %1 complete %1 wurde synchronisiert - + Synchronization of the following devices complete: Folgende Verzeichnisse wurden synchronisiert: @@ -721,7 +741,7 @@ - + Start Starten @@ -892,7 +912,7 @@ For <i>all</i> notifications, checkout the log Die Datei <i>%1</i> existiert nicht (lokal). - + Stop Stoppen @@ -909,7 +929,7 @@ For <i>all</i> notifications, checkout the log QtGui::WebViewOptionPage - + General Allgemein @@ -939,7 +959,7 @@ For <i>all</i> notifications, checkout the log Lasse Weboberfläche im Hintgergrund weiter offen, wenn Fenster nicht offen - + Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit or Qt WebEngine. The Web UI will be opened in the default web browser instead. Syncthing Tray wurde nicht mit Unterstützung für die eingebaute Anzeige der Weboberfläche unter Verwendung von Qt WebKit oder Qt WebEngine gebaut. diff --git a/tray/translations/syncthingtray_en_US.ts b/tray/translations/syncthingtray_en_US.ts index 693562f..bc57e03 100644 --- a/tray/translations/syncthingtray_en_US.ts +++ b/tray/translations/syncthingtray_en_US.ts @@ -127,22 +127,22 @@ - + This is achieved by adding a *.desktop file under <i>~/.config/autostart</i> so the setting only affects the current user. - + This is achieved by adding a registry key under <i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</i> so the setting only affects the current user. Note that the startup entry is invalidated when moving <i>syncthingtray.exe</i>. - + This feature has not been implemented for your platform (yet). - + unable to modify startup entry @@ -390,13 +390,13 @@ - + Syncthing exited with exit code %1 - + Syncthing crashed with exit code %1 @@ -449,6 +449,26 @@ &Method provided by Qt (might be overridden by QPA plugin) + + + Misc + + + + + Ignore inavailability of Syncthing the specified number of seconds after Syncthing has been started; has only effect if the Syncthing start can be determined which is currently only supported for the local instance by checking Systemd unit status + + + + + don't ignore + + + + + s + + Configured to use D-Bus notifications but D-Bus notification daemon seems unavailabe. @@ -458,22 +478,22 @@ QtGui::SettingsDialog - + Tray - + Web view - + Startup - + Settings @@ -514,8 +534,8 @@ - - + + unknown @@ -547,12 +567,12 @@ - + specified unit is either inactive or doesn't exist - + since @@ -560,133 +580,133 @@ QtGui::TrayIcon - + - internal error - + Syncthing notification - + Web UI - + Settings - + Rescan all - + About - + Close - + Error - + Syncthing notification - click to dismiss - + Not connected to Syncthing - trying to reconnect every %1 ms - + Not connected to Syncthing - - + + Disconnected from Syncthing - + Log - + Try to reconnect - + Dismiss - + Show - + Reconnecting ... - + Synchronization is ongoing but at least one directory is out of sync - + At least one directory is out of sync - + Notifications available - + Syncthing is idling - + Syncthing is scanning - + At least one device is paused - + Synchronization is ongoing - + Synchronization of %1 complete - + Synchronization of the following devices complete: @@ -718,7 +738,7 @@ - + Start @@ -888,7 +908,7 @@ For <i>all</i> notifications, checkout the log - + Stop @@ -905,7 +925,7 @@ For <i>all</i> notifications, checkout the log QtGui::WebViewOptionPage - + General @@ -935,7 +955,7 @@ For <i>all</i> notifications, checkout the log - + Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit or Qt WebEngine. The Web UI will be opened in the default web browser instead.