diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-11 15:16:34 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-11 15:16:34 +1000 |
| commit | 44c0e1b1164aa44bf0cc1c639a44edcff9fb3355 (patch) | |
| tree | 06febd08bee29797baedb575b87ce2af6e73e6bd | |
| parent | plugin: use qt typedefs for fixed ints (diff) | |
| download | caelestia-shell-44c0e1b1164aa44bf0cc1c639a44edcff9fb3355.tar.gz caelestia-shell-44c0e1b1164aa44bf0cc1c639a44edcff9fb3355.tar.bz2 caelestia-shell-44c0e1b1164aa44bf0cc1c639a44edcff9fb3355.zip | |
plugin/appdb: fix persistence
| -rw-r--r-- | modules/launcher/services/Apps.qml | 18 | ||||
| -rw-r--r-- | plugin/src/Caelestia/appdb.cpp | 12 |
2 files changed, 9 insertions, 21 deletions
diff --git a/modules/launcher/services/Apps.qml b/modules/launcher/services/Apps.qml index b4b766d..02d997a 100644 --- a/modules/launcher/services/Apps.qml +++ b/modules/launcher/services/Apps.qml @@ -74,22 +74,4 @@ Searcher { path: `${Paths.state}/apps.sqlite` entries: DesktopEntries.applications.values.filter(a => !Config.launcher.hiddenApps.includes(a.id)) } - - // Variants { - // id: variants - - // model: [...DesktopEntries.applications.values].filter(a => !Config.launcher.hiddenApps.includes(a.id)).sort((a, b) => a.name.localeCompare(b.name)) - - // QtObject { - // required property DesktopEntry modelData - // readonly property string id: modelData.id - // readonly property string name: modelData.name - // readonly property string desc: modelData.comment - // readonly property string execString: modelData.execString - // readonly property string wmClass: modelData.startupClass - // readonly property string genericName: modelData.genericName - // readonly property string categories: modelData.categories.join(" ") - // readonly property string keywords: modelData.keywords.join(" ") - // } - // } } 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(); } |