Warning, /network/neochat/src/qml/SearchPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 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 0010 import org.kde.neochat 0011 0012 Kirigami.ScrollablePage { 0013 id: root 0014 0015 property NeoChatRoom currentRoom 0016 required property NeoChatConnection connection 0017 0018 title: i18nc("@action:title", "Search Messages") 0019 0020 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0021 0022 SearchModel { 0023 id: searchModel 0024 connection: root.connection 0025 searchText: searchField.text 0026 room: root.currentRoom 0027 } 0028 0029 header: QQC2.Control { 0030 padding: Kirigami.Units.largeSpacing 0031 0032 background: Rectangle { 0033 color: Kirigami.Theme.backgroundColor 0034 0035 Kirigami.Separator { 0036 anchors { 0037 left: parent.left 0038 bottom: parent.bottom 0039 right: parent.right 0040 } 0041 } 0042 } 0043 0044 contentItem: RowLayout { 0045 spacing: Kirigami.Units.largeSpacing 0046 0047 Kirigami.SearchField { 0048 id: searchField 0049 focus: true 0050 Layout.fillWidth: true 0051 Keys.onEnterPressed: searchButton.clicked() 0052 Keys.onReturnPressed: searchButton.clicked() 0053 } 0054 QQC2.Button { 0055 id: searchButton 0056 onClicked: searchModel.search() 0057 icon.name: "search" 0058 } 0059 } 0060 } 0061 0062 ListView { 0063 id: messageListView 0064 Layout.fillWidth: true 0065 Layout.fillHeight: true 0066 spacing: 0 0067 verticalLayoutDirection: ListView.BottomToTop 0068 0069 section.property: "section" 0070 0071 Kirigami.PlaceholderMessage { 0072 anchors.centerIn: parent 0073 visible: searchField.text.length === 0 && messageListView.count === 0 0074 text: i18n("Enter a text to start searching") 0075 } 0076 0077 Kirigami.PlaceholderMessage { 0078 anchors.centerIn: parent 0079 visible: searchField.text.length > 0 && messageListView.count === 0 && !searchModel.searching 0080 text: i18n("No results found") 0081 } 0082 0083 Kirigami.LoadingPlaceholder { 0084 anchors.centerIn: parent 0085 visible: searchModel.searching 0086 } 0087 0088 model: searchModel 0089 delegate: EventDelegate { 0090 connection: root.connection 0091 } 0092 } 0093 }