summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
Unidiff
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 8253c91..f1075c0 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -336,169 +336,181 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name,
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 ComboBox1->setCurrentItem( data->ConnectionType() ); 341 ComboBox1->setCurrentItem( data->ConnectionType() );
342} 342}
343 343
344void IMAPconfig::slotConnectionToggle( int index ) 344void IMAPconfig::slotConnectionToggle( int index )
345{ 345{
346 if ( index == 2 ) 346 if ( index == 2 )
347 { 347 {
348 portLine->setText( IMAP_SSL_PORT ); 348 portLine->setText( IMAP_SSL_PORT );
349 } 349 }
350 else if ( index == 3 ) 350 else if ( index == 3 )
351 { 351 {
352 portLine->setText( IMAP_PORT ); 352 portLine->setText( IMAP_PORT );
353 CommandEdit->show(); 353 CommandEdit->show();
354 } 354 }
355 else 355 else
356 { 356 {
357 portLine->setText( IMAP_PORT ); 357 portLine->setText( IMAP_PORT );
358 } 358 }
359} 359}
360 360
361void IMAPconfig::fillValues() 361void IMAPconfig::fillValues()
362{ 362{
363 accountLine->setText( data->getAccountName() ); 363 accountLine->setText( data->getAccountName() );
364 serverLine->setText( data->getServer() ); 364 serverLine->setText( data->getServer() );
365 portLine->setText( data->getPort() ); 365 portLine->setText( data->getPort() );
366 ComboBox1->setCurrentItem( data->ConnectionType() ); 366 ComboBox1->setCurrentItem( data->ConnectionType() );
367 userLine->setText( data->getUser() ); 367 userLine->setText( data->getUser() );
368 passLine->setText( data->getPassword() ); 368 passLine->setText( data->getPassword() );
369 prefixLine->setText(data->getPrefix()); 369 prefixLine->setText(data->getPrefix());
370 localFolder->setText( data->getLocalFolder() ); 370 localFolder->setText( data->getLocalFolder() );
371 int max = data->getMaxMailSize() ; 371 int max = data->getMaxMailSize() ;
372 if ( max ) { 372 if ( max ) {
373 CheckBoxDown->setChecked( true ); 373 CheckBoxDown->setChecked( true );
374 SpinBoxDown->setValue ( max ); 374 SpinBoxDown->setValue ( max );
375 } else { 375 } else {
376 CheckBoxDown->setChecked( false ); 376 CheckBoxDown->setChecked( false );
377 SpinBoxDown->setValue ( 5 ); 377 SpinBoxDown->setValue ( 5 );
378 } 378 }
379 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 379 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
380} 380}
381 381
382void IMAPconfig::accept() 382void IMAPconfig::accept()
383{ 383{
384 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
385 QMessageBox::information( this, i18n( "Error" ),
386 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
387 i18n( "Ok" ) );
388 return;
389 }
384 data->setAccountName( accountLine->text() ); 390 data->setAccountName( accountLine->text() );
385 data->setServer( serverLine->text() ); 391 data->setServer( serverLine->text() );
386 data->setPort( portLine->text() ); 392 data->setPort( portLine->text() );
387 data->setConnectionType( ComboBox1->currentItem() ); 393 data->setConnectionType( ComboBox1->currentItem() );
388 data->setUser( userLine->text() ); 394 data->setUser( userLine->text() );
389 data->setPassword( passLine->text() ); 395 data->setPassword( passLine->text() );
390 data->setPrefix(prefixLine->text()); 396 data->setPrefix(prefixLine->text());
391 data->setLocalFolder( localFolder->text() ); 397 data->setLocalFolder( localFolder->text() );
392 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 398 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
393 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 399 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
394 400
395 QDialog::accept(); 401 QDialog::accept();
396} 402}
397 403
398/** 404/**
399 * POP3config 405 * POP3config
400 */ 406 */
401 407
402POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 408POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
403 : POP3configUI( parent, name, modal, flags ) 409 : POP3configUI( parent, name, modal, flags )
404{ 410{
405 data = account; 411 data = account;
406 fillValues(); 412 fillValues();
407 413
408 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 414 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
409 ComboBox1->insertItem( "Only if available", 0 ); 415 ComboBox1->insertItem( "Only if available", 0 );
410 ComboBox1->insertItem( "Always, Negotiated", 1 ); 416 ComboBox1->insertItem( "Always, Negotiated", 1 );
411 ComboBox1->insertItem( "Connect on secure port", 2 ); 417 ComboBox1->insertItem( "Connect on secure port", 2 );
412 ComboBox1->insertItem( "Run command instead", 3 ); 418 ComboBox1->insertItem( "Run command instead", 3 );
413 CommandEdit->hide(); 419 CommandEdit->hide();
414 ComboBox1->setCurrentItem( data->ConnectionType() ); 420 ComboBox1->setCurrentItem( data->ConnectionType() );
415} 421}
416 422
417void POP3config::slotConnectionToggle( int index ) 423void POP3config::slotConnectionToggle( int index )
418{ 424{
419 // 2 is ssl connection 425 // 2 is ssl connection
420 if ( index == 2 ) 426 if ( index == 2 )
421 { 427 {
422 portLine->setText( POP3_SSL_PORT ); 428 portLine->setText( POP3_SSL_PORT );
423 } 429 }
424 else if ( index == 3 ) 430 else if ( index == 3 )
425 { 431 {
426 portLine->setText( POP3_PORT ); 432 portLine->setText( POP3_PORT );
427 CommandEdit->show(); 433 CommandEdit->show();
428 } 434 }
429 else 435 else
430 { 436 {
431 portLine->setText( POP3_PORT ); 437 portLine->setText( POP3_PORT );
432 } 438 }
433} 439}
434 440
435void POP3config::fillValues() 441void POP3config::fillValues()
436{ 442{
437 accountLine->setText( data->getAccountName() ); 443 accountLine->setText( data->getAccountName() );
438 serverLine->setText( data->getServer() ); 444 serverLine->setText( data->getServer() );
439 portLine->setText( data->getPort() ); 445 portLine->setText( data->getPort() );
440 ComboBox1->setCurrentItem( data->ConnectionType() ); 446 ComboBox1->setCurrentItem( data->ConnectionType() );
441 userLine->setText( data->getUser() ); 447 userLine->setText( data->getUser() );
442 passLine->setText( data->getPassword() ); 448 passLine->setText( data->getPassword() );
443 localFolder->setText( data->getLocalFolder() ); 449 localFolder->setText( data->getLocalFolder() );
444 int max = data->getMaxMailSize() ; 450 int max = data->getMaxMailSize() ;
445 if ( max ) { 451 if ( max ) {
446 CheckBoxDown->setChecked( true ); 452 CheckBoxDown->setChecked( true );
447 SpinBoxDown->setValue ( max ); 453 SpinBoxDown->setValue ( max );
448 } else { 454 } else {
449 CheckBoxDown->setChecked( false ); 455 CheckBoxDown->setChecked( false );
450 SpinBoxDown->setValue ( 5 ); 456 SpinBoxDown->setValue ( 5 );
451 } 457 }
452 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 458 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
453} 459}
454 460
455void POP3config::accept() 461void POP3config::accept()
456{ 462{
463 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
464 QMessageBox::information( this, i18n( "Error" ),
465 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
466 i18n( "Ok" ) );
467 return;
468 }
457 data->setAccountName( accountLine->text() ); 469 data->setAccountName( accountLine->text() );
458 data->setServer( serverLine->text() ); 470 data->setServer( serverLine->text() );
459 data->setPort( portLine->text() ); 471 data->setPort( portLine->text() );
460 data->setConnectionType( ComboBox1->currentItem() ); 472 data->setConnectionType( ComboBox1->currentItem() );
461 data->setUser( userLine->text() ); 473 data->setUser( userLine->text() );
462 data->setPassword( passLine->text() ); 474 data->setPassword( passLine->text() );
463 data->setLocalFolder( localFolder->text() ); 475 data->setLocalFolder( localFolder->text() );
464 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 476 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
465 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 477 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
466 478
467 QDialog::accept(); 479 QDialog::accept();
468} 480}
469 481
470/** 482/**
471 * SMTPconfig 483 * SMTPconfig
472 */ 484 */
473 485
474SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 486SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
475 : SMTPconfigUI( parent, name, modal, flags ) 487 : SMTPconfigUI( parent, name, modal, flags )
476{ 488{
477 data = account; 489 data = account;
478 490
479 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 491 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
480 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 492 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
481 493
482 fillValues(); 494 fillValues();
483 QIconSet icon; 495 QIconSet icon;
484 //icon = SmallIcon("fileexport"); 496 //icon = SmallIcon("fileexport");
485 icon = SmallIcon("fileopen"); 497 icon = SmallIcon("fileopen");
486 SignaturButton->setText(""); 498 SignaturButton->setText("");
487 SignaturButton->setIconSet (icon ) ; 499 SignaturButton->setIconSet (icon ) ;
488 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; 500 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
489 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 501 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
490 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 502 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
491 ComboBox1->insertItem( "Only if available", 0 ); 503 ComboBox1->insertItem( "Only if available", 0 );
492 ComboBox1->insertItem( "Always, Negotiated", 1 ); 504 ComboBox1->insertItem( "Always, Negotiated", 1 );
493 ComboBox1->insertItem( "Connect on secure port", 2 ); 505 ComboBox1->insertItem( "Connect on secure port", 2 );
494 ComboBox1->insertItem( "Run command instead", 3 ); 506 ComboBox1->insertItem( "Run command instead", 3 );
495 CommandEdit->hide(); 507 CommandEdit->hide();
496 ComboBox1->setCurrentItem( data->ConnectionType() ); 508 ComboBox1->setCurrentItem( data->ConnectionType() );
497} 509}
498void SMTPconfig::chooseSig() 510void SMTPconfig::chooseSig()
499{ 511{
500 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); 512 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
501 if ( !lnk.isEmpty() ) { 513 if ( !lnk.isEmpty() ) {
502 SignaturEdit->setText( lnk ); 514 SignaturEdit->setText( lnk );
503 } 515 }
504} 516}