Remove search bar; Use QuickSwitcher instead
This commit is contained in:
@@ -17,7 +17,7 @@ RowLayout {
|
||||
property bool collapsed: false
|
||||
required property NeoChatConnection connection
|
||||
|
||||
property alias roomSearchFieldFocussed: roomSearchField.activeFocus
|
||||
signal search
|
||||
|
||||
property Kirigami.Action exploreAction: Kirigami.Action {
|
||||
text: i18n("Explore rooms")
|
||||
@@ -83,14 +83,30 @@ RowLayout {
|
||||
*/
|
||||
signal textChanged(string newText)
|
||||
|
||||
Kirigami.SearchField {
|
||||
id: roomSearchField
|
||||
Layout.topMargin: Kirigami.Units.smallSpacing
|
||||
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
||||
Item {
|
||||
Layout.preferredWidth: Kirigami.Units.largeSpacing
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: root.desiredWidth ? root.desiredWidth - menuButton.width - root.spacing : -1
|
||||
visible: !root.collapsed
|
||||
onTextChanged: root.textChanged(text)
|
||||
text: i18nc("@title", "Rooms")
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
visible: root.collapsed
|
||||
}
|
||||
|
||||
QQC2.ToolButton {
|
||||
id: searchButton
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
onClicked: root.search();
|
||||
icon.name: "search"
|
||||
text: i18nc("@action", "Search Room")
|
||||
Shortcut {
|
||||
sequence: "Ctrl+F"
|
||||
onActivated: searchButton.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
QQC2.ToolButton {
|
||||
|
||||
@@ -98,12 +98,9 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: quickView
|
||||
active: !Kirigami.Settings.isMobile
|
||||
sourceComponent: QuickSwitcher {
|
||||
connection: root.connection
|
||||
}
|
||||
QuickSwitcher {
|
||||
id: quickSwitcher
|
||||
connection: root.connection
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -226,6 +223,8 @@ Kirigami.ApplicationWindow {
|
||||
RoomListPage {
|
||||
id: roomList
|
||||
|
||||
onSearch: quickSwitcher.open()
|
||||
|
||||
connection: root.connection
|
||||
|
||||
Shortcut {
|
||||
|
||||
@@ -6,6 +6,7 @@ import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.components
|
||||
import org.kde.kitemmodels
|
||||
|
||||
import org.kde.neochat
|
||||
@@ -19,10 +20,10 @@ QQC2.Dialog {
|
||||
width: Math.min(700, parent.width)
|
||||
height: 400
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
bottomPadding: 1
|
||||
topPadding: 0
|
||||
leftPadding: Kirigami.Units.smallSpacing
|
||||
rightPadding: Kirigami.Units.smallSpacing
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
topPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
anchors.centerIn: applicationWindow().overlay
|
||||
|
||||
@@ -40,53 +41,60 @@ QQC2.Dialog {
|
||||
roomList.currentIndex = 0;
|
||||
}
|
||||
|
||||
header: Kirigami.SearchField {
|
||||
id: searchField
|
||||
Keys.onDownPressed: {
|
||||
roomList.forceActiveFocus();
|
||||
if (roomList.currentIndex < roomList.count - 1) {
|
||||
roomList.currentIndex++;
|
||||
} else {
|
||||
roomList.currentIndex = 0;
|
||||
background: DialogRoundedBackground {}
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
Kirigami.SearchField {
|
||||
id: searchField
|
||||
Layout.fillWidth: true
|
||||
Keys.onDownPressed: {
|
||||
roomList.forceActiveFocus();
|
||||
if (roomList.currentIndex < roomList.count - 1) {
|
||||
roomList.currentIndex++;
|
||||
} else {
|
||||
roomList.currentIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Keys.onUpPressed: {
|
||||
if (roomList.currentIndex === 0) {
|
||||
roomList.currentIndex = roomList.count - 1;
|
||||
} else {
|
||||
roomList.currentIndex--;
|
||||
Keys.onUpPressed: {
|
||||
if (roomList.currentIndex === 0) {
|
||||
roomList.currentIndex = roomList.count - 1;
|
||||
} else {
|
||||
roomList.currentIndex--;
|
||||
}
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
RoomManager.resolveResource(roomList.currentItem.currentRoom.id);
|
||||
root.close();
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
RoomManager.resolveResource(roomList.currentItem.currentRoom.id);
|
||||
root.close();
|
||||
}
|
||||
focusSequence: ""
|
||||
onTextChanged: RoomManager.sortFilterRoomListModel.filterText = text
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
RoomManager.resolveResource(roomList.currentItem.currentRoom.id);
|
||||
root.close();
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
RoomManager.resolveResource(roomList.currentItem.currentRoom.id);
|
||||
root.close();
|
||||
}
|
||||
focusSequence: ""
|
||||
onTextChanged: RoomManager.sortFilterRoomListModel.filterText = text
|
||||
}
|
||||
|
||||
QQC2.ScrollView {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
QQC2.ScrollView {
|
||||
clip: true
|
||||
|
||||
Keys.forwardTo: searchField
|
||||
|
||||
ListView {
|
||||
id: roomList
|
||||
|
||||
currentIndex: 0
|
||||
highlightMoveDuration: 200
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Keys.forwardTo: searchField
|
||||
keyNavigationEnabled: true
|
||||
model: RoomManager.sortFilterRoomListModel
|
||||
|
||||
delegate: RoomDelegate {
|
||||
connection: root.connection
|
||||
onClicked: root.close()
|
||||
ListView {
|
||||
id: roomList
|
||||
|
||||
currentIndex: 0
|
||||
highlightMoveDuration: 200
|
||||
Keys.forwardTo: searchField
|
||||
keyNavigationEnabled: true
|
||||
model: RoomManager.sortFilterRoomListModel
|
||||
|
||||
delegate: RoomDelegate {
|
||||
connection: root.connection
|
||||
onClicked: root.close()
|
||||
showConfigure: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ Delegates.RoundedItemDelegate {
|
||||
required property string subtitleText
|
||||
required property string displayName
|
||||
|
||||
property bool showConfigure: true
|
||||
|
||||
property bool collapsed: false
|
||||
|
||||
readonly property bool hasNotifications: contextNotificationCount > 0
|
||||
@@ -130,7 +132,7 @@ Delegates.RoundedItemDelegate {
|
||||
|
||||
QQC2.Button {
|
||||
id: configButton
|
||||
visible: root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList && !root.collapsed
|
||||
visible: root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList && !root.collapsed && root.showConfigure
|
||||
text: i18n("Configure room")
|
||||
display: QQC2.Button.IconOnly
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ Kirigami.Page {
|
||||
|
||||
readonly property bool collapsed: Config.collapsed
|
||||
|
||||
signal search
|
||||
|
||||
onCurrentWidthChanged: pageStack.defaultColumnWidth = root.currentWidth
|
||||
Component.onCompleted: pageStack.defaultColumnWidth = root.currentWidth
|
||||
|
||||
@@ -164,22 +166,6 @@ Kirigami.Page {
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "search"
|
||||
delegate: Delegates.RoundedItemDelegate {
|
||||
required property TreeView treeView
|
||||
|
||||
implicitWidth: treeView.width
|
||||
onClicked: quickView.item.open()
|
||||
|
||||
contentItem: Kirigami.Icon {
|
||||
width: Kirigami.Units.iconSizes.smallMedium
|
||||
height: Kirigami.Units.iconSizes.smallMedium
|
||||
source: "search"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "addDirect"
|
||||
delegate: Delegates.RoundedItemDelegate {
|
||||
@@ -312,6 +298,8 @@ Kirigami.Page {
|
||||
collapsed: root.collapsed
|
||||
connection: root.connection
|
||||
|
||||
onSearch: root.search()
|
||||
|
||||
onTextChanged: newText => {
|
||||
RoomManager.sortFilterRoomTreeModel.filterText = newText;
|
||||
treeView.expandRecursively();
|
||||
|
||||
Reference in New Issue
Block a user