-rw-r--r-- | kmicromail/editaccounts.cpp | 12 |
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 | |||
@@ -288,265 +288,277 @@ void EditAccounts::slotAdjustColumns() | |||
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 | ||
300 | void EditAccounts::accept() | 300 | void 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 | ||
311 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) | 311 | SelectMailType::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 | ||
319 | void SelectMailType::slotSelection( const QString &sel ) | 319 | void 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 | ||
328 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 328 | IMAPconfig::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 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 341 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
342 | } | 342 | } |
343 | 343 | ||
344 | void IMAPconfig::slotConnectionToggle( int index ) | 344 | void 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 | ||
361 | void IMAPconfig::fillValues() | 361 | void 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 | ||
382 | void IMAPconfig::accept() | 382 | void 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 | ||
402 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 408 | POP3config::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 | ||
417 | void POP3config::slotConnectionToggle( int index ) | 423 | void 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 | ||
435 | void POP3config::fillValues() | 441 | void 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 | ||
455 | void POP3config::accept() | 461 | void 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 | ||
474 | SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 486 | SMTPconfig::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 | } |
498 | void SMTPconfig::chooseSig() | 510 | void 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 | } |
505 | void SMTPconfig::slotConnectionToggle( int index ) | 517 | void SMTPconfig::slotConnectionToggle( int index ) |
506 | { | 518 | { |
507 | // 2 is ssl connection | 519 | // 2 is ssl connection |
508 | if ( index == 2 ) | 520 | if ( index == 2 ) |
509 | { | 521 | { |
510 | portLine->setText( SMTP_SSL_PORT ); | 522 | portLine->setText( SMTP_SSL_PORT ); |
511 | } | 523 | } |
512 | else if ( index == 3 ) | 524 | else if ( index == 3 ) |
513 | { | 525 | { |
514 | portLine->setText( SMTP_PORT ); | 526 | portLine->setText( SMTP_PORT ); |
515 | CommandEdit->show(); | 527 | CommandEdit->show(); |
516 | } | 528 | } |
517 | else | 529 | else |
518 | { | 530 | { |
519 | portLine->setText( SMTP_PORT ); | 531 | portLine->setText( SMTP_PORT ); |
520 | } | 532 | } |
521 | } | 533 | } |
522 | 534 | ||
523 | void SMTPconfig::fillValues() | 535 | void SMTPconfig::fillValues() |
524 | { | 536 | { |
525 | accountLine->setText( data->getAccountName() ); | 537 | accountLine->setText( data->getAccountName() ); |
526 | serverLine->setText( data->getServer() ); | 538 | serverLine->setText( data->getServer() ); |
527 | portLine->setText( data->getPort() ); | 539 | portLine->setText( data->getPort() ); |
528 | ComboBox1->setCurrentItem( data->ConnectionType() ); | 540 | ComboBox1->setCurrentItem( data->ConnectionType() ); |
529 | loginBox->setChecked( data->getLogin() ); | 541 | loginBox->setChecked( data->getLogin() ); |
530 | userLine->setText( data->getUser() ); | 542 | userLine->setText( data->getUser() ); |
531 | passLine->setText( data->getPassword() ); | 543 | passLine->setText( data->getPassword() ); |
532 | SignaturEdit->setText( data->getSigFile() ); | 544 | SignaturEdit->setText( data->getSigFile() ); |
533 | } | 545 | } |
534 | 546 | ||
535 | void SMTPconfig::accept() | 547 | void SMTPconfig::accept() |
536 | { | 548 | { |
537 | data->setAccountName( accountLine->text() ); | 549 | data->setAccountName( accountLine->text() ); |
538 | data->setServer( serverLine->text() ); | 550 | data->setServer( serverLine->text() ); |
539 | data->setPort( portLine->text() ); | 551 | data->setPort( portLine->text() ); |
540 | data->setConnectionType( ComboBox1->currentItem() ); | 552 | data->setConnectionType( ComboBox1->currentItem() ); |
541 | data->setLogin( loginBox->isChecked() ); | 553 | data->setLogin( loginBox->isChecked() ); |
542 | data->setUser( userLine->text() ); | 554 | data->setUser( userLine->text() ); |
543 | data->setPassword( passLine->text() ); | 555 | data->setPassword( passLine->text() ); |
544 | data->setSigFile( SignaturEdit->text() ); | 556 | data->setSigFile( SignaturEdit->text() ); |
545 | 557 | ||
546 | QDialog::accept(); | 558 | QDialog::accept(); |
547 | } | 559 | } |
548 | 560 | ||
549 | /** | 561 | /** |
550 | * NNTPconfig | 562 | * NNTPconfig |
551 | */ | 563 | */ |
552 | 564 | ||