From ba6417e72f2d2600dfc038c2456c66d87afcae3a Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Mon, 3 Nov 2025 12:39:31 +1100 Subject: [PATCH] Fix saving the new key to the settings if the 'remember key' option was set and the DB was rekeyed --- CHANGELOG.md | 8 ++++++++ bouquin/db.py | 2 +- bouquin/settings_dialog.py | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86bf338..0ee1a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 * Fix shortcuts for next/previous day to not collide with Normal text (Ctrl+N) diff --git a/bouquin/db.py b/bouquin/db.py index df5aa62..37b65f1 100644 --- a/bouquin/db.py +++ b/bouquin/db.py @@ -133,7 +133,7 @@ class DBManager: raise RuntimeError("Database is not connected") cur = self.conn.cursor() # 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() # Close and reopen with the new key to verify and restore PRAGMAs diff --git a/bouquin/settings_dialog.py b/bouquin/settings_dialog.py index c981388..cd2f13e 100644 --- a/bouquin/settings_dialog.py +++ b/bouquin/settings_dialog.py @@ -180,6 +180,7 @@ class SettingsDialog(QDialog): QMessageBox.warning(self, "Empty key", "Key cannot be empty.") return try: + self.key = new_key self._db.rekey(new_key) QMessageBox.information( self, "Key changed", "The notebook was re-encrypted with the new key!"