-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mail/editaccounts.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 4 |
4 files changed, 19 insertions, 4 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 2a1acc0..215380d 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -1,73 +1,74 @@ | |||
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 | #include <qstringlist.h> | ||
10 | 11 | ||
11 | #include <libmailwrapper/nntpwrapper.h> | 12 | #include <libmailwrapper/nntpwrapper.h> |
12 | 13 | ||
13 | #include <libetpan/nntpdriver.h> | 14 | #include <libetpan/nntpdriver.h> |
14 | 15 | ||
15 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 16 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
16 | : QListViewItem( parent ) | 17 | : QListViewItem( parent ) |
17 | { | 18 | { |
18 | account = a; | 19 | account = a; |
19 | setText( 0, account->getAccountName() ); | 20 | setText( 0, account->getAccountName() ); |
20 | setText( 1, account->getType() ); | 21 | setText( 1, account->getType() ); |
21 | } | 22 | } |
22 | 23 | ||
23 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 24 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
24 | : EditAccountsUI( parent, name, modal, flags ) | 25 | : EditAccountsUI( parent, name, modal, flags ) |
25 | { | 26 | { |
26 | qDebug( "New Account Configuration Widget" ); | 27 | qDebug( "New Account Configuration Widget" ); |
27 | settings = s; | 28 | settings = s; |
28 | 29 | ||
29 | mailList->addColumn( tr( "Account" ) ); | 30 | mailList->addColumn( tr( "Account" ) ); |
30 | mailList->addColumn( tr( "Type" ) ); | 31 | mailList->addColumn( tr( "Type" ) ); |
31 | 32 | ||
32 | newsList->addColumn( tr( "Account" ) ); | 33 | newsList->addColumn( tr( "Account" ) ); |
33 | 34 | ||
34 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 35 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
35 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 36 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
36 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 37 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
37 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 38 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
38 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 39 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
39 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 40 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
40 | 41 | ||
41 | slotFillLists(); | 42 | slotFillLists(); |
42 | } | 43 | } |
43 | 44 | ||
44 | void EditAccounts::slotFillLists() | 45 | void EditAccounts::slotFillLists() |
45 | { | 46 | { |
46 | mailList->clear(); | 47 | mailList->clear(); |
47 | newsList->clear(); | 48 | newsList->clear(); |
48 | 49 | ||
49 | QList<Account> accounts = settings->getAccounts(); | 50 | QList<Account> accounts = settings->getAccounts(); |
50 | Account *it; | 51 | Account *it; |
51 | for ( it = accounts.first(); it; it = accounts.next() ) | 52 | for ( it = accounts.first(); it; it = accounts.next() ) |
52 | { | 53 | { |
53 | if ( it->getType().compare( "NNTP" ) == 0 ) | 54 | if ( it->getType().compare( "NNTP" ) == 0 ) |
54 | { | 55 | { |
55 | (void) new AccountListItem( newsList, it ); | 56 | (void) new AccountListItem( newsList, it ); |
56 | } | 57 | } |
57 | else | 58 | else |
58 | { | 59 | { |
59 | (void) new AccountListItem( mailList, it ); | 60 | (void) new AccountListItem( mailList, it ); |
60 | } | 61 | } |
61 | } | 62 | } |
62 | } | 63 | } |
63 | 64 | ||
64 | void EditAccounts::slotNewMail() | 65 | void EditAccounts::slotNewMail() |
65 | { | 66 | { |
66 | qDebug( "New Mail Account" ); | 67 | qDebug( "New Mail Account" ); |
67 | QString *selection = new QString(); | 68 | QString *selection = new QString(); |
68 | SelectMailType selType( selection, this, 0, true ); | 69 | SelectMailType selType( selection, this, 0, true ); |
69 | selType.show(); | 70 | selType.show(); |
70 | if ( QDialog::Accepted == selType.exec() ) | 71 | if ( QDialog::Accepted == selType.exec() ) |
71 | { | 72 | { |
72 | slotNewAccount( *selection ); | 73 | slotNewAccount( *selection ); |
73 | } | 74 | } |
@@ -450,118 +451,125 @@ void SMTPconfig::slotConnectionToggle( int index ) | |||
450 | { | 451 | { |
451 | portLine->setText( SMTP_PORT ); | 452 | portLine->setText( SMTP_PORT ); |
452 | CommandEdit->show(); | 453 | CommandEdit->show(); |
453 | } | 454 | } |
454 | else | 455 | else |
455 | { | 456 | { |
456 | portLine->setText( SMTP_PORT ); | 457 | portLine->setText( SMTP_PORT ); |
457 | } | 458 | } |
458 | } | 459 | } |
459 | 460 | ||
460 | void SMTPconfig::fillValues() | 461 | void SMTPconfig::fillValues() |
461 | { | 462 | { |
462 | accountLine->setText( data->getAccountName() ); | 463 | accountLine->setText( data->getAccountName() ); |
463 | serverLine->setText( data->getServer() ); | 464 | serverLine->setText( data->getServer() ); |
464 | portLine->setText( data->getPort() ); | 465 | portLine->setText( data->getPort() ); |
465 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 466 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
466 | loginBox->setChecked( data->getLogin() ); | 467 | loginBox->setChecked( data->getLogin() ); |
467 | userLine->setText( data->getUser() ); | 468 | userLine->setText( data->getUser() ); |
468 | passLine->setText( data->getPassword() ); | 469 | passLine->setText( data->getPassword() ); |
469 | } | 470 | } |
470 | 471 | ||
471 | void SMTPconfig::accept() | 472 | void SMTPconfig::accept() |
472 | { | 473 | { |
473 | data->setAccountName( accountLine->text() ); | 474 | data->setAccountName( accountLine->text() ); |
474 | data->setServer( serverLine->text() ); | 475 | data->setServer( serverLine->text() ); |
475 | data->setPort( portLine->text() ); | 476 | data->setPort( portLine->text() ); |
476 | data->setConnectionType( ComboBox1->currentItem() ); | 477 | data->setConnectionType( ComboBox1->currentItem() ); |
477 | data->setLogin( loginBox->isChecked() ); | 478 | data->setLogin( loginBox->isChecked() ); |
478 | data->setUser( userLine->text() ); | 479 | data->setUser( userLine->text() ); |
479 | data->setPassword( passLine->text() ); | 480 | data->setPassword( passLine->text() ); |
480 | 481 | ||
481 | QDialog::accept(); | 482 | QDialog::accept(); |
482 | } | 483 | } |
483 | 484 | ||
484 | /** | 485 | /** |
485 | * NNTPconfig | 486 | * NNTPconfig |
486 | */ | 487 | */ |
487 | 488 | ||
488 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 489 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
489 | : NNTPconfigUI( parent, name, modal, flags ) | 490 | : NNTPconfigUI( parent, name, modal, flags ) |
490 | { | 491 | { |
491 | data = account; | 492 | data = account; |
492 | 493 | ||
493 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 494 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
494 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 495 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
495 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 496 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
496 | fillValues(); | 497 | fillValues(); |
497 | 498 | ||
498 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 499 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
499 | } | 500 | } |
500 | 501 | ||
501 | void NNTPconfig::slotGetNG() { | 502 | void NNTPconfig::slotGetNG() { |
502 | save(); | 503 | save(); |
503 | data->save(); | 504 | data->save(); |
504 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 505 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
505 | clist* list = tmp->listAllNewsgroups(); | 506 | clist* list = tmp->listAllNewsgroups(); |
506 | 507 | ||
507 | clistcell *current; | 508 | clistcell *current; |
508 | newsnntp_group_description *group; | 509 | newsnntp_group_description *group; |
509 | 510 | ||
510 | // FIXME - test if not empty | 511 | // FIXME - test if not empty |
511 | current = list->first; | 512 | current = list->first; |
512 | for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) { | 513 | for ( current=clist_begin(list);current!=NULL;current=clist_next(current) ) { |
513 | group = ( newsnntp_group_description* ) current->data; | 514 | group = ( newsnntp_group_description* ) current->data; |
514 | qDebug( group->grp_name ); | 515 | // qDebug( group->grp_name ); |
515 | 516 | ||
516 | QCheckListItem *item; | 517 | QCheckListItem *item; |
517 | item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); | 518 | item = new QCheckListItem( ListViewGroups, ( QString )group->grp_name, QCheckListItem::CheckBox ); |
519 | if ( subscribedGroups.contains( ( QString )group->grp_name ) >= 1 ) { | ||
520 | item->setSelected( true ); | ||
521 | } | ||
518 | } | 522 | } |
519 | } | 523 | } |
520 | 524 | ||
521 | void NNTPconfig::slotSSL( bool enabled ) | 525 | void NNTPconfig::slotSSL( bool enabled ) |
522 | { | 526 | { |
523 | if ( enabled ) | 527 | if ( enabled ) |
524 | { | 528 | { |
525 | portLine->setText( NNTP_SSL_PORT ); | 529 | portLine->setText( NNTP_SSL_PORT ); |
526 | } | 530 | } |
527 | else | 531 | else |
528 | { | 532 | { |
529 | portLine->setText( NNTP_PORT ); | 533 | portLine->setText( NNTP_PORT ); |
530 | } | 534 | } |
531 | } | 535 | } |
532 | 536 | ||
533 | void NNTPconfig::fillValues() | 537 | void NNTPconfig::fillValues() |
534 | { | 538 | { |
535 | accountLine->setText( data->getAccountName() ); | 539 | accountLine->setText( data->getAccountName() ); |
536 | serverLine->setText( data->getServer() ); | 540 | serverLine->setText( data->getServer() ); |
537 | portLine->setText( data->getPort() ); | 541 | portLine->setText( data->getPort() ); |
538 | sslBox->setChecked( data->getSSL() ); | 542 | sslBox->setChecked( data->getSSL() ); |
539 | loginBox->setChecked( data->getLogin() ); | 543 | loginBox->setChecked( data->getLogin() ); |
540 | userLine->setText( data->getUser() ); | 544 | userLine->setText( data->getUser() ); |
541 | passLine->setText( data->getPassword() ); | 545 | passLine->setText( data->getPassword() ); |
546 | subscribedGroups = data->getGroups(); | ||
542 | } | 547 | } |
543 | 548 | ||
544 | void NNTPconfig::save() | 549 | void NNTPconfig::save() |
545 | { | 550 | { |
546 | data->setAccountName( accountLine->text() ); | 551 | data->setAccountName( accountLine->text() ); |
547 | data->setServer( serverLine->text() ); | 552 | data->setServer( serverLine->text() ); |
548 | data->setPort( portLine->text() ); | 553 | data->setPort( portLine->text() ); |
549 | data->setSSL( sslBox->isChecked() ); | 554 | data->setSSL( sslBox->isChecked() ); |
550 | data->setLogin( loginBox->isChecked() ); | 555 | data->setLogin( loginBox->isChecked() ); |
551 | data->setUser( userLine->text() ); | 556 | data->setUser( userLine->text() ); |
552 | data->setPassword( passLine->text() ); | 557 | data->setPassword( passLine->text() ); |
553 | 558 | ||
554 | QListViewItemIterator list_it( ListViewGroups ); | 559 | QListViewItemIterator list_it( ListViewGroups ); |
555 | for ( ; list_it.current(); ++list_it ) { | 560 | for ( ; list_it.current(); ++list_it ) { |
561 | QStringList groupList; | ||
556 | if ( list_it.current()->isSelected() ) { | 562 | if ( list_it.current()->isSelected() ) { |
557 | qDebug( list_it.current()->text(0) ); | 563 | qDebug(list_it.current()->text(0) ); |
564 | groupList.append( list_it.current()->text(0) ); | ||
558 | } | 565 | } |
566 | data->setGroups( groupList ); | ||
559 | } | 567 | } |
560 | } | 568 | } |
561 | 569 | ||
562 | void NNTPconfig::accept() | 570 | void NNTPconfig::accept() |
563 | { | 571 | { |
564 | save(); | 572 | save(); |
565 | QDialog::accept(); | 573 | QDialog::accept(); |
566 | } | 574 | } |
567 | 575 | ||
diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h index 438a984..a9eb19f 100644 --- a/noncore/net/mail/editaccounts.h +++ b/noncore/net/mail/editaccounts.h | |||
@@ -82,71 +82,72 @@ public slots: | |||
82 | 82 | ||
83 | protected slots: | 83 | protected slots: |
84 | void slotConnectionToggle( int index ); | 84 | void slotConnectionToggle( int index ); |
85 | void accept(); | 85 | void accept(); |
86 | 86 | ||
87 | private: | 87 | private: |
88 | IMAPaccount *data; | 88 | IMAPaccount *data; |
89 | 89 | ||
90 | }; | 90 | }; |
91 | 91 | ||
92 | class POP3config : public POP3configUI | 92 | class POP3config : public POP3configUI |
93 | { | 93 | { |
94 | Q_OBJECT | 94 | Q_OBJECT |
95 | 95 | ||
96 | public: | 96 | public: |
97 | 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 ); |
98 | 98 | ||
99 | public slots: | 99 | public slots: |
100 | void fillValues(); | 100 | void fillValues(); |
101 | 101 | ||
102 | protected slots: | 102 | protected slots: |
103 | void slotConnectionToggle( int index ); | 103 | void slotConnectionToggle( int index ); |
104 | void accept(); | 104 | void accept(); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | POP3account *data; | 107 | POP3account *data; |
108 | 108 | ||
109 | }; | 109 | }; |
110 | 110 | ||
111 | class SMTPconfig : public SMTPconfigUI | 111 | class SMTPconfig : public SMTPconfigUI |
112 | { | 112 | { |
113 | Q_OBJECT | 113 | Q_OBJECT |
114 | 114 | ||
115 | public: | 115 | public: |
116 | 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 ); |
117 | 117 | ||
118 | public slots: | 118 | public slots: |
119 | void fillValues(); | 119 | void fillValues(); |
120 | 120 | ||
121 | protected slots: | 121 | protected slots: |
122 | void slotConnectionToggle( int index ); | 122 | void slotConnectionToggle( int index ); |
123 | void accept(); | 123 | void accept(); |
124 | 124 | ||
125 | private: | 125 | private: |
126 | SMTPaccount *data; | 126 | SMTPaccount *data; |
127 | 127 | ||
128 | }; | 128 | }; |
129 | 129 | ||
130 | class NNTPconfig : public NNTPconfigUI | 130 | class NNTPconfig : public NNTPconfigUI |
131 | { | 131 | { |
132 | Q_OBJECT | 132 | Q_OBJECT |
133 | 133 | ||
134 | public: | 134 | public: |
135 | 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 ); |
136 | 136 | ||
137 | public slots: | 137 | public slots: |
138 | void fillValues(); | 138 | void fillValues(); |
139 | 139 | ||
140 | protected slots: | 140 | protected slots: |
141 | void slotSSL( bool enabled ); | 141 | void slotSSL( bool enabled ); |
142 | void accept(); | 142 | void accept(); |
143 | void slotGetNG(); | 143 | void slotGetNG(); |
144 | 144 | ||
145 | private: | 145 | private: |
146 | QStringList subscribedGroups; | ||
146 | void save(); | 147 | void save(); |
147 | NNTPaccount *data; | 148 | NNTPaccount *data; |
148 | clist* list; | 149 | clist* list; |
149 | 150 | ||
150 | }; | 151 | }; |
151 | 152 | ||
152 | #endif | 153 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 65ca387..f64c17d 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -349,91 +349,93 @@ void SMTPaccount::save() | |||
349 | conf->writeEntry( "Port", port ); | 349 | conf->writeEntry( "Port", port ); |
350 | conf->writeEntry( "SSL", ssl ); | 350 | conf->writeEntry( "SSL", ssl ); |
351 | conf->writeEntry( "ConnectionType", connectionType ); | 351 | conf->writeEntry( "ConnectionType", connectionType ); |
352 | conf->writeEntry( "Login", login ); | 352 | conf->writeEntry( "Login", login ); |
353 | conf->writeEntry( "User", user ); | 353 | conf->writeEntry( "User", user ); |
354 | conf->writeEntryCrypt( "Password", password ); | 354 | conf->writeEntryCrypt( "Password", password ); |
355 | conf->write(); | 355 | conf->write(); |
356 | delete conf; | 356 | delete conf; |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | QString SMTPaccount::getFileName() | 360 | QString SMTPaccount::getFileName() |
361 | { | 361 | { |
362 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 362 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
363 | } | 363 | } |
364 | 364 | ||
365 | NNTPaccount::NNTPaccount() | 365 | NNTPaccount::NNTPaccount() |
366 | : Account() | 366 | : Account() |
367 | { | 367 | { |
368 | file = NNTPaccount::getUniqueFileName(); | 368 | file = NNTPaccount::getUniqueFileName(); |
369 | accountName = "New NNTP Account"; | 369 | accountName = "New NNTP Account"; |
370 | ssl = false; | 370 | ssl = false; |
371 | login = false; | 371 | login = false; |
372 | type = "NNTP"; | 372 | type = "NNTP"; |
373 | port = NNTP_PORT; | 373 | port = NNTP_PORT; |
374 | } | 374 | } |
375 | 375 | ||
376 | NNTPaccount::NNTPaccount( QString filename ) | 376 | NNTPaccount::NNTPaccount( QString filename ) |
377 | : Account() | 377 | : Account() |
378 | { | 378 | { |
379 | file = filename; | 379 | file = filename; |
380 | accountName = "New NNTP Account"; | 380 | accountName = "New NNTP Account"; |
381 | ssl = false; | 381 | ssl = false; |
382 | login = false; | 382 | login = false; |
383 | type = "NNTP"; | 383 | type = "NNTP"; |
384 | port = NNTP_PORT; | 384 | port = NNTP_PORT; |
385 | } | 385 | } |
386 | 386 | ||
387 | QString NNTPaccount::getUniqueFileName() | 387 | QString NNTPaccount::getUniqueFileName() |
388 | { | 388 | { |
389 | int num = 0; | 389 | int num = 0; |
390 | QString unique; | 390 | QString unique; |
391 | 391 | ||
392 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 392 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
393 | 393 | ||
394 | QStringList imap = dir.entryList( "nntp-*" ); | 394 | QStringList imap = dir.entryList( "nntp-*" ); |
395 | do { | 395 | do { |
396 | unique.setNum( num++ ); | 396 | unique.setNum( num++ ); |
397 | } while ( imap.contains( "nntp-" + unique ) > 0 ); | 397 | } while ( imap.contains( "nntp-" + unique ) > 0 ); |
398 | 398 | ||
399 | return unique; | 399 | return unique; |
400 | } | 400 | } |
401 | 401 | ||
402 | void NNTPaccount::read() | 402 | void NNTPaccount::read() |
403 | { | 403 | { |
404 | Config *conf = new Config( getFileName(), Config::File ); | 404 | Config *conf = new Config( getFileName(), Config::File ); |
405 | conf->setGroup( "NNTP Account" ); | 405 | conf->setGroup( "NNTP Account" ); |
406 | accountName = conf->readEntry( "Account" ); | 406 | accountName = conf->readEntry( "Account" ); |
407 | server = conf->readEntry( "Server" ); | 407 | server = conf->readEntry( "Server" ); |
408 | port = conf->readEntry( "Port" ); | 408 | port = conf->readEntry( "Port" ); |
409 | ssl = conf->readBoolEntry( "SSL" ); | 409 | ssl = conf->readBoolEntry( "SSL" ); |
410 | login = conf->readBoolEntry( "Login" ); | 410 | login = conf->readBoolEntry( "Login" ); |
411 | user = conf->readEntry( "User" ); | 411 | user = conf->readEntry( "User" ); |
412 | password = conf->readEntryCrypt( "Password" ); | 412 | password = conf->readEntryCrypt( "Password" ); |
413 | subscribedGroups = conf->readListEntry( "Subscribed", ',' ); | ||
413 | delete conf; | 414 | delete conf; |
414 | } | 415 | } |
415 | 416 | ||
416 | void NNTPaccount::save() | 417 | void NNTPaccount::save() |
417 | { | 418 | { |
418 | qDebug( "saving " + getFileName() ); | 419 | qDebug( "saving " + getFileName() ); |
419 | Settings::checkDirectory(); | 420 | Settings::checkDirectory(); |
420 | 421 | ||
421 | Config *conf = new Config( getFileName(), Config::File ); | 422 | Config *conf = new Config( getFileName(), Config::File ); |
422 | conf->setGroup( "NNTP Account" ); | 423 | conf->setGroup( "NNTP Account" ); |
423 | conf->writeEntry( "Account", accountName ); | 424 | conf->writeEntry( "Account", accountName ); |
424 | conf->writeEntry( "Server", server ); | 425 | conf->writeEntry( "Server", server ); |
425 | conf->writeEntry( "Port", port ); | 426 | conf->writeEntry( "Port", port ); |
426 | conf->writeEntry( "SSL", ssl ); | 427 | conf->writeEntry( "SSL", ssl ); |
427 | conf->writeEntry( "Login", login ); | 428 | conf->writeEntry( "Login", login ); |
428 | conf->writeEntry( "User", user ); | 429 | conf->writeEntry( "User", user ); |
429 | conf->writeEntryCrypt( "Password", password ); | 430 | conf->writeEntryCrypt( "Password", password ); |
431 | conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); | ||
430 | conf->write(); | 432 | conf->write(); |
431 | delete conf; | 433 | delete conf; |
432 | } | 434 | } |
433 | 435 | ||
434 | 436 | ||
435 | QString NNTPaccount::getFileName() | 437 | QString NNTPaccount::getFileName() |
436 | { | 438 | { |
437 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; | 439 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; |
438 | } | 440 | } |
439 | 441 | ||
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h index 8d7df92..1feedbf 100644 --- a/noncore/net/mail/libmailwrapper/settings.h +++ b/noncore/net/mail/libmailwrapper/settings.h | |||
@@ -65,90 +65,94 @@ public: | |||
65 | void setPrefix(const QString&str) {prefix=str;} | 65 | void setPrefix(const QString&str) {prefix=str;} |
66 | const QString&getPrefix()const{return prefix;} | 66 | const QString&getPrefix()const{return prefix;} |
67 | 67 | ||
68 | private: | 68 | private: |
69 | QString file,prefix; | 69 | QString file,prefix; |
70 | 70 | ||
71 | }; | 71 | }; |
72 | 72 | ||
73 | class POP3account : public Account | 73 | class POP3account : public Account |
74 | { | 74 | { |
75 | 75 | ||
76 | public: | 76 | public: |
77 | POP3account(); | 77 | POP3account(); |
78 | POP3account( QString filename ); | 78 | POP3account( QString filename ); |
79 | 79 | ||
80 | static QString getUniqueFileName(); | 80 | static QString getUniqueFileName(); |
81 | 81 | ||
82 | virtual void read(); | 82 | virtual void read(); |
83 | virtual void save(); | 83 | virtual void save(); |
84 | virtual QString getFileName(); | 84 | virtual QString getFileName(); |
85 | 85 | ||
86 | private: | 86 | private: |
87 | QString file; | 87 | QString file; |
88 | 88 | ||
89 | }; | 89 | }; |
90 | 90 | ||
91 | class SMTPaccount : public Account | 91 | class SMTPaccount : public Account |
92 | { | 92 | { |
93 | 93 | ||
94 | public: | 94 | public: |
95 | SMTPaccount(); | 95 | SMTPaccount(); |
96 | SMTPaccount( QString filename ); | 96 | SMTPaccount( QString filename ); |
97 | 97 | ||
98 | static QString getUniqueFileName(); | 98 | static QString getUniqueFileName(); |
99 | 99 | ||
100 | virtual void read(); | 100 | virtual void read(); |
101 | virtual void save(); | 101 | virtual void save(); |
102 | virtual QString getFileName(); | 102 | virtual QString getFileName(); |
103 | 103 | ||
104 | void setLogin( bool b ) { login = b; } | 104 | void setLogin( bool b ) { login = b; } |
105 | bool getLogin() { return login; } | 105 | bool getLogin() { return login; } |
106 | 106 | ||
107 | private: | 107 | private: |
108 | QString file, name, mail, org, cc, bcc, reply, signature; | 108 | QString file, name, mail, org, cc, bcc, reply, signature; |
109 | bool useCC, useBCC, useReply, login; | 109 | bool useCC, useBCC, useReply, login; |
110 | 110 | ||
111 | }; | 111 | }; |
112 | 112 | ||
113 | class NNTPaccount : public Account | 113 | class NNTPaccount : public Account |
114 | { | 114 | { |
115 | 115 | ||
116 | public: | 116 | public: |
117 | NNTPaccount(); | 117 | NNTPaccount(); |
118 | NNTPaccount( QString filename ); | 118 | NNTPaccount( QString filename ); |
119 | 119 | ||
120 | static QString getUniqueFileName(); | 120 | static QString getUniqueFileName(); |
121 | 121 | ||
122 | virtual void read(); | 122 | virtual void read(); |
123 | virtual void save(); | 123 | virtual void save(); |
124 | virtual QString getFileName(); | 124 | virtual QString getFileName(); |
125 | 125 | ||
126 | void setLogin( bool b ) { login = b; } | 126 | void setLogin( bool b ) { login = b; } |
127 | bool getLogin() { return login; } | 127 | bool getLogin() { return login; } |
128 | 128 | ||
129 | void setGroups( QStringList list ) { subscribedGroups = list; } | ||
130 | QStringList getGroups() { return subscribedGroups; } | ||
131 | |||
129 | private: | 132 | private: |
130 | QString file; | 133 | QString file; |
131 | bool login; | 134 | bool login; |
135 | QStringList subscribedGroups; | ||
132 | 136 | ||
133 | }; | 137 | }; |
134 | 138 | ||
135 | class Settings : public QObject | 139 | class Settings : public QObject |
136 | { | 140 | { |
137 | Q_OBJECT | 141 | Q_OBJECT |
138 | 142 | ||
139 | public: | 143 | public: |
140 | Settings(); | 144 | Settings(); |
141 | QList<Account> getAccounts(); | 145 | QList<Account> getAccounts(); |
142 | void addAccount(Account *account); | 146 | void addAccount(Account *account); |
143 | void delAccount(Account *account); | 147 | void delAccount(Account *account); |
144 | void saveAccounts(); | 148 | void saveAccounts(); |
145 | void readAccounts(); | 149 | void readAccounts(); |
146 | static void checkDirectory(); | 150 | static void checkDirectory(); |
147 | 151 | ||
148 | private: | 152 | private: |
149 | void updateAccounts(); | 153 | void updateAccounts(); |
150 | QList<Account> accounts; | 154 | QList<Account> accounts; |
151 | 155 | ||
152 | }; | 156 | }; |
153 | 157 | ||
154 | #endif | 158 | #endif |