Edit locally. Restart current folder sync immediately after file opened.
authoralex-z <blackslayer4@gmail.com>
Fri, 7 Apr 2023 15:37:50 +0000 (17:37 +0200)
committerallexzander <allexzander@users.noreply.github.com>
Tue, 11 Apr 2023 07:50:51 +0000 (09:50 +0200)
Signed-off-by: alex-z <blackslayer4@gmail.com>
src/gui/editlocallyjob.cpp
src/gui/editlocallyjob.h

index a95ad1375dca539edc615753edd47a526b66369a..cb652ba9468bebf56e48d66a5ce0f35b946fa0a8 100644 (file)
@@ -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();
     });
 }
index 582d5049fdff8ed266d8ff87f189e5ad07e5e56f..14ca52da6b827378bbca1e43d51a44d96865516e 100644 (file)
@@ -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)