From 5db91854091e90c819ef06d9ba1d81998faff350 Mon Sep 17 00:00:00 2001 From: stoffu Date: Tue, 20 Feb 2018 12:10:19 +0900 Subject: [PATCH] startsWith is unsupported for Qt < 5.8, use indexOf instead --- main.qml | 4 ++-- pages/TxKey.qml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.qml b/main.qml index b5280738..329c4b78 100644 --- a/main.qml +++ b/main.qml @@ -783,10 +783,10 @@ ApplicationWindow { var result; if (address.length > 0) result = currentWallet.getTxProof(txid, address, message); - if (!result || result.startsWith("error|")) + if (!result || result.indexOf("error|") === 0) result = currentWallet.getSpendProof(txid, message); informationPopup.title = qsTr("Payment proof") + translationManager.emptyString; - if (result.startsWith("error|")) { + if (result.indexOf("error|") === 0) { var errorString = result.split("|")[1]; informationPopup.text = qsTr("Couldn't generate a proof because of the following reason: \n") + errorString + translationManager.emptyString; informationPopup.icon = StandardIcon.Critical; diff --git a/pages/TxKey.qml b/pages/TxKey.qml index 3793e81e..e8bc1214 100644 --- a/pages/TxKey.qml +++ b/pages/TxKey.qml @@ -64,15 +64,15 @@ Rectangle { } function checkSignature(signature) { - if (signature.startsWith("OutProofV")) { + if (signature.indexOf("OutProofV") === 0) { if ((signature.length - 10) % 132 != 0) return false; return check256(signature, signature.length); - } else if (signature.startsWith("InProofV")) { + } else if (signature.indexOf("InProofV") === 0) { if ((signature.length - 9) % 132 != 0) return false; return check256(signature, signature.length); - } else if (signature.startsWith("SpendProofV")) { + } else if (signature.indexOf("SpendProofV") === 0) { if ((signature.length - 12) % 88 != 0) return false; return check256(signature, signature.length); @@ -328,7 +328,7 @@ Rectangle { shadowPressedColor: "#B32D00" releasedColor: "#FF6C3C" pressedColor: "#FF4304" - enabled: checkTxID(checkProofTxIdLine.text) && checkSignature(checkProofSignatureLine.text) && ((checkProofSignatureLine.text.startsWith("SpendProofV") && checkProofAddressLine.text.length == 0) || (!checkProofSignatureLine.text.startsWith("SpendProofV") && checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.testnet))) + enabled: checkTxID(checkProofTxIdLine.text) && checkSignature(checkProofSignatureLine.text) && ((checkProofSignatureLine.text.indexOf("SpendProofV") === 0 && checkProofAddressLine.text.length == 0) || (checkProofSignatureLine.text.indexOf("SpendProofV") !== 0 && checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.testnet))) onClicked: { console.log("checkProof: Check clicked: txid " + checkProofTxIdLine.text + ", address " + checkProofAddressLine.text + ", message " + checkProofMessageLine.text + ", signature " + checkProofSignatureLine.text); root.checkProofClicked(checkProofTxIdLine.text, checkProofAddressLine.text, checkProofMessageLine.text, checkProofSignatureLine.text)