Add context menu action to view message as richtext
This commit is contained in:
parent
0b5c5b2931
commit
234aa4dfec
|
@ -3426,9 +3426,12 @@ class MyForm(QtGui.QMainWindow):
|
|||
self.actionReply = self.ui.inboxContextMenuToolbar.addAction("Reply", self.on_action_InboxReply)
|
||||
self.actionAddSenderToAddressBook = self.ui.inboxContextMenuToolbar.addAction("Add sender to your Address Book", self.on_action_InboxAddSenderToAddressBook)
|
||||
self.actionTrashInboxMessage = self.ui.inboxContextMenuToolbar.addAction("Move to Trash", self.on_action_InboxTrash)
|
||||
self.actionForceHtml = self.ui.inboxContextMenuToolbar.addAction("View as Richtext", self.on_action_InboxMsgForceHtml)
|
||||
self.ui.tableWidgetInbox.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
|
||||
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuInbox)
|
||||
self.popMenuInbox = QtGui.QMenu( self )
|
||||
self.popMenuInbox.addAction( self.actionForceHtml )
|
||||
self.popMenuInbox.addSeparator()
|
||||
self.popMenuInbox.addAction( self.actionReply )
|
||||
self.popMenuInbox.addAction( self.actionAddSenderToAddressBook )
|
||||
self.popMenuInbox.addSeparator()
|
||||
|
@ -4637,6 +4640,16 @@ class MyForm(QtGui.QMainWindow):
|
|||
event.accept()
|
||||
raise SystemExit
|
||||
|
||||
def on_action_InboxMsgForceHtml(self):
|
||||
lines = str(self.ui.textEditInboxMessage.toPlainText()).split('\n')
|
||||
from_prefix = 'Message ostensibly from '
|
||||
for i in xrange(len(lines)):
|
||||
if lines[i].find(from_prefix) != -1:
|
||||
lines[i] = '<p style="font-size: 12px; color: grey;">%s<span style="font-size: 16px; color: black;">%s</span></p>' % (from_prefix,lines[i][24:-1])
|
||||
elif lines[i] == '------------------------------------------------------':
|
||||
lines[i] = '<hr>'
|
||||
content = '\n'.join(lines)
|
||||
self.ui.textEditInboxMessage.setHtml(QtCore.QString(content))
|
||||
|
||||
def on_action_InboxReply(self):
|
||||
currentInboxRow = self.ui.tableWidgetInbox.currentRow()
|
||||
|
|
Loading…
Reference in New Issue
Block a user