From 46494dc3e6001ec1961b0e220e8dacfe2b1ad7b8 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Sun, 10 Jan 2016 17:45:49 +0100 Subject: [PATCH] "All accounts" can't be renamed Minor error --- src/bitmessageqt/__init__.py | 5 +++-- src/bitmessageqt/foldertree.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 754b3a76..9ae4e6cd 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -477,7 +477,6 @@ class MyForm(settingsmixin.SMainWindow): subwidget = Ui_FolderWidget(widget, j, toAddress, folder, 0) j += 1 widget.setUnreadCount(unread) - widget.setFlags (widget.flags() | QtCore.Qt.ItemIsEditable) i += 1 treeWidget.setSortingEnabled(True) @@ -592,7 +591,6 @@ class MyForm(settingsmixin.SMainWindow): unread += db[toAddress][folder] j += 1 widget.setUnreadCount(unread) - widget.setFlags (widget.flags() | QtCore.Qt.ItemIsEditable) i += 1 treeWidget.setSortingEnabled(True) @@ -3938,6 +3936,9 @@ class MyForm(settingsmixin.SMainWindow): # only currently selected item if item.address != self.getCurrentAccount(): return + # "All accounts" can't be renamed + if item.type == AccountMixin.ALL: + return newLabel = str(item.text(0)) if item.type == AccountMixin.SUBSCRIPTION: diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index 6d81f143..19d5dc12 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -61,8 +61,10 @@ class AccountMixin (object): self.updateText() def setType(self): + self.setFlags(self.flags() | QtCore.Qt.ItemIsEditable) if self.address is None: self.type = self.ALL + self.setFlags(self.flags() & ~QtCore.Qt.ItemIsEditable) elif shared.safeConfigGetBoolean(self.address, 'chan'): self.type = self.CHAN elif shared.safeConfigGetBoolean(self.address, 'mailinglist'): @@ -246,7 +248,8 @@ class Ui_SubscriptionWidget(Ui_AddressWidget, AccountMixin): return unicode(self.label, 'utf-8)') def setType(self): - self.type = self.SUBSCRIPTION + super(Ui_SubscriptionWidget, self).setType() # sets it editable + self.type = self.SUBSCRIPTION # overrides type def setData(self, column, role, value): if role == QtCore.Qt.EditRole: