summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-07 02:18:47 (UTC)
committer alwin <alwin>2004-03-07 02:18:47 (UTC)
commite1c0bbc4fafe709ceed8f4a046c4bff7d4ba30ff (patch) (unidiff)
tree5c7bc290c2f2e262749c93023a4a5c2b7249bd92
parentdf4f3107d45976d9276ef96df4683822cf05d38c (diff)
downloadopie-e1c0bbc4fafe709ceed8f4a046c4bff7d4ba30ff.zip
opie-e1c0bbc4fafe709ceed8f4a046c4bff7d4ba30ff.tar.gz
opie-e1c0bbc4fafe709ceed8f4a046c4bff7d4ba30ff.tar.bz2
filter for newsgroups works
ToDo: we should cache the list of newsgroups!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/nntpgroups.cpp7
-rw-r--r--noncore/net/mail/nntpgroups.h2
-rw-r--r--noncore/net/mail/nntpgroupsui.ui49
3 files changed, 52 insertions, 6 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
@@ -3,6 +3,7 @@
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()
@@ -21,12 +22,15 @@ void NNTPGroups::slotGetNG()
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}
@@ -53,5 +57,6 @@ void NNTPGroups::storeValues()
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}
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:
27 virtual void fillGroups(); 27 virtual void fillGroups();
28 28
29 NNTPaccount*m_Account; 29 NNTPaccount*m_Account;
30 QStringList subscribedGroups; 30 QStringList subscribedGroups,subscribedGroupsNotListed;
31}; 31};
32 32
33#endif 33#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 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>356</width> 14 <width>254</width>
15 <height>406</height> 15 <height>330</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
@@ -28,11 +28,11 @@
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>2</number> 31 <number>1</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>1</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QListView</class> 38 <class>QListView</class>
@@ -60,6 +60,47 @@
60 </property> 60 </property>
61 </widget> 61 </widget>
62 <widget> 62 <widget>
63 <class>QLayoutWidget</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>Layout1</cstring>
67 </property>
68 <hbox>
69 <property stdset="1">
70 <name>margin</name>
71 <number>0</number>
72 </property>
73 <property stdset="1">
74 <name>spacing</name>
75 <number>6</number>
76 </property>
77 <widget>
78 <class>QLabel</class>
79 <property stdset="1">
80 <name>name</name>
81 <cstring>filterlabel</cstring>
82 </property>
83 <property stdset="1">
84 <name>text</name>
85 <string>Groupfilter:</string>
86 </property>
87 </widget>
88 <widget>
89 <class>QLineEdit</class>
90 <property stdset="1">
91 <name>name</name>
92 <cstring>Groupfilteredit</cstring>
93 </property>
94 <property>
95 <name>whatsThis</name>
96 <string>Enter a filter string here.
97Then hit "get newsgroup list" again and only groups starting
98with that filter will be listet.</string>
99 </property>
100 </widget>
101 </hbox>
102 </widget>
103 <widget>
63 <class>QPushButton</class> 104 <class>QPushButton</class>
64 <property stdset="1"> 105 <property stdset="1">
65 <name>name</name> 106 <name>name</name>