Warning, /network/neochat/src/qml/QuickSwitcher.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 0005 import QtQuick.Controls as QQC2 0006 import QtQuick.Layouts 0007 0008 import org.kde.kirigami as Kirigami 0009 import org.kde.kitemmodels 0010 0011 import org.kde.neochat 0012 0013 QQC2.Dialog { 0014 id: root 0015 0016 required property NeoChatConnection connection 0017 0018 parent: applicationWindow().overlay 0019 width: Math.min(700, parent.width) 0020 height: 400 0021 0022 leftPadding: 0 0023 rightPadding: 0 0024 bottomPadding: 1 0025 topPadding: 0 0026 0027 anchors.centerIn: applicationWindow().overlay 0028 0029 0030 Shortcut { 0031 sequence: "Ctrl+K" 0032 onActivated: root.open() 0033 } 0034 0035 onVisibleChanged: { 0036 if (!visible) { 0037 return 0038 } 0039 searchField.forceActiveFocus() 0040 searchField.text = "" 0041 roomList.currentIndex = 0 0042 } 0043 0044 header: Kirigami.SearchField { 0045 id: searchField 0046 Keys.onDownPressed: { 0047 roomList.forceActiveFocus() 0048 if (roomList.currentIndex < roomList.count - 1) { 0049 roomList.currentIndex++ 0050 } else { 0051 roomList.currentIndex = 0 0052 } 0053 } 0054 Keys.onUpPressed: { 0055 if (roomList.currentIndex === 0) { 0056 roomList.currentIndex = roomList.count - 1 0057 } else { 0058 roomList.currentIndex-- 0059 } 0060 } 0061 Keys.onEnterPressed: { 0062 RoomManager.enterRoom(roomList.currentItem.currentRoom); 0063 root.close(); 0064 } 0065 Keys.onReturnPressed: { 0066 RoomManager.enterRoom(roomList.currentItem.currentRoom); 0067 root.close(); 0068 } 0069 focusSequence: "" 0070 } 0071 0072 QQC2.ScrollView { 0073 anchors.fill: parent 0074 clip: true 0075 0076 Keys.forwardTo: searchField 0077 0078 ListView { 0079 id: roomList 0080 0081 currentIndex: 0 0082 highlightMoveDuration: 200 0083 Keys.forwardTo: searchField 0084 keyNavigationEnabled: true 0085 model: SortFilterRoomListModel { 0086 filterText: searchField.text 0087 sourceModel: RoomListModel { 0088 id: roomListModel 0089 connection: root.connection 0090 } 0091 } 0092 0093 delegate: RoomDelegate { 0094 filterText: searchField.text 0095 0096 connection: root.connection 0097 0098 onSelected: { 0099 RoomManager.enterRoom(currentRoom); 0100 root.close() 0101 } 0102 0103 Keys.onEnterPressed: { 0104 RoomManager.enterRoom(currentRoom); 0105 root.close(); 0106 } 0107 0108 Keys.onReturnPressed: { 0109 RoomManager.enterRoom(currentRoom); 0110 root.close(); 0111 } 0112 } 0113 } 0114 } 0115 }