summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-22 10:49:00 (UTC)
committer zautrix <zautrix>2005-08-22 10:49:00 (UTC)
commitf516a558e6d18982a54152b28ca3da78fe76e3fc (patch) (unidiff)
tree231fa0bd8fe72db6cdae319def362e07945b1e2c
parent4b60cc60255c64717a2d4011d561c72b6878cdb4 (diff)
downloadkdepimpi-f516a558e6d18982a54152b28ca3da78fe76e3fc.zip
kdepimpi-f516a558e6d18982a54152b28ca3da78fe76e3fc.tar.gz
kdepimpi-f516a558e6d18982a54152b28ca3da78fe76e3fc.tar.bz2
recurrence default fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt1
-rw-r--r--korganizer/koeditorrecurrence.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 37266bf..a864f1d 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,50 +1,51 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.2.3 ************ 3********** VERSION 2.2.3 ************
4 4
5Fixed a problem with (non empty) exception dates of recurring events for newly created events.
5 6
6 7
7********** VERSION 2.2.2 ************ 8********** VERSION 2.2.2 ************
8 9
9KO/Pi: 10KO/Pi:
10Fixed a problem with the sort order of last modified date in list view. 11Fixed a problem with the sort order of last modified date in list view.
11KA/Pi: 12KA/Pi:
12Fixed a resource config read problem on windows. 13Fixed a resource config read problem on windows.
13 14
14 15
15********** VERSION 2.2.1 ************ 16********** VERSION 2.2.1 ************
16 17
17KO/Pi: 18KO/Pi:
18Fixed a problem displaying very long allday events in agenda view in single day mode. 19Fixed a problem displaying very long allday events in agenda view in single day mode.
19Fixed a problem with the default settings for new todos. 20Fixed a problem with the default settings for new todos.
20Added an error message dialog if saving of calendar files is not possible. 21Added an error message dialog if saving of calendar files is not possible.
21Made it impossible to close KO/Pi if saving fails. 22Made it impossible to close KO/Pi if saving fails.
22Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. 23Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick.
23Added config options for conflict detection. 24Added config options for conflict detection.
24 25
25KA/Pi: 26KA/Pi:
26Added a config option to turn on asking before a contact is deleted. 27Added a config option to turn on asking before a contact is deleted.
27Fixed a problem with the default view and view selection at startup. 28Fixed a problem with the default view and view selection at startup.
28Formatted name is now set on import, if formatted name is empty. 29Formatted name is now set on import, if formatted name is empty.
29Fixed a problem of displaying images in the contact details view: 30Fixed a problem of displaying images in the contact details view:
30Now the wid/hei ratio is not changed. 31Now the wid/hei ratio is not changed.
31I a picture is larger than 128 pixels in wid or hei it is downscaled to 32I a picture is larger than 128 pixels in wid or hei it is downscaled to
32max 128 pixels wid/hei. 33max 128 pixels wid/hei.
33 34
34********** VERSION 2.2.0 ************ 35********** VERSION 2.2.0 ************
35 36
36New stable release! 37New stable release!
37Fixed some minor usability problems. 38Fixed some minor usability problems.
38Added writing of next alarm to a file for usage on pdaXrom. 39Added writing of next alarm to a file for usage on pdaXrom.
39 40
40 41
41************************************* 42*************************************
42 43
43You can find the complete changelog 44You can find the complete changelog
44from version 1.7.7 to 2.2.0 45from version 1.7.7 to 2.2.0
45in the source package or on 46in the source package or on
46 47
47http://www.pi-sync.net/html/changelog.html 48http://www.pi-sync.net/html/changelog.html
48 49
49 50
50 51
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 0e74a99..e0380c4 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -236,384 +236,386 @@ RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
236 mByPosCountCombo->insertItem( i18n("2nd") ); 236 mByPosCountCombo->insertItem( i18n("2nd") );
237 mByPosCountCombo->insertItem( i18n("3rd") ); 237 mByPosCountCombo->insertItem( i18n("3rd") );
238 mByPosCountCombo->insertItem( i18n("4th") ); 238 mByPosCountCombo->insertItem( i18n("4th") );
239 mByPosCountCombo->insertItem( i18n("5th") ); 239 mByPosCountCombo->insertItem( i18n("5th") );
240 buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); 240 buttonLayout->addWidget( mByPosCountCombo, 1, 1 );
241 241
242 mByPosWeekdayCombo = new QComboBox( buttonGroup ); 242 mByPosWeekdayCombo = new QComboBox( buttonGroup );
243 mByPosWeekdayCombo->insertItem( i18n("Monday") ); 243 mByPosWeekdayCombo->insertItem( i18n("Monday") );
244 mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); 244 mByPosWeekdayCombo->insertItem( i18n("Tuesday") );
245 mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); 245 mByPosWeekdayCombo->insertItem( i18n("Wednesday") );
246 mByPosWeekdayCombo->insertItem( i18n("Thursday") ); 246 mByPosWeekdayCombo->insertItem( i18n("Thursday") );
247 mByPosWeekdayCombo->insertItem( i18n("Friday") ); 247 mByPosWeekdayCombo->insertItem( i18n("Friday") );
248 mByPosWeekdayCombo->insertItem( i18n("Saturday") ); 248 mByPosWeekdayCombo->insertItem( i18n("Saturday") );
249 mByPosWeekdayCombo->insertItem( i18n("Sunday") ); 249 mByPosWeekdayCombo->insertItem( i18n("Sunday") );
250 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); 250 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 );
251} 251}
252 252
253void RecurMonthly::setByDay( int day ) 253void RecurMonthly::setByDay( int day )
254{ 254{
255 mByDayRadio->setChecked( true ); 255 mByDayRadio->setChecked( true );
256 mByDayCombo->setCurrentItem( day ); 256 mByDayCombo->setCurrentItem( day );
257} 257}
258 258
259void RecurMonthly::setByPos( int count, int weekday ) 259void RecurMonthly::setByPos( int count, int weekday )
260{ 260{
261 mByPosRadio->setChecked( true ); 261 mByPosRadio->setChecked( true );
262 mByPosCountCombo->setCurrentItem( count ); 262 mByPosCountCombo->setCurrentItem( count );
263 mByPosWeekdayCombo->setCurrentItem( weekday ); 263 mByPosWeekdayCombo->setCurrentItem( weekday );
264} 264}
265 265
266bool RecurMonthly::byDay() 266bool RecurMonthly::byDay()
267{ 267{
268 return mByDayRadio->isChecked(); 268 return mByDayRadio->isChecked();
269} 269}
270 270
271bool RecurMonthly::byPos() 271bool RecurMonthly::byPos()
272{ 272{
273 return mByPosRadio->isChecked(); 273 return mByPosRadio->isChecked();
274} 274}
275 275
276int RecurMonthly::day() 276int RecurMonthly::day()
277{ 277{
278 return mByDayCombo->currentItem() + 1; 278 return mByDayCombo->currentItem() + 1;
279} 279}
280 280
281int RecurMonthly::count() 281int RecurMonthly::count()
282{ 282{
283 return mByPosCountCombo->currentItem() + 1; 283 return mByPosCountCombo->currentItem() + 1;
284} 284}
285 285
286int RecurMonthly::weekday() 286int RecurMonthly::weekday()
287{ 287{
288 return mByPosWeekdayCombo->currentItem(); 288 return mByPosWeekdayCombo->currentItem();
289} 289}
290 290
291/////////////////////////// RecurYearly /////////////////////////////// 291/////////////////////////// RecurYearly ///////////////////////////////
292 292
293RecurYearly::RecurYearly( QWidget *parent, const char *name ) : 293RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
294 RecurBase( parent, name ) 294 RecurBase( parent, name )
295{ 295{
296 QBoxLayout *topLayout = new QVBoxLayout( this ); 296 QBoxLayout *topLayout = new QVBoxLayout( this );
297 topLayout->setSpacing( KDialog::spacingHint() ); 297 topLayout->setSpacing( KDialog::spacingHint() );
298 topLayout->setMargin( KDialog::marginHintSmall() ); 298 topLayout->setMargin( KDialog::marginHintSmall() );
299 299
300 300
301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
302 302
303 QLabel *preLabel = new QLabel( i18n("every"), this ); 303 QLabel *preLabel = new QLabel( i18n("every"), this );
304 freqLayout->addWidget( preLabel ); 304 freqLayout->addWidget( preLabel );
305 305
306 freqLayout->addWidget( frequencyEdit() ); 306 freqLayout->addWidget( frequencyEdit() );
307 307
308 QLabel *postLabel = new QLabel( i18n("year(s)"), this ); 308 QLabel *postLabel = new QLabel( i18n("year(s)"), this );
309 freqLayout->addWidget( postLabel ); 309 freqLayout->addWidget( postLabel );
310 310
311 311
312 QButtonGroup *buttonGroup = new QButtonGroup( this ); 312 QButtonGroup *buttonGroup = new QButtonGroup( this );
313 buttonGroup->setFrameStyle( QFrame::NoFrame ); 313 buttonGroup->setFrameStyle( QFrame::NoFrame );
314 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 314 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
315 315
316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); 316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 );
317 317
318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); 318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); 319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); 320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
321 321
322 buttonLayout->addWidget( mByDayLabel, 0, 1 ); 322 buttonLayout->addWidget( mByDayLabel, 0, 1 );
323 mByMonthCombo = new QComboBox( buttonGroup ); 323 mByMonthCombo = new QComboBox( buttonGroup );
324 mByMonthCombo->insertItem( i18n("January") ); 324 mByMonthCombo->insertItem( i18n("January") );
325 mByMonthCombo->insertItem( i18n("February") ); 325 mByMonthCombo->insertItem( i18n("February") );
326 mByMonthCombo->insertItem( i18n("March") ); 326 mByMonthCombo->insertItem( i18n("March") );
327 mByMonthCombo->insertItem( i18n("April") ); 327 mByMonthCombo->insertItem( i18n("April") );
328 mByMonthCombo->insertItem( i18n("May") ); 328 mByMonthCombo->insertItem( i18n("May") );
329 mByMonthCombo->insertItem( i18n("June") ); 329 mByMonthCombo->insertItem( i18n("June") );
330 mByMonthCombo->insertItem( i18n("July") ); 330 mByMonthCombo->insertItem( i18n("July") );
331 mByMonthCombo->insertItem( i18n("August") ); 331 mByMonthCombo->insertItem( i18n("August") );
332 mByMonthCombo->insertItem( i18n("September") ); 332 mByMonthCombo->insertItem( i18n("September") );
333 mByMonthCombo->insertItem( i18n("October") ); 333 mByMonthCombo->insertItem( i18n("October") );
334 mByMonthCombo->insertItem( i18n("November") ); 334 mByMonthCombo->insertItem( i18n("November") );
335 mByMonthCombo->insertItem( i18n("December") ); 335 mByMonthCombo->insertItem( i18n("December") );
336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); 336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft );
337 if ( QApplication::desktop()->width() <= 640 ) { 337 if ( QApplication::desktop()->width() <= 640 ) {
338 mByMonthCombo->setSizeLimit( 6 ); 338 mByMonthCombo->setSizeLimit( 6 );
339 } 339 }
340 340
341 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup); 341 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup);
342 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight); 342 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight);
343 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup ); 343 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup );
344 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 ); 344 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 );
345 345
346} 346}
347 347
348void RecurYearly::setByDay( int doy ) 348void RecurYearly::setByDay( int doy )
349{ 349{
350 mByDayRadio->setChecked( true ); 350 mByDayRadio->setChecked( true );
351 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) ); 351 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) );
352} 352}
353 353
354void RecurYearly::setByMonth( int month, int day ) 354void RecurYearly::setByMonth( int month, int day )
355{ 355{
356 mByMonthRadio->setChecked( true ); 356 mByMonthRadio->setChecked( true );
357 mByMonthCombo->setCurrentItem( month - 1 ); 357 mByMonthCombo->setCurrentItem( month - 1 );
358 mByDayLabel->setText(i18n("%1 of ").arg( day ) ); 358 mByDayLabel->setText(i18n("%1 of ").arg( day ) );
359 mDay = day; 359 mDay = day;
360} 360}
361 361
362bool RecurYearly::byMonth() 362bool RecurYearly::byMonth()
363{ 363{
364 return mByMonthRadio->isChecked(); 364 return mByMonthRadio->isChecked();
365} 365}
366 366
367bool RecurYearly::byDay() 367bool RecurYearly::byDay()
368{ 368{
369 return mByDayRadio->isChecked(); 369 return mByDayRadio->isChecked();
370} 370}
371 371
372int RecurYearly::month() 372int RecurYearly::month()
373{ 373{
374 return mByMonthCombo->currentItem() + 1; 374 return mByMonthCombo->currentItem() + 1;
375} 375}
376int RecurYearly::day() 376int RecurYearly::day()
377{ 377{
378 return mDay;//mByDayCombo->currentItem() + 1; 378 return mDay;//mByDayCombo->currentItem() + 1;
379} 379}
380 380
381//////////////////////////// ExceptionsWidget ////////////////////////// 381//////////////////////////// ExceptionsWidget //////////////////////////
382 382
383ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : 383ExceptionsWidget::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
426void ExceptionsWidget::setDefaults( const QDateTime &from ) 426void 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
431void ExceptionsWidget::addException() 433void 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
441void ExceptionsWidget::changeException() 443void 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
451void ExceptionsWidget::deleteException() 453void 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
460void ExceptionsWidget::setDates( const DateList &dates ) 462void 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
471DateList ExceptionsWidget::dates() 473DateList ExceptionsWidget::dates()
472{ 474{
473 return mExceptionDates; 475 return mExceptionDates;
474} 476}
475 477
476///////////////////////// ExceptionsDialog /////////////////////////// 478///////////////////////// ExceptionsDialog ///////////////////////////
477 479
478ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : 480ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) :
479 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) 481 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel )
480{ 482{
481 mExceptions = new ExceptionsWidget( this ); 483 mExceptions = new ExceptionsWidget( this );
482 setMainWidget( mExceptions ); 484 setMainWidget( mExceptions );
483 resize(220,10); 485 resize(220,10);
484} 486}
485 487
486void ExceptionsDialog::setDefaults( const QDateTime &from ) 488void ExceptionsDialog::setDefaults( const QDateTime &from )
487{ 489{
488 mExceptions->setDefaults( from ); 490 mExceptions->setDefaults( from );
489} 491}
490 492
491void ExceptionsDialog::setDates( const DateList &dates ) 493void ExceptionsDialog::setDates( const DateList &dates )
492{ 494{
493 mExceptions->setDates( dates ); 495 mExceptions->setDates( dates );
494} 496}
495 497
496DateList ExceptionsDialog::dates() 498DateList ExceptionsDialog::dates()
497{ 499{
498 return mExceptions->dates(); 500 return mExceptions->dates();
499} 501}
500 502
501///////////////////////// RecurrenceRangeWidget /////////////////////////// 503///////////////////////// RecurrenceRangeWidget ///////////////////////////
502 504
503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 505RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
504 const char *name ) 506 const char *name )
505 : QWidget( parent, name ) 507 : QWidget( parent, name )
506{ 508{
507 QBoxLayout *topLayout = new QVBoxLayout( this ); 509 QBoxLayout *topLayout = new QVBoxLayout( this );
508 510
509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 511 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
510 this ); 512 this );
511 topLayout->addWidget( mRangeGroupBox ); 513 topLayout->addWidget( mRangeGroupBox );
512 514
513 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 515 QWidget *rangeBox = new QWidget( mRangeGroupBox );
514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 516 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
515 rangeLayout->setSpacing( KDialog::spacingHint() ); 517 rangeLayout->setSpacing( KDialog::spacingHint() );
516 rangeLayout->setMargin( KDialog::marginHintSmall() ); 518 rangeLayout->setMargin( KDialog::marginHintSmall() );
517 519
518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 520 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
519 rangeLayout->addWidget( mStartDateLabel ); 521 rangeLayout->addWidget( mStartDateLabel );
520 522
521 mRangeButtonGroup = new QButtonGroup; 523 mRangeButtonGroup = new QButtonGroup;
522 524
523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 525 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
524 mRangeButtonGroup->insert( mNoEndDateButton ); 526 mRangeButtonGroup->insert( mNoEndDateButton );
525 rangeLayout->addWidget( mNoEndDateButton ); 527 rangeLayout->addWidget( mNoEndDateButton );
526 528
527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 529 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
528 durationLayout->setSpacing( KDialog::spacingHint() ); 530 durationLayout->setSpacing( KDialog::spacingHint() );
529 531
530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 532 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
531 mRangeButtonGroup->insert( mEndDurationButton ); 533 mRangeButtonGroup->insert( mEndDurationButton );
532 durationLayout->addWidget( mEndDurationButton ); 534 durationLayout->addWidget( mEndDurationButton );
533 535
534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 536 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
535 durationLayout->addWidget( mEndDurationEdit ); 537 durationLayout->addWidget( mEndDurationEdit );
536 538
537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 539 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
538 durationLayout ->addWidget( endDurationLabel ); 540 durationLayout ->addWidget( endDurationLabel );
539 541
540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 542 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
541 endDateLayout->setSpacing( KDialog::spacingHint() ); 543 endDateLayout->setSpacing( KDialog::spacingHint() );
542 544
543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 545 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
544 mRangeButtonGroup->insert( mEndDateButton ); 546 mRangeButtonGroup->insert( mEndDateButton );
545 endDateLayout->addWidget( mEndDateButton ); 547 endDateLayout->addWidget( mEndDateButton );
546 548
547 mEndDateEdit = new KDateEdit( rangeBox ); 549 mEndDateEdit = new KDateEdit( rangeBox );
548 endDateLayout->addWidget( mEndDateEdit ); 550 endDateLayout->addWidget( mEndDateEdit );
549 551
550 //endDateLayout->addStretch( 1 ); 552 //endDateLayout->addStretch( 1 );
551 553
552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 554 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
553 SLOT( showCurrentRange() ) ); 555 SLOT( showCurrentRange() ) );
554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 556 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
555 SLOT( showCurrentRange() ) ); 557 SLOT( showCurrentRange() ) );
556 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 558 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
557 SLOT( showCurrentRange() ) ); 559 SLOT( showCurrentRange() ) );
558} 560}
559 561
560RecurrenceRangeWidget::~RecurrenceRangeWidget() 562RecurrenceRangeWidget::~RecurrenceRangeWidget()
561{ 563{
562 delete mRangeButtonGroup; 564 delete mRangeButtonGroup;
563} 565}
564void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) 566void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
565{ 567{
566 mNoEndDateButton->setChecked( true ); 568 mNoEndDateButton->setChecked( true );
567 569
568 setDateTimes( from ); 570 setDateTimes( from );
569 mEndDateEdit->setDate( from.date() ); 571 mEndDateEdit->setDate( from.date() );
570} 572}
571 573
572void RecurrenceRangeWidget::setDuration( int duration ) 574void RecurrenceRangeWidget::setDuration( int duration )
573{ 575{
574 if ( duration == -1 ) { 576 if ( duration == -1 ) {
575 mNoEndDateButton->setChecked( true ); 577 mNoEndDateButton->setChecked( true );
576 } else if ( duration == 0 ) { 578 } else if ( duration == 0 ) {
577 mEndDateButton->setChecked( true ); 579 mEndDateButton->setChecked( true );
578 } else { 580 } else {
579 mEndDurationButton->setChecked( true ); 581 mEndDurationButton->setChecked( true );
580 mEndDurationEdit->setValue( duration ); 582 mEndDurationEdit->setValue( duration );
581 } 583 }
582} 584}
583 585
584int RecurrenceRangeWidget::duration() 586int RecurrenceRangeWidget::duration()
585{ 587{
586 if ( mNoEndDateButton->isChecked() ) { 588 if ( mNoEndDateButton->isChecked() ) {
587 return -1; 589 return -1;
588 } else if ( mEndDurationButton->isChecked() ) { 590 } else if ( mEndDurationButton->isChecked() ) {
589 return mEndDurationEdit->value(); 591 return mEndDurationEdit->value();
590 } else { 592 } else {
591 return 0; 593 return 0;
592 } 594 }
593} 595}
594 596
595void RecurrenceRangeWidget::setEndDate( const QDate &date ) 597void RecurrenceRangeWidget::setEndDate( const QDate &date )
596{ 598{
597 mEndDateEdit->setDate( date ); 599 mEndDateEdit->setDate( date );
598} 600}
599 601
600QDate RecurrenceRangeWidget::endDate() 602QDate RecurrenceRangeWidget::endDate()
601{ 603{
602 return mEndDateEdit->date(); 604 return mEndDateEdit->date();
603} 605}
604 606
605void RecurrenceRangeWidget::showCurrentRange() 607void RecurrenceRangeWidget::showCurrentRange()
606{ 608{
607 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); 609 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() );
608 mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); 610 mEndDateEdit->setEnabled( mEndDateButton->isChecked() );
609} 611}
610 612
611void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, 613void RecurrenceRangeWidget::setDateTimes( const QDateTime &start,
612 const QDateTime & ) 614 const QDateTime & )
613{ 615{
614 mStartDateLabel->setText( i18n("Start date: %1") 616 mStartDateLabel->setText( i18n("Start date: %1")
615 .arg( KGlobal::locale()->formatDate( start.date() ) ) ); 617 .arg( KGlobal::locale()->formatDate( start.date() ) ) );
616 618
617 if(!mEndDateButton->isChecked()) 619 if(!mEndDateButton->isChecked())
618 mEndDateEdit->setDate( start.date() ); 620 mEndDateEdit->setDate( start.date() );
619} 621}