Clear Syncthing errors when considering read
This commit is contained in:
parent
f03af9c3cb
commit
ac0492d890
|
@ -547,6 +547,16 @@ void SyncthingConnection::requestErrors()
|
|||
QObject::connect(m_errorsReply = requestData(QStringLiteral("system/error"), QUrlQuery()), &QNetworkReply::finished, this, &SyncthingConnection::readErrors);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Requests clearing errors asynchronously.
|
||||
*
|
||||
* The signal error() is emitted in the error case.
|
||||
*/
|
||||
void SyncthingConnection::requestClearingErrors()
|
||||
{
|
||||
QObject::connect(m_errorsReply = postData(QStringLiteral("system/error/clear"), QUrlQuery()), &QNetworkReply::finished, this, &SyncthingConnection::readClearingErrors);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Requests directory statistics asynchronously.
|
||||
*/
|
||||
|
@ -1097,6 +1107,22 @@ void SyncthingConnection::readErrors()
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Reads results of requestClearingErrors().
|
||||
*/
|
||||
void SyncthingConnection::readClearingErrors()
|
||||
{
|
||||
auto *reply = static_cast<QNetworkReply *>(sender());
|
||||
reply->deleteLater();
|
||||
|
||||
switch(reply->error()) {
|
||||
case QNetworkReply::NoError:
|
||||
break;
|
||||
default:
|
||||
emit error(tr("Unable to request clearing errors: ") + reply->errorString(), SyncthingErrorCategory::SpecificRequest, reply->error());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Reads results of requestEvents().
|
||||
*/
|
||||
|
|
|
@ -153,6 +153,7 @@ private Q_SLOTS:
|
|||
void requestStatus();
|
||||
void requestConnections();
|
||||
void requestErrors();
|
||||
void requestClearingErrors();
|
||||
void requestDirStatistics();
|
||||
void requestDeviceStatistics();
|
||||
void requestEvents();
|
||||
|
@ -166,6 +167,7 @@ private Q_SLOTS:
|
|||
void readDirStatistics();
|
||||
void readDeviceStatistics();
|
||||
void readErrors();
|
||||
void readClearingErrors();
|
||||
void readEvents();
|
||||
void readStartingEvent(const QJsonObject &eventData);
|
||||
void readStatusChangedEvent(ChronoUtilities::DateTime eventTime, const QJsonObject &eventData);
|
||||
|
@ -317,6 +319,7 @@ inline bool SyncthingConnection::hasUnreadNotifications() const
|
|||
inline void SyncthingConnection::considerAllNotificationsRead()
|
||||
{
|
||||
m_unreadNotifications = false;
|
||||
requestClearingErrors();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue