Parcourir la source

Merge pull request #5588 from nextcloud/feature/restart-folder-sync

Edit locally. Restart current folder sync immediately after file opened.
allexzander il y a 2 ans
Parent
commit
663b0d9c37
2 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 8 0
      src/gui/editlocallyjob.cpp
  2. 2 0
      src/gui/editlocallyjob.h

+ 8 - 0
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();
     });
 }

+ 2 - 0
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)