Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index b8aad11..28d531b 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -2,26 +2,24 @@ | |||
2 | #include "defines.h" | 2 | #include "defines.h" |
3 | #include "editaccounts.h" | 3 | #include "editaccounts.h" |
4 | 4 | ||
5 | /* OPIE */ | 5 | /* OPIE */ |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qt.h> | 9 | #include <qt.h> |
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | 11 | ||
12 | #include <libmailwrapper/nntpwrapper.h> | 12 | #include <libmailwrapper/nntpwrapper.h> |
13 | 13 | ||
14 | #include <libetpan/nntpdriver.h> | ||
15 | |||
16 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 14 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
17 | : QListViewItem( parent ) | 15 | : QListViewItem( parent ) |
18 | { | 16 | { |
19 | account = a; | 17 | account = a; |
20 | setText( 0, account->getAccountName() ); | 18 | setText( 0, account->getAccountName() ); |
21 | setText( 1, account->getType() ); | 19 | setText( 1, account->getType() ); |
22 | } | 20 | } |
23 | 21 | ||
24 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 22 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
25 | : EditAccountsUI( parent, name, modal, flags ) | 23 | : EditAccountsUI( parent, name, modal, flags ) |
26 | { | 24 | { |
27 | qDebug( "New Account Configuration Widget" ); | 25 | qDebug( "New Account Configuration Widget" ); |
@@ -494,65 +492,65 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, | |||
494 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 492 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
495 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 493 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
496 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 494 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
497 | fillValues(); | 495 | fillValues(); |
498 | 496 | ||
499 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 497 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
500 | } | 498 | } |
501 | 499 | ||
502 | void NNTPconfig::slotGetNG() { | 500 | void NNTPconfig::slotGetNG() { |
503 | save(); | 501 | save(); |
504 | data->save(); | 502 | data->save(); |
505 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 503 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
506 | clist* list = tmp->listAllNewsgroups(); | 504 | QStringList list = tmp->listAllNewsgroups(); |
507 | 505 | ||
508 | clistcell *current; | 506 | ListViewGroups->clear(); |
509 | newsnntp_group_description *group; | 507 | |
510 | 508 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | |
511 | // FIXME - test if not empty | 509 | QCheckListItem *item; |
512 | current = list->first; | 510 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
513 | for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) { | 511 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
514 | group = ( newsnntp_group_description* ) current->data; | 512 | item->setOn( true ); |
515 | // qDebug( group->grp_name ); | 513 | } |
516 | 514 | } | |
517 | QCheckListItem *item; | ||
518 | item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); | ||
519 | if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) { | ||
520 | item->setOn( true ); | ||
521 | } | ||
522 | } | ||
523 | } | 515 | } |
524 | 516 | ||
525 | void NNTPconfig::slotSSL( bool enabled ) | 517 | void NNTPconfig::slotSSL( bool enabled ) |
526 | { | 518 | { |
527 | if ( enabled ) | 519 | if ( enabled ) |
528 | { | 520 | { |
529 | portLine->setText( NNTP_SSL_PORT ); | 521 | portLine->setText( NNTP_SSL_PORT ); |
530 | } | 522 | } |
531 | else | 523 | else |
532 | { | 524 | { |
533 | portLine->setText( NNTP_PORT ); | 525 | portLine->setText( NNTP_PORT ); |
534 | } | 526 | } |
535 | } | 527 | } |
536 | 528 | ||
537 | void NNTPconfig::fillValues() | 529 | void NNTPconfig::fillValues() |
538 | { | 530 | { |
539 | accountLine->setText( data->getAccountName() ); | 531 | accountLine->setText( data->getAccountName() ); |
540 | serverLine->setText( data->getServer() ); | 532 | serverLine->setText( data->getServer() ); |
541 | portLine->setText( data->getPort() ); | 533 | portLine->setText( data->getPort() ); |
542 | sslBox->setChecked( data->getSSL() ); | 534 | sslBox->setChecked( data->getSSL() ); |
543 | loginBox->setChecked( data->getLogin() ); | 535 | loginBox->setChecked( data->getLogin() ); |
544 | userLine->setText( data->getUser() ); | 536 | userLine->setText( data->getUser() ); |
545 | passLine->setText( data->getPassword() ); | 537 | passLine->setText( data->getPassword() ); |
546 | subscribedGroups = data->getGroups(); | 538 | subscribedGroups = data->getGroups(); |
539 | /* don't forget that - you will overwrite values if user clicks cancel! */ | ||
540 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | ||
541 | QCheckListItem *item; | ||
542 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | ||
543 | item->setOn( true ); | ||
544 | } | ||
547 | } | 545 | } |
548 | 546 | ||
549 | void NNTPconfig::save() | 547 | void NNTPconfig::save() |
550 | { | 548 | { |
551 | data->setAccountName( accountLine->text() ); | 549 | data->setAccountName( accountLine->text() ); |
552 | data->setServer( serverLine->text() ); | 550 | data->setServer( serverLine->text() ); |
553 | data->setPort( portLine->text() ); | 551 | data->setPort( portLine->text() ); |
554 | data->setSSL( sslBox->isChecked() ); | 552 | data->setSSL( sslBox->isChecked() ); |
555 | data->setLogin( loginBox->isChecked() ); | 553 | data->setLogin( loginBox->isChecked() ); |
556 | data->setUser( userLine->text() ); | 554 | data->setUser( userLine->text() ); |
557 | data->setPassword( passLine->text() ); | 555 | data->setPassword( passLine->text() ); |
558 | 556 | ||