summaryrefslogtreecommitdiff
path: root/noncore/net/mail/editaccounts.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/editaccounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp24
1 files changed, 11 insertions, 13 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 @@
/* QT */
#include <qt.h>
#include <qstringlist.h>
#include <libmailwrapper/nntpwrapper.h>
-#include <libetpan/nntpdriver.h>
-
AccountListItem::AccountListItem( QListView *parent, Account *a)
: QListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
setText( 1, account->getType() );
@@ -500,26 +498,20 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
}
void NNTPconfig::slotGetNG() {
save();
data->save();
NNTPwrapper* tmp = new NNTPwrapper( data );
- clist* list = tmp->listAllNewsgroups();
-
- clistcell *current;
- newsnntp_group_description *group;
+ QStringList list = tmp->listAllNewsgroups();
- // FIXME - test if not empty
- current = list->first;
- for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) {
- group = ( newsnntp_group_description* ) current->data;
- // qDebug( group->grp_name );
+ ListViewGroups->clear();
+ for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
QCheckListItem *item;
- item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox );
- if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) {
+ item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ if ( subscribedGroups.contains( (*it) ) >= 1 ) {
item->setOn( true );
}
}
}
void NNTPconfig::slotSSL( bool enabled )
@@ -541,12 +533,18 @@ void NNTPconfig::fillValues()
portLine->setText( data->getPort() );
sslBox->setChecked( data->getSSL() );
loginBox->setChecked( data->getLogin() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
subscribedGroups = data->getGroups();
+ /* don't forget that - you will overwrite values if user clicks cancel! */
+ for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
+ QCheckListItem *item;
+ item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ item->setOn( true );
+ }
}
void NNTPconfig::save()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );