summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-03-05 23:08:46 (UTC)
committer harlekin <harlekin>2004-03-05 23:08:46 (UTC)
commit6afcd375a640d5c6888bc111cd1d80a08f554136 (patch) (unidiff)
tree520b12836ea13ee6e58f36a8851994fcfbe16051
parentb4ec902435df4e3c834b7790c1dc70a235157477 (diff)
downloadopie-6afcd375a640d5c6888bc111cd1d80a08f554136.zip
opie-6afcd375a640d5c6888bc111cd1d80a08f554136.tar.gz
opie-6afcd375a640d5c6888bc111cd1d80a08f554136.tar.bz2
list newsgroups in nntp config
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp39
-rw-r--r--noncore/net/mail/editaccounts.h7
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp24
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h2
-rw-r--r--noncore/net/mail/nntpconfigui.ui38
5 files changed, 67 insertions, 43 deletions
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 @@
8/* QT */ 8/* QT */
9#include <qt.h> 9#include <qt.h>
10 10
11#include <libmailwrapper/nntpwrapper.h>
12
13#include <libetpan/nntpdriver.h>
14
11AccountListItem::AccountListItem( QListView *parent, Account *a) 15AccountListItem::AccountListItem( QListView *parent, Account *a)
12 : QListViewItem( parent ) 16 : QListViewItem( parent )
13{ 17{
@@ -488,12 +492,32 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name,
488 492
489 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 493 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
490 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 494 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
491 495 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
492 fillValues(); 496 fillValues();
493 497
494 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 498 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
495} 499}
496 500
501void NNTPconfig::slotGetNG() {
502 save();
503 data->save();
504 NNTPwrapper* tmp = new NNTPwrapper( data );
505 clist* list = tmp->listAllNewsgroups();
506
507 clistcell *current;
508 newsnntp_group_description *group;
509
510 // FIXME - test if not empty
511 current = list->first;
512 for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) {
513 group = ( newsnntp_group_description* ) current->data;
514 qDebug( group->grp_name );
515
516 QCheckListItem *item;
517 item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox );
518 }
519}
520
497void NNTPconfig::slotSSL( bool enabled ) 521void NNTPconfig::slotSSL( bool enabled )
498{ 522{
499 if ( enabled ) 523 if ( enabled )
@@ -517,7 +541,7 @@ void NNTPconfig::fillValues()
517 passLine->setText( data->getPassword() ); 541 passLine->setText( data->getPassword() );
518} 542}
519 543
520void NNTPconfig::accept() 544void NNTPconfig::save()
521{ 545{
522 data->setAccountName( accountLine->text() ); 546 data->setAccountName( accountLine->text() );
523 data->setServer( serverLine->text() ); 547 data->setServer( serverLine->text() );
@@ -527,6 +551,17 @@ void NNTPconfig::accept()
527 data->setUser( userLine->text() ); 551 data->setUser( userLine->text() );
528 data->setPassword( passLine->text() ); 552 data->setPassword( passLine->text() );
529 553
554 QListViewItemIterator list_it( ListViewGroups );
555 for ( ; list_it.current(); ++list_it ) {
556 if ( list_it.current()->isSelected() ) {
557 qDebug( list_it.current()->text(0) );
558 }
559 }
560}
561
562void NNTPconfig::accept()
563{
564 save();
530 QDialog::accept(); 565 QDialog::accept();
531} 566}
532 567
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 @@
10#include "pop3configui.h" 10#include "pop3configui.h"
11#include "smtpconfigui.h" 11#include "smtpconfigui.h"
12#include "nntpconfigui.h" 12#include "nntpconfigui.h"
13
14#include <libetpan/clist.h>
13#include <libmailwrapper/settings.h> 15#include <libmailwrapper/settings.h>
14 16
15 17
@@ -81,7 +83,7 @@ public slots:
81protected slots: 83protected slots:
82 void slotConnectionToggle( int index ); 84 void slotConnectionToggle( int index );
83 void accept(); 85 void accept();
84 86
85private: 87private:
86 IMAPaccount *data; 88 IMAPaccount *data;
87 89
@@ -138,9 +140,12 @@ public slots:
138protected slots: 140protected slots:
139 void slotSSL( bool enabled ); 141 void slotSSL( bool enabled );
140 void accept(); 142 void accept();
143 void slotGetNG();
141 144
142private: 145private:
146 void save();
143 NNTPaccount *data; 147 NNTPaccount *data;
148 clist* list;
144 149
145}; 150};
146 151
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 @@
7#include <stdlib.h> 7#include <stdlib.h>
8 8
9#include <libetpan/libetpan.h> 9#include <libetpan/libetpan.h>
10#include <libetpan/nntpdriver.h>
11
12 10
13 11
14#define HARD_MSG_SIZE_LIMIT 5242880 12#define HARD_MSG_SIZE_LIMIT 5242880
@@ -192,35 +190,29 @@ void NNTPwrapper::logout()
192 190
193QList<Folder>* NNTPwrapper::listFolders() { 191QList<Folder>* NNTPwrapper::listFolders() {
194 192
195
196
197
198 QList<Folder> * folders = new QList<Folder>(); 193 QList<Folder> * folders = new QList<Folder>();
199 folders->setAutoDelete( false ); 194 folders->setAutoDelete( false );
195
196// folders->append(inb);
197 return folders;
198}
199
200 clist * NNTPwrapper::listAllNewsgroups() {
201 login();
200 clist *result = 0; 202 clist *result = 0;
201 clistcell *current; 203 clistcell *current;
202 newsnntp_group_description *list; 204 newsnntp_group_description *list;
203
204 login();
205 if ( m_nntp ) { 205 if ( m_nntp ) {
206 mailsession * session = m_nntp->sto_session; 206 mailsession * session = m_nntp->sto_session;
207 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; 207 newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
208 int err = newsnntp_list_newsgroups(news, NULL, &result); 208 int err = newsnntp_list_newsgroups(news, NULL, &result);
209 209
210 if ( err == NEWSNNTP_NO_ERROR ) { 210 if ( err == NEWSNNTP_NO_ERROR ) {
211 current = result->first; 211 return result;
212 for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
213 list = ( newsnntp_group_description* ) current->data;
214 qDebug( list->grp_name );
215 }
216// Folder*inb=new Folder("INBOX","/");
217 } 212 }
218 } 213 }
219// folders->append(inb);
220 return folders;
221} 214}
222 215
223
224void NNTPwrapper::answeredMail(const RecMail&) {} 216void NNTPwrapper::answeredMail(const RecMail&) {}
225 217
226void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { 218void 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:
25 virtual QList<Folder>* listFolders(); 25 virtual QList<Folder>* listFolders();
26 /* mailbox will be ignored */ 26 /* mailbox will be ignored */
27 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); 27 virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
28 28 clist * listAllNewsgroups();
29 virtual void deleteMail(const RecMail&mail); 29 virtual void deleteMail(const RecMail&mail);
30 virtual void answeredMail(const RecMail&mail); 30 virtual void answeredMail(const RecMail&mail);
31 virtual int deleteAllMail(const Folder*); 31 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 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>413</width> 14 <width>409</width>
15 <height>520</height> 15 <height>520</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -297,6 +297,20 @@
297 </property> 297 </property>
298 <widget> 298 <widget>
299 <class>QListView</class> 299 <class>QListView</class>
300 <column>
301 <property>
302 <name>text</name>
303 <string>Newsgroup</string>
304 </property>
305 <property>
306 <name>clickable</name>
307 <bool>true</bool>
308 </property>
309 <property>
310 <name>resizeable</name>
311 <bool>true</bool>
312 </property>
313 </column>
300 <property stdset="1"> 314 <property stdset="1">
301 <name>name</name> 315 <name>name</name>
302 <cstring>ListViewGroups</cstring> 316 <cstring>ListViewGroups</cstring>
@@ -318,28 +332,6 @@
318 </widget> 332 </widget>
319 </vbox> 333 </vbox>
320</widget> 334</widget>
321<customwidgets>
322 <customwidget>
323 <class>QListView</class>
324 <header location="global">qlistview.h</header>
325 <sizehint>
326 <width>-1</width>
327 <height>-1</height>
328 </sizehint>
329 <container>0</container>
330 <sizepolicy>
331 <hordata>5</hordata>
332 <verdata>5</verdata>
333 </sizepolicy>
334 <pixmap>image0</pixmap>
335 </customwidget>
336</customwidgets>
337<images>
338 <image>
339 <name>image0</name>
340 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
341 </image>
342</images>
343<tabstops> 335<tabstops>
344 <tabstop>accountLine</tabstop> 336 <tabstop>accountLine</tabstop>
345 <tabstop>serverLine</tabstop> 337 <tabstop>serverLine</tabstop>