summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>2019-09-22 20:56:19 +0800
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>2019-09-22 20:56:19 +0800
commit57881a95bf730dec7dd010bc086a5c42003840d4 (patch)
tree46c93228a9c74366026ceb45b282767e5e9564a6 /app
parentae47635e56c4af4d816a76e5186e945768543679 (diff)
Message: == and != may perform type coercion, use === or !== to avoid it. Description: The non-strict equality comparison is allowed to convert its arguments to a common type. That can lead to unexpected results such as ' \t\r\n' == 0 being true. Use the strict equality operators === and !== and be explicit about conversions you require. Bug-AGL: SPEC-2814 Change-Id: I4dd5848797f445d082242a5c5e2a0148ea790dc0 Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
Diffstat (limited to 'app')
-rw-r--r--app/api/GPS.qml2
-rw-r--r--app/api/GeoFence.qml2
-rw-r--r--app/forms/RouteList.qml4
-rw-r--r--app/map/MapComponent.qml12
-rw-r--r--app/map/Marker.qml2
-rw-r--r--app/mapviewer.qml10
6 files changed, 16 insertions, 16 deletions
diff --git a/app/api/GPS.qml b/app/api/GPS.qml
index 679c66e..95c7712 100644
--- a/app/api/GPS.qml
+++ b/app/api/GPS.qml
@@ -55,7 +55,7 @@ WebSocket {
case msgid.event:
var payload = JSON.parse(JSON.stringify(json[2]))
var event = payload.event
- if (event == "gps/location") {
+ if (event === "gps/location") {
var data = json[2].data
var latitude = data.latitude
var longitude = data.longitude
diff --git a/app/api/GeoFence.qml b/app/api/GeoFence.qml
index 7061984..a39eecb 100644
--- a/app/api/GeoFence.qml
+++ b/app/api/GeoFence.qml
@@ -55,7 +55,7 @@ WebSocket {
case msgid.event:
var payload = JSON.parse(JSON.stringify(json[2]))
var event = payload.event
- if (event == "geofence/fence") {
+ if (event === "geofence/fence") {
var data = json[2].data
console.log("geofence event - name: " + data.name + " state: " + data.state)
}
diff --git a/app/forms/RouteList.qml b/app/forms/RouteList.qml
index 27fa572..e37b581 100644
--- a/app/forms/RouteList.qml
+++ b/app/forms/RouteList.qml
@@ -79,8 +79,8 @@ ListView {
}
}
//! [routeinfomodel2]
- totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime)
- totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance)
+ totalTravelTime = routeModel.count === 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime)
+ totalDistance = routeModel.count === 0 ? "" : Helper.formatDistance(routeModel.get(0).distance)
}
//! [routeinfomodel3]
}
diff --git a/app/map/MapComponent.qml b/app/map/MapComponent.qml
index 161038c..87ad74a 100644
--- a/app/map/MapComponent.qml
+++ b/app/map/MapComponent.qml
@@ -181,7 +181,7 @@ Map {
{
var count = map.mapItems.length
var co = Qt.createComponent(item+'.qml')
- if (co.status == Component.Ready) {
+ if (co.status === Component.Ready) {
var o = co.createObject(map)
o.setGeometry(map.markers, currentMarker)
map.addMapItem(o)
@@ -204,13 +204,13 @@ Map {
var myArray = new Array()
var count = map.markers.length
for (var i = 0; i<count; i++){
- if (index != i) myArray.push(map.markers[i])
+ if (index !== i) myArray.push(map.markers[i])
}
map.removeMapItem(map.markers[index])
map.markers[index].destroy()
map.markers = myArray
- if (markers.length == 0) markerCounter = 0
+ if (markers.length === 0) markerCounter = 0
}
function calculateMarkerRoute()
@@ -526,7 +526,7 @@ Map {
}
onPositionChanged: {
- if (mouse.button == Qt.LeftButton) {
+ if (mouse.button === Qt.LeftButton) {
map.lastX = mouse.x + parent.x
map.lastY = mouse.y + parent.y
}
@@ -596,7 +596,7 @@ Map {
if (pressed) parent.radius = parent.center.distanceTo(
map.toCoordinate(Qt.point(mouse.x, mouse.y)))
}
- if (mouse.button == Qt.LeftButton) {
+ if (mouse.button === Qt.LeftButton) {
map.lastX = mouse.x + parent.x
map.lastY = mouse.y + parent.y
}
@@ -656,7 +656,7 @@ Map {
}
onPositionChanged: {
- if (mouse.button == Qt.LeftButton) {
+ if (mouse.button === Qt.LeftButton) {
map.lastX = mouse.x
map.lastY = mouse.y
}
diff --git a/app/map/Marker.qml b/app/map/Marker.qml
index 3c0ed17..ada7954 100644
--- a/app/map/Marker.qml
+++ b/app/map/Marker.qml
@@ -74,7 +74,7 @@ MapQuickItem {
map.pressY = mouse.y
map.currentMarker = -1
for (var i = 0; i< map.markers.length; i++){
- if (marker == map.markers[i]){
+ if (marker === map.markers[i]){
map.currentMarker = i
break
}
diff --git a/app/mapviewer.qml b/app/mapviewer.qml
index 6240600..a92a9fd 100644
--- a/app/mapviewer.qml
+++ b/app/mapviewer.qml
@@ -449,8 +449,8 @@ ApplicationWindow {
stackView.showMessage(qsTr("Coordinates"),text);
}
onGeocodeFinished:{
- if (map.geocodeModel.status == GeocodeModel.Ready) {
- if (map.geocodeModel.count == 0) {
+ if (map.geocodeModel.status === GeocodeModel.Ready) {
+ if (map.geocodeModel.count === 0) {
stackView.showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"))
} else if (map.geocodeModel.count > 1) {
stackView.showMessage(qsTr("Ambiguous geocode"), map.geocodeModel.count + " " +
@@ -458,7 +458,7 @@ ApplicationWindow {
} else {
stackView.showMessage(qsTr("Location"), geocodeMessage(),page)
}
- } else if (map.geocodeModel.status == GeocodeModel.Error) {
+ } else if (map.geocodeModel.status === GeocodeModel.Error) {
stackView.showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"))
}
}
@@ -467,10 +467,10 @@ ApplicationWindow {
onShowGeocodeInfo: stackView.showMessage(qsTr("Location"),geocodeMessage(),page)
onErrorChanged: {
- if (map.error != Map.NoError) {
+ if (map.error !== Map.NoError) {
var title = qsTr("ProviderError")
var message = map.errorString + "<br/><br/><b>" + qsTr("Try to select other provider") + "</b>"
- if (map.error == Map.MissingRequiredParameterError)
+ if (map.error === Map.MissingRequiredParameterError)
message += "<br/>" + qsTr("or see") + " \'mapviewer --help\' "
+ qsTr("how to pass plugin parameters.")
stackView.showMessage(title,message);