From: Claudio Cambra Date: Mon, 5 Dec 2022 20:22:08 +0000 (+0100) Subject: Ensure we are checking lock state once file has been synced after setting lock X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~88^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3f20f192e9d7cbc202f2b35dc60cef53f3f99ce5;p=nextcloud-desktop.git Ensure we are checking lock state once file has been synced after setting lock Signed-off-by: Claudio Cambra --- diff --git a/src/gui/editlocallyjob.cpp b/src/gui/editlocallyjob.cpp index 489b027ed..a248c6b50 100644 --- a/src/gui/editlocallyjob.cpp +++ b/src/gui/editlocallyjob.cpp @@ -566,22 +566,23 @@ void EditLocallyJob::lockFile() return; } - _folderConnections.append(connect(_accountState->account().data(), &Account::lockFileSuccess, - this, [this] { - _folderForFile->journalDb()->schedulePathForRemoteDiscovery(_relPath); - _folderForFile->scheduleThisFolderSoon(); - })); - _folderConnections.append(connect(_folderForFile, &Folder::syncFinished, - this, [this](const OCC::SyncResult &result) { - Q_UNUSED(result) - fileLockSuccess(); + _folderForFile->setSyncPaused(true); + + _folderConnections.append(connect(&_folderForFile->syncEngine(), &SyncEngine::itemCompleted, + this, [this](const SyncFileItemPtr &item) { + if (item->_file == _relPath && item->_locked == SyncFileItem::LockStatus::LockedItem) { + fileLockSuccess(); + } })); + _folderConnections.append(connect(_accountState->account().data(), &Account::lockFileError, this, &EditLocallyJob::fileLockError)); _folderForFile->accountState()->account()->setLockFileState(_relPath, _folderForFile->journalDb(), SyncFileItem::LockStatus::LockedItem); + _folderForFile->journalDb()->schedulePathForRemoteDiscovery(_relPath); + FolderMan::instance()->forceSyncForFolder(_folderForFile); } void EditLocallyJob::disconnectFolderSignals()