-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index 0e74a99..e0380c4 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -380,96 +380,98 @@ int RecurYearly::day() | |||
380 | 380 | ||
381 | //////////////////////////// ExceptionsWidget ////////////////////////// | 381 | //////////////////////////// ExceptionsWidget ////////////////////////// |
382 | 382 | ||
383 | ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : | 383 | ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : |
384 | QWidget( parent, name ) | 384 | QWidget( parent, name ) |
385 | { | 385 | { |
386 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 386 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
387 | 387 | ||
388 | QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), | 388 | QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), |
389 | this ); | 389 | this ); |
390 | topLayout->addWidget( groupBox ); | 390 | topLayout->addWidget( groupBox ); |
391 | 391 | ||
392 | QWidget *box = new QWidget( groupBox ); | 392 | QWidget *box = new QWidget( groupBox ); |
393 | 393 | ||
394 | QGridLayout *boxLayout = new QGridLayout( box ); | 394 | QGridLayout *boxLayout = new QGridLayout( box ); |
395 | 395 | ||
396 | mExceptionDateEdit = new KDateEdit( box ); | 396 | mExceptionDateEdit = new KDateEdit( box ); |
397 | boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); | 397 | boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); |
398 | 398 | ||
399 | QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); | 399 | QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); |
400 | boxLayout->addWidget( addExceptionButton, 1, 0 ); | 400 | boxLayout->addWidget( addExceptionButton, 1, 0 ); |
401 | QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); | 401 | QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); |
402 | boxLayout->addWidget( changeExceptionButton, 2, 0 ); | 402 | boxLayout->addWidget( changeExceptionButton, 2, 0 ); |
403 | QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); | 403 | QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); |
404 | boxLayout->addWidget( deleteExceptionButton, 3, 0 ); | 404 | boxLayout->addWidget( deleteExceptionButton, 3, 0 ); |
405 | 405 | ||
406 | mExceptionList = new QListBox( box ); | 406 | mExceptionList = new QListBox( box ); |
407 | boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); | 407 | boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); |
408 | 408 | ||
409 | boxLayout->setRowStretch( 4, 1 ); | 409 | boxLayout->setRowStretch( 4, 1 ); |
410 | boxLayout->setColStretch( 1, 3 ); | 410 | boxLayout->setColStretch( 1, 3 ); |
411 | 411 | ||
412 | connect( addExceptionButton, SIGNAL( clicked() ), | 412 | connect( addExceptionButton, SIGNAL( clicked() ), |
413 | SLOT( addException() ) ); | 413 | SLOT( addException() ) ); |
414 | connect( changeExceptionButton, SIGNAL( clicked() ), | 414 | connect( changeExceptionButton, SIGNAL( clicked() ), |
415 | SLOT( changeException() ) ); | 415 | SLOT( changeException() ) ); |
416 | connect( deleteExceptionButton, SIGNAL( clicked() ), | 416 | connect( deleteExceptionButton, SIGNAL( clicked() ), |
417 | SLOT( deleteException() ) ); | 417 | SLOT( deleteException() ) ); |
418 | if ( QApplication::desktop()->width() < 480 ) { | 418 | if ( QApplication::desktop()->width() < 480 ) { |
419 | setMinimumWidth( 220 ); | 419 | setMinimumWidth( 220 ); |
420 | } else { | 420 | } else { |
421 | setMinimumWidth( 440 ); | 421 | setMinimumWidth( 440 ); |
422 | mExceptionDateEdit->setMinimumWidth( 200 ); | 422 | mExceptionDateEdit->setMinimumWidth( 200 ); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
426 | void ExceptionsWidget::setDefaults( const QDateTime &from ) | 426 | void ExceptionsWidget::setDefaults( const QDateTime &from ) |
427 | { | 427 | { |
428 | mExceptionList->clear(); | ||
429 | mExceptionDates.clear(); | ||
428 | mExceptionDateEdit->setDate( from.date() ); | 430 | mExceptionDateEdit->setDate( from.date() ); |
429 | } | 431 | } |
430 | 432 | ||
431 | void ExceptionsWidget::addException() | 433 | void ExceptionsWidget::addException() |
432 | { | 434 | { |
433 | QDate date = mExceptionDateEdit->date(); | 435 | QDate date = mExceptionDateEdit->date(); |
434 | QString dateStr = KGlobal::locale()->formatDate( date ); | 436 | QString dateStr = KGlobal::locale()->formatDate( date ); |
435 | if( !mExceptionList->findItem( dateStr ) ) { | 437 | if( !mExceptionList->findItem( dateStr ) ) { |
436 | mExceptionDates.append( date ); | 438 | mExceptionDates.append( date ); |
437 | mExceptionList->insertItem( dateStr ); | 439 | mExceptionList->insertItem( dateStr ); |
438 | } | 440 | } |
439 | } | 441 | } |
440 | 442 | ||
441 | void ExceptionsWidget::changeException() | 443 | void ExceptionsWidget::changeException() |
442 | { | 444 | { |
443 | int pos = mExceptionList->currentItem(); | 445 | int pos = mExceptionList->currentItem(); |
444 | if ( pos < 0 ) return; | 446 | if ( pos < 0 ) return; |
445 | 447 | ||
446 | QDate date = mExceptionDateEdit->date(); | 448 | QDate date = mExceptionDateEdit->date(); |
447 | mExceptionDates[ pos ] = date; | 449 | mExceptionDates[ pos ] = date; |
448 | mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); | 450 | mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); |
449 | } | 451 | } |
450 | 452 | ||
451 | void ExceptionsWidget::deleteException() | 453 | void ExceptionsWidget::deleteException() |
452 | { | 454 | { |
453 | int pos = mExceptionList->currentItem(); | 455 | int pos = mExceptionList->currentItem(); |
454 | if ( pos < 0 ) return; | 456 | if ( pos < 0 ) return; |
455 | 457 | ||
456 | mExceptionDates.remove( mExceptionDates.at( pos ) ); | 458 | mExceptionDates.remove( mExceptionDates.at( pos ) ); |
457 | mExceptionList->removeItem( pos ); | 459 | mExceptionList->removeItem( pos ); |
458 | } | 460 | } |
459 | 461 | ||
460 | void ExceptionsWidget::setDates( const DateList &dates ) | 462 | void ExceptionsWidget::setDates( const DateList &dates ) |
461 | { | 463 | { |
462 | mExceptionList->clear(); | 464 | mExceptionList->clear(); |
463 | mExceptionDates.clear(); | 465 | mExceptionDates.clear(); |
464 | DateList::ConstIterator dit; | 466 | DateList::ConstIterator dit; |
465 | for ( dit = dates.begin(); dit != dates.end(); ++dit ) { | 467 | for ( dit = dates.begin(); dit != dates.end(); ++dit ) { |
466 | mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); | 468 | mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); |
467 | mExceptionDates.append( *dit ); | 469 | mExceptionDates.append( *dit ); |
468 | } | 470 | } |
469 | } | 471 | } |
470 | 472 | ||
471 | DateList ExceptionsWidget::dates() | 473 | DateList ExceptionsWidget::dates() |
472 | { | 474 | { |
473 | return mExceptionDates; | 475 | return mExceptionDates; |
474 | } | 476 | } |
475 | 477 | ||