author | ar <ar> | 2004-02-21 15:27:41 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 15:27:41 (UTC) |
commit | 460258f203be746ff79e14f32a823f381b8ea513 (patch) (unidiff) | |
tree | 87dddbacda3050027d343730cf021b53045e80cb /noncore/net/mail/editaccounts.cpp | |
parent | 76b70b355d2c1c32c0f74e844e0654e39db2a175 (diff) | |
download | opie-460258f203be746ff79e14f32a823f381b8ea513.zip opie-460258f203be746ff79e14f32a823f381b8ea513.tar.gz opie-460258f203be746ff79e14f32a823f381b8ea513.tar.bz2 |
improve support for BigScreen
Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 183 |
1 files changed, 119 insertions, 64 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,10 +1,15 @@ | |||
1 | #include <qt.h> | ||
2 | 1 | ||
3 | #include "defines.h" | 2 | #include "defines.h" |
4 | #include "editaccounts.h" | 3 | #include "editaccounts.h" |
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) |
7 | : QListViewItem( parent ) | 12 | : QListViewItem( parent ) |
8 | { | 13 | { |
9 | account = a; | 14 | account = a; |
10 | setText( 0, account->getAccountName() ); | 15 | setText( 0, account->getAccountName() ); |
@@ -12,7 +17,7 @@ AccountListItem::AccountListItem( QListView *parent, Account *a) | |||
12 | } | 17 | } |
13 | 18 | ||
14 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 19 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
15 | : EditAccountsUI( parent, name, modal, flags ) | 20 | : EditAccountsUI( parent, name, modal, flags ) |
16 | { | 21 | { |
17 | qDebug( "New Account Configuration Widget" ); | 22 | qDebug( "New Account Configuration Widget" ); |
18 | settings = s; | 23 | settings = s; |
@@ -39,10 +44,14 @@ void EditAccounts::slotFillLists() | |||
39 | 44 | ||
40 | QList<Account> accounts = settings->getAccounts(); | 45 | QList<Account> accounts = settings->getAccounts(); |
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 ); |
47 | } | 56 | } |
48 | } | 57 | } |
@@ -54,60 +63,76 @@ void EditAccounts::slotNewMail() | |||
54 | QString *selection = new QString(); | 63 | QString *selection = new QString(); |
55 | SelectMailType selType( selection, this, 0, true ); | 64 | SelectMailType selType( selection, this, 0, true ); |
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 ); |
59 | } | 69 | } |
60 | } | 70 | } |
61 | 71 | ||
62 | void EditAccounts::slotNewAccount( const QString &type ) | 72 | 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" ); |
66 | IMAPaccount *account = new IMAPaccount(); | 77 | IMAPaccount *account = new IMAPaccount(); |
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 ); |
71 | account->save(); | 82 | account->save(); |
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" ); |
78 | POP3account *account = new POP3account(); | 93 | POP3account *account = new POP3account(); |
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 ); |
83 | account->save(); | 98 | account->save(); |
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" ); |
90 | SMTPaccount *account = new SMTPaccount(); | 109 | SMTPaccount *account = new SMTPaccount(); |
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 ); |
95 | account->save(); | 114 | account->save(); |
96 | slotFillLists(); | 115 | slotFillLists(); |
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" ); |
103 | NNTPaccount *account = new NNTPaccount(); | 126 | NNTPaccount *account = new NNTPaccount(); |
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 ); |
108 | account->save(); | 131 | account->save(); |
109 | slotFillLists(); | 132 | slotFillLists(); |
110 | } else { | 133 | } |
134 | else | ||
135 | { | ||
111 | account->remove(); | 136 | account->remove(); |
112 | } | 137 | } |
113 | } | 138 | } |
@@ -115,33 +140,40 @@ void EditAccounts::slotNewAccount( const QString &type ) | |||
115 | 140 | ||
116 | void EditAccounts::slotEditAccount( Account *account ) | 141 | 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(); |
145 | } | 177 | } |
146 | } | 178 | } |
147 | } | 179 | } |
@@ -149,8 +181,9 @@ void EditAccounts::slotEditAccount( Account *account ) | |||
149 | void EditAccounts::slotDeleteAccount( Account *account ) | 181 | void EditAccounts::slotDeleteAccount( Account *account ) |
150 | { | 182 | { |
151 | if ( QMessageBox::information( this, tr( "Question" ), | 183 | if ( QMessageBox::information( this, tr( "Question" ), |
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 ); |
155 | slotFillLists(); | 188 | slotFillLists(); |
156 | } | 189 | } |
@@ -159,7 +192,8 @@ void EditAccounts::slotDeleteAccount( Account *account ) | |||
159 | void EditAccounts::slotEditMail() | 192 | void EditAccounts::slotEditMail() |
160 | { | 193 | { |
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" ), |
164 | tr( "<p>Please select an account.</p>" ), | 198 | tr( "<p>Please select an account.</p>" ), |
165 | tr( "Ok" ) ); | 199 | tr( "Ok" ) ); |
@@ -172,7 +206,8 @@ void EditAccounts::slotEditMail() | |||
172 | 206 | ||
173 | void EditAccounts::slotDeleteMail() | 207 | 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" ), |
177 | tr( "<p>Please select an account.</p>" ), | 212 | tr( "<p>Please select an account.</p>" ), |
178 | tr( "Ok" ) ); | 213 | tr( "Ok" ) ); |
@@ -192,7 +227,8 @@ void EditAccounts::slotNewNews() | |||
192 | void EditAccounts::slotEditNews() | 227 | void EditAccounts::slotEditNews() |
193 | { | 228 | { |
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" ), |
197 | tr( "<p>Please select an account.</p>" ), | 233 | tr( "<p>Please select an account.</p>" ), |
198 | tr( "Ok" ) ); | 234 | tr( "Ok" ) ); |
@@ -206,7 +242,8 @@ void EditAccounts::slotEditNews() | |||
206 | void EditAccounts::slotDeleteNews() | 242 | void EditAccounts::slotDeleteNews() |
207 | { | 243 | { |
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" ), |
211 | tr( "<p>Please select an account.</p>" ), | 248 | tr( "<p>Please select an account.</p>" ), |
212 | tr( "Ok" ) ); | 249 | tr( "Ok" ) ); |
@@ -243,7 +280,7 @@ void EditAccounts::accept() | |||
243 | */ | 280 | */ |
244 | 281 | ||
245 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) | 282 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) |
246 | : SelectMailTypeUI( parent, name, modal, flags ) | 283 | : SelectMailTypeUI( parent, name, modal, flags ) |
247 | { | 284 | { |
248 | selected = selection; | 285 | selected = selection; |
249 | selected->replace( 0, selected->length(), typeBox->currentText() ); | 286 | selected->replace( 0, selected->length(), typeBox->currentText() ); |
@@ -260,7 +297,7 @@ void SelectMailType::slotSelection( const QString &sel ) | |||
260 | */ | 297 | */ |
261 | 298 | ||
262 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 299 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
263 | : IMAPconfigUI( parent, name, modal, flags ) | 300 | : IMAPconfigUI( parent, name, modal, flags ) |
264 | { | 301 | { |
265 | data = account; | 302 | data = account; |
266 | 303 | ||
@@ -277,12 +314,17 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, | |||
277 | 314 | ||
278 | void IMAPconfig::slotConnectionToggle( int index ) | 315 | void IMAPconfig::slotConnectionToggle( int index ) |
279 | { | 316 | { |
280 | if ( index == 2 ) { | 317 | if ( index == 2 ) |
281 | portLine->setText( IMAP_SSL_PORT ); | 318 | { |
282 | } else if ( index == 3 ) { | 319 | portLine->setText( IMAP_SSL_PORT ); |
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 ); |
287 | } | 329 | } |
288 | } | 330 | } |
@@ -316,7 +358,7 @@ void IMAPconfig::accept() | |||
316 | */ | 358 | */ |
317 | 359 | ||
318 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 360 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
319 | : POP3configUI( parent, name, modal, flags ) | 361 | : POP3configUI( parent, name, modal, flags ) |
320 | { | 362 | { |
321 | data = account; | 363 | data = account; |
322 | fillValues(); | 364 | fillValues(); |
@@ -333,12 +375,17 @@ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, | |||
333 | void POP3config::slotConnectionToggle( int index ) | 375 | void POP3config::slotConnectionToggle( int index ) |
334 | { | 376 | { |
335 | // 2 is ssl connection | 377 | // 2 is ssl connection |
336 | if ( index == 2 ) { | 378 | if ( index == 2 ) |
337 | portLine->setText( POP3_SSL_PORT ); | 379 | { |
338 | } else if ( index == 3 ) { | 380 | portLine->setText( POP3_SSL_PORT ); |
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 ); |
343 | } | 390 | } |
344 | } | 391 | } |
@@ -370,7 +417,7 @@ void POP3config::accept() | |||
370 | */ | 417 | */ |
371 | 418 | ||
372 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 419 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
373 | : SMTPconfigUI( parent, name, modal, flags ) | 420 | : SMTPconfigUI( parent, name, modal, flags ) |
374 | { | 421 | { |
375 | data = account; | 422 | data = account; |
376 | 423 | ||
@@ -391,12 +438,17 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, | |||
391 | void SMTPconfig::slotConnectionToggle( int index ) | 438 | void SMTPconfig::slotConnectionToggle( int index ) |
392 | { | 439 | { |
393 | // 2 is ssl connection | 440 | // 2 is ssl connection |
394 | if ( index == 2 ) { | 441 | if ( index == 2 ) |
395 | portLine->setText( SMTP_SSL_PORT ); | 442 | { |
396 | } else if ( index == 3 ) { | 443 | portLine->setText( SMTP_SSL_PORT ); |
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 ); |
401 | } | 453 | } |
402 | } | 454 | } |
@@ -430,7 +482,7 @@ void SMTPconfig::accept() | |||
430 | */ | 482 | */ |
431 | 483 | ||
432 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 484 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
433 | : NNTPconfigUI( parent, name, modal, flags ) | 485 | : NNTPconfigUI( parent, name, modal, flags ) |
434 | { | 486 | { |
435 | data = account; | 487 | data = account; |
436 | 488 | ||
@@ -444,9 +496,12 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, | |||
444 | 496 | ||
445 | void NNTPconfig::slotSSL( bool enabled ) | 497 | 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 ); |
451 | } | 506 | } |
452 | } | 507 | } |