From bf93a394c0bb631800503dbb9d3b7ada7b022bb8 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 ad711103..dc5cf9c1 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -478,7 +478,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) @@ -593,7 +592,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) @@ -3939,6 +3937,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: