summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
Unidiff
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 49049f6..2c0f2d8 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -302,282 +302,288 @@ void EditAccounts::accept()
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, 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, 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 } 351 }
351 else if ( index == 3 ) 352 else if ( index == 3 )
352 { 353 {
353 portLine->setText( IMAP_PORT ); 354 portLine->setText( IMAP_PORT );
354 CommandEdit->show(); 355 CommandEdit->show();
355 } 356 }
356 else 357 else
357 { 358 {
358 portLine->setText( IMAP_PORT ); 359 portLine->setText( IMAP_PORT );
360 CommandEdit->hide();
359 } 361 }
360} 362}
361 363
362void IMAPconfig::fillValues() 364void IMAPconfig::fillValues()
363{ 365{
364 accountLine->setText( data->getAccountName() ); 366 accountLine->setText( data->getAccountName() );
365 serverLine->setText( data->getServer() ); 367 serverLine->setText( data->getServer() );
366 portLine->setText( data->getPort() ); 368 portLine->setText( data->getPort() );
367 ComboBox1->setCurrentItem( data->ConnectionType() ); 369 ComboBox1->setCurrentItem( data->ConnectionType() );
368 userLine->setText( data->getUser() ); 370 userLine->setText( data->getUser() );
369 passLine->setText( data->getPassword() ); 371 passLine->setText( data->getPassword() );
370 prefixLine->setText(data->getPrefix()); 372 prefixLine->setText(data->getPrefix());
371 localFolder->setText( data->getLocalFolder() ); 373 localFolder->setText( data->getLocalFolder() );
372 int max = data->getMaxMailSize() ; 374 int max = data->getMaxMailSize() ;
373 if ( max ) { 375 if ( max ) {
374 CheckBoxDown->setChecked( true ); 376 CheckBoxDown->setChecked( true );
375 SpinBoxDown->setValue ( max ); 377 SpinBoxDown->setValue ( max );
376 } else { 378 } else {
377 CheckBoxDown->setChecked( false ); 379 CheckBoxDown->setChecked( false );
378 SpinBoxDown->setValue ( 5 ); 380 SpinBoxDown->setValue ( 5 );
379 } 381 }
380 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 382 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
381} 383}
382 384
383void IMAPconfig::accept() 385void IMAPconfig::accept()
384{ 386{
385 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { 387 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
386 QMessageBox::information( this, i18n( "Error" ), 388 QMessageBox::information( this, i18n( "Error" ),
387 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." ),
388 i18n( "Ok" ) ); 390 i18n( "Ok" ) );
389 return; 391 return;
390 } 392 }
391 data->setAccountName( accountLine->text() ); 393 data->setAccountName( accountLine->text() );
392 data->setServer( serverLine->text() ); 394 data->setServer( serverLine->text() );
393 data->setPort( portLine->text() ); 395 data->setPort( portLine->text() );
394 data->setConnectionType( ComboBox1->currentItem() ); 396 data->setConnectionType( ComboBox1->currentItem() );
395 data->setUser( userLine->text() ); 397 data->setUser( userLine->text() );
396 data->setPassword( passLine->text() ); 398 data->setPassword( passLine->text() );
397 data->setPrefix(prefixLine->text()); 399 data->setPrefix(prefixLine->text());
398 data->setLocalFolder( localFolder->text() ); 400 data->setLocalFolder( localFolder->text() );
399 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 401 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
400 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 402 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
401 403
402 QDialog::accept(); 404 QDialog::accept();
403} 405}
404 406
405/** 407/**
406 * POP3config 408 * POP3config
407 */ 409 */
408 410
409POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 411POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
410 : POP3configUI( parent, name, modal, flags ) 412 : POP3configUI( parent, name, modal, flags )
411{ 413{
412 data = account; 414 data = account;
413 //fillValues(); 415 //fillValues();
414 416
415 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 417 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
416 ComboBox1->insertItem( "Only if available", 0 ); 418 ComboBox1->insertItem( "Only if available", 0 );
417 ComboBox1->insertItem( "Always, Negotiated", 1 ); 419 ComboBox1->insertItem( "Always, Negotiated", 1 );
418 ComboBox1->insertItem( "Connect on secure port", 2 ); 420 ComboBox1->insertItem( "Connect on secure port", 2 );
419 ComboBox1->insertItem( "Run command instead", 3 ); 421 ComboBox1->insertItem( "Run command instead", 3 );
420 CommandEdit->hide(); 422 CommandEdit->hide();
421 fillValues(); 423 fillValues();
422 //ComboBox1->setCurrentItem( data->ConnectionType() ); 424 //ComboBox1->setCurrentItem( data->ConnectionType() );
423} 425}
424 426
425void POP3config::slotConnectionToggle( int index ) 427void POP3config::slotConnectionToggle( int index )
426{ 428{
427 // 2 is ssl connection 429 // 2 is ssl connection
428 if ( index == 2 ) 430 if ( index == 2 )
429 { 431 {
430 portLine->setText( POP3_SSL_PORT ); 432 portLine->setText( POP3_SSL_PORT );
433 CommandEdit->hide();
431 } 434 }
432 else if ( index == 3 ) 435 else if ( index == 3 )
433 { 436 {
434 portLine->setText( POP3_PORT ); 437 portLine->setText( POP3_PORT );
435 CommandEdit->show(); 438 CommandEdit->show();
436 } 439 }
437 else 440 else
438 { 441 {
439 portLine->setText( POP3_PORT ); 442 portLine->setText( POP3_PORT );
443 CommandEdit->hide();
440 } 444 }
441} 445}
442 446
443void POP3config::fillValues() 447void POP3config::fillValues()
444{ 448{
445 accountLine->setText( data->getAccountName() ); 449 accountLine->setText( data->getAccountName() );
446 serverLine->setText( data->getServer() ); 450 serverLine->setText( data->getServer() );
447 portLine->setText( data->getPort() ); 451 portLine->setText( data->getPort() );
448 ComboBox1->setCurrentItem( data->ConnectionType() ); 452 ComboBox1->setCurrentItem( data->ConnectionType() );
449 userLine->setText( data->getUser() ); 453 userLine->setText( data->getUser() );
450 passLine->setText( data->getPassword() ); 454 passLine->setText( data->getPassword() );
451 localFolder->setText( data->getLocalFolder() ); 455 localFolder->setText( data->getLocalFolder() );
452 int max = data->getMaxMailSize() ; 456 int max = data->getMaxMailSize() ;
453 if ( max ) { 457 if ( max ) {
454 CheckBoxDown->setChecked( true ); 458 CheckBoxDown->setChecked( true );
455 SpinBoxDown->setValue ( max ); 459 SpinBoxDown->setValue ( max );
456 } else { 460 } else {
457 CheckBoxDown->setChecked( false ); 461 CheckBoxDown->setChecked( false );
458 SpinBoxDown->setValue ( 5 ); 462 SpinBoxDown->setValue ( 5 );
459 } 463 }
460 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 464 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
461} 465}
462 466
463void POP3config::accept() 467void POP3config::accept()
464{ 468{
465 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { 469 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
466 QMessageBox::information( this, i18n( "Error" ), 470 QMessageBox::information( this, i18n( "Error" ),
467 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." ),
468 i18n( "Ok" ) ); 472 i18n( "Ok" ) );
469 return; 473 return;
470 } 474 }
471 data->setAccountName( accountLine->text() ); 475 data->setAccountName( accountLine->text() );
472 data->setServer( serverLine->text() ); 476 data->setServer( serverLine->text() );
473 data->setPort( portLine->text() ); 477 data->setPort( portLine->text() );
474 data->setConnectionType( ComboBox1->currentItem() ); 478 data->setConnectionType( ComboBox1->currentItem() );
475 data->setUser( userLine->text() ); 479 data->setUser( userLine->text() );
476 data->setPassword( passLine->text() ); 480 data->setPassword( passLine->text() );
477 data->setLocalFolder( localFolder->text() ); 481 data->setLocalFolder( localFolder->text() );
478 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 482 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
479 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 483 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
480 484
481 QDialog::accept(); 485 QDialog::accept();
482} 486}
483 487
484/** 488/**
485 * SMTPconfig 489 * SMTPconfig
486 */ 490 */
487 491
488SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 492SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
489 : SMTPconfigUI( parent, name, modal, flags ) 493 : SMTPconfigUI( parent, name, modal, flags )
490{ 494{
491 data = account; 495 data = account;
492 496
493 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 497 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
494 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 498 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
495 499
496 // fillValues(); 500 // fillValues();
497 QIconSet icon; 501 QIconSet icon;
498 //icon = SmallIcon("fileexport"); 502 //icon = SmallIcon("fileexport");
499 icon = SmallIcon("fileopen"); 503 icon = SmallIcon("fileopen");
500 SignaturButton->setText(""); 504 SignaturButton->setText("");
501 SignaturButton->setIconSet (icon ) ; 505 SignaturButton->setIconSet (icon ) ;
502 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; 506 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
503 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 507 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
504 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 508 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
505 ComboBox1->insertItem( "No secure connection, no TLS", 0 ); 509 ComboBox1->insertItem( "No secure connection, no TLS", 0 );
506 ComboBox1->insertItem( "Only if available, try TLS", 1 ); 510 ComboBox1->insertItem( "Only if available, try TLS", 1 );
507 ComboBox1->insertItem( "Always, use TLS", 2 ); 511 ComboBox1->insertItem( "Always, use TLS", 2 );
508 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); 512 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 );
509 ComboBox1->insertItem( "Run command instead", 4 ); 513 ComboBox1->insertItem( "Run command instead", 4 );
510 CommandEdit->hide(); 514 CommandEdit->hide();
511 fillValues(); 515 fillValues();
512 //ComboBox1->setCurrentItem( data->ConnectionType() ); 516 //ComboBox1->setCurrentItem( data->ConnectionType() );
513} 517}
514void SMTPconfig::chooseSig() 518void SMTPconfig::chooseSig()
515{ 519{
516 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); 520 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
517 if ( !lnk.isEmpty() ) { 521 if ( !lnk.isEmpty() ) {
518 SignaturEdit->setText( lnk ); 522 SignaturEdit->setText( lnk );
519 } 523 }
520} 524}
521void SMTPconfig::slotConnectionToggle( int index ) 525void SMTPconfig::slotConnectionToggle( int index )
522{ 526{
523 // 2 is ssl connection 527 // 3 is ssl connection
524 if ( index == 2 ) 528 if ( index == 3 )
525 { 529 {
526 portLine->setText( SMTP_SSL_PORT ); 530 portLine->setText( SMTP_SSL_PORT );
531 CommandEdit->hide();
527 } 532 }
528 else if ( index == 3 ) 533 else if ( index == 4 )
529 { 534 {
530 portLine->setText( SMTP_PORT ); 535 portLine->setText( SMTP_PORT );
531 CommandEdit->show(); 536 CommandEdit->show();
532 } 537 }
533 else 538 else
534 { 539 {
535 portLine->setText( SMTP_PORT ); 540 portLine->setText( SMTP_PORT );
541 CommandEdit->hide();
536 } 542 }
537} 543}
538 544
539void SMTPconfig::fillValues() 545void SMTPconfig::fillValues()
540{ 546{
541 accountLine->setText( data->getAccountName() ); 547 accountLine->setText( data->getAccountName() );
542 serverLine->setText( data->getServer() ); 548 serverLine->setText( data->getServer() );
543 portLine->setText( data->getPort() ); 549 portLine->setText( data->getPort() );
544 ComboBox1->setCurrentItem( data->ConnectionType() ); 550 ComboBox1->setCurrentItem( data->ConnectionType() );
545 loginBox->setChecked( data->getLogin() ); 551 loginBox->setChecked( data->getLogin() );
546 userLine->setText( data->getUser() ); 552 userLine->setText( data->getUser() );
547 passLine->setText( data->getPassword() ); 553 passLine->setText( data->getPassword() );
548 SignaturEdit->setText( data->getSigFile() ); 554 SignaturEdit->setText( data->getSigFile() );
549} 555}
550 556
551void SMTPconfig::accept() 557void SMTPconfig::accept()
552{ 558{
553 data->setAccountName( accountLine->text() ); 559 data->setAccountName( accountLine->text() );
554 data->setServer( serverLine->text() ); 560 data->setServer( serverLine->text() );
555 data->setPort( portLine->text() ); 561 data->setPort( portLine->text() );
556 data->setConnectionType( ComboBox1->currentItem() ); 562 data->setConnectionType( ComboBox1->currentItem() );
557 data->setLogin( loginBox->isChecked() ); 563 data->setLogin( loginBox->isChecked() );
558 data->setUser( userLine->text() ); 564 data->setUser( userLine->text() );
559 data->setPassword( passLine->text() ); 565 data->setPassword( passLine->text() );
560 data->setSigFile( SignaturEdit->text() ); 566 data->setSigFile( SignaturEdit->text() );
561 567
562 QDialog::accept(); 568 QDialog::accept();
563} 569}
564 570
565/** 571/**
566 * NNTPconfig 572 * NNTPconfig
567 */ 573 */
568 574
569NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 575NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
570 : NNTPconfigUI( parent, name, modal, flags ) 576 : NNTPconfigUI( parent, name, modal, flags )
571{ 577{
572 data = account; 578 data = account;
573 579
574 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 580 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
575 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 581 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
576 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 582 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
577 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 583 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
578 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 584 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
579 fillValues(); 585 fillValues();
580 586
581 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 587 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
582} 588}
583 589