author | harlekin <harlekin> | 2003-12-17 00:18:06 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-17 00:18:06 (UTC) |
commit | fb054f9c69224e14f446f405098bd5166377f58d (patch) (side-by-side diff) | |
tree | 6c729398a7f69eedf5554aa3c2509784eb9806df | |
parent | 30e3e50ecb912e93faeeafbfff36f8032a904b84 (diff) | |
download | opie-fb054f9c69224e14f446f405098bd5166377f58d.zip opie-fb054f9c69224e14f446f405098bd5166377f58d.tar.gz opie-fb054f9c69224e14f446f405098bd5166377f58d.tar.bz2 |
new account, changed account etc are there now without a restart ,)
-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 @@ -13,18 +13,18 @@ AccountListItem::AccountListItem( QListView *parent, Account *a) 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() ) ); @@ -67,13 +67,13 @@ void EditAccounts::slotNewAccount( const QString &type ) 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 ); @@ -91,12 +91,13 @@ void EditAccounts::slotNewAccount( const QString &type ) 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(); @@ -144,43 +145,43 @@ void EditAccounts::slotEditAccount( Account *account ) } } } 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() { @@ -189,13 +190,13 @@ void EditAccounts::slotNewNews() } 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(); @@ -203,26 +204,26 @@ void EditAccounts::slotEditNews() } 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() ); @@ -230,13 +231,13 @@ void EditAccounts::slotAdjustColumns() configTab->setCurrentPage( currPage ); } void EditAccounts::accept() { settings->saveAccounts(); - + QDialog::accept(); } /** * SelectMailType */ @@ -259,13 +260,13 @@ void SelectMailType::slotSelection( const QString &sel ) */ 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 ) @@ -426,13 +427,13 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, : 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 ) 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 @@ -3,15 +3,15 @@ #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() ) ); } @@ -44,7 +44,12 @@ 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 @@ -8,19 +8,20 @@ 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 |