Changeset View
Changeset View
Standalone View
Standalone View
kcms/nightcolor/package/contents/ui/LocationsFixedView.qml
Show All 26 Lines | 25 | Connections { | |||
---|---|---|---|---|---|
27 | onReset: reset() | 27 | onReset: reset() | ||
28 | } | 28 | } | ||
29 | 29 | | |||
30 | function reset() { | 30 | function reset() { | ||
31 | latitudeFixedField.backend = cA.latitudeFixed; | 31 | latitudeFixedField.backend = cA.latitudeFixed; | ||
32 | longitudeFixedField.backend = cA.longitudeFixed; | 32 | longitudeFixedField.backend = cA.longitudeFixed; | ||
33 | } | 33 | } | ||
34 | 34 | | |||
35 | QQC2.Button { | ||||
36 | text: i18n("Detect Location") | ||||
37 | implicitWidth: longitudeFixedField.width // TODO: see if there is a smarter way for doing this | ||||
38 | icon.name: "find-location" | ||||
39 | onClicked: { | ||||
40 | latitudeFixedField.backend = locator.latitude; | ||||
41 | longitudeFixedField.backend = locator.longitude; | ||||
42 | } | ||||
43 | } | ||||
44 | | ||||
35 | NumberField { | 45 | NumberField { | ||
36 | id: latitudeFixedField | 46 | id: latitudeFixedField | ||
37 | Kirigami.FormData.label: i18n("Latitude:") | 47 | Kirigami.FormData.label: i18n("Latitude:") | ||
38 | backend: cA.latitudeFixedStaged | 48 | backend: cA.latitudeFixedStaged | ||
39 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | 49 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | ||
40 | onBackendChanged: { | 50 | onBackendChanged: { | ||
41 | cA.latitudeFixedStaged = backend; | 51 | cA.latitudeFixedStaged = backend; | ||
42 | manualLocationsViewRow.change(); | 52 | manualLocationsViewRow.change(); | ||
43 | calcNeedsSave(); | 53 | calcNeedsSave(); | ||
44 | } | 54 | } | ||
45 | } | 55 | } | ||
46 | 56 | | |||
47 | NumberField { | 57 | NumberField { | ||
48 | id: longitudeFixedField | 58 | id: longitudeFixedField | ||
49 | Kirigami.FormData.label: i18n("Longitude:") | 59 | Kirigami.FormData.label: i18n("Longitude:") | ||
50 | backend: cA.longitudeFixedStaged | 60 | backend: cA.longitudeFixedStaged | ||
51 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | 61 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | ||
52 | onBackendChanged: { | 62 | onBackendChanged: { | ||
53 | cA.longitudeFixedStaged = backend; | 63 | cA.longitudeFixedStaged = backend; | ||
54 | manualLocationsViewRow.change(); | 64 | manualLocationsViewRow.change(); | ||
55 | calcNeedsSave(); | 65 | calcNeedsSave(); | ||
56 | } | 66 | } | ||
57 | } | 67 | } | ||
58 | | ||||
59 | QQC2.Button { | | |||
60 | text: i18n("Detect Location") | | |||
61 | implicitWidth: longitudeFixedField.width // TODO: see if there is a smarter way for doing this | | |||
62 | icon.name: "find-location" | | |||
63 | onClicked: { | | |||
64 | latitudeFixedField.backend = locator.latitude; | | |||
65 | longitudeFixedField.backend = locator.longitude; | | |||
66 | } | | |||
67 | } | | |||
68 | } | 68 | } |