Skip to content

Commit

Permalink
Fix review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Dec 12, 2022
1 parent 744709f commit fd896e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/gui/editlocallyjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,11 @@ void EditLocallyJob::startEditLocally()
if (_folderForFile->isSyncRunning()) {
// in case sync is already running - terminate it and start a new one
_syncTerminatedConnection = connect(_folderForFile, &Folder::syncFinished, this, [this]() {
_folderForFile->setSilenceErrors(false);
disconnect(_syncTerminatedConnection);
_syncTerminatedConnection = {};
startSyncBeforeOpening();
});
_folderForFile->setSilenceErrors(true);
_folderForFile->setSilenceErrorsUntilNextSync(true);
_folderForFile->slotTerminateSync();

return;
Expand Down
11 changes: 6 additions & 5 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void Folder::setSyncPaused(bool paused)

void Folder::setSyncState(SyncResult::Status state)
{
if (_silenceErrors && state == SyncResult::Error) {
if (_silenceErrorsUntilNextSync && state == SyncResult::Error) {
_syncResult.setStatus(SyncResult::Status::Success);
return;
}
Expand Down Expand Up @@ -836,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()) {
Expand Down Expand Up @@ -966,7 +967,7 @@ void Folder::setDirtyNetworkLimits()

void Folder::slotSyncError(const QString &message, ErrorCategory category)
{
if (!_silenceErrors) {
if (!_silenceErrorsUntilNextSync) {
_syncResult.appendErrorString(message);
emit ProgressDispatcher::instance()->syncError(alias(), message, category);
}
Expand Down Expand Up @@ -1004,7 +1005,7 @@ void Folder::slotSyncFinished(bool success)

if (syncError) {
_syncResult.setStatus(SyncResult::Error);
if (_silenceErrors) {
if (_silenceErrorsUntilNextSync) {
_syncResult.setStatus(SyncResult::Status::Success);
}
} else if (_syncResult.foundFilesNotSynced()) {
Expand Down Expand Up @@ -1160,9 +1161,9 @@ void Folder::slotNextSyncFullLocalDiscovery()
_timeSinceLastFullLocalDiscovery.invalidate();
}

void Folder::setSilenceErrors(bool silenceErrors)
void Folder::setSilenceErrorsUntilNextSync(bool silenceErrors)
{
_silenceErrors = silenceErrors;
_silenceErrorsUntilNextSync = silenceErrors;
}

void Folder::schedulePathForLocalDiscovery(const QString &relativePath)
Expand Down

0 comments on commit fd896e2

Please sign in to comment.