Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsync/discovery.cpp')
-rw-r--r--src/libsync/discovery.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp
index 41ce627cd..13de3edb3 100644
--- a/src/libsync/discovery.cpp
+++ b/src/libsync/discovery.cpp
@@ -88,7 +88,9 @@ void ProcessDirectoryJob::process()
auto name = pathU8.isEmpty() ? rec._path : QString::fromUtf8(rec._path.constData() + (pathU8.size() + 1));
if (rec.isVirtualFile() && isVfsWithSuffix())
chopVirtualFileSuffix(name);
- entries[name].dbEntry = rec;
+ auto &dbEntry = entries[name].dbEntry;
+ dbEntry = rec;
+ setupDbPinStateActions(dbEntry);
})) {
dbError();
return;
@@ -1448,4 +1450,30 @@ void ProcessDirectoryJob::computePinState(PinState parentState)
}
}
+void ProcessDirectoryJob::setupDbPinStateActions(SyncJournalFileRecord &record)
+{
+ // Only suffix-vfs uses the db for pin states.
+ // Other plugins will set localEntry._type according to the file's pin state.
+ if (!isVfsWithSuffix())
+ return;
+
+ QByteArray pinPath = record._path;
+ if (record.isVirtualFile()) {
+ const auto suffix = _discoveryData->_syncOptions._vfs->fileSuffix().toUtf8();
+ if (pinPath.endsWith(suffix))
+ pinPath.chop(suffix.size());
+ }
+ auto pin = _discoveryData->_statedb->internalPinStates().rawForPath(pinPath);
+ if (!pin || *pin == PinState::Inherited)
+ pin = _pinState;
+
+ // OnlineOnly hydrated files want to be dehydrated
+ if (record._type == ItemTypeFile && *pin == PinState::OnlineOnly)
+ record._type = ItemTypeVirtualFileDehydration;
+
+ // AlwaysLocal dehydrated files want to be hydrated
+ if (record._type == ItemTypeVirtualFile && *pin == PinState::AlwaysLocal)
+ record._type = ItemTypeVirtualFileDownload;
+}
+
}