Missing folders in rerenderTabTreeSubscriptions

I optimised it too much and sometimes folders were missing in the tree.
This commit is contained in:
mailchuck 2015-11-19 04:14:13 +01:00
parent 164ae6b31f
commit 159b68fa17
Signed by untrusted user who does not match committer: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -385,6 +385,10 @@ class MyForm(settingsmixin.SMainWindow):
# init dictionary # init dictionary
db = getSortedSubscriptions(True) db = getSortedSubscriptions(True)
for address in db:
for folder in folders:
if not folder in db[address]:
db[address][folder] = {}
if treeWidget.isSortingEnabled(): if treeWidget.isSortingEnabled():
treeWidget.setSortingEnabled(False) treeWidget.setSortingEnabled(False)
@ -420,7 +424,10 @@ class MyForm(settingsmixin.SMainWindow):
if len(db[toAddress]) > 0: if len(db[toAddress]) > 0:
j = 0 j = 0
for f, c in db[toAddress].iteritems(): for f, c in db[toAddress].iteritems():
try:
subwidget = Ui_FolderWidget(widget, j, toAddress, f, c['count']) subwidget = Ui_FolderWidget(widget, j, toAddress, f, c['count'])
except KeyError:
subwidget = Ui_FolderWidget(widget, j, toAddress, f, 0)
j += 1 j += 1
widget.setUnreadCount(unread) widget.setUnreadCount(unread)
db.pop(toAddress, None) db.pop(toAddress, None)