-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 4 |
4 files changed, 19 insertions, 4 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 @@ -6,8 +6,9 @@ #include <qpe/qpeapplication.h> /* QT */ #include <qt.h> +#include <qstringlist.h> #include <libmailwrapper/nntpwrapper.h> #include <libetpan/nntpdriver.h> @@ -510,12 +511,15 @@ void NNTPconfig::slotGetNG() { // 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 ); + 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 ) @@ -538,8 +542,9 @@ void NNTPconfig::fillValues() sslBox->setChecked( data->getSSL() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); + subscribedGroups = data->getGroups(); } void NNTPconfig::save() { @@ -552,11 +557,14 @@ void NNTPconfig::save() 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) ); + qDebug(list_it.current()->text(0) ); + groupList.append( list_it.current()->text(0) ); } + data->setGroups( groupList ); } } void NNTPconfig::accept() 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 @@ -142,8 +142,9 @@ protected slots: 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 @@ -409,8 +409,9 @@ void NNTPaccount::read() 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() @@ -426,8 +427,9 @@ void NNTPaccount::save() conf->writeEntry( "SSL", ssl ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); + conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); conf->write(); delete conf; } 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 @@ -125,11 +125,15 @@ public: 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 |