summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-11 15:16:34 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-11 15:16:34 +1000
commit44c0e1b1164aa44bf0cc1c639a44edcff9fb3355 (patch)
tree06febd08bee29797baedb575b87ce2af6e73e6bd /plugin
parentplugin: use qt typedefs for fixed ints (diff)
downloadcaelestia-shell-44c0e1b1164aa44bf0cc1c639a44edcff9fb3355.tar.gz
caelestia-shell-44c0e1b1164aa44bf0cc1c639a44edcff9fb3355.tar.bz2
caelestia-shell-44c0e1b1164aa44bf0cc1c639a44edcff9fb3355.zip
plugin/appdb: fix persistence
Diffstat (limited to 'plugin')
-rw-r--r--plugin/src/Caelestia/appdb.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugin/src/Caelestia/appdb.cpp b/plugin/src/Caelestia/appdb.cpp
index 20e37bb..71f7130 100644
--- a/plugin/src/Caelestia/appdb.cpp
+++ b/plugin/src/Caelestia/appdb.cpp
@@ -83,16 +83,22 @@ QString AppDb::path() const {
}
void AppDb::setPath(const QString& path) {
- if (m_path == path) {
+ auto newPath = path.isEmpty() ? ":memory:" : path;
+
+ if (m_path == newPath) {
return;
}
- m_path = path;
+ m_path = newPath;
emit pathChanged();
auto db = QSqlDatabase::database(m_uuid, false);
db.close();
- db.setDatabaseName(path);
+ db.setDatabaseName(newPath);
+ db.open();
+
+ QSqlQuery query(db);
+ query.exec("CREATE TABLE IF NOT EXISTS frequencies (id TEXT PRIMARY KEY, frequency INTEGER)");
updateAppFrequencies();
}