Added address menu plugins to each popup menu except for Blacklist,
closes #819
This commit is contained in:
parent
e6f3e52014
commit
e07cd1462e
|
@ -817,6 +817,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.initSettings()
|
self.initSettings()
|
||||||
self.resetNamecoinConnection()
|
self.resetNamecoinConnection()
|
||||||
|
|
||||||
|
self._contact_selected = None
|
||||||
|
|
||||||
|
def getContactSelected(self):
|
||||||
|
"""Returns last selected contact once"""
|
||||||
|
try:
|
||||||
|
return self._contact_selected
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
self._contact_selected = None
|
||||||
|
|
||||||
def updateTTL(self, sliderPosition):
|
def updateTTL(self, sliderPosition):
|
||||||
TTL = int(sliderPosition ** 3.199 + 3600)
|
TTL = int(sliderPosition ** 3.199 + 3600)
|
||||||
self.updateHumanFriendlyTTLDescription(TTL)
|
self.updateHumanFriendlyTTLDescription(TTL)
|
||||||
|
@ -3446,15 +3457,19 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.popMenuAddressBook.addSeparator()
|
self.popMenuAddressBook.addSeparator()
|
||||||
self.popMenuAddressBook.addAction(self.actionAddressBookNew)
|
self.popMenuAddressBook.addAction(self.actionAddressBookNew)
|
||||||
normal = True
|
normal = True
|
||||||
for row in self.ui.tableWidgetAddressBook.selectedIndexes():
|
selected_items = self.getAddressbookSelectedItems()
|
||||||
currentRow = row.row()
|
for item in selected_items:
|
||||||
type = self.ui.tableWidgetAddressBook.item(
|
if item.type != AccountMixin.NORMAL:
|
||||||
currentRow, 0).type
|
|
||||||
if type != AccountMixin.NORMAL:
|
|
||||||
normal = False
|
normal = False
|
||||||
|
break
|
||||||
if normal:
|
if normal:
|
||||||
# only if all selected addressbook items are normal, allow delete
|
# only if all selected addressbook items are normal, allow delete
|
||||||
self.popMenuAddressBook.addAction(self.actionAddressBookDelete)
|
self.popMenuAddressBook.addAction(self.actionAddressBookDelete)
|
||||||
|
if len(selected_items) == 1:
|
||||||
|
self._contact_selected = selected_items.pop()
|
||||||
|
self.popMenuAddressBook.addSeparator()
|
||||||
|
for plugin in self.menu_plugins['address']:
|
||||||
|
self.popMenuAddressBook.addAction(plugin)
|
||||||
self.popMenuAddressBook.exec_(
|
self.popMenuAddressBook.exec_(
|
||||||
self.ui.tableWidgetAddressBook.mapToGlobal(point))
|
self.ui.tableWidgetAddressBook.mapToGlobal(point))
|
||||||
|
|
||||||
|
@ -3526,6 +3541,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard)
|
self.popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard)
|
||||||
self.popMenuSubscriptions.addAction(self.actionsubscriptionsSend)
|
self.popMenuSubscriptions.addAction(self.actionsubscriptionsSend)
|
||||||
self.popMenuSubscriptions.addSeparator()
|
self.popMenuSubscriptions.addSeparator()
|
||||||
|
|
||||||
|
self._contact_selected = currentItem
|
||||||
# preloaded gui.menu plugins with prefix 'address'
|
# preloaded gui.menu plugins with prefix 'address'
|
||||||
for plugin in self.menu_plugins['address']:
|
for plugin in self.menu_plugins['address']:
|
||||||
self.popMenuSubscriptions.addAction(plugin)
|
self.popMenuSubscriptions.addAction(plugin)
|
||||||
|
@ -3939,6 +3956,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.popMenuYourIdentities.addAction(self.actionEmailGateway)
|
self.popMenuYourIdentities.addAction(self.actionEmailGateway)
|
||||||
self.popMenuYourIdentities.addSeparator()
|
self.popMenuYourIdentities.addSeparator()
|
||||||
if currentItem.type != AccountMixin.ALL:
|
if currentItem.type != AccountMixin.ALL:
|
||||||
|
self._contact_selected = currentItem
|
||||||
# preloaded gui.menu plugins with prefix 'address'
|
# preloaded gui.menu plugins with prefix 'address'
|
||||||
for plugin in self.menu_plugins['address']:
|
for plugin in self.menu_plugins['address']:
|
||||||
self.popMenuYourIdentities.addAction(plugin)
|
self.popMenuYourIdentities.addAction(plugin)
|
||||||
|
@ -3967,6 +3985,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.popMenu.addAction(self.actionClipboard)
|
self.popMenu.addAction(self.actionClipboard)
|
||||||
self.popMenu.addAction(self.actionSend)
|
self.popMenu.addAction(self.actionSend)
|
||||||
self.popMenu.addSeparator()
|
self.popMenu.addSeparator()
|
||||||
|
self._contact_selected = currentItem
|
||||||
# preloaded gui.menu plugins with prefix 'address'
|
# preloaded gui.menu plugins with prefix 'address'
|
||||||
for plugin in self.menu_plugins['address']:
|
for plugin in self.menu_plugins['address']:
|
||||||
self.popMenu.addAction(plugin)
|
self.popMenu.addAction(plugin)
|
||||||
|
@ -3980,49 +3999,61 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_context_menuInbox(self, point):
|
def on_context_menuInbox(self, point):
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
if tableWidget:
|
if not tableWidget:
|
||||||
currentFolder = self.getCurrentFolder()
|
return
|
||||||
if currentFolder is None:
|
|
||||||
pass
|
currentFolder = self.getCurrentFolder()
|
||||||
if currentFolder == 'sent':
|
if currentFolder == 'sent':
|
||||||
self.on_context_menuSent(point)
|
self.on_context_menuSent(point)
|
||||||
else:
|
return
|
||||||
self.popMenuInbox = QtGui.QMenu(self)
|
|
||||||
self.popMenuInbox.addAction(self.actionForceHtml)
|
self.popMenuInbox = QtGui.QMenu(self)
|
||||||
self.popMenuInbox.addAction(self.actionMarkUnread)
|
self.popMenuInbox.addAction(self.actionForceHtml)
|
||||||
self.popMenuInbox.addSeparator()
|
self.popMenuInbox.addAction(self.actionMarkUnread)
|
||||||
address = tableWidget.item(
|
self.popMenuInbox.addSeparator()
|
||||||
tableWidget.currentRow(), 0).data(QtCore.Qt.UserRole)
|
currentRow = tableWidget.currentRow()
|
||||||
account = accountClass(address)
|
account = accountClass(
|
||||||
if account.type == AccountMixin.CHAN:
|
tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole))
|
||||||
self.popMenuInbox.addAction(self.actionReplyChan)
|
|
||||||
self.popMenuInbox.addAction(self.actionReply)
|
if account.type == AccountMixin.CHAN:
|
||||||
self.popMenuInbox.addAction(self.actionAddSenderToAddressBook)
|
self.popMenuInbox.addAction(self.actionReplyChan)
|
||||||
self.actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction(
|
self.popMenuInbox.addAction(self.actionReply)
|
||||||
_translate("MainWindow", "Copy subject to clipboard")
|
self.popMenuInbox.addAction(self.actionAddSenderToAddressBook)
|
||||||
if tableWidget.currentColumn() == 2 else
|
self.actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction(
|
||||||
_translate("MainWindow", "Copy address to clipboard"),
|
_translate("MainWindow", "Copy subject to clipboard")
|
||||||
self.on_action_ClipboardMessagelist)
|
if tableWidget.currentColumn() == 2 else
|
||||||
self.popMenuInbox.addAction(self.actionClipboardMessagelist)
|
_translate("MainWindow", "Copy address to clipboard"),
|
||||||
self.popMenuInbox.addSeparator()
|
self.on_action_ClipboardMessagelist)
|
||||||
self.popMenuInbox.addAction(self.actionAddSenderToBlackList)
|
self.popMenuInbox.addAction(self.actionClipboardMessagelist)
|
||||||
self.popMenuInbox.addSeparator()
|
# pylint: disable=no-member
|
||||||
self.popMenuInbox.addAction(self.actionSaveMessageAs)
|
self._contact_selected = tableWidget.item(currentRow, 1)
|
||||||
if currentFolder == "trash":
|
# preloaded gui.menu plugins with prefix 'address'
|
||||||
self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage)
|
for plugin in self.menu_plugins['address']:
|
||||||
else:
|
self.popMenuInbox.addAction(plugin)
|
||||||
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
|
self.popMenuInbox.addSeparator()
|
||||||
self.popMenuInbox.exec_(tableWidget.mapToGlobal(point))
|
self.popMenuInbox.addAction(self.actionAddSenderToBlackList)
|
||||||
|
self.popMenuInbox.addSeparator()
|
||||||
|
self.popMenuInbox.addAction(self.actionSaveMessageAs)
|
||||||
|
if currentFolder == "trash":
|
||||||
|
self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage)
|
||||||
|
else:
|
||||||
|
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
|
||||||
|
self.popMenuInbox.exec_(tableWidget.mapToGlobal(point))
|
||||||
|
|
||||||
def on_context_menuSent(self, point):
|
def on_context_menuSent(self, point):
|
||||||
|
currentRow = self.ui.tableWidgetInbox.currentRow()
|
||||||
self.popMenuSent = QtGui.QMenu(self)
|
self.popMenuSent = QtGui.QMenu(self)
|
||||||
self.popMenuSent.addAction(self.actionSentClipboard)
|
self.popMenuSent.addAction(self.actionSentClipboard)
|
||||||
|
self._contact_selected = self.ui.tableWidgetInbox.item(currentRow, 0)
|
||||||
|
# preloaded gui.menu plugins with prefix 'address'
|
||||||
|
for plugin in self.menu_plugins['address']:
|
||||||
|
self.popMenuSent.addAction(plugin)
|
||||||
|
self.popMenuSent.addSeparator()
|
||||||
self.popMenuSent.addAction(self.actionTrashSentMessage)
|
self.popMenuSent.addAction(self.actionTrashSentMessage)
|
||||||
self.popMenuSent.addAction(self.actionSentReply)
|
self.popMenuSent.addAction(self.actionSentReply)
|
||||||
|
|
||||||
# Check to see if this item is toodifficult and display an additional
|
# Check to see if this item is toodifficult and display an additional
|
||||||
# menu option (Force Send) if it is.
|
# menu option (Force Send) if it is.
|
||||||
currentRow = self.ui.tableWidgetInbox.currentRow()
|
|
||||||
if currentRow >= 0:
|
if currentRow >= 0:
|
||||||
ackData = str(self.ui.tableWidgetInbox.item(
|
ackData = str(self.ui.tableWidgetInbox.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
||||||
|
|
|
@ -81,8 +81,14 @@ def connect_plugin(form):
|
||||||
dialog = form.qrcode_dialog
|
dialog = form.qrcode_dialog
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
form.qrcode_dialog = dialog = QRCodeDialog(form)
|
form.qrcode_dialog = dialog = QRCodeDialog(form)
|
||||||
account = form.getCurrentItem()
|
account = form.getContactSelected()
|
||||||
label = account._getLabel()
|
try:
|
||||||
|
label = account._getLabel() # pylint: disable=protected-access
|
||||||
|
except AttributeError:
|
||||||
|
try:
|
||||||
|
label = account.getLabel()
|
||||||
|
except AttributeError:
|
||||||
|
return
|
||||||
dialog.render(
|
dialog.render(
|
||||||
'bitmessage:%s' % account.address + (
|
'bitmessage:%s' % account.address + (
|
||||||
'?' + urllib.urlencode({'label': label.encode('utf-8')})
|
'?' + urllib.urlencode({'label': label.encode('utf-8')})
|
||||||
|
|
Reference in New Issue
Block a user