summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/nntpgroups.cpp7
-rw-r--r--noncore/net/mail/nntpgroups.h2
-rw-r--r--noncore/net/mail/nntpgroupsui.ui49
3 files changed, 52 insertions, 6 deletions
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp
index 97b1985..8741c4b 100644
--- a/noncore/net/mail/nntpgroups.cpp
+++ b/noncore/net/mail/nntpgroups.cpp
@@ -1,57 +1,62 @@
#include "nntpgroups.h"
#include <libmailwrapper/settings.h>
#include <qlistview.h>
+#include <qlineedit.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();
+ 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() ) {
qDebug(list_it.current()->text(0) );
subscribedGroups.append( list_it.current()->text(0) );
}
}
+ subscribedGroups+=subscribedGroupsNotListed;
m_Account->setGroups( subscribedGroups );
}
diff --git a/noncore/net/mail/nntpgroups.h b/noncore/net/mail/nntpgroups.h
index 8cc2e8b..e5b7c35 100644
--- a/noncore/net/mail/nntpgroups.h
+++ b/noncore/net/mail/nntpgroups.h
@@ -1,33 +1,33 @@
#ifndef __NNTPGROUPS_WINDOW__
#define __NNTPGROUPS_WINDOW__
#include "nntpgroupsui.h"
#include <libmailwrapper/nntpwrapper.h>
class NNTPaccount;
class QStringList;
class NNTPGroups:public NNTPGroupsUI
{
Q_OBJECT
public:
NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
virtual ~NNTPGroups();
/* must be called from external.
* it will store the new subscription list into the account
* but don't save them, this must be done by the calling class.
*/
void storeValues();
protected slots:
virtual void slotGetNG();
protected:
virtual void fillGroups();
NNTPaccount*m_Account;
- QStringList subscribedGroups;
+ QStringList subscribedGroups,subscribedGroupsNotListed;
};
#endif
diff --git a/noncore/net/mail/nntpgroupsui.ui b/noncore/net/mail/nntpgroupsui.ui
index 93f487b..2902731 100644
--- a/noncore/net/mail/nntpgroupsui.ui
+++ b/noncore/net/mail/nntpgroupsui.ui
@@ -1,88 +1,129 @@
<!DOCTYPE UI><UI>
<class>NNTPGroupsUI</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>NNTPGroupsUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>356</width>
- <height>406</height>
+ <width>254</width>
+ <height>330</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>newsgroupslist</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>2</number>
+ <number>1</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>2</number>
+ <number>1</number>
</property>
<widget>
<class>QListView</class>
<column>
<property>
<name>text</name>
<string>Newsgroups</string>
</property>
<property>
<name>clickable</name>
<bool>true</bool>
</property>
<property>
<name>resizeable</name>
<bool>true</bool>
</property>
</column>
<property stdset="1">
<name>name</name>
<cstring>GroupListView</cstring>
</property>
<property>
<name>whatsThis</name>
<string>List of groups from the server. On start, only subscribed groups are listed.</string>
</property>
</widget>
<widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>filterlabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Groupfilter:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Groupfilteredit</cstring>
+ </property>
+ <property>
+ <name>whatsThis</name>
+ <string>Enter a filter string here.
+Then hit "get newsgroup list" again and only groups starting
+with that filter will be listet.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>GetNGButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Get newsgroup list from server</string>
</property>
<property>
<name>whatsThis</name>
<string>Retrieve the list of groups from server</string>
</property>
</widget>
</vbox>
</widget>
<connections>
<connection>
<sender>GetNGButton</sender>
<signal>clicked()</signal>
<receiver>NNTPGroupsUI</receiver>
<slot>slotGetNG()</slot>
</connection>
<slot access="protected">slotGetNG()</slot>
</connections>
</UI>