moment/src/gui/MainPane/MainPaneToolBar.qml

64 lines
1.8 KiB
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
2019-03-26 09:29:46 +11:00
HRowLayout {
id: toolBar
// Hide filter field overflowing for a sec on size changes
clip: true
2019-03-26 09:29:46 +11:00
property AccountRoomsList mainPaneList
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")
2019-12-11 06:17:41 +11:00
backgroundColor: theme.mainPane.settingsButton.background
onClicked: {
mainPaneList.clearSelection()
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
saveName: "roomFilterField"
2019-03-26 09:29:46 +11:00
placeholderText: qsTr("Filter rooms")
2019-12-11 06:17:41 +11:00
backgroundColor: theme.mainPane.filterRooms.background
bordered: false
opacity: width >= 16 * theme.uiScale ? 1 : 0
Layout.fillWidth: true
Layout.fillHeight: true
2019-12-11 06:17:41 +11:00
Keys.onUpPressed: mainPaneList.previous(false) // do not activate
Keys.onDownPressed: mainPaneList.next(false)
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {
2019-12-11 06:17:41 +11:00
mainPaneList.toggleCollapseAccount()
return
}
if (window.settings.clearRoomFilterOnEnter) text = ""
2019-12-11 06:17:41 +11:00
mainPaneList.activate()
}
Keys.onEscapePressed: {
if (window.settings.clearRoomFilterOnEscape) text = ""
mainUI.pageLoader.forceActiveFocus()
}
2019-12-16 19:42:41 +11:00
Behavior on opacity { HNumberAnimation {} }
2019-03-26 09:29:46 +11:00
}
}