diff --git a/src/core/Database.cpp b/src/core/Database.cpp index ae1664118..e3fa5a269 100644 --- a/src/core/Database.cpp +++ b/src/core/Database.cpp @@ -261,6 +261,7 @@ bool Database::setKey(const CompositeKey& key, bool updateChangedTime, bool upda m_data.kdf->randomizeSeed(); } + QByteArray oldTransformedMasterKey = m_data.transformedMasterKey; QByteArray transformedMasterKey; if (!key.transform(*m_data.kdf, transformedMasterKey)) { return false; @@ -272,7 +273,10 @@ bool Database::setKey(const CompositeKey& key, bool updateChangedTime, bool upda if (updateChangedTime) { m_metadata->setMasterKeyChanged(QDateTime::currentDateTimeUtc()); } - emit modifiedImmediate(); + + if (oldTransformedMasterKey != m_data.transformedMasterKey) { + emit modifiedImmediate(); + } return true; } @@ -461,7 +465,9 @@ QString Database::saveToFile(QString filePath) if (saveFile.open(QIODevice::WriteOnly)) { // write the database to the file + setEmitModified(false); writer.writeDatabase(&saveFile, this); + setEmitModified(true); if (writer.hasError()) { return writer.errorString();