@@ -535,7 +535,6 @@ def rerenderTabTree(self, tab):
535
535
j += 1
536
536
widget .setUnreadCount (unread )
537
537
if (tab == 'messages' ):
538
- print "setting %s editable" % (toAddress )
539
538
widget .setFlags (widget .flags () | QtCore .Qt .ItemIsEditable )
540
539
i += 1
541
540
@@ -3467,19 +3466,29 @@ def treeWidgetItemClicked(self):
3467
3466
self .loadMessagelist (messagelist , account , folder )
3468
3467
3469
3468
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 ()
3483
3492
3484
3493
def tableWidgetInboxItemClicked (self ):
3485
3494
folder = self .getCurrentFolder ()
0 commit comments