Changeset View
Changeset View
Standalone View
Standalone View
kcms/nightcolor/package/contents/ui/LocationsFixedView.qml
Show All 9 Lines | |||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | *********************************************************************/ | 16 | *********************************************************************/ | ||
17 | import QtQuick 2.1 | 17 | import QtQuick 2.1 | ||
18 | import org.kde.kirigami 2.5 as Kirigami | 18 | import QtQuick.Layouts 1.1 | ||
19 | import QtQuick.Controls 2.5 as QQC2 | 19 | import QtQuick.Controls 2.5 as QQC2 | ||
20 | import org.kde.kirigami 2.5 as Kirigami | ||||
20 | 21 | | |||
21 | Kirigami.FormLayout { | 22 | Kirigami.FormLayout { | ||
22 | twinFormLayouts: parentLayout | 23 | twinFormLayouts: parentLayout | ||
23 | enabled: activator.checked | | |||
24 | 24 | | |||
25 | Connections { | 25 | Connections { | ||
26 | target: root | 26 | target: root | ||
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 | // Match combobox width | ||||
38 | Layout.minimumWidth: modeSwitcher.width | ||||
39 | icon.name: "find-location" | ||||
40 | onClicked: { | ||||
41 | latitudeFixedField.backend = locator.latitude; | ||||
42 | longitudeFixedField.backend = locator.longitude; | ||||
43 | } | ||||
44 | } | ||||
45 | | ||||
35 | NumberField { | 46 | NumberField { | ||
36 | id: latitudeFixedField | 47 | id: latitudeFixedField | ||
48 | // Match combobox width | ||||
49 | Layout.minimumWidth: modeSwitcher.width | ||||
37 | Kirigami.FormData.label: i18n("Latitude:") | 50 | Kirigami.FormData.label: i18n("Latitude:") | ||
38 | backend: cA.latitudeFixedStaged | 51 | backend: cA.latitudeFixedStaged | ||
39 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | 52 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | ||
40 | onBackendChanged: { | 53 | onBackendChanged: { | ||
41 | cA.latitudeFixedStaged = backend; | 54 | cA.latitudeFixedStaged = backend; | ||
42 | manualLocationsViewRow.change(); | | |||
43 | calcNeedsSave(); | 55 | calcNeedsSave(); | ||
44 | } | 56 | } | ||
45 | } | 57 | } | ||
46 | 58 | | |||
47 | NumberField { | 59 | NumberField { | ||
48 | id: longitudeFixedField | 60 | id: longitudeFixedField | ||
61 | // Match combobox width | ||||
62 | Layout.minimumWidth: modeSwitcher.width | ||||
49 | Kirigami.FormData.label: i18n("Longitude:") | 63 | Kirigami.FormData.label: i18n("Longitude:") | ||
50 | backend: cA.longitudeFixedStaged | 64 | backend: cA.longitudeFixedStaged | ||
51 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | 65 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | ||
52 | onBackendChanged: { | 66 | onBackendChanged: { | ||
53 | cA.longitudeFixedStaged = backend; | 67 | cA.longitudeFixedStaged = backend; | ||
54 | manualLocationsViewRow.change(); | | |||
55 | calcNeedsSave(); | 68 | calcNeedsSave(); | ||
56 | } | 69 | } | ||
57 | } | 70 | } | ||
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 | } | 71 | } |