Warning, /education/kstars/kstars/kstarslite/qml/dialogs/FindDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.6
0005 import QtQuick.Window 2.2
0006 import QtQuick.Layouts 1.1
0007 import QtQuick.Controls 2.0
0008 import QtQuick.Controls.Material 2.0
0009 import QtQuick.Controls.Universal 2.0
0010 import "../constants" 1.0
0011 import "../modules"
0012 
0013 KSPage {
0014     title: xi18n("Find an Object")
0015     onVisibleChanged: {
0016         if(visible) {
0017             typeChoose.currentIndex = 0
0018             searchQuery.text = ""
0019         }
0020     }
0021 
0022     ColumnLayout {
0023         id: findColumn
0024         anchors.fill: parent
0025         spacing: 5 * Num.dp
0026         anchors{
0027             bottom: parent.bottom
0028             bottomMargin: 15 * Num.dp
0029         }
0030 
0031         RowLayout {
0032             anchors {
0033                 left: parent.left
0034                 right: parent.right
0035             }
0036             KSLabel {
0037                 text: xi18n("Filter by name: ")
0038             }
0039             KSTextField {
0040                 id: searchQuery
0041                 Layout.fillWidth: true
0042                 onTextChanged: {
0043                     FindDialogLite.filterList(text)
0044                 }
0045             }
0046         }
0047 
0048         RowLayout {
0049             anchors {
0050                 left: parent.left
0051                 right: parent.right
0052             }
0053             KSLabel {
0054                 text: xi18n("Filter by type: ")
0055             }
0056 
0057             Item {
0058                 //Spacer
0059                 Layout.minimumWidth: 30 * Num.dp
0060                 Layout.fillWidth: true
0061             }
0062 
0063             ComboBox {
0064                 id: typeChoose
0065                 model: FindDialogLite.filterModel
0066                 Layout.fillWidth: true
0067 
0068                 //Init list with objects when everything is loaded
0069                 Connections {
0070                     target: window
0071                     onLoaded: {
0072                         if(isLoaded) FindDialogLite.filterByType(typeChoose.currentIndex)
0073                     }
0074                 }
0075 
0076                 onCurrentIndexChanged: {
0077                     if(isLoaded) FindDialogLite.filterByType(currentIndex)
0078                 }
0079             }
0080         }
0081 
0082         KSListView {
0083             model: SortModel
0084             textRole: "name"
0085 
0086             Layout.fillWidth: true
0087             Layout.fillHeight: true
0088 
0089             onClicked: {
0090                 stackView.replace(null, initPage)
0091                 FindDialogLite.selectObject(index)
0092             }
0093         }
0094 
0095         RowLayout {
0096             KSButton {
0097                 id: searchInInternet
0098                 enabled: searchQuery.text.length > 0 && FindDialogLite.isResolveEnabled
0099 
0100                 text: xi18n("Search in internet")
0101                 onClicked: {
0102                     FindDialogLite.resolveInInternet(searchQuery.text)
0103                 }
0104             }
0105 
0106             KSButton {
0107                 text: xi18n("Cancel")
0108                 onClicked: {
0109                     stackView.pop()
0110                 }
0111             }
0112         }
0113     }
0114 }
0115