author | harlekin <harlekin> | 2004-03-06 00:20:22 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-03-06 00:20:22 (UTC) |
commit | 7b10be8e0ed88afe9e8964e6b5f1fe449cee3609 (patch) (unidiff) | |
tree | 149f8aecef57768cd4cf9e0c35778a711c5b6cf4 | |
parent | 6afcd375a640d5c6888bc111cd1d80a08f554136 (diff) | |
download | opie-7b10be8e0ed88afe9e8964e6b5f1fe449cee3609.zip opie-7b10be8e0ed88afe9e8964e6b5f1fe449cee3609.tar.gz opie-7b10be8e0ed88afe9e8964e6b5f1fe449cee3609.tar.bz2 |
save selected newsgroups
-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 | |||
@@ -4,12 +4,13 @@ | |||
4 | 4 | ||
5 | /* OPIE */ | 5 | /* OPIE */ |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qt.h> | 9 | #include <qt.h> |
10 | #include <qstringlist.h> | ||
10 | 11 | ||
11 | #include <libmailwrapper/nntpwrapper.h> | 12 | #include <libmailwrapper/nntpwrapper.h> |
12 | 13 | ||
13 | #include <libetpan/nntpdriver.h> | 14 | #include <libetpan/nntpdriver.h> |
14 | 15 | ||
15 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 16 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
@@ -508,16 +509,19 @@ void NNTPconfig::slotGetNG() { | |||
508 | newsnntp_group_description *group; | 509 | newsnntp_group_description *group; |
509 | 510 | ||
510 | // FIXME - test if not empty | 511 | // FIXME - test if not empty |
511 | current = list->first; | 512 | current = list->first; |
512 | for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) { | 513 | for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) { |
513 | group = ( newsnntp_group_description* ) current->data; | 514 | group = ( newsnntp_group_description* ) current->data; |
514 | qDebug( group->grp_name ); | 515 | // qDebug( group->grp_name ); |
515 | 516 | ||
516 | QCheckListItem *item; | 517 | QCheckListItem *item; |
517 | item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); | 518 | item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); |
519 | if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) { | ||
520 | item->setSelected( true ); | ||
521 | } | ||
518 | } | 522 | } |
519 | } | 523 | } |
520 | 524 | ||
521 | void NNTPconfig::slotSSL( bool enabled ) | 525 | void NNTPconfig::slotSSL( bool enabled ) |
522 | { | 526 | { |
523 | if ( enabled ) | 527 | if ( enabled ) |
@@ -536,12 +540,13 @@ void NNTPconfig::fillValues() | |||
536 | serverLine->setText( data->getServer() ); | 540 | serverLine->setText( data->getServer() ); |
537 | portLine->setText( data->getPort() ); | 541 | portLine->setText( data->getPort() ); |
538 | sslBox->setChecked( data->getSSL() ); | 542 | sslBox->setChecked( data->getSSL() ); |
539 | loginBox->setChecked( data->getLogin() ); | 543 | loginBox->setChecked( data->getLogin() ); |
540 | userLine->setText( data->getUser() ); | 544 | userLine->setText( data->getUser() ); |
541 | passLine->setText( data->getPassword() ); | 545 | passLine->setText( data->getPassword() ); |
546 | subscribedGroups = data->getGroups(); | ||
542 | } | 547 | } |
543 | 548 | ||
544 | void NNTPconfig::save() | 549 | void NNTPconfig::save() |
545 | { | 550 | { |
546 | data->setAccountName( accountLine->text() ); | 551 | data->setAccountName( accountLine->text() ); |
547 | data->setServer( serverLine->text() ); | 552 | data->setServer( serverLine->text() ); |
@@ -550,15 +555,18 @@ void NNTPconfig::save() | |||
550 | data->setLogin( loginBox->isChecked() ); | 555 | data->setLogin( loginBox->isChecked() ); |
551 | data->setUser( userLine->text() ); | 556 | data->setUser( userLine->text() ); |
552 | data->setPassword( passLine->text() ); | 557 | data->setPassword( passLine->text() ); |
553 | 558 | ||
554 | QListViewItemIterator list_it( ListViewGroups ); | 559 | QListViewItemIterator list_it( ListViewGroups ); |
555 | for ( ; list_it.current(); ++list_it ) { | 560 | for ( ; list_it.current(); ++list_it ) { |
561 | QStringList groupList; | ||
556 | if ( list_it.current()->isSelected() ) { | 562 | if ( list_it.current()->isSelected() ) { |
557 | qDebug( list_it.current()->text(0) ); | 563 | qDebug(list_it.current()->text(0) ); |
564 | groupList.append( list_it.current()->text(0) ); | ||
558 | } | 565 | } |
566 | data->setGroups( groupList ); | ||
559 | } | 567 | } |
560 | } | 568 | } |
561 | 569 | ||
562 | void NNTPconfig::accept() | 570 | void NNTPconfig::accept() |
563 | { | 571 | { |
564 | save(); | 572 | 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: | |||
140 | protected slots: | 140 | protected slots: |
141 | void slotSSL( bool enabled ); | 141 | void slotSSL( bool enabled ); |
142 | void accept(); | 142 | void accept(); |
143 | void slotGetNG(); | 143 | void slotGetNG(); |
144 | 144 | ||
145 | private: | 145 | private: |
146 | QStringList subscribedGroups; | ||
146 | void save(); | 147 | void save(); |
147 | NNTPaccount *data; | 148 | NNTPaccount *data; |
148 | clist* list; | 149 | clist* list; |
149 | 150 | ||
150 | }; | 151 | }; |
151 | 152 | ||
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() | |||
407 | server = conf->readEntry( "Server" ); | 407 | server = conf->readEntry( "Server" ); |
408 | port = conf->readEntry( "Port" ); | 408 | port = conf->readEntry( "Port" ); |
409 | ssl = conf->readBoolEntry( "SSL" ); | 409 | ssl = conf->readBoolEntry( "SSL" ); |
410 | login = conf->readBoolEntry( "Login" ); | 410 | login = conf->readBoolEntry( "Login" ); |
411 | user = conf->readEntry( "User" ); | 411 | user = conf->readEntry( "User" ); |
412 | password = conf->readEntryCrypt( "Password" ); | 412 | password = conf->readEntryCrypt( "Password" ); |
413 | subscribedGroups = conf->readListEntry( "Subscribed", ',' ); | ||
413 | delete conf; | 414 | delete conf; |
414 | } | 415 | } |
415 | 416 | ||
416 | void NNTPaccount::save() | 417 | void NNTPaccount::save() |
417 | { | 418 | { |
418 | qDebug( "saving " + getFileName() ); | 419 | qDebug( "saving " + getFileName() ); |
@@ -424,12 +425,13 @@ void NNTPaccount::save() | |||
424 | conf->writeEntry( "Server", server ); | 425 | conf->writeEntry( "Server", server ); |
425 | conf->writeEntry( "Port", port ); | 426 | conf->writeEntry( "Port", port ); |
426 | conf->writeEntry( "SSL", ssl ); | 427 | conf->writeEntry( "SSL", ssl ); |
427 | conf->writeEntry( "Login", login ); | 428 | conf->writeEntry( "Login", login ); |
428 | conf->writeEntry( "User", user ); | 429 | conf->writeEntry( "User", user ); |
429 | conf->writeEntryCrypt( "Password", password ); | 430 | conf->writeEntryCrypt( "Password", password ); |
431 | conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); | ||
430 | conf->write(); | 432 | conf->write(); |
431 | delete conf; | 433 | delete conf; |
432 | } | 434 | } |
433 | 435 | ||
434 | 436 | ||
435 | QString NNTPaccount::getFileName() | 437 | 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: | |||
123 | virtual void save(); | 123 | virtual void save(); |
124 | virtual QString getFileName(); | 124 | virtual QString getFileName(); |
125 | 125 | ||
126 | void setLogin( bool b ) { login = b; } | 126 | void setLogin( bool b ) { login = b; } |
127 | bool getLogin() { return login; } | 127 | bool getLogin() { return login; } |
128 | 128 | ||
129 | void setGroups( QStringList list ) { subscribedGroups = list; } | ||
130 | QStringList getGroups() { return subscribedGroups; } | ||
131 | |||
129 | private: | 132 | private: |
130 | QString file; | 133 | QString file; |
131 | bool login; | 134 | bool login; |
135 | QStringList subscribedGroups; | ||
132 | 136 | ||
133 | }; | 137 | }; |
134 | 138 | ||
135 | class Settings : public QObject | 139 | class Settings : public QObject |
136 | { | 140 | { |
137 | Q_OBJECT | 141 | Q_OBJECT |