diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 2edd3c4c5ba8..9141aa7ced7b 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -1198,6 +1198,14 @@ void PropagateDownloadFile::downloadFinished() } } + if (_item->_locked == SyncFileItem::LockStatus::LockedItem && (_item->_lockOwnerType != SyncFileItem::LockOwnerType::UserLock || _item->_lockOwnerId != propagator()->account()->davUser())) { + qCDebug(lcPropagateDownload()) << "file is locked: making it read only"; + FileSystem::setFileReadOnly(filename, true); + } else { + qCDebug(lcPropagateDownload()) << "file is not locked: making it read write"; + FileSystem::setFileReadOnly(filename, (!_item->_remotePerm.isNull() && !_item->_remotePerm.hasPermission(RemotePermissions::CanWrite))); + } + // Apply the remote permissions FileSystem::setFileReadOnlyWeak(_tmpFile.fileName(), !_item->_remotePerm.isNull() && !_item->_remotePerm.hasPermission(RemotePermissions::CanWrite)); @@ -1262,12 +1270,6 @@ void PropagateDownloadFile::downloadFinished() return; } - qCInfo(lcPropagateDownload()) << propagator()->account()->davUser() << propagator()->account()->davDisplayName() << propagator()->account()->displayName(); - if (_item->_locked == SyncFileItem::LockStatus::LockedItem && (_item->_lockOwnerType != SyncFileItem::LockOwnerType::UserLock || _item->_lockOwnerId != propagator()->account()->davUser())) { - qCInfo(lcPropagateDownload()) << "file is locked: making it read only"; - FileSystem::setFileReadOnly(filename, true); - } - FileSystem::setFileHidden(filename, false); // Maybe we downloaded a newer version of the file than we thought we would... @@ -1346,6 +1348,14 @@ void PropagateDownloadFile::updateMetadata(bool isConflict) handleRecallFile(fn, propagator()->localPath(), *propagator()->_journal); } + if (_item->_locked == SyncFileItem::LockStatus::LockedItem && (_item->_lockOwnerType != SyncFileItem::LockOwnerType::UserLock || _item->_lockOwnerId != propagator()->account()->davUser())) { + qCDebug(lcPropagateDownload()) << "file is locked: making it read only"; + FileSystem::setFileReadOnly(fn, true); + } else { + qCDebug(lcPropagateDownload()) << "file is not locked: making it read write"; + FileSystem::setFileReadOnly(fn, (!_item->_remotePerm.isNull() && !_item->_remotePerm.hasPermission(RemotePermissions::CanWrite))); + } + qint64 duration = _stopwatch.elapsed(); if (isLikelyFinishedQuickly() && duration > 5 * 1000) { qCWarning(lcPropagateDownload) << "WARNING: Unexpectedly slow connection, took" << duration << "msec for" << _item->_size - _resumeStart << "bytes for" << _item->_file;