2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-08-16 01:29:22 +10:00
|
|
|
import QtQuick 2.12
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../Base"
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HRowLayout {
|
2019-04-21 07:45:51 +10:00
|
|
|
id: toolBar
|
2019-12-16 05:56:40 +11:00
|
|
|
// Hide filter field overflowing for a sec on size changes
|
|
|
|
clip: true
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-12-03 07:29:29 +11:00
|
|
|
property AccountRoomsList mainPaneList
|
2019-08-24 01:02:22 +10:00
|
|
|
readonly property alias addAccountButton: addAccountButton
|
|
|
|
readonly property alias filterField: filterField
|
2019-07-03 03:59:52 +10:00
|
|
|
property alias roomFilter: filterField.text
|
|
|
|
|
2019-08-21 07:41:24 +10:00
|
|
|
HButton {
|
2019-08-24 01:02:22 +10:00
|
|
|
id: addAccountButton
|
2019-08-22 05:45:13 +10:00
|
|
|
icon.name: "add-account"
|
2019-08-22 23:27:26 +10:00
|
|
|
toolTip.text: qsTr("Add another account")
|
2019-12-11 06:17:41 +11:00
|
|
|
backgroundColor: theme.mainPane.settingsButton.background
|
2020-02-13 20:56:10 +11:00
|
|
|
onClicked: {
|
|
|
|
mainPaneList.clearSelection()
|
|
|
|
pageLoader.showPage("AddAccount/AddAccount")
|
|
|
|
}
|
2019-08-21 07:41:24 +10:00
|
|
|
|
2019-08-22 23:27:26 +10:00
|
|
|
Layout.fillHeight: true
|
2019-04-29 05:13:18 +10:00
|
|
|
}
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HTextField {
|
2019-03-26 09:29:46 +11:00
|
|
|
id: filterField
|
2019-12-11 07:29:49 +11:00
|
|
|
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
|
2019-07-19 10:39:13 +10:00
|
|
|
bordered: false
|
2019-12-16 05:56:40 +11:00
|
|
|
opacity: width >= 16 * theme.uiScale ? 1 : 0
|
2019-04-29 02:08:54 +10:00
|
|
|
|
2019-12-09 05:43:41 +11:00
|
|
|
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)
|
2019-12-09 05:43:41 +11:00
|
|
|
|
|
|
|
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
|
|
|
Keys.onReturnPressed: {
|
|
|
|
if (event.modifiers & Qt.ShiftModifier) {
|
2019-12-11 06:17:41 +11:00
|
|
|
mainPaneList.toggleCollapseAccount()
|
2019-12-09 05:43:41 +11:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-03-08 02:28:51 +11:00
|
|
|
if (window.settings.clearRoomFilterOnEnter) {
|
|
|
|
mainPaneList.setCollapseAccount(false)
|
|
|
|
text = ""
|
|
|
|
}
|
|
|
|
|
2020-03-08 02:17:48 +11:00
|
|
|
mainPaneList.requestActivate()
|
2019-08-16 01:29:22 +10:00
|
|
|
}
|
|
|
|
|
2019-12-09 05:43:41 +11:00
|
|
|
Keys.onEscapePressed: {
|
|
|
|
if (window.settings.clearRoomFilterOnEscape) text = ""
|
|
|
|
mainUI.pageLoader.forceActiveFocus()
|
|
|
|
}
|
2019-12-16 05:56:40 +11:00
|
|
|
|
2019-12-16 19:42:41 +11:00
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
2019-03-26 09:29:46 +11:00
|
|
|
}
|
|
|
|
}
|