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
parent aa29c49829
commit f4f2425b03
2 changed files with 20 additions and 10 deletions

View File

@ -447,11 +447,12 @@ class MyForm(QtGui.QMainWindow):
self.rerenderTabTree('chan')
def rerenderTabTree(self, tab):
folders = ['inbox', 'sent', 'trash']
if tab == 'messages':
treeWidget = self.ui.treeWidgetYourIdentities
folders = ['inbox', 'sent', 'trash']
elif tab == 'chan':
treeWidget = self.ui.treeWidgetChans
folders = ['inbox', 'trash']
# sort ascending when creating
if treeWidget.topLevelItemCount() == 0:
@ -874,6 +875,7 @@ class MyForm(QtGui.QMainWindow):
else:
where = "toaddress || fromaddress || subject || message"
tableWidget.setColumnHidden(0, False)
tableWidget.setColumnHidden(1, True)
tableWidget.setSortingEnabled(False)
@ -2246,9 +2248,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.setFont(font)
newItem.setData(Qt.UserRole, str(toAddress))
if shared.safeConfigGetBoolean(str(toAddress), 'mailinglist'):
if acct.type == 'mailinglist':
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
self.ui.tableWidgetInbox.insertRow(0)
newItem.setIcon(avatarize(toAddress))
@ -3259,8 +3261,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
def getCurrentAccount(self):
#treeWidget = self.getCurrentTreeWidget()
treeWidget = self.ui.treeWidgetYourIdentities
treeWidget = self.getCurrentTreeWidget()
#treeWidget = self.ui.treeWidgetYourIdentities
if treeWidget:
currentItem = treeWidget.currentItem()
if currentItem:
@ -3472,8 +3474,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
if column != 0:
return
# only account names
if not isinstance(item, Ui_AddressWidget):
# only account names of normal addresses (no chans/mailinglists)
if (not isinstance(item, Ui_AddressWidget)) or item.type != 'normal':
return
# only currently selected item
if item.address != self.getCurrentTreeWidget().currentItem().address:

View File

@ -63,18 +63,26 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem):
class Ui_AddressWidget(QtGui.QTreeWidgetItem):
def __init__(self, parent, pos = 0, address = "", unreadCount = 0):
super(QtGui.QTreeWidgetItem, self).__init__()
self.address = address
self.unreadCount = unreadCount
parent.insertTopLevelItem(pos, self)
# only set default when creating
#super(QtGui.QTreeWidgetItem, self).setExpanded(shared.config.getboolean(self.address, 'enabled'))
self.setExpanded(shared.safeConfigGetBoolean(self.address, 'enabled'))
self.updateText()
self.setAddress(address)
def setAddress(self, address):
self.address = str(address)
self.setType()
self.setExpanded(shared.safeConfigGetBoolean(self.address, 'enabled'))
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):
self.unreadCount = int(cnt)
self.updateText()