From d38f6f3f40489f64868e082d9beaf60daaa0776f Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Mon, 8 Apr 2013 17:15:50 -0400 Subject: [PATCH] smarter selection of a message after deleting a message --- bitmessagemain.py | 10 +++++++++- messages.dat reader.py | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/bitmessagemain.py b/bitmessagemain.py index df9ef69c..6bde803e 100755 --- a/bitmessagemain.py +++ b/bitmessagemain.py @@ -4688,7 +4688,10 @@ class MyForm(QtGui.QMainWindow): self.ui.tableWidgetInbox.removeRow(currentRow) self.statusBar().showMessage('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.') sqlSubmitQueue.put('commit') - self.ui.tableWidgetInbox.selectRow(currentRow) + if currentRow == 0: + self.ui.tableWidgetInbox.selectRow(currentRow) + else: + self.ui.tableWidgetInbox.selectRow(currentRow-1) #Send item on the Sent tab to trash def on_action_SentTrash(self): @@ -4705,6 +4708,11 @@ class MyForm(QtGui.QMainWindow): self.ui.tableWidgetSent.removeRow(currentRow) self.statusBar().showMessage('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.') sqlSubmitQueue.put('commit') + if currentRow == 0: + self.ui.tableWidgetSent.selectRow(currentRow) + else: + self.ui.tableWidgetSent.selectRow(currentRow-1) + def on_action_SentClipboard(self): currentRow = self.ui.tableWidgetSent.currentRow() addressAtCurrentRow = str(self.ui.tableWidgetSent.item(currentRow,0).data(Qt.UserRole).toPyObject()) diff --git a/messages.dat reader.py b/messages.dat reader.py index 7843863e..252d71f4 100644 --- a/messages.dat reader.py +++ b/messages.dat reader.py @@ -88,9 +88,18 @@ def takeSentMessagesOutOfTrash(): conn.commit() print 'done' -takeInboxMessagesOutOfTrash() +def markAllInboxMessagesAsUnread(): + item = '''update inbox set read='0' ''' + parameters = '' + cur.execute(item, parameters) + output = cur.fetchall() + conn.commit() + print 'done' + +#takeInboxMessagesOutOfTrash() #takeSentMessagesOutOfTrash() -#readInbox() +#markAllInboxMessagesAsUnread() +readInbox() #readSent() #readPubkeys() #readSubscriptions()