summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mail2/accounteditor.cpp
authorconber <conber>2002-06-15 09:46:14 (UTC)
committer conber <conber>2002-06-15 09:46:14 (UTC)
commit7f2eef29708380844922f34f59ba4e9beefbf7c3 (patch) (side-by-side diff)
treef57125fbaabddecc35d6677f1b9e48a4594165d5 /noncore/unsupported/mail2/accounteditor.cpp
parent0acbdd392814589df303b6e50c79d9822e3db27a (diff)
downloadopie-7f2eef29708380844922f34f59ba4e9beefbf7c3.zip
opie-7f2eef29708380844922f34f59ba4e9beefbf7c3.tar.gz
opie-7f2eef29708380844922f34f59ba4e9beefbf7c3.tar.bz2
initial checkin
Diffstat (limited to 'noncore/unsupported/mail2/accounteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/accounteditor.cpp82
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 @@
+#include <qmultilineedit.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qmessagebox.h>
+#include <qtabwidget.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+
+#include "accounteditor.h"
+#include "miscfunctions.h"
+
+AccountEditor::AccountEditor(Account account, QWidget *parent, const char *name, bool modal, WFlags fl)
+ : AccountEditorBase(parent, name, modal, fl), _account(account)
+{
+ TabWidget2->removePage(sslTab);
+
+ fillValues();
+}
+
+void AccountEditor::accept()
+{
+ int numLf = 0;
+ for (unsigned int i = 0; i <= signature->text().length(); i++) {
+ if (signature->text()[i] == '\n') numLf++;
+ }
+ if (numLf >= 4) {
+ 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"));
+ if (ret == 0) return;
+ }
+
+ _account.setAccountName(_account.accountName() ? _account.accountName() : MiscFunctions::uniqueString());
+ _account.setRealName(realname->text());
+ _account.setEmail(email->text());
+ _account.setOrg(org->text());
+ _account.setImapServer(imapServer->text());
+ _account.setImapPort(imapPort->text());
+ _account.setSmtpServer(smtpServer->text());
+ _account.setSmtpPort(smtpPort->text());
+ _account.setUser(user->text());
+ _account.setPass(pass->text());
+ _account.setSmtpSsl(smtpssl->isChecked());
+ _account.setSmtpSslPort(smtpsPort->text());
+ _account.setImapSsl(imapssl->isChecked());
+ _account.setImapSslPort(imapsPort->text());
+ _account.setDefaultCc(addCc->isChecked());
+ _account.setDefaultBcc(addBcc->isChecked());
+ _account.setDefaultReplyTo(addReplyTo->isChecked());
+ _account.setCc(cc->text());
+ _account.setBcc(bcc->text());
+ _account.setReplyTo(replyTo->text());
+ _account.setSignature(signature->text());
+
+ QDialog::accept();
+}
+
+void AccountEditor::fillValues()
+{
+ realname->setText(_account.realName());
+ email->setText(_account.email());
+ org->setText(_account.org());
+ imapServer->setText(_account.imapServer());
+ imapPort->setText(!_account.imapPort().isEmpty() ? _account.imapPort() : QString("143"));
+ smtpServer->setText(_account.smtpServer());
+ smtpPort->setText(!_account.smtpPort().isEmpty() ? _account.smtpPort() : QString("25"));
+ user->setText(_account.user());
+ pass->setText(_account.pass());
+ smtpssl->setChecked(_account.smtpSsl());
+ smtpsPort->setText(_account.smtpSslPort());
+ imapssl->setChecked(_account.imapSsl());
+ imapsPort->setText(!_account.imapSslPort().isEmpty() ? _account.imapSslPort() : QString("993"));
+ addCc->setChecked(_account.defaultCc());
+ if (_account.defaultCc()) cc->setEnabled(true);
+ addBcc->setChecked(_account.defaultBcc());
+ if (_account.defaultBcc()) bcc->setEnabled(true);
+ addReplyTo->setChecked(_account.defaultReplyTo());
+ if (_account.defaultReplyTo()) replyTo->setEnabled(true);
+ cc->setText(_account.cc());
+ bcc->setText(_account.bcc());
+ replyTo->setText(_account.replyTo());
+ signature->setText(_account.signature());
+}
+