-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 5 |
3 files changed, 25 insertions, 18 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 1c80adb..1246037 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -11,22 +11,22 @@ AccountListItem::AccountListItem( QListView *parent, Account *a) setText( 1, account->getType() ); } EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) : EditAccountsUI( parent, name, modal, flags ) { qDebug( "New Account Configuration Widget" ); settings = s; - + mailList->addColumn( tr( "Account" ) ); mailList->addColumn( tr( "Type" ) ); newsList->addColumn( tr( "Account" ) ); - + connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); slotFillLists(); @@ -65,17 +65,17 @@ void EditAccounts::slotNewAccount( const QString &type ) qDebug( "-> config IMAP" ); IMAPaccount *account = new IMAPaccount(); IMAPconfig imap( account, this, 0, true ); imap.showMaximized(); if ( QDialog::Accepted == imap.exec() ) { settings->addAccount( account ); account->save(); slotFillLists(); - } else { + } else { account->remove(); } } else if ( type.compare( "POP3" ) == 0 ) { qDebug( "-> config POP3" ); POP3account *account = new POP3account(); POP3config pop3( account, this, 0, true ); pop3.showMaximized(); if ( QDialog::Accepted == pop3.exec() ) { @@ -89,16 +89,17 @@ void EditAccounts::slotNewAccount( const QString &type ) qDebug( "-> config SMTP" ); SMTPaccount *account = new SMTPaccount(); SMTPconfig smtp( account, this, 0, true ); smtp.showMaximized(); if ( QDialog::Accepted == smtp.exec() ) { settings->addAccount( account ); account->save(); slotFillLists(); + } else { account->remove(); } } else if ( type.compare( "NNTP" ) == 0 ) { qDebug( "-> config NNTP" ); NNTPaccount *account = new NNTPaccount(); NNTPconfig nntp( account, this, 0, true ); nntp.showMaximized(); @@ -142,103 +143,103 @@ void EditAccounts::slotEditAccount( Account *account ) if ( QDialog::Accepted == nntp.exec() ) { slotFillLists(); } } } void EditAccounts::slotDeleteAccount( Account *account ) { - if ( QMessageBox::information( this, tr( "Question" ), + if ( QMessageBox::information( this, tr( "Question" ), tr( "<p>Do you really want to delete the selected Account?</p>" ), tr( "Yes" ), tr( "No" ) ) == 0 ) { settings->delAccount( account ); slotFillLists(); } } void EditAccounts::slotEditMail() { qDebug( "Edit Mail Account" ); if ( !mailList->currentItem() ) { - QMessageBox::information( this, tr( "Error" ), + QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotEditAccount( a ); } void EditAccounts::slotDeleteMail() { if ( !mailList->currentItem() ) { - QMessageBox::information( this, tr( "Error" ), + QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } - + Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotNewNews() { qDebug( "New News Account" ); slotNewAccount( "NNTP" ); } void EditAccounts::slotEditNews() { qDebug( "Edit News Account" ); if ( !newsList->currentItem() ) { - QMessageBox::information( this, tr( "Error" ), + QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotEditAccount( a ); } void EditAccounts::slotDeleteNews() { qDebug( "Delete News Account" ); if ( !newsList->currentItem() ) { - QMessageBox::information( this, tr( "Error" ), + QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select an account.</p>" ), tr( "Ok" ) ); return; } - + Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotAdjustColumns() { int currPage = configTab->currentPageIndex(); - + configTab->showPage( mailTab ); mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); mailList->setColumnWidth( 1, 50 ); configTab->showPage( newsTab ); newsList->setColumnWidth( 0, newsList->visibleWidth() ); configTab->setCurrentPage( currPage ); } void EditAccounts::accept() { settings->saveAccounts(); - + QDialog::accept(); } /** * SelectMailType */ SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) @@ -257,17 +258,17 @@ void SelectMailType::slotSelection( const QString &sel ) /** * IMAPconfig */ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : IMAPconfigUI( parent, name, modal, flags ) { data = account; - + fillValues(); connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); } void IMAPconfig::slotSSL( bool enabled ) { if ( enabled ) { @@ -424,17 +425,17 @@ void SMTPconfig::accept() NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : NNTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); - + fillValues(); connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); } void NNTPconfig::slotSSL( bool enabled ) { if ( enabled ) { diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 93f3bb7..740e4cf 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -1,19 +1,19 @@ #include "opiemail.h" #include "editaccounts.h" #include "composemail.h" OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) : MainWindow( parent, name, flags ) { settings = new Settings(); - + folderView->populate( settings->getAccounts() ); - + connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); } void OpieMail::slotComposeMail() @@ -42,9 +42,14 @@ void OpieMail::slotEditSettings() void OpieMail::slotEditAccounts() { qDebug( "Edit Accounts" ); EditAccounts eaDialog( settings, this, 0, true ); eaDialog.showMaximized(); eaDialog.slotAdjustColumns(); eaDialog.exec(); + if ( settings ) delete settings; + settings = new Settings(); + + folderView->populate( settings->getAccounts() ); } + diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index 7bcd818..ba60297 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h @@ -6,21 +6,22 @@ class OpieMail : public MainWindow { Q_OBJECT public: OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); static QString appName() { return QString::fromLatin1("opiemail"); } -protected slots: + +public slots: void slotComposeMail(); +protected slots: void slotSendQueued(); void slotSearchMails(); void slotEditSettings(); void slotEditAccounts(); - private: Settings *settings; }; #endif |