Diffstat (limited to 'noncore/unsupported/mail2/accounteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mail2/accounteditor.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/noncore/unsupported/mail2/accounteditor.cpp b/noncore/unsupported/mail2/accounteditor.cpp new file mode 100644 index 0000000..8230a69 --- a/dev/null +++ b/noncore/unsupported/mail2/accounteditor.cpp | |||
@@ -0,0 +1,82 @@ | |||
1 | #include <qmultilineedit.h> | ||
2 | #include <qbuttongroup.h> | ||
3 | #include <qradiobutton.h> | ||
4 | #include <qmessagebox.h> | ||
5 | #include <qtabwidget.h> | ||
6 | #include <qlineedit.h> | ||
7 | #include <qcheckbox.h> | ||
8 | |||
9 | #include "accounteditor.h" | ||
10 | #include "miscfunctions.h" | ||
11 | |||
12 | AccountEditor::AccountEditor(Account account, QWidget *parent, const char *name, bool modal, WFlags fl) | ||
13 | : AccountEditorBase(parent, name, modal, fl), _account(account) | ||
14 | { | ||
15 | TabWidget2->removePage(sslTab); | ||
16 | |||
17 | fillValues(); | ||
18 | } | ||
19 | |||
20 | void AccountEditor::accept() | ||
21 | { | ||
22 | int numLf = 0; | ||
23 | for (unsigned int i = 0; i <= signature->text().length(); i++) { | ||
24 | if (signature->text()[i] == '\n') numLf++; | ||
25 | } | ||
26 | if (numLf >= 4) { | ||
27 | int ret = QMessageBox::warning(this, tr("Warning"), tr("<p>Your signature is longer than 4 lines. This is considered inpolite by many people. You should shorten your signature.</p>"), tr("Change"), tr("Continue")); | ||
28 | if (ret == 0) return; | ||
29 | } | ||
30 | |||
31 | _account.setAccountName(_account.accountName() ? _account.accountName() : MiscFunctions::uniqueString()); | ||
32 | _account.setRealName(realname->text()); | ||
33 | _account.setEmail(email->text()); | ||
34 | _account.setOrg(org->text()); | ||
35 | _account.setImapServer(imapServer->text()); | ||
36 | _account.setImapPort(imapPort->text()); | ||
37 | _account.setSmtpServer(smtpServer->text()); | ||
38 | _account.setSmtpPort(smtpPort->text()); | ||
39 | _account.setUser(user->text()); | ||
40 | _account.setPass(pass->text()); | ||
41 | _account.setSmtpSsl(smtpssl->isChecked()); | ||
42 | _account.setSmtpSslPort(smtpsPort->text()); | ||
43 | _account.setImapSsl(imapssl->isChecked()); | ||
44 | _account.setImapSslPort(imapsPort->text()); | ||
45 | _account.setDefaultCc(addCc->isChecked()); | ||
46 | _account.setDefaultBcc(addBcc->isChecked()); | ||
47 | _account.setDefaultReplyTo(addReplyTo->isChecked()); | ||
48 | _account.setCc(cc->text()); | ||
49 | _account.setBcc(bcc->text()); | ||
50 | _account.setReplyTo(replyTo->text()); | ||
51 | _account.setSignature(signature->text()); | ||
52 | |||
53 | QDialog::accept(); | ||
54 | } | ||
55 | |||
56 | void AccountEditor::fillValues() | ||
57 | { | ||
58 | realname->setText(_account.realName()); | ||
59 | email->setText(_account.email()); | ||
60 | org->setText(_account.org()); | ||
61 | imapServer->setText(_account.imapServer()); | ||
62 | imapPort->setText(!_account.imapPort().isEmpty() ? _account.imapPort() : QString("143")); | ||
63 | smtpServer->setText(_account.smtpServer()); | ||
64 | smtpPort->setText(!_account.smtpPort().isEmpty() ? _account.smtpPort() : QString("25")); | ||
65 | user->setText(_account.user()); | ||
66 | pass->setText(_account.pass()); | ||
67 | smtpssl->setChecked(_account.smtpSsl()); | ||
68 | smtpsPort->setText(_account.smtpSslPort()); | ||
69 | imapssl->setChecked(_account.imapSsl()); | ||
70 | imapsPort->setText(!_account.imapSslPort().isEmpty() ? _account.imapSslPort() : QString("993")); | ||
71 | addCc->setChecked(_account.defaultCc()); | ||
72 | if (_account.defaultCc()) cc->setEnabled(true); | ||
73 | addBcc->setChecked(_account.defaultBcc()); | ||
74 | if (_account.defaultBcc()) bcc->setEnabled(true); | ||
75 | addReplyTo->setChecked(_account.defaultReplyTo()); | ||
76 | if (_account.defaultReplyTo()) replyTo->setEnabled(true); | ||
77 | cc->setText(_account.cc()); | ||
78 | bcc->setText(_account.bcc()); | ||
79 | replyTo->setText(_account.replyTo()); | ||
80 | signature->setText(_account.signature()); | ||
81 | } | ||
82 | |||