prevent exception if user presses delete key when no more messages to delete

This commit is contained in:
Jonathan Warren 2013-03-27 17:14:01 -04:00
parent 8a5982fb28
commit d9a44f0f17

View File

@ -5021,31 +5021,33 @@ class MyForm(QtGui.QMainWindow):
#Send item on the Inbox tab to trash
def on_action_InboxTrash(self):
currentRow = self.ui.tableWidgetInbox.currentRow()
inventoryHashToTrash = str(self.ui.tableWidgetInbox.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (inventoryHashToTrash,)
sqlLock.acquire()
#sqlSubmitQueue.put('''delete from inbox where msgid=?''')
sqlSubmitQueue.put('''UPDATE inbox SET folder='trash' WHERE msgid=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlLock.release()
self.ui.textEditInboxMessage.setText("")
self.ui.tableWidgetInbox.removeRow(currentRow)
self.statusBar().showMessage('Moved item to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.')
if currentRow >= 0:
inventoryHashToTrash = str(self.ui.tableWidgetInbox.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (inventoryHashToTrash,)
sqlLock.acquire()
#sqlSubmitQueue.put('''delete from inbox where msgid=?''')
sqlSubmitQueue.put('''UPDATE inbox SET folder='trash' WHERE msgid=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlLock.release()
self.ui.textEditInboxMessage.setText("")
self.ui.tableWidgetInbox.removeRow(currentRow)
self.statusBar().showMessage('Moved item to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.')
#Send item on the Sent tab to trash
def on_action_SentTrash(self):
currentRow = self.ui.tableWidgetSent.currentRow()
ackdataToTrash = str(self.ui.tableWidgetSent.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (ackdataToTrash,)
sqlLock.acquire()
sqlSubmitQueue.put('''UPDATE sent SET folder='trash' WHERE ackdata=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlLock.release()
self.ui.textEditSentMessage.setText("")
self.ui.tableWidgetSent.removeRow(currentRow)
self.statusBar().showMessage('Moved item to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.')
if currentRow >= 0:
ackdataToTrash = str(self.ui.tableWidgetSent.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (ackdataToTrash,)
sqlLock.acquire()
sqlSubmitQueue.put('''UPDATE sent SET folder='trash' WHERE ackdata=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlLock.release()
self.ui.textEditSentMessage.setText("")
self.ui.tableWidgetSent.removeRow(currentRow)
self.statusBar().showMessage('Moved item to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.')
def on_action_SentClipboard(self):
currentRow = self.ui.tableWidgetSent.currentRow()
addressAtCurrentRow = str(self.ui.tableWidgetSent.item(currentRow,0).data(Qt.UserRole).toPyObject())