diff --git a/CMakeLists.txt b/CMakeLists.txt index 31195aa..ce19ea8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(META_VERSION_MAJOR 1) set(META_VERSION_MINOR 4) set(META_VERSION_PATCH 6) set(META_RELEASE_DATE "2023-08-09") -set(META_SOVERSION 8) +set(META_SOVERSION 9) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) project(${META_PROJECT_NAME}) diff --git a/syncthingconnector/syncthingconnection_requests.cpp b/syncthingconnector/syncthingconnection_requests.cpp index e9fba89..165b495 100644 --- a/syncthingconnector/syncthingconnection_requests.cpp +++ b/syncthingconnector/syncthingconnection_requests.cpp @@ -2001,12 +2001,15 @@ void SyncthingConnection::readDeviceEvent(SyncthingEventId eventId, DateTime eve } // distinguish specific events - SyncthingDevStatus status = devInfo->status; - bool paused = devInfo->paused; + auto status = devInfo->status; + auto paused = devInfo->paused; + auto disconnectReason = devInfo->disconnectReason; if (eventType == QLatin1String("DeviceConnected")) { status = devInfo->computeConnectedStateAccordingToCompletion(); + disconnectReason.clear(); } else if (eventType == QLatin1String("DeviceDisconnected")) { status = SyncthingDevStatus::Disconnected; + disconnectReason = eventData.value(QLatin1String("error")).toString(); } else if (eventType == QLatin1String("DevicePaused")) { paused = true; } else if (eventType == QLatin1String("DeviceRejected")) { @@ -2020,11 +2023,12 @@ void SyncthingConnection::readDeviceEvent(SyncthingEventId eventId, DateTime eve } // assign new status - if (devInfo->status != status || devInfo->paused != paused) { + if (devInfo->status != status || devInfo->paused != paused || devInfo->disconnectReason != disconnectReason) { // don't mess with the status of the own device if (devInfo->status != SyncthingDevStatus::OwnDevice) { devInfo->status = status; devInfo->paused = paused; + devInfo->disconnectReason = disconnectReason; } emit devStatusChanged(*devInfo, index); } diff --git a/syncthingconnector/syncthingdev.h b/syncthingconnector/syncthingdev.h index 56f5a96..26deb95 100644 --- a/syncthingconnector/syncthingdev.h +++ b/syncthingconnector/syncthingdev.h @@ -50,6 +50,7 @@ struct LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingDev { QString connectionAddress; QString connectionType; QString clientVersion; + QString disconnectReason; CppUtilities::DateTime lastSeen; std::unordered_map completionByDir; SyncthingCompletion overallCompletion;