diff --git a/src/gui/editlocallyjob.cpp b/src/gui/editlocallyjob.cpp index a95ad1375..cb652ba94 100644 --- a/src/gui/editlocallyjob.cpp +++ b/src/gui/editlocallyjob.cpp @@ -452,6 +452,7 @@ void EditLocallyJob::startEditLocally() }); _folderForFile->setSilenceErrorsUntilNextSync(true); _folderForFile->slotTerminateSync(); + _shouldScheduleFolderSyncAfterFileIsOpened = true; return; } @@ -538,6 +539,8 @@ void EditLocallyJob::slotItemDiscovered(const OCC::SyncFileItemPtr &item) void EditLocallyJob::openFile() { + Q_ASSERT(_folderForFile); + if(_localFilePath.isEmpty()) { qCWarning(lcEditLocallyJob) << "Could not edit locally. Invalid local file path."; return; @@ -553,6 +556,11 @@ void EditLocallyJob::openFile() } Systray::instance()->destroyEditFileLocallyLoadingDialog(); + + if (_shouldScheduleFolderSyncAfterFileIsOpened) { + _folderForFile->startSync(); + } + emit finished(); }); } diff --git a/src/gui/editlocallyjob.h b/src/gui/editlocallyjob.h index 582d5049f..14ca52da6 100644 --- a/src/gui/editlocallyjob.h +++ b/src/gui/editlocallyjob.h @@ -92,6 +92,8 @@ private: bool _tokenVerified = false; + bool _shouldScheduleFolderSyncAfterFileIsOpened = false; + AccountStatePtr _accountState; QString _userId; QString _relPath; // full remote path for a file (as on the server)