Add keyboard controls for message focus/selection

This commit is contained in:
miruka
2020-03-27 04:49:01 -04:00
parent 6ca10e1f2b
commit 936c49127d
5 changed files with 81 additions and 8 deletions

View File

@@ -77,14 +77,12 @@ ListView {
function delegatesChecked(...indices) {
print( indices)
for (const i of indices) {
const model = listView.model.get(i)
checkedDelegates[model.id] = model
}
lastCheckedDelegateIndex = indices.slice(-1)[0]
checkedDelegatesChanged()
}
@@ -98,6 +96,27 @@ ListView {
const model = listView.model.get(i)
delete checkedDelegates[model.id]
}
checkedDelegatesChanged()
}
function toggleCheck(...indices) {
const checkedIndices = []
for (const i of indices) {
const model = listView.model.get(i)
if (model.id in checkedDelegates) {
delete checkedDelegates[model.id]
} else {
checkedDelegates[model.id] = model
checkedIndices.push(i)
}
}
if (checkedIndices.length > 0)
lastCheckedDelegateIndex = checkedIndices.slice(-1)[0]
checkedDelegatesChanged()
}