Correct regression in database modification signal

This commit is contained in:
Jonathan White 2018-01-01 13:59:57 -05:00
parent 542ee42313
commit 738f870e70
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

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