Main pane list items keyboard activation

This commit is contained in:
miruka 2020-02-13 05:56:10 -04:00
parent 4636a36154
commit 7547703bb0
5 changed files with 34 additions and 5 deletions

View File

@ -187,13 +187,19 @@ Item {
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.goToPreviousRoom
onActivated: mainUI.mainPane.mainPaneList.previous()
onActivated: {
mainUI.mainPane.mainPaneList.previous()
mainUI.mainPane.mainPaneList.requestActivate()
}
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.goToNextRoom
onActivated: mainUI.mainPane.mainPaneList.next()
onActivated: {
mainUI.mainPane.mainPaneList.next()
mainUI.mainPane.mainPaneList.requestActivate()
}
}

View File

@ -48,6 +48,8 @@ HTileDelegate {
)
readonly property alias addChat: addChat
readonly property bool collapsed:
window.uiState.collapseAccounts[model.id] || false

View File

@ -20,6 +20,8 @@ HListView {
highlightRangeMode: ListView.NoHighlightRange
highlight: Rectangle {
Component.onCompleted: print("coc")
Component.onDestruction: print("cod")
id: highlightRectangle
y:
selectedRoom ?
@ -120,8 +122,15 @@ HListView {
}
}
function requestActivate() {
activateLimiter.restart()
}
function activate() {
currentItem.item.activated()
if (! currentItem) incrementCurrentIndex()
selectedRoom ?
currentItem.roomList.currentItem.activated() :
currentItem.account.activated()
}
function accountSettings() {
@ -133,7 +142,7 @@ HListView {
function addNewChat() {
if (! currentItem) incrementCurrentIndex()
currentItem.roomList.currentIndex = -1
currentItem.account.activated()
currentItem.account.addChat.clicked()
}
function toggleCollapseAccount() {
@ -142,6 +151,11 @@ HListView {
currentItem.account.toggleCollapse()
}
function clearSelection() {
if (selectedRoom) currentItem.roomList.currentIndex = -1
currentIndex = -1
}
Timer {
id: activateLimiter

View File

@ -27,6 +27,10 @@ HDrawer {
toolBar.filterField.forceActiveFocus()
}
function addccount() {
toolBar.addAccountButton.clicked()
}
Behavior on opacity { HNumberAnimation {} }

View File

@ -19,7 +19,10 @@ HRowLayout {
icon.name: "add-account"
toolTip.text: qsTr("Add another account")
backgroundColor: theme.mainPane.settingsButton.background
onClicked: pageLoader.showPage("AddAccount/AddAccount")
onClicked: {
mainPaneList.clearSelection()
pageLoader.showPage("AddAccount/AddAccount")
}
Layout.fillHeight: true
}