diff --git a/electrum/gui/qml/components/controls/QRImage.qml b/electrum/gui/qml/components/controls/QRImage.qml index 46929ea7b..ce8ac7154 100644 --- a/electrum/gui/qml/components/controls/QRImage.qml +++ b/electrum/gui/qml/components/controls/QRImage.qml @@ -8,6 +8,8 @@ Item { property bool enableToggleText: false // if true, clicking the QR code shows the encoded text property bool isTextState: false // internal state, if the above is enabled + signal clicked() + property var _qrprops: QRIP.getDimensions(qrdata) width: r.width @@ -71,6 +73,8 @@ Item { onClicked: { if (enableToggleText) { root.isTextState = !root.isTextState + } else { + root.clicked() } } } diff --git a/electrum/plugins/trustedcoin/qml/ShowConfirmOTP.qml b/electrum/plugins/trustedcoin/qml/ShowConfirmOTP.qml index 778b3ddb6..a63d8ecc3 100644 --- a/electrum/plugins/trustedcoin/qml/ShowConfirmOTP.qml +++ b/electrum/plugins/trustedcoin/qml/ShowConfirmOTP.qml @@ -40,15 +40,37 @@ WizardComponent { qrdata: encodeURI('otpauth://totp/Electrum 2FA ' + wizard_data['wallet_name'] + '?secret=' + plugin.otpSecret + '&digits=6') render: plugin.otpSecret + onClicked: { + if (plugin.otpSecret) { + if (AppController.isAndroid()) { + Qt.openUrlExternally(qrdata) + } else { + AppController.textToClipboard(plugin.otpSecret) + toaster.show(this, qsTr('Copied!')) + } + } + } } - TextHighlightPane { + Item { Layout.alignment: Qt.AlignHCenter visible: plugin.otpSecret - Label { - text: plugin.otpSecret - font.family: FixedFont - font.bold: true + implicitWidth: otpSecretPane.implicitWidth + implicitHeight: otpSecretPane.implicitHeight + TextHighlightPane { + id: otpSecretPane + Label { + text: plugin.otpSecret + font.family: FixedFont + font.bold: true + } + } + MouseArea { + anchors.fill: parent + onClicked: { + AppController.textToClipboard(plugin.otpSecret) + toaster.show(otpSecretPane, qsTr('Copied!')) + } } } @@ -56,7 +78,7 @@ WizardComponent { Layout.fillWidth: true visible: !otpVerified && plugin.otpSecret wrapMode: Text.Wrap - text: qsTr('Enter or scan into authenticator app. Then authenticate below') + text: qsTr('Tap the QR code to open in your authenticator app, or scan it manually. Then authenticate below') } Label { @@ -118,6 +140,10 @@ WizardComponent { otp_auth.forceActiveFocus() } + Toaster { + id: toaster + } + Connections { target: plugin function onOtpError(message) {