moment/src/qml/SidePane/SidePaneToolBar.qml

60 lines
1.7 KiB
QML
Raw Normal View History

import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
2019-03-26 09:29:46 +11:00
HRowLayout {
id: toolBar
2019-03-26 09:29:46 +11:00
property SidePaneList sidePaneList
2019-08-24 01:02:22 +10:00
readonly property alias addAccountButton: addAccountButton
readonly property alias filterField: filterField
property alias roomFilter: filterField.text
2019-08-21 07:41:24 +10:00
HButton {
2019-08-24 01:02:22 +10:00
id: addAccountButton
icon.name: "add-account"
toolTip.text: qsTr("Add another account")
backgroundColor: theme.sidePane.settingsButton.background
onClicked: pageLoader.showPage("AddAccount/AddAccount")
2019-08-21 07:41:24 +10:00
Layout.fillHeight: true
2019-04-29 05:13:18 +10:00
}
2019-03-26 09:29:46 +11:00
HTextField {
2019-03-26 09:29:46 +11:00
id: filterField
placeholderText: qsTr("Filter rooms")
backgroundColor: theme.sidePane.filterRooms.background
bordered: false
Component.onCompleted: filterField.text = uiState.sidePaneFilter
onTextChanged: {
if (window.uiState.sidePaneFilter == text) return
window.uiState.sidePaneFilter = text
window.uiStateChanged()
}
Layout.fillWidth: true
Layout.fillHeight: true
Keys.onUpPressed: sidePaneList.previous(false) // do not activate
Keys.onDownPressed: sidePaneList.next(false)
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {
sidePaneList.toggleCollapseAccount()
return
}
if (window.settings.clearRoomFilterOnEnter) text = ""
sidePaneList.activate()
}
Keys.onEscapePressed: {
if (window.settings.clearRoomFilterOnEscape) text = ""
mainUI.pageLoader.forceActiveFocus()
}
2019-03-26 09:29:46 +11:00
}
}