Consider isActiveFor() for process also when systemd unavailable
This commit is contained in:
parent
146d4870e4
commit
ce7a4421fa
|
@ -57,6 +57,10 @@ void SyncthingNotifier::handleStatusChangedEvent(SyncthingStatus newStatus)
|
||||||
m_previousStatus = newStatus;
|
m_previousStatus = newStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns whether a "disconnected" notification should be shown.
|
||||||
|
* \todo Unify with InternalError::isRelevant().
|
||||||
|
*/
|
||||||
bool SyncthingNotifier::isDisconnectRelevant() const
|
bool SyncthingNotifier::isDisconnectRelevant() const
|
||||||
{
|
{
|
||||||
// skip disconnect if not initialized
|
// skip disconnect if not initialized
|
||||||
|
@ -74,20 +78,28 @@ bool SyncthingNotifier::isDisconnectRelevant() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
|
const SyncthingService &service(syncthingService());
|
||||||
if (m_service.isManuallyStopped()) {
|
if (m_service.isManuallyStopped()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ignore inavailability after start or standby-wakeup
|
// ignore inavailability after start or standby-wakeup
|
||||||
if (m_ignoreInavailabilityAfterStart) {
|
if (m_ignoreInavailabilityAfterStart) {
|
||||||
if (m_process.isRunning() && !m_service.isActiveWithoutSleepFor(m_process.activeSince(), m_ignoreInavailabilityAfterStart)) {
|
if (m_process.isRunning()
|
||||||
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
|
&& ((m_service.isSystemdAvailable() && !service.isActiveWithoutSleepFor(m_process.activeSince(), m_ignoreInavailabilityAfterStart))
|
||||||
|
|| !m_process.isActiveFor(m_ignoreInavailabilityAfterStart))
|
||||||
|
#else
|
||||||
|
&& !m_process.isActiveFor(m_ignoreInavailabilityAfterStart)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_service.isRunning() && !m_service.isActiveWithoutSleepFor(m_ignoreInavailabilityAfterStart)) {
|
if (m_service.isRunning() && !m_service.isActiveWithoutSleepFor(m_ignoreInavailabilityAfterStart)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace QtGui {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns whether the error is relevant. Only in this case a notification for the error should be shown.
|
* \brief Returns whether the error is relevant. Only in this case a notification for the error should be shown.
|
||||||
|
* \todo Unify with SyncthingNotifier::isDisconnectRelevant().
|
||||||
*/
|
*/
|
||||||
bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingErrorCategory category, int networkError)
|
bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingErrorCategory category, int networkError)
|
||||||
{
|
{
|
||||||
|
@ -45,17 +46,24 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
|
||||||
if (settings.systemd.considerForReconnect && remoteHostClosed && service.isManuallyStopped()) {
|
if (settings.systemd.considerForReconnect && remoteHostClosed && service.isManuallyStopped()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ignore inavailability after start or standby-wakeup
|
// ignore inavailability after start or standby-wakeup
|
||||||
if (settings.ignoreInavailabilityAfterStart && networkError == QNetworkReply::ConnectionRefusedError) {
|
if (settings.ignoreInavailabilityAfterStart && networkError == QNetworkReply::ConnectionRefusedError) {
|
||||||
if (process.isRunning() && !service.isActiveWithoutSleepFor(process.activeSince(), settings.ignoreInavailabilityAfterStart)) {
|
if (process.isRunning()
|
||||||
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
|
&& ((service.isSystemdAvailable() && !service.isActiveWithoutSleepFor(process.activeSince(), settings.ignoreInavailabilityAfterStart))
|
||||||
|
|| !process.isActiveFor(settings.ignoreInavailabilityAfterStart))
|
||||||
|
#else
|
||||||
|
&& !process.isActiveFor(settings.ignoreInavailabilityAfterStart)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (service.isRunning() && !service.isActiveWithoutSleepFor(settings.ignoreInavailabilityAfterStart)) {
|
if (service.isRunning() && !service.isActiveWithoutSleepFor(settings.ignoreInavailabilityAfterStart)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="dbusRadioButton">
|
<widget class="QRadioButton" name="dbusRadioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>D-Bus notifi&cations (org.freedesktop.Notifications)</string>
|
<string>D-Bus &notifications (org.freedesktop.Notifications)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="ignoreInavailabilityAfterStartLabel">
|
<widget class="QLabel" name="ignoreInavailabilityAfterStartLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>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</string>
|
<string>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 started via Systemd or the internal launcher.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
Loading…
Reference in New Issue