author | alwin <alwin> | 2004-03-06 03:17:38 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-06 03:17:38 (UTC) |
commit | 5b49d47174925c1e2415641b77269b753688f5f1 (patch) (side-by-side diff) | |
tree | 136274f2c46ef95ea16fc1241acb5ee93931767a | |
parent | dcddc2bbe09153468a5d994c64011a5dc175baad (diff) | |
download | opie-5b49d47174925c1e2415641b77269b753688f5f1.zip opie-5b49d47174925c1e2415641b77269b753688f5f1.tar.gz opie-5b49d47174925c1e2415641b77269b753688f5f1.tar.bz2 |
removed dependies to libetpan from the frontend and some stuff more
-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 24 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 21 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.h | 2 |
3 files changed, 27 insertions, 20 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index b8aad11..28d531b 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -6,18 +6,16 @@ #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() ); } @@ -498,30 +496,24 @@ 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; + QStringList list = tmp->listAllNewsgroups(); - // 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 ); + ListViewGroups->clear(); + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QCheckListItem *item; - item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); - if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) { + item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); + if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); } } } void NNTPconfig::slotSSL( bool enabled ) { if ( enabled ) @@ -539,16 +531,22 @@ 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(); + /* don't forget that - you will overwrite values if user clicks cancel! */ + for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { + QCheckListItem *item; + item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); + item->setOn( true ); + } } void NNTPconfig::save() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setSSL( sslBox->isChecked() ); diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 798879d..a766a59 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -197,30 +197,39 @@ QList<Folder>* NNTPwrapper::listFolders() { groups = account->getGroups(); } for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { folders->append(new Folder((*it),".")); } return folders; } - clist * NNTPwrapper::listAllNewsgroups() { +QStringList NNTPwrapper::listAllNewsgroups() { login(); + QStringList res; clist *result = 0; - clistcell *current; - newsnntp_group_description *list; + clistcell *current = 0; + newsnntp_group_description *group; + if ( m_nntp ) { mailsession * session = m_nntp->sto_session; newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; int err = newsnntp_list_newsgroups(news, NULL, &result); - - if ( err == NEWSNNTP_NO_ERROR ) { - return result; + if ( err == NEWSNNTP_NO_ERROR && result) { + for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) { + group = ( newsnntp_group_description* ) current->data; + if (!group||!group->grp_name||strlen(group->grp_name)==0) continue; + res.append(group->grp_name); + } } } + if (result) { + clist_free(result); + } + return res; } void NNTPwrapper::answeredMail(const RecMail&) {} void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { login(); target_stat.message_count = 0; target_stat.message_unseen = 0; diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index e8e2cf4..4d03754 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h @@ -20,17 +20,17 @@ public: virtual ~NNTPwrapper(); /* mailbox will be ignored */ virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); /* should only get the subscribed one */ virtual QList<Folder>* listFolders(); /* mailbox will be ignored */ virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); - clist * listAllNewsgroups(); + QStringList listAllNewsgroups(); virtual void deleteMail(const RecMail&mail); virtual void answeredMail(const RecMail&mail); virtual int deleteAllMail(const Folder*); virtual RecBody fetchBody( const RecMail &mail ); virtual encodedString* fetchRawBody(const RecMail&mail); virtual void logout(); virtual const QString&getType()const; |