summaryrefslogtreecommitdiffabout
path: root/kmicromail/nntpgroups.cpp
authorzautrix <zautrix>2004-07-03 16:33:12 (UTC)
committer zautrix <zautrix>2004-07-03 16:33:12 (UTC)
commite3b89230f065c48c84b48c88edb6eb088374c487 (patch) (unidiff)
tree162ea2ef909a6f82ccfcedf45d80d6c821174912 /kmicromail/nntpgroups.cpp
parent2dd6ac0b2d24c91d35ce674a6c26351352df2b15 (diff)
downloadkdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.zip
kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.gz
kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.bz2
Initial revision
Diffstat (limited to 'kmicromail/nntpgroups.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/nntpgroups.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/kmicromail/nntpgroups.cpp b/kmicromail/nntpgroups.cpp
new file mode 100644
index 0000000..c729f79
--- a/dev/null
+++ b/kmicromail/nntpgroups.cpp
@@ -0,0 +1,62 @@
1#include "nntpgroups.h"
2
3#include <libmailwrapper/settings.h>
4#include <qlistview.h>
5#include <qlineedit.h>
6
7using namespace Opie::Core;
8
9NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl)
10 : NNTPGroupsUI(parent,name,fl),subscribedGroups()
11{
12 m_Account = account;
13 fillGroups();
14}
15
16NNTPGroups::~NNTPGroups()
17{
18
19}
20
21void NNTPGroups::slotGetNG()
22{
23 if (!m_Account) return;
24 GroupListView->clear();
25 NNTPwrapper tmp( m_Account );
26 QString filter = Groupfilteredit->text();
27 QStringList list = tmp.listAllNewsgroups(filter);
28 subscribedGroupsNotListed = subscribedGroups;
29 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
30 QCheckListItem *item;
31 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
32 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
33 item->setOn( true );
34 subscribedGroupsNotListed.remove((*it));
35 }
36 }
37}
38
39void NNTPGroups::fillGroups()
40{
41 if (!m_Account) return;
42 subscribedGroups = m_Account->getGroups();
43 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
44 QCheckListItem *item;
45 item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
46 item->setOn( true );
47 }
48}
49
50void NNTPGroups::storeValues()
51{
52 if (!m_Account) return;
53 QListViewItemIterator list_it( GroupListView );
54 subscribedGroups.clear();
55 for ( ; list_it.current(); ++list_it ) {
56 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
57 subscribedGroups.append( list_it.current()->text(0) );
58 }
59 }
60 subscribedGroups+=subscribedGroupsNotListed;
61 m_Account->setGroups( subscribedGroups );
62}