From 6afcd375a640d5c6888bc111cd1d80a08f554136 Mon Sep 17 00:00:00 2001 From: harlekin Date: Fri, 05 Mar 2004 23:08:46 +0000 Subject: list newsgroups in nntp config --- (limited to 'noncore/net/mail') diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index edeb1de..2a1acc0 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp @@ -8,6 +8,10 @@ /* QT */ #include +#include + +#include + AccountListItem::AccountListItem( QListView *parent, Account *a) : QListViewItem( parent ) { @@ -488,12 +492,32 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); - + connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); fillValues(); 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 ); + + QCheckListItem *item; + item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); + } +} + void NNTPconfig::slotSSL( bool enabled ) { if ( enabled ) @@ -517,7 +541,7 @@ void NNTPconfig::fillValues() passLine->setText( data->getPassword() ); } -void NNTPconfig::accept() +void NNTPconfig::save() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); @@ -527,6 +551,17 @@ void NNTPconfig::accept() data->setUser( userLine->text() ); data->setPassword( passLine->text() ); + QListViewItemIterator list_it( ListViewGroups ); + for ( ; list_it.current(); ++list_it ) { + if ( list_it.current()->isSelected() ) { + qDebug( list_it.current()->text(0) ); + } + } +} + +void NNTPconfig::accept() +{ + save(); QDialog::accept(); } diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h index d8e1219..438a984 100644 --- a/noncore/net/mail/editaccounts.h +++ b/noncore/net/mail/editaccounts.h @@ -10,6 +10,8 @@ #include "pop3configui.h" #include "smtpconfigui.h" #include "nntpconfigui.h" + +#include #include @@ -81,7 +83,7 @@ public slots: protected slots: void slotConnectionToggle( int index ); void accept(); - + private: IMAPaccount *data; @@ -138,9 +140,12 @@ public slots: protected slots: void slotSSL( bool enabled ); void accept(); + void slotGetNG(); private: + void save(); NNTPaccount *data; + clist* list; }; diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 54e0ed4..2d6f9a3 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -7,8 +7,6 @@ #include #include -#include - #define HARD_MSG_SIZE_LIMIT 5242880 @@ -192,35 +190,29 @@ void NNTPwrapper::logout() QList* NNTPwrapper::listFolders() { - - - QList * folders = new QList(); folders->setAutoDelete( false ); + +// folders->append(inb); + return folders; +} + + clist * NNTPwrapper::listAllNewsgroups() { + login(); clist *result = 0; clistcell *current; newsnntp_group_description *list; - - login(); 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 ) { - current = result->first; - for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { - list = ( newsnntp_group_description* ) current->data; - qDebug( list->grp_name ); - } -// Folder*inb=new Folder("INBOX","/"); + return result; } } -// folders->append(inb); - return folders; } - void NNTPwrapper::answeredMail(const RecMail&) {} void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index e47e68f..e4d4a37 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h @@ -25,7 +25,7 @@ public: virtual QList* listFolders(); /* mailbox will be ignored */ virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); - + clist * listAllNewsgroups(); virtual void deleteMail(const RecMail&mail); virtual void answeredMail(const RecMail&mail); virtual int deleteAllMail(const Folder*); diff --git a/noncore/net/mail/nntpconfigui.ui b/noncore/net/mail/nntpconfigui.ui index 7769804..25d564e 100644 --- a/noncore/net/mail/nntpconfigui.ui +++ b/noncore/net/mail/nntpconfigui.ui @@ -11,7 +11,7 @@ 0 0 - 413 + 409 520 @@ -297,6 +297,20 @@ QListView + + + text + Newsgroup + + + clickable + true + + + resizeable + true + + name ListViewGroups @@ -318,28 +332,6 @@ - - - QListView -
qlistview.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753 - - accountLine serverLine -- cgit v0.9.0.2