summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp36
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp35
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h2
3 files changed, 40 insertions, 33 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
@@ -13,4 +13,2 @@
-#include <libetpan/nntpdriver.h>
-
AccountListItem::AccountListItem( QListView *parent, Account *a)
@@ -505,19 +503,13 @@ void NNTPconfig::slotGetNG() {
NNTPwrapper* tmp = new NNTPwrapper( data );
- clist* list = tmp->listAllNewsgroups();
-
- clistcell *current;
- newsnntp_group_description *group;
-
- // 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 );
-
- QCheckListItem *item;
- item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox );
- if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) {
- item->setOn( true );
- }
- }
+ QStringList list = tmp->listAllNewsgroups();
+
+ ListViewGroups->clear();
+
+ for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ QCheckListItem *item;
+ item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ if ( subscribedGroups.contains( (*it) ) >= 1 ) {
+ item->setOn( true );
+ }
+ }
}
@@ -546,2 +538,8 @@ void NNTPconfig::fillValues()
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 );
+ }
}
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index 798879d..a766a59 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -204,16 +204,25 @@ QList<Folder>* NNTPwrapper::listFolders() {
- clist * NNTPwrapper::listAllNewsgroups() {
- login();
+QStringList NNTPwrapper::listAllNewsgroups() {
+ login();
+ QStringList res;
clist *result = 0;
- clistcell *current;
- newsnntp_group_description *list;
- if ( m_nntp ) {
- mailsession * session = m_nntp->sto_session;
- newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
- int err = newsnntp_list_newsgroups(news, NULL, &result);
-
- if ( err == NEWSNNTP_NO_ERROR ) {
- return result;
- }
- }
+ clistcell *current = 0;
+ newsnntp_group_description *group;
+
+ if ( m_nntp ) {
+ mailsession * session = m_nntp->sto_session;
+ newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
+ int err = newsnntp_list_newsgroups(news, NULL, &result);
+ if ( err == NEWSNNTP_NO_ERROR && result) {
+ for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) {
+ group = ( newsnntp_group_description* ) current->data;
+ if (!group||!group->grp_name||strlen(group->grp_name)==0) continue;
+ res.append(group->grp_name);
+ }
+ }
+ }
+ if (result) {
+ clist_free(result);
+ }
+ return res;
}
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h
index e8e2cf4..4d03754 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h
@@ -27,3 +27,3 @@ public:
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
- clist * listAllNewsgroups();
+ QStringList listAllNewsgroups();
virtual void deleteMail(const RecMail&mail);