mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
FolderListModel filters
This commit is contained in:
@@ -54,6 +54,7 @@ Singleton {
|
|||||||
showDirs: true
|
showDirs: true
|
||||||
showFiles: false
|
showFiles: false
|
||||||
showDotAndDotDot: false
|
showDotAndDotDot: false
|
||||||
|
nameFilters: ["plugin.json"]
|
||||||
|
|
||||||
onCountChanged: resyncDebounce.restart()
|
onCountChanged: resyncDebounce.restart()
|
||||||
onStatusChanged: if (status === FolderListModel.Ready) resyncDebounce.restart()
|
onStatusChanged: if (status === FolderListModel.Ready) resyncDebounce.restart()
|
||||||
@@ -64,6 +65,7 @@ Singleton {
|
|||||||
showDirs: true
|
showDirs: true
|
||||||
showFiles: false
|
showFiles: false
|
||||||
showDotAndDotDot: false
|
showDotAndDotDot: false
|
||||||
|
nameFilters: ["plugin.json"]
|
||||||
|
|
||||||
onCountChanged: resyncDebounce.restart()
|
onCountChanged: resyncDebounce.restart()
|
||||||
onStatusChanged: if (status === FolderListModel.Ready) resyncDebounce.restart()
|
onStatusChanged: if (status === FolderListModel.Ready) resyncDebounce.restart()
|
||||||
@@ -72,8 +74,15 @@ Singleton {
|
|||||||
function snapshotModel(model, sourceTag) {
|
function snapshotModel(model, sourceTag) {
|
||||||
const out = []
|
const out = []
|
||||||
const n = model.count
|
const n = model.count
|
||||||
|
const baseDir = sourceTag === "user" ? pluginDirectory : systemPluginDirectory
|
||||||
for (let i = 0; i < n; i++) {
|
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"
|
const manifestPath = dirPath + "/plugin.json"
|
||||||
out.push({ path: manifestPath, source: sourceTag })
|
out.push({ path: manifestPath, source: sourceTag })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user