author | harlekin <harlekin> | 2004-03-05 23:08:46 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-03-05 23:08:46 (UTC) |
commit | 6afcd375a640d5c6888bc111cd1d80a08f554136 (patch) (unidiff) | |
tree | 520b12836ea13ee6e58f36a8851994fcfbe16051 | |
parent | b4ec902435df4e3c834b7790c1dc70a235157477 (diff) | |
download | opie-6afcd375a640d5c6888bc111cd1d80a08f554136.zip opie-6afcd375a640d5c6888bc111cd1d80a08f554136.tar.gz opie-6afcd375a640d5c6888bc111cd1d80a08f554136.tar.bz2 |
list newsgroups in nntp config
-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 | |||
@@ -1,106 +1,110 @@ | |||
1 | 1 | ||
2 | #include "defines.h" | 2 | #include "defines.h" |
3 | #include "editaccounts.h" | 3 | #include "editaccounts.h" |
4 | 4 | ||
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() ); |
17 | } | 21 | } |
18 | 22 | ||
19 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 23 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
20 | : EditAccountsUI( parent, name, modal, flags ) | 24 | : EditAccountsUI( parent, name, modal, flags ) |
21 | { | 25 | { |
22 | qDebug( "New Account Configuration Widget" ); | 26 | qDebug( "New Account Configuration Widget" ); |
23 | settings = s; | 27 | settings = s; |
24 | 28 | ||
25 | mailList->addColumn( tr( "Account" ) ); | 29 | mailList->addColumn( tr( "Account" ) ); |
26 | mailList->addColumn( tr( "Type" ) ); | 30 | mailList->addColumn( tr( "Type" ) ); |
27 | 31 | ||
28 | newsList->addColumn( tr( "Account" ) ); | 32 | newsList->addColumn( tr( "Account" ) ); |
29 | 33 | ||
30 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 34 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
31 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 35 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
32 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 36 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
33 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 37 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
34 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 38 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
35 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 39 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
36 | 40 | ||
37 | slotFillLists(); | 41 | slotFillLists(); |
38 | } | 42 | } |
39 | 43 | ||
40 | void EditAccounts::slotFillLists() | 44 | void EditAccounts::slotFillLists() |
41 | { | 45 | { |
42 | mailList->clear(); | 46 | mailList->clear(); |
43 | newsList->clear(); | 47 | newsList->clear(); |
44 | 48 | ||
45 | QList<Account> accounts = settings->getAccounts(); | 49 | QList<Account> accounts = settings->getAccounts(); |
46 | Account *it; | 50 | Account *it; |
47 | for ( it = accounts.first(); it; it = accounts.next() ) | 51 | for ( it = accounts.first(); it; it = accounts.next() ) |
48 | { | 52 | { |
49 | if ( it->getType().compare( "NNTP" ) == 0 ) | 53 | if ( it->getType().compare( "NNTP" ) == 0 ) |
50 | { | 54 | { |
51 | (void) new AccountListItem( newsList, it ); | 55 | (void) new AccountListItem( newsList, it ); |
52 | } | 56 | } |
53 | else | 57 | else |
54 | { | 58 | { |
55 | (void) new AccountListItem( mailList, it ); | 59 | (void) new AccountListItem( mailList, it ); |
56 | } | 60 | } |
57 | } | 61 | } |
58 | } | 62 | } |
59 | 63 | ||
60 | void EditAccounts::slotNewMail() | 64 | void EditAccounts::slotNewMail() |
61 | { | 65 | { |
62 | qDebug( "New Mail Account" ); | 66 | qDebug( "New Mail Account" ); |
63 | QString *selection = new QString(); | 67 | QString *selection = new QString(); |
64 | SelectMailType selType( selection, this, 0, true ); | 68 | SelectMailType selType( selection, this, 0, true ); |
65 | selType.show(); | 69 | selType.show(); |
66 | if ( QDialog::Accepted == selType.exec() ) | 70 | if ( QDialog::Accepted == selType.exec() ) |
67 | { | 71 | { |
68 | slotNewAccount( *selection ); | 72 | slotNewAccount( *selection ); |
69 | } | 73 | } |
70 | } | 74 | } |
71 | 75 | ||
72 | void EditAccounts::slotNewAccount( const QString &type ) | 76 | void EditAccounts::slotNewAccount( const QString &type ) |
73 | { | 77 | { |
74 | if ( type.compare( "IMAP" ) == 0 ) | 78 | if ( type.compare( "IMAP" ) == 0 ) |
75 | { | 79 | { |
76 | qDebug( "-> config IMAP" ); | 80 | qDebug( "-> config IMAP" ); |
77 | IMAPaccount *account = new IMAPaccount(); | 81 | IMAPaccount *account = new IMAPaccount(); |
78 | IMAPconfig imap( account, this, 0, true ); | 82 | IMAPconfig imap( account, this, 0, true ); |
79 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) | 83 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) |
80 | { | 84 | { |
81 | settings->addAccount( account ); | 85 | settings->addAccount( account ); |
82 | account->save(); | 86 | account->save(); |
83 | slotFillLists(); | 87 | slotFillLists(); |
84 | } | 88 | } |
85 | else | 89 | else |
86 | { | 90 | { |
87 | account->remove(); | 91 | account->remove(); |
88 | } | 92 | } |
89 | } | 93 | } |
90 | else if ( type.compare( "POP3" ) == 0 ) | 94 | else if ( type.compare( "POP3" ) == 0 ) |
91 | { | 95 | { |
92 | qDebug( "-> config POP3" ); | 96 | qDebug( "-> config POP3" ); |
93 | POP3account *account = new POP3account(); | 97 | POP3account *account = new POP3account(); |
94 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 98 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
95 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) | 99 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) |
96 | { | 100 | { |
97 | settings->addAccount( account ); | 101 | settings->addAccount( account ); |
98 | account->save(); | 102 | account->save(); |
99 | slotFillLists(); | 103 | slotFillLists(); |
100 | } | 104 | } |
101 | else | 105 | else |
102 | { | 106 | { |
103 | account->remove(); | 107 | account->remove(); |
104 | } | 108 | } |
105 | } | 109 | } |
106 | else if ( type.compare( "SMTP" ) == 0 ) | 110 | else if ( type.compare( "SMTP" ) == 0 ) |
@@ -395,138 +399,169 @@ void POP3config::fillValues() | |||
395 | accountLine->setText( data->getAccountName() ); | 399 | accountLine->setText( data->getAccountName() ); |
396 | serverLine->setText( data->getServer() ); | 400 | serverLine->setText( data->getServer() ); |
397 | portLine->setText( data->getPort() ); | 401 | portLine->setText( data->getPort() ); |
398 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 402 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
399 | userLine->setText( data->getUser() ); | 403 | userLine->setText( data->getUser() ); |
400 | passLine->setText( data->getPassword() ); | 404 | passLine->setText( data->getPassword() ); |
401 | } | 405 | } |
402 | 406 | ||
403 | void POP3config::accept() | 407 | void POP3config::accept() |
404 | { | 408 | { |
405 | data->setAccountName( accountLine->text() ); | 409 | data->setAccountName( accountLine->text() ); |
406 | data->setServer( serverLine->text() ); | 410 | data->setServer( serverLine->text() ); |
407 | data->setPort( portLine->text() ); | 411 | data->setPort( portLine->text() ); |
408 | data->setConnectionType( ComboBox1->currentItem() ); | 412 | data->setConnectionType( ComboBox1->currentItem() ); |
409 | data->setUser( userLine->text() ); | 413 | data->setUser( userLine->text() ); |
410 | data->setPassword( passLine->text() ); | 414 | data->setPassword( passLine->text() ); |
411 | 415 | ||
412 | QDialog::accept(); | 416 | QDialog::accept(); |
413 | } | 417 | } |
414 | 418 | ||
415 | /** | 419 | /** |
416 | * SMTPconfig | 420 | * SMTPconfig |
417 | */ | 421 | */ |
418 | 422 | ||
419 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 423 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
420 | : SMTPconfigUI( parent, name, modal, flags ) | 424 | : SMTPconfigUI( parent, name, modal, flags ) |
421 | { | 425 | { |
422 | data = account; | 426 | data = account; |
423 | 427 | ||
424 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 428 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
425 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 429 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
426 | 430 | ||
427 | fillValues(); | 431 | fillValues(); |
428 | 432 | ||
429 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 433 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
430 | ComboBox1->insertItem( "Only if available", 0 ); | 434 | ComboBox1->insertItem( "Only if available", 0 ); |
431 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 435 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
432 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 436 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
433 | ComboBox1->insertItem( "Run command instead", 3 ); | 437 | ComboBox1->insertItem( "Run command instead", 3 ); |
434 | CommandEdit->hide(); | 438 | CommandEdit->hide(); |
435 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 439 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
436 | } | 440 | } |
437 | 441 | ||
438 | void SMTPconfig::slotConnectionToggle( int index ) | 442 | void SMTPconfig::slotConnectionToggle( int index ) |
439 | { | 443 | { |
440 | // 2 is ssl connection | 444 | // 2 is ssl connection |
441 | if ( index == 2 ) | 445 | if ( index == 2 ) |
442 | { | 446 | { |
443 | portLine->setText( SMTP_SSL_PORT ); | 447 | portLine->setText( SMTP_SSL_PORT ); |
444 | } | 448 | } |
445 | else if ( index == 3 ) | 449 | else if ( index == 3 ) |
446 | { | 450 | { |
447 | portLine->setText( SMTP_PORT ); | 451 | portLine->setText( SMTP_PORT ); |
448 | CommandEdit->show(); | 452 | CommandEdit->show(); |
449 | } | 453 | } |
450 | else | 454 | else |
451 | { | 455 | { |
452 | portLine->setText( SMTP_PORT ); | 456 | portLine->setText( SMTP_PORT ); |
453 | } | 457 | } |
454 | } | 458 | } |
455 | 459 | ||
456 | void SMTPconfig::fillValues() | 460 | void SMTPconfig::fillValues() |
457 | { | 461 | { |
458 | accountLine->setText( data->getAccountName() ); | 462 | accountLine->setText( data->getAccountName() ); |
459 | serverLine->setText( data->getServer() ); | 463 | serverLine->setText( data->getServer() ); |
460 | portLine->setText( data->getPort() ); | 464 | portLine->setText( data->getPort() ); |
461 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 465 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
462 | loginBox->setChecked( data->getLogin() ); | 466 | loginBox->setChecked( data->getLogin() ); |
463 | userLine->setText( data->getUser() ); | 467 | userLine->setText( data->getUser() ); |
464 | passLine->setText( data->getPassword() ); | 468 | passLine->setText( data->getPassword() ); |
465 | } | 469 | } |
466 | 470 | ||
467 | void SMTPconfig::accept() | 471 | void SMTPconfig::accept() |
468 | { | 472 | { |
469 | data->setAccountName( accountLine->text() ); | 473 | data->setAccountName( accountLine->text() ); |
470 | data->setServer( serverLine->text() ); | 474 | data->setServer( serverLine->text() ); |
471 | data->setPort( portLine->text() ); | 475 | data->setPort( portLine->text() ); |
472 | data->setConnectionType( ComboBox1->currentItem() ); | 476 | data->setConnectionType( ComboBox1->currentItem() ); |
473 | data->setLogin( loginBox->isChecked() ); | 477 | data->setLogin( loginBox->isChecked() ); |
474 | data->setUser( userLine->text() ); | 478 | data->setUser( userLine->text() ); |
475 | data->setPassword( passLine->text() ); | 479 | data->setPassword( passLine->text() ); |
476 | 480 | ||
477 | QDialog::accept(); | 481 | QDialog::accept(); |
478 | } | 482 | } |
479 | 483 | ||
480 | /** | 484 | /** |
481 | * NNTPconfig | 485 | * NNTPconfig |
482 | */ | 486 | */ |
483 | 487 | ||
484 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 488 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
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 | } |
503 | else | 527 | else |
504 | { | 528 | { |
505 | portLine->setText( NNTP_PORT ); | 529 | portLine->setText( NNTP_PORT ); |
506 | } | 530 | } |
507 | } | 531 | } |
508 | 532 | ||
509 | void NNTPconfig::fillValues() | 533 | void NNTPconfig::fillValues() |
510 | { | 534 | { |
511 | accountLine->setText( data->getAccountName() ); | 535 | accountLine->setText( data->getAccountName() ); |
512 | serverLine->setText( data->getServer() ); | 536 | serverLine->setText( data->getServer() ); |
513 | portLine->setText( data->getPort() ); | 537 | portLine->setText( data->getPort() ); |
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 | |||
@@ -1,147 +1,152 @@ | |||
1 | #ifndef EDITACCOUNTS_H | 1 | #ifndef EDITACCOUNTS_H |
2 | #define EDITACCOUNTS_H | 2 | #define EDITACCOUNTS_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | 6 | ||
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 | ||
19 | public: | 21 | public: |
20 | AccountListItem( QListView *parent, Account *a); | 22 | AccountListItem( QListView *parent, Account *a); |
21 | Account *getAccount() { return account; } | 23 | Account *getAccount() { return account; } |
22 | 24 | ||
23 | private: | 25 | private: |
24 | Account *account; | 26 | Account *account; |
25 | 27 | ||
26 | }; | 28 | }; |
27 | 29 | ||
28 | class EditAccounts : public EditAccountsUI | 30 | class EditAccounts : public EditAccountsUI |
29 | { | 31 | { |
30 | Q_OBJECT | 32 | Q_OBJECT |
31 | 33 | ||
32 | public: | 34 | public: |
33 | EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 35 | EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
34 | 36 | ||
35 | public slots: | 37 | public slots: |
36 | void slotNewAccount( const QString &type ); | 38 | void slotNewAccount( const QString &type ); |
37 | void slotEditAccount( Account *account ); | 39 | void slotEditAccount( Account *account ); |
38 | void slotDeleteAccount( Account * account ); | 40 | void slotDeleteAccount( Account * account ); |
39 | void slotAdjustColumns(); | 41 | void slotAdjustColumns(); |
40 | 42 | ||
41 | protected slots: | 43 | protected slots: |
42 | void slotFillLists(); | 44 | void slotFillLists(); |
43 | void slotNewMail(); | 45 | void slotNewMail(); |
44 | void slotEditMail(); | 46 | void slotEditMail(); |
45 | void slotDeleteMail(); | 47 | void slotDeleteMail(); |
46 | void slotNewNews(); | 48 | void slotNewNews(); |
47 | void slotEditNews(); | 49 | void slotEditNews(); |
48 | void slotDeleteNews(); | 50 | void slotDeleteNews(); |
49 | void accept(); | 51 | void accept(); |
50 | 52 | ||
51 | private: | 53 | private: |
52 | Settings *settings; | 54 | Settings *settings; |
53 | 55 | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | class SelectMailType : public SelectMailTypeUI | 58 | class SelectMailType : public SelectMailTypeUI |
57 | { | 59 | { |
58 | Q_OBJECT | 60 | Q_OBJECT |
59 | 61 | ||
60 | public: | 62 | public: |
61 | SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 63 | SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
62 | 64 | ||
63 | private slots: | 65 | private slots: |
64 | void slotSelection( const QString &sel ); | 66 | void slotSelection( const QString &sel ); |
65 | 67 | ||
66 | private: | 68 | private: |
67 | QString *selected; | 69 | QString *selected; |
68 | 70 | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | class IMAPconfig : public IMAPconfigUI | 73 | class IMAPconfig : public IMAPconfigUI |
72 | { | 74 | { |
73 | Q_OBJECT | 75 | Q_OBJECT |
74 | 76 | ||
75 | public: | 77 | public: |
76 | IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 78 | IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
77 | 79 | ||
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 |
91 | { | 93 | { |
92 | Q_OBJECT | 94 | Q_OBJECT |
93 | 95 | ||
94 | public: | 96 | public: |
95 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 97 | POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
96 | 98 | ||
97 | public slots: | 99 | public slots: |
98 | void fillValues(); | 100 | void fillValues(); |
99 | 101 | ||
100 | protected slots: | 102 | protected slots: |
101 | void slotConnectionToggle( int index ); | 103 | void slotConnectionToggle( int index ); |
102 | void accept(); | 104 | void accept(); |
103 | 105 | ||
104 | private: | 106 | private: |
105 | POP3account *data; | 107 | POP3account *data; |
106 | 108 | ||
107 | }; | 109 | }; |
108 | 110 | ||
109 | class SMTPconfig : public SMTPconfigUI | 111 | class SMTPconfig : public SMTPconfigUI |
110 | { | 112 | { |
111 | Q_OBJECT | 113 | Q_OBJECT |
112 | 114 | ||
113 | public: | 115 | public: |
114 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 116 | SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
115 | 117 | ||
116 | public slots: | 118 | public slots: |
117 | void fillValues(); | 119 | void fillValues(); |
118 | 120 | ||
119 | protected slots: | 121 | protected slots: |
120 | void slotConnectionToggle( int index ); | 122 | void slotConnectionToggle( int index ); |
121 | void accept(); | 123 | void accept(); |
122 | 124 | ||
123 | private: | 125 | private: |
124 | SMTPaccount *data; | 126 | SMTPaccount *data; |
125 | 127 | ||
126 | }; | 128 | }; |
127 | 129 | ||
128 | class NNTPconfig : public NNTPconfigUI | 130 | class NNTPconfig : public NNTPconfigUI |
129 | { | 131 | { |
130 | Q_OBJECT | 132 | Q_OBJECT |
131 | 133 | ||
132 | public: | 134 | public: |
133 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); | 135 | NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); |
134 | 136 | ||
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 | |||
@@ -1,265 +1,257 @@ | |||
1 | #include "nntpwrapper.h" | 1 | #include "nntpwrapper.h" |
2 | #include "logindialog.h" | 2 | #include "logindialog.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
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() { |
18 | account = a; | 16 | account = a; |
19 | m_nntp = NULL; | 17 | m_nntp = NULL; |
20 | msgTempName = a->getFileName()+"_msg_cache"; | 18 | msgTempName = a->getFileName()+"_msg_cache"; |
21 | last_msg_id = 0; | 19 | last_msg_id = 0; |
22 | } | 20 | } |
23 | 21 | ||
24 | NNTPwrapper::~NNTPwrapper() { | 22 | NNTPwrapper::~NNTPwrapper() { |
25 | logout(); | 23 | logout(); |
26 | QFile msg_cache(msgTempName); | 24 | QFile msg_cache(msgTempName); |
27 | if (msg_cache.exists()) { | 25 | if (msg_cache.exists()) { |
28 | msg_cache.remove(); | 26 | msg_cache.remove(); |
29 | } | 27 | } |
30 | } | 28 | } |
31 | 29 | ||
32 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { | 30 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { |
33 | qDebug( "NNTP: %i of %i", current, maximum ); | 31 | qDebug( "NNTP: %i of %i", current, maximum ); |
34 | } | 32 | } |
35 | 33 | ||
36 | 34 | ||
37 | RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { | 35 | RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { |
38 | int err = NEWSNNTP_NO_ERROR; | 36 | int err = NEWSNNTP_NO_ERROR; |
39 | char *message = 0; | 37 | char *message = 0; |
40 | size_t length = 0; | 38 | size_t length = 0; |
41 | 39 | ||
42 | login(); | 40 | login(); |
43 | if ( !m_nntp ) { | 41 | if ( !m_nntp ) { |
44 | return RecBody(); | 42 | return RecBody(); |
45 | } | 43 | } |
46 | 44 | ||
47 | RecBody body; | 45 | RecBody body; |
48 | mailmessage * mailmsg; | 46 | mailmessage * mailmsg; |
49 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { | 47 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { |
50 | qDebug("Message to large: %i",mail.Msgsize()); | 48 | qDebug("Message to large: %i",mail.Msgsize()); |
51 | return body; | 49 | return body; |
52 | } | 50 | } |
53 | 51 | ||
54 | QFile msg_cache(msgTempName); | 52 | QFile msg_cache(msgTempName); |
55 | 53 | ||
56 | cleanMimeCache(); | 54 | cleanMimeCache(); |
57 | 55 | ||
58 | if (mail.getNumber()!=last_msg_id) { | 56 | if (mail.getNumber()!=last_msg_id) { |
59 | if (msg_cache.exists()) { | 57 | if (msg_cache.exists()) { |
60 | msg_cache.remove(); | 58 | msg_cache.remove(); |
61 | } | 59 | } |
62 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 60 | msg_cache.open(IO_ReadWrite|IO_Truncate); |
63 | last_msg_id = mail.getNumber(); | 61 | last_msg_id = mail.getNumber(); |
64 | err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); | 62 | err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); |
65 | err = mailmessage_fetch(mailmsg,&message,&length); | 63 | err = mailmessage_fetch(mailmsg,&message,&length); |
66 | msg_cache.writeBlock(message,length); | 64 | msg_cache.writeBlock(message,length); |
67 | } else { | 65 | } else { |
68 | QString msg=""; | 66 | QString msg=""; |
69 | msg_cache.open(IO_ReadOnly); | 67 | msg_cache.open(IO_ReadOnly); |
70 | message = new char[4096]; | 68 | message = new char[4096]; |
71 | memset(message,0,4096); | 69 | memset(message,0,4096); |
72 | while (msg_cache.readBlock(message,4095)>0) { | 70 | while (msg_cache.readBlock(message,4095)>0) { |
73 | msg+=message; | 71 | msg+=message; |
74 | memset(message,0,4096); | 72 | memset(message,0,4096); |
75 | } | 73 | } |
76 | delete message; | 74 | delete message; |
77 | message = (char*)malloc(msg.length()+1*sizeof(char)); | 75 | message = (char*)malloc(msg.length()+1*sizeof(char)); |
78 | memset(message,0,msg.length()+1); | 76 | memset(message,0,msg.length()+1); |
79 | memcpy(message,msg.latin1(),msg.length()); | 77 | memcpy(message,msg.latin1(),msg.length()); |
80 | /* transform to libetpan stuff */ | 78 | /* transform to libetpan stuff */ |
81 | mailmsg = mailmessage_new(); | 79 | mailmsg = mailmessage_new(); |
82 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | 80 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); |
83 | generic_message_t * msg_data; | 81 | generic_message_t * msg_data; |
84 | msg_data = (generic_message_t *)mailmsg->msg_data; | 82 | msg_data = (generic_message_t *)mailmsg->msg_data; |
85 | msg_data->msg_fetched = 1; | 83 | msg_data->msg_fetched = 1; |
86 | msg_data->msg_message = message; | 84 | msg_data->msg_message = message; |
87 | msg_data->msg_length = strlen(message); | 85 | msg_data->msg_length = strlen(message); |
88 | } | 86 | } |
89 | body = parseMail(mailmsg); | 87 | body = parseMail(mailmsg); |
90 | 88 | ||
91 | /* clean up */ | 89 | /* clean up */ |
92 | if (mailmsg) | 90 | if (mailmsg) |
93 | mailmessage_free(mailmsg); | 91 | mailmessage_free(mailmsg); |
94 | if (message) | 92 | if (message) |
95 | free(message); | 93 | free(message); |
96 | 94 | ||
97 | return body; | 95 | return body; |
98 | } | 96 | } |
99 | 97 | ||
100 | 98 | ||
101 | void NNTPwrapper::listMessages(const QString &, QList<RecMail> &target ) | 99 | void NNTPwrapper::listMessages(const QString &, QList<RecMail> &target ) |
102 | { | 100 | { |
103 | login(); | 101 | login(); |
104 | if (!m_nntp) | 102 | if (!m_nntp) |
105 | return; | 103 | return; |
106 | uint32_t res_messages,res_recent,res_unseen; | 104 | uint32_t res_messages,res_recent,res_unseen; |
107 | mailsession_status_folder(m_nntp->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 105 | mailsession_status_folder(m_nntp->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
108 | parseList(target,m_nntp->sto_session,"INBOX"); | 106 | parseList(target,m_nntp->sto_session,"INBOX"); |
109 | } | 107 | } |
110 | 108 | ||
111 | void NNTPwrapper::login() | 109 | void NNTPwrapper::login() |
112 | { | 110 | { |
113 | if (account->getOffline()) | 111 | if (account->getOffline()) |
114 | return; | 112 | return; |
115 | /* we'll hold the line */ | 113 | /* we'll hold the line */ |
116 | if ( m_nntp != NULL ) | 114 | if ( m_nntp != NULL ) |
117 | return; | 115 | return; |
118 | 116 | ||
119 | const char *server, *user, *pass; | 117 | const char *server, *user, *pass; |
120 | QString User,Pass; | 118 | QString User,Pass; |
121 | uint16_t port; | 119 | uint16_t port; |
122 | int err = NEWSNNTP_NO_ERROR; | 120 | int err = NEWSNNTP_NO_ERROR; |
123 | 121 | ||
124 | server = account->getServer().latin1(); | 122 | server = account->getServer().latin1(); |
125 | port = account->getPort().toUInt(); | 123 | port = account->getPort().toUInt(); |
126 | 124 | ||
127 | user = pass = 0; | 125 | user = pass = 0; |
128 | 126 | ||
129 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 127 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
130 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 128 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
131 | login.show(); | 129 | login.show(); |
132 | if ( QDialog::Accepted == login.exec() ) { | 130 | if ( QDialog::Accepted == login.exec() ) { |
133 | // ok | 131 | // ok |
134 | User = login.getUser().latin1(); | 132 | User = login.getUser().latin1(); |
135 | Pass = login.getPassword().latin1(); | 133 | Pass = login.getPassword().latin1(); |
136 | } else { | 134 | } else { |
137 | // cancel | 135 | // cancel |
138 | qDebug( "NNTP: Login canceled" ); | 136 | qDebug( "NNTP: Login canceled" ); |
139 | return; | 137 | return; |
140 | } | 138 | } |
141 | } else { | 139 | } else { |
142 | User = account->getUser().latin1(); | 140 | User = account->getUser().latin1(); |
143 | Pass = account->getPassword().latin1(); | 141 | Pass = account->getPassword().latin1(); |
144 | } | 142 | } |
145 | 143 | ||
146 | if (User.isEmpty()) { | 144 | if (User.isEmpty()) { |
147 | user=0; | 145 | user=0; |
148 | pass = 0; | 146 | pass = 0; |
149 | } else { | 147 | } else { |
150 | user=User.latin1(); | 148 | user=User.latin1(); |
151 | pass=Pass.latin1(); | 149 | pass=Pass.latin1(); |
152 | } | 150 | } |
153 | // bool ssl = account->getSSL(); | 151 | // bool ssl = account->getSSL(); |
154 | 152 | ||
155 | m_nntp=mailstorage_new(NULL); | 153 | m_nntp=mailstorage_new(NULL); |
156 | 154 | ||
157 | int conntypeset = account->ConnectionType(); | 155 | int conntypeset = account->ConnectionType(); |
158 | int conntype = 0; | 156 | int conntype = 0; |
159 | if ( conntypeset == 3 ) { | 157 | if ( conntypeset == 3 ) { |
160 | conntype = CONNECTION_TYPE_COMMAND; | 158 | conntype = CONNECTION_TYPE_COMMAND; |
161 | } else if ( conntypeset == 2 ) { | 159 | } else if ( conntypeset == 2 ) { |
162 | conntype = CONNECTION_TYPE_TLS; | 160 | conntype = CONNECTION_TYPE_TLS; |
163 | } else if ( conntypeset == 1 ) { | 161 | } else if ( conntypeset == 1 ) { |
164 | conntype = CONNECTION_TYPE_STARTTLS; | 162 | conntype = CONNECTION_TYPE_STARTTLS; |
165 | } else if ( conntypeset == 0 ) { | 163 | } else if ( conntypeset == 0 ) { |
166 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 164 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
167 | } | 165 | } |
168 | 166 | ||
169 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, | 167 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, |
170 | (char*)user,(char*)pass,0,0,0); | 168 | (char*)user,(char*)pass,0,0,0); |
171 | 169 | ||
172 | err = mailstorage_connect( m_nntp ); | 170 | err = mailstorage_connect( m_nntp ); |
173 | 171 | ||
174 | if (err != NEWSNNTP_NO_ERROR) { | 172 | if (err != NEWSNNTP_NO_ERROR) { |
175 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | 173 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); |
176 | // Global::statusMessage(tr("Error initializing folder")); | 174 | // Global::statusMessage(tr("Error initializing folder")); |
177 | mailstorage_free(m_nntp); | 175 | mailstorage_free(m_nntp); |
178 | m_nntp = 0; | 176 | m_nntp = 0; |
179 | 177 | ||
180 | } | 178 | } |
181 | 179 | ||
182 | } | 180 | } |
183 | 181 | ||
184 | void NNTPwrapper::logout() | 182 | void NNTPwrapper::logout() |
185 | { | 183 | { |
186 | int err = NEWSNNTP_NO_ERROR; | 184 | int err = NEWSNNTP_NO_ERROR; |
187 | if ( m_nntp == NULL ) | 185 | if ( m_nntp == NULL ) |
188 | return; | 186 | return; |
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; |
230 | target_stat.message_recent = 0; | 222 | target_stat.message_recent = 0; |
231 | if (!m_nntp) | 223 | if (!m_nntp) |
232 | return; | 224 | return; |
233 | int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count, | 225 | int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count, |
234 | &target_stat.message_recent,&target_stat.message_unseen); | 226 | &target_stat.message_recent,&target_stat.message_unseen); |
235 | } | 227 | } |
236 | 228 | ||
237 | 229 | ||
238 | encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { | 230 | encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { |
239 | char*target=0; | 231 | char*target=0; |
240 | size_t length=0; | 232 | size_t length=0; |
241 | encodedString*res = 0; | 233 | encodedString*res = 0; |
242 | mailmessage * mailmsg = 0; | 234 | mailmessage * mailmsg = 0; |
243 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); | 235 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); |
244 | err = mailmessage_fetch(mailmsg,&target,&length); | 236 | err = mailmessage_fetch(mailmsg,&target,&length); |
245 | if (mailmsg) | 237 | if (mailmsg) |
246 | mailmessage_free(mailmsg); | 238 | mailmessage_free(mailmsg); |
247 | if (target) { | 239 | if (target) { |
248 | res = new encodedString(target,length); | 240 | res = new encodedString(target,length); |
249 | } | 241 | } |
250 | return res; | 242 | return res; |
251 | } | 243 | } |
252 | 244 | ||
253 | const QString&NNTPwrapper::getType()const { | 245 | const QString&NNTPwrapper::getType()const { |
254 | return account->getType(); | 246 | return account->getType(); |
255 | } | 247 | } |
256 | 248 | ||
257 | const QString&NNTPwrapper::getName()const{ | 249 | const QString&NNTPwrapper::getName()const{ |
258 | return account->getAccountName(); | 250 | return account->getAccountName(); |
259 | } | 251 | } |
260 | 252 | ||
261 | void NNTPwrapper::deleteMail(const RecMail&mail) { | 253 | void NNTPwrapper::deleteMail(const RecMail&mail) { |
262 | } | 254 | } |
263 | 255 | ||
264 | int NNTPwrapper::deleteAllMail(const Folder*) { | 256 | int NNTPwrapper::deleteAllMail(const Folder*) { |
265 | } | 257 | } |
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 | |||
@@ -1,48 +1,48 @@ | |||
1 | #ifndef __NNTPWRAPPER | 1 | #ifndef __NNTPWRAPPER |
2 | #define __NNTPWRAPPER | 2 | #define __NNTPWRAPPER |
3 | 3 | ||
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | #include "genericwrapper.h" | 5 | #include "genericwrapper.h" |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <libetpan/clist.h> | 7 | #include <libetpan/clist.h> |
8 | 8 | ||
9 | class encodedString; | 9 | class encodedString; |
10 | struct mailstorage; | 10 | struct mailstorage; |
11 | struct mailfolder; | 11 | struct mailfolder; |
12 | 12 | ||
13 | class NNTPwrapper : public Genericwrapper | 13 | class NNTPwrapper : public Genericwrapper |
14 | { | 14 | { |
15 | 15 | ||
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | 17 | ||
18 | public: | 18 | public: |
19 | NNTPwrapper( NNTPaccount *a ); | 19 | NNTPwrapper( NNTPaccount *a ); |
20 | virtual ~NNTPwrapper(); | 20 | virtual ~NNTPwrapper(); |
21 | 21 | ||
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); |
35 | virtual void logout(); | 35 | virtual void logout(); |
36 | virtual const QString&getType()const; | 36 | virtual const QString&getType()const; |
37 | virtual const QString&getName()const; | 37 | virtual const QString&getName()const; |
38 | static void nntp_progress( size_t current, size_t maximum ); | 38 | static void nntp_progress( size_t current, size_t maximum ); |
39 | 39 | ||
40 | protected: | 40 | protected: |
41 | void login(); | 41 | void login(); |
42 | NNTPaccount *account; | 42 | NNTPaccount *account; |
43 | mailstorage* m_nntp; | 43 | mailstorage* m_nntp; |
44 | 44 | ||
45 | 45 | ||
46 | }; | 46 | }; |
47 | 47 | ||
48 | #endif | 48 | #endif |
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 | |||
@@ -1,110 +1,110 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NNTPconfigUI</class> | 2 | <class>NNTPconfigUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NNTPconfigUI</cstring> | 7 | <cstring>NNTPconfigUI</cstring> |
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> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget2</cstring> | 41 | <cstring>TabWidget2</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tab</cstring> | 53 | <cstring>tab</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Account</string> | 57 | <string>Account</string> |
58 | </attribute> | 58 | </attribute> |
59 | <grid> | 59 | <grid> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>3</number> | 62 | <number>3</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>3</number> | 66 | <number>3</number> |
67 | </property> | 67 | </property> |
68 | <widget row="2" column="1" > | 68 | <widget row="2" column="1" > |
69 | <class>QLineEdit</class> | 69 | <class>QLineEdit</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>serverLine</cstring> | 72 | <cstring>serverLine</cstring> |
73 | </property> | 73 | </property> |
74 | </widget> | 74 | </widget> |
75 | <widget row="3" column="0" > | 75 | <widget row="3" column="0" > |
76 | <class>QLabel</class> | 76 | <class>QLabel</class> |
77 | <property stdset="1"> | 77 | <property stdset="1"> |
78 | <name>name</name> | 78 | <name>name</name> |
79 | <cstring>portLabel</cstring> | 79 | <cstring>portLabel</cstring> |
80 | </property> | 80 | </property> |
81 | <property stdset="1"> | 81 | <property stdset="1"> |
82 | <name>text</name> | 82 | <name>text</name> |
83 | <string>Port</string> | 83 | <string>Port</string> |
84 | </property> | 84 | </property> |
85 | </widget> | 85 | </widget> |
86 | <widget row="3" column="1" > | 86 | <widget row="3" column="1" > |
87 | <class>QLineEdit</class> | 87 | <class>QLineEdit</class> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
89 | <name>name</name> | 89 | <name>name</name> |
90 | <cstring>portLine</cstring> | 90 | <cstring>portLine</cstring> |
91 | </property> | 91 | </property> |
92 | </widget> | 92 | </widget> |
93 | <widget row="0" column="1" > | 93 | <widget row="0" column="1" > |
94 | <class>QLineEdit</class> | 94 | <class>QLineEdit</class> |
95 | <property stdset="1"> | 95 | <property stdset="1"> |
96 | <name>name</name> | 96 | <name>name</name> |
97 | <cstring>accountLine</cstring> | 97 | <cstring>accountLine</cstring> |
98 | </property> | 98 | </property> |
99 | <property> | 99 | <property> |
100 | <name>toolTip</name> | 100 | <name>toolTip</name> |
101 | <string>Name of the Account</string> | 101 | <string>Name of the Account</string> |
102 | </property> | 102 | </property> |
103 | </widget> | 103 | </widget> |
104 | <widget row="0" column="0" > | 104 | <widget row="0" column="0" > |
105 | <class>QLabel</class> | 105 | <class>QLabel</class> |
106 | <property stdset="1"> | 106 | <property stdset="1"> |
107 | <name>name</name> | 107 | <name>name</name> |
108 | <cstring>accountLabel</cstring> | 108 | <cstring>accountLabel</cstring> |
109 | </property> | 109 | </property> |
110 | <property stdset="1"> | 110 | <property stdset="1"> |
@@ -204,149 +204,141 @@ | |||
204 | <name>text</name> | 204 | <name>text</name> |
205 | <string>User</string> | 205 | <string>User</string> |
206 | </property> | 206 | </property> |
207 | </widget> | 207 | </widget> |
208 | <widget row="8" column="0" > | 208 | <widget row="8" column="0" > |
209 | <class>QLabel</class> | 209 | <class>QLabel</class> |
210 | <property stdset="1"> | 210 | <property stdset="1"> |
211 | <name>name</name> | 211 | <name>name</name> |
212 | <cstring>passLabel</cstring> | 212 | <cstring>passLabel</cstring> |
213 | </property> | 213 | </property> |
214 | <property stdset="1"> | 214 | <property stdset="1"> |
215 | <name>text</name> | 215 | <name>text</name> |
216 | <string>Password</string> | 216 | <string>Password</string> |
217 | </property> | 217 | </property> |
218 | </widget> | 218 | </widget> |
219 | <spacer row="9" column="1" > | 219 | <spacer row="9" column="1" > |
220 | <property> | 220 | <property> |
221 | <name>name</name> | 221 | <name>name</name> |
222 | <cstring>spacer</cstring> | 222 | <cstring>spacer</cstring> |
223 | </property> | 223 | </property> |
224 | <property stdset="1"> | 224 | <property stdset="1"> |
225 | <name>orientation</name> | 225 | <name>orientation</name> |
226 | <enum>Vertical</enum> | 226 | <enum>Vertical</enum> |
227 | </property> | 227 | </property> |
228 | <property stdset="1"> | 228 | <property stdset="1"> |
229 | <name>sizeType</name> | 229 | <name>sizeType</name> |
230 | <enum>Expanding</enum> | 230 | <enum>Expanding</enum> |
231 | </property> | 231 | </property> |
232 | <property> | 232 | <property> |
233 | <name>sizeHint</name> | 233 | <name>sizeHint</name> |
234 | <size> | 234 | <size> |
235 | <width>20</width> | 235 | <width>20</width> |
236 | <height>20</height> | 236 | <height>20</height> |
237 | </size> | 237 | </size> |
238 | </property> | 238 | </property> |
239 | </spacer> | 239 | </spacer> |
240 | <widget row="6" column="1" > | 240 | <widget row="6" column="1" > |
241 | <class>QCheckBox</class> | 241 | <class>QCheckBox</class> |
242 | <property stdset="1"> | 242 | <property stdset="1"> |
243 | <name>name</name> | 243 | <name>name</name> |
244 | <cstring>loginBox</cstring> | 244 | <cstring>loginBox</cstring> |
245 | </property> | 245 | </property> |
246 | <property stdset="1"> | 246 | <property stdset="1"> |
247 | <name>text</name> | 247 | <name>text</name> |
248 | <string>Use Login</string> | 248 | <string>Use Login</string> |
249 | </property> | 249 | </property> |
250 | </widget> | 250 | </widget> |
251 | <widget row="7" column="1" > | 251 | <widget row="7" column="1" > |
252 | <class>QLineEdit</class> | 252 | <class>QLineEdit</class> |
253 | <property stdset="1"> | 253 | <property stdset="1"> |
254 | <name>name</name> | 254 | <name>name</name> |
255 | <cstring>userLine</cstring> | 255 | <cstring>userLine</cstring> |
256 | </property> | 256 | </property> |
257 | <property stdset="1"> | 257 | <property stdset="1"> |
258 | <name>enabled</name> | 258 | <name>enabled</name> |
259 | <bool>false</bool> | 259 | <bool>false</bool> |
260 | </property> | 260 | </property> |
261 | </widget> | 261 | </widget> |
262 | <widget row="8" column="1" > | 262 | <widget row="8" column="1" > |
263 | <class>QLineEdit</class> | 263 | <class>QLineEdit</class> |
264 | <property stdset="1"> | 264 | <property stdset="1"> |
265 | <name>name</name> | 265 | <name>name</name> |
266 | <cstring>passLine</cstring> | 266 | <cstring>passLine</cstring> |
267 | </property> | 267 | </property> |
268 | <property stdset="1"> | 268 | <property stdset="1"> |
269 | <name>enabled</name> | 269 | <name>enabled</name> |
270 | <bool>false</bool> | 270 | <bool>false</bool> |
271 | </property> | 271 | </property> |
272 | <property stdset="1"> | 272 | <property stdset="1"> |
273 | <name>echoMode</name> | 273 | <name>echoMode</name> |
274 | <enum>Password</enum> | 274 | <enum>Password</enum> |
275 | </property> | 275 | </property> |
276 | </widget> | 276 | </widget> |
277 | </grid> | 277 | </grid> |
278 | </widget> | 278 | </widget> |
279 | <widget> | 279 | <widget> |
280 | <class>QWidget</class> | 280 | <class>QWidget</class> |
281 | <property stdset="1"> | 281 | <property stdset="1"> |
282 | <name>name</name> | 282 | <name>name</name> |
283 | <cstring>tab</cstring> | 283 | <cstring>tab</cstring> |
284 | </property> | 284 | </property> |
285 | <attribute> | 285 | <attribute> |
286 | <name>title</name> | 286 | <name>title</name> |
287 | <string>Groups</string> | 287 | <string>Groups</string> |
288 | </attribute> | 288 | </attribute> |
289 | <vbox> | 289 | <vbox> |
290 | <property stdset="1"> | 290 | <property stdset="1"> |
291 | <name>margin</name> | 291 | <name>margin</name> |
292 | <number>3</number> | 292 | <number>3</number> |
293 | </property> | 293 | </property> |
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> |
306 | <class>QPushButton</class> | 320 | <class>QPushButton</class> |
307 | <property stdset="1"> | 321 | <property stdset="1"> |
308 | <name>name</name> | 322 | <name>name</name> |
309 | <cstring>GetNGButton</cstring> | 323 | <cstring>GetNGButton</cstring> |
310 | </property> | 324 | </property> |
311 | <property stdset="1"> | 325 | <property stdset="1"> |
312 | <name>text</name> | 326 | <name>text</name> |
313 | <string>Get newsgroup list from server</string> | 327 | <string>Get newsgroup list from server</string> |
314 | </property> | 328 | </property> |
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> |
349 | <tabstop>userLine</tabstop> | 341 | <tabstop>userLine</tabstop> |
350 | <tabstop>passLine</tabstop> | 342 | <tabstop>passLine</tabstop> |
351 | </tabstops> | 343 | </tabstops> |
352 | </UI> | 344 | </UI> |