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

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Weilbach <felix.weilbach@nextcloud.com>2021-11-16 13:50:43 +0300
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>2021-11-17 12:53:26 +0300
commitc76a77e43101e7825c79f8e1412609eb66ebfde0 (patch)
tree1c5b5a534e309a8b0dc5b5a21e7995151f62ba6a /src/common
parent2308c9da49cbda0f137c4ac1a35cf64de9ade188 (diff)
Correct virtual files placeholder files if needed
In the past not all files were converted to placeholder files when converting an existing sync folder to a virtual files folder. Because some files were not converted to placeholder files, the status would be wrong on the files. This code makes sure that every file in a virtual files folder is a placeholder file. It could be removed in the future. Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/syncjournaldb.cpp23
-rw-r--r--src/common/syncjournaldb.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp
index 5c5195bba..8c41aec63 100644
--- a/src/common/syncjournaldb.cpp
+++ b/src/common/syncjournaldb.cpp
@@ -1016,6 +1016,29 @@ qint64 SyncJournalDb::keyValueStoreGetInt(const QString &key, qint64 defaultValu
return query->int64Value(0);
}
+bool SyncJournalDb::keyValueStoreGetBool(const QString &key, bool defaultValue)
+{
+ QMutexLocker locker(&_mutex);
+ if (!checkConnect()) {
+ return defaultValue;
+ }
+
+ const auto query = _queryManager.get(PreparedSqlQueryManager::GetKeyValueStoreQuery,
+ QByteArrayLiteral("SELECT value FROM key_value_store WHERE key = ?1;"), _db);
+ if (!query) {
+ return defaultValue;
+ }
+
+ query->bindValue(1, key);
+ query->exec();
+
+ if (!query->next().hasData) {
+ return defaultValue;
+ }
+
+ return query->intValue(0);
+}
+
QVariant SyncJournalDb::keyValueStoreGet(const QString &key, QVariant defaultValue)
{
QMutexLocker locker(&_mutex);
diff --git a/src/common/syncjournaldb.h b/src/common/syncjournaldb.h
index ba4c0ede8..9a3db7125 100644
--- a/src/common/syncjournaldb.h
+++ b/src/common/syncjournaldb.h
@@ -70,6 +70,7 @@ public:
void keyValueStoreSet(const QString &key, QVariant value);
qint64 keyValueStoreGetInt(const QString &key, qint64 defaultValue);
+ bool keyValueStoreGetBool(const QString &key, bool defaultValue);
QVariant keyValueStoreGet(const QString &key, QVariant defaultValue = {});
void keyValueStoreDelete(const QString &key);