Show password prompt in any error case in Qt Quick GUI
It might happen that an empty/incorrect password does not lead to a crypto error. Then the data is nevertheless wrongly decrypted and trying again with the correct password might help. Not using PasswordFile::isEncryptionUsed() here like in the Qt Widgets GUI for better/easier integration with Android's storage access framework.
This commit is contained in:
parent
9ff25a27b7
commit
a290294c25
|
@ -143,7 +143,13 @@ void Controller::load()
|
||||||
emit fileError(tr("A crypto error occured when opening the file: ") + QString::fromLocal8Bit(e.what()), QStringLiteral("load"));
|
emit fileError(tr("A crypto error occured when opening the file: ") + QString::fromLocal8Bit(e.what()), QStringLiteral("load"));
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
emitFileError(tr("loading"));
|
if ((m_file.saveOptions() & PasswordFileSaveFlags::Encryption) && m_password.isEmpty()) {
|
||||||
|
emit passwordRequired(m_filePath);
|
||||||
|
} else {
|
||||||
|
// clear password since the password which has been provided might not have been correct (although there was no CryptoException)
|
||||||
|
clearPassword();
|
||||||
|
emitFileError(tr("loading"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue