From e1c0bbc4fafe709ceed8f4a046c4bff7d4ba30ff Mon Sep 17 00:00:00 2001 From: alwin Date: Sun, 07 Mar 2004 02:18:47 +0000 Subject: filter for newsgroups works ToDo: we should cache the list of newsgroups! --- (limited to 'noncore/net/mail') 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 @@ -3,6 +3,7 @@ #include #include +#include NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl) : NNTPGroupsUI(parent,name,fl),subscribedGroups() @@ -21,12 +22,15 @@ void NNTPGroups::slotGetNG() if (!m_Account) return; GroupListView->clear(); NNTPwrapper tmp( m_Account ); - QStringList list = tmp.listAllNewsgroups(); + QString filter = Groupfilteredit->text(); + QStringList list = tmp.listAllNewsgroups(filter); + subscribedGroupsNotListed = subscribedGroups; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); + subscribedGroupsNotListed.remove((*it)); } } } @@ -53,5 +57,6 @@ void NNTPGroups::storeValues() subscribedGroups.append( list_it.current()->text(0) ); } } + subscribedGroups+=subscribedGroupsNotListed; m_Account->setGroups( subscribedGroups ); } diff --git a/noncore/net/mail/nntpgroups.h b/noncore/net/mail/nntpgroups.h index 8cc2e8b..e5b7c35 100644 --- a/noncore/net/mail/nntpgroups.h +++ b/noncore/net/mail/nntpgroups.h @@ -27,7 +27,7 @@ protected: virtual void fillGroups(); NNTPaccount*m_Account; - QStringList subscribedGroups; + QStringList subscribedGroups,subscribedGroupsNotListed; }; #endif diff --git a/noncore/net/mail/nntpgroupsui.ui b/noncore/net/mail/nntpgroupsui.ui index 93f487b..2902731 100644 --- a/noncore/net/mail/nntpgroupsui.ui +++ b/noncore/net/mail/nntpgroupsui.ui @@ -11,8 +11,8 @@ 0 0 - 356 - 406 + 254 + 330 @@ -28,11 +28,11 @@ margin - 2 + 1 spacing - 2 + 1 QListView @@ -60,6 +60,47 @@ + QLayoutWidget + + name + Layout1 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + filterlabel + + + text + Groupfilter: + + + + QLineEdit + + name + Groupfilteredit + + + whatsThis + Enter a filter string here. +Then hit "get newsgroup list" again and only groups starting +with that filter will be listet. + + + + + QPushButton name -- cgit v0.9.0.2