Moved SpecialAddressBehaviorDialog into dialogs module
This commit is contained in:
parent
c965a1d2aa
commit
62a930c374
|
@ -30,7 +30,6 @@ from foldertree import *
|
|||
from regenerateaddresses import *
|
||||
from newchandialog import *
|
||||
from safehtmlparser import *
|
||||
from specialaddressbehavior import *
|
||||
from emailgateway import *
|
||||
from settings import *
|
||||
import settingsmixin
|
||||
|
@ -2449,31 +2448,7 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
pass
|
||||
|
||||
def on_action_SpecialAddressBehaviorDialog(self):
|
||||
self.dialog = SpecialAddressBehaviorDialog(self)
|
||||
# For Modal dialogs
|
||||
if self.dialog.exec_():
|
||||
addressAtCurrentRow = self.getCurrentAccount()
|
||||
if BMConfigParser().safeGetBoolean(addressAtCurrentRow, 'chan'):
|
||||
return
|
||||
if self.dialog.ui.radioButtonBehaveNormalAddress.isChecked():
|
||||
BMConfigParser().set(str(
|
||||
addressAtCurrentRow), 'mailinglist', 'false')
|
||||
# Set the color to either black or grey
|
||||
if BMConfigParser().getboolean(addressAtCurrentRow, 'enabled'):
|
||||
self.setCurrentItemColor(QApplication.palette()
|
||||
.text().color())
|
||||
else:
|
||||
self.setCurrentItemColor(QtGui.QColor(128, 128, 128))
|
||||
else:
|
||||
BMConfigParser().set(str(
|
||||
addressAtCurrentRow), 'mailinglist', 'true')
|
||||
BMConfigParser().set(str(addressAtCurrentRow), 'mailinglistname', str(
|
||||
self.dialog.ui.lineEditMailingListName.text().toUtf8()))
|
||||
self.setCurrentItemColor(QtGui.QColor(137, 04, 177)) #magenta
|
||||
self.rerenderComboBoxSendFrom()
|
||||
self.rerenderComboBoxSendFromBroadcast()
|
||||
BMConfigParser().save()
|
||||
self.rerenderMessagelistToLabels()
|
||||
dialogs.SpecialAddressBehaviorDialog(self, BMConfigParser())
|
||||
|
||||
def on_action_EmailGatewayDialog(self):
|
||||
self.dialog = EmailGatewayDialog(self)
|
||||
|
@ -4190,33 +4165,6 @@ class settingsDialog(QtGui.QDialog):
|
|||
self.parent.ui.pushButtonFetchNamecoinID.show()
|
||||
|
||||
|
||||
class SpecialAddressBehaviorDialog(QtGui.QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
self.ui = Ui_SpecialAddressBehaviorDialog()
|
||||
self.ui.setupUi(self)
|
||||
self.parent = parent
|
||||
addressAtCurrentRow = parent.getCurrentAccount()
|
||||
if not BMConfigParser().safeGetBoolean(addressAtCurrentRow, 'chan'):
|
||||
if BMConfigParser().safeGetBoolean(addressAtCurrentRow, 'mailinglist'):
|
||||
self.ui.radioButtonBehaviorMailingList.click()
|
||||
else:
|
||||
self.ui.radioButtonBehaveNormalAddress.click()
|
||||
try:
|
||||
mailingListName = BMConfigParser().get(
|
||||
addressAtCurrentRow, 'mailinglistname')
|
||||
except:
|
||||
mailingListName = ''
|
||||
self.ui.lineEditMailingListName.setText(
|
||||
unicode(mailingListName, 'utf-8'))
|
||||
else: # if addressAtCurrentRow is a chan address
|
||||
self.ui.radioButtonBehaviorMailingList.setDisabled(True)
|
||||
self.ui.lineEditMailingListName.setText(_translate(
|
||||
"MainWindow", "This is a chan address. You cannot use it as a pseudo-mailing list."))
|
||||
|
||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
||||
|
||||
class EmailGatewayDialog(QtGui.QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
|
|
|
@ -145,3 +145,68 @@ class ConnectDialog(QtGui.QDialog, RetranslateMixin):
|
|||
super(ConnectDialog, self).__init__(parent)
|
||||
widgets.load('connect.ui', self)
|
||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
||||
|
||||
|
||||
class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
||||
|
||||
def __init__(self, parent=None, config=None):
|
||||
super(SpecialAddressBehaviorDialog, self).__init__(parent)
|
||||
widgets.load('specialaddressbehavior.ui', self)
|
||||
self.address = parent.getCurrentAccount()
|
||||
self.parent = parent
|
||||
self.config = config
|
||||
|
||||
try:
|
||||
self.address_is_chan = config.safeGetBoolean(
|
||||
self.address, 'chan'
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
if self.address_is_chan: # address is a chan address
|
||||
self.radioButtonBehaviorMailingList.setDisabled(True)
|
||||
self.lineEditMailingListName.setText(_translate(
|
||||
"MainWindow",
|
||||
"This is a chan address. You cannot use it as a"
|
||||
" pseudo-mailing list."
|
||||
))
|
||||
else:
|
||||
if config.safeGetBoolean(self.address, 'mailinglist'):
|
||||
self.radioButtonBehaviorMailingList.click()
|
||||
else:
|
||||
self.radioButtonBehaveNormalAddress.click()
|
||||
try:
|
||||
mailingListName = config.get(
|
||||
self.address, 'mailinglistname')
|
||||
except:
|
||||
mailingListName = ''
|
||||
self.lineEditMailingListName.setText(
|
||||
unicode(mailingListName, 'utf-8')
|
||||
)
|
||||
|
||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
||||
self.show()
|
||||
|
||||
def accept(self):
|
||||
self.hide()
|
||||
if self.address_is_chan:
|
||||
return
|
||||
if self.radioButtonBehaveNormalAddress.isChecked():
|
||||
self.config.set(str(self.address), 'mailinglist', 'false')
|
||||
# Set the color to either black or grey
|
||||
if self.config.getboolean(self.address, 'enabled'):
|
||||
self.parent.setCurrentItemColor(
|
||||
QtGui.QApplication.palette().text().color()
|
||||
)
|
||||
else:
|
||||
self.parent.setCurrentItemColor(QtGui.QColor(128, 128, 128))
|
||||
else:
|
||||
self.config.set(str(self.address), 'mailinglist', 'true')
|
||||
self.config.set(str(self.address), 'mailinglistname', str(
|
||||
self.lineEditMailingListName.text().toUtf8()))
|
||||
self.parent.setCurrentItemColor(
|
||||
QtGui.QColor(137, 04, 177)) # magenta
|
||||
self.parent.rerenderComboBoxSendFrom()
|
||||
self.parent.rerenderComboBoxSendFromBroadcast()
|
||||
self.config.save()
|
||||
self.parent.rerenderMessagelistToLabels()
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'specialaddressbehavior.ui'
|
||||
#
|
||||
# Created: Fri Apr 26 17:43:31 2013
|
||||
# by: PyQt4 UI code generator 4.9.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
class Ui_SpecialAddressBehaviorDialog(object):
|
||||
def setupUi(self, SpecialAddressBehaviorDialog):
|
||||
SpecialAddressBehaviorDialog.setObjectName(_fromUtf8("SpecialAddressBehaviorDialog"))
|
||||
SpecialAddressBehaviorDialog.resize(386, 172)
|
||||
self.gridLayout = QtGui.QGridLayout(SpecialAddressBehaviorDialog)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.radioButtonBehaveNormalAddress = QtGui.QRadioButton(SpecialAddressBehaviorDialog)
|
||||
self.radioButtonBehaveNormalAddress.setChecked(True)
|
||||
self.radioButtonBehaveNormalAddress.setObjectName(_fromUtf8("radioButtonBehaveNormalAddress"))
|
||||
self.gridLayout.addWidget(self.radioButtonBehaveNormalAddress, 0, 0, 1, 1)
|
||||
self.radioButtonBehaviorMailingList = QtGui.QRadioButton(SpecialAddressBehaviorDialog)
|
||||
self.radioButtonBehaviorMailingList.setObjectName(_fromUtf8("radioButtonBehaviorMailingList"))
|
||||
self.gridLayout.addWidget(self.radioButtonBehaviorMailingList, 1, 0, 1, 1)
|
||||
self.label = QtGui.QLabel(SpecialAddressBehaviorDialog)
|
||||
self.label.setWordWrap(True)
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.gridLayout.addWidget(self.label, 2, 0, 1, 1)
|
||||
self.label_2 = QtGui.QLabel(SpecialAddressBehaviorDialog)
|
||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||
self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
|
||||
self.lineEditMailingListName = QtGui.QLineEdit(SpecialAddressBehaviorDialog)
|
||||
self.lineEditMailingListName.setEnabled(False)
|
||||
self.lineEditMailingListName.setObjectName(_fromUtf8("lineEditMailingListName"))
|
||||
self.gridLayout.addWidget(self.lineEditMailingListName, 4, 0, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(SpecialAddressBehaviorDialog)
|
||||
self.buttonBox.setMinimumSize(QtCore.QSize(368, 0))
|
||||
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.retranslateUi(SpecialAddressBehaviorDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), SpecialAddressBehaviorDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), SpecialAddressBehaviorDialog.reject)
|
||||
QtCore.QObject.connect(self.radioButtonBehaviorMailingList, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditMailingListName.setEnabled)
|
||||
QtCore.QObject.connect(self.radioButtonBehaveNormalAddress, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.lineEditMailingListName.setDisabled)
|
||||
QtCore.QMetaObject.connectSlotsByName(SpecialAddressBehaviorDialog)
|
||||
SpecialAddressBehaviorDialog.setTabOrder(self.radioButtonBehaveNormalAddress, self.radioButtonBehaviorMailingList)
|
||||
SpecialAddressBehaviorDialog.setTabOrder(self.radioButtonBehaviorMailingList, self.lineEditMailingListName)
|
||||
SpecialAddressBehaviorDialog.setTabOrder(self.lineEditMailingListName, self.buttonBox)
|
||||
|
||||
def retranslateUi(self, SpecialAddressBehaviorDialog):
|
||||
SpecialAddressBehaviorDialog.setWindowTitle(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Special Address Behavior", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButtonBehaveNormalAddress.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Behave as a normal address", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.radioButtonBehaviorMailingList.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Behave as a pseudo-mailing-list address", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Mail received to a pseudo-mailing-list address will be automatically broadcast to subscribers (and thus will be public).", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_2.setText(QtGui.QApplication.translate("SpecialAddressBehaviorDialog", "Name of the pseudo-mailing-list:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
Reference in New Issue
Block a user