"All accounts" can't be renamed

Minor error
This commit is contained in:
mailchuck 2016-01-10 17:45:49 +01:00 committed by Peter Surda
parent f4c2cc5160
commit 46494dc3e6
2 changed files with 7 additions and 3 deletions

View File

@ -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:

View File

@ -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: