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,2 +1 @@ | |||
1 | #include <qt.h> | ||
2 | |||
@@ -5,2 +4,8 @@ | |||
5 | 4 | ||
5 | /* OPIE */ | ||
6 | #include <qpe/qpeapplication.h> | ||
7 | |||
8 | /* QT */ | ||
9 | #include <qt.h> | ||
10 | |||
6 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 11 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
@@ -41,6 +46,10 @@ void EditAccounts::slotFillLists() | |||
41 | Account *it; | 46 | Account *it; |
42 | for ( it = accounts.first(); it; it = accounts.next() ) { | 47 | for ( it = accounts.first(); it; it = accounts.next() ) |
43 | if ( it->getType().compare( "NNTP" ) == 0 ) { | 48 | { |
49 | if ( it->getType().compare( "NNTP" ) == 0 ) | ||
50 | { | ||
44 | (void) new AccountListItem( newsList, it ); | 51 | (void) new AccountListItem( newsList, it ); |
45 | } else { | 52 | } |
53 | else | ||
54 | { | ||
46 | (void) new AccountListItem( mailList, it ); | 55 | (void) new AccountListItem( mailList, it ); |
@@ -56,3 +65,4 @@ void EditAccounts::slotNewMail() | |||
56 | selType.show(); | 65 | selType.show(); |
57 | if ( QDialog::Accepted == selType.exec() ) { | 66 | if ( QDialog::Accepted == selType.exec() ) |
67 | { | ||
58 | slotNewAccount( *selection ); | 68 | slotNewAccount( *selection ); |
@@ -63,3 +73,4 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
63 | { | 73 | { |
64 | if ( type.compare( "IMAP" ) == 0 ) { | 74 | if ( type.compare( "IMAP" ) == 0 ) |
75 | { | ||
65 | qDebug( "-> config IMAP" ); | 76 | qDebug( "-> config IMAP" ); |
@@ -67,4 +78,4 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
67 | IMAPconfig imap( account, this, 0, true ); | 78 | IMAPconfig imap( account, this, 0, true ); |
68 | imap.showMaximized(); | 79 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) |
69 | if ( QDialog::Accepted == imap.exec() ) { | 80 | { |
70 | settings->addAccount( account ); | 81 | settings->addAccount( account ); |
@@ -72,6 +83,10 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
72 | slotFillLists(); | 83 | slotFillLists(); |
73 | } else { | 84 | } |
85 | else | ||
86 | { | ||
74 | account->remove(); | 87 | account->remove(); |
75 | } | 88 | } |
76 | } else if ( type.compare( "POP3" ) == 0 ) { | 89 | } |
90 | else if ( type.compare( "POP3" ) == 0 ) | ||
91 | { | ||
77 | qDebug( "-> config POP3" ); | 92 | qDebug( "-> config POP3" ); |
@@ -79,4 +94,4 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
79 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 94 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
80 | pop3.showMaximized(); | 95 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) |
81 | if ( QDialog::Accepted == pop3.exec() ) { | 96 | { |
82 | settings->addAccount( account ); | 97 | settings->addAccount( account ); |
@@ -84,6 +99,10 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
84 | slotFillLists(); | 99 | slotFillLists(); |
85 | } else { | 100 | } |
101 | else | ||
102 | { | ||
86 | account->remove(); | 103 | account->remove(); |
87 | } | 104 | } |
88 | } else if ( type.compare( "SMTP" ) == 0 ) { | 105 | } |
106 | else if ( type.compare( "SMTP" ) == 0 ) | ||
107 | { | ||
89 | qDebug( "-> config SMTP" ); | 108 | qDebug( "-> config SMTP" ); |
@@ -91,4 +110,4 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
91 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 110 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
92 | smtp.showMaximized(); | 111 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) |
93 | if ( QDialog::Accepted == smtp.exec() ) { | 112 | { |
94 | settings->addAccount( account ); | 113 | settings->addAccount( account ); |
@@ -97,6 +116,10 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
97 | 116 | ||
98 | } else { | 117 | } |
118 | else | ||
119 | { | ||
99 | account->remove(); | 120 | account->remove(); |
100 | } | 121 | } |
101 | } else if ( type.compare( "NNTP" ) == 0 ) { | 122 | } |
123 | else if ( type.compare( "NNTP" ) == 0 ) | ||
124 | { | ||
102 | qDebug( "-> config NNTP" ); | 125 | qDebug( "-> config NNTP" ); |
@@ -104,4 +127,4 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
104 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); | 127 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); |
105 | nntp.showMaximized(); | 128 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) |
106 | if ( QDialog::Accepted == nntp.exec() ) { | 129 | { |
107 | settings->addAccount( account ); | 130 | settings->addAccount( account ); |
@@ -109,3 +132,5 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
109 | slotFillLists(); | 132 | slotFillLists(); |
110 | } else { | 133 | } |
134 | else | ||
135 | { | ||
111 | account->remove(); | 136 | account->remove(); |
@@ -117,28 +142,35 @@ void EditAccounts::slotEditAccount( Account *account ) | |||
117 | { | 142 | { |
118 | if ( account->getType().compare( "IMAP" ) == 0 ) { | 143 | if ( account->getType().compare( "IMAP" ) == 0 ) |
144 | { | ||
119 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 145 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
120 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); | 146 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); |
121 | imap.showMaximized(); | 147 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) |
122 | if ( QDialog::Accepted == imap.exec() ) { | 148 | { |
123 | slotFillLists(); | 149 | slotFillLists(); |
124 | } | 150 | } |
125 | } else if ( account->getType().compare( "POP3" ) == 0 ) { | 151 | } |
152 | else if ( account->getType().compare( "POP3" ) == 0 ) | ||
153 | { | ||
126 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 154 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
127 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); | 155 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); |
128 | pop3.showMaximized(); | 156 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) |
129 | if ( QDialog::Accepted == pop3.exec() ) { | 157 | { |
130 | slotFillLists(); | 158 | slotFillLists(); |
131 | } | 159 | } |
132 | } else if ( account->getType().compare( "SMTP" ) == 0 ) { | 160 | } |
161 | else if ( account->getType().compare( "SMTP" ) == 0 ) | ||
162 | { | ||
133 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 163 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
134 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); | 164 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); |
135 | smtp.showMaximized(); | 165 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) |
136 | if ( QDialog::Accepted == smtp.exec() ) { | 166 | { |
137 | slotFillLists(); | 167 | slotFillLists(); |
138 | } | 168 | } |
139 | } else if ( account->getType().compare( "NNTP" ) == 0 ) { | 169 | } |
170 | else if ( account->getType().compare( "NNTP" ) == 0 ) | ||
171 | { | ||
140 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 172 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
141 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); | 173 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); |
142 | nntp.showMaximized(); | 174 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) |
143 | if ( QDialog::Accepted == nntp.exec() ) { | 175 | { |
144 | slotFillLists(); | 176 | slotFillLists(); |
@@ -152,3 +184,4 @@ void EditAccounts::slotDeleteAccount( Account *account ) | |||
152 | tr( "<p>Do you really want to delete the selected Account?</p>" ), | 184 | tr( "<p>Do you really want to delete the selected Account?</p>" ), |
153 | tr( "Yes" ), tr( "No" ) ) == 0 ) { | 185 | tr( "Yes" ), tr( "No" ) ) == 0 ) |
186 | { | ||
154 | settings->delAccount( account ); | 187 | settings->delAccount( account ); |
@@ -161,3 +194,4 @@ void EditAccounts::slotEditMail() | |||
161 | qDebug( "Edit Mail Account" ); | 194 | qDebug( "Edit Mail Account" ); |
162 | if ( !mailList->currentItem() ) { | 195 | if ( !mailList->currentItem() ) |
196 | { | ||
163 | QMessageBox::information( this, tr( "Error" ), | 197 | QMessageBox::information( this, tr( "Error" ), |
@@ -174,3 +208,4 @@ void EditAccounts::slotDeleteMail() | |||
174 | { | 208 | { |
175 | if ( !mailList->currentItem() ) { | 209 | if ( !mailList->currentItem() ) |
210 | { | ||
176 | QMessageBox::information( this, tr( "Error" ), | 211 | QMessageBox::information( this, tr( "Error" ), |
@@ -194,3 +229,4 @@ void EditAccounts::slotEditNews() | |||
194 | qDebug( "Edit News Account" ); | 229 | qDebug( "Edit News Account" ); |
195 | if ( !newsList->currentItem() ) { | 230 | if ( !newsList->currentItem() ) |
231 | { | ||
196 | QMessageBox::information( this, tr( "Error" ), | 232 | QMessageBox::information( this, tr( "Error" ), |
@@ -208,3 +244,4 @@ void EditAccounts::slotDeleteNews() | |||
208 | qDebug( "Delete News Account" ); | 244 | qDebug( "Delete News Account" ); |
209 | if ( !newsList->currentItem() ) { | 245 | if ( !newsList->currentItem() ) |
246 | { | ||
210 | QMessageBox::information( this, tr( "Error" ), | 247 | QMessageBox::information( this, tr( "Error" ), |
@@ -279,8 +316,13 @@ void IMAPconfig::slotConnectionToggle( int index ) | |||
279 | { | 316 | { |
280 | if ( index == 2 ) { | 317 | if ( index == 2 ) |
318 | { | ||
281 | portLine->setText( IMAP_SSL_PORT ); | 319 | portLine->setText( IMAP_SSL_PORT ); |
282 | } else if ( index == 3 ) { | 320 | } |
321 | else if ( index == 3 ) | ||
322 | { | ||
283 | portLine->setText( IMAP_PORT ); | 323 | portLine->setText( IMAP_PORT ); |
284 | CommandEdit->show(); | 324 | CommandEdit->show(); |
285 | } else { | 325 | } |
326 | else | ||
327 | { | ||
286 | portLine->setText( IMAP_PORT ); | 328 | portLine->setText( IMAP_PORT ); |
@@ -335,8 +377,13 @@ void POP3config::slotConnectionToggle( int index ) | |||
335 | // 2 is ssl connection | 377 | // 2 is ssl connection |
336 | if ( index == 2 ) { | 378 | if ( index == 2 ) |
379 | { | ||
337 | portLine->setText( POP3_SSL_PORT ); | 380 | portLine->setText( POP3_SSL_PORT ); |
338 | } else if ( index == 3 ) { | 381 | } |
382 | else if ( index == 3 ) | ||
383 | { | ||
339 | portLine->setText( POP3_PORT ); | 384 | portLine->setText( POP3_PORT ); |
340 | CommandEdit->show(); | 385 | CommandEdit->show(); |
341 | } else { | 386 | } |
387 | else | ||
388 | { | ||
342 | portLine->setText( POP3_PORT ); | 389 | portLine->setText( POP3_PORT ); |
@@ -393,8 +440,13 @@ void SMTPconfig::slotConnectionToggle( int index ) | |||
393 | // 2 is ssl connection | 440 | // 2 is ssl connection |
394 | if ( index == 2 ) { | 441 | if ( index == 2 ) |
442 | { | ||
395 | portLine->setText( SMTP_SSL_PORT ); | 443 | portLine->setText( SMTP_SSL_PORT ); |
396 | } else if ( index == 3 ) { | 444 | } |
445 | else if ( index == 3 ) | ||
446 | { | ||
397 | portLine->setText( SMTP_PORT ); | 447 | portLine->setText( SMTP_PORT ); |
398 | CommandEdit->show(); | 448 | CommandEdit->show(); |
399 | } else { | 449 | } |
450 | else | ||
451 | { | ||
400 | portLine->setText( SMTP_PORT ); | 452 | portLine->setText( SMTP_PORT ); |
@@ -446,5 +498,8 @@ void NNTPconfig::slotSSL( bool enabled ) | |||
446 | { | 498 | { |
447 | if ( enabled ) { | 499 | if ( enabled ) |
500 | { | ||
448 | portLine->setText( NNTP_SSL_PORT ); | 501 | portLine->setText( NNTP_SSL_PORT ); |
449 | } else { | 502 | } |
503 | else | ||
504 | { | ||
450 | portLine->setText( NNTP_PORT ); | 505 | portLine->setText( NNTP_PORT ); |