diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-07-27 10:24:30 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-07-29 15:41:16 +0300 |
commit | 1be763213f6aa3a5f3bfc4819e7076439955c8fe (patch) | |
tree | 5fac2e5bdc27953938b29b8eeff60ab61318e7a4 /src | |
parent | a769b15220b11454507c46ffa6ce7e14db26465a (diff) |
Simplify api
Diffstat (limited to 'src')
-rw-r--r-- | src/common/vfs.h | 4 | ||||
-rw-r--r-- | src/libsync/discovery.cpp | 2 | ||||
-rw-r--r-- | src/libsync/owncloudpropagator.cpp | 10 | ||||
-rw-r--r-- | src/libsync/owncloudpropagator.h | 2 | ||||
-rw-r--r-- | src/libsync/propagatedownload.cpp | 2 | ||||
-rw-r--r-- | src/libsync/vfs/suffix/vfs_suffix.cpp | 2 | ||||
-rw-r--r-- | src/libsync/vfs/suffix/vfs_suffix.h | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/src/common/vfs.h b/src/common/vfs.h index e3d0b4cdb..84e95e55f 100644 --- a/src/common/vfs.h +++ b/src/common/vfs.h @@ -238,7 +238,7 @@ protected: * If the remote metadata changes, the local placeholder's metadata should possibly * change as well. */ - virtual OC_REQUIRED_RESULT Result<ConvertToPlaceholderResult, QString> updateMetadata(const QString &filePath, const SyncFileItem &item, const QString &replacesFile = {}) = 0; + virtual OC_REQUIRED_RESULT Result<ConvertToPlaceholderResult, QString> updateMetadata(const SyncFileItem &item, const QString &filePath, const QString &replacesFile) = 0; /** Setup the plugin for the folder. * @@ -296,7 +296,7 @@ public slots: void fileStatusChanged(const QString &, SyncFileStatus) override {} protected: - Result<ConvertToPlaceholderResult, QString> updateMetadata(const QString &, const SyncFileItem &, const QString & = {}) override { return { ConvertToPlaceholderResult::Ok }; } + Result<ConvertToPlaceholderResult, QString> updateMetadata(const SyncFileItem &, const QString &, const QString &) override { return { ConvertToPlaceholderResult::Ok }; } void startImpl(const VfsSetupParams &) override {} }; diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 5b14b6360..cce5ae713 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -1048,7 +1048,7 @@ void ProcessDirectoryJob::processFileConflict(const SyncFileItemPtr &item, Proce // we recieved the etag (Issue #5106) auto up = _discoveryData->_statedb->getUploadInfo(path._original); if (up._valid && up._contentChecksum == serverEntry.checksumHeader) { - // Solve the conflict into an upload, or nothing + // Solve the conflict into an upload, or update meta data item->_instruction = up._modtime == localEntry.modtime && up._size == localEntry.size ? CSYNC_INSTRUCTION_UPDATE_METADATA : CSYNC_INSTRUCTION_SYNC; diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index a1204093e..1ca022570 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -754,7 +754,7 @@ QString OwncloudPropagator::adjustRenamedPath(const QString &original) const Result<Vfs::ConvertToPlaceholderResult, QString> OwncloudPropagator::updatePlaceholder(const SyncFileItem &item, const QString &fileName, const QString &replacesFile) { - const auto result = syncOptions()._vfs->updateMetadata(fileName, item, replacesFile); + const auto result = syncOptions()._vfs->updateMetadata(item, fileName, replacesFile); if (!result) { return result.error(); } else if (*result == Vfs::ConvertToPlaceholderResult::Locked) { @@ -763,9 +763,9 @@ Result<Vfs::ConvertToPlaceholderResult, QString> OwncloudPropagator::updatePlace return Vfs::ConvertToPlaceholderResult::Ok; } -Result<Vfs::ConvertToPlaceholderResult, QString> OwncloudPropagator::updateMetadata(const SyncFileItem &item, const QString &fileName) +Result<Vfs::ConvertToPlaceholderResult, QString> OwncloudPropagator::updateMetadata(const SyncFileItem &item) { - const QString fsPath = fileName.isEmpty() ? fullLocalPath(item.destination()) : fileName; + const QString fsPath = fullLocalPath(item.destination()); const auto result = updatePlaceholder(item, fsPath, {}); if (!result) { return result; @@ -1148,7 +1148,7 @@ void OCC::PropagateUpdateMetaDataJob::start() // database is removed. Nothing will be done for those files, but we still need // to update the database. - const QString filePath = propagator()->fullLocalPath(_item->_file); + const QString filePath = propagator()->fullLocalPath(_item->destination()); if (_item->_direction == SyncFileItem::Down) { // If the 'W' remote permission changed, update the local filesystem SyncJournalFileRecord prev; @@ -1163,7 +1163,7 @@ void OCC::PropagateUpdateMetaDataJob::start() _item->_serverHasIgnoredFiles |= prev._serverHasIgnoredFiles; } } - const auto result = propagator()->updateMetadata(*_item, filePath); + const auto result = propagator()->updateMetadata(*_item); if (!result) { done(SyncFileItem::SoftError, tr("Could not update file : %1").arg(result.error())); } diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index b1c440e17..944a80d98 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -522,7 +522,7 @@ public: * * Will also trigger updatePlaceholder. */ - Result<Vfs::ConvertToPlaceholderResult, QString> updateMetadata(const SyncFileItem &item, const QString &fileName = {}); + Result<Vfs::ConvertToPlaceholderResult, QString> updateMetadata(const SyncFileItem &item); /** Update the the placeholder and takes over some metadata from replacesFile diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 9551ffe63..72ed864a1 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -1017,7 +1017,7 @@ void PropagateDownloadFile::downloadFinished() void PropagateDownloadFile::updateMetadata(bool isConflict) { const QString fn = propagator()->fullLocalPath(_item->destination()); - const auto result = propagator()->updateMetadata(*_item, fn); + const auto result = propagator()->updateMetadata(*_item); if (!result) { done(SyncFileItem::FatalError, tr("Error updating metadata: %1").arg(result.error())); return; diff --git a/src/libsync/vfs/suffix/vfs_suffix.cpp b/src/libsync/vfs/suffix/vfs_suffix.cpp index 38af62ab7..8f9353f47 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.cpp +++ b/src/libsync/vfs/suffix/vfs_suffix.cpp @@ -68,7 +68,7 @@ bool VfsSuffix::isHydrating() const return false; } -Result<Vfs::ConvertToPlaceholderResult, QString> VfsSuffix::updateMetadata(const QString &filePath, const SyncFileItem &item, const QString &) +Result<Vfs::ConvertToPlaceholderResult, QString> VfsSuffix::updateMetadata(const SyncFileItem &item, const QString &filePath, const QString &) { FileSystem::setModTime(filePath, item._modtime); return Vfs::ConvertToPlaceholderResult::Ok; diff --git a/src/libsync/vfs/suffix/vfs_suffix.h b/src/libsync/vfs/suffix/vfs_suffix.h index 987a1758f..a9911605f 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.h +++ b/src/libsync/vfs/suffix/vfs_suffix.h @@ -56,7 +56,7 @@ public slots: void fileStatusChanged(const QString &, SyncFileStatus) override {} protected: - Result<ConvertToPlaceholderResult, QString> updateMetadata(const QString &filePath, const SyncFileItem &item, const QString &replacesFile = {}) override; + Result<ConvertToPlaceholderResult, QString> updateMetadata(const SyncFileItem &item, const QString &filePath, const QString &replacesFile) override; void startImpl(const VfsSetupParams ¶ms) override; }; |