X-Git-Url: http://git.maemo.org/git/?p=gc-dialer;a=blobdiff_plain;f=src%2Fgv_views.py;h=08de9b78d834afcb2238d6565b2efcdf866865af;hp=681953062956495edef06fc057ca407e56c82c73;hb=35398cbc6f8edecb35115faf0f496617f963676e;hpb=fab7bc44c04f9339a021d685e832bacff508af43 diff --git a/src/gv_views.py b/src/gv_views.py index 6819530..08de9b7 100644 --- a/src/gv_views.py +++ b/src/gv_views.py @@ -344,7 +344,7 @@ class History(object): def refresh(self, force=True): self._itemView.setFocus(QtCore.Qt.OtherFocusReason) self._session.update_history(force) - if self._app.notifyOnMissed: + if self._app.notifyOnMissed and self._app.alarmHandler.alarmType == self._app.alarmHandler.ALARM_BACKGROUND: self._app.ledHandler.off() def _populate_items(self): @@ -451,7 +451,7 @@ class Messages(object): ALL_STATUS = "Any" MESSAGE_STATUSES = [UNREAD_STATUS, UNARCHIVED_STATUS, ALL_STATUS] - _MIN_MESSAGES_SHOWN = 4 + _MIN_MESSAGES_SHOWN = 1 def __init__(self, app, session, errorLog): self._selectedTypeFilter = self.ALL_TYPES @@ -495,6 +495,7 @@ class Messages(object): self._itemStore.setHorizontalHeaderLabels(["Messages"]) self._categoryManager = TimeCategories(self._itemStore) + self._htmlDelegate = qui_utils.QHtmlDelegate() self._itemView = QtGui.QTreeView() self._itemView.setModel(self._itemStore) self._itemView.setUniformRowHeights(False) @@ -504,7 +505,9 @@ class Messages(object): self._itemView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self._itemView.setHeaderHidden(True) self._itemView.setItemsExpandable(False) + self._itemView.setItemDelegate(self._htmlDelegate) self._itemView.activated.connect(self._on_row_activated) + self._itemView.header().sectionResized.connect(self._on_column_resized) self._layout = QtGui.QVBoxLayout() self._layout.addLayout(self._selectionLayout) @@ -550,8 +553,19 @@ class Messages(object): def refresh(self, force=True): self._itemView.setFocus(QtCore.Qt.OtherFocusReason) - self._session.update_messages(force) - if self._app.notifyOnSms or self._app.notifyOnVoicemail: + + if self._selectedTypeFilter == self.NO_MESSAGES: + pass + elif self._selectedTypeFilter == self.TEXT_MESSAGES: + self._session.update_messages(self._session.MESSAGE_TEXTS, force) + elif self._selectedTypeFilter == self.VOICEMAIL_MESSAGES: + self._session.update_messages(self._session.MESSAGE_VOICEMAILS, force) + elif self._selectedTypeFilter == self.ALL_TYPES: + self._session.update_messages(self._session.MESSAGE_ALL, force) + else: + assert False, "How did we get here?" + + if self._app.notifyOnSms or self._app.notifyOnVoicemail and self._app.alarmHandler.alarmType == self._app.alarmHandler.ALARM_BACKGROUND: self._app.ledHandler.off() def _populate_items(self): @@ -615,16 +629,6 @@ class Messages(object): messageItem.setCheckable(False) row = (messageItem, ) self._categoryManager.add_row(item["time"], row) - for c in xrange(self._itemStore.rowCount()): - catItem = self._itemStore.item(c, 0) - for r in xrange(catItem.rowCount()): - rowItem = catItem.child(r, 0) - rowIndex = self._itemStore.indexFromItem(rowItem) - itemWidget = QtGui.QLabel(rowItem.text()) - itemWidget.setTextFormat(QtCore.Qt.RichText) - itemWidget.setAutoFillBackground(True) - itemWidget.setWordWrap(True) - self._itemView.setIndexWidget(rowIndex, itemWidget) self._itemView.expandAll() @QtCore.pyqtSlot(str) @@ -678,6 +682,11 @@ class Messages(object): numbersWithDescriptions = [(number, "")] self._session.draft.add_contact(contactId, title, description, numbersWithDescriptions) + @QtCore.pyqtSlot(QtCore.QModelIndex) + @misc_utils.log_exception(_moduleLogger) + def _on_column_resized(self, index, oldSize, newSize): + self._htmlDelegate.setWidth(newSize, self._itemStore) + class Contacts(object): @@ -686,7 +695,7 @@ class Contacts(object): def __init__(self, app, session, errorLog): self._app = app self._session = session - self._session.contactsUpdated.connect(self._on_contacts_updated) + self._session.accountUpdated.connect(self._on_contacts_updated) self._errorLog = errorLog self._addressBookFactories = [ null_backend.NullAddressBookFactory(), @@ -767,7 +776,7 @@ class Contacts(object): def refresh(self, force=True): self._itemView.setFocus(QtCore.Qt.OtherFocusReason) - self._backend.update_contacts(force) + self._backend.update_account(force) @property def _backend(self):