Merge pull request #117 from Atheros1/master

Show unread messages in bold and do not switch to new messages on arrival
This commit is contained in:
Jonathan Warren 2013-04-08 10:36:55 -07:00
commit 88c1167826
3 changed files with 162 additions and 58 deletions

View File

@ -657,8 +657,8 @@ class receiveDataThread(QThread):
toAddress = '[Broadcast subscribers]' toAddress = '[Broadcast subscribers]'
if messageEncodingType <> 0: if messageEncodingType <> 0:
sqlLock.acquire() sqlLock.acquire()
t = (self.inventoryHash,toAddress,fromAddress,subject,int(time.time()),body,'inbox') t = (self.inventoryHash,toAddress,fromAddress,subject,int(time.time()),body,'inbox',messageEncodingType,0)
sqlSubmitQueue.put('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -929,8 +929,8 @@ class receiveDataThread(QThread):
subject = '' subject = ''
if messageEncodingType <> 0: if messageEncodingType <> 0:
sqlLock.acquire() sqlLock.acquire()
t = (self.inventoryHash,toAddress,fromAddress,subject,int(time.time()),body,'inbox') t = (self.inventoryHash,toAddress,fromAddress,subject,int(time.time()),body,'inbox',messageEncodingType,0)
sqlSubmitQueue.put('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -961,8 +961,8 @@ class receiveDataThread(QThread):
toAddress = '[Broadcast subscribers]' toAddress = '[Broadcast subscribers]'
ripe = '' ripe = ''
sqlLock.acquire() sqlLock.acquire()
t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'broadcastpending',1,1,'sent') t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'broadcastpending',1,1,'sent',2)
sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -1943,8 +1943,8 @@ class sqlThread(QThread):
self.conn.text_factory = str self.conn.text_factory = str
self.cur = self.conn.cursor() self.cur = self.conn.cursor()
try: try:
self.cur.execute( '''CREATE TABLE inbox (msgid blob, toaddress text, fromaddress text, subject text, received text, message text, folder text, UNIQUE(msgid) ON CONFLICT REPLACE)''' ) self.cur.execute( '''CREATE TABLE inbox (msgid blob, toaddress text, fromaddress text, subject text, received text, message text, folder text, encodingtype int, read bool, UNIQUE(msgid) ON CONFLICT REPLACE)''' )
self.cur.execute( '''CREATE TABLE sent (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text, ackdata blob, lastactiontime integer, status text, pubkeyretrynumber integer, msgretrynumber integer, folder text)''' ) self.cur.execute( '''CREATE TABLE sent (msgid blob, toaddress text, toripe blob, fromaddress text, subject text, message text, ackdata blob, lastactiontime integer, status text, pubkeyretrynumber integer, msgretrynumber integer, folder text, encodingtype int)''' )
self.cur.execute( '''CREATE TABLE subscriptions (label text, address text, enabled bool)''' ) self.cur.execute( '''CREATE TABLE subscriptions (label text, address text, enabled bool)''' )
self.cur.execute( '''CREATE TABLE addressbook (label text, address text)''' ) self.cur.execute( '''CREATE TABLE addressbook (label text, address text)''' )
self.cur.execute( '''CREATE TABLE blacklist (label text, address text, enabled bool)''' ) self.cur.execute( '''CREATE TABLE blacklist (label text, address text, enabled bool)''' )
@ -1979,6 +1979,25 @@ class sqlThread(QThread):
with open(appdata + 'keys.dat', 'wb') as configfile: with open(appdata + 'keys.dat', 'wb') as configfile:
config.write(configfile) config.write(configfile)
#People running earlier versions of PyBitmessage do not have the encodingtype field in their inbox and sent tables or the read field in the inbox table. Let's add them.
if config.getint('bitmessagesettings','settingsversion') == 3:
item = '''ALTER TABLE inbox ADD encodingtype int DEFAULT '2' '''
parameters = ''
self.cur.execute(item, parameters)
item = '''ALTER TABLE inbox ADD read bool DEFAULT '1' '''
parameters = ''
self.cur.execute(item, parameters)
item = '''ALTER TABLE sent ADD encodingtype int DEFAULT '2' '''
parameters = ''
self.cur.execute(item, parameters)
self.conn.commit()
config.set('bitmessagesettings','settingsversion','4')
with open(appdata + 'keys.dat', 'wb') as configfile:
config.write(configfile)
try: try:
testpayload = '\x00\x00' testpayload = '\x00\x00'
t = ('1234','True',testpayload,'12345678','no') t = ('1234','True',testpayload,'12345678','no')
@ -3020,8 +3039,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
sqlLock.acquire() sqlLock.acquire()
t = ('',toAddress,toRipe,fromAddress,subject,message,ackdata,int(time.time()),'findingpubkey',1,1,'sent') t = ('',toAddress,toRipe,fromAddress,subject,message,ackdata,int(time.time()),'findingpubkey',1,1,'sent',2)
sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -3081,8 +3100,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
ripe = '' ripe = ''
sqlLock.acquire() sqlLock.acquire()
t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'broadcastpending',1,1,'sent') t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'broadcastpending',1,1,'sent',2)
sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -3416,12 +3435,17 @@ class MyForm(QtGui.QMainWindow):
self.actionsubscriptionsNew = self.ui.subscriptionsContextMenuToolbar.addAction("New", self.on_action_SubscriptionsNew) self.actionsubscriptionsNew = self.ui.subscriptionsContextMenuToolbar.addAction("New", self.on_action_SubscriptionsNew)
self.actionsubscriptionsDelete = self.ui.subscriptionsContextMenuToolbar.addAction("Delete", self.on_action_SubscriptionsDelete) self.actionsubscriptionsDelete = self.ui.subscriptionsContextMenuToolbar.addAction("Delete", self.on_action_SubscriptionsDelete)
self.actionsubscriptionsClipboard = self.ui.subscriptionsContextMenuToolbar.addAction("Copy address to clipboard", self.on_action_SubscriptionsClipboard) self.actionsubscriptionsClipboard = self.ui.subscriptionsContextMenuToolbar.addAction("Copy address to clipboard", self.on_action_SubscriptionsClipboard)
self.actionsubscriptionsEnable = self.ui.subscriptionsContextMenuToolbar.addAction("Enable", self.on_action_SubscriptionsEnable)
self.actionsubscriptionsDisable = self.ui.subscriptionsContextMenuToolbar.addAction("Disable", self.on_action_SubscriptionsDisable)
self.ui.tableWidgetSubscriptions.setContextMenuPolicy( QtCore.Qt.CustomContextMenu ) self.ui.tableWidgetSubscriptions.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuSubscriptions) self.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuSubscriptions)
self.popMenuSubscriptions = QtGui.QMenu( self ) self.popMenuSubscriptions = QtGui.QMenu( self )
self.popMenuSubscriptions.addAction( self.actionsubscriptionsNew ) self.popMenuSubscriptions.addAction( self.actionsubscriptionsNew )
self.popMenuSubscriptions.addAction( self.actionsubscriptionsDelete ) self.popMenuSubscriptions.addAction( self.actionsubscriptionsDelete )
self.popMenuSubscriptions.addSeparator() self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction( self.actionsubscriptionsEnable )
self.popMenuSubscriptions.addAction( self.actionsubscriptionsDisable )
self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction( self.actionsubscriptionsClipboard ) self.popMenuSubscriptions.addAction( self.actionsubscriptionsClipboard )
#Popup menu for the Sent page #Popup menu for the Sent page
@ -3487,13 +3511,14 @@ class MyForm(QtGui.QMainWindow):
self.reloadBroadcastSendersForWhichImWatching() self.reloadBroadcastSendersForWhichImWatching()
self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent
font = QFont()
font.setBold(True)
#Load inbox from messages database file #Load inbox from messages database file
sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, received, message FROM inbox where folder='inbox' ORDER BY received''') sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, received, message, read FROM inbox where folder='inbox' ORDER BY received''')
sqlSubmitQueue.put('') sqlSubmitQueue.put('')
queryreturn = sqlReturnQueue.get() queryreturn = sqlReturnQueue.get()
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, = row msgid, toAddress, fromAddress, subject, received, message, read = row
try: try:
if toAddress == '[Broadcast subscribers]': if toAddress == '[Broadcast subscribers]':
@ -3518,6 +3543,8 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetInbox.insertRow(0) self.ui.tableWidgetInbox.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole,str(toAddress)) newItem.setData(Qt.UserRole,str(toAddress))
if safeConfigGetBoolean(toAddress,'mailinglist'): if safeConfigGetBoolean(toAddress,'mailinglist'):
newItem.setTextColor(QtGui.QColor(137,04,177)) newItem.setTextColor(QtGui.QColor(137,04,177))
@ -3527,19 +3554,24 @@ class MyForm(QtGui.QMainWindow):
else: else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel,'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(fromLabel,'utf-8'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole,str(fromAddress)) newItem.setData(Qt.UserRole,str(fromAddress))
self.ui.tableWidgetInbox.setItem(0,1,newItem) self.ui.tableWidgetInbox.setItem(0,1,newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8'))
newItem.setData(Qt.UserRole,unicode(message,'utf-8)')) newItem.setData(Qt.UserRole,unicode(message,'utf-8)'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,2,newItem) self.ui.tableWidgetInbox.setItem(0,2,newItem)
newItem = myTableWidgetItem(unicode(strftime(config.get('bitmessagesettings', 'timeformat'),localtime(int(received))),'utf-8')) newItem = myTableWidgetItem(unicode(strftime(config.get('bitmessagesettings', 'timeformat'),localtime(int(received))),'utf-8'))
newItem.setData(Qt.UserRole,QByteArray(msgid)) newItem.setData(Qt.UserRole,QByteArray(msgid))
newItem.setData(33,int(received)) newItem.setData(33,int(received))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,3,newItem) self.ui.tableWidgetInbox.setItem(0,3,newItem)
#self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(0,2).data(Qt.UserRole).toPyObject())
self.ui.tableWidgetInbox.sortItems(3,Qt.DescendingOrder) self.ui.tableWidgetInbox.sortItems(3,Qt.DescendingOrder)
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetInboxKeyPressEvent self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetInboxKeyPressEvent
@ -3619,16 +3651,20 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetAddressBook.setItem(0,1,newItem) self.ui.tableWidgetAddressBook.setItem(0,1,newItem)
#Initialize the Subscriptions #Initialize the Subscriptions
sqlSubmitQueue.put('SELECT label, address FROM subscriptions') sqlSubmitQueue.put('SELECT label, address, enabled FROM subscriptions')
sqlSubmitQueue.put('') sqlSubmitQueue.put('')
queryreturn = sqlReturnQueue.get() queryreturn = sqlReturnQueue.get()
for row in queryreturn: for row in queryreturn:
label, address = row label, address, enabled = row
self.ui.tableWidgetSubscriptions.insertRow(0) self.ui.tableWidgetSubscriptions.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(label,'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(label,'utf-8'))
if not enabled:
newItem.setTextColor(QtGui.QColor(128,128,128))
self.ui.tableWidgetSubscriptions.setItem(0,0,newItem) self.ui.tableWidgetSubscriptions.setItem(0,0,newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
if not enabled:
newItem.setTextColor(QtGui.QColor(128,128,128))
self.ui.tableWidgetSubscriptions.setItem(0,1,newItem) self.ui.tableWidgetSubscriptions.setItem(0,1,newItem)
#Initialize the Blacklist or Whitelist #Initialize the Blacklist or Whitelist
@ -3970,8 +4006,8 @@ class MyForm(QtGui.QMainWindow):
self.statusBar().showMessage('Warning: The address uses a stream number currently not supported by this Bitmessage version. Perhaps upgrade.') self.statusBar().showMessage('Warning: The address uses a stream number currently not supported by this Bitmessage version. Perhaps upgrade.')
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
sqlLock.acquire() sqlLock.acquire()
t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'findingpubkey',1,1,'sent') t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'findingpubkey',1,1,'sent',2)
sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -4045,8 +4081,8 @@ class MyForm(QtGui.QMainWindow):
toAddress = '[Broadcast subscribers]' toAddress = '[Broadcast subscribers]'
ripe = '' ripe = ''
sqlLock.acquire() sqlLock.acquire()
t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'broadcastpending',1,1,'sent') t = ('',toAddress,ripe,fromAddress,subject,message,ackdata,int(time.time()),'broadcastpending',1,1,'sent',2)
sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?)''') sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''')
sqlSubmitQueue.put(t) sqlSubmitQueue.put(t)
sqlReturnQueue.get() sqlReturnQueue.get()
sqlSubmitQueue.put('commit') sqlSubmitQueue.put('commit')
@ -4229,8 +4265,11 @@ class MyForm(QtGui.QMainWindow):
if toLabel == '': if toLabel == '':
toLabel = toAddress toLabel = toAddress
font = QFont()
font.setBold(True)
self.ui.tableWidgetInbox.setSortingEnabled(False) self.ui.tableWidgetInbox.setSortingEnabled(False)
newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8'))
newItem.setFont(font)
newItem.setData(Qt.UserRole,str(toAddress)) newItem.setData(Qt.UserRole,str(toAddress))
if safeConfigGetBoolean(str(toAddress),'mailinglist'): if safeConfigGetBoolean(str(toAddress),'mailinglist'):
newItem.setTextColor(QtGui.QColor(137,04,177)) newItem.setTextColor(QtGui.QColor(137,04,177))
@ -4246,21 +4285,23 @@ class MyForm(QtGui.QMainWindow):
if config.getboolean('bitmessagesettings', 'showtraynotifications'): if config.getboolean('bitmessagesettings', 'showtraynotifications'):
self.trayIcon.showMessage('New Message', 'New message from '+fromLabel, 1, 2000) self.trayIcon.showMessage('New Message', 'New message from '+fromLabel, 1, 2000)
newItem.setData(Qt.UserRole,str(fromAddress)) newItem.setData(Qt.UserRole,str(fromAddress))
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,1,newItem) self.ui.tableWidgetInbox.setItem(0,1,newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8)')) newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8)'))
newItem.setData(Qt.UserRole,unicode(message,'utf-8)')) newItem.setData(Qt.UserRole,unicode(message,'utf-8)'))
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,2,newItem) self.ui.tableWidgetInbox.setItem(0,2,newItem)
newItem = myTableWidgetItem(unicode(strftime(config.get('bitmessagesettings', 'timeformat'),localtime(int(time.time()))),'utf-8')) newItem = myTableWidgetItem(unicode(strftime(config.get('bitmessagesettings', 'timeformat'),localtime(int(time.time()))),'utf-8'))
newItem.setData(Qt.UserRole,QByteArray(inventoryHash)) newItem.setData(Qt.UserRole,QByteArray(inventoryHash))
newItem.setData(33,int(time.time())) newItem.setData(33,int(time.time()))
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,3,newItem) self.ui.tableWidgetInbox.setItem(0,3,newItem)
self.ui.tableWidgetInbox.setCurrentCell(0,0)
#If we have received this message from either a broadcast address or from someone in our address book, display as HTML """#If we have received this message from either a broadcast address or from someone in our address book, display as HTML
if decodeAddress(fromAddress)[3] in broadcastSendersForWhichImWatching or isAddressInMyAddressBook(fromAddress): if decodeAddress(fromAddress)[3] in broadcastSendersForWhichImWatching or isAddressInMyAddressBook(fromAddress):
self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item(0,2).data(Qt.UserRole).toPyObject()) self.ui.textEditInboxMessage.setText(self.ui.tableWidgetInbox.item(0,2).data(Qt.UserRole).toPyObject())
else: else:
self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(0,2).data(Qt.UserRole).toPyObject()) self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(0,2).data(Qt.UserRole).toPyObject())"""
self.ui.tableWidgetInbox.setSortingEnabled(True) self.ui.tableWidgetInbox.setSortingEnabled(True)
def click_pushButtonAddAddressBook(self): def click_pushButtonAddAddressBook(self):
@ -4683,7 +4724,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 +4747,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) )
@ -4761,6 +4816,32 @@ class MyForm(QtGui.QMainWindow):
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(currentRow,1).text() addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(currentRow,1).text()
clipboard = QtGui.QApplication.clipboard() clipboard = QtGui.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow)) clipboard.setText(str(addressAtCurrentRow))
def on_action_SubscriptionsEnable(self):
currentRow = self.ui.tableWidgetSubscriptions.currentRow()
labelAtCurrentRow = self.ui.tableWidgetSubscriptions.item(currentRow,0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(currentRow,1).text()
t = (str(labelAtCurrentRow),str(addressAtCurrentRow))
sqlLock.acquire()
sqlSubmitQueue.put('''update subscriptions set enabled=1 WHERE label=? AND address=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlSubmitQueue.put('commit')
sqlLock.release()
self.ui.tableWidgetSubscriptions.item(currentRow,0).setTextColor(QtGui.QColor(0,0,0))
self.reloadBroadcastSendersForWhichImWatching()
def on_action_SubscriptionsDisable(self):
currentRow = self.ui.tableWidgetSubscriptions.currentRow()
labelAtCurrentRow = self.ui.tableWidgetSubscriptions.item(currentRow,0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(currentRow,1).text()
t = (str(labelAtCurrentRow),str(addressAtCurrentRow))
sqlLock.acquire()
sqlSubmitQueue.put('''update subscriptions set enabled=0 WHERE label=? AND address=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlSubmitQueue.put('commit')
sqlLock.release()
self.ui.tableWidgetSubscriptions.item(currentRow,0).setTextColor(QtGui.QColor(128,128,128))
self.reloadBroadcastSendersForWhichImWatching()
def on_context_menuSubscriptions(self, point): def on_context_menuSubscriptions(self, point):
self.popMenuSubscriptions.exec_( self.ui.tableWidgetSubscriptions.mapToGlobal(point) ) self.popMenuSubscriptions.exec_( self.ui.tableWidgetSubscriptions.mapToGlobal(point) )
@ -4768,7 +4849,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()
@ -4876,6 +4956,22 @@ class MyForm(QtGui.QMainWindow):
else: else:
self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject()) self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject())
inventoryHash = str(self.ui.tableWidgetInbox.item(currentRow,3).data(Qt.UserRole).toPyObject())
t = (inventoryHash,)
sqlLock.acquire()
sqlSubmitQueue.put('''update inbox set read=1 WHERE msgid=?''')
sqlSubmitQueue.put(t)
sqlReturnQueue.get()
sqlSubmitQueue.put('commit')
sqlLock.release()
font = QFont()
font.setBold(False)
self.ui.tableWidgetInbox.item(currentRow,0).setFont(font)
self.ui.tableWidgetInbox.item(currentRow,1).setFont(font)
self.ui.tableWidgetInbox.item(currentRow,2).setFont(font)
self.ui.tableWidgetInbox.item(currentRow,3).setFont(font)
def tableWidgetSentItemClicked(self): def tableWidgetSentItemClicked(self):
currentRow = self.ui.tableWidgetSent.currentRow() currentRow = self.ui.tableWidgetSent.currentRow()
@ -4933,7 +5029,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):
@ -4946,7 +5042,7 @@ class MyForm(QtGui.QMainWindow):
def reloadBroadcastSendersForWhichImWatching(self): def reloadBroadcastSendersForWhichImWatching(self):
broadcastSendersForWhichImWatching.clear() broadcastSendersForWhichImWatching.clear()
sqlLock.acquire() sqlLock.acquire()
sqlSubmitQueue.put('SELECT address FROM subscriptions') sqlSubmitQueue.put('SELECT address FROM subscriptions where enabled=1')
sqlSubmitQueue.put('') sqlSubmitQueue.put('')
queryreturn = sqlReturnQueue.get() queryreturn = sqlReturnQueue.get()
sqlLock.release() sqlLock.release()
@ -5021,7 +5117,7 @@ if __name__ == "__main__":
except: except:
#This appears to be the first time running the program; there is no config file (or it cannot be accessed). Create config file. #This appears to be the first time running the program; there is no config file (or it cannot be accessed). Create config file.
config.add_section('bitmessagesettings') config.add_section('bitmessagesettings')
config.set('bitmessagesettings','settingsversion','1') config.set('bitmessagesettings','settingsversion','4')
config.set('bitmessagesettings','port','8444') config.set('bitmessagesettings','port','8444')
config.set('bitmessagesettings','timeformat','%%a, %%d %%b %%Y %%I:%%M %%p') config.set('bitmessagesettings','timeformat','%%a, %%d %%b %%Y %%I:%%M %%p')
config.set('bitmessagesettings','blackwhitelist','black') config.set('bitmessagesettings','blackwhitelist','black')
@ -5032,6 +5128,14 @@ if __name__ == "__main__":
config.set('bitmessagesettings','minimizetotray','true') config.set('bitmessagesettings','minimizetotray','true')
config.set('bitmessagesettings','showtraynotifications','true') config.set('bitmessagesettings','showtraynotifications','true')
config.set('bitmessagesettings','startintray','false') config.set('bitmessagesettings','startintray','false')
config.set('bitmessagesettings','socksproxytype','none')
config.set('bitmessagesettings','sockshostname','localhost')
config.set('bitmessagesettings','socksport','9050')
config.set('bitmessagesettings','socksauthentication','false')
config.set('bitmessagesettings','socksusername','')
config.set('bitmessagesettings','sockspassword','')
config.set('bitmessagesettings','keysencrypted','false')
config.set('bitmessagesettings','messagesencrypted','false')
if storeConfigFilesInSameDirectoryAsProgramByDefault: if storeConfigFilesInSameDirectoryAsProgramByDefault:
#Just use the same directory as the program and forget about the appdata folder #Just use the same directory as the program and forget about the appdata folder
@ -5045,7 +5149,7 @@ if __name__ == "__main__":
config.write(configfile) config.write(configfile)
if config.getint('bitmessagesettings','settingsversion') == 1: if config.getint('bitmessagesettings','settingsversion') == 1:
config.set('bitmessagesettings','settingsversion','3') #If the settings version is equal to 2 then the sqlThread will modify the pubkeys table and change the settings version to 3. config.set('bitmessagesettings','settingsversion','4') #If the settings version is equal to 2 or 3 then the sqlThread will modify the pubkeys table and change the settings version to 4.
config.set('bitmessagesettings','socksproxytype','none') config.set('bitmessagesettings','socksproxytype','none')
config.set('bitmessagesettings','sockshostname','localhost') config.set('bitmessagesettings','sockshostname','localhost')
config.set('bitmessagesettings','socksport','9050') config.set('bitmessagesettings','socksport','9050')
@ -5091,7 +5195,7 @@ if __name__ == "__main__":
knownNodes = pickle.load(pickleFile) knownNodes = pickle.load(pickleFile)
pickleFile.close() pickleFile.close()
if config.getint('bitmessagesettings', 'settingsversion') > 3: if config.getint('bitmessagesettings', 'settingsversion') > 4:
print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.' print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
raise SystemExit raise SystemExit

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>