00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <qhbox.h>
00022 #include "editaccount.h"
00023
00024 EditAccount::EditAccount( QWidget* parent, const char* name, WFlags fl )
00025 : QDialog(parent, name, fl)
00026 {
00027 setCaption( tr("Edit Account") );
00028 init();
00029 popPasswInput->setEchoMode(QLineEdit::Password);
00030 }
00031
00032 void EditAccount::setAccount(MailAccount *in, bool newOne)
00033 {
00034 account = in;
00035 if (newOne) {
00036 accountNameInput->setText("");
00037 nameInput->setText("");
00038 emailInput->setText("");
00039 popUserInput->setText("");
00040 popPasswInput->setText("");
00041 popServerInput->setText("");
00042 smtpServerInput->setText("");
00043 syncCheckBox->setChecked(TRUE);
00044 syncLimitInput->setValue(2);
00045
00046 setCaption( tr("Create new Account") );
00047 } else {
00048 accountNameInput->setText(account->accountName);
00049 nameInput->setText(account->name);
00050 emailInput->setText(account->emailAddress);
00051 popUserInput->setText(account->popUserName);
00052 popPasswInput->setText(account->popPasswd);
00053 popServerInput->setText(account->popServer);
00054 smtpServerInput->setText(account->smtpServer);
00055 syncCheckBox->setChecked(account->synchronize);
00056 syncLimitInput->setValue(account->syncLimit/1000);
00057 }
00058 }
00059
00060 void EditAccount::init()
00061 {
00062 grid = new QGridLayout(this);
00063 grid->setSpacing( 6 );
00064 grid->setMargin( 11 );
00065
00066 accountNameInputLabel = new QLabel(tr("Account name"), this);
00067 grid->addWidget( accountNameInputLabel, 0, 0 );
00068 accountNameInput = new QLineEdit( this, "account nameInput" );
00069 grid->addWidget( accountNameInput, 0, 1 );
00070
00071 nameInputLabel = new QLabel(tr("Your name"), this);
00072 grid->addWidget( nameInputLabel, 1, 0 );
00073 nameInput = new QLineEdit( this, "nameInput" );
00074 grid->addWidget( nameInput, 1, 1 );
00075
00076 emailInputLabel = new QLabel(tr("Email"), this);
00077 grid->addWidget(emailInputLabel, 2, 0 );
00078 emailInput = new QLineEdit( this, "emailInput" );
00079 grid->addWidget( emailInput, 2, 1 );
00080
00081 popUserInputLabel = new QLabel(tr("POP username"), this);
00082 grid->addWidget( popUserInputLabel, 3, 0 );
00083 popUserInput = new QLineEdit( this, "popUserInput" );
00084 grid->addWidget( popUserInput, 3, 1 );
00085
00086 popPasswInputLabel = new QLabel( tr("POP password"), this);
00087 grid->addWidget( popPasswInputLabel, 4, 0 );
00088 popPasswInput = new QLineEdit( this, "popPasswInput" );
00089 grid->addWidget( popPasswInput, 4, 1 );
00090
00091 popServerInputLabel = new QLabel(tr("POP server"), this);
00092 grid->addWidget( popServerInputLabel, 5, 0 );
00093 popServerInput = new QLineEdit( this, "popServerInput" );
00094 grid->addWidget( popServerInput, 5, 1 );
00095
00096 smtpServerInputLabel = new QLabel(tr("SMTP server"), this );
00097 grid->addWidget( smtpServerInputLabel, 6, 0 );
00098 smtpServerInput = new QLineEdit( this, "smtpServerInput" );
00099 grid->addWidget( smtpServerInput, 6, 1 );
00100
00101 QHBox* syncBox=new QHBox(this);
00102 grid->addWidget( syncBox, 7, 1 );
00103
00104 syncCheckBox = new QCheckBox( tr( "Synchronize" ), this);
00105 syncCheckBox->setChecked( TRUE );
00106 grid->addWidget( syncCheckBox,7,0);
00107
00108 syncLimitInputLabel = new QLabel(tr("Mail Size (k)"), syncBox);
00109
00110 syncLimitInput = new QSpinBox( syncBox, "syncSize" );
00111
00112
00113 }
00114
00115
00116 void EditAccount::accept()
00117 {
00118 account->accountName = accountNameInput->text();
00119 account->name = nameInput->text();
00120 account->emailAddress = emailInput->text();
00121 account->popUserName = popUserInput->text();
00122 account->popPasswd = popPasswInput->text();
00123 account->popServer = popServerInput->text();
00124 account->smtpServer = smtpServerInput->text();
00125 account->synchronize = syncCheckBox->isChecked();
00126 account->syncLimit = syncLimitInput->value()*1000;
00127
00128 QDialog::accept();
00129 }
00130
00131 void EditAccount::reject()
00132 {
00133 }