Merge pull request #81 from Atheros1/master

Use delete key to trash Inbox or Sent messages
This commit is contained in:
Jonathan Warren 2013-03-27 14:15:01 -07:00
commit ce6ad1058c
1 changed files with 35 additions and 22 deletions

View File

@ -3886,7 +3886,7 @@ class MyForm(QtGui.QMainWindow):
reloadMyAddressHashes()
self.reloadBroadcastSendersForWhichImWatching()
self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent
#Load inbox from messages database file
sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, received, message FROM inbox where folder='inbox' ORDER BY received''')
sqlSubmitQueue.put('')
@ -3941,6 +3941,7 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetInbox.setItem(0,3,newItem)
#self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item(0,2).data(Qt.UserRole).toPyObject())
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetInboxKeyPressEvent
#Load Sent items from database
sqlSubmitQueue.put('''SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime FROM sent where folder = 'sent' ORDER BY lastactiontime''')
sqlSubmitQueue.put('')
@ -4103,6 +4104,16 @@ class MyForm(QtGui.QMainWindow):
QtCore.QObject.connect(self.singleAPISignalHandlerThread, QtCore.SIGNAL("passAddressGeneratorObjectThrough(PyQt_PyObject)"), self.connectObjectToAddressGeneratorSignals)
QtCore.QObject.connect(self.singleAPISignalHandlerThread, QtCore.SIGNAL("displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewSentMessage)
def tableWidgetInboxKeyPressEvent(self,event):
if event.key() == QtCore.Qt.Key_Delete:
self.on_action_InboxTrash()
return QtGui.QTableWidget.keyPressEvent(self.ui.tableWidgetInbox, event)
def tableWidgetSentKeyPressEvent(self,event):
if event.key() == QtCore.Qt.Key_Delete:
self.on_action_SentTrash()
return QtGui.QTableWidget.keyPressEvent(self.ui.tableWidgetSent, event)
def click_actionManageKeys(self):
if 'darwin' in sys.platform or 'linux' in sys.platform:
if appdata == '':
@ -5010,6 +5021,7 @@ class MyForm(QtGui.QMainWindow):
#Send item on the Inbox tab to trash
def on_action_InboxTrash(self):
currentRow = self.ui.tableWidgetInbox.currentRow()
if currentRow >= 0:
inventoryHashToTrash = str(self.ui.tableWidgetInbox.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (inventoryHashToTrash,)
sqlLock.acquire()
@ -5025,6 +5037,7 @@ class MyForm(QtGui.QMainWindow):
#Send item on the Sent tab to trash
def on_action_SentTrash(self):
currentRow = self.ui.tableWidgetSent.currentRow()
if currentRow >= 0:
ackdataToTrash = str(self.ui.tableWidgetSent.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (ackdataToTrash,)
sqlLock.acquire()