summaryrefslogtreecommitdiff
path: root/noncore/net/mail/editaccounts.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp36
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
@@ -8,14 +8,12 @@
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
16AccountListItem::AccountListItem( QListView *parent, Account *a) 14AccountListItem::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() );
@@ -500,29 +498,23 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
500} 498}
501 499
502void NNTPconfig::slotGetNG() { 500void 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
525void NNTPconfig::slotSSL( bool enabled ) 517void NNTPconfig::slotSSL( bool enabled )
526{ 518{
527 if ( enabled ) 519 if ( enabled )
528 { 520 {
@@ -541,12 +533,18 @@ void NNTPconfig::fillValues()
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
549void NNTPconfig::save() 547void NNTPconfig::save()
550{ 548{
551 data->setAccountName( accountLine->text() ); 549 data->setAccountName( accountLine->text() );
552 data->setServer( serverLine->text() ); 550 data->setServer( serverLine->text() );