self.set_fullscreen(self._app.fullscreenAction.isChecked())
self.update_orientation(self._app.orientation)
+ def _init_call_handler(self):
+ if self._callHandler is not None:
+ return
+ import call_handler
+ self._callHandler = call_handler.MissedCallWatcher()
+ self._callHandler.callMissed.connect(self._voicemailRefreshDelay.start)
+
def set_default_credentials(self, username, password):
self._defaultCredentials = username, password
)
self.set_default_credentials(*creds)
self._app.fullscreenAction.setChecked(isFullscreen)
- self.update_orientation(orientation)
+ self._app.set_orientation(orientation)
self.set_current_tab(tabIndex)
backendId = 2 # For backwards compatibility
def _show_account_dialog(self):
if self._accountDialog is None:
import dialogs
- self._accountDialog = dialogs.AccountDialog(self._app)
+ self._accountDialog = dialogs.AccountDialog(self._window, self._app, self._app.errorLog)
self._accountDialog.setIfNotificationsSupported(self._app.alarmHandler.backgroundNotificationsSupported)
+ self._accountDialog.settingsApproved.connect(self._on_settings_approved)
- if self._callHandler is None or not self._callHandler.isSupported:
+ if self._callHandler is not None and not self._callHandler.isSupported:
self._accountDialog.updateVMOnMissedCall = self._accountDialog.VOICEMAIL_CHECK_NOT_SUPPORTED
elif self._updateVoicemailOnMissedCall:
self._accountDialog.updateVMOnMissedCall = self._accountDialog.VOICEMAIL_CHECK_ENABLED
if not accountNumberToDisplay:
accountNumberToDisplay = "Not Available (%s)" % self._session.state
self._accountDialog.set_account_number(accountNumberToDisplay)
- response = self._accountDialog.run(self.window)
- if response == QtGui.QDialog.Accepted:
- if self._accountDialog.doClear:
- self._session.logout_and_clear()
- self._defaultCredentials = "", ""
- self._curentCredentials = "", ""
- for tab in self._tabsContents:
- tab.disable()
- else:
- callbackNumber = self._accountDialog.selectedCallback
- self._session.set_callback_number(callbackNumber)
+ self._accountDialog.orientation = self._app.orientation
- if self._callHandler is None or self._accountDialog.updateVMOnMissedCall == self._accountDialog.VOICEMAIL_CHECK_DISABLEDD:
- pass
- elif self._accountDialog.updateVMOnMissedCall == self._accountDialog.VOICEMAIL_CHECK_ENABLED:
- self._updateVoicemailOnMissedCall = True
- self._callHandler.start()
- else:
- self._updateVoicemailOnMissedCall = False
+ self._accountDialog.run()
+
+ @qt_compat.Slot()
+ @misc_utils.log_exception(_moduleLogger)
+ def _on_settings_approved(self):
+ if self._accountDialog.doClear:
+ self._session.logout_and_clear()
+ self._defaultCredentials = "", ""
+ self._curentCredentials = "", ""
+ for tab in self._tabsContents:
+ tab.disable()
+ else:
+ callbackNumber = self._accountDialog.selectedCallback
+ self._session.set_callback_number(callbackNumber)
+
+ if self._accountDialog.updateVMOnMissedCall == self._accountDialog.VOICEMAIL_CHECK_NOT_SUPPORTED:
+ pass
+ elif self._accountDialog.updateVMOnMissedCall == self._accountDialog.VOICEMAIL_CHECK_ENABLED:
+ self._updateVoicemailOnMissedCall = True
+ self._init_call_handler()
+ self._callHandler.start()
+ else:
+ self._updateVoicemailOnMissedCall = False
+ if self._callHandler is not None:
self._callHandler.stop()
- if (
- self._accountDialog.notifyOnMissed or
- self._accountDialog.notifyOnVoicemail or
- self._accountDialog.notifyOnSms
- ):
- notifications = self._accountDialog.notifications
- else:
- notifications = self._accountDialog.ALARM_NONE
- self._app.alarmHandler.apply_settings(notifications, self._accountDialog.notificationTime)
-
- self._app.notifyOnMissed = self._accountDialog.notifyOnMissed
- self._app.notifyOnVoicemail = self._accountDialog.notifyOnVoicemail
- self._app.notifyOnSms = self._accountDialog.notifyOnSms
- self._app.save_settings()
- elif response == QtGui.QDialog.Rejected:
- _moduleLogger.info("Cancelled")
+ if (
+ self._accountDialog.notifyOnMissed or
+ self._accountDialog.notifyOnVoicemail or
+ self._accountDialog.notifyOnSms
+ ):
+ notifications = self._accountDialog.notifications
else:
- _moduleLogger.info("Unknown response")
+ notifications = self._accountDialog.ALARM_NONE
+ self._app.alarmHandler.apply_settings(notifications, self._accountDialog.notificationTime)
+
+ self._app.notifyOnMissed = self._accountDialog.notifyOnMissed
+ self._app.notifyOnVoicemail = self._accountDialog.notifyOnVoicemail
+ self._app.notifyOnSms = self._accountDialog.notifyOnSms
+ self._app.set_orientation(self._accountDialog.orientation)
+ self._app.save_settings()
@qt_compat.Slot()
@misc_utils.log_exception(_moduleLogger)
with qui_utils.notify_error(self._errorLog):
if self._app.alarmHandler.alarmType == self._app.alarmHandler.ALARM_APPLICATION:
if self._currentTab == self.MESSAGES_TAB or not self._app.ledHandler.isReal:
- self._errorLog.push_message("New messages available")
+ self._errorLog.push_message("New messages")
else:
self._app.ledHandler.on()
tab.enable()
self._initialize_tab(self._currentTab)
if self._updateVoicemailOnMissedCall:
- if self._callHandler is None:
- import call_handler
- self._callHandler = call_handler.MissedCallWatcher()
- self._callHandler.callMissed.connect(self._voicemailRefreshDelay.start)
+ self._init_call_handler()
self._callHandler.start()
@qt_compat.Slot()