-rw-r--r-- | kmicromail/editaccounts.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 48c3963..8253c91 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -1,117 +1,118 @@ | |||
1 | 1 | ||
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include "kapplication.h" | 3 | #include "kapplication.h" |
4 | #include "defines.h" | 4 | #include "defines.h" |
5 | #include "editaccounts.h" | 5 | #include "editaccounts.h" |
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | /* QT */ | 9 | /* QT */ |
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | 11 | ||
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qcheckbox.h> | 13 | #include <qcheckbox.h> |
14 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
15 | #include <qpushbutton.h> | 15 | #include <qpushbutton.h> |
16 | #include <qlineedit.h> | 16 | #include <qlineedit.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qtabwidget.h> | 18 | #include <qtabwidget.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qspinbox.h> | 20 | #include <qspinbox.h> |
21 | #include <klocale.h> | 21 | #include <klocale.h> |
22 | #include <kfiledialog.h> | ||
22 | 23 | ||
23 | #include <libmailwrapper/nntpwrapper.h> | 24 | #include <libmailwrapper/nntpwrapper.h> |
24 | 25 | ||
25 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
26 | 27 | ||
27 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 28 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
28 | : QListViewItem( parent ) | 29 | : QListViewItem( parent ) |
29 | { | 30 | { |
30 | account = a; | 31 | account = a; |
31 | setText( 0, account->getAccountName() ); | 32 | setText( 0, account->getAccountName() ); |
32 | QString ttext = ""; | 33 | QString ttext = ""; |
33 | switch (account->getType()) { | 34 | switch (account->getType()) { |
34 | case MAILLIB::A_NNTP: | 35 | case MAILLIB::A_NNTP: |
35 | ttext="NNTP"; | 36 | ttext="NNTP"; |
36 | break; | 37 | break; |
37 | case MAILLIB::A_POP3: | 38 | case MAILLIB::A_POP3: |
38 | ttext = "POP3"; | 39 | ttext = "POP3"; |
39 | break; | 40 | break; |
40 | case MAILLIB::A_IMAP: | 41 | case MAILLIB::A_IMAP: |
41 | ttext = "IMAP"; | 42 | ttext = "IMAP"; |
42 | break; | 43 | break; |
43 | case MAILLIB::A_SMTP: | 44 | case MAILLIB::A_SMTP: |
44 | ttext = "SMTP"; | 45 | ttext = "SMTP"; |
45 | break; | 46 | break; |
46 | default: | 47 | default: |
47 | ttext = "UNKNOWN"; | 48 | ttext = "UNKNOWN"; |
48 | break; | 49 | break; |
49 | } | 50 | } |
50 | setText( 1, ttext); | 51 | setText( 1, ttext); |
51 | } | 52 | } |
52 | 53 | ||
53 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 54 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
54 | : EditAccountsUI( parent, name, modal, flags ) | 55 | : EditAccountsUI( parent, name, modal, flags ) |
55 | { | 56 | { |
56 | settings = s; | 57 | settings = s; |
57 | 58 | ||
58 | mailList->addColumn( i18n( "Account" ) ); | 59 | mailList->addColumn( i18n( "Account" ) ); |
59 | mailList->addColumn( i18n( "Type" ) ); | 60 | mailList->addColumn( i18n( "Type" ) ); |
60 | 61 | ||
61 | newsList->addColumn( i18n( "Account" ) ); | 62 | newsList->addColumn( i18n( "Account" ) ); |
62 | 63 | ||
63 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 64 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
64 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 65 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
65 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 66 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
66 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 67 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
67 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 68 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
68 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 69 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
69 | 70 | ||
70 | slotFillLists(); | 71 | slotFillLists(); |
71 | } | 72 | } |
72 | 73 | ||
73 | void EditAccounts::slotFillLists() | 74 | void EditAccounts::slotFillLists() |
74 | { | 75 | { |
75 | mailList->clear(); | 76 | mailList->clear(); |
76 | newsList->clear(); | 77 | newsList->clear(); |
77 | 78 | ||
78 | QList<Account> accounts = settings->getAccounts(); | 79 | QList<Account> accounts = settings->getAccounts(); |
79 | Account *it; | 80 | Account *it; |
80 | for ( it = accounts.first(); it; it = accounts.next() ) | 81 | for ( it = accounts.first(); it; it = accounts.next() ) |
81 | { | 82 | { |
82 | if ( it->getType()==MAILLIB::A_NNTP ) | 83 | if ( it->getType()==MAILLIB::A_NNTP ) |
83 | { | 84 | { |
84 | (void) new AccountListItem( newsList, it ); | 85 | (void) new AccountListItem( newsList, it ); |
85 | } | 86 | } |
86 | else | 87 | else |
87 | { | 88 | { |
88 | (void) new AccountListItem( mailList, it ); | 89 | (void) new AccountListItem( mailList, it ); |
89 | } | 90 | } |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
93 | void EditAccounts::slotNewMail() | 94 | void EditAccounts::slotNewMail() |
94 | { | 95 | { |
95 | QString *selection = new QString(); | 96 | QString *selection = new QString(); |
96 | SelectMailType selType( selection, this, 0, true ); | 97 | SelectMailType selType( selection, this, 0, true ); |
97 | selType.show(); | 98 | selType.show(); |
98 | if ( QDialog::Accepted == selType.exec() ) | 99 | if ( QDialog::Accepted == selType.exec() ) |
99 | { | 100 | { |
100 | slotNewAccount( *selection ); | 101 | slotNewAccount( *selection ); |
101 | } | 102 | } |
102 | } | 103 | } |
103 | 104 | ||
104 | void EditAccounts::slotNewAccount( const QString &type ) | 105 | void EditAccounts::slotNewAccount( const QString &type ) |
105 | { | 106 | { |
106 | if ( type.compare( i18n("IMAP") ) == 0 ) | 107 | if ( type.compare( i18n("IMAP") ) == 0 ) |
107 | { | 108 | { |
108 | IMAPaccount *account = new IMAPaccount(); | 109 | IMAPaccount *account = new IMAPaccount(); |
109 | IMAPconfig imap( account, this, 0, true ); | 110 | IMAPconfig imap( account, this, 0, true ); |
110 | 111 | ||
111 | #ifndef DESKTOP_VERSION | 112 | #ifndef DESKTOP_VERSION |
112 | imap.showMaximized(); | 113 | imap.showMaximized(); |
113 | #endif | 114 | #endif |
114 | if ( QDialog::Accepted == imap.exec() ) | 115 | if ( QDialog::Accepted == imap.exec() ) |
115 | { | 116 | { |
116 | settings->addAccount( account ); | 117 | settings->addAccount( account ); |
117 | account->save(); | 118 | account->save(); |
@@ -386,240 +387,254 @@ void IMAPconfig::accept() | |||
386 | data->setConnectionType( ComboBox1->currentItem() ); | 387 | data->setConnectionType( ComboBox1->currentItem() ); |
387 | data->setUser( userLine->text() ); | 388 | data->setUser( userLine->text() ); |
388 | data->setPassword( passLine->text() ); | 389 | data->setPassword( passLine->text() ); |
389 | data->setPrefix(prefixLine->text()); | 390 | data->setPrefix(prefixLine->text()); |
390 | data->setLocalFolder( localFolder->text() ); | 391 | data->setLocalFolder( localFolder->text() ); |
391 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 392 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
392 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 393 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
393 | 394 | ||
394 | QDialog::accept(); | 395 | QDialog::accept(); |
395 | } | 396 | } |
396 | 397 | ||
397 | /** | 398 | /** |
398 | * POP3config | 399 | * POP3config |
399 | */ | 400 | */ |
400 | 401 | ||
401 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 402 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
402 | : POP3configUI( parent, name, modal, flags ) | 403 | : POP3configUI( parent, name, modal, flags ) |
403 | { | 404 | { |
404 | data = account; | 405 | data = account; |
405 | fillValues(); | 406 | fillValues(); |
406 | 407 | ||
407 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 408 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
408 | ComboBox1->insertItem( "Only if available", 0 ); | 409 | ComboBox1->insertItem( "Only if available", 0 ); |
409 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 410 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
410 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 411 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
411 | ComboBox1->insertItem( "Run command instead", 3 ); | 412 | ComboBox1->insertItem( "Run command instead", 3 ); |
412 | CommandEdit->hide(); | 413 | CommandEdit->hide(); |
413 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 414 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
414 | } | 415 | } |
415 | 416 | ||
416 | void POP3config::slotConnectionToggle( int index ) | 417 | void POP3config::slotConnectionToggle( int index ) |
417 | { | 418 | { |
418 | // 2 is ssl connection | 419 | // 2 is ssl connection |
419 | if ( index == 2 ) | 420 | if ( index == 2 ) |
420 | { | 421 | { |
421 | portLine->setText( POP3_SSL_PORT ); | 422 | portLine->setText( POP3_SSL_PORT ); |
422 | } | 423 | } |
423 | else if ( index == 3 ) | 424 | else if ( index == 3 ) |
424 | { | 425 | { |
425 | portLine->setText( POP3_PORT ); | 426 | portLine->setText( POP3_PORT ); |
426 | CommandEdit->show(); | 427 | CommandEdit->show(); |
427 | } | 428 | } |
428 | else | 429 | else |
429 | { | 430 | { |
430 | portLine->setText( POP3_PORT ); | 431 | portLine->setText( POP3_PORT ); |
431 | } | 432 | } |
432 | } | 433 | } |
433 | 434 | ||
434 | void POP3config::fillValues() | 435 | void POP3config::fillValues() |
435 | { | 436 | { |
436 | accountLine->setText( data->getAccountName() ); | 437 | accountLine->setText( data->getAccountName() ); |
437 | serverLine->setText( data->getServer() ); | 438 | serverLine->setText( data->getServer() ); |
438 | portLine->setText( data->getPort() ); | 439 | portLine->setText( data->getPort() ); |
439 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 440 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
440 | userLine->setText( data->getUser() ); | 441 | userLine->setText( data->getUser() ); |
441 | passLine->setText( data->getPassword() ); | 442 | passLine->setText( data->getPassword() ); |
442 | localFolder->setText( data->getLocalFolder() ); | 443 | localFolder->setText( data->getLocalFolder() ); |
443 | int max = data->getMaxMailSize() ; | 444 | int max = data->getMaxMailSize() ; |
444 | if ( max ) { | 445 | if ( max ) { |
445 | CheckBoxDown->setChecked( true ); | 446 | CheckBoxDown->setChecked( true ); |
446 | SpinBoxDown->setValue ( max ); | 447 | SpinBoxDown->setValue ( max ); |
447 | } else { | 448 | } else { |
448 | CheckBoxDown->setChecked( false ); | 449 | CheckBoxDown->setChecked( false ); |
449 | SpinBoxDown->setValue ( 5 ); | 450 | SpinBoxDown->setValue ( 5 ); |
450 | } | 451 | } |
451 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 452 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
452 | } | 453 | } |
453 | 454 | ||
454 | void POP3config::accept() | 455 | void POP3config::accept() |
455 | { | 456 | { |
456 | data->setAccountName( accountLine->text() ); | 457 | data->setAccountName( accountLine->text() ); |
457 | data->setServer( serverLine->text() ); | 458 | data->setServer( serverLine->text() ); |
458 | data->setPort( portLine->text() ); | 459 | data->setPort( portLine->text() ); |
459 | data->setConnectionType( ComboBox1->currentItem() ); | 460 | data->setConnectionType( ComboBox1->currentItem() ); |
460 | data->setUser( userLine->text() ); | 461 | data->setUser( userLine->text() ); |
461 | data->setPassword( passLine->text() ); | 462 | data->setPassword( passLine->text() ); |
462 | data->setLocalFolder( localFolder->text() ); | 463 | data->setLocalFolder( localFolder->text() ); |
463 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 464 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
464 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 465 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
465 | 466 | ||
466 | QDialog::accept(); | 467 | QDialog::accept(); |
467 | } | 468 | } |
468 | 469 | ||
469 | /** | 470 | /** |
470 | * SMTPconfig | 471 | * SMTPconfig |
471 | */ | 472 | */ |
472 | 473 | ||
473 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 474 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
474 | : SMTPconfigUI( parent, name, modal, flags ) | 475 | : SMTPconfigUI( parent, name, modal, flags ) |
475 | { | 476 | { |
476 | data = account; | 477 | data = account; |
477 | 478 | ||
478 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 479 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
479 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 480 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
480 | 481 | ||
481 | fillValues(); | 482 | fillValues(); |
482 | 483 | QIconSet icon; | |
484 | //icon = SmallIcon("fileexport"); | ||
485 | icon = SmallIcon("fileopen"); | ||
486 | SignaturButton->setText(""); | ||
487 | SignaturButton->setIconSet (icon ) ; | ||
488 | SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; | ||
489 | connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); | ||
483 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 490 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
484 | ComboBox1->insertItem( "Only if available", 0 ); | 491 | ComboBox1->insertItem( "Only if available", 0 ); |
485 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 492 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
486 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 493 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
487 | ComboBox1->insertItem( "Run command instead", 3 ); | 494 | ComboBox1->insertItem( "Run command instead", 3 ); |
488 | CommandEdit->hide(); | 495 | CommandEdit->hide(); |
489 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 496 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
490 | } | 497 | } |
491 | 498 | void SMTPconfig::chooseSig() | |
499 | { | ||
500 | QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); | ||
501 | if ( !lnk.isEmpty() ) { | ||
502 | SignaturEdit->setText( lnk ); | ||
503 | } | ||
504 | } | ||
492 | void SMTPconfig::slotConnectionToggle( int index ) | 505 | void SMTPconfig::slotConnectionToggle( int index ) |
493 | { | 506 | { |
494 | // 2 is ssl connection | 507 | // 2 is ssl connection |
495 | if ( index == 2 ) | 508 | if ( index == 2 ) |
496 | { | 509 | { |
497 | portLine->setText( SMTP_SSL_PORT ); | 510 | portLine->setText( SMTP_SSL_PORT ); |
498 | } | 511 | } |
499 | else if ( index == 3 ) | 512 | else if ( index == 3 ) |
500 | { | 513 | { |
501 | portLine->setText( SMTP_PORT ); | 514 | portLine->setText( SMTP_PORT ); |
502 | CommandEdit->show(); | 515 | CommandEdit->show(); |
503 | } | 516 | } |
504 | else | 517 | else |
505 | { | 518 | { |
506 | portLine->setText( SMTP_PORT ); | 519 | portLine->setText( SMTP_PORT ); |
507 | } | 520 | } |
508 | } | 521 | } |
509 | 522 | ||
510 | void SMTPconfig::fillValues() | 523 | void SMTPconfig::fillValues() |
511 | { | 524 | { |
512 | accountLine->setText( data->getAccountName() ); | 525 | accountLine->setText( data->getAccountName() ); |
513 | serverLine->setText( data->getServer() ); | 526 | serverLine->setText( data->getServer() ); |
514 | portLine->setText( data->getPort() ); | 527 | portLine->setText( data->getPort() ); |
515 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 528 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
516 | loginBox->setChecked( data->getLogin() ); | 529 | loginBox->setChecked( data->getLogin() ); |
517 | userLine->setText( data->getUser() ); | 530 | userLine->setText( data->getUser() ); |
518 | passLine->setText( data->getPassword() ); | 531 | passLine->setText( data->getPassword() ); |
532 | SignaturEdit->setText( data->getSigFile() ); | ||
519 | } | 533 | } |
520 | 534 | ||
521 | void SMTPconfig::accept() | 535 | void SMTPconfig::accept() |
522 | { | 536 | { |
523 | data->setAccountName( accountLine->text() ); | 537 | data->setAccountName( accountLine->text() ); |
524 | data->setServer( serverLine->text() ); | 538 | data->setServer( serverLine->text() ); |
525 | data->setPort( portLine->text() ); | 539 | data->setPort( portLine->text() ); |
526 | data->setConnectionType( ComboBox1->currentItem() ); | 540 | data->setConnectionType( ComboBox1->currentItem() ); |
527 | data->setLogin( loginBox->isChecked() ); | 541 | data->setLogin( loginBox->isChecked() ); |
528 | data->setUser( userLine->text() ); | 542 | data->setUser( userLine->text() ); |
529 | data->setPassword( passLine->text() ); | 543 | data->setPassword( passLine->text() ); |
544 | data->setSigFile( SignaturEdit->text() ); | ||
530 | 545 | ||
531 | QDialog::accept(); | 546 | QDialog::accept(); |
532 | } | 547 | } |
533 | 548 | ||
534 | /** | 549 | /** |
535 | * NNTPconfig | 550 | * NNTPconfig |
536 | */ | 551 | */ |
537 | 552 | ||
538 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 553 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
539 | : NNTPconfigUI( parent, name, modal, flags ) | 554 | : NNTPconfigUI( parent, name, modal, flags ) |
540 | { | 555 | { |
541 | data = account; | 556 | data = account; |
542 | 557 | ||
543 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 558 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
544 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 559 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
545 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 560 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
546 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); | 561 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); |
547 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); | 562 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); |
548 | fillValues(); | 563 | fillValues(); |
549 | 564 | ||
550 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 565 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
551 | } | 566 | } |
552 | 567 | ||
553 | void NNTPconfig::slotShowSub() | 568 | void NNTPconfig::slotShowSub() |
554 | { | 569 | { |
555 | save(); | 570 | save(); |
556 | data->save(); | 571 | data->save(); |
557 | ListViewGroups->clear(); | 572 | ListViewGroups->clear(); |
558 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 573 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
559 | QCheckListItem *item; | 574 | QCheckListItem *item; |
560 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 575 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
561 | item->setOn( true ); | 576 | item->setOn( true ); |
562 | } | 577 | } |
563 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); | 578 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); |
564 | } | 579 | } |
565 | void NNTPconfig::slotShowFilter() | 580 | void NNTPconfig::slotShowFilter() |
566 | { | 581 | { |
567 | save(); | 582 | save(); |
568 | data->save(); | 583 | data->save(); |
569 | ListViewGroups->clear(); | 584 | ListViewGroups->clear(); |
570 | int count = 0; | 585 | int count = 0; |
571 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 586 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
572 | QCheckListItem *item; | 587 | QCheckListItem *item; |
573 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { | 588 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { |
574 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 589 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
575 | ++count; | 590 | ++count; |
576 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 591 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
577 | item->setOn( true ); | 592 | item->setOn( true ); |
578 | } | 593 | } |
579 | } | 594 | } |
580 | } | 595 | } |
581 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); | 596 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); |
582 | } | 597 | } |
583 | void NNTPconfig::slotGetNG() { | 598 | void NNTPconfig::slotGetNG() { |
584 | save(); | 599 | save(); |
585 | data->save(); | 600 | data->save(); |
586 | topLevelWidget()->setCaption( i18n("Fetching group list...")); | 601 | topLevelWidget()->setCaption( i18n("Fetching group list...")); |
587 | qApp->processEvents(); | 602 | qApp->processEvents(); |
588 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 603 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
589 | allGroups = tmp->listAllNewsgroups(); | 604 | allGroups = tmp->listAllNewsgroups(); |
590 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); | 605 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); |
591 | 606 | ||
592 | ListViewGroups->clear(); | 607 | ListViewGroups->clear(); |
593 | 608 | ||
594 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 609 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
595 | QCheckListItem *item; | 610 | QCheckListItem *item; |
596 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 611 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
597 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 612 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
598 | item->setOn( true ); | 613 | item->setOn( true ); |
599 | 614 | ||
600 | } | 615 | } |
601 | } | 616 | } |
602 | delete tmp; | 617 | delete tmp; |
603 | } | 618 | } |
604 | 619 | ||
605 | void NNTPconfig::slotSSL( bool enabled ) | 620 | void NNTPconfig::slotSSL( bool enabled ) |
606 | { | 621 | { |
607 | if ( enabled ) | 622 | if ( enabled ) |
608 | { | 623 | { |
609 | portLine->setText( NNTP_SSL_PORT ); | 624 | portLine->setText( NNTP_SSL_PORT ); |
610 | } | 625 | } |
611 | else | 626 | else |
612 | { | 627 | { |
613 | portLine->setText( NNTP_PORT ); | 628 | portLine->setText( NNTP_PORT ); |
614 | } | 629 | } |
615 | } | 630 | } |
616 | 631 | ||
617 | void NNTPconfig::fillValues() | 632 | void NNTPconfig::fillValues() |
618 | { | 633 | { |
619 | accountLine->setText( data->getAccountName() ); | 634 | accountLine->setText( data->getAccountName() ); |
620 | serverLine->setText( data->getServer() ); | 635 | serverLine->setText( data->getServer() ); |
621 | portLine->setText( data->getPort() ); | 636 | portLine->setText( data->getPort() ); |
622 | sslBox->setChecked( data->getSSL() ); | 637 | sslBox->setChecked( data->getSSL() ); |
623 | loginBox->setChecked( data->getLogin() ); | 638 | loginBox->setChecked( data->getLogin() ); |
624 | userLine->setText( data->getUser() ); | 639 | userLine->setText( data->getUser() ); |
625 | passLine->setText( data->getPassword() ); | 640 | passLine->setText( data->getPassword() ); |