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):
|
def on_action_Send(self):
|
||||||
"""Send message to current selected address"""
|
"""Send message to current selected address"""
|
||||||
self.click_pushButtonClear()
|
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.setCurrentIndex(
|
||||||
self.ui.tabWidget.indexOf(self.ui.send)
|
self.ui.tabWidget.indexOf(self.ui.send)
|
||||||
)
|
)
|
||||||
|
@ -3662,11 +3665,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if treeWidget is None:
|
if treeWidget is None:
|
||||||
treeWidget = self.getCurrentTreeWidget()
|
treeWidget = self.getCurrentTreeWidget()
|
||||||
if treeWidget:
|
if treeWidget:
|
||||||
currentItem = treeWidget.currentItem()
|
return treeWidget.currentItem()
|
||||||
if currentItem:
|
|
||||||
return currentItem
|
|
||||||
return False
|
|
||||||
|
|
||||||
def getCurrentAccount(self, treeWidget=None):
|
def getCurrentAccount(self, treeWidget=None):
|
||||||
currentItem = self.getCurrentItem(treeWidget)
|
currentItem = self.getCurrentItem(treeWidget)
|
||||||
if currentItem:
|
if currentItem:
|
||||||
|
|
|
@ -56,6 +56,14 @@ class AccountMixin(object):
|
||||||
brush.setStyle(QtCore.Qt.NoBrush)
|
brush.setStyle(QtCore.Qt.NoBrush)
|
||||||
return brush
|
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):
|
def setAddress(self, address):
|
||||||
"""Set bitmessage address of the object"""
|
"""Set bitmessage address of the object"""
|
||||||
if address is None:
|
if address is None:
|
||||||
|
@ -359,6 +367,9 @@ class BMAddressWidget(BMTableWidgetItem, AccountMixin):
|
||||||
def _setup(self):
|
def _setup(self):
|
||||||
self.setEnabled(True)
|
self.setEnabled(True)
|
||||||
|
|
||||||
|
def _getLabel(self):
|
||||||
|
return self.label
|
||||||
|
|
||||||
def data(self, role):
|
def data(self, role):
|
||||||
"""Return object data (QT UI)"""
|
"""Return object data (QT UI)"""
|
||||||
if role == QtCore.Qt.ToolTipRole:
|
if role == QtCore.Qt.ToolTipRole:
|
||||||
|
|
Reference in New Issue
Block a user