From: Ed Page Date: Fri, 18 Mar 2011 00:40:48 +0000 (-0500) Subject: Front-end support for partial history updates X-Git-Url: https://vcs.maemo.org/git/?p=gc-dialer;a=commitdiff_plain;h=9708c3b670d58c0370a45e28dcbd0abc9d8276a8 Front-end support for partial history updates --- diff --git a/src/gv_views.py b/src/gv_views.py index 18251df..f57995c 100644 --- a/src/gv_views.py +++ b/src/gv_views.py @@ -260,7 +260,12 @@ class History(object): FROM_IDX = 1 MAX_IDX = 2 - HISTORY_ITEM_TYPES = ["Received", "Missed", "Placed", "All"] + HISTORY_RECEIVED = "Received" + HISTORY_MISSED = "Missed" + HISTORY_PLACED = "Placed" + HISTORY_ALL = "All" + + HISTORY_ITEM_TYPES = [HISTORY_RECEIVED, HISTORY_MISSED, HISTORY_PLACED, HISTORY_ALL] HISTORY_COLUMNS = ["Details", "From"] assert len(HISTORY_COLUMNS) == MAX_IDX @@ -343,7 +348,18 @@ class History(object): def refresh(self, force=True): self._itemView.setFocus(QtCore.Qt.OtherFocusReason) - self._session.update_history(force) + + if self._selectedFilter == self.HISTORY_RECEIVED: + self._session.update_history(self._session.HISTORY_RECEIVED, force) + elif self._selectedFilter == self.HISTORY_MISSED: + self._session.update_history(self._session.HISTORY_MISSED, force) + elif self._selectedFilter == self.HISTORY_PLACED: + self._session.update_history(self._session.HISTORY_PLACED, force) + elif self._selectedFilter == self.HISTORY_ALL: + self._session.update_history(self._session.HISTORY_ALL, force) + else: + assert False, "How did we get here?" + if self._app.notifyOnMissed and self._app.alarmHandler.alarmType == self._app.alarmHandler.ALARM_BACKGROUND: self._app.ledHandler.off() diff --git a/src/session.py b/src/session.py index 7061f09..6bf5888 100644 --- a/src/session.py +++ b/src/session.py @@ -220,6 +220,11 @@ class Session(QtCore.QObject): MESSAGE_VOICEMAILS = "Voicemail" MESSAGE_ALL = "All" + HISTORY_RECEIVED = "Received" + HISTORY_MISSED = "Missed" + HISTORY_PLACED = "Placed" + HISTORY_ALL = "All" + _OLDEST_COMPATIBLE_FORMAT_VERSION = misc_utils.parse_version("1.3.0") _LOGGEDOUT_TIME = -1 @@ -335,10 +340,10 @@ class Session(QtCore.QObject): def get_when_messages_updated(self): return self._messageUpdateTime - def update_history(self, force = True): + def update_history(self, historyType, force = True): if not force and self._history: return - le = concurrent.AsyncLinearExecution(self._pool, self._update_history), (), {} + le = concurrent.AsyncLinearExecution(self._pool, self._update_history), (historyType, ), {} self._perform_op_while_loggedin(le) def get_history(self): @@ -689,13 +694,13 @@ class Session(QtCore.QObject): self.messagesUpdated.emit() self._alert_on_messages(self._messages) - def _update_history(self): + def _update_history(self, historyType): try: assert self.state == self.LOGGEDIN_STATE, "History requires being logged in (currently %s" % self.state with qui_utils.notify_busy(self._errorLog, "Updating History"): self._history = yield ( self._backend[0].get_call_history, - (self._backend[0].HISTORY_ALL, ), + (historyType, ), {}, ) except Exception, e: