summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -1,25 +1,26 @@
#include "defines.h"
#include "editaccounts.h"
/* 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)
: QListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
setText( 1, account->getType() );
}
EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
{
@@ -498,70 +499,77 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
}
void NNTPconfig::slotGetNG() {
save();
data->save();
NNTPwrapper* tmp = new NNTPwrapper( data );
clist* list = tmp->listAllNewsgroups();
clistcell *current;
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 )
{
portLine->setText( NNTP_SSL_PORT );
}
else
{
portLine->setText( NNTP_PORT );
}
}
void NNTPconfig::fillValues()
{
accountLine->setText( data->getAccountName() );
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() );
data->setPort( portLine->text() );
data->setSSL( sslBox->isChecked() );
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();
QDialog::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
@@ -130,23 +130,24 @@ private:
class NNTPconfig : public NNTPconfigUI
{
Q_OBJECT
public:
NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
public slots:
void fillValues();
protected slots:
void slotSSL( bool enabled );
void accept();
void slotGetNG();
private:
+ QStringList subscribedGroups;
void save();
NNTPaccount *data;
clist* list;
};
#endif
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
@@ -397,43 +397,45 @@ QString NNTPaccount::getUniqueFileName()
} while ( imap.contains( "nntp-" + unique ) > 0 );
return unique;
}
void NNTPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
accountName = conf->readEntry( "Account" );
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() );
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
conf->writeEntry( "Account", accountName );
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()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file;
}
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
@@ -113,35 +113,39 @@ private:
class NNTPaccount : public Account
{
public:
NNTPaccount();
NNTPaccount( QString filename );
static QString getUniqueFileName();
virtual void read();
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
public:
Settings();
QList<Account> getAccounts();
void addAccount(Account *account);
void delAccount(Account *account);
void saveAccounts();
void readAccounts();
static void checkDirectory();