Show edit locally loading dialog with filename immediately in editlocallyjob constructor
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 27 May 2024 14:45:20 +0000 (22:45 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 22 Jul 2024 11:51:38 +0000 (19:51 +0800)
By the time we launch this job we ahve already finished verifying the
token after recent changes

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/editlocallyjob.cpp

index 94be3a27afa8ac34b0a3e9b0c75ae81359ac8a01..7ec6b32532dc869fd335b7a570bf5063469e07bb 100644 (file)
@@ -19,7 +19,6 @@
 #include <QtConcurrent>
 
 #include "editlocallymanager.h"
-#include "editlocallyverificationjob.h"
 #include "folder.h"
 #include "folderman.h"
 #include "syncengine.h"
@@ -49,7 +48,15 @@ void EditLocallyJob::startSetup()
         return;
     }
 
-    Systray::instance()->createEditFileLocallyLoadingDialog({});
+    const auto relPathSplit = _relPath.split(QLatin1Char('/'));
+    if (relPathSplit.isEmpty()) {
+        showError(tr("Could not find a file for local editing."
+                     "Make sure its path is valid and it is synced locally."), _relPath);
+        return;
+    }
+
+    _fileName = relPathSplit.last();
+    Systray::instance()->createEditFileLocallyLoadingDialog(_fileName);
     findAfolderAndConstructPaths();
 }
 
@@ -120,15 +127,8 @@ void EditLocallyJob::fetchRemoteFileParentInfo()
 
 void EditLocallyJob::proceedWithSetup()
 {
-    const auto relPathSplit = _relPath.split(QLatin1Char('/'));
-    if (relPathSplit.isEmpty()) {
-        showError(tr("Could not find a file for local editing. Make sure its path is valid and it is synced locally."), _relPath);
-        return;
-    }
-
-    _fileName = relPathSplit.last();
     _folderForFile = findFolderForFile(_relPath, _accountState->account()->userIdAtHostWithPort());
-
+    
     if (!_folderForFile) {
         showError(tr("Could not find a file for local editing. Make sure it is not excluded via selective sync."), _relPath);
         return;
@@ -141,7 +141,6 @@ void EditLocallyJob::proceedWithSetup()
 
     _localFilePath = _folderForFile->path() + _relativePathToRemoteRoot;
 
-    Systray::instance()->destroyEditFileLocallyLoadingDialog();
     startEditLocally();
 }
 
@@ -325,8 +324,6 @@ void EditLocallyJob::startEditLocally()
         return;
     }
 
-    Systray::instance()->createEditFileLocallyLoadingDialog(_fileName);
-
     if (_folderForFile->isSyncRunning()) {
         // in case sync is already running - terminate it and start a new one
         _syncTerminatedConnection = connect(_folderForFile, &Folder::syncFinished, this, [this]() {