"All accounts" can't be renamed

Minor error
This commit is contained in:
mailchuck 2016-01-10 17:45:49 +01:00
parent 106ac6ce78
commit bf93a394c0
Signed by untrusted user who does not match committer: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 7 additions and 3 deletions

View File

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

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: