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) (side-by-side diff)
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 @@
+#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 );
+}