From 06fadb45364de7296b3c1a8847fe98623acc3632 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 19 Feb 2018 13:51:06 +0200 Subject: [PATCH] Browser connection keys and rules are stored in custom data instead of attributes --- src/browser/BrowserEntryConfig.cpp | 4 ++-- src/browser/BrowserService.cpp | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/browser/BrowserEntryConfig.cpp b/src/browser/BrowserEntryConfig.cpp index 36d0c73397..2fcc48a281 100644 --- a/src/browser/BrowserEntryConfig.cpp +++ b/src/browser/BrowserEntryConfig.cpp @@ -83,7 +83,7 @@ void BrowserEntryConfig::setRealm(const QString& realm) bool BrowserEntryConfig::load(const Entry* entry) { - QString s = entry->attributes()->value(KEEPASSBROWSER_NAME); + QString s = entry->customData()->value(KEEPASSBROWSER_NAME); if (s.isEmpty()) { return false; } @@ -105,5 +105,5 @@ void BrowserEntryConfig::save(Entry* entry) QVariantMap v = qo2qv(this); QJsonObject o = QJsonObject::fromVariantMap(v); QByteArray json = QJsonDocument(o).toJson(QJsonDocument::Compact); - entry->attributes()->set(KEEPASSBROWSER_NAME, json); + entry->customData()->set(KEEPASSBROWSER_NAME, json); } diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index fb89e8bcb6..f4b3854f09 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -107,12 +107,12 @@ QString BrowserService::getDatabaseRootUuid() { Database* db = getDatabase(); if (!db) { - return QString(); + return {}; } Group* rootGroup = db->rootGroup(); if (!rootGroup) { - return QString(); + return {}; } return rootGroup->uuid().toHex(); @@ -122,12 +122,12 @@ QString BrowserService::getDatabaseRecycleBinUuid() { Database* db = getDatabase(); if (!db) { - return QString(); + return {}; } Group* recycleBin = db->metadata()->recycleBin(); if (!recycleBin) { - return QString(); + return {}; } return recycleBin->uuid().toHex(); } @@ -200,7 +200,7 @@ QString BrowserService::storeKey(const QString& key) return {}; } - contains = config->attributes()->contains(QLatin1String(ASSOCIATE_KEY_PREFIX) + id); + contains = config->customData()->contains(QLatin1String(ASSOCIATE_KEY_PREFIX) + id); if (contains) { dialogResult = QMessageBox::warning(nullptr, tr("KeePassXC: Overwrite existing key?"), tr("A shared encryption key with the name \"%1\" " @@ -210,7 +210,7 @@ QString BrowserService::storeKey(const QString& key) } } while (contains && dialogResult == QMessageBox::No); - config->attributes()->set(QLatin1String(ASSOCIATE_KEY_PREFIX) + id, key, true); + config->customData()->set(QLatin1String(ASSOCIATE_KEY_PREFIX) + id, key); return id; } @@ -218,10 +218,10 @@ QString BrowserService::getKey(const QString& id) { Entry* config = getConfigEntry(); if (!config) { - return QString(); + return {}; } - return config->attributes()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + id); + return config->customData()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + id); } QJsonArray BrowserService::findMatchingEntries(const QString& id, const QString& url, const QString& submitUrl, const QString& realm) @@ -429,7 +429,7 @@ void BrowserService::removeSharedEncryptionKeys() } QStringList keysToRemove; - for (const QString& key : entry->attributes()->keys()) { + for (const QString& key : entry->customData()->keys()) { if (key.startsWith(ASSOCIATE_KEY_PREFIX)) { keysToRemove << key; } @@ -444,7 +444,7 @@ void BrowserService::removeSharedEncryptionKeys() entry->beginUpdate(); for (const QString& key : keysToRemove) { - entry->attributes()->remove(key); + entry->customData()->remove(key); } entry->endUpdate(); @@ -481,9 +481,9 @@ void BrowserService::removeStoredPermissions() return; } - if (entry->attributes()->contains(KEEPASSXCBROWSER_NAME)) { + if (entry->customData()->contains(KEEPASSXCBROWSER_NAME)) { entry->beginUpdate(); - entry->attributes()->remove(KEEPASSXCBROWSER_NAME); + entry->customData()->remove(KEEPASSXCBROWSER_NAME); entry->endUpdate(); ++counter; }