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]
|
unread += db[toAddress][folder]
|
||||||
j += 1
|
j += 1
|
||||||
widget.setUnreadCount(unread)
|
widget.setUnreadCount(unread)
|
||||||
|
if (tab == 'messages'):
|
||||||
|
print "setting %s editable" % (toAddress)
|
||||||
|
widget.setFlags (widget.flags() | QtCore.Qt.ItemIsEditable)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
treeWidget.setSortingEnabled(True)
|
treeWidget.setSortingEnabled(True)
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
|
@ -645,6 +648,8 @@ class MyForm(QtGui.QMainWindow):
|
||||||
# tree address lists
|
# tree address lists
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
||||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
||||||
|
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
||||||
|
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetSubscriptions, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.treeWidgetSubscriptions, QtCore.SIGNAL(
|
||||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
|
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()
|
folder = self.getCurrentFolder()
|
||||||
self.loadMessagelist(messagelist, account, folder)
|
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):
|
def tableWidgetInboxItemClicked(self):
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
messageTextedit = self.getCurrentMessageTextedit()
|
messageTextedit = self.getCurrentMessageTextedit()
|
||||||
|
|
|
@ -80,9 +80,7 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem):
|
||||||
self.updateText()
|
self.updateText()
|
||||||
|
|
||||||
def updateText(self):
|
def updateText(self):
|
||||||
text = QtGui.QApplication.translate("MainWindow",
|
text = unicode(shared.config.get(self.address, 'label'), 'utf-8)') + ' (' + self.address + ')'
|
||||||
unicode(shared.config.get(self.address, 'label'), 'utf-8)')
|
|
||||||
+ ' (' + self.address + ')')
|
|
||||||
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
if self.unreadCount > 0:
|
if self.unreadCount > 0:
|
||||||
|
@ -116,6 +114,10 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem):
|
||||||
super(Ui_AddressWidget, self).setExpanded(expand)
|
super(Ui_AddressWidget, self).setExpanded(expand)
|
||||||
self.updateText()
|
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
|
# label (or address) alphabetically, disabled at the end
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if (isinstance(other, Ui_AddressWidget)):
|
if (isinstance(other, Ui_AddressWidget)):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user