self._voicemailRefreshDelay.setSingleShot(True)
self._callHandler = call_handler.MissedCallWatcher()
self._callHandler.callMissed.connect(self._voicemailRefreshDelay.start)
+ self._updateVoicemailOnMissedCall = False
self._defaultCredentials = "", ""
self._curentCredentials = "", ""
self._app.notifyOnMissed = config.getboolean("2 - Account Info", "notifyOnMissed")
self._app.notifyOnVoicemail = config.getboolean("2 - Account Info", "notifyOnVoicemail")
self._app.notifyOnSms = config.getboolean("2 - Account Info", "notifyOnSms")
+ self._updateVoicemailOnMissedCall = config.getboolean("2 - Account Info", "updateVoicemailOnMissedCall")
except ConfigParser.NoOptionError, e:
_moduleLogger.info(
"Settings file %s is missing option %s" % (
config.set("2 - Account Info", "notifyOnMissed", repr(self._app.notifyOnMissed))
config.set("2 - Account Info", "notifyOnVoicemail", repr(self._app.notifyOnVoicemail))
config.set("2 - Account Info", "notifyOnSms", repr(self._app.notifyOnSms))
+ config.set("2 - Account Info", "updateVoicemailOnMissedCall", repr(self._updateVoicemailOnMissedCall))
backendId = 2 # For backwards compatibility
for tabIndex, tabTitle in enumerate(self._TAB_TITLES):
import dialogs
self._accountDialog = dialogs.AccountDialog(self._app)
self._accountDialog.setIfNotificationsSupported(self._app.alarmHandler.backgroundNotificationsSupported)
+
+ if not self._callHandler.isSupported:
+ self._accountDialog.updateVMOnMissedCall = self._accountDialog.VOICEMAIL_CHECK_NOT_SUPPORTED
+ elif self._updateVoicemailOnMissedCall:
+ self._accountDialog.updateVMOnMissedCall = self._accountDialog.VOICEMAIL_CHECK_ENABLED
+ else:
+ self._accountDialog.updateVMOnMissedCall = self._accountDialog.VOICEMAIL_CHECK_DISABLED
self._accountDialog.notifications = self._app.alarmHandler.alarmType
self._accountDialog.notificationTime = self._app.alarmHandler.recurrence
self._accountDialog.notifyOnMissed = self._app.notifyOnMissed
callbackNumber = self._accountDialog.selectedCallback
self._session.set_callback_number(callbackNumber)
+ if self._accountDialog.updateVMOnMissedCall == self._accountDialog.VOICEMAIL_CHECK_ENABLED:
+ self._updateVoicemailOnMissedCall = True
+ self._callHandler.start()
+ else:
+ self._updateVoicemailOnMissedCall = False
+ self._callHandler.stop()
if (
self._accountDialog.notifyOnMissed or
self._accountDialog.notifyOnVoicemail or
for tab in self._tabsContents:
tab.enable()
self._initialize_tab(self._currentTab)
- self._callHandler.start()
+ if self._updateVoicemailOnMissedCall:
+ self._callHandler.start()
@QtCore.pyqtSlot()
@misc_utils.log_exception(_moduleLogger)
ALARM_BACKGROUND = "Background Alert"
ALARM_APPLICATION = "Application Alert"
+ VOICEMAIL_CHECK_NOT_SUPPORTED = "Not Supported"
+ VOICEMAIL_CHECK_DISABLED = "Disabled"
+ VOICEMAIL_CHECK_ENABLED = "Enabled"
+
def __init__(self, app):
self._app = app
self._doClear = False
self._missedCallsNotificationButton = QtGui.QCheckBox("Missed Calls")
self._voicemailNotificationButton = QtGui.QCheckBox("Voicemail")
self._smsNotificationButton = QtGui.QCheckBox("SMS")
+ self._voicemailOnMissedButton = QtGui.QCheckBox("Voicemail Update on Missed Calls")
self._clearButton = QtGui.QPushButton("Clear Account")
self._clearButton.clicked.connect(self._on_clear)
self._callbackSelector = QtGui.QComboBox()
self._credLayout.addWidget(self._voicemailNotificationButton, 4, 1)
self._credLayout.addWidget(QtGui.QLabel(""), 5, 0)
self._credLayout.addWidget(self._smsNotificationButton, 5, 1)
-
self._credLayout.addWidget(QtGui.QLabel(""), 6, 0)
- self._credLayout.addWidget(self._clearButton, 6, 1)
- self._credLayout.addWidget(QtGui.QLabel(""), 3, 0)
+ self._credLayout.addWidget(self._voicemailOnMissedButton, 6, 1)
+
+ self._credLayout.addWidget(QtGui.QLabel(""), 7, 0)
+ self._credLayout.addWidget(self._clearButton, 7, 1)
self._loginButton = QtGui.QPushButton("&Apply")
self._buttonLayout = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Cancel)
def set_account_number(self, num):
self._accountNumberLabel.setText(num)
+ def _set_voicemail_on_missed(self, status):
+ if status == self.VOICEMAIL_CHECK_NOT_SUPPORTED:
+ self._voicemailOnMissedButton.setChecked(False)
+ self._voicemailOnMissedButton.hide()
+ elif status == self.VOICEMAIL_CHECK_DISABLED:
+ self._voicemailOnMissedButton.setChecked(False)
+ self._voicemailOnMissedButton.show()
+ elif status == self.VOICEMAIL_CHECK_ENABLED:
+ self._voicemailOnMissedButton.setChecked(True)
+ self._voicemailOnMissedButton.show()
+ else:
+ raise RuntimeError("Unsupported option for updating voicemail on missed calls %r" % status)
+
+ def _get_voicemail_on_missed(self):
+ if not self._voicemailOnMissedButton.isVisible():
+ return self.VOICEMAIL_CHECK_NOT_SUPPORTED
+ elif self._voicemailOnMissedButton.isChecked():
+ return self.VOICEMAIL_CHECK_ENABLED
+ else:
+ return self.VOICEMAIL_CHECK_DISABLED
+
+ updateVMOnMissedCall = property(_get_voicemail_on_missed, _set_voicemail_on_missed)
+
def _set_notifications(self, enabled):
for i in xrange(self._notificationSelecter.count()):
if self._notificationSelecter.itemText(i) == enabled: