From e80132cdef038fdff253f59979fbb8789e325315 Mon Sep 17 00:00:00 2001
From: Joakim Bygdell <j.bygdell@gmail.com>
Date: Wed, 19 Jul 2017 20:57:12 +0200
Subject: [PATCH] QML UI: move location service to preferences page

Move the locations service switch to the GPS section of  the preferences page.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
---
 mobile-widgets/qml/Preferences.qml | 35 +++++++++++++++++++++
 mobile-widgets/qml/main.qml        | 49 ------------------------------
 2 files changed, 35 insertions(+), 49 deletions(-)

diff --git a/mobile-widgets/qml/Preferences.qml b/mobile-widgets/qml/Preferences.qml
index 2a12e71ac..7335b0a31 100644
--- a/mobile-widgets/qml/Preferences.qml
+++ b/mobile-widgets/qml/Preferences.qml
@@ -278,6 +278,41 @@ Kirigami.ScrollablePage {
 				Layout.fillHeight: true
 			}
 		}
+		GridLayout {
+			id: locationService
+			columns: 2
+			width: parent.width
+			CheckBox {
+				id: locationCheckbox
+				visible: manager.locationServiceAvailable
+				checked: manager.locationServiceEnabled
+				onClicked: {
+					manager.locationServiceEnabled = checked
+				}
+				indicator: Rectangle {
+					implicitWidth: 20
+					implicitHeight: 20
+					x: locationCheckbox.leftPadding
+					y: parent.height / 2 - height / 2
+					radius: 4
+					border.color: locationCheckbox.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
+					color: subsurfaceTheme.backgroundColor
+
+					Rectangle {
+						width: 12
+						height: 12
+						x: 4
+						y: 4
+						radius: 3
+						color: locationCheckbox.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
+						visible: locationCheckbox.checked
+					}
+				}
+			}
+			Kirigami.Label {
+				text: qsTr("Run location service")
+			}
+		}
 		GridLayout {
 			id: libdclogprefs
 			columns: 2
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 9dedb190b..0ba47743e 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -290,55 +290,6 @@ if you have network connectivity and want to sync your data to cloud storage."),
 			}
 		] // end actions
 
-		MouseArea {
-			height: childrenRect.height
-			width: Kirigami.Units.gridUnit * 10
-			CheckBox {
-				//text: qsTr("Run location service")
-				id: locationCheckbox
-				visible: manager.locationServiceAvailable
-				anchors {
-					left: parent.left
-					top: parent.top
-				}
-				checked: manager.locationServiceEnabled
-				onCheckedChanged: {
-					manager.locationServiceEnabled = checked;
-				}
-				indicator: Rectangle {
-					implicitWidth: 20
-					implicitHeight: 20
-					x: locationCheckbox.leftPadding
-					y: parent.height / 2 - height / 2
-					radius: 4
-					border.color: locationCheckbox.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
-					color: subsurfaceTheme.drawerColor
-
-					Rectangle {
-						width: 12
-						height: 12
-						x: 4
-						y: 4
-						radius: 3
-						color: locationCheckbox.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
-						visible: locationCheckbox && locationCheckbox.checked
-					}
-				}
-			}
-			Kirigami.Label {
-				x: Kirigami.Units.gridUnit * 1.5
-				anchors {
-					left: locationCheckbox.right
-					//leftMargin: units.smallSpacing
-					verticalCenter: locationCheckbox.verticalCenter
-				}
-				text: Qt.platform.os == "ios" ? "" : manager.locationServiceAvailable ? qsTr("Run location service") : qsTr("No GPS source available")
-			}
-			onClicked: {
-				print("Click.")
-				locationCheckbox.checked = !locationCheckbox.checked
-			}
-		}
 	}
 
 	function blueTheme() {