From af87503ec729915fa2503ab6374f9648d52314a9 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Fri, 5 Apr 2013 17:54:38 -0400 Subject: [PATCH] Support select multiple items in inbox and Sent box --- bitmessagemain.py | 18 +++++++++--------- bitmessageui.py | 6 +++--- bitmessageui.ui | 4 ++-- messages.dat reader.py | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bitmessagemain.py b/bitmessagemain.py index 19cdf678..b23adbb6 100755 --- a/bitmessagemain.py +++ b/bitmessagemain.py @@ -4663,36 +4663,36 @@ 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: + while self.ui.tableWidgetInbox.selectedIndexes() != []: + currentRow = self.ui.tableWidgetInbox.selectedIndexes()[0].row() 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() - sqlSubmitQueue.put('commit') 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.') + 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') #Send item on the Sent tab to trash def on_action_SentTrash(self): - currentRow = self.ui.tableWidgetSent.currentRow() - if currentRow >= 0: + #currentRow = self.ui.tableWidgetSent.currentRow() + while self.ui.tableWidgetSent.selectedIndexes() != []: + currentRow = self.ui.tableWidgetSent.selectedIndexes()[0].row() 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() - sqlSubmitQueue.put('commit') sqlLock.release() self.ui.textEditSentMessage.setPlainText("") 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.') + 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') 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/bitmessageui.py b/bitmessageui.py index 026dbbda..c1c62d37 100644 --- a/bitmessageui.py +++ b/bitmessageui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'bitmessageui.ui' # -# Created: Wed Mar 27 17:23:59 2013 +# Created: Fri Apr 05 17:47:21 2013 # by: PyQt4 UI code generator 4.9.4 # # WARNING! All changes made in this file will be lost! @@ -47,7 +47,7 @@ class Ui_MainWindow(object): self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.tableWidgetInbox = QtGui.QTableWidget(self.inbox) self.tableWidgetInbox.setAlternatingRowColors(True) - self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) + self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.tableWidgetInbox.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidgetInbox.setWordWrap(False) self.tableWidgetInbox.setObjectName(_fromUtf8("tableWidgetInbox")) @@ -144,7 +144,7 @@ class Ui_MainWindow(object): self.tableWidgetSent = QtGui.QTableWidget(self.sent) self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop) self.tableWidgetSent.setAlternatingRowColors(True) - self.tableWidgetSent.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) + self.tableWidgetSent.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.tableWidgetSent.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidgetSent.setWordWrap(False) self.tableWidgetSent.setObjectName(_fromUtf8("tableWidgetSent")) diff --git a/bitmessageui.ui b/bitmessageui.ui index cf7467ad..0e2e19aa 100644 --- a/bitmessageui.ui +++ b/bitmessageui.ui @@ -74,7 +74,7 @@ true - QAbstractItemView::SingleSelection + QAbstractItemView::ExtendedSelection QAbstractItemView::SelectRows @@ -319,7 +319,7 @@ p, li { white-space: pre-wrap; } true - QAbstractItemView::SingleSelection + QAbstractItemView::ExtendedSelection QAbstractItemView::SelectRows diff --git a/messages.dat reader.py b/messages.dat reader.py index cb6ca7d0..7843863e 100644 --- a/messages.dat reader.py +++ b/messages.dat reader.py @@ -88,12 +88,12 @@ def takeSentMessagesOutOfTrash(): conn.commit() print 'done' -#takeInboxMessagesOutOfTrash() +takeInboxMessagesOutOfTrash() #takeSentMessagesOutOfTrash() #readInbox() #readSent() #readPubkeys() #readSubscriptions() -readInventory() +#readInventory()