Browse Source

enable android share option

patch-4
Sander van Grieken 3 years ago
parent
commit
bbc1f4dba8
  1. 3
      electrum/gui/qml/components/AddressDetails.qml
  2. 6
      electrum/gui/qml/components/RequestDialog.qml
  3. 6
      electrum/gui/qml/components/controls/GenericShareDialog.qml
  4. 21
      electrum/gui/qml/qeapp.py

3
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
}
}
}

6
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 {

6
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)
}
}
}
}

21
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)

Loading…
Cancel
Save