-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 36 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 35 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.h | 2 |
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 | |||
@@ -11,8 +11,6 @@ | |||
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 | { |
@@ -503,23 +501,17 @@ 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 ) |
@@ -544,6 +536,12 @@ void NNTPconfig::fillValues() | |||
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() |
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 | |||
@@ -202,20 +202,29 @@ QList<Folder>* NNTPwrapper::listFolders() { | |||
202 | return folders; | 202 | return folders; |
203 | } | 203 | } |
204 | 204 | ||
205 | clist * NNTPwrapper::listAllNewsgroups() { | 205 | QStringList NNTPwrapper::listAllNewsgroups() { |
206 | login(); | 206 | login(); |
207 | QStringList res; | ||
207 | clist *result = 0; | 208 | clist *result = 0; |
208 | clistcell *current; | 209 | clistcell *current = 0; |
209 | newsnntp_group_description *list; | 210 | newsnntp_group_description *group; |
210 | if ( m_nntp ) { | 211 | |
211 | mailsession * session = m_nntp->sto_session; | 212 | if ( m_nntp ) { |
212 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; | 213 | mailsession * session = m_nntp->sto_session; |
213 | int err = newsnntp_list_newsgroups(news, NULL, &result); | 214 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; |
214 | 215 | int err = newsnntp_list_newsgroups(news, NULL, &result); | |
215 | if ( err == NEWSNNTP_NO_ERROR ) { | 216 | if ( err == NEWSNNTP_NO_ERROR && result) { |
216 | return result; | 217 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) { |
217 | } | 218 | group = ( newsnntp_group_description* ) current->data; |
218 | } | 219 | if (!group||!group->grp_name||strlen(group->grp_name)==0) continue; |
220 | res.append(group->grp_name); | ||
221 | } | ||
222 | } | ||
223 | } | ||
224 | if (result) { | ||
225 | clist_free(result); | ||
226 | } | ||
227 | return res; | ||
219 | } | 228 | } |
220 | 229 | ||
221 | void NNTPwrapper::answeredMail(const RecMail&) {} | 230 | void NNTPwrapper::answeredMail(const RecMail&) {} |
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 | |||
@@ -25,7 +25,7 @@ public: | |||
25 | virtual QList<Folder>* listFolders(); | 25 | virtual QList<Folder>* listFolders(); |
26 | /* mailbox will be ignored */ | 26 | /* mailbox will be ignored */ |
27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
28 | clist * listAllNewsgroups(); | 28 | QStringList listAllNewsgroups(); |
29 | virtual void deleteMail(const RecMail&mail); | 29 | virtual void deleteMail(const RecMail&mail); |
30 | virtual void answeredMail(const RecMail&mail); | 30 | virtual void answeredMail(const RecMail&mail); |
31 | virtual int deleteAllMail(const Folder*); | 31 | virtual int deleteAllMail(const Folder*); |