Kstars

LocationDialog.qml
1 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 import QtQuick 2.6
5 import QtQuick.Window 2.2
6 import QtQuick.Layouts 1.1
7 import QtQuick.Controls 2.0
8 import QtQuick.Controls.Material 2.0
9 import QtQuick.Controls.Universal 2.0
10 import "../constants" 1.0
11 import "../modules"
12 
13 KSPage {
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 }
QTextStream & right(QTextStream &stream)
QTextStream & left(QTextStream &stream)
QString xi18n(const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &s)
QTextStream & right(QTextStream &s)
KJOBWIDGETS_EXPORT QWidget * window(KJob *job)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:13:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.