Track "SubState" of systemd service correctly

Due to short-circuing the previous code might not have taken a
changed "SubState" into account. This change should fix it and
therefore might fix
https://github.com/Martchus/syncthingtray/issues/179.
This commit is contained in:
Martchus 2023-04-03 19:19:45 +02:00
parent 76209e2922
commit 0f6ea4f88e
1 changed files with 6 additions and 5 deletions

View File

@ -484,11 +484,12 @@ void SyncthingService::handlePropertiesChanged(
#endif
handlePropertyChanged(m_activeSince, QStringLiteral("ActiveEnterTimestamp"), changedProperties, invalidatedProperties);
const bool wasRunningBefore = isRunning();
if (handlePropertyChanged(
m_activeState, &SyncthingService::activeStateChanged, QStringLiteral("ActiveState"), changedProperties, invalidatedProperties)
|| handlePropertyChanged(
m_subState, &SyncthingService::subStateChanged, QStringLiteral("SubState"), changedProperties, invalidatedProperties)) {
const auto wasRunningBefore = isRunning();
const auto activeStateChanged = handlePropertyChanged(
m_activeState, &SyncthingService::activeStateChanged, QStringLiteral("ActiveState"), changedProperties, invalidatedProperties);
const auto subStateChanged
= handlePropertyChanged(m_subState, &SyncthingService::subStateChanged, QStringLiteral("SubState"), changedProperties, invalidatedProperties);
if (activeStateChanged || subStateChanged) {
emit stateChanged(m_activeState, m_subState, m_activeSince);
}
const bool currentlyRunning = isRunning();