New method foldertree.AccountMixin.accountString():
composes the 'label <address>' string which is used in MyForm.on_action_Send() instead of bare address.
This commit is contained in:
parent
5a9a2dd54c
commit
9a58af4de5
|
@ -2610,7 +2610,10 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
def on_action_Send(self):
|
||||
"""Send message to current selected address"""
|
||||
self.click_pushButtonClear()
|
||||
self.ui.lineEditTo.setText(self.getCurrentAccount())
|
||||
account_item = self.getCurrentItem()
|
||||
if not account_item:
|
||||
return
|
||||
self.ui.lineEditTo.setText(account_item.accountString())
|
||||
self.ui.tabWidget.setCurrentIndex(
|
||||
self.ui.tabWidget.indexOf(self.ui.send)
|
||||
)
|
||||
|
@ -3662,11 +3665,8 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
if treeWidget is None:
|
||||
treeWidget = self.getCurrentTreeWidget()
|
||||
if treeWidget:
|
||||
currentItem = treeWidget.currentItem()
|
||||
if currentItem:
|
||||
return currentItem
|
||||
return False
|
||||
|
||||
return treeWidget.currentItem()
|
||||
|
||||
def getCurrentAccount(self, treeWidget=None):
|
||||
currentItem = self.getCurrentItem(treeWidget)
|
||||
if currentItem:
|
||||
|
|
|
@ -56,6 +56,14 @@ class AccountMixin(object):
|
|||
brush.setStyle(QtCore.Qt.NoBrush)
|
||||
return brush
|
||||
|
||||
def accountString(self):
|
||||
"""Account string suitable for use in To: field: label <address>"""
|
||||
label = self._getLabel()
|
||||
return (
|
||||
self.address if label == self.address
|
||||
else '%s <%s>' % (label, self.address)
|
||||
)
|
||||
|
||||
def setAddress(self, address):
|
||||
"""Set bitmessage address of the object"""
|
||||
if address is None:
|
||||
|
@ -359,6 +367,9 @@ class BMAddressWidget(BMTableWidgetItem, AccountMixin):
|
|||
def _setup(self):
|
||||
self.setEnabled(True)
|
||||
|
||||
def _getLabel(self):
|
||||
return self.label
|
||||
|
||||
def data(self, role):
|
||||
"""Return object data (QT UI)"""
|
||||
if role == QtCore.Qt.ToolTipRole:
|
||||
|
|
Loading…
Reference in New Issue
Block a user