-rw-r--r-- | kmicromail/editaccounts.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index d272c3b..e7d2750 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -1,66 +1,67 @@ | |||
1 | 1 | ||
2 | #include "defines.h" | 2 | #include "defines.h" |
3 | #include "editaccounts.h" | 3 | #include "editaccounts.h" |
4 | #include "kapplication.h" | 4 | #include "kapplication.h" |
5 | /* OPIE */ | 5 | /* OPIE */ |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
10 | 10 | ||
11 | #include <qcombobox.h> | 11 | #include <qcombobox.h> |
12 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qtabwidget.h> | 17 | #include <qtabwidget.h> |
18 | #include <qlistview.h> | 18 | #include <qlistview.h> |
19 | #include <qspinbox.h> | ||
19 | 20 | ||
20 | #include <libmailwrapper/nntpwrapper.h> | 21 | #include <libmailwrapper/nntpwrapper.h> |
21 | 22 | ||
22 | using namespace Opie::Core; | 23 | using namespace Opie::Core; |
23 | 24 | ||
24 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 25 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
25 | : QListViewItem( parent ) | 26 | : QListViewItem( parent ) |
26 | { | 27 | { |
27 | account = a; | 28 | account = a; |
28 | setText( 0, account->getAccountName() ); | 29 | setText( 0, account->getAccountName() ); |
29 | QString ttext = ""; | 30 | QString ttext = ""; |
30 | switch (account->getType()) { | 31 | switch (account->getType()) { |
31 | case MAILLIB::A_NNTP: | 32 | case MAILLIB::A_NNTP: |
32 | ttext="NNTP"; | 33 | ttext="NNTP"; |
33 | break; | 34 | break; |
34 | case MAILLIB::A_POP3: | 35 | case MAILLIB::A_POP3: |
35 | ttext = "POP3"; | 36 | ttext = "POP3"; |
36 | break; | 37 | break; |
37 | case MAILLIB::A_IMAP: | 38 | case MAILLIB::A_IMAP: |
38 | ttext = "IMAP"; | 39 | ttext = "IMAP"; |
39 | break; | 40 | break; |
40 | case MAILLIB::A_SMTP: | 41 | case MAILLIB::A_SMTP: |
41 | ttext = "SMTP"; | 42 | ttext = "SMTP"; |
42 | break; | 43 | break; |
43 | default: | 44 | default: |
44 | ttext = "UNKNOWN"; | 45 | ttext = "UNKNOWN"; |
45 | break; | 46 | break; |
46 | } | 47 | } |
47 | setText( 1, ttext); | 48 | setText( 1, ttext); |
48 | } | 49 | } |
49 | 50 | ||
50 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 51 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
51 | : EditAccountsUI( parent, name, modal, flags ) | 52 | : EditAccountsUI( parent, name, modal, flags ) |
52 | { | 53 | { |
53 | settings = s; | 54 | settings = s; |
54 | 55 | ||
55 | mailList->addColumn( tr( "Account" ) ); | 56 | mailList->addColumn( tr( "Account" ) ); |
56 | mailList->addColumn( tr( "Type" ) ); | 57 | mailList->addColumn( tr( "Type" ) ); |
57 | 58 | ||
58 | newsList->addColumn( tr( "Account" ) ); | 59 | newsList->addColumn( tr( "Account" ) ); |
59 | 60 | ||
60 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 61 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
61 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 62 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
62 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 63 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
63 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 64 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
64 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 65 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
65 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 66 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
66 | 67 | ||
@@ -375,106 +376,117 @@ void IMAPconfig::accept() | |||
375 | QDialog::accept(); | 376 | QDialog::accept(); |
376 | } | 377 | } |
377 | 378 | ||
378 | /** | 379 | /** |
379 | * POP3config | 380 | * POP3config |
380 | */ | 381 | */ |
381 | 382 | ||
382 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 383 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
383 | : POP3configUI( parent, name, modal, flags ) | 384 | : POP3configUI( parent, name, modal, flags ) |
384 | { | 385 | { |
385 | data = account; | 386 | data = account; |
386 | fillValues(); | 387 | fillValues(); |
387 | 388 | ||
388 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 389 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
389 | ComboBox1->insertItem( "Only if available", 0 ); | 390 | ComboBox1->insertItem( "Only if available", 0 ); |
390 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 391 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
391 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 392 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
392 | ComboBox1->insertItem( "Run command instead", 3 ); | 393 | ComboBox1->insertItem( "Run command instead", 3 ); |
393 | CommandEdit->hide(); | 394 | CommandEdit->hide(); |
394 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 395 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
395 | } | 396 | } |
396 | 397 | ||
397 | void POP3config::slotConnectionToggle( int index ) | 398 | void POP3config::slotConnectionToggle( int index ) |
398 | { | 399 | { |
399 | // 2 is ssl connection | 400 | // 2 is ssl connection |
400 | if ( index == 2 ) | 401 | if ( index == 2 ) |
401 | { | 402 | { |
402 | portLine->setText( POP3_SSL_PORT ); | 403 | portLine->setText( POP3_SSL_PORT ); |
403 | } | 404 | } |
404 | else if ( index == 3 ) | 405 | else if ( index == 3 ) |
405 | { | 406 | { |
406 | portLine->setText( POP3_PORT ); | 407 | portLine->setText( POP3_PORT ); |
407 | CommandEdit->show(); | 408 | CommandEdit->show(); |
408 | } | 409 | } |
409 | else | 410 | else |
410 | { | 411 | { |
411 | portLine->setText( POP3_PORT ); | 412 | portLine->setText( POP3_PORT ); |
412 | } | 413 | } |
413 | } | 414 | } |
414 | 415 | ||
415 | void POP3config::fillValues() | 416 | void POP3config::fillValues() |
416 | { | 417 | { |
417 | accountLine->setText( data->getAccountName() ); | 418 | accountLine->setText( data->getAccountName() ); |
418 | serverLine->setText( data->getServer() ); | 419 | serverLine->setText( data->getServer() ); |
419 | portLine->setText( data->getPort() ); | 420 | portLine->setText( data->getPort() ); |
420 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 421 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
421 | userLine->setText( data->getUser() ); | 422 | userLine->setText( data->getUser() ); |
422 | passLine->setText( data->getPassword() ); | 423 | passLine->setText( data->getPassword() ); |
424 | localFolder->setText( data->getLocalFolder() ); | ||
425 | int max = data->getMaxMailSize() ; | ||
426 | if ( max ) { | ||
427 | CheckBoxDown->setChecked( true ); | ||
428 | SpinBoxDown->setValue ( max ); | ||
429 | } else { | ||
430 | CheckBoxDown->setChecked( false ); | ||
431 | SpinBoxDown->setValue ( 5 ); | ||
432 | } | ||
423 | } | 433 | } |
424 | 434 | ||
425 | void POP3config::accept() | 435 | void POP3config::accept() |
426 | { | 436 | { |
427 | data->setAccountName( accountLine->text() ); | 437 | data->setAccountName( accountLine->text() ); |
428 | data->setServer( serverLine->text() ); | 438 | data->setServer( serverLine->text() ); |
429 | data->setPort( portLine->text() ); | 439 | data->setPort( portLine->text() ); |
430 | data->setConnectionType( ComboBox1->currentItem() ); | 440 | data->setConnectionType( ComboBox1->currentItem() ); |
431 | data->setUser( userLine->text() ); | 441 | data->setUser( userLine->text() ); |
432 | data->setPassword( passLine->text() ); | 442 | data->setPassword( passLine->text() ); |
443 | data->setLocalFolder( localFolder->text() ); | ||
444 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | ||
433 | 445 | ||
434 | QDialog::accept(); | 446 | QDialog::accept(); |
435 | } | 447 | } |
436 | 448 | ||
437 | /** | 449 | /** |
438 | * SMTPconfig | 450 | * SMTPconfig |
439 | */ | 451 | */ |
440 | 452 | ||
441 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 453 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
442 | : SMTPconfigUI( parent, name, modal, flags ) | 454 | : SMTPconfigUI( parent, name, modal, flags ) |
443 | { | 455 | { |
444 | data = account; | 456 | data = account; |
445 | 457 | ||
446 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 458 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
447 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 459 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
448 | 460 | ||
449 | fillValues(); | 461 | fillValues(); |
450 | 462 | ||
451 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 463 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
452 | ComboBox1->insertItem( "Only if available", 0 ); | 464 | ComboBox1->insertItem( "Only if available", 0 ); |
453 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 465 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
454 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 466 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
455 | ComboBox1->insertItem( "Run command instead", 3 ); | 467 | ComboBox1->insertItem( "Run command instead", 3 ); |
456 | CommandEdit->hide(); | 468 | CommandEdit->hide(); |
457 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 469 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
458 | } | 470 | } |
459 | 471 | ||
460 | void SMTPconfig::slotConnectionToggle( int index ) | 472 | void SMTPconfig::slotConnectionToggle( int index ) |
461 | { | 473 | { |
462 | // 2 is ssl connection | 474 | // 2 is ssl connection |
463 | if ( index == 2 ) | 475 | if ( index == 2 ) |
464 | { | 476 | { |
465 | portLine->setText( SMTP_SSL_PORT ); | 477 | portLine->setText( SMTP_SSL_PORT ); |
466 | } | 478 | } |
467 | else if ( index == 3 ) | 479 | else if ( index == 3 ) |
468 | { | 480 | { |
469 | portLine->setText( SMTP_PORT ); | 481 | portLine->setText( SMTP_PORT ); |
470 | CommandEdit->show(); | 482 | CommandEdit->show(); |
471 | } | 483 | } |
472 | else | 484 | else |
473 | { | 485 | { |
474 | portLine->setText( SMTP_PORT ); | 486 | portLine->setText( SMTP_PORT ); |
475 | } | 487 | } |
476 | } | 488 | } |
477 | 489 | ||
478 | void SMTPconfig::fillValues() | 490 | void SMTPconfig::fillValues() |
479 | { | 491 | { |
480 | accountLine->setText( data->getAccountName() ); | 492 | accountLine->setText( data->getAccountName() ); |