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):
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
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)
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)
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):
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)
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):
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(),
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):