Add context menu action to view message as richtext #101

Merged
Atheros1 merged 5 commits from master into master 2013-04-02 18:32:35 +02:00
Showing only changes of commit 234aa4dfec - Show all commits

View File

@ -3426,9 +3426,12 @@ class MyForm(QtGui.QMainWindow):
self.actionReply = self.ui.inboxContextMenuToolbar.addAction("Reply", self.on_action_InboxReply) 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.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.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.ui.tableWidgetInbox.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuInbox) self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuInbox)
self.popMenuInbox = QtGui.QMenu( self ) self.popMenuInbox = QtGui.QMenu( self )
self.popMenuInbox.addAction( self.actionForceHtml )
self.popMenuInbox.addSeparator()
self.popMenuInbox.addAction( self.actionReply ) self.popMenuInbox.addAction( self.actionReply )
self.popMenuInbox.addAction( self.actionAddSenderToAddressBook ) self.popMenuInbox.addAction( self.actionAddSenderToAddressBook )
self.popMenuInbox.addSeparator() self.popMenuInbox.addSeparator()
@ -4637,6 +4640,16 @@ class MyForm(QtGui.QMainWindow):
event.accept() event.accept()
raise SystemExit 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): def on_action_InboxReply(self):
currentInboxRow = self.ui.tableWidgetInbox.currentRow() currentInboxRow = self.ui.tableWidgetInbox.currentRow()