diff --git a/electrum/gui/qml/components/AddressDetails.qml b/electrum/gui/qml/components/AddressDetails.qml index 51e008c82..8bb606452 100644 --- a/electrum/gui/qml/components/AddressDetails.qml +++ b/electrum/gui/qml/components/AddressDetails.qml @@ -26,6 +26,7 @@ Pane { text: qsTr('Spend from') //onTriggered: icon.source: '../../icons/tab_send.png' + enabled: false } } MenuItem { @@ -33,6 +34,7 @@ Pane { action: Action { text: qsTr('Sign/Verify') icon.source: '../../icons/key.png' + enabled: false } } MenuItem { @@ -40,6 +42,7 @@ Pane { action: Action { text: qsTr('Encrypt/Decrypt') icon.source: '../../icons/mail_icon.png' + enabled: false } } } diff --git a/electrum/gui/qml/components/RequestDialog.qml b/electrum/gui/qml/components/RequestDialog.qml index 0d5bd9e48..e0aa4af40 100644 --- a/electrum/gui/qml/components/RequestDialog.qml +++ b/electrum/gui/qml/components/RequestDialog.qml @@ -113,7 +113,11 @@ Dialog { Button { icon.source: '../../icons/share.png' text: 'Share' - enabled: false + onClicked: { + enabled = false + AppController.doShare(_bip21uri, qsTr('Payment Request')) + enabled = true + } } } Label { diff --git a/electrum/gui/qml/components/controls/GenericShareDialog.qml b/electrum/gui/qml/components/controls/GenericShareDialog.qml index 9ef834b74..392ebfcd6 100644 --- a/electrum/gui/qml/components/controls/GenericShareDialog.qml +++ b/electrum/gui/qml/components/controls/GenericShareDialog.qml @@ -96,10 +96,12 @@ Dialog { onClicked: AppController.textToClipboard(dialog.text) } Button { - enabled: false + //enabled: false text: qsTr('Share') icon.source: '../../../icons/share.png' - onClicked: console.log('TODO') + onClicked: { + AppController.doShare(dialog.text, dialog.title) + } } } } diff --git a/electrum/gui/qml/qeapp.py b/electrum/gui/qml/qeapp.py index d41314f4c..5d20a305f 100644 --- a/electrum/gui/qml/qeapp.py +++ b/electrum/gui/qml/qeapp.py @@ -93,6 +93,27 @@ class QEAppController(QObject): except ImportError: self.logger.error('Notification: needs plyer; `sudo python3 -m pip install plyer`') + @pyqtSlot(str, str) + def doShare(self, data, title): + #if platform != 'android': + #return + try: + from jnius import autoclass, cast + except ImportError: + self.logger.error('Share: needs jnius. Platform not Android?') + return + + JS = autoclass('java.lang.String') + Intent = autoclass('android.content.Intent') + sendIntent = Intent() + sendIntent.setAction(Intent.ACTION_SEND) + sendIntent.setType("text/plain") + sendIntent.putExtra(Intent.EXTRA_TEXT, JS(data)) + pythonActivity = autoclass('org.kivy.android.PythonActivity') + currentActivity = cast('android.app.Activity', pythonActivity.mActivity) + it = Intent.createChooser(sendIntent, cast('java.lang.CharSequence', JS(title))) + currentActivity.startActivity(it) + @pyqtSlot('QString') def textToClipboard(self, text): QGuiApplication.clipboard().setText(text)