Editable address labels
Address labels can be edited now (F2 or double click)
This commit is contained in:
parent
2bc9c7ff4c
commit
80afc489d8
|
@ -534,8 +534,11 @@ class MyForm(QtGui.QMainWindow):
|
|||
unread += db[toAddress][folder]
|
||||
j += 1
|
||||
widget.setUnreadCount(unread)
|
||||
if (tab == 'messages'):
|
||||
print "setting %s editable" % (toAddress)
|
||||
widget.setFlags (widget.flags() | QtCore.Qt.ItemIsEditable)
|
||||
i += 1
|
||||
|
||||
|
||||
treeWidget.setSortingEnabled(True)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
@ -645,6 +648,8 @@ class MyForm(QtGui.QMainWindow):
|
|||
# tree address lists
|
||||
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
||||
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
||||
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
|
||||
QtCore.QObject.connect(self.ui.treeWidgetSubscriptions, QtCore.SIGNAL(
|
||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
||||
QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
|
||||
|
@ -3463,6 +3468,21 @@ more work your computer must do to send the message. A Time-To-Live of four or f
|
|||
folder = self.getCurrentFolder()
|
||||
self.loadMessagelist(messagelist, account, folder)
|
||||
|
||||
def treeWidgetItemChanged(self, item, column):
|
||||
widget = self.getCurrentTreeWidget()
|
||||
if item.address == widget.currentItem().address:
|
||||
newLabel = str(item.text(0))
|
||||
newLabel = newLabel.replace("(" + str(item.address) + ")", '')
|
||||
newLabel = newLabel.rstrip()
|
||||
oldLabel = shared.config.get(str(item.address), 'label')
|
||||
oldLabel = oldLabel.replace("(" + str(item.address) + ")", '')
|
||||
oldLabel = oldLabel.rstrip()
|
||||
if newLabel == oldLabel:
|
||||
return
|
||||
shared.config.set(str(item.address), 'label', newLabel)
|
||||
item.updateText()
|
||||
shared.writeKeysFile()
|
||||
|
||||
def tableWidgetInboxItemClicked(self):
|
||||
folder = self.getCurrentFolder()
|
||||
messageTextedit = self.getCurrentMessageTextedit()
|
||||
|
|
|
@ -80,9 +80,7 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem):
|
|||
self.updateText()
|
||||
|
||||
def updateText(self):
|
||||
text = QtGui.QApplication.translate("MainWindow",
|
||||
unicode(shared.config.get(self.address, 'label'), 'utf-8)')
|
||||
+ ' (' + self.address + ')')
|
||||
text = unicode(shared.config.get(self.address, 'label'), 'utf-8)') + ' (' + self.address + ')'
|
||||
|
||||
font = QtGui.QFont()
|
||||
if self.unreadCount > 0:
|
||||
|
@ -116,6 +114,10 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem):
|
|||
super(Ui_AddressWidget, self).setExpanded(expand)
|
||||
self.updateText()
|
||||
|
||||
def edit(self):
|
||||
self.setText(0, shared.config.get(self.address, 'label'))
|
||||
super(QtGui.QAbstractItemView, self).edit()
|
||||
|
||||
# label (or address) alphabetically, disabled at the end
|
||||
def __lt__(self, other):
|
||||
if (isinstance(other, Ui_AddressWidget)):
|
||||
|
|
Loading…
Reference in New Issue
Block a user