Keep apps menu alphabetically sorted
This commit is contained in:
@@ -549,6 +549,22 @@ Item {
|
||||
if (!root.isVisible(child)) continue
|
||||
rows.push(root.displayRow(child, child.description, child.order))
|
||||
}
|
||||
|
||||
// DesktopEntries can reorder its values when an application starts.
|
||||
// Keep the Apps menu alphabetical independently of provider refreshes.
|
||||
if (active === "apps") {
|
||||
rows.sort(function(a, b) {
|
||||
var aLabel = String(a.label || "").toLowerCase()
|
||||
var bLabel = String(b.label || "").toLowerCase()
|
||||
if (aLabel < bLabel) return -1
|
||||
if (aLabel > bLabel) return 1
|
||||
var aId = String(a.itemId || "")
|
||||
var bId = String(b.itemId || "")
|
||||
if (aId < bId) return -1
|
||||
if (aId > bId) return 1
|
||||
return 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for (var k = 0; k < rows.length; k++) displayModel.append(rows[k])
|
||||
|
||||
@@ -109,6 +109,11 @@ assert(
|
||||
'app library fallback icon index includes device icons'
|
||||
)
|
||||
|
||||
assert(
|
||||
/if \(active === "apps"\) \{[\s\S]*?rows\.sort\(function\(a, b\)/.test(menuQml),
|
||||
'apps menu enforces alphabetical display order after provider refreshes'
|
||||
)
|
||||
|
||||
const iconSourceMatch = appLibraryQml.match(/function iconSource\(icon\) \{([\s\S]*?)\n \}/)
|
||||
assert(iconSourceMatch, 'app library iconSource function exists')
|
||||
assert(
|
||||
|
||||
Reference in New Issue
Block a user