| 11 | extern Global global; |
| 12 | |
| 13 | EmailPreferences::EmailPreferences(QWidget *parent) : |
| 14 | QWidget(parent) |
| 15 | { |
| 16 | |
| 17 | smtpServerLabel.setText(tr("SMTP Server")); |
| 18 | smtpPortLabel.setText(tr("Server Port")); |
| 19 | useridLabel.setText(tr("Userid")); |
| 20 | passwordLabel.setText(tr("Password")); |
| 21 | senderNameLabel.setText(tr("Sender Display Name")); |
| 22 | senderEmailLabel.setText(tr("Sender Email")); |
| 23 | smtpConnectionTypeLabel.setText(tr("Connection Type")); |
| 24 | |
| 25 | password.setEchoMode(QLineEdit::Password); |
| 26 | smtpPort.setInputMask("99999"); |
| 27 | |
| 28 | QGridLayout *mainLayout = new QGridLayout(this); |
| 29 | mainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); |
| 30 | |
| 31 | smtpConnectionType.addItem(tr("Plain Text"), "TcpConnection"); |
| 32 | smtpConnectionType.addItem(tr("SSL Connection"), "SslConnection"); |
| 33 | smtpConnectionType.addItem(tr("TLS Connection"), "TlsConnection"); |
| 34 | |
| 35 | testEmail = new QPushButton(tr("Send Test Email")); |
| 36 | connect(testEmail, SIGNAL(pressed()), this, SLOT(sendTestEmail())); |
| 37 | |
| 38 | int row = 0; |
| 39 | mainLayout->addWidget(&smtpServerLabel, row, 0); |
| 40 | mainLayout->addWidget(&smtpServer, row++, 1); |
| 41 | mainLayout->addWidget(&smtpPortLabel, row, 0); |
| 42 | mainLayout->addWidget(&smtpPort, row++, 1); |
| 43 | mainLayout->addWidget(&smtpConnectionTypeLabel, row, 0); |
| 44 | mainLayout->addWidget(&smtpConnectionType, row++, 1); |
| 45 | mainLayout->addWidget(&useridLabel, row, 0); |
| 46 | mainLayout->addWidget(&userid, row++, 1); |
| 47 | mainLayout->addWidget(&passwordLabel, row, 0); |
| 48 | mainLayout->addWidget(&password, row++, 1); |
| 49 | mainLayout->addWidget(&senderEmailLabel, row, 0); |
| 50 | mainLayout->addWidget(&senderEmail, row++, 1); |
| 51 | mainLayout->addWidget(&senderNameLabel, row, 0); |
| 52 | mainLayout->addWidget(&senderName, row++, 1); |
| 53 | mainLayout->addWidget(testEmail, row++,0); |
| 54 | |
| 55 | // Get the smtp server settings |
| 56 | global.settings->beginGroup("Email"); |
| 57 | QString s = global.settings->value("smtpServer", "").toString(); |
| 58 | QString p = global.settings->value("smtpPort", "25").toString(); |
| 59 | QString ctype = global.settings->value("smtpConnectionType", "TcpConnection").toString(); |
| 60 | QString u = global.settings->value("userid", "").toString(); |
| 61 | QString pswd = global.settings->value("password", "").toString(); |
| 62 | QString senderE = global.settings->value("senderEmail", "").toString(); |
| 63 | QString senderN = global.settings->value("senderName", "").toString(); |
| 64 | global.settings->endGroup(); |
| 65 | |
| 66 | int index = smtpConnectionType.findData(ctype); |
| 67 | smtpConnectionType.setCurrentIndex(index); |
| 68 | |
| 69 | smtpServer.setText(s); |
| 70 | smtpPort.setText(p); |