author | zautrix <zautrix> | 2004-07-03 16:33:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 16:33:12 (UTC) |
commit | e3b89230f065c48c84b48c88edb6eb088374c487 (patch) (unidiff) | |
tree | 162ea2ef909a6f82ccfcedf45d80d6c821174912 /kmicromail/nntpgroups.cpp | |
parent | 2dd6ac0b2d24c91d35ce674a6c26351352df2b15 (diff) | |
download | kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.zip kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.gz kdepimpi-e3b89230f065c48c84b48c88edb6eb088374c487.tar.bz2 |
Initial revision
-rw-r--r-- | kmicromail/nntpgroups.cpp | 62 |
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 | |||
7 | using namespace Opie::Core; | ||
8 | |||
9 | NNTPGroups::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 | |||
16 | NNTPGroups::~NNTPGroups() | ||
17 | { | ||
18 | |||
19 | } | ||
20 | |||
21 | void 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 | |||
39 | void 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 | |||
50 | void 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 | } | ||