author | alwin <alwin> | 2004-03-06 12:36:55 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-06 12:36:55 (UTC) |
commit | a66fd5afde517e9a61e74fc17df617297f134c96 (patch) (side-by-side diff) | |
tree | 7bb9819c087516f6b0f3399bdec6d5ce225201e5 /noncore/net/mail/nntpgroups.cpp | |
parent | 5b49d47174925c1e2415641b77269b753688f5f1 (diff) | |
download | opie-a66fd5afde517e9a61e74fc17df617297f134c96.zip opie-a66fd5afde517e9a61e74fc17df617297f134c96.tar.gz opie-a66fd5afde517e9a61e74fc17df617297f134c96.tar.bz2 |
standalone dlg for (un-)subscribing newsgroups.
May be integrated into the standard nntp-settings-dialog, too.
Diffstat (limited to 'noncore/net/mail/nntpgroups.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/nntpgroups.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp new file mode 100644 index 0000000..97b1985 --- a/dev/null +++ b/noncore/net/mail/nntpgroups.cpp @@ -0,0 +1,57 @@ +#include "nntpgroups.h" + +#include <libmailwrapper/settings.h> + +#include <qlistview.h> + +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 ); + QStringList list = tmp.listAllNewsgroups(); + 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 ); + } + } +} + +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() ) { + qDebug(list_it.current()->text(0) ); + subscribedGroups.append( list_it.current()->text(0) ); + } + } + m_Account->setGroups( subscribedGroups ); +} |