Support selecting multiple addresses in address book

This commit is contained in:
Jonathan Warren 2013-04-08 12:07:05 -04:00
parent fc69d42acf
commit 72ccdbcf44
3 changed files with 42 additions and 29 deletions

View File

@ -4683,7 +4683,6 @@ 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):
#currentRow = self.ui.tableWidgetSent.currentRow()
while self.ui.tableWidgetSent.selectedIndexes() != []: while self.ui.tableWidgetSent.selectedIndexes() != []:
currentRow = self.ui.tableWidgetSent.selectedIndexes()[0].row() currentRow = self.ui.tableWidgetSent.selectedIndexes()[0].row()
ackdataToTrash = str(self.ui.tableWidgetSent.item(currentRow,3).data(Qt.UserRole).toPyObject()) ackdataToTrash = str(self.ui.tableWidgetSent.item(currentRow,3).data(Qt.UserRole).toPyObject())
@ -4707,33 +4706,48 @@ class MyForm(QtGui.QMainWindow):
def on_action_AddressBookNew(self): def on_action_AddressBookNew(self):
self.click_pushButtonAddAddressBook() self.click_pushButtonAddAddressBook()
def on_action_AddressBookDelete(self): def on_action_AddressBookDelete(self):
currentRow = self.ui.tableWidgetAddressBook.currentRow() while self.ui.tableWidgetInbox.selectedIndexes() != []:
labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,0).text().toUtf8() currentRow = self.ui.tableWidgetInbox.selectedIndexes()[0].row()
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,1).text() labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,0).text().toUtf8()
t = (str(labelAtCurrentRow),str(addressAtCurrentRow)) addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,1).text()
sqlLock.acquire() t = (str(labelAtCurrentRow),str(addressAtCurrentRow))
sqlSubmitQueue.put('''DELETE FROM addressbook WHERE label=? AND address=?''') sqlLock.acquire()
sqlSubmitQueue.put(t) sqlSubmitQueue.put('''DELETE FROM addressbook WHERE label=? AND address=?''')
queryreturn = sqlReturnQueue.get() sqlSubmitQueue.put(t)
sqlSubmitQueue.put('commit') queryreturn = sqlReturnQueue.get()
sqlLock.release() sqlSubmitQueue.put('commit')
self.ui.tableWidgetAddressBook.removeRow(currentRow) sqlLock.release()
self.rerenderInboxFromLabels() self.ui.tableWidgetAddressBook.removeRow(currentRow)
self.rerenderSentToLabels() self.rerenderInboxFromLabels()
self.reloadBroadcastSendersForWhichImWatching() self.rerenderSentToLabels()
def on_action_AddressBookClipboard(self): def on_action_AddressBookClipboard(self):
currentRow = self.ui.tableWidgetAddressBook.currentRow() fullStringOfAddresses = ''
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,1).text() listOfSelectedRows = {}
for i in range(len(self.ui.tableWidgetAddressBook.selectedIndexes())):
listOfSelectedRows[self.ui.tableWidgetAddressBook.selectedIndexes()[i].row()] = 0
for currentRow in listOfSelectedRows:
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,1).text()
if fullStringOfAddresses == '':
fullStringOfAddresses = addressAtCurrentRow
else:
fullStringOfAddresses += ', '+ str(addressAtCurrentRow)
clipboard = QtGui.QApplication.clipboard() clipboard = QtGui.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow)) clipboard.setText(fullStringOfAddresses)
def on_action_AddressBookSend(self): def on_action_AddressBookSend(self):
currentRow = self.ui.tableWidgetAddressBook.currentRow() listOfSelectedRows = {}
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,1).text() for i in range(len(self.ui.tableWidgetAddressBook.selectedIndexes())):
if self.ui.lineEditTo.text() == '': listOfSelectedRows[self.ui.tableWidgetAddressBook.selectedIndexes()[i].row()] = 0
self.ui.lineEditTo.setText(str(addressAtCurrentRow)) for currentRow in listOfSelectedRows:
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,1).text()
if self.ui.lineEditTo.text() == '':
self.ui.lineEditTo.setText(str(addressAtCurrentRow))
else:
self.ui.lineEditTo.setText(str(self.ui.lineEditTo.text()) + '; '+ str(addressAtCurrentRow))
if listOfSelectedRows == {}:
self.statusBar().showMessage('No addresses selected.')
else: else:
self.ui.lineEditTo.setText(str(self.ui.lineEditTo.text()) + '; '+ str(addressAtCurrentRow)) self.statusBar().showMessage('')
self.statusBar().showMessage('You have added the address to the \'To\' field on the \'Send\' tab. You may add more recipients if you want. When you are done, go to the \'Send\' tab.') self.ui.tabWidget.setCurrentIndex(1)
def on_context_menuAddressBook(self, point): def on_context_menuAddressBook(self, point):
self.popMenuAddressBook.exec_( self.ui.tableWidgetAddressBook.mapToGlobal(point) ) self.popMenuAddressBook.exec_( self.ui.tableWidgetAddressBook.mapToGlobal(point) )
@ -4768,7 +4782,6 @@ class MyForm(QtGui.QMainWindow):
def on_action_BlacklistNew(self): def on_action_BlacklistNew(self):
self.click_pushButtonAddBlacklist() self.click_pushButtonAddBlacklist()
def on_action_BlacklistDelete(self): def on_action_BlacklistDelete(self):
print 'clicked Delete'
currentRow = self.ui.tableWidgetBlacklist.currentRow() currentRow = self.ui.tableWidgetBlacklist.currentRow()
labelAtCurrentRow = self.ui.tableWidgetBlacklist.item(currentRow,0).text().toUtf8() labelAtCurrentRow = self.ui.tableWidgetBlacklist.item(currentRow,0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(currentRow,1).text() addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(currentRow,1).text()
@ -4933,7 +4946,7 @@ class MyForm(QtGui.QMainWindow):
newItem = QtGui.QTableWidgetItem(streamNumber) newItem = QtGui.QTableWidgetItem(streamNumber)
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetYourIdentities.setItem(0, 2, newItem) self.ui.tableWidgetYourIdentities.setItem(0, 2, newItem)
self.ui.tableWidgetYourIdentities.setSortingEnabled(True) #self.ui.tableWidgetYourIdentities.setSortingEnabled(True)
self.rerenderComboBoxSendFrom() self.rerenderComboBoxSendFrom()
def updateStatusBar(self,data): def updateStatusBar(self,data):

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'bitmessageui.ui' # Form implementation generated from reading ui file 'bitmessageui.ui'
# #
# Created: Fri Apr 05 17:47:21 2013 # Created: Mon Apr 08 11:57:15 2013
# by: PyQt4 UI code generator 4.9.4 # by: PyQt4 UI code generator 4.9.4
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -261,7 +261,7 @@ class Ui_MainWindow(object):
self.gridLayout_5.addItem(spacerItem6, 1, 1, 1, 1) self.gridLayout_5.addItem(spacerItem6, 1, 1, 1, 1)
self.tableWidgetAddressBook = QtGui.QTableWidget(self.addressbook) self.tableWidgetAddressBook = QtGui.QTableWidget(self.addressbook)
self.tableWidgetAddressBook.setAlternatingRowColors(True) self.tableWidgetAddressBook.setAlternatingRowColors(True)
self.tableWidgetAddressBook.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.tableWidgetAddressBook.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.tableWidgetAddressBook.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidgetAddressBook.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tableWidgetAddressBook.setObjectName(_fromUtf8("tableWidgetAddressBook")) self.tableWidgetAddressBook.setObjectName(_fromUtf8("tableWidgetAddressBook"))
self.tableWidgetAddressBook.setColumnCount(2) self.tableWidgetAddressBook.setColumnCount(2)

View File

@ -608,7 +608,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
</property> </property>
<property name="selectionBehavior"> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>