Email gateway account status query

- addresses #14
This commit is contained in:
Peter Šurda 2016-02-14 20:13:23 +01:00
parent db84d699db
commit 2b6bffc7ff
3 changed files with 23 additions and 3 deletions

View File

@ -2730,6 +2730,12 @@ class MyForm(settingsmixin.SMainWindow):
acct.unregister()
shared.config.remove_option(addressAtCurrentRow, 'gateway')
shared.writeKeysFile()
self.statusBar().showMessage(_translate(
"MainWindow", "Sending email gateway unregistration request"))
elif self.dialog.ui.radioButtonStatus.isChecked() and isinstance(acct, GatewayAccount):
acct.status()
self.statusBar().showMessage(_translate(
"MainWindow", "Sending email gateway status request"))
elif self.dialog.ui.radioButtonRegister.isChecked():
email = str(self.dialog.ui.lineEditEmail.text().toUtf8())
acct = MailchuckAccount(addressAtCurrentRow)
@ -2737,6 +2743,8 @@ class MyForm(settingsmixin.SMainWindow):
shared.config.set(addressAtCurrentRow, 'label', email)
shared.config.set(addressAtCurrentRow, 'gateway', 'mailchuck')
shared.writeKeysFile()
self.statusBar().showMessage(_translate(
"MainWindow", "Sending email gateway registration request"))
else:
pass
#print "well nothing"

View File

@ -200,6 +200,13 @@ class MailchuckAccount(GatewayAccount):
self.fromAddress = self.address
self.send()
def status(self):
self.toAddress = self.registrationAddress
self.subject = "status"
self.message = ""
self.fromAddress = self.address
self.send()
def parseMessage(self, toAddress, fromAddress, subject, message):
super(GatewayAccount, self).parseMessage(toAddress, fromAddress, subject, message)
if fromAddress == self.relayAddress:
@ -220,4 +227,4 @@ class MailchuckAccount(GatewayAccount):
self.subject = matches.group(2)
if not matches.group(1) is None:
self.toLabel = matches.group(1)
self.toAddress = matches.group(1)
self.toAddress = matches.group(1)

View File

@ -24,9 +24,12 @@ class Ui_EmailGatewayDialog(object):
self.radioButtonRegister.setChecked(True)
self.radioButtonRegister.setObjectName(_fromUtf8("radioButtonRegister"))
self.gridLayout.addWidget(self.radioButtonRegister, 1, 0, 1, 1)
self.radioButtonStatus = QtGui.QRadioButton(EmailGatewayDialog)
self.radioButtonStatus.setObjectName(_fromUtf8("radioButtonStatus"))
self.gridLayout.addWidget(self.radioButtonStatus, 4, 0, 1, 1)
self.radioButtonUnregister = QtGui.QRadioButton(EmailGatewayDialog)
self.radioButtonUnregister.setObjectName(_fromUtf8("radioButtonUnregister"))
self.gridLayout.addWidget(self.radioButtonUnregister, 4, 0, 1, 1)
self.gridLayout.addWidget(self.radioButtonUnregister, 5, 0, 1, 1)
self.label = QtGui.QLabel(EmailGatewayDialog)
self.label.setWordWrap(True)
self.label.setObjectName(_fromUtf8("label"))
@ -43,12 +46,13 @@ class Ui_EmailGatewayDialog(object):
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
self.gridLayout.addWidget(self.buttonBox, 6, 0, 1, 1)
self.retranslateUi(EmailGatewayDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmailGatewayDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmailGatewayDialog.reject)
QtCore.QObject.connect(self.radioButtonRegister, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setEnabled)
QtCore.QObject.connect(self.radioButtonStatus, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled)
QtCore.QObject.connect(self.radioButtonUnregister, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditEmail.setDisabled)
QtCore.QMetaObject.connectSlotsByName(EmailGatewayDialog)
EmailGatewayDialog.setTabOrder(self.radioButtonRegister, self.lineEditEmail)
@ -58,6 +62,7 @@ class Ui_EmailGatewayDialog(object):
def retranslateUi(self, EmailGatewayDialog):
EmailGatewayDialog.setWindowTitle(QtGui.QApplication.translate("EmailGatewayDialog", "Email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonRegister.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Register on email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonStatus.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Account status at email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.radioButtonUnregister.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Unregister from email gateway", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Email gateway allows you to communicate with email users. Currently, only the Mailchuck email gateway (@mailchuck.com) is available.", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("EmailGatewayDialog", "Desired email address (including @mailchuck.com):", None, QtGui.QApplication.UnicodeUTF8))