diff --git a/src/core/Database.cpp b/src/core/Database.cpp index 279243d5a..ffb260e19 100644 --- a/src/core/Database.cpp +++ b/src/core/Database.cpp @@ -189,7 +189,15 @@ void Database::setCompressionAlgo(Database::CompressionAlgorithm algo) void Database::setTransformRounds(quint64 rounds) { - m_transformRounds = rounds; + if (m_transformRounds != rounds) { + m_transformRounds = rounds; + + if (m_hasKey) { + m_transformedMasterKey = m_key.transform(m_transformSeed, m_transformRounds); + m_metadata->setMasterKeyChanged(Tools::currentDateTimeUtc()); + Q_EMIT modifiedImmediate(); + } + } } void Database::setKey(const CompositeKey& key, const QByteArray& transformSeed, bool updateChangedTime) @@ -209,16 +217,6 @@ void Database::setKey(const CompositeKey& key) setKey(key, Random::randomArray(32)); } -void Database::updateKey(quint64 rounds) -{ - if (m_transformRounds != rounds) { - m_transformRounds = rounds; - m_transformedMasterKey = m_key.transform(m_transformSeed, transformRounds()); - m_metadata->setMasterKeyChanged(Tools::currentDateTimeUtc()); - Q_EMIT modifiedImmediate(); - } -} - bool Database::hasKey() { return m_hasKey; diff --git a/src/core/Database.h b/src/core/Database.h index de4f00c7f..aa68df7fb 100644 --- a/src/core/Database.h +++ b/src/core/Database.h @@ -86,7 +86,6 @@ public: * Sets the database key and generates a random transform seed. */ void setKey(const CompositeKey& key); - void updateKey(quint64 rounds); bool hasKey(); void recycleEntry(Entry* entry); void recycleGroup(Group* group);