From 00cd258edd23c0e2f35593f87915b85eaff2d727 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 27 May 2024 22:40:11 +0800 Subject: [PATCH] Remove token related tasks from editlocallyjob Signed-off-by: Claudio Cambra --- src/gui/editlocallyjob.cpp | 13 +------------ src/gui/editlocallyjob.h | 4 ---- src/gui/editlocallymanager.cpp | 3 ++- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/gui/editlocallyjob.cpp b/src/gui/editlocallyjob.cpp index 1654d76ca5..94be3a27af 100644 --- a/src/gui/editlocallyjob.cpp +++ b/src/gui/editlocallyjob.cpp @@ -31,29 +31,24 @@ Q_LOGGING_CATEGORY(lcEditLocallyJob, "nextcloud.gui.editlocallyjob", QtInfoMsg) EditLocallyJob::EditLocallyJob(const AccountStatePtr &accountState, const QString &relPath, - const QString &token, QObject *parent) : QObject{parent} , _accountState(accountState) , _relPath(relPath) - , _token(token) { connect(this, &EditLocallyJob::callShowError, this, &EditLocallyJob::showError, Qt::QueuedConnection); } void EditLocallyJob::startSetup() { - if (_token.isEmpty() || _relPath.isEmpty() || !_accountState) { + if (_relPath.isEmpty() || !_accountState) { qCWarning(lcEditLocallyJob) << "Could not start setup." - << "token:" << _token << "relPath:" << _relPath << "accountState:" << _accountState; showError(tr("Could not start editing locally."), tr("An error occurred during setup.")); return; } - // Show the loading dialog but don't show the filename until we have - // verified the token Systray::instance()->createEditFileLocallyLoadingDialog({}); findAfolderAndConstructPaths(); } @@ -125,12 +120,6 @@ void EditLocallyJob::fetchRemoteFileParentInfo() void EditLocallyJob::proceedWithSetup() { - if (!_tokenVerified) { - qCWarning(lcEditLocallyJob) << "Could not proceed with setup as token is not verified."; - showError(tr("Could not validate the request to open a file from server."), tr("Please try again.")); - return; - } - 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); diff --git a/src/gui/editlocallyjob.h b/src/gui/editlocallyjob.h index 6a0aef0ee7..d1029376c2 100644 --- a/src/gui/editlocallyjob.h +++ b/src/gui/editlocallyjob.h @@ -34,7 +34,6 @@ class EditLocallyJob : public QObject public: explicit EditLocallyJob(const AccountStatePtr &accountState, const QString &relPath, - const QString &token, QObject *parent = nullptr); [[nodiscard]] static OCC::Folder *findFolderForFile(const QString &relPath, const QString &userId); @@ -86,15 +85,12 @@ private: [[nodiscard]] bool isFileParentItemValid() const; - bool _tokenVerified = false; - bool _shouldScheduleFolderSyncAfterFileIsOpened = false; AccountStatePtr _accountState; QString _relPath; // full remote path for a file (as on the server) QString _relativePathToRemoteRoot; // (relative path - Folder::remotePath()) for folders pointing to a non-root remote path e.g. '/subfolder' instead of '/' QString _relPathParent; // a folder where the file resides ('/' if it is in the first level of a remote root, or e.g. a '/subfolder/a/b/c if it resides in a nested folder) - QString _token; SyncFileItemPtr _fileParentItem; QString _fileName; diff --git a/src/gui/editlocallymanager.cpp b/src/gui/editlocallymanager.cpp index 69fc494e02..29de4fba2d 100644 --- a/src/gui/editlocallymanager.cpp +++ b/src/gui/editlocallymanager.cpp @@ -127,7 +127,8 @@ void EditLocallyManager::editLocally(const AccountStatePtr &accountState, if (_editLocallyJobs.contains(token)) { return; } - const EditLocallyJobPtr job(new EditLocallyJob(accountState, relPath, token)); + + const EditLocallyJobPtr job(new EditLocallyJob(accountState, relPath)); // We need to make sure the job sticks around until it is finished _editLocallyJobs.insert(token, job);