From 54c13a560d9c093f122e543a8a6af08d2aeb71d7 Mon Sep 17 00:00:00 2001 From: alex-z Date: Fri, 7 Apr 2023 17:37:50 +0200 Subject: [PATCH] Edit locally. Restart current folder sync immediately after file opened. Signed-off-by: alex-z --- src/gui/editlocallyjob.cpp | 8 ++++++++ src/gui/editlocallyjob.h | 2 ++ 2 files changed, 10 insertions(+) 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)