Deleting from sent fix

Fixes #52
This commit is contained in:
mailchuck 2015-11-01 10:59:11 +01:00 committed by Peter Surda
parent 33928f1bc7
commit aafa7b2840

View File

@ -3149,19 +3149,28 @@ class MyForm(QtGui.QMainWindow):
# 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.tableWidgetInbox.selectedIndexes() != []: currentRow = 0
currentRow = self.ui.tableWidgetInbox.selectedIndexes()[0].row() unread = False
ackdataToTrash = str(self.ui.tableWidgetInbox.item( tableWidget = self.getCurrentMessagelist()
if not tableWidget:
return
while tableWidget.selectedIndexes() != []:
currentRow = tableWidget.selectedIndexes()[0].row()
ackdataToTrash = str(tableWidget.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
sqlExecute('''UPDATE sent SET folder='trash' WHERE ackdata=?''', ackdataToTrash) sqlExecute('''UPDATE sent SET folder='trash' WHERE ackdata=?''', ackdataToTrash)
self.ui.textEditSentMessage.setPlainText("") if tableWidget.item(currentRow, 0).font().bold():
self.ui.tableWidgetInbox.removeRow(currentRow) unread = True
self.getCurrentMessageTextedit().setPlainText("")
tableWidget.removeRow(currentRow)
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
"MainWindow", "Moved items 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.")) "MainWindow", "Moved items to trash."))
if currentRow == 0: if currentRow == 0:
self.ui.tableWidgetInbox.selectRow(currentRow) self.ui.tableWidgetInbox.selectRow(currentRow)
else: else:
self.ui.tableWidgetInbox.selectRow(currentRow - 1) self.ui.tableWidgetInbox.selectRow(currentRow - 1)
if unread:
self.propagateUnreadCount(self.getCurrentAccount(), None, self.getCurrentTreeWidget(), 0)
def on_action_ForceSend(self): def on_action_ForceSend(self):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()