-import QtQuick 1.0
-import com.meego 1.0
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import QtWebKit 1.0
Page {
id: mainPage
- orientationLock: PageOrientation.LockLandscape
+ orientationLock: PageOrientation.LockPortrait
Column {
spacing: 16
Row {
- width: rootWindow.width
+// width: rootWindow.width
Button {
- id: do_auth
+ id: do_staff
width: rootWindow.width / 3
- text: "Auth"
+ text: "..."
enabled: false
onClicked: {
- Qt.openUrlExternally(latitude.getUserAuthorization())
- }
- }
- Button {
- id: do_start
- width: rootWindow.width / 3
- text: "Start"
- enabled: false
- onClicked: {
- do_start.enabled = false;
- do_stop.enabled = true;
- if (!demonio.demonio_start()) {
- gps.startUpdates()
- }
- }
- }
- Button {
- id: do_stop
- width: rootWindow.width / 3
- text: "Stop"
- enabled: false
- onClicked: {
- do_start.enabled = true;
- do_stop.enabled = false;
- if (!demonio.demonio_stop()) {
- gps.stopUpdates(true)
+ if (text.match("Start")) {
+ console.log("match start")
+ if (!demonio.demonio_start()) {
+ gps.startUpdates()
+ }
+ text = "Stop"
+ } else if (text.match("Stop")) {
+ console.log("match stop")
+ if (!demonio.demonio_stop()) {
+ gps.stopUpdates(true)
+ }
+ text = "Start"
}
}
}
Label {
id: method_label
text: "Method"
- width: rootWindow.width / 4
+ width: mainPage.width / 4
anchors.verticalCenter: method_button.verticalCenter
}
- ButtonRow {
+ ButtonColumn {
id: method_button
- width: rootWindow.width * 2 / 3
+ width: mainPage.width * 1 / 3
Button {
id: method_cell
text: "Cell Tower"
}
Slider {
id: timeout_slider
- width: rootWindow.width / 2
+ width: rootWindow.width / 4
valueIndicatorVisible: true
minimumValue: 5
maximumValue: 120
}
Slider {
id: interval_slider
- width: rootWindow.width / 2
+ width: rootWindow.width / 4
valueIndicatorVisible: true
minimumValue: 5
maximumValue: 60
}
Switch {
id: connect_switch
- width: rootWindow.width / 2
+ width: rootWindow.width / 4
checked: latitude.getAutoConnect() ? true : false
onCheckedChanged: {
connect_value.text = checked
anchors.verticalCenter: connect_switch.verticalCenter
}
}
+ Row {
+ Label {
+ id: daemon_label
+ text: "Daemon at boot time"
+ width: rootWindow.width / 4
+ anchors.verticalCenter: daemon_switch.verticalCenter
+ }
+ Switch {
+ id: daemon_switch
+ width: rootWindow.width / 4
+ checked: latitude.getDaemonMode() ? true : false
+ onCheckedChanged: {
+ daemon_value.text = checked
+ latitude.setDaemonMode(checked) }
+ }
+ Label {
+ id: daemon_value
+ text: daemon_switch.checked
+ width: rootWindow.width / 4
+ anchors.verticalCenter: daemon_switch.verticalCenter
+ }
+ }
Connections {
target: latitude
onGotToken: {
- do_auth.enabled = false;
if (demonio.demonio_status()) {
- do_start.enabled = false;
- do_stop.enabled = true;
+ do_staff.text = "Stop"
+ do_staff.enabled = true;
} else {
- do_start.enabled = true;
- do_stop.enabled = false;
+ do_staff.text = "Start"
+ do_staff.enabled = true;
}
+ pageStack.pop(login)
}
}
+
Connections {
target: latitude
onNotToken: {
- do_auth.enabled = true;
- do_start.enabled = false;
- do_stop.enabled = false;
+ do_staff.text = "..."
+ do_staff.enabled = false;
if (!demonio.demonio_stop()) {
gps.stopUpdates(true)
}
+ latitude.getAccess()
}
}
Connections {
target: latitude
onNeedAuth: {
- do_auth.enabled = true;
+ pageStack.push(login)
}
}
}
}
}
+
+ Component {
+ id: login
+ Page {
+ orientationLock: PageOrientation.LockPortrait
+ Flickable {
+ id: flickable
+ width: parent.width
+ height: parent.height
+ contentWidth: webView.width
+ contentHeight: webView.height
+ WebView {
+ id: webView
+ url: latitude.getUserAuthorization()
+ preferredWidth: parent.width
+ preferredHeight: parent.height
+ onLoadFinished: {
+ console.log(url)
+ flickable.contentY = 0;
+ if (url.toString().match("ServiceLogin")) {
+ console.log("* QML WebView go w/2,0")
+ flickable.contentX = width/2;
+ } else {
+ console.log("* QML WebView go 0,0")
+ flickable.contentX = 0;
+ }
+ }
+ }
+ }
+ }
+ }
}