Skip to content

Commit 8ff7903

Browse files
committed
Fix: do not update account name from folder name
Last commit caused changes in unread count of folder to change the account name. This is now fixed.
1 parent 8c8795c commit 8ff7903

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

src/bitmessageqt/__init__.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,6 @@ def rerenderTabTree(self, tab):
535535
j += 1
536536
widget.setUnreadCount(unread)
537537
if (tab == 'messages'):
538-
print "setting %s editable" % (toAddress)
539538
widget.setFlags (widget.flags() | QtCore.Qt.ItemIsEditable)
540539
i += 1
541540

@@ -3467,19 +3466,29 @@ def treeWidgetItemClicked(self):
34673466
self.loadMessagelist(messagelist, account, folder)
34683467

34693468
def treeWidgetItemChanged(self, item, column):
3470-
widget = self.getCurrentTreeWidget()
3471-
if item.address == widget.currentItem().address:
3472-
newLabel = str(item.text(0))
3473-
newLabel = newLabel.replace("(" + str(item.address) + ")", '')
3474-
newLabel = newLabel.rstrip()
3475-
oldLabel = shared.config.get(str(item.address), 'label')
3476-
oldLabel = oldLabel.replace("(" + str(item.address) + ")", '')
3477-
oldLabel = oldLabel.rstrip()
3478-
if newLabel == oldLabel:
3479-
return
3480-
shared.config.set(str(item.address), 'label', newLabel)
3481-
item.updateText()
3482-
shared.writeKeysFile()
3469+
# only for manual edits. automatic edits (setText) are ignored
3470+
if column != 0:
3471+
return
3472+
# only account names
3473+
if not isinstance(item, Ui_AddressWidget):
3474+
return
3475+
# only currently selected item
3476+
if item.address != self.getCurrentTreeWidget().currentItem().address:
3477+
return
3478+
3479+
newLabel = str(item.text(0))
3480+
newLabel = newLabel.replace("(" + str(item.address) + ")", '')
3481+
newLabel = newLabel.rstrip()
3482+
oldLabel = shared.config.get(str(item.address), 'label')
3483+
oldLabel = oldLabel.replace("(" + str(item.address) + ")", '')
3484+
oldLabel = oldLabel.rstrip()
3485+
# unchanged, do not do anything either
3486+
if newLabel == oldLabel:
3487+
return
3488+
3489+
shared.config.set(str(item.address), 'label', newLabel)
3490+
item.updateText()
3491+
shared.writeKeysFile()
34833492

34843493
def tableWidgetInboxItemClicked(self):
34853494
folder = self.getCurrentFolder()

0 commit comments

Comments
 (0)