mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Merge pull request #5261 from nextcloud/feature/do-not-show-error-status-on-editlocally-abort
Silence sync termination errors when running EditLocallyJob.
This commit is contained in:
commit
73307a1161
3 changed files with 22 additions and 2 deletions
|
@ -450,6 +450,7 @@ void EditLocallyJob::startEditLocally()
|
|||
_syncTerminatedConnection = {};
|
||||
startSyncBeforeOpening();
|
||||
});
|
||||
_folderForFile->setSilenceErrorsUntilNextSync(true);
|
||||
_folderForFile->slotTerminateSync();
|
||||
|
||||
return;
|
||||
|
|
|
@ -308,6 +308,10 @@ void Folder::setSyncPaused(bool paused)
|
|||
|
||||
void Folder::setSyncState(SyncResult::Status state)
|
||||
{
|
||||
if (_silenceErrorsUntilNextSync && state == SyncResult::Error) {
|
||||
_syncResult.setStatus(SyncResult::Status::Success);
|
||||
return;
|
||||
}
|
||||
_syncResult.setStatus(state);
|
||||
}
|
||||
|
||||
|
@ -832,6 +836,7 @@ bool Folder::reloadExcludes()
|
|||
void Folder::startSync(const QStringList &pathList)
|
||||
{
|
||||
Q_UNUSED(pathList);
|
||||
setSilenceErrorsUntilNextSync(false);
|
||||
const auto singleItemDiscoveryOptions = _engine->singleItemDiscoveryOptions();
|
||||
Q_ASSERT(!singleItemDiscoveryOptions.discoveryDirItem || singleItemDiscoveryOptions.discoveryDirItem->isDirectory());
|
||||
if (singleItemDiscoveryOptions.discoveryDirItem && !singleItemDiscoveryOptions.discoveryDirItem->isDirectory()) {
|
||||
|
@ -962,8 +967,10 @@ void Folder::setDirtyNetworkLimits()
|
|||
|
||||
void Folder::slotSyncError(const QString &message, ErrorCategory category)
|
||||
{
|
||||
_syncResult.appendErrorString(message);
|
||||
emit ProgressDispatcher::instance()->syncError(alias(), message, category);
|
||||
if (!_silenceErrorsUntilNextSync) {
|
||||
_syncResult.appendErrorString(message);
|
||||
emit ProgressDispatcher::instance()->syncError(alias(), message, category);
|
||||
}
|
||||
}
|
||||
|
||||
void Folder::slotAddErrorToGui(SyncFileItem::Status status, const QString &errorMessage, const QString &subject)
|
||||
|
@ -998,6 +1005,9 @@ void Folder::slotSyncFinished(bool success)
|
|||
|
||||
if (syncError) {
|
||||
_syncResult.setStatus(SyncResult::Error);
|
||||
if (_silenceErrorsUntilNextSync) {
|
||||
_syncResult.setStatus(SyncResult::Status::Success);
|
||||
}
|
||||
} else if (_syncResult.foundFilesNotSynced()) {
|
||||
_syncResult.setStatus(SyncResult::Problem);
|
||||
} else if (_definition.paused) {
|
||||
|
@ -1151,6 +1161,11 @@ void Folder::slotNextSyncFullLocalDiscovery()
|
|||
_timeSinceLastFullLocalDiscovery.invalidate();
|
||||
}
|
||||
|
||||
void Folder::setSilenceErrorsUntilNextSync(bool silenceErrors)
|
||||
{
|
||||
_silenceErrorsUntilNextSync = silenceErrors;
|
||||
}
|
||||
|
||||
void Folder::schedulePathForLocalDiscovery(const QString &relativePath)
|
||||
{
|
||||
_localDiscoveryTracker->addTouchedPath(relativePath.toUtf8());
|
||||
|
|
|
@ -368,6 +368,8 @@ public slots:
|
|||
/** Ensures that the next sync performs a full local discovery. */
|
||||
void slotNextSyncFullLocalDiscovery();
|
||||
|
||||
void setSilenceErrorsUntilNextSync(bool silenceErrors);
|
||||
|
||||
private slots:
|
||||
void slotSyncStarted();
|
||||
void slotSyncFinished(bool);
|
||||
|
@ -506,6 +508,8 @@ private:
|
|||
*/
|
||||
bool _hasSwitchedToVfs = false;
|
||||
|
||||
bool _silenceErrorsUntilNextSync = false;
|
||||
|
||||
/**
|
||||
* Watches this folder's local directory for changes.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue