Added copy address from conversations list

This commit is contained in:
Mark Qvist 2022-10-09 14:39:56 +02:00
parent 9ec2ba9cd5
commit 6db088f285

View File

@ -9,6 +9,7 @@ from kivymd.uix.menu import MDDropdownMenu
from kivy.uix.gridlayout import GridLayout from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock from kivy.clock import Clock
from kivy.core.clipboard import Clipboard
from kivymd.uix.button import MDRectangleFlatButton from kivymd.uix.button import MDRectangleFlatButton
from kivymd.uix.dialog import MDDialog from kivymd.uix.dialog import MDDialog
@ -187,6 +188,12 @@ class Conversations():
dialog.open() dialog.open()
return x return x
def gen_copy_addr(dest, item):
def x():
Clipboard.copy(RNS.hexrep(dest, delimit=False))
item.dmenu.dismiss()
return x
if self.conversation_dropdown == None: if self.conversation_dropdown == None:
dmi_h = 40 dmi_h = 40
dm_items = [ dm_items = [
@ -196,6 +203,12 @@ class Conversations():
"height": dp(dmi_h), "height": dp(dmi_h),
"on_release": gen_edit(context_dest, item) "on_release": gen_edit(context_dest, item)
}, },
{
"text": "Copy Address",
"viewclass": "OneLineListItem",
"height": dp(dmi_h),
"on_release": gen_copy_addr(context_dest, item)
},
{ {
"text": "Clear Messages", "text": "Clear Messages",
"viewclass": "OneLineListItem", "viewclass": "OneLineListItem",