Merge pull request #226 from Atheros1/master
'Save message as...' option in Inbox
This commit is contained in:
commit
a6704ac5dc
|
@ -4647,6 +4647,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
shared.UISignalQueue.put(('rerenderInboxFromLabels', ''))
|
shared.UISignalQueue.put(('rerenderInboxFromLabels', ''))
|
||||||
shared.UISignalQueue.put(('rerenderSubscriptions', ''))
|
shared.UISignalQueue.put(('rerenderSubscriptions', ''))
|
||||||
return 'Deleted subscription if it existed.'
|
return 'Deleted subscription if it existed.'
|
||||||
|
elif method == 'clientStatus':
|
||||||
|
return '{ "networkConnections" : "%s" }' % str(len(shared.connectedHostsList))
|
||||||
else:
|
else:
|
||||||
return 'Invalid Method: %s' % method
|
return 'Invalid Method: %s' % method
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,8 @@ class MyForm(QtGui.QMainWindow):
|
||||||
_translate("MainWindow", "Move to Trash"), self.on_action_InboxTrash)
|
_translate("MainWindow", "Move to Trash"), self.on_action_InboxTrash)
|
||||||
self.actionForceHtml = self.ui.inboxContextMenuToolbar.addAction(_translate(
|
self.actionForceHtml = self.ui.inboxContextMenuToolbar.addAction(_translate(
|
||||||
"MainWindow", "View HTML code as formatted text"), self.on_action_InboxMessageForceHtml)
|
"MainWindow", "View HTML code as formatted text"), self.on_action_InboxMessageForceHtml)
|
||||||
|
self.actionSaveMessageAs = self.ui.inboxContextMenuToolbar.addAction(_translate(
|
||||||
|
"MainWindow", "Save message as..."), self.on_action_InboxSaveMessageAs)
|
||||||
self.ui.tableWidgetInbox.setContextMenuPolicy(
|
self.ui.tableWidgetInbox.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
|
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
|
||||||
|
@ -153,6 +155,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
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()
|
||||||
|
self.popMenuInbox.addAction( self.actionSaveMessageAs )
|
||||||
self.popMenuInbox.addAction( self.actionTrashInboxMessage )
|
self.popMenuInbox.addAction( self.actionTrashInboxMessage )
|
||||||
|
|
||||||
# Popup menu for the Your Identities tab
|
# Popup menu for the Your Identities tab
|
||||||
|
@ -2123,6 +2126,25 @@ class MyForm(QtGui.QMainWindow):
|
||||||
else:
|
else:
|
||||||
self.ui.tableWidgetInbox.selectRow(currentRow - 1)
|
self.ui.tableWidgetInbox.selectRow(currentRow - 1)
|
||||||
|
|
||||||
|
def on_action_InboxSaveMessageAs(self):
|
||||||
|
currentInboxRow = self.ui.tableWidgetInbox.currentRow()
|
||||||
|
try:
|
||||||
|
subjectAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item(currentInboxRow,2).text())
|
||||||
|
except:
|
||||||
|
subjectAtCurrentInboxRow = ''
|
||||||
|
defaultFilename = "".join(x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
||||||
|
data = self.ui.tableWidgetInbox.item(currentInboxRow,2).data(Qt.UserRole).toPyObject()
|
||||||
|
filename = QFileDialog.getSaveFileName(self, _translate("MainWindow","Save As..."), defaultFilename, "Text files (*.txt);;All files (*.*)")
|
||||||
|
if filename == '':
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
f = open(filename, 'w')
|
||||||
|
f.write( self.ui.tableWidgetInbox.item(currentInboxRow,2).data(Qt.UserRole).toPyObject() )
|
||||||
|
f.close()
|
||||||
|
except Exception, e:
|
||||||
|
sys.stderr.write('Write error: '+ e)
|
||||||
|
self.statusBar().showMessage(_translate("MainWindow", "Write error."))
|
||||||
|
|
||||||
# Send item on the Sent tab to trash
|
# Send item on the Sent tab to trash
|
||||||
def on_action_SentTrash(self):
|
def on_action_SentTrash(self):
|
||||||
while self.ui.tableWidgetSent.selectedIndexes() != []:
|
while self.ui.tableWidgetSent.selectedIndexes() != []:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user