summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
Unidiff
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 2c0f2d8..f274dc3 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,86 +1,86 @@
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 <q3listview.h>
20#include <qspinbox.h> 20#include <qspinbox.h>
21#include <klocale.h> 21#include <klocale.h>
22#include <kfiledialog.h> 22#include <kfiledialog.h>
23 23
24#include <libmailwrapper/nntpwrapper.h> 24#include <libmailwrapper/nntpwrapper.h>
25 25
26using namespace Opie::Core; 26using namespace Opie::Core;
27 27
28AccountListItem::AccountListItem( QListView *parent, Account *a) 28AccountListItem::AccountListItem( Q3ListView *parent, Account *a)
29 : QListViewItem( parent ) 29 : Q3ListViewItem( parent )
30{ 30{
31 account = a; 31 account = a;
32 setText( 0, account->getAccountName() ); 32 setText( 0, account->getAccountName() );
33 QString ttext = ""; 33 QString ttext = "";
34 switch (account->getType()) { 34 switch (account->getType()) {
35 case MAILLIB::A_NNTP: 35 case MAILLIB::A_NNTP:
36 ttext="NNTP"; 36 ttext="NNTP";
37 break; 37 break;
38 case MAILLIB::A_POP3: 38 case MAILLIB::A_POP3:
39 ttext = "POP3"; 39 ttext = "POP3";
40 break; 40 break;
41 case MAILLIB::A_IMAP: 41 case MAILLIB::A_IMAP:
42 ttext = "IMAP"; 42 ttext = "IMAP";
43 break; 43 break;
44 case MAILLIB::A_SMTP: 44 case MAILLIB::A_SMTP:
45 ttext = "SMTP"; 45 ttext = "SMTP";
46 break; 46 break;
47 default: 47 default:
48 ttext = "UNKNOWN"; 48 ttext = "UNKNOWN";
49 break; 49 break;
50 } 50 }
51 setText( 1, ttext); 51 setText( 1, ttext);
52} 52}
53 53
54EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 54EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
55 : EditAccountsUI( parent, name, modal, flags ) 55 : EditAccountsUI( parent, name, modal, flags )
56{ 56{
57 settings = s; 57 settings = s;
58 58
59 mailList->addColumn( i18n( "Account" ) ); 59 mailList->addColumn( i18n( "Account" ) );
60 mailList->addColumn( i18n( "Type" ) ); 60 mailList->addColumn( i18n( "Type" ) );
61 61
62 newsList->addColumn( i18n( "Account" ) ); 62 newsList->addColumn( i18n( "Account" ) );
63 63
64 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 64 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
65 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 65 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
66 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 66 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
67 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 67 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
68 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 68 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
69 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 69 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
70 70
71 slotFillLists(); 71 slotFillLists();
72} 72}
73 73
74void EditAccounts::slotFillLists() 74void EditAccounts::slotFillLists()
75{ 75{
76 mailList->clear(); 76 mailList->clear();
77 newsList->clear(); 77 newsList->clear();
78 78
79 QList<Account> accounts = settings->getAccounts(); 79 QList<Account> accounts = settings->getAccounts();
80 Account *it; 80 Account *it;
81 for ( it = accounts.first(); it; it = accounts.next() ) 81 for ( it = accounts.first(); it; it = accounts.next() )
82 { 82 {
83 if ( it->getType()==MAILLIB::A_NNTP ) 83 if ( it->getType()==MAILLIB::A_NNTP )
84 { 84 {
85 (void) new AccountListItem( newsList, it ); 85 (void) new AccountListItem( newsList, it );
86 } 86 }
@@ -279,82 +279,82 @@ void EditAccounts::slotDeleteNews()
279 return; 279 return;
280 } 280 }
281 281
282 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 282 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
283 slotDeleteAccount( a ); 283 slotDeleteAccount( a );
284} 284}
285 285
286void EditAccounts::slotAdjustColumns() 286void EditAccounts::slotAdjustColumns()
287{ 287{
288 int currPage = configTab->currentPageIndex(); 288 int currPage = configTab->currentPageIndex();
289 289
290 configTab->showPage( mailTab ); 290 configTab->showPage( mailTab );
291 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 291 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
292 mailList->setColumnWidth( 1, 50 ); 292 mailList->setColumnWidth( 1, 50 );
293 293
294 configTab->showPage( newsTab ); 294 configTab->showPage( newsTab );
295 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 295 newsList->setColumnWidth( 0, newsList->visibleWidth() );
296 296
297 configTab->setCurrentPage( currPage ); 297 configTab->setCurrentPage( currPage );
298} 298}
299 299
300void EditAccounts::accept() 300void EditAccounts::accept()
301{ 301{
302 settings->saveAccounts(); 302 settings->saveAccounts();
303 303
304 QDialog::accept(); 304 QDialog::accept();
305} 305}
306 306
307/** 307/**
308 * SelectMailType 308 * SelectMailType
309 */ 309 */
310 310
311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
312 : SelectMailTypeUI( parent, name, modal, flags ) 312 : SelectMailTypeUI( parent, name, modal, flags )
313{ 313{
314 selected = selection; 314 selected = selection;
315 selected->replace( 0, selected->length(), typeBox->currentText() ); 315 selected->replace( 0, selected->length(), typeBox->currentText() );
316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
317} 317}
318 318
319void SelectMailType::slotSelection( const QString &sel ) 319void SelectMailType::slotSelection( const QString &sel )
320{ 320{
321 selected->replace( 0, selected->length(), sel ); 321 selected->replace( 0, selected->length(), sel );
322} 322}
323 323
324/** 324/**
325 * IMAPconfig 325 * IMAPconfig
326 */ 326 */
327 327
328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
329 : IMAPconfigUI( parent, name, modal, flags ) 329 : IMAPconfigUI( parent, name, modal, flags )
330{ 330{
331 data = account; 331 data = account;
332 332
333 //fillValues(); 333 //fillValues();
334 334
335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
336 ComboBox1->insertItem( "Only if available", 0 ); 336 ComboBox1->insertItem( "Only if available", 0 );
337 ComboBox1->insertItem( "Always, Negotiated", 1 ); 337 ComboBox1->insertItem( "Always, Negotiated", 1 );
338 ComboBox1->insertItem( "Connect on secure port", 2 ); 338 ComboBox1->insertItem( "Connect on secure port", 2 );
339 ComboBox1->insertItem( "Run command instead", 3 ); 339 ComboBox1->insertItem( "Run command instead", 3 );
340 CommandEdit->hide(); 340 CommandEdit->hide();
341 fillValues(); 341 fillValues();
342 // ComboBox1->setCurrentItem( data->ConnectionType() ); 342 // ComboBox1->setCurrentItem( data->ConnectionType() );
343} 343}
344 344
345void IMAPconfig::slotConnectionToggle( int index ) 345void IMAPconfig::slotConnectionToggle( int index )
346{ 346{
347 if ( index == 2 ) 347 if ( index == 2 )
348 { 348 {
349 portLine->setText( IMAP_SSL_PORT ); 349 portLine->setText( IMAP_SSL_PORT );
350 CommandEdit->hide(); 350 CommandEdit->hide();
351 } 351 }
352 else if ( index == 3 ) 352 else if ( index == 3 )
353 { 353 {
354 portLine->setText( IMAP_PORT ); 354 portLine->setText( IMAP_PORT );
355 CommandEdit->show(); 355 CommandEdit->show();
356 } 356 }
357 else 357 else
358 { 358 {
359 portLine->setText( IMAP_PORT ); 359 portLine->setText( IMAP_PORT );
360 CommandEdit->hide(); 360 CommandEdit->hide();
@@ -379,65 +379,65 @@ void IMAPconfig::fillValues()
379 CheckBoxDown->setChecked( false ); 379 CheckBoxDown->setChecked( false );
380 SpinBoxDown->setValue ( 5 ); 380 SpinBoxDown->setValue ( 5 );
381 } 381 }
382 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 382 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
383} 383}
384 384
385void IMAPconfig::accept() 385void IMAPconfig::accept()
386{ 386{
387 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { 387 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
388 QMessageBox::information( this, i18n( "Error" ), 388 QMessageBox::information( this, i18n( "Error" ),
389 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), 389 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
390 i18n( "Ok" ) ); 390 i18n( "Ok" ) );
391 return; 391 return;
392 } 392 }
393 data->setAccountName( accountLine->text() ); 393 data->setAccountName( accountLine->text() );
394 data->setServer( serverLine->text() ); 394 data->setServer( serverLine->text() );
395 data->setPort( portLine->text() ); 395 data->setPort( portLine->text() );
396 data->setConnectionType( ComboBox1->currentItem() ); 396 data->setConnectionType( ComboBox1->currentItem() );
397 data->setUser( userLine->text() ); 397 data->setUser( userLine->text() );
398 data->setPassword( passLine->text() ); 398 data->setPassword( passLine->text() );
399 data->setPrefix(prefixLine->text()); 399 data->setPrefix(prefixLine->text());
400 data->setLocalFolder( localFolder->text() ); 400 data->setLocalFolder( localFolder->text() );
401 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 401 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
402 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 402 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
403 403
404 QDialog::accept(); 404 QDialog::accept();
405} 405}
406 406
407/** 407/**
408 * POP3config 408 * POP3config
409 */ 409 */
410 410
411POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 411POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
412 : POP3configUI( parent, name, modal, flags ) 412 : POP3configUI( parent, name, modal, flags )
413{ 413{
414 data = account; 414 data = account;
415 //fillValues(); 415 //fillValues();
416 416
417 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 417 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
418 ComboBox1->insertItem( "Only if available", 0 ); 418 ComboBox1->insertItem( "Only if available", 0 );
419 ComboBox1->insertItem( "Always, Negotiated", 1 ); 419 ComboBox1->insertItem( "Always, Negotiated", 1 );
420 ComboBox1->insertItem( "Connect on secure port", 2 ); 420 ComboBox1->insertItem( "Connect on secure port", 2 );
421 ComboBox1->insertItem( "Run command instead", 3 ); 421 ComboBox1->insertItem( "Run command instead", 3 );
422 CommandEdit->hide(); 422 CommandEdit->hide();
423 fillValues(); 423 fillValues();
424 //ComboBox1->setCurrentItem( data->ConnectionType() ); 424 //ComboBox1->setCurrentItem( data->ConnectionType() );
425} 425}
426 426
427void POP3config::slotConnectionToggle( int index ) 427void POP3config::slotConnectionToggle( int index )
428{ 428{
429 // 2 is ssl connection 429 // 2 is ssl connection
430 if ( index == 2 ) 430 if ( index == 2 )
431 { 431 {
432 portLine->setText( POP3_SSL_PORT ); 432 portLine->setText( POP3_SSL_PORT );
433 CommandEdit->hide(); 433 CommandEdit->hide();
434 } 434 }
435 else if ( index == 3 ) 435 else if ( index == 3 )
436 { 436 {
437 portLine->setText( POP3_PORT ); 437 portLine->setText( POP3_PORT );
438 CommandEdit->show(); 438 CommandEdit->show();
439 } 439 }
440 else 440 else
441 { 441 {
442 portLine->setText( POP3_PORT ); 442 portLine->setText( POP3_PORT );
443 CommandEdit->hide(); 443 CommandEdit->hide();
@@ -460,74 +460,74 @@ void POP3config::fillValues()
460 } else { 460 } else {
461 CheckBoxDown->setChecked( false ); 461 CheckBoxDown->setChecked( false );
462 SpinBoxDown->setValue ( 5 ); 462 SpinBoxDown->setValue ( 5 );
463 } 463 }
464 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 464 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
465} 465}
466 466
467void POP3config::accept() 467void POP3config::accept()
468{ 468{
469 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { 469 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
470 QMessageBox::information( this, i18n( "Error" ), 470 QMessageBox::information( this, i18n( "Error" ),
471 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), 471 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
472 i18n( "Ok" ) ); 472 i18n( "Ok" ) );
473 return; 473 return;
474 } 474 }
475 data->setAccountName( accountLine->text() ); 475 data->setAccountName( accountLine->text() );
476 data->setServer( serverLine->text() ); 476 data->setServer( serverLine->text() );
477 data->setPort( portLine->text() ); 477 data->setPort( portLine->text() );
478 data->setConnectionType( ComboBox1->currentItem() ); 478 data->setConnectionType( ComboBox1->currentItem() );
479 data->setUser( userLine->text() ); 479 data->setUser( userLine->text() );
480 data->setPassword( passLine->text() ); 480 data->setPassword( passLine->text() );
481 data->setLocalFolder( localFolder->text() ); 481 data->setLocalFolder( localFolder->text() );
482 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 482 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
483 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 483 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
484 484
485 QDialog::accept(); 485 QDialog::accept();
486} 486}
487 487
488/** 488/**
489 * SMTPconfig 489 * SMTPconfig
490 */ 490 */
491 491
492SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 492SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
493 : SMTPconfigUI( parent, name, modal, flags ) 493 : SMTPconfigUI( parent, name, modal, flags )
494{ 494{
495 data = account; 495 data = account;
496 496
497 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 497 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
498 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 498 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
499 499
500 // fillValues(); 500 // fillValues();
501 QIconSet icon; 501 QIcon icon;
502 //icon = SmallIcon("fileexport"); 502 //icon = SmallIcon("fileexport");
503 icon = SmallIcon("fileopen"); 503 icon = SmallIcon("fileopen");
504 SignaturButton->setText(""); 504 SignaturButton->setText("");
505 SignaturButton->setIconSet (icon ) ; 505 SignaturButton->setIconSet (icon ) ;
506 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; 506 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
507 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 507 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
508 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 508 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
509 ComboBox1->insertItem( "No secure connection, no TLS", 0 ); 509 ComboBox1->insertItem( "No secure connection, no TLS", 0 );
510 ComboBox1->insertItem( "Only if available, try TLS", 1 ); 510 ComboBox1->insertItem( "Only if available, try TLS", 1 );
511 ComboBox1->insertItem( "Always, use TLS", 2 ); 511 ComboBox1->insertItem( "Always, use TLS", 2 );
512 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); 512 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 );
513 ComboBox1->insertItem( "Run command instead", 4 ); 513 ComboBox1->insertItem( "Run command instead", 4 );
514 CommandEdit->hide(); 514 CommandEdit->hide();
515 fillValues(); 515 fillValues();
516 //ComboBox1->setCurrentItem( data->ConnectionType() ); 516 //ComboBox1->setCurrentItem( data->ConnectionType() );
517} 517}
518void SMTPconfig::chooseSig() 518void SMTPconfig::chooseSig()
519{ 519{
520 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); 520 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
521 if ( !lnk.isEmpty() ) { 521 if ( !lnk.isEmpty() ) {
522 SignaturEdit->setText( lnk ); 522 SignaturEdit->setText( lnk );
523 } 523 }
524} 524}
525void SMTPconfig::slotConnectionToggle( int index ) 525void SMTPconfig::slotConnectionToggle( int index )
526{ 526{
527 // 3 is ssl connection 527 // 3 is ssl connection
528 if ( index == 3 ) 528 if ( index == 3 )
529 { 529 {
530 portLine->setText( SMTP_SSL_PORT ); 530 portLine->setText( SMTP_SSL_PORT );
531 CommandEdit->hide(); 531 CommandEdit->hide();
532 } 532 }
533 else if ( index == 4 ) 533 else if ( index == 4 )
@@ -543,161 +543,161 @@ void SMTPconfig::slotConnectionToggle( int index )
543} 543}
544 544
545void SMTPconfig::fillValues() 545void SMTPconfig::fillValues()
546{ 546{
547 accountLine->setText( data->getAccountName() ); 547 accountLine->setText( data->getAccountName() );
548 serverLine->setText( data->getServer() ); 548 serverLine->setText( data->getServer() );
549 portLine->setText( data->getPort() ); 549 portLine->setText( data->getPort() );
550 ComboBox1->setCurrentItem( data->ConnectionType() ); 550 ComboBox1->setCurrentItem( data->ConnectionType() );
551 loginBox->setChecked( data->getLogin() ); 551 loginBox->setChecked( data->getLogin() );
552 userLine->setText( data->getUser() ); 552 userLine->setText( data->getUser() );
553 passLine->setText( data->getPassword() ); 553 passLine->setText( data->getPassword() );
554 SignaturEdit->setText( data->getSigFile() ); 554 SignaturEdit->setText( data->getSigFile() );
555} 555}
556 556
557void SMTPconfig::accept() 557void SMTPconfig::accept()
558{ 558{
559 data->setAccountName( accountLine->text() ); 559 data->setAccountName( accountLine->text() );
560 data->setServer( serverLine->text() ); 560 data->setServer( serverLine->text() );
561 data->setPort( portLine->text() ); 561 data->setPort( portLine->text() );
562 data->setConnectionType( ComboBox1->currentItem() ); 562 data->setConnectionType( ComboBox1->currentItem() );
563 data->setLogin( loginBox->isChecked() ); 563 data->setLogin( loginBox->isChecked() );
564 data->setUser( userLine->text() ); 564 data->setUser( userLine->text() );
565 data->setPassword( passLine->text() ); 565 data->setPassword( passLine->text() );
566 data->setSigFile( SignaturEdit->text() ); 566 data->setSigFile( SignaturEdit->text() );
567 567
568 QDialog::accept(); 568 QDialog::accept();
569} 569}
570 570
571/** 571/**
572 * NNTPconfig 572 * NNTPconfig
573 */ 573 */
574 574
575NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 575NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
576 : NNTPconfigUI( parent, name, modal, flags ) 576 : NNTPconfigUI( parent, name, modal, flags )
577{ 577{
578 data = account; 578 data = account;
579 579
580 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 580 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
581 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 581 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
582 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 582 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
583 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 583 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
584 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 584 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
585 fillValues(); 585 fillValues();
586 586
587 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 587 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
588} 588}
589 589
590void NNTPconfig::slotShowSub() 590void NNTPconfig::slotShowSub()
591{ 591{
592 save(); 592 save();
593 data->save(); 593 data->save();
594 ListViewGroups->clear(); 594 ListViewGroups->clear();
595 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 595 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
596 QCheckListItem *item; 596 Q3CheckListItem *item;
597 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 597 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
598 item->setOn( true ); 598 item->setOn( true );
599 } 599 }
600 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); 600 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
601} 601}
602void NNTPconfig::slotShowFilter() 602void NNTPconfig::slotShowFilter()
603{ 603{
604 save(); 604 save();
605 data->save(); 605 data->save();
606 ListViewGroups->clear(); 606 ListViewGroups->clear();
607 int count = 0; 607 int count = 0;
608 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 608 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
609 QCheckListItem *item; 609 Q3CheckListItem *item;
610 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 610 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
611 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 611 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
612 ++count; 612 ++count;
613 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 613 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
614 item->setOn( true ); 614 item->setOn( true );
615 } 615 }
616 } 616 }
617 } 617 }
618 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); 618 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
619} 619}
620void NNTPconfig::slotGetNG() { 620void NNTPconfig::slotGetNG() {
621 save(); 621 save();
622 data->save(); 622 data->save();
623 topLevelWidget()->setCaption( i18n("Fetching group list...")); 623 topLevelWidget()->setCaption( i18n("Fetching group list..."));
624 qApp->processEvents(); 624 qApp->processEvents();
625 NNTPwrapper* tmp = new NNTPwrapper( data ); 625 NNTPwrapper* tmp = new NNTPwrapper( data );
626 allGroups = tmp->listAllNewsgroups(); 626 allGroups = tmp->listAllNewsgroups();
627 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); 627 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
628 628
629 ListViewGroups->clear(); 629 ListViewGroups->clear();
630 630
631 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 631 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
632 QCheckListItem *item; 632 Q3CheckListItem *item;
633 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 633 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
634 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 634 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
635 item->setOn( true ); 635 item->setOn( true );
636 636
637 } 637 }
638 } 638 }
639 delete tmp; 639 delete tmp;
640} 640}
641 641
642void NNTPconfig::slotSSL( bool enabled ) 642void NNTPconfig::slotSSL( bool enabled )
643{ 643{
644 if ( enabled ) 644 if ( enabled )
645 { 645 {
646 portLine->setText( NNTP_SSL_PORT ); 646 portLine->setText( NNTP_SSL_PORT );
647 } 647 }
648 else 648 else
649 { 649 {
650 portLine->setText( NNTP_PORT ); 650 portLine->setText( NNTP_PORT );
651 } 651 }
652} 652}
653 653
654void NNTPconfig::fillValues() 654void NNTPconfig::fillValues()
655{ 655{
656 accountLine->setText( data->getAccountName() ); 656 accountLine->setText( data->getAccountName() );
657 serverLine->setText( data->getServer() ); 657 serverLine->setText( data->getServer() );
658 portLine->setText( data->getPort() ); 658 portLine->setText( data->getPort() );
659 sslBox->setChecked( data->getSSL() ); 659 sslBox->setChecked( data->getSSL() );
660 loginBox->setChecked( data->getLogin() ); 660 loginBox->setChecked( data->getLogin() );
661 userLine->setText( data->getUser() ); 661 userLine->setText( data->getUser() );
662 passLine->setText( data->getPassword() ); 662 passLine->setText( data->getPassword() );
663 subscribedGroups = data->getGroups(); 663 subscribedGroups = data->getGroups();
664 /* don't forget that - you will overwrite values if user clicks cancel! */ 664 /* don't forget that - you will overwrite values if user clicks cancel! */
665 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 665 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
666 QCheckListItem *item; 666 Q3CheckListItem *item;
667 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 667 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
668 item->setOn( true ); 668 item->setOn( true );
669 } 669 }
670} 670}
671 671
672void NNTPconfig::save() 672void NNTPconfig::save()
673{ 673{
674 data->setAccountName( accountLine->text() ); 674 data->setAccountName( accountLine->text() );
675 data->setServer( serverLine->text() ); 675 data->setServer( serverLine->text() );
676 data->setPort( portLine->text() ); 676 data->setPort( portLine->text() );
677 data->setSSL( sslBox->isChecked() ); 677 data->setSSL( sslBox->isChecked() );
678 data->setLogin( loginBox->isChecked() ); 678 data->setLogin( loginBox->isChecked() );
679 data->setUser( userLine->text() ); 679 data->setUser( userLine->text() );
680 data->setPassword( passLine->text() ); 680 data->setPassword( passLine->text() );
681 681
682 QListViewItemIterator list_it( ListViewGroups ); 682 Q3ListViewItemIterator list_it( ListViewGroups );
683 683
684 for ( ; list_it.current(); ++list_it ) { 684 for ( ; list_it.current(); ++list_it ) {
685 685
686 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 686 if ( ( (Q3CheckListItem*)list_it.current() )->isOn() ) {
687 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) 687 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
688 subscribedGroups.append( list_it.current()->text(0) ); 688 subscribedGroups.append( list_it.current()->text(0) );
689 } else { 689 } else {
690 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) 690 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
691 subscribedGroups.remove( list_it.current()->text(0) ); 691 subscribedGroups.remove( list_it.current()->text(0) );
692 } 692 }
693 693
694 } 694 }
695 data->setGroups( subscribedGroups ); 695 data->setGroups( subscribedGroups );
696} 696}
697 697
698void NNTPconfig::accept() 698void NNTPconfig::accept()
699{ 699{
700 save(); 700 save();
701 QDialog::accept(); 701 QDialog::accept();
702} 702}
703 703