Commit f0d576f6 authored by Dan Pascu's avatar Dan Pascu

Refactored the code that initializes the contact list views

parent d6529484
......@@ -693,6 +693,7 @@ class ContactSearchModel(QSortFilterProxyModel):
class ContactListView(QListView):
def __init__(self, parent=None):
super(ContactListView, self).__init__(parent)
self.setItemDelegate(ContactDelegate(self))
self.setDragEnabled(True)
self.setAcceptDrops(True)
self.setDropIndicatorShown(False)
......@@ -869,6 +870,7 @@ class ContactListView(QListView):
class ContactSearchListView(QListView):
def __init__(self, parent=None):
super(ContactSearchListView, self).__init__(parent)
self.setItemDelegate(ContactDelegate(self))
self.setDragEnabled(True)
self.setAcceptDrops(True)
self.setDropIndicatorShown(False)
......
......@@ -9,7 +9,7 @@ from PyQt4 import uic
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QBrush, QColor, QPainter, QPen, QPixmap
from blink.contacts import ContactDelegate, ContactModel, ContactSearchModel
from blink.contacts import ContactModel, ContactSearchModel
from blink.resources import Resources
......@@ -28,15 +28,13 @@ class MainWindow(base_class, ui_class):
self._setup_identities()
self.contact_model = ContactModel(self)
self.contact_list.setModel(self.contact_model)
self.contact_list.setItemDelegate(ContactDelegate(self.contact_list))
self.contact_model.test()
self.contact_search_model = ContactSearchModel(self.contact_model, self)
self.contact_list.setModel(self.contact_model)
self.search_list.setModel(self.contact_search_model)
self.search_list.setItemDelegate(ContactDelegate(self.search_list))
self.search_box.textChanged.connect(self.contact_search_model.setFilterFixedString)
self.contact_model.test()
self.contacts_panel.sibling_panel = self.sessions_panel
self.contacts_panel.sibling_name = u'Sessions'
self.sessions_panel.sibling_panel = self.contacts_panel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment