Chan updates

- chans now work with the new interface, still some bugs present
- chans do not have a sent folder anymore (you'll see sent messages in
the sent folder of the account you're sending it from)
This commit is contained in:
mailchuck 2015-10-05 10:32:56 +02:00 committed by Peter Surda
parent b8baceb629
commit 5525176216
2 changed files with 20 additions and 10 deletions

View File

@ -447,11 +447,12 @@ class MyForm(QtGui.QMainWindow):
self.rerenderTabTree('chan') self.rerenderTabTree('chan')
def rerenderTabTree(self, tab): def rerenderTabTree(self, tab):
folders = ['inbox', 'sent', 'trash']
if tab == 'messages': if tab == 'messages':
treeWidget = self.ui.treeWidgetYourIdentities treeWidget = self.ui.treeWidgetYourIdentities
folders = ['inbox', 'sent', 'trash']
elif tab == 'chan': elif tab == 'chan':
treeWidget = self.ui.treeWidgetChans treeWidget = self.ui.treeWidgetChans
folders = ['inbox', 'trash']
# sort ascending when creating # sort ascending when creating
if treeWidget.topLevelItemCount() == 0: if treeWidget.topLevelItemCount() == 0:
@ -874,6 +875,7 @@ class MyForm(QtGui.QMainWindow):
else: else:
where = "toaddress || fromaddress || subject || message" where = "toaddress || fromaddress || subject || message"
tableWidget.setColumnHidden(0, False) tableWidget.setColumnHidden(0, False)
tableWidget.setColumnHidden(1, True) tableWidget.setColumnHidden(1, True)
tableWidget.setSortingEnabled(False) tableWidget.setSortingEnabled(False)
@ -2248,9 +2250,9 @@ more work your computer must do to send the message. A Time-To-Live of four or f
newItem.setToolTip(unicode(acct.toLabel, 'utf-8')) newItem.setToolTip(unicode(acct.toLabel, 'utf-8'))
newItem.setFont(font) newItem.setFont(font)
newItem.setData(Qt.UserRole, str(toAddress)) newItem.setData(Qt.UserRole, str(toAddress))
if shared.safeConfigGetBoolean(str(toAddress), 'mailinglist'): if acct.type == 'mailinglist':
newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta
if shared.safeConfigGetBoolean(str(toAddress), 'chan'): if acct.type == 'chan':
newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange
self.ui.tableWidgetInbox.insertRow(0) self.ui.tableWidgetInbox.insertRow(0)
newItem.setIcon(avatarize(toAddress)) newItem.setIcon(avatarize(toAddress))
@ -3261,8 +3263,8 @@ more work your computer must do to send the message. A Time-To-Live of four or f
# Group of functions for the Your Identities dialog box # Group of functions for the Your Identities dialog box
def getCurrentAccount(self): def getCurrentAccount(self):
#treeWidget = self.getCurrentTreeWidget() treeWidget = self.getCurrentTreeWidget()
treeWidget = self.ui.treeWidgetYourIdentities #treeWidget = self.ui.treeWidgetYourIdentities
if treeWidget: if treeWidget:
currentItem = treeWidget.currentItem() currentItem = treeWidget.currentItem()
if currentItem: if currentItem:
@ -3474,8 +3476,8 @@ more work your computer must do to send the message. A Time-To-Live of four or f
# only for manual edits. automatic edits (setText) are ignored # only for manual edits. automatic edits (setText) are ignored
if column != 0: if column != 0:
return return
# only account names # only account names of normal addresses (no chans/mailinglists)
if not isinstance(item, Ui_AddressWidget): if (not isinstance(item, Ui_AddressWidget)) or item.type != 'normal':
return return
# only currently selected item # only currently selected item
if item.address != self.getCurrentTreeWidget().currentItem().address: if item.address != self.getCurrentTreeWidget().currentItem().address:

View File

@ -63,18 +63,26 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem):
class Ui_AddressWidget(QtGui.QTreeWidgetItem): class Ui_AddressWidget(QtGui.QTreeWidgetItem):
def __init__(self, parent, pos = 0, address = "", unreadCount = 0): def __init__(self, parent, pos = 0, address = "", unreadCount = 0):
super(QtGui.QTreeWidgetItem, self).__init__() super(QtGui.QTreeWidgetItem, self).__init__()
self.address = address
self.unreadCount = unreadCount self.unreadCount = unreadCount
parent.insertTopLevelItem(pos, self) parent.insertTopLevelItem(pos, self)
# only set default when creating # only set default when creating
#super(QtGui.QTreeWidgetItem, self).setExpanded(shared.config.getboolean(self.address, 'enabled')) #super(QtGui.QTreeWidgetItem, self).setExpanded(shared.config.getboolean(self.address, 'enabled'))
self.setExpanded(shared.safeConfigGetBoolean(self.address, 'enabled')) self.setAddress(address)
self.updateText()
def setAddress(self, address): def setAddress(self, address):
self.address = str(address) self.address = str(address)
self.setType()
self.setExpanded(shared.safeConfigGetBoolean(self.address, 'enabled'))
self.updateText() self.updateText()
def setType(self):
if shared.safeConfigGetBoolean(self.address, 'chan'):
self.type = "chan"
elif shared.safeConfigGetBoolean(self.address, 'mailinglist'):
self.type = "mailinglist"
else:
self.type = "normal"
def setUnreadCount(self, cnt): def setUnreadCount(self, cnt):
self.unreadCount = int(cnt) self.unreadCount = int(cnt)
self.updateText() self.updateText()