Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 153 |
1 files changed, 104 insertions, 49 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 1cb202e..60bffa5 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -1,8 +1,13 @@ -#include <qt.h> #include "defines.h" #include "editaccounts.h" +/* OPIE */ +#include <qpe/qpeapplication.h> + +/* QT */ +#include <qt.h> + AccountListItem::AccountListItem( QListView *parent, Account *a) : QListViewItem( parent ) { @@ -39,10 +44,14 @@ void EditAccounts::slotFillLists() QList<Account> accounts = settings->getAccounts(); Account *it; - for ( it = accounts.first(); it; it = accounts.next() ) { - if ( it->getType().compare( "NNTP" ) == 0 ) { + for ( it = accounts.first(); it; it = accounts.next() ) + { + if ( it->getType().compare( "NNTP" ) == 0 ) + { (void) new AccountListItem( newsList, it ); - } else { + } + else + { (void) new AccountListItem( mailList, it ); } } @@ -54,60 +63,76 @@ void EditAccounts::slotNewMail() QString *selection = new QString(); SelectMailType selType( selection, this, 0, true ); selType.show(); - if ( QDialog::Accepted == selType.exec() ) { + if ( QDialog::Accepted == selType.exec() ) + { slotNewAccount( *selection ); } } void EditAccounts::slotNewAccount( const QString &type ) { - if ( type.compare( "IMAP" ) == 0 ) { + if ( type.compare( "IMAP" ) == 0 ) + { qDebug( "-> config IMAP" ); IMAPaccount *account = new IMAPaccount(); IMAPconfig imap( account, this, 0, true ); - imap.showMaximized(); - if ( QDialog::Accepted == imap.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) + { settings->addAccount( account ); account->save(); slotFillLists(); - } else { + } + else + { account->remove(); } - } else if ( type.compare( "POP3" ) == 0 ) { + } + else if ( type.compare( "POP3" ) == 0 ) + { qDebug( "-> config POP3" ); POP3account *account = new POP3account(); POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); - pop3.showMaximized(); - if ( QDialog::Accepted == pop3.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) + { settings->addAccount( account ); account->save(); slotFillLists(); - } else { + } + else + { account->remove(); } - } else if ( type.compare( "SMTP" ) == 0 ) { + } + else if ( type.compare( "SMTP" ) == 0 ) + { qDebug( "-> config SMTP" ); SMTPaccount *account = new SMTPaccount(); SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); - smtp.showMaximized(); - if ( QDialog::Accepted == smtp.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) + { settings->addAccount( account ); account->save(); slotFillLists(); - } else { + } + else + { account->remove(); } - } else if ( type.compare( "NNTP" ) == 0 ) { + } + else if ( type.compare( "NNTP" ) == 0 ) + { qDebug( "-> config NNTP" ); NNTPaccount *account = new NNTPaccount(); NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); - nntp.showMaximized(); - if ( QDialog::Accepted == nntp.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) + { settings->addAccount( account ); account->save(); slotFillLists(); - } else { + } + else + { account->remove(); } } @@ -115,32 +140,39 @@ void EditAccounts::slotNewAccount( const QString &type ) void EditAccounts::slotEditAccount( Account *account ) { - if ( account->getType().compare( "IMAP" ) == 0 ) { + if ( account->getType().compare( "IMAP" ) == 0 ) + { IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); - imap.showMaximized(); - if ( QDialog::Accepted == imap.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) + { slotFillLists(); } - } else if ( account->getType().compare( "POP3" ) == 0 ) { + } + else if ( account->getType().compare( "POP3" ) == 0 ) + { POP3account *pop3Acc = static_cast<POP3account *>(account); POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); - pop3.showMaximized(); - if ( QDialog::Accepted == pop3.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) + { slotFillLists(); } - } else if ( account->getType().compare( "SMTP" ) == 0 ) { + } + else if ( account->getType().compare( "SMTP" ) == 0 ) + { SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); - smtp.showMaximized(); - if ( QDialog::Accepted == smtp.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) + { slotFillLists(); } - } else if ( account->getType().compare( "NNTP" ) == 0 ) { + } + else if ( account->getType().compare( "NNTP" ) == 0 ) + { NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); - nntp.showMaximized(); - if ( QDialog::Accepted == nntp.exec() ) { + if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) + { slotFillLists(); } } @@ -150,7 +182,8 @@ void EditAccounts::slotDeleteAccount( Account *account ) { if ( QMessageBox::information( this, tr( "Question" ), tr( "<p>Do you really want to delete the selected Account?</p>" ), - tr( "Yes" ), tr( "No" ) ) == 0 ) { + tr( "Yes" ), tr( "No" ) ) == 0 ) + { settings->delAccount( account ); slotFillLists(); } @@ -159,7 +192,8 @@ void EditAccounts::slotDeleteAccount( Account *account ) void EditAccounts::slotEditMail() { qDebug( "Edit Mail Account" ); - if ( !mailList->currentItem() ) { + if ( !mailList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); @@ -172,7 +206,8 @@ void EditAccounts::slotEditMail() void EditAccounts::slotDeleteMail() { - if ( !mailList->currentItem() ) { + if ( !mailList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); @@ -192,7 +227,8 @@ void EditAccounts::slotNewNews() void EditAccounts::slotEditNews() { qDebug( "Edit News Account" ); - if ( !newsList->currentItem() ) { + if ( !newsList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); @@ -206,7 +242,8 @@ void EditAccounts::slotEditNews() void EditAccounts::slotDeleteNews() { qDebug( "Delete News Account" ); - if ( !newsList->currentItem() ) { + if ( !newsList->currentItem() ) + { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); @@ -277,12 +314,17 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, void IMAPconfig::slotConnectionToggle( int index ) { - if ( index == 2 ) { + if ( index == 2 ) + { portLine->setText( IMAP_SSL_PORT ); - } else if ( index == 3 ) { + } + else if ( index == 3 ) + { portLine->setText( IMAP_PORT ); CommandEdit->show(); - } else { + } + else + { portLine->setText( IMAP_PORT ); } } @@ -333,12 +375,17 @@ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, void POP3config::slotConnectionToggle( int index ) { // 2 is ssl connection - if ( index == 2 ) { + if ( index == 2 ) + { portLine->setText( POP3_SSL_PORT ); - } else if ( index == 3 ) { + } + else if ( index == 3 ) + { portLine->setText( POP3_PORT ); CommandEdit->show(); - } else { + } + else + { portLine->setText( POP3_PORT ); } } @@ -391,12 +438,17 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, void SMTPconfig::slotConnectionToggle( int index ) { // 2 is ssl connection - if ( index == 2 ) { + if ( index == 2 ) + { portLine->setText( SMTP_SSL_PORT ); - } else if ( index == 3 ) { + } + else if ( index == 3 ) + { portLine->setText( SMTP_PORT ); CommandEdit->show(); - } else { + } + else + { portLine->setText( SMTP_PORT ); } } @@ -444,9 +496,12 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, void NNTPconfig::slotSSL( bool enabled ) { - if ( enabled ) { + if ( enabled ) + { portLine->setText( NNTP_SSL_PORT ); - } else { + } + else + { portLine->setText( NNTP_PORT ); } } |