From 8da336d3ddbcbb4a4b52c1c05b1b39a5ed2a4254 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 16 Oct 2011 20:54:27 +0200 Subject: [PATCH] when thread is a discussion, display messages linearly --- weboob/applications/qboobmsg/messages_manager.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/weboob/applications/qboobmsg/messages_manager.py b/weboob/applications/qboobmsg/messages_manager.py index 707e1bce..de9cf0ea 100644 --- a/weboob/applications/qboobmsg/messages_manager.py +++ b/weboob/applications/qboobmsg/messages_manager.py @@ -125,8 +125,13 @@ class MessagesManager(QWidget): return self.thread = thread + if thread.flags & thread.IS_THREADS: + top = self.ui.messagesTree.invisibleRootItem() + else: + top = None + + self._insert_message(thread.root, top) self.showMessage(thread.root) - self._insert_message(thread.root, self.ui.messagesTree.invisibleRootItem()) self.ui.messagesTree.expandAll() @@ -139,11 +144,16 @@ class MessagesManager(QWidget): item.setForeground(1, QBrush(Qt.darkYellow)) item.setForeground(2, QBrush(Qt.darkYellow)) - top.addChild(item) + if top is not None: + # threads + top.addChild(item) + else: + # discussion + self.ui.messagesTree.invisibleRootItem().insertChild(0, item) if message.children is not None: for child in message.children: - self._insert_message(child, item) + self._insert_message(child, top and item) def _messageSelected(self, item, column): message = item.data(0, Qt.UserRole).toPyObject()