summaryrefslogtreecommitdiff
path: root/noncore/net/mail/nntpgroups.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/nntpgroups.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/nntpgroups.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp
index 97b1985..8741c4b 100644
--- a/noncore/net/mail/nntpgroups.cpp
+++ b/noncore/net/mail/nntpgroups.cpp
@@ -1,41 +1,45 @@
1#include "nntpgroups.h" 1#include "nntpgroups.h"
2 2
3#include <libmailwrapper/settings.h> 3#include <libmailwrapper/settings.h>
4 4
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qlineedit.h>
6 7
7NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl) 8NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl)
8 : NNTPGroupsUI(parent,name,fl),subscribedGroups() 9 : NNTPGroupsUI(parent,name,fl),subscribedGroups()
9{ 10{
10 m_Account = account; 11 m_Account = account;
11 fillGroups(); 12 fillGroups();
12} 13}
13 14
14NNTPGroups::~NNTPGroups() 15NNTPGroups::~NNTPGroups()
15{ 16{
16 17
17} 18}
18 19
19void NNTPGroups::slotGetNG() 20void NNTPGroups::slotGetNG()
20{ 21{
21 if (!m_Account) return; 22 if (!m_Account) return;
22 GroupListView->clear(); 23 GroupListView->clear();
23 NNTPwrapper tmp( m_Account ); 24 NNTPwrapper tmp( m_Account );
24 QStringList list = tmp.listAllNewsgroups(); 25 QString filter = Groupfilteredit->text();
26 QStringList list = tmp.listAllNewsgroups(filter);
27 subscribedGroupsNotListed = subscribedGroups;
25 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 28 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
26 QCheckListItem *item; 29 QCheckListItem *item;
27 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); 30 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
28 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 31 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
29 item->setOn( true ); 32 item->setOn( true );
33 subscribedGroupsNotListed.remove((*it));
30 } 34 }
31 } 35 }
32} 36}
33 37
34void NNTPGroups::fillGroups() 38void NNTPGroups::fillGroups()
35{ 39{
36 if (!m_Account) return; 40 if (!m_Account) return;
37 subscribedGroups = m_Account->getGroups(); 41 subscribedGroups = m_Account->getGroups();
38 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 42 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
39 QCheckListItem *item; 43 QCheckListItem *item;
40 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); 44 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
41 item->setOn( true ); 45 item->setOn( true );
@@ -44,14 +48,15 @@ void NNTPGroups::fillGroups()
44 48
45void NNTPGroups::storeValues() 49void NNTPGroups::storeValues()
46{ 50{
47 if (!m_Account) return; 51 if (!m_Account) return;
48 QListViewItemIterator list_it( GroupListView ); 52 QListViewItemIterator list_it( GroupListView );
49 subscribedGroups.clear(); 53 subscribedGroups.clear();
50 for ( ; list_it.current(); ++list_it ) { 54 for ( ; list_it.current(); ++list_it ) {
51 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 55 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
52 qDebug(list_it.current()->text(0) ); 56 qDebug(list_it.current()->text(0) );
53 subscribedGroups.append( list_it.current()->text(0) ); 57 subscribedGroups.append( list_it.current()->text(0) );
54 } 58 }
55 } 59 }
60 subscribedGroups+=subscribedGroupsNotListed;
56 m_Account->setGroups( subscribedGroups ); 61 m_Account->setGroups( subscribedGroups );
57} 62}