Kstars

LocationDialog.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Window 2.2
6import QtQuick.Layouts 1.1
7import QtQuick.Controls 2.0
8import QtQuick.Controls.Material 2.0
9import QtQuick.Controls.Universal 2.0
10import "../constants" 1.0
11import "../modules"
12
13KSPage {
14 title: xi18n("Set Geolocation")
15
16 function filterCities() {
17 LocationDialogLite.filterCity(cityFilter.text, provinceFilter.text, countryFilter.text)
18 }
19
20 onVisibleChanged: {
21 filterCities()
22 }
23
24 ColumnLayout {
25 id: locationColumn
26 spacing: 5 * Num.dp
27 anchors{
28 fill: parent
29 bottomMargin: 15 * Num.dp
30 }
31
32 Flow {
33 anchors {
34 left: parent.left
35 right: parent.right
36 }
37
38 KSLabel {
39 text: xi18n("Current Location: ")
40 }
41
42 KSLabel {
43 text: LocationDialogLite.currentLocation
44 }
45 }
46
47 Rectangle {
48 Layout.fillWidth: true
49 height: 1
50 color: "grey"
51 }
52
53 GridLayout {
54 Layout.fillWidth: true
55 Layout.fillHeight: true
56
57 flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight
58
59 RowLayout {
60 Layout.fillWidth: true
61 Layout.fillHeight: true
62 KSLabel {
63 text: xi18n("City filter: ")
64 }
65 KSTextField {
66 id: cityFilter
67 Layout.fillWidth: true
68 onTextChanged: {
69 filterCities()
70 }
71 }
72 }
73
74 RowLayout {
75 Layout.fillWidth: true
76 Layout.fillHeight: true
77 KSLabel {
78 text: xi18n("Province filter: ")
79 }
80
81 KSTextField {
82 id: provinceFilter
83 Layout.fillWidth: true
84 onTextChanged: {
85 filterCities()
86 }
87 }
88 }
89
90 RowLayout {
91 Layout.fillWidth: true
92 Layout.fillHeight: true
93 KSLabel {
94 text: xi18n("Country filter: ")
95 }
96 KSTextField {
97 id: countryFilter
98 Layout.fillWidth: true
99 onTextChanged: {
100 filterCities()
101 }
102 }
103 }
104 }
105
106 KSListView {
107 model: CitiesModel
108 textRole: "display"
109
110 Layout.fillWidth: true
111 Layout.fillHeight: true
112
113 checkCurrent: true
114 currentIndex: LocationDialogLite.currLocIndex
115 onClickCheck: false
116
117 onClicked: {
118 locationsGeoMenu.openMenu(text)
119 }
120 }
121
122 Button {
123 anchors {
124 bottom: parent.bottom
125 }
126
127 text: xi18n("Add Location")
128 onClicked: {
129 locationEdit.openAdd()
130 }
131 }
132
133 Button {
134 anchors {
135 bottom: parent.bottom
136 right: parent.right
137 }
138
139 text: xi18n("Set from GPS")
140 onClicked: {
141 locationEdit.setAutomaticallyFromGPS()
142 }
143 }
144 }
145}
A backend of location dialog declared in QML.
QString xi18n(const char *text, const TYPE &arg...)
KGUIADDONS_EXPORT QWindow * window(QObject *job)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.