self._itemView.clear()
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):
def _on_row_activated(self, index):
with qui_utils.notify_error(self._errorLog):
timeIndex = index.parent()
- assert timeIndex.isValid(), "Invalid row"
+ if not timeIndex.isValid():
+ return
timeRow = timeIndex.row()
row = index.row()
detailsItem = self._categoryManager.get_item(timeRow, row, self.DETAILS_IDX)
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._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)
self._itemView.clear()
def refresh(self, force=True):
- self._session.update_messages(force)
- if self._app.notifyOnSms or self._app.notifyOnVoicemail:
+ self._itemView.setFocus(QtCore.Qt.OtherFocusReason)
+
+ 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):
for messagePart in messageParts
]
- firstMessage = "<b>%s - %s</b> <i>(%s)</i>" % (name, prettyNumber, relTime)
+ firstMessage = "<b>%s<br/>%s</b> <i>(%s)</i>" % (name, prettyNumber, relTime)
expandedMessages = [firstMessage]
expandedMessages.extend(messages)
- if (self._MIN_MESSAGES_SHOWN + 1) < len(messages):
+ if self._MIN_MESSAGES_SHOWN < len(messages):
secondMessage = "<i>%d Messages Hidden...</i>" % (len(messages) - self._MIN_MESSAGES_SHOWN, )
collapsedMessages = [firstMessage, secondMessage]
collapsedMessages.extend(messages[-(self._MIN_MESSAGES_SHOWN+0):])
def _on_row_activated(self, index):
with qui_utils.notify_error(self._errorLog):
timeIndex = index.parent()
- assert timeIndex.isValid(), "Invalid row"
+ if not timeIndex.isValid():
+ return
timeRow = timeIndex.row()
row = index.row()
item = self._categoryManager.get_item(timeRow, row, 0)
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(),
self._itemView.clear()
def refresh(self, force=True):
- self._backend.update_contacts(force)
+ self._itemView.setFocus(QtCore.Qt.OtherFocusReason)
+ self._backend.update_account(force)
@property
def _backend(self):
def _on_row_activated(self, index):
with qui_utils.notify_error(self._errorLog):
letterIndex = index.parent()
- assert letterIndex.isValid(), "Invalid row"
+ if not letterIndex.isValid():
+ return
letterRow = letterIndex.row()
letter = list(self._prefixes())[letterRow]
letterItem = self._alphaItem[letter]