author | zautrix <zautrix> | 2005-02-03 10:48:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-03 10:48:05 (UTC) |
commit | fb6753570dc90e936b4e89092554ab012e946a56 (patch) (unidiff) | |
tree | 6d3ae5c866f0bbb99f0b6bc8194d04d2c7681ff9 /kmicromail/editaccounts.cpp | |
parent | e0fce8c0f108e054cb6e4e4767affd04b398da45 (diff) | |
download | kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.zip kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.tar.gz kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.tar.bz2 |
mail fixes
-rw-r--r-- | kmicromail/editaccounts.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 48c3963..8253c91 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -1,149 +1,150 @@ | |||
1 | 1 | ||
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include "kapplication.h" | 3 | #include "kapplication.h" |
4 | #include "defines.h" | 4 | #include "defines.h" |
5 | #include "editaccounts.h" | 5 | #include "editaccounts.h" |
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | /* QT */ | 9 | /* QT */ |
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | 11 | ||
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qcheckbox.h> | 13 | #include <qcheckbox.h> |
14 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
15 | #include <qpushbutton.h> | 15 | #include <qpushbutton.h> |
16 | #include <qlineedit.h> | 16 | #include <qlineedit.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qtabwidget.h> | 18 | #include <qtabwidget.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qspinbox.h> | 20 | #include <qspinbox.h> |
21 | #include <klocale.h> | 21 | #include <klocale.h> |
22 | #include <kfiledialog.h> | ||
22 | 23 | ||
23 | #include <libmailwrapper/nntpwrapper.h> | 24 | #include <libmailwrapper/nntpwrapper.h> |
24 | 25 | ||
25 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
26 | 27 | ||
27 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 28 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
28 | : QListViewItem( parent ) | 29 | : QListViewItem( parent ) |
29 | { | 30 | { |
30 | account = a; | 31 | account = a; |
31 | setText( 0, account->getAccountName() ); | 32 | setText( 0, account->getAccountName() ); |
32 | QString ttext = ""; | 33 | QString ttext = ""; |
33 | switch (account->getType()) { | 34 | switch (account->getType()) { |
34 | case MAILLIB::A_NNTP: | 35 | case MAILLIB::A_NNTP: |
35 | ttext="NNTP"; | 36 | ttext="NNTP"; |
36 | break; | 37 | break; |
37 | case MAILLIB::A_POP3: | 38 | case MAILLIB::A_POP3: |
38 | ttext = "POP3"; | 39 | ttext = "POP3"; |
39 | break; | 40 | break; |
40 | case MAILLIB::A_IMAP: | 41 | case MAILLIB::A_IMAP: |
41 | ttext = "IMAP"; | 42 | ttext = "IMAP"; |
42 | break; | 43 | break; |
43 | case MAILLIB::A_SMTP: | 44 | case MAILLIB::A_SMTP: |
44 | ttext = "SMTP"; | 45 | ttext = "SMTP"; |
45 | break; | 46 | break; |
46 | default: | 47 | default: |
47 | ttext = "UNKNOWN"; | 48 | ttext = "UNKNOWN"; |
48 | break; | 49 | break; |
49 | } | 50 | } |
50 | setText( 1, ttext); | 51 | setText( 1, ttext); |
51 | } | 52 | } |
52 | 53 | ||
53 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 54 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
54 | : EditAccountsUI( parent, name, modal, flags ) | 55 | : EditAccountsUI( parent, name, modal, flags ) |
55 | { | 56 | { |
56 | settings = s; | 57 | settings = s; |
57 | 58 | ||
58 | mailList->addColumn( i18n( "Account" ) ); | 59 | mailList->addColumn( i18n( "Account" ) ); |
59 | mailList->addColumn( i18n( "Type" ) ); | 60 | mailList->addColumn( i18n( "Type" ) ); |
60 | 61 | ||
61 | newsList->addColumn( i18n( "Account" ) ); | 62 | newsList->addColumn( i18n( "Account" ) ); |
62 | 63 | ||
63 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 64 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
64 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 65 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
65 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 66 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
66 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 67 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
67 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 68 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
68 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 69 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
69 | 70 | ||
70 | slotFillLists(); | 71 | slotFillLists(); |
71 | } | 72 | } |
72 | 73 | ||
73 | void EditAccounts::slotFillLists() | 74 | void EditAccounts::slotFillLists() |
74 | { | 75 | { |
75 | mailList->clear(); | 76 | mailList->clear(); |
76 | newsList->clear(); | 77 | newsList->clear(); |
77 | 78 | ||
78 | QList<Account> accounts = settings->getAccounts(); | 79 | QList<Account> accounts = settings->getAccounts(); |
79 | Account *it; | 80 | Account *it; |
80 | for ( it = accounts.first(); it; it = accounts.next() ) | 81 | for ( it = accounts.first(); it; it = accounts.next() ) |
81 | { | 82 | { |
82 | if ( it->getType()==MAILLIB::A_NNTP ) | 83 | if ( it->getType()==MAILLIB::A_NNTP ) |
83 | { | 84 | { |
84 | (void) new AccountListItem( newsList, it ); | 85 | (void) new AccountListItem( newsList, it ); |
85 | } | 86 | } |
86 | else | 87 | else |
87 | { | 88 | { |
88 | (void) new AccountListItem( mailList, it ); | 89 | (void) new AccountListItem( mailList, it ); |
89 | } | 90 | } |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
93 | void EditAccounts::slotNewMail() | 94 | void EditAccounts::slotNewMail() |
94 | { | 95 | { |
95 | QString *selection = new QString(); | 96 | QString *selection = new QString(); |
96 | SelectMailType selType( selection, this, 0, true ); | 97 | SelectMailType selType( selection, this, 0, true ); |
97 | selType.show(); | 98 | selType.show(); |
98 | if ( QDialog::Accepted == selType.exec() ) | 99 | if ( QDialog::Accepted == selType.exec() ) |
99 | { | 100 | { |
100 | slotNewAccount( *selection ); | 101 | slotNewAccount( *selection ); |
101 | } | 102 | } |
102 | } | 103 | } |
103 | 104 | ||
104 | void EditAccounts::slotNewAccount( const QString &type ) | 105 | void EditAccounts::slotNewAccount( const QString &type ) |
105 | { | 106 | { |
106 | if ( type.compare( i18n("IMAP") ) == 0 ) | 107 | if ( type.compare( i18n("IMAP") ) == 0 ) |
107 | { | 108 | { |
108 | IMAPaccount *account = new IMAPaccount(); | 109 | IMAPaccount *account = new IMAPaccount(); |
109 | IMAPconfig imap( account, this, 0, true ); | 110 | IMAPconfig imap( account, this, 0, true ); |
110 | 111 | ||
111 | #ifndef DESKTOP_VERSION | 112 | #ifndef DESKTOP_VERSION |
112 | imap.showMaximized(); | 113 | imap.showMaximized(); |
113 | #endif | 114 | #endif |
114 | if ( QDialog::Accepted == imap.exec() ) | 115 | if ( QDialog::Accepted == imap.exec() ) |
115 | { | 116 | { |
116 | settings->addAccount( account ); | 117 | settings->addAccount( account ); |
117 | account->save(); | 118 | account->save(); |
118 | slotFillLists(); | 119 | slotFillLists(); |
119 | } | 120 | } |
120 | else | 121 | else |
121 | { | 122 | { |
122 | account->remove(); | 123 | account->remove(); |
123 | } | 124 | } |
124 | } | 125 | } |
125 | else if ( type.compare( i18n("POP3") ) == 0 ) | 126 | else if ( type.compare( i18n("POP3") ) == 0 ) |
126 | { | 127 | { |
127 | POP3account *account = new POP3account(); | 128 | POP3account *account = new POP3account(); |
128 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 129 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
129 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 130 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
130 | { | 131 | { |
131 | settings->addAccount( account ); | 132 | settings->addAccount( account ); |
132 | account->save(); | 133 | account->save(); |
133 | slotFillLists(); | 134 | slotFillLists(); |
134 | } | 135 | } |
135 | else | 136 | else |
136 | { | 137 | { |
137 | account->remove(); | 138 | account->remove(); |
138 | } | 139 | } |
139 | } | 140 | } |
140 | else if ( type.compare( i18n("SMTP") ) == 0 ) | 141 | else if ( type.compare( i18n("SMTP") ) == 0 ) |
141 | { | 142 | { |
142 | SMTPaccount *account = new SMTPaccount(); | 143 | SMTPaccount *account = new SMTPaccount(); |
143 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 144 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
144 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 145 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
145 | { | 146 | { |
146 | settings->addAccount( account ); | 147 | settings->addAccount( account ); |
147 | account->save(); | 148 | account->save(); |
148 | slotFillLists(); | 149 | slotFillLists(); |
149 | 150 | ||
@@ -354,304 +355,318 @@ void IMAPconfig::slotConnectionToggle( int index ) | |||
354 | else | 355 | else |
355 | { | 356 | { |
356 | portLine->setText( IMAP_PORT ); | 357 | portLine->setText( IMAP_PORT ); |
357 | } | 358 | } |
358 | } | 359 | } |
359 | 360 | ||
360 | void IMAPconfig::fillValues() | 361 | void IMAPconfig::fillValues() |
361 | { | 362 | { |
362 | accountLine->setText( data->getAccountName() ); | 363 | accountLine->setText( data->getAccountName() ); |
363 | serverLine->setText( data->getServer() ); | 364 | serverLine->setText( data->getServer() ); |
364 | portLine->setText( data->getPort() ); | 365 | portLine->setText( data->getPort() ); |
365 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 366 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
366 | userLine->setText( data->getUser() ); | 367 | userLine->setText( data->getUser() ); |
367 | passLine->setText( data->getPassword() ); | 368 | passLine->setText( data->getPassword() ); |
368 | prefixLine->setText(data->getPrefix()); | 369 | prefixLine->setText(data->getPrefix()); |
369 | localFolder->setText( data->getLocalFolder() ); | 370 | localFolder->setText( data->getLocalFolder() ); |
370 | int max = data->getMaxMailSize() ; | 371 | int max = data->getMaxMailSize() ; |
371 | if ( max ) { | 372 | if ( max ) { |
372 | CheckBoxDown->setChecked( true ); | 373 | CheckBoxDown->setChecked( true ); |
373 | SpinBoxDown->setValue ( max ); | 374 | SpinBoxDown->setValue ( max ); |
374 | } else { | 375 | } else { |
375 | CheckBoxDown->setChecked( false ); | 376 | CheckBoxDown->setChecked( false ); |
376 | SpinBoxDown->setValue ( 5 ); | 377 | SpinBoxDown->setValue ( 5 ); |
377 | } | 378 | } |
378 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 379 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
379 | } | 380 | } |
380 | 381 | ||
381 | void IMAPconfig::accept() | 382 | void IMAPconfig::accept() |
382 | { | 383 | { |
383 | data->setAccountName( accountLine->text() ); | 384 | data->setAccountName( accountLine->text() ); |
384 | data->setServer( serverLine->text() ); | 385 | data->setServer( serverLine->text() ); |
385 | data->setPort( portLine->text() ); | 386 | data->setPort( portLine->text() ); |
386 | data->setConnectionType( ComboBox1->currentItem() ); | 387 | data->setConnectionType( ComboBox1->currentItem() ); |
387 | data->setUser( userLine->text() ); | 388 | data->setUser( userLine->text() ); |
388 | data->setPassword( passLine->text() ); | 389 | data->setPassword( passLine->text() ); |
389 | data->setPrefix(prefixLine->text()); | 390 | data->setPrefix(prefixLine->text()); |
390 | data->setLocalFolder( localFolder->text() ); | 391 | data->setLocalFolder( localFolder->text() ); |
391 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 392 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
392 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 393 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
393 | 394 | ||
394 | QDialog::accept(); | 395 | QDialog::accept(); |
395 | } | 396 | } |
396 | 397 | ||
397 | /** | 398 | /** |
398 | * POP3config | 399 | * POP3config |
399 | */ | 400 | */ |
400 | 401 | ||
401 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 402 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
402 | : POP3configUI( parent, name, modal, flags ) | 403 | : POP3configUI( parent, name, modal, flags ) |
403 | { | 404 | { |
404 | data = account; | 405 | data = account; |
405 | fillValues(); | 406 | fillValues(); |
406 | 407 | ||
407 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 408 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
408 | ComboBox1->insertItem( "Only if available", 0 ); | 409 | ComboBox1->insertItem( "Only if available", 0 ); |
409 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 410 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
410 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 411 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
411 | ComboBox1->insertItem( "Run command instead", 3 ); | 412 | ComboBox1->insertItem( "Run command instead", 3 ); |
412 | CommandEdit->hide(); | 413 | CommandEdit->hide(); |
413 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 414 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
414 | } | 415 | } |
415 | 416 | ||
416 | void POP3config::slotConnectionToggle( int index ) | 417 | void POP3config::slotConnectionToggle( int index ) |
417 | { | 418 | { |
418 | // 2 is ssl connection | 419 | // 2 is ssl connection |
419 | if ( index == 2 ) | 420 | if ( index == 2 ) |
420 | { | 421 | { |
421 | portLine->setText( POP3_SSL_PORT ); | 422 | portLine->setText( POP3_SSL_PORT ); |
422 | } | 423 | } |
423 | else if ( index == 3 ) | 424 | else if ( index == 3 ) |
424 | { | 425 | { |
425 | portLine->setText( POP3_PORT ); | 426 | portLine->setText( POP3_PORT ); |
426 | CommandEdit->show(); | 427 | CommandEdit->show(); |
427 | } | 428 | } |
428 | else | 429 | else |
429 | { | 430 | { |
430 | portLine->setText( POP3_PORT ); | 431 | portLine->setText( POP3_PORT ); |
431 | } | 432 | } |
432 | } | 433 | } |
433 | 434 | ||
434 | void POP3config::fillValues() | 435 | void POP3config::fillValues() |
435 | { | 436 | { |
436 | accountLine->setText( data->getAccountName() ); | 437 | accountLine->setText( data->getAccountName() ); |
437 | serverLine->setText( data->getServer() ); | 438 | serverLine->setText( data->getServer() ); |
438 | portLine->setText( data->getPort() ); | 439 | portLine->setText( data->getPort() ); |
439 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 440 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
440 | userLine->setText( data->getUser() ); | 441 | userLine->setText( data->getUser() ); |
441 | passLine->setText( data->getPassword() ); | 442 | passLine->setText( data->getPassword() ); |
442 | localFolder->setText( data->getLocalFolder() ); | 443 | localFolder->setText( data->getLocalFolder() ); |
443 | int max = data->getMaxMailSize() ; | 444 | int max = data->getMaxMailSize() ; |
444 | if ( max ) { | 445 | if ( max ) { |
445 | CheckBoxDown->setChecked( true ); | 446 | CheckBoxDown->setChecked( true ); |
446 | SpinBoxDown->setValue ( max ); | 447 | SpinBoxDown->setValue ( max ); |
447 | } else { | 448 | } else { |
448 | CheckBoxDown->setChecked( false ); | 449 | CheckBoxDown->setChecked( false ); |
449 | SpinBoxDown->setValue ( 5 ); | 450 | SpinBoxDown->setValue ( 5 ); |
450 | } | 451 | } |
451 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); | 452 | CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); |
452 | } | 453 | } |
453 | 454 | ||
454 | void POP3config::accept() | 455 | void POP3config::accept() |
455 | { | 456 | { |
456 | data->setAccountName( accountLine->text() ); | 457 | data->setAccountName( accountLine->text() ); |
457 | data->setServer( serverLine->text() ); | 458 | data->setServer( serverLine->text() ); |
458 | data->setPort( portLine->text() ); | 459 | data->setPort( portLine->text() ); |
459 | data->setConnectionType( ComboBox1->currentItem() ); | 460 | data->setConnectionType( ComboBox1->currentItem() ); |
460 | data->setUser( userLine->text() ); | 461 | data->setUser( userLine->text() ); |
461 | data->setPassword( passLine->text() ); | 462 | data->setPassword( passLine->text() ); |
462 | data->setLocalFolder( localFolder->text() ); | 463 | data->setLocalFolder( localFolder->text() ); |
463 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; | 464 | data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; |
464 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); | 465 | data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); |
465 | 466 | ||
466 | QDialog::accept(); | 467 | QDialog::accept(); |
467 | } | 468 | } |
468 | 469 | ||
469 | /** | 470 | /** |
470 | * SMTPconfig | 471 | * SMTPconfig |
471 | */ | 472 | */ |
472 | 473 | ||
473 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 474 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
474 | : SMTPconfigUI( parent, name, modal, flags ) | 475 | : SMTPconfigUI( parent, name, modal, flags ) |
475 | { | 476 | { |
476 | data = account; | 477 | data = account; |
477 | 478 | ||
478 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 479 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
479 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 480 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
480 | 481 | ||
481 | fillValues(); | 482 | fillValues(); |
482 | 483 | QIconSet icon; | |
484 | //icon = SmallIcon("fileexport"); | ||
485 | icon = SmallIcon("fileopen"); | ||
486 | SignaturButton->setText(""); | ||
487 | SignaturButton->setIconSet (icon ) ; | ||
488 | SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; | ||
489 | connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); | ||
483 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); | 490 | connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); |
484 | ComboBox1->insertItem( "Only if available", 0 ); | 491 | ComboBox1->insertItem( "Only if available", 0 ); |
485 | ComboBox1->insertItem( "Always, Negotiated", 1 ); | 492 | ComboBox1->insertItem( "Always, Negotiated", 1 ); |
486 | ComboBox1->insertItem( "Connect on secure port", 2 ); | 493 | ComboBox1->insertItem( "Connect on secure port", 2 ); |
487 | ComboBox1->insertItem( "Run command instead", 3 ); | 494 | ComboBox1->insertItem( "Run command instead", 3 ); |
488 | CommandEdit->hide(); | 495 | CommandEdit->hide(); |
489 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 496 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
490 | } | 497 | } |
491 | 498 | void SMTPconfig::chooseSig() | |
499 | { | ||
500 | QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); | ||
501 | if ( !lnk.isEmpty() ) { | ||
502 | SignaturEdit->setText( lnk ); | ||
503 | } | ||
504 | } | ||
492 | void SMTPconfig::slotConnectionToggle( int index ) | 505 | void SMTPconfig::slotConnectionToggle( int index ) |
493 | { | 506 | { |
494 | // 2 is ssl connection | 507 | // 2 is ssl connection |
495 | if ( index == 2 ) | 508 | if ( index == 2 ) |
496 | { | 509 | { |
497 | portLine->setText( SMTP_SSL_PORT ); | 510 | portLine->setText( SMTP_SSL_PORT ); |
498 | } | 511 | } |
499 | else if ( index == 3 ) | 512 | else if ( index == 3 ) |
500 | { | 513 | { |
501 | portLine->setText( SMTP_PORT ); | 514 | portLine->setText( SMTP_PORT ); |
502 | CommandEdit->show(); | 515 | CommandEdit->show(); |
503 | } | 516 | } |
504 | else | 517 | else |
505 | { | 518 | { |
506 | portLine->setText( SMTP_PORT ); | 519 | portLine->setText( SMTP_PORT ); |
507 | } | 520 | } |
508 | } | 521 | } |
509 | 522 | ||
510 | void SMTPconfig::fillValues() | 523 | void SMTPconfig::fillValues() |
511 | { | 524 | { |
512 | accountLine->setText( data->getAccountName() ); | 525 | accountLine->setText( data->getAccountName() ); |
513 | serverLine->setText( data->getServer() ); | 526 | serverLine->setText( data->getServer() ); |
514 | portLine->setText( data->getPort() ); | 527 | portLine->setText( data->getPort() ); |
515 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 528 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
516 | loginBox->setChecked( data->getLogin() ); | 529 | loginBox->setChecked( data->getLogin() ); |
517 | userLine->setText( data->getUser() ); | 530 | userLine->setText( data->getUser() ); |
518 | passLine->setText( data->getPassword() ); | 531 | passLine->setText( data->getPassword() ); |
532 | SignaturEdit->setText( data->getSigFile() ); | ||
519 | } | 533 | } |
520 | 534 | ||
521 | void SMTPconfig::accept() | 535 | void SMTPconfig::accept() |
522 | { | 536 | { |
523 | data->setAccountName( accountLine->text() ); | 537 | data->setAccountName( accountLine->text() ); |
524 | data->setServer( serverLine->text() ); | 538 | data->setServer( serverLine->text() ); |
525 | data->setPort( portLine->text() ); | 539 | data->setPort( portLine->text() ); |
526 | data->setConnectionType( ComboBox1->currentItem() ); | 540 | data->setConnectionType( ComboBox1->currentItem() ); |
527 | data->setLogin( loginBox->isChecked() ); | 541 | data->setLogin( loginBox->isChecked() ); |
528 | data->setUser( userLine->text() ); | 542 | data->setUser( userLine->text() ); |
529 | data->setPassword( passLine->text() ); | 543 | data->setPassword( passLine->text() ); |
544 | data->setSigFile( SignaturEdit->text() ); | ||
530 | 545 | ||
531 | QDialog::accept(); | 546 | QDialog::accept(); |
532 | } | 547 | } |
533 | 548 | ||
534 | /** | 549 | /** |
535 | * NNTPconfig | 550 | * NNTPconfig |
536 | */ | 551 | */ |
537 | 552 | ||
538 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 553 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
539 | : NNTPconfigUI( parent, name, modal, flags ) | 554 | : NNTPconfigUI( parent, name, modal, flags ) |
540 | { | 555 | { |
541 | data = account; | 556 | data = account; |
542 | 557 | ||
543 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); | 558 | connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); |
544 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); | 559 | connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); |
545 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); | 560 | connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); |
546 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); | 561 | connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); |
547 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); | 562 | connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); |
548 | fillValues(); | 563 | fillValues(); |
549 | 564 | ||
550 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); | 565 | connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); |
551 | } | 566 | } |
552 | 567 | ||
553 | void NNTPconfig::slotShowSub() | 568 | void NNTPconfig::slotShowSub() |
554 | { | 569 | { |
555 | save(); | 570 | save(); |
556 | data->save(); | 571 | data->save(); |
557 | ListViewGroups->clear(); | 572 | ListViewGroups->clear(); |
558 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 573 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
559 | QCheckListItem *item; | 574 | QCheckListItem *item; |
560 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 575 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
561 | item->setOn( true ); | 576 | item->setOn( true ); |
562 | } | 577 | } |
563 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); | 578 | topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); |
564 | } | 579 | } |
565 | void NNTPconfig::slotShowFilter() | 580 | void NNTPconfig::slotShowFilter() |
566 | { | 581 | { |
567 | save(); | 582 | save(); |
568 | data->save(); | 583 | data->save(); |
569 | ListViewGroups->clear(); | 584 | ListViewGroups->clear(); |
570 | int count = 0; | 585 | int count = 0; |
571 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 586 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
572 | QCheckListItem *item; | 587 | QCheckListItem *item; |
573 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { | 588 | if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { |
574 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 589 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
575 | ++count; | 590 | ++count; |
576 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 591 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
577 | item->setOn( true ); | 592 | item->setOn( true ); |
578 | } | 593 | } |
579 | } | 594 | } |
580 | } | 595 | } |
581 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); | 596 | topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); |
582 | } | 597 | } |
583 | void NNTPconfig::slotGetNG() { | 598 | void NNTPconfig::slotGetNG() { |
584 | save(); | 599 | save(); |
585 | data->save(); | 600 | data->save(); |
586 | topLevelWidget()->setCaption( i18n("Fetching group list...")); | 601 | topLevelWidget()->setCaption( i18n("Fetching group list...")); |
587 | qApp->processEvents(); | 602 | qApp->processEvents(); |
588 | NNTPwrapper* tmp = new NNTPwrapper( data ); | 603 | NNTPwrapper* tmp = new NNTPwrapper( data ); |
589 | allGroups = tmp->listAllNewsgroups(); | 604 | allGroups = tmp->listAllNewsgroups(); |
590 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); | 605 | topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); |
591 | 606 | ||
592 | ListViewGroups->clear(); | 607 | ListViewGroups->clear(); |
593 | 608 | ||
594 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { | 609 | for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { |
595 | QCheckListItem *item; | 610 | QCheckListItem *item; |
596 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 611 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
597 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { | 612 | if ( subscribedGroups.contains( (*it) ) >= 1 ) { |
598 | item->setOn( true ); | 613 | item->setOn( true ); |
599 | 614 | ||
600 | } | 615 | } |
601 | } | 616 | } |
602 | delete tmp; | 617 | delete tmp; |
603 | } | 618 | } |
604 | 619 | ||
605 | void NNTPconfig::slotSSL( bool enabled ) | 620 | void NNTPconfig::slotSSL( bool enabled ) |
606 | { | 621 | { |
607 | if ( enabled ) | 622 | if ( enabled ) |
608 | { | 623 | { |
609 | portLine->setText( NNTP_SSL_PORT ); | 624 | portLine->setText( NNTP_SSL_PORT ); |
610 | } | 625 | } |
611 | else | 626 | else |
612 | { | 627 | { |
613 | portLine->setText( NNTP_PORT ); | 628 | portLine->setText( NNTP_PORT ); |
614 | } | 629 | } |
615 | } | 630 | } |
616 | 631 | ||
617 | void NNTPconfig::fillValues() | 632 | void NNTPconfig::fillValues() |
618 | { | 633 | { |
619 | accountLine->setText( data->getAccountName() ); | 634 | accountLine->setText( data->getAccountName() ); |
620 | serverLine->setText( data->getServer() ); | 635 | serverLine->setText( data->getServer() ); |
621 | portLine->setText( data->getPort() ); | 636 | portLine->setText( data->getPort() ); |
622 | sslBox->setChecked( data->getSSL() ); | 637 | sslBox->setChecked( data->getSSL() ); |
623 | loginBox->setChecked( data->getLogin() ); | 638 | loginBox->setChecked( data->getLogin() ); |
624 | userLine->setText( data->getUser() ); | 639 | userLine->setText( data->getUser() ); |
625 | passLine->setText( data->getPassword() ); | 640 | passLine->setText( data->getPassword() ); |
626 | subscribedGroups = data->getGroups(); | 641 | subscribedGroups = data->getGroups(); |
627 | /* don't forget that - you will overwrite values if user clicks cancel! */ | 642 | /* don't forget that - you will overwrite values if user clicks cancel! */ |
628 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { | 643 | for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { |
629 | QCheckListItem *item; | 644 | QCheckListItem *item; |
630 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); | 645 | item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); |
631 | item->setOn( true ); | 646 | item->setOn( true ); |
632 | } | 647 | } |
633 | } | 648 | } |
634 | 649 | ||
635 | void NNTPconfig::save() | 650 | void NNTPconfig::save() |
636 | { | 651 | { |
637 | data->setAccountName( accountLine->text() ); | 652 | data->setAccountName( accountLine->text() ); |
638 | data->setServer( serverLine->text() ); | 653 | data->setServer( serverLine->text() ); |
639 | data->setPort( portLine->text() ); | 654 | data->setPort( portLine->text() ); |
640 | data->setSSL( sslBox->isChecked() ); | 655 | data->setSSL( sslBox->isChecked() ); |
641 | data->setLogin( loginBox->isChecked() ); | 656 | data->setLogin( loginBox->isChecked() ); |
642 | data->setUser( userLine->text() ); | 657 | data->setUser( userLine->text() ); |
643 | data->setPassword( passLine->text() ); | 658 | data->setPassword( passLine->text() ); |
644 | 659 | ||
645 | QListViewItemIterator list_it( ListViewGroups ); | 660 | QListViewItemIterator list_it( ListViewGroups ); |
646 | 661 | ||
647 | for ( ; list_it.current(); ++list_it ) { | 662 | for ( ; list_it.current(); ++list_it ) { |
648 | 663 | ||
649 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 664 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { |
650 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) | 665 | if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) |
651 | subscribedGroups.append( list_it.current()->text(0) ); | 666 | subscribedGroups.append( list_it.current()->text(0) ); |
652 | } else { | 667 | } else { |
653 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) | 668 | if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) |
654 | subscribedGroups.remove( list_it.current()->text(0) ); | 669 | subscribedGroups.remove( list_it.current()->text(0) ); |
655 | } | 670 | } |
656 | 671 | ||
657 | } | 672 | } |