blob: c729f79699edd9089d75c48a5702462ff7d96fa5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#include "nntpgroups.h"
#include <libmailwrapper/settings.h>
#include <qlistview.h>
#include <qlineedit.h>
using namespace Opie::Core;
NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl)
: NNTPGroupsUI(parent,name,fl),subscribedGroups()
{
m_Account = account;
fillGroups();
}
NNTPGroups::~NNTPGroups()
{
}
void NNTPGroups::slotGetNG()
{
if (!m_Account) return;
GroupListView->clear();
NNTPwrapper tmp( m_Account );
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));
}
}
}
void NNTPGroups::fillGroups()
{
if (!m_Account) return;
subscribedGroups = m_Account->getGroups();
for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
QCheckListItem *item;
item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
item->setOn( true );
}
}
void NNTPGroups::storeValues()
{
if (!m_Account) return;
QListViewItemIterator list_it( GroupListView );
subscribedGroups.clear();
for ( ; list_it.current(); ++list_it ) {
if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
subscribedGroups.append( list_it.current()->text(0) );
}
}
subscribedGroups+=subscribedGroupsNotListed;
m_Account->setGroups( subscribedGroups );
}
|