-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 39 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.h | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 24 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/nntpconfigui.ui | 38 |
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 | |||
@@ -7,8 +7,12 @@ | |||
7 | 7 | ||
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 | |||
11 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 15 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
12 | : QListViewItem( parent ) | 16 | : QListViewItem( parent ) |
13 | { | 17 | { |
14 | account = a; | 18 | account = a; |
@@ -487,14 +491,34 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, | |||
487 | data = account; | 491 | data = account; |
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 | ||
501 | void 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 | |||
497 | void NNTPconfig::slotSSL( bool enabled ) | 521 | void NNTPconfig::slotSSL( bool enabled ) |
498 | { | 522 | { |
499 | if ( enabled ) | 523 | if ( enabled ) |
500 | { | 524 | { |
@@ -516,9 +540,9 @@ void NNTPconfig::fillValues() | |||
516 | userLine->setText( data->getUser() ); | 540 | userLine->setText( data->getUser() ); |
517 | passLine->setText( data->getPassword() ); | 541 | passLine->setText( data->getPassword() ); |
518 | } | 542 | } |
519 | 543 | ||
520 | void NNTPconfig::accept() | 544 | void NNTPconfig::save() |
521 | { | 545 | { |
522 | data->setAccountName( accountLine->text() ); | 546 | data->setAccountName( accountLine->text() ); |
523 | data->setServer( serverLine->text() ); | 547 | data->setServer( serverLine->text() ); |
524 | data->setPort( portLine->text() ); | 548 | data->setPort( portLine->text() ); |
@@ -526,7 +550,18 @@ void NNTPconfig::accept() | |||
526 | data->setLogin( loginBox->isChecked() ); | 550 | data->setLogin( loginBox->isChecked() ); |
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 | |||
562 | void 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 | |||
@@ -9,8 +9,10 @@ | |||
9 | #include "imapconfigui.h" | 9 | #include "imapconfigui.h" |
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 | ||
16 | class AccountListItem : public QListViewItem | 18 | class AccountListItem : public QListViewItem |
@@ -80,9 +82,9 @@ public slots: | |||
80 | 82 | ||
81 | protected slots: | 83 | protected slots: |
82 | void slotConnectionToggle( int index ); | 84 | void slotConnectionToggle( int index ); |
83 | void accept(); | 85 | void accept(); |
84 | 86 | ||
85 | private: | 87 | private: |
86 | IMAPaccount *data; | 88 | IMAPaccount *data; |
87 | 89 | ||
88 | }; | 90 | }; |
@@ -137,11 +139,14 @@ public slots: | |||
137 | 139 | ||
138 | protected slots: | 140 | protected slots: |
139 | void slotSSL( bool enabled ); | 141 | void slotSSL( bool enabled ); |
140 | void accept(); | 142 | void accept(); |
143 | void slotGetNG(); | ||
141 | 144 | ||
142 | private: | 145 | private: |
146 | void save(); | ||
143 | NNTPaccount *data; | 147 | NNTPaccount *data; |
148 | clist* list; | ||
144 | 149 | ||
145 | }; | 150 | }; |
146 | 151 | ||
147 | #endif | 152 | #endif |
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 | |||
@@ -6,10 +6,8 @@ | |||
6 | 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 |
15 | 13 | ||
@@ -191,37 +189,31 @@ void NNTPwrapper::logout() | |||
191 | } | 189 | } |
192 | 190 | ||
193 | QList<Folder>* NNTPwrapper::listFolders() { | 191 | QList<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 | |||
224 | void NNTPwrapper::answeredMail(const RecMail&) {} | 216 | void NNTPwrapper::answeredMail(const RecMail&) {} |
225 | 217 | ||
226 | void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { | 218 | void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { |
227 | login(); | 219 | login(); |
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 | |||
@@ -24,9 +24,9 @@ public: | |||
24 | /* should only get the subscribed one */ | 24 | /* should only get the subscribed one */ |
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*); |
32 | 32 | ||
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 | |||
@@ -10,9 +10,9 @@ | |||
10 | <name>geometry</name> | 10 | <name>geometry</name> |
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> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
@@ -296,8 +296,22 @@ | |||
296 | <number>3</number> | 296 | <number>3</number> |
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> |
303 | </property> | 317 | </property> |
@@ -317,30 +331,8 @@ | |||
317 | </widget> | 331 | </widget> |
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> |
346 | <tabstop>portLine</tabstop> | 338 | <tabstop>portLine</tabstop> |