From a4b1a781ce00f2c8608449eaf043b8be17040a30 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 14 Feb 2017 01:35:32 +0100 Subject: [PATCH] Minor UI fixes - "new" folder consistently appears in chans and "All accounts" - "Sent" message list sorting fix - When editing a label, keys.dat is saved and the lineEdit completer is updated - addressbook is updated when adding/deleting a new chan --- src/bitmessageqt/__init__.py | 13 +++++++++++-- src/bitmessageqt/foldertree.py | 1 + src/bitmessageqt/newchandialog.py | 1 - 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index c44339f8..3917f7d7 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -571,6 +571,8 @@ class MyForm(settingsmixin.SMainWindow): if len(db[toAddress]) > 0: j = 0 for f, c in db[toAddress].iteritems(): + if toAddress is not None and tab == 'messages' and folder == "new": + continue subwidget = Ui_FolderWidget(widget, j, toAddress, f, c) if subwidget.folderName not in ["new", "trash", "sent"]: unread += c @@ -585,7 +587,7 @@ class MyForm(settingsmixin.SMainWindow): j = 0 unread = 0 for folder in folders: - if toAddress is not None and folder == "new": + if toAddress is not None and tab == 'messages' and folder == "new": continue subwidget = Ui_FolderWidget(widget, j, toAddress, folder, db[toAddress][folder]) if subwidget.folderName not in ["new", "trash", "sent"]: @@ -1115,8 +1117,8 @@ class MyForm(settingsmixin.SMainWindow): toAddress, fromAddress, subject, status, ackdata, lastactiontime = row self.addMessageListItemSent(tableWidget, toAddress, fromAddress, subject, status, ackdata, lastactiontime) - tableWidget.setSortingEnabled(False) tableWidget.horizontalHeader().setSortIndicator(3, Qt.DescendingOrder) + tableWidget.setSortingEnabled(True) tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Sent", None)) tableWidget.setUpdatesEnabled(True) @@ -3558,6 +3560,7 @@ class MyForm(settingsmixin.SMainWindow): BMConfigParser().save() shared.reloadMyAddressHashes() self.rerenderAddressBook() + self.rerenderComboBoxSendFrom() if account.type == AccountMixin.NORMAL: self.rerenderTabTreeMessages() elif account.type == AccountMixin.CHAN: @@ -3937,6 +3940,11 @@ class MyForm(settingsmixin.SMainWindow): self.rerenderComboBoxSendFrom() self.rerenderMessagelistFromLabels() self.rerenderMessagelistToLabels() + completerList = self.ui.lineEditTo.completer().model().stringList() + for i in range(len(completerList)): + if str(completerList[i]).endswith(" <" + item.address + ">"): + completerList[i] = item.label + " <" + item.address + ">" + stringList = self.ui.lineEditTo.completer().model().setStringList(completerList) def writeNewAddressToTable(self, label, address, streamNumber): self.rerenderTabTreeMessages() @@ -3944,6 +3952,7 @@ class MyForm(settingsmixin.SMainWindow): self.rerenderTabTreeChans() self.rerenderComboBoxSendFrom() self.rerenderComboBoxSendFromBroadcast() + self.rerenderAddressBook() def updateStatusBar(self, data): if type(data) is tuple or type(data) is list: diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index 821efdb4..4392495d 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -442,6 +442,7 @@ class Ui_AddressBookWidgetItem(QtGui.QTableWidgetItem, AccountMixin): try: a = BMConfigParser().get(self.address, 'label') BMConfigParser().set(self.address, 'label', self.label) + BMConfigParser().save() except: sqlExecute('''UPDATE addressbook set label=? WHERE address=?''', self.label, self.address) elif self.type == AccountMixin.SUBSCRIPTION: diff --git a/src/bitmessageqt/newchandialog.py b/src/bitmessageqt/newchandialog.py index 64ed3a8c..a7784206 100644 --- a/src/bitmessageqt/newchandialog.py +++ b/src/bitmessageqt/newchandialog.py @@ -39,7 +39,6 @@ class NewChanDialog(QtGui.QDialog, RetranslateMixin): if len(addressGeneratorReturnValue) > 0 and addressGeneratorReturnValue[0] != 'chan name does not match address': UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Successfully created / joined chan %1").arg(str(self.chanPassPhrase.text().toUtf8())))) self.parent.ui.tabWidget.setCurrentIndex(3) - self.parent.rerenderAddressBook() self.done(QtGui.QDialog.Accepted) else: UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed")))