plugin/appdb: fix persistence
This commit is contained in:
parent
6f147b21cc
commit
44c0e1b116
2 changed files with 9 additions and 21 deletions
|
|
@ -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(" ")
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue