enable android share option
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user