From 6318feef026436ada12a9c44a0279d198ee3ae8c Mon Sep 17 00:00:00 2001 From: Li Xiaoming Date: Mon, 16 Sep 2019 11:04:24 +0800 Subject: fix: Remove qml M126 warning 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: I94130d38621a8775593edab63d409654dd758ef2 Signed-off-by: Li Xiaoming --- app/ContactsView.qml | 10 +++++----- app/Dialer.qml | 18 +++++++++--------- app/Recents.qml | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/ContactsView.qml b/app/ContactsView.qml index 5c2c327..66f2199 100644 --- a/app/ContactsView.qml +++ b/app/ContactsView.qml @@ -26,15 +26,15 @@ Item { id: root function display_type(type) { - if (type == PhoneNumber.CELL) { + if (type === PhoneNumber.CELL) { return "M" - } else if (type == PhoneNumber.WORK) { + } else if (type === PhoneNumber.WORK) { return "W" - } else if (type == PhoneNumber.HOME) { + } else if (type === PhoneNumber.HOME) { return "H" - } else if (type == PhoneNumber.FAX) { + } else if (type === PhoneNumber.FAX) { return "F" - } else if (type == PhoneNumber.VOICE) { + } else if (type === PhoneNumber.VOICE) { return "V" } else { return "O" diff --git a/app/Dialer.qml b/app/Dialer.qml index 11c190e..743c742 100644 --- a/app/Dialer.qml +++ b/app/Dialer.qml @@ -42,15 +42,15 @@ Item { } onCallStateChanged: { - if (telephony.callState == "incoming") { + if (telephony.callState === "incoming") { pbap.search(telephony.callClip) rejectButton.active = true callStateLabel.text = "Incoming call from " + telephony.callClip - } else if (telephony.callState == "dialing") { + } else if (telephony.callState === "dialing") { callStateLabel.text = "Dialing " + telephony.callColp - } else if (telephony.callState == "active") { + } else if (telephony.callState === "active") { rejectButton.active = false - } else if (telephony.callState == "disconnected") { + } else if (telephony.callState === "disconnected") { pbap.refreshCalls(100); rejectButton.active = false callButton.checked = false @@ -63,10 +63,10 @@ Item { target: pbap onSearchResults: { - if (name != "Not Found") { - if (telephony.callState == "incoming") { + if (name !== "Not Found") { + if (telephony.callState === "incoming") { callStateLabel.text = "Incoming call from " + name - } else if (telephony.callState == "dialing") { + } else if (telephony.callState === "dialing") { callStateLabel.text = "Dialing " + name } } @@ -150,7 +150,7 @@ Item { Layout.alignment: Qt.AlignHCenter onImage: './images/HMI_Phone_Hangup.svg' offImage: './images/HMI_Phone_Call.svg' - property var active: (number.text.length > 0) || (telephony.callState == "incoming") || (telephony.callState == "active") + property var active: (number.text.length > 0) || (telephony.callState === "incoming") || (telephony.callState === "active") opacity: active ? 1 : 0.25 onCheckedChanged: { @@ -163,7 +163,7 @@ Item { var contact = {'name': name.text, 'number': number.text} if (contact.name === '') contact.name = 'Unknown' - if (telephony.callState == "incoming") { + if (telephony.callState === "incoming") { telephony.answer() } else { pbap.search(number.text) diff --git a/app/Recents.qml b/app/Recents.qml index 3eafaac..5a516a1 100644 --- a/app/Recents.qml +++ b/app/Recents.qml @@ -24,11 +24,11 @@ Item { id: root function log_icon(type) { - if (type == RecentCall.MISSED) { + if (type === RecentCall.MISSED) { return './images/ic_call_missed_48px.svg' - } else if (type == RecentCall.RECEIVED) { + } else if (type === RecentCall.RECEIVED) { return './images/ic_call_received_48px.svg' - } else if (type == RecentCall.DIALED) { + } else if (type === RecentCall.DIALED) { return './images/ic_call_made_48px.svg' } } -- cgit 1.2.3-korg