1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

FolderListModel filters

This commit is contained in:
bbedward
2025-10-09 14:30:43 -04:00
parent 97dbd40f07
commit b06e48a444

View File

@@ -54,6 +54,7 @@ Singleton {
showDirs: true
showFiles: false
showDotAndDotDot: false
nameFilters: ["plugin.json"]
onCountChanged: resyncDebounce.restart()
onStatusChanged: if (status === FolderListModel.Ready) resyncDebounce.restart()
@@ -64,6 +65,7 @@ Singleton {
showDirs: true
showFiles: false
showDotAndDotDot: false
nameFilters: ["plugin.json"]
onCountChanged: resyncDebounce.restart()
onStatusChanged: if (status === FolderListModel.Ready) resyncDebounce.restart()
@@ -72,8 +74,15 @@ Singleton {
function snapshotModel(model, sourceTag) {
const out = []
const n = model.count
const baseDir = sourceTag === "user" ? pluginDirectory : systemPluginDirectory
for (let i = 0; i < n; i++) {
const dirPath = model.get(i, "filePath")
let dirPath = model.get(i, "filePath")
if (dirPath.startsWith("file://")) {
dirPath = dirPath.substring(7)
}
if (!dirPath.startsWith(baseDir)) {
continue
}
const manifestPath = dirPath + "/plugin.json"
out.push({ path: manifestPath, source: sourceTag })
}