This commit is contained in:
Romain Bignon 2010-10-01 13:53:38 +02:00
commit c216690351
2 changed files with 82 additions and 55 deletions

View file

@ -46,12 +46,13 @@ class MessagesManager(QWidget):
self.backend = None
self.connect(self.ui.backendsList, SIGNAL('itemSelectionChanged()'), self._backendChanged)
self.connect(self.ui.threadsList, SIGNAL('itemSelectionChanged()'), self._threadChanged)
self.connect(self.ui.messagesTree, SIGNAL('itemClicked(QTreeWidgetItem *, int)'), self._messageSelected)
self.connect(self.ui.messagesTree, SIGNAL('itemActivated(QTreeWidgetItem *, int)'), self._messageSelected)
self.connect(self, SIGNAL('gotMessage'), self._gotMessage)
def load(self):
self.refresh()
self.refreshThreads()
def _backendChanged(self):
selection = self.ui.backendsList.selectedItems()
@ -61,8 +62,21 @@ class MessagesManager(QWidget):
self.backend = selection[0].data(Qt.UserRole).toPyObject()
def refreshThreads(self):
self.ui.messagesTree.clear()
self.ui.threadsList.clear()
self.process_threads = QtDo(self.weboob, self._gotThread)
self.process_threads.do('iter_threads', backends=self.backends, caps=ICapMessages)
def _gotThread(self, backend, thread):
if not backend:
return
def _threadChanged(self):
self.ui.messagesTree.clear()
self.refresh()
pass
def refresh(self):
if self.ui.messagesTree.topLevelItemCount() > 0:

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>767</width>
<height>591</height>
<width>696</width>
<height>592</height>
</rect>
</property>
<property name="windowTitle">
@ -15,11 +15,11 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSplitter" name="splitter_2">
<widget class="QSplitter" name="splitter_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="backendsList">
<widget class="QListWidget" name="backendsList_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
@ -27,68 +27,81 @@
</sizepolicy>
</property>
</widget>
<widget class="QSplitter" name="splitter">
<widget class="QSplitter" name="splitter_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>2</horstretch>
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QTreeWidget" name="messagesTree">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="tabKeyNavigation">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Date</string>
<widget class="QListWidget" name="threadsList">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
</widget>
<widget class="QTreeWidget" name="messagesTree">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</column>
<column>
<property name="text">
<string>From</string>
<property name="tabKeyNavigation">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Title</string>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</column>
<property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Date</string>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
</property>
</column>
<column>
<property name="text">
<string>From</string>
</property>
</column>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
</widget>
</widget>
<widget class="QTextEdit" name="messageBody">
<property name="readOnly">