-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 | |||
@@ -5,12 +5,16 @@ | |||
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 | 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; |
15 | setText( 0, account->getAccountName() ); | 19 | setText( 0, account->getAccountName() ); |
16 | setText( 1, account->getType() ); | 20 | setText( 1, account->getType() ); |
@@ -485,18 +489,38 @@ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, | |||
485 | : NNTPconfigUI( parent, name, modal, flags ) | 489 | : NNTPconfigUI( parent, name, modal, flags ) |
486 | { | 490 | { |
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 | { |
501 | portLine->setText( NNTP_SSL_PORT ); | 525 | portLine->setText( NNTP_SSL_PORT ); |
502 | } | 526 | } |
@@ -514,19 +538,30 @@ void NNTPconfig::fillValues() | |||
514 | sslBox->setChecked( data->getSSL() ); | 538 | sslBox->setChecked( data->getSSL() ); |
515 | loginBox->setChecked( data->getLogin() ); | 539 | loginBox->setChecked( data->getLogin() ); |
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() ); |
525 | data->setSSL( sslBox->isChecked() ); | 549 | data->setSSL( sslBox->isChecked() ); |
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 | |||
@@ -7,12 +7,14 @@ | |||
7 | #include "editaccountsui.h" | 7 | #include "editaccountsui.h" |
8 | #include "selectmailtypeui.h" | 8 | #include "selectmailtypeui.h" |
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 |
17 | { | 19 | { |
18 | 20 | ||
@@ -78,13 +80,13 @@ public: | |||
78 | public slots: | 80 | public slots: |
79 | void fillValues(); | 81 | void fillValues(); |
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 | }; |
89 | 91 | ||
90 | class POP3config : public POP3configUI | 92 | class POP3config : public POP3configUI |
@@ -135,13 +137,16 @@ public: | |||
135 | public slots: | 137 | public slots: |
136 | void fillValues(); | 138 | void fillValues(); |
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 | |||
@@ -4,14 +4,12 @@ | |||
4 | 4 | ||
5 | #include <qfile.h> | 5 | #include <qfile.h> |
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 | ||
16 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) | 14 | NNTPwrapper::NNTPwrapper( NNTPaccount *a ) |
17 | : Genericwrapper() { | 15 | : Genericwrapper() { |
@@ -189,41 +187,35 @@ void NNTPwrapper::logout() | |||
189 | mailstorage_free(m_nntp); | 187 | mailstorage_free(m_nntp); |
190 | m_nntp = 0; | 188 | m_nntp = 0; |
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(); |
228 | target_stat.message_count = 0; | 220 | target_stat.message_count = 0; |
229 | target_stat.message_unseen = 0; | 221 | target_stat.message_unseen = 0; |
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 | |||
@@ -22,13 +22,13 @@ public: | |||
22 | /* mailbox will be ignored */ | 22 | /* mailbox will be ignored */ |
23 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 23 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
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 | ||
33 | virtual RecBody fetchBody( const RecMail &mail ); | 33 | virtual RecBody fetchBody( const RecMail &mail ); |
34 | virtual encodedString* fetchRawBody(const RecMail&mail); | 34 | virtual encodedString* fetchRawBody(const RecMail&mail); |
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 | |||
@@ -8,13 +8,13 @@ | |||
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
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"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure NNTP</string> | 20 | <string>Configure NNTP</string> |
@@ -294,12 +294,26 @@ | |||
294 | <property stdset="1"> | 294 | <property stdset="1"> |
295 | <name>spacing</name> | 295 | <name>spacing</name> |
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> |
304 | </widget> | 318 | </widget> |
305 | <widget> | 319 | <widget> |
@@ -315,34 +329,12 @@ | |||
315 | </widget> | 329 | </widget> |
316 | </vbox> | 330 | </vbox> |
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> |
347 | <tabstop>sslBox</tabstop> | 339 | <tabstop>sslBox</tabstop> |
348 | <tabstop>loginBox</tabstop> | 340 | <tabstop>loginBox</tabstop> |