Fix saving the new key to the settings if the 'remember key' option was set and the DB was rekeyed
This commit is contained in:
parent
329e016f8d
commit
ba6417e72f
3 changed files with 10 additions and 1 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
# 0.1.8
|
||||||
|
|
||||||
|
* Fix saving the new key to the settings if the 'remember key' option was set and the DB was rekeyed
|
||||||
|
|
||||||
|
# 0.1.7
|
||||||
|
|
||||||
|
* More fixes for shortcuts and move the Change Key button in settings
|
||||||
|
|
||||||
# 0.1.6
|
# 0.1.6
|
||||||
|
|
||||||
* Fix shortcuts for next/previous day to not collide with Normal text (Ctrl+N)
|
* Fix shortcuts for next/previous day to not collide with Normal text (Ctrl+N)
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ class DBManager:
|
||||||
raise RuntimeError("Database is not connected")
|
raise RuntimeError("Database is not connected")
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
# Change the encryption key of the currently open database
|
# Change the encryption key of the currently open database
|
||||||
cur.execute(f"PRAGMA rekey = '{new_key}';")
|
cur.execute(f"PRAGMA rekey = '{new_key}';").fetchone()
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
||||||
# Close and reopen with the new key to verify and restore PRAGMAs
|
# Close and reopen with the new key to verify and restore PRAGMAs
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ class SettingsDialog(QDialog):
|
||||||
QMessageBox.warning(self, "Empty key", "Key cannot be empty.")
|
QMessageBox.warning(self, "Empty key", "Key cannot be empty.")
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
self.key = new_key
|
||||||
self._db.rekey(new_key)
|
self._db.rekey(new_key)
|
||||||
QMessageBox.information(
|
QMessageBox.information(
|
||||||
self, "Key changed", "The notebook was re-encrypted with the new key!"
|
self, "Key changed", "The notebook was re-encrypted with the new key!"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue