From 55251762160ef5571f937b0ccf62e7afd88bbdbe Mon Sep 17 00:00:00 2001 From: mailchuck Date: Mon, 5 Oct 2015 10:32:56 +0200 Subject: [PATCH] Chan updates - chans now work with the new interface, still some bugs present - chans do not have a sent folder anymore (you'll see sent messages in the sent folder of the account you're sending it from) --- src/bitmessageqt/__init__.py | 16 +++++++++------- src/bitmessageqt/foldertree.py | 14 +++++++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 6feb12cb..7e1b63ca 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -447,11 +447,12 @@ class MyForm(QtGui.QMainWindow): self.rerenderTabTree('chan') def rerenderTabTree(self, tab): - folders = ['inbox', 'sent', 'trash'] if tab == 'messages': treeWidget = self.ui.treeWidgetYourIdentities + folders = ['inbox', 'sent', 'trash'] elif tab == 'chan': treeWidget = self.ui.treeWidgetChans + folders = ['inbox', 'trash'] # sort ascending when creating if treeWidget.topLevelItemCount() == 0: @@ -874,6 +875,7 @@ class MyForm(QtGui.QMainWindow): else: where = "toaddress || fromaddress || subject || message" + tableWidget.setColumnHidden(0, False) tableWidget.setColumnHidden(1, True) tableWidget.setSortingEnabled(False) @@ -2248,9 +2250,9 @@ more work your computer must do to send the message. A Time-To-Live of four or f newItem.setToolTip(unicode(acct.toLabel, 'utf-8')) newItem.setFont(font) newItem.setData(Qt.UserRole, str(toAddress)) - if shared.safeConfigGetBoolean(str(toAddress), 'mailinglist'): + if acct.type == 'mailinglist': newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta - if shared.safeConfigGetBoolean(str(toAddress), 'chan'): + if acct.type == 'chan': newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange self.ui.tableWidgetInbox.insertRow(0) newItem.setIcon(avatarize(toAddress)) @@ -3261,8 +3263,8 @@ more work your computer must do to send the message. A Time-To-Live of four or f # Group of functions for the Your Identities dialog box def getCurrentAccount(self): - #treeWidget = self.getCurrentTreeWidget() - treeWidget = self.ui.treeWidgetYourIdentities + treeWidget = self.getCurrentTreeWidget() + #treeWidget = self.ui.treeWidgetYourIdentities if treeWidget: currentItem = treeWidget.currentItem() if currentItem: @@ -3474,8 +3476,8 @@ more work your computer must do to send the message. A Time-To-Live of four or f # only for manual edits. automatic edits (setText) are ignored if column != 0: return - # only account names - if not isinstance(item, Ui_AddressWidget): + # only account names of normal addresses (no chans/mailinglists) + if (not isinstance(item, Ui_AddressWidget)) or item.type != 'normal': return # only currently selected item if item.address != self.getCurrentTreeWidget().currentItem().address: diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index 2a907711..cb06763b 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -63,18 +63,26 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem): class Ui_AddressWidget(QtGui.QTreeWidgetItem): def __init__(self, parent, pos = 0, address = "", unreadCount = 0): super(QtGui.QTreeWidgetItem, self).__init__() - self.address = address self.unreadCount = unreadCount parent.insertTopLevelItem(pos, self) # only set default when creating #super(QtGui.QTreeWidgetItem, self).setExpanded(shared.config.getboolean(self.address, 'enabled')) - self.setExpanded(shared.safeConfigGetBoolean(self.address, 'enabled')) - self.updateText() + self.setAddress(address) def setAddress(self, address): self.address = str(address) + self.setType() + self.setExpanded(shared.safeConfigGetBoolean(self.address, 'enabled')) self.updateText() + def setType(self): + if shared.safeConfigGetBoolean(self.address, 'chan'): + self.type = "chan" + elif shared.safeConfigGetBoolean(self.address, 'mailinglist'): + self.type = "mailinglist" + else: + self.type = "normal" + def setUnreadCount(self, cnt): self.unreadCount = int(cnt) self.updateText()