summaryrefslogtreecommitdiff
path: root/noncore
authorharlekin <harlekin>2004-03-06 00:20:22 (UTC)
committer harlekin <harlekin>2004-03-06 00:20:22 (UTC)
commit7b10be8e0ed88afe9e8964e6b5f1fe449cee3609 (patch) (side-by-side diff)
tree149f8aecef57768cd4cf9e0c35778a711c5b6cf4 /noncore
parent6afcd375a640d5c6888bc111cd1d80a08f554136 (diff)
downloadopie-7b10be8e0ed88afe9e8964e6b5f1fe449cee3609.zip
opie-7b10be8e0ed88afe9e8964e6b5f1fe449cee3609.tar.gz
opie-7b10be8e0ed88afe9e8964e6b5f1fe449cee3609.tar.bz2
save selected newsgroups
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp10
-rw-r--r--noncore/net/mail/editaccounts.h1
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h4
4 files changed, 16 insertions, 1 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 2a1acc0..215380d 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -4,12 +4,13 @@
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qt.h>
+#include <qstringlist.h>
#include <libmailwrapper/nntpwrapper.h>
#include <libetpan/nntpdriver.h>
AccountListItem::AccountListItem( QListView *parent, Account *a)
@@ -508,16 +509,19 @@ void NNTPconfig::slotGetNG() {
newsnntp_group_description *group;
// FIXME - test if not empty
current = list->first;
for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) {
group = ( newsnntp_group_description* ) current->data;
- qDebug( group->grp_name );
+ // qDebug( group->grp_name );
QCheckListItem *item;
item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox );
+ if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) {
+ item->setSelected( true );
+ }
}
}
void NNTPconfig::slotSSL( bool enabled )
{
if ( enabled )
@@ -536,12 +540,13 @@ void NNTPconfig::fillValues()
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
sslBox->setChecked( data->getSSL() );
loginBox->setChecked( data->getLogin() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
+ subscribedGroups = data->getGroups();
}
void NNTPconfig::save()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
@@ -550,15 +555,18 @@ void NNTPconfig::save()
data->setLogin( loginBox->isChecked() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
QListViewItemIterator list_it( ListViewGroups );
for ( ; list_it.current(); ++list_it ) {
+ QStringList groupList;
if ( list_it.current()->isSelected() ) {
qDebug( list_it.current()->text(0) );
+ groupList.append( list_it.current()->text(0) );
}
+ data->setGroups( groupList );
}
}
void NNTPconfig::accept()
{
save();
diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h
index 438a984..a9eb19f 100644
--- a/noncore/net/mail/editaccounts.h
+++ b/noncore/net/mail/editaccounts.h
@@ -140,12 +140,13 @@ public slots:
protected slots:
void slotSSL( bool enabled );
void accept();
void slotGetNG();
private:
+ QStringList subscribedGroups;
void save();
NNTPaccount *data;
clist* list;
};
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 65ca387..f64c17d 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -407,12 +407,13 @@ void NNTPaccount::read()
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
+ subscribedGroups = conf->readListEntry( "Subscribed", ',' );
delete conf;
}
void NNTPaccount::save()
{
qDebug( "saving " + getFileName() );
@@ -424,12 +425,13 @@ void NNTPaccount::save()
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
+ conf->writeEntry( "Subscribed" , subscribedGroups, ',' );
conf->write();
delete conf;
}
QString NNTPaccount::getFileName()
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index 8d7df92..1feedbf 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -123,15 +123,19 @@ public:
virtual void save();
virtual QString getFileName();
void setLogin( bool b ) { login = b; }
bool getLogin() { return login; }
+ void setGroups( QStringList list ) { subscribedGroups = list; }
+ QStringList getGroups() { return subscribedGroups; }
+
private:
QString file;
bool login;
+ QStringList subscribedGroups;
};
class Settings : public QObject
{
Q_OBJECT