-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 776cdd3..623cf9d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -319,480 +319,488 @@ class KOCatPrefs : public QDialog | |||
319 | lay->addWidget( format ); | 319 | lay->addWidget( format ); |
320 | format->setExclusive ( true ) ; | 320 | format->setExclusive ( true ) ; |
321 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 321 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
322 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 322 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
323 | addCatBut->setChecked( true ); | 323 | addCatBut->setChecked( true ); |
324 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 324 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
325 | lay->addWidget( ok ); | 325 | lay->addWidget( ok ); |
326 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 326 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
327 | lay->addWidget( cancel ); | 327 | lay->addWidget( cancel ); |
328 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 328 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
329 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 329 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
330 | resize( 200, 200 ); | 330 | resize( 200, 200 ); |
331 | } | 331 | } |
332 | 332 | ||
333 | bool addCat() { return addCatBut->isChecked(); } | 333 | bool addCat() { return addCatBut->isChecked(); } |
334 | private: | 334 | private: |
335 | QRadioButton* addCatBut; | 335 | QRadioButton* addCatBut; |
336 | }; | 336 | }; |
337 | 337 | ||
338 | 338 | ||
339 | 339 | ||
340 | CalendarView::CalendarView( CalendarResources *calendar, | 340 | CalendarView::CalendarView( CalendarResources *calendar, |
341 | QWidget *parent, const char *name ) | 341 | QWidget *parent, const char *name ) |
342 | : CalendarViewBase( parent, name ), | 342 | : CalendarViewBase( parent, name ), |
343 | mCalendar( calendar ), | 343 | mCalendar( calendar ), |
344 | mResourceManager( calendar->resourceManager() ) | 344 | mResourceManager( calendar->resourceManager() ) |
345 | { | 345 | { |
346 | 346 | ||
347 | mEventEditor = 0; | 347 | mEventEditor = 0; |
348 | mTodoEditor = 0; | 348 | mTodoEditor = 0; |
349 | 349 | ||
350 | init(); | 350 | init(); |
351 | } | 351 | } |
352 | 352 | ||
353 | CalendarView::CalendarView( Calendar *calendar, | 353 | CalendarView::CalendarView( Calendar *calendar, |
354 | QWidget *parent, const char *name ) | 354 | QWidget *parent, const char *name ) |
355 | : CalendarViewBase( parent, name ), | 355 | : CalendarViewBase( parent, name ), |
356 | mCalendar( calendar ), | 356 | mCalendar( calendar ), |
357 | mResourceManager( 0 ) | 357 | mResourceManager( 0 ) |
358 | { | 358 | { |
359 | 359 | ||
360 | mEventEditor = 0; | 360 | mEventEditor = 0; |
361 | mTodoEditor = 0; | 361 | mTodoEditor = 0; |
362 | init(); | 362 | init(); |
363 | } | 363 | } |
364 | 364 | ||
365 | void CalendarView::init() | 365 | void CalendarView::init() |
366 | { | 366 | { |
367 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 367 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
368 | setFocusPolicy ( NoFocus ); | 368 | setFocusPolicy ( NoFocus ); |
369 | mViewerCallerIsSearchDialog = false; | 369 | mViewerCallerIsSearchDialog = false; |
370 | mBlockShowDates = false; | 370 | mBlockShowDates = false; |
371 | 371 | ||
372 | mDatePickerMode = 0; | 372 | mDatePickerMode = 0; |
373 | mCurrentSyncDevice = ""; | 373 | mCurrentSyncDevice = ""; |
374 | mViewManager = new KOViewManager( this ); | 374 | mViewManager = new KOViewManager( this ); |
375 | mDialogManager = new KODialogManager( this ); | 375 | mDialogManager = new KODialogManager( this ); |
376 | mEventViewerDialog = 0; | 376 | mEventViewerDialog = 0; |
377 | mModified = false; | 377 | mModified = false; |
378 | mReadOnly = false; | 378 | mReadOnly = false; |
379 | mSelectedIncidence = 0; | 379 | mSelectedIncidence = 0; |
380 | mCalPrinter = 0; | 380 | mCalPrinter = 0; |
381 | mFilters.setAutoDelete(true); | 381 | mFilters.setAutoDelete(true); |
382 | 382 | ||
383 | mCalendar->registerObserver( this ); | 383 | mCalendar->registerObserver( this ); |
384 | // TODO: Make sure that view is updated, when calendar is changed. | 384 | // TODO: Make sure that view is updated, when calendar is changed. |
385 | 385 | ||
386 | mStorage = new FileStorage( mCalendar ); | 386 | mStorage = new FileStorage( mCalendar ); |
387 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 387 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
388 | 388 | ||
389 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 389 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
390 | #ifndef KORG_NOSPLITTER | 390 | #ifndef KORG_NOSPLITTER |
391 | // create the main layout frames. | 391 | // create the main layout frames. |
392 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 392 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
393 | topLayout->addWidget(mPanner); | 393 | topLayout->addWidget(mPanner); |
394 | 394 | ||
395 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 395 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
396 | "CalendarView::LeftFrame"); | 396 | "CalendarView::LeftFrame"); |
397 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 397 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
398 | 398 | ||
399 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 399 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
400 | "CalendarView::DateNavigator" ); | 400 | "CalendarView::DateNavigator" ); |
401 | 401 | ||
402 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 402 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
403 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 403 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
404 | mTodoList->setNavigator( mNavigator ); | 404 | mTodoList->setNavigator( mNavigator ); |
405 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 405 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
406 | 406 | ||
407 | #ifdef KORG_NORESOURCEVIEW | 407 | #ifdef KORG_NORESOURCEVIEW |
408 | mResourceView = 0; | 408 | mResourceView = 0; |
409 | #else | 409 | #else |
410 | if ( mResourceManager ) { | 410 | if ( mResourceManager ) { |
411 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 411 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
412 | mResourceView->updateView(); | 412 | mResourceView->updateView(); |
413 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 413 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
414 | SLOT( updateView() ) ); | 414 | SLOT( updateView() ) ); |
415 | } else { | 415 | } else { |
416 | mResourceView = 0; | 416 | mResourceView = 0; |
417 | } | 417 | } |
418 | #endif | 418 | #endif |
419 | QWidget *rightBox = new QWidget( mPanner ); | 419 | QWidget *rightBox = new QWidget( mPanner ); |
420 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 420 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
421 | 421 | ||
422 | mRightFrame = new QWidgetStack( rightBox ); | 422 | mRightFrame = new QWidgetStack( rightBox ); |
423 | rightLayout->addWidget( mRightFrame, 1 ); | 423 | rightLayout->addWidget( mRightFrame, 1 ); |
424 | 424 | ||
425 | mLeftFrame = mLeftSplitter; | 425 | mLeftFrame = mLeftSplitter; |
426 | #else | 426 | #else |
427 | //QWidget *mainBox = new QWidget( this ); | 427 | //QWidget *mainBox = new QWidget( this ); |
428 | //QWidget *leftFrame = new QWidget( mainBox ); | 428 | //QWidget *leftFrame = new QWidget( mainBox ); |
429 | //QBoxLayout * mainBoxLayout; | 429 | //QBoxLayout * mainBoxLayout; |
430 | if ( KOPrefs::instance()->mVerticalScreen ) { | 430 | if ( KOPrefs::instance()->mVerticalScreen ) { |
431 | //mainBoxLayout = new QVBoxLayout(mainBox); | 431 | //mainBoxLayout = new QVBoxLayout(mainBox); |
432 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 432 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
433 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 433 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
434 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 434 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
435 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 435 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
436 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 436 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
437 | } else { | 437 | } else { |
438 | //mainBoxLayout = new QHBoxLayout(mainBox); | 438 | //mainBoxLayout = new QHBoxLayout(mainBox); |
439 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 439 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
440 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 440 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
441 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 441 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
442 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 442 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
443 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 443 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
444 | } | 444 | } |
445 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 445 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
446 | //QBoxLayout * leftFrameLayout; | 446 | //QBoxLayout * leftFrameLayout; |
447 | mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); | ||
448 | topLayout->addWidget( mMainFrame ); | 447 | topLayout->addWidget( mMainFrame ); |
449 | topLayout->addWidget( mDateScrollBar ); | 448 | #ifdef DESKTOP_VERSION |
449 | mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); | ||
450 | topLayout->addWidget( mDateScrollBar ); | ||
451 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | ||
452 | #endif | ||
450 | //mainBoxLayout->addWidget (mLeftFrame); | 453 | //mainBoxLayout->addWidget (mLeftFrame); |
451 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 454 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
452 | "CalendarView::DateNavigator" ); | 455 | "CalendarView::DateNavigator" ); |
453 | #if 0 | 456 | #if 0 |
454 | // FIXME | 457 | // FIXME |
455 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 458 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
456 | "CalendarView::DateNavigator", QDate::currentDate()); | 459 | "CalendarView::DateNavigator", QDate::currentDate()); |
457 | #endif | 460 | #endif |
458 | // mDateNavigator->blockSignals( true ); | 461 | // mDateNavigator->blockSignals( true ); |
459 | //leftFrameLayout->addWidget( mDateNavigator ); | 462 | //leftFrameLayout->addWidget( mDateNavigator ); |
460 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 463 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
461 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 464 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
462 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 465 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
463 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 466 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
464 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 467 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
465 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); | 468 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); |
466 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 469 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
467 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | 470 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); |
468 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 471 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
469 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 472 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
470 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 473 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
471 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 474 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
472 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 475 | |
473 | mTodoList->setNavigator( mNavigator ); | 476 | mTodoList->setNavigator( mNavigator ); |
474 | #if 0 | 477 | #if 0 |
475 | if ( QApplication::desktop()->width() < 480 ) { | 478 | if ( QApplication::desktop()->width() < 480 ) { |
476 | leftFrameLayout->addWidget(mFilterView); | 479 | leftFrameLayout->addWidget(mFilterView); |
477 | leftFrameLayout->addWidget(mTodoList, 2 ); | 480 | leftFrameLayout->addWidget(mTodoList, 2 ); |
478 | 481 | ||
479 | } else { | 482 | } else { |
480 | leftFrameLayout->addWidget(mTodoList,2 ); | 483 | leftFrameLayout->addWidget(mTodoList,2 ); |
481 | leftFrameLayout->addWidget(mFilterView ); | 484 | leftFrameLayout->addWidget(mFilterView ); |
482 | } | 485 | } |
483 | #endif | 486 | #endif |
484 | mFilterView->hide(); | 487 | mFilterView->hide(); |
485 | mCalEditView->hide(); | 488 | mCalEditView->hide(); |
486 | QWidget *rightBox = new QWidget( mMainFrame ); | 489 | QWidget *rightBox = new QWidget( mMainFrame ); |
487 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 490 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
488 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 491 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
489 | mRightFrame = new QWidgetStack( rightBox ); | 492 | mRightFrame = new QWidgetStack( rightBox ); |
490 | rightLayout->addWidget( mRightFrame, 10 ); | 493 | rightLayout->addWidget( mRightFrame, 10 ); |
491 | 494 | ||
492 | //mLeftFrame = (QWidget *)leftFrame; | 495 | //mLeftFrame = (QWidget *)leftFrame; |
493 | if ( KOPrefs::instance()->mVerticalScreen ) { | 496 | if ( KOPrefs::instance()->mVerticalScreen ) { |
494 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 497 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
495 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 498 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
496 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 499 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
497 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 500 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
498 | } else { | 501 | } else { |
499 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 502 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
500 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 503 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
501 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 504 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
502 | } | 505 | } |
503 | if ( !KOPrefs::instance()->mShowDateNavigator) | 506 | if ( !KOPrefs::instance()->mShowDateNavigator) |
504 | mDateNavigator->hide(); | 507 | mDateNavigator->hide(); |
505 | //qDebug("Calendarview Size %d %d ", width(), height()); | 508 | //qDebug("Calendarview Size %d %d ", width(), height()); |
506 | #endif | 509 | #endif |
507 | 510 | ||
508 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 511 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
509 | SLOT( showDates( const KCal::DateList & ) ) ); | 512 | SLOT( showDates( const KCal::DateList & ) ) ); |
510 | 513 | ||
511 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 514 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
512 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 515 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
513 | 516 | ||
514 | 517 | ||
515 | 518 | ||
516 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 519 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
517 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 520 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
518 | 521 | ||
519 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 522 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
520 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 523 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
521 | 524 | ||
522 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 525 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
523 | mNavigator, SLOT( selectPreviousYear() ) ); | 526 | mNavigator, SLOT( selectPreviousYear() ) ); |
524 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 527 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
525 | mNavigator, SLOT( selectNextYear() ) ); | 528 | mNavigator, SLOT( selectNextYear() ) ); |
526 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 529 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
527 | mNavigator, SLOT( selectPreviousMonth() ) ); | 530 | mNavigator, SLOT( selectPreviousMonth() ) ); |
528 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 531 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
529 | mNavigator, SLOT( selectNextMonth() ) ); | 532 | mNavigator, SLOT( selectNextMonth() ) ); |
530 | 533 | ||
531 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 534 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
532 | mNavigator, SLOT( selectPrevious() ) ); | 535 | mNavigator, SLOT( selectPrevious() ) ); |
533 | connect( mDateNavigator, SIGNAL( goNext() ), | 536 | connect( mDateNavigator, SIGNAL( goNext() ), |
534 | mNavigator, SLOT( selectNext() ) ); | 537 | mNavigator, SLOT( selectNext() ) ); |
535 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 538 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
536 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 539 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
537 | 540 | ||
538 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 541 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
539 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 542 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
540 | #if 0 | 543 | #if 0 |
541 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 544 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
542 | SLOT( incidenceAdded( Incidence *) ) ); | 545 | SLOT( incidenceAdded( Incidence *) ) ); |
543 | #endif | 546 | #endif |
544 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 547 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
545 | 548 | ||
546 | connect( this, SIGNAL( configChanged() ), | 549 | connect( this, SIGNAL( configChanged() ), |
547 | mDateNavigator, SLOT( updateConfig() ) ); | 550 | mDateNavigator, SLOT( updateConfig() ) ); |
548 | 551 | ||
549 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 552 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
550 | SLOT( newTodo() ) ); | 553 | SLOT( newTodo() ) ); |
551 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 554 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
552 | SLOT( newSubTodo( Todo * ) ) ); | 555 | SLOT( newSubTodo( Todo * ) ) ); |
553 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 556 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
554 | SLOT( editTodo( Todo * ) ) ); | 557 | SLOT( editTodo( Todo * ) ) ); |
555 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 558 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
556 | SLOT( showTodo( Todo *) ) ); | 559 | SLOT( showTodo( Todo *) ) ); |
557 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 560 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
558 | SLOT( deleteTodo( Todo *) ) ); | 561 | SLOT( deleteTodo( Todo *) ) ); |
559 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 562 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
560 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 563 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
561 | SLOT( purgeCompleted() ) ); | 564 | SLOT( purgeCompleted() ) ); |
562 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 565 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
563 | SIGNAL( todoModified( Todo *, int ) ) ); | 566 | SIGNAL( todoModified( Todo *, int ) ) ); |
564 | 567 | ||
565 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 568 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
566 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 569 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
567 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 570 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
568 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 571 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
569 | 572 | ||
570 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 573 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
571 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 574 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
572 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 575 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
573 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 576 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
574 | 577 | ||
575 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 578 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
576 | this, SLOT ( todo_unsub( Todo * ) ) ); | 579 | this, SLOT ( todo_unsub( Todo * ) ) ); |
577 | 580 | ||
578 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 581 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
579 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 582 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
580 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 583 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
581 | SLOT( updateTodo( Todo *, int ) ) ); | 584 | SLOT( updateTodo( Todo *, int ) ) ); |
582 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 585 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
583 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 586 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
584 | 587 | ||
585 | 588 | ||
586 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 589 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
587 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 590 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
588 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 591 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
589 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 592 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
590 | 593 | ||
591 | 594 | ||
592 | 595 | ||
593 | 596 | ||
594 | 597 | ||
595 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 598 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
596 | SLOT(checkClipboard())); | 599 | SLOT(checkClipboard())); |
597 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 600 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
598 | SLOT( processTodoListSelection( Incidence * ) ) ); | 601 | SLOT( processTodoListSelection( Incidence * ) ) ); |
599 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 602 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
600 | 603 | ||
601 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 604 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
602 | 605 | ||
603 | mDateFrame = new QVBox(0,0,WType_Popup); | 606 | mDateFrame = new QVBox(0,0,WType_Popup); |
604 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 607 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
605 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 608 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
606 | mDateFrame->setLineWidth(3); | 609 | mDateFrame->setLineWidth(3); |
607 | mDateFrame->hide(); | 610 | mDateFrame->hide(); |
608 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 611 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
609 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 612 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
610 | 613 | ||
611 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 614 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
612 | 615 | ||
613 | mEventEditor = mDialogManager->getEventEditor(); | 616 | mEventEditor = mDialogManager->getEventEditor(); |
614 | mTodoEditor = mDialogManager->getTodoEditor(); | 617 | mTodoEditor = mDialogManager->getTodoEditor(); |
615 | 618 | ||
616 | mFlagEditDescription = false; | 619 | mFlagEditDescription = false; |
617 | 620 | ||
618 | mSuspendTimer = new QTimer( this ); | 621 | mSuspendTimer = new QTimer( this ); |
619 | mAlarmTimer = new QTimer( this ); | 622 | mAlarmTimer = new QTimer( this ); |
620 | mRecheckAlarmTimer = new QTimer( this ); | 623 | mRecheckAlarmTimer = new QTimer( this ); |
621 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 624 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
622 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 625 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
623 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 626 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
624 | mAlarmDialog = new AlarmDialog( this ); | 627 | mAlarmDialog = new AlarmDialog( this ); |
625 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 628 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
626 | mAlarmDialog->setServerNotification( false ); | 629 | mAlarmDialog->setServerNotification( false ); |
627 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 630 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
628 | 631 | ||
629 | 632 | ||
630 | #ifndef DESKTOP_VERSION | 633 | #ifndef DESKTOP_VERSION |
631 | //US listen for arriving address resultsets | 634 | //US listen for arriving address resultsets |
632 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 635 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
633 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 636 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
634 | #endif | 637 | #endif |
635 | mDateNavigator->setCalendar( mCalendar ); | 638 | mDateNavigator->setCalendar( mCalendar ); |
636 | } | 639 | } |
637 | 640 | ||
638 | 641 | ||
639 | CalendarView::~CalendarView() | 642 | CalendarView::~CalendarView() |
640 | { | 643 | { |
641 | // kdDebug() << "~CalendarView()" << endl; | 644 | // kdDebug() << "~CalendarView()" << endl; |
642 | //qDebug("CalendarView::~CalendarView() "); | 645 | //qDebug("CalendarView::~CalendarView() "); |
643 | delete mDialogManager; | 646 | delete mDialogManager; |
644 | delete mViewManager; | 647 | delete mViewManager; |
645 | delete mStorage; | 648 | delete mStorage; |
646 | delete mDateFrame ; | 649 | delete mDateFrame ; |
647 | delete mEventViewerDialog; | 650 | delete mEventViewerDialog; |
648 | //kdDebug() << "~CalendarView() done" << endl; | 651 | //kdDebug() << "~CalendarView() done" << endl; |
649 | } | 652 | } |
650 | void CalendarView::setScrollBarStep(int val ) | 653 | void CalendarView::setScrollBarStep(int val ) |
651 | { | 654 | { |
655 | #ifdef DESKTOP_VERSION | ||
652 | mDateScrollBar->setLineStep ( val ); | 656 | mDateScrollBar->setLineStep ( val ); |
657 | #endif | ||
653 | } | 658 | } |
654 | void CalendarView::scrollBarValue(int val ) | 659 | void CalendarView::scrollBarValue(int val ) |
655 | { | 660 | { |
661 | #ifdef DESKTOP_VERSION | ||
662 | if ( QApplication::desktop()->width() < 800 ) return; | ||
656 | static bool block = false; | 663 | static bool block = false; |
657 | if ( block ) return; | 664 | if ( block ) return; |
658 | block = true; | 665 | block = true; |
659 | val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 666 | val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
660 | //qDebug("VAL %d ",val ); | 667 | //qDebug("VAL %d ",val ); |
661 | int count = mNavigator->selectedDates().count(); | 668 | int count = mNavigator->selectedDates().count(); |
662 | int year = mNavigator->selectedDates().first().year(); | 669 | int year = mNavigator->selectedDates().first().year(); |
663 | int day = mNavigator->selectedDates().first().dayOfYear(); | 670 | int day = mNavigator->selectedDates().first().dayOfYear(); |
664 | if ( val == day -1 ) { | 671 | if ( val == day -1 ) { |
665 | block = false; | 672 | block = false; |
666 | return; | 673 | return; |
667 | } | 674 | } |
668 | QDate d ( year,1,1 ); | 675 | QDate d ( year,1,1 ); |
669 | mNavigator->selectDates( d.addDays( val ), count ); | 676 | mNavigator->selectDates( d.addDays( val ), count ); |
670 | block = false; | 677 | block = false; |
678 | #endif | ||
671 | 679 | ||
672 | } | 680 | } |
673 | 681 | ||
674 | void CalendarView::checkAlarms() | 682 | void CalendarView::checkAlarms() |
675 | { | 683 | { |
676 | KConfig *config = KOGlobals::config(); | 684 | KConfig *config = KOGlobals::config(); |
677 | config->setGroup( "AppRun" ); | 685 | config->setGroup( "AppRun" ); |
678 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 686 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
679 | int daysto = dt.daysTo( QDate::currentDate() ); | 687 | int daysto = dt.daysTo( QDate::currentDate() ); |
680 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 688 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
681 | dt = dt.addDays( days ); | 689 | dt = dt.addDays( days ); |
682 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 690 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
683 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 691 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
684 | //qDebug("KO: Reading program stop %d ", secs); | 692 | //qDebug("KO: Reading program stop %d ", secs); |
685 | //secs -= ( 3600 * 24*3 ); // debug only | 693 | //secs -= ( 3600 * 24*3 ); // debug only |
686 | QDateTime latest = dt.addSecs ( secs ); | 694 | QDateTime latest = dt.addSecs ( secs ); |
687 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 695 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
688 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 696 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
689 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 697 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
690 | QPtrList<Incidence> al; | 698 | QPtrList<Incidence> al; |
691 | Incidence* inL = el.first(); | 699 | Incidence* inL = el.first(); |
692 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 700 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
693 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 701 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
694 | while ( inL ) { | 702 | while ( inL ) { |
695 | bool ok = false; | 703 | bool ok = false; |
696 | int offset = 0; | 704 | int offset = 0; |
697 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 705 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
698 | if ( ok ) { | 706 | if ( ok ) { |
699 | //qDebug("OK %s",next.toString().latin1()); | 707 | //qDebug("OK %s",next.toString().latin1()); |
700 | if ( next < cur ) { | 708 | if ( next < cur ) { |
701 | al.append( inL ); | 709 | al.append( inL ); |
702 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 710 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
703 | } | 711 | } |
704 | } | 712 | } |
705 | inL = el.next(); | 713 | inL = el.next(); |
706 | } | 714 | } |
707 | if ( al.count() ) { | 715 | if ( al.count() ) { |
708 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 716 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
709 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 717 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
710 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 718 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
711 | lay->setSpacing( 0 ); | 719 | lay->setSpacing( 0 ); |
712 | lay->setMargin( 0 ); | 720 | lay->setMargin( 0 ); |
713 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 721 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
714 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 722 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
715 | lay->addWidget( matb ); | 723 | lay->addWidget( matb ); |
716 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 724 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
717 | int wid = 210; | 725 | int wid = 210; |
718 | int x = QApplication::desktop()->width() - wid - 7; | 726 | int x = QApplication::desktop()->width() - wid - 7; |
719 | int y = QApplication::desktop()->height() - wid - 70; | 727 | int y = QApplication::desktop()->height() - wid - 70; |
720 | dia->setGeometry ( x,y,wid,wid); | 728 | dia->setGeometry ( x,y,wid,wid); |
721 | } else { | 729 | } else { |
722 | int si = 220; | 730 | int si = 220; |
723 | if ( QApplication::desktop()->width() > 470 ) | 731 | if ( QApplication::desktop()->width() > 470 ) |
724 | si = 400; | 732 | si = 400; |
725 | dia->resize(si,si/2); | 733 | dia->resize(si,si/2); |
726 | } | 734 | } |
727 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 735 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
728 | dia->show(); | 736 | dia->show(); |
729 | 737 | ||
730 | } | 738 | } |
731 | } | 739 | } |
732 | void CalendarView::showDay( QDate d ) | 740 | void CalendarView::showDay( QDate d ) |
733 | { | 741 | { |
734 | dateNavigator()->blockSignals( true ); | 742 | dateNavigator()->blockSignals( true ); |
735 | dateNavigator()->selectDate( d ); | 743 | dateNavigator()->selectDate( d ); |
736 | dateNavigator()->blockSignals( false ); | 744 | dateNavigator()->blockSignals( false ); |
737 | mViewManager->showDayView(); | 745 | mViewManager->showDayView(); |
738 | //dateNavigator()->selectDate( d ); | 746 | //dateNavigator()->selectDate( d ); |
739 | } | 747 | } |
740 | void CalendarView::timerAlarm() | 748 | void CalendarView::timerAlarm() |
741 | { | 749 | { |
742 | //qDebug("CalendarView::timerAlarm() "); | 750 | //qDebug("CalendarView::timerAlarm() "); |
743 | computeAlarm(mAlarmNotification ); | 751 | computeAlarm(mAlarmNotification ); |
744 | } | 752 | } |
745 | 753 | ||
746 | void CalendarView::suspendAlarm() | 754 | void CalendarView::suspendAlarm() |
747 | { | 755 | { |
748 | //qDebug(" CalendarView::suspendAlarm() "); | 756 | //qDebug(" CalendarView::suspendAlarm() "); |
749 | computeAlarm(mSuspendAlarmNotification ); | 757 | computeAlarm(mSuspendAlarmNotification ); |
750 | 758 | ||
751 | } | 759 | } |
752 | 760 | ||
753 | void CalendarView::startAlarm( QString mess , QString filename) | 761 | void CalendarView::startAlarm( QString mess , QString filename) |
754 | { | 762 | { |
755 | 763 | ||
756 | topLevelWidget()->showNormal(); | 764 | topLevelWidget()->showNormal(); |
757 | topLevelWidget()->setActiveWindow(); | 765 | topLevelWidget()->setActiveWindow(); |
758 | topLevelWidget()->raise(); | 766 | topLevelWidget()->raise(); |
759 | 767 | ||
760 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 768 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
761 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 769 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
762 | 770 | ||
763 | } | 771 | } |
764 | 772 | ||
765 | void CalendarView::checkNextTimerAlarm() | 773 | void CalendarView::checkNextTimerAlarm() |
766 | { | 774 | { |
767 | mCalendar->checkAlarmForIncidence( 0, true ); | 775 | mCalendar->checkAlarmForIncidence( 0, true ); |
768 | } | 776 | } |
769 | 777 | ||
770 | void CalendarView::computeAlarm( QString msg ) | 778 | void CalendarView::computeAlarm( QString msg ) |
771 | { | 779 | { |
772 | 780 | ||
773 | QString mess = msg; | 781 | QString mess = msg; |
774 | QString mAlarmMessage = mess.mid( 9 ); | 782 | QString mAlarmMessage = mess.mid( 9 ); |
775 | QString filename = MainWindow::resourcePath(); | 783 | QString filename = MainWindow::resourcePath(); |
776 | filename += "koalarm.wav"; | 784 | filename += "koalarm.wav"; |
777 | QString tempfilename; | 785 | QString tempfilename; |
778 | if ( mess.left( 13 ) == "suspend_alarm") { | 786 | if ( mess.left( 13 ) == "suspend_alarm") { |
779 | bool error = false; | 787 | bool error = false; |
780 | int len = mess.mid( 13 ).find("+++"); | 788 | int len = mess.mid( 13 ).find("+++"); |
781 | if ( len < 2 ) | 789 | if ( len < 2 ) |
782 | error = true; | 790 | error = true; |
783 | else { | 791 | else { |
784 | tempfilename = mess.mid( 13, len ); | 792 | tempfilename = mess.mid( 13, len ); |
785 | if ( !QFile::exists( tempfilename ) ) | 793 | if ( !QFile::exists( tempfilename ) ) |
786 | error = true; | 794 | error = true; |
787 | } | 795 | } |
788 | if ( ! error ) { | 796 | if ( ! error ) { |
789 | filename = tempfilename; | 797 | filename = tempfilename; |
790 | } | 798 | } |
791 | mAlarmMessage = mess.mid( 13+len+3 ); | 799 | mAlarmMessage = mess.mid( 13+len+3 ); |
792 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 800 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
793 | startAlarm( mAlarmMessage, filename); | 801 | startAlarm( mAlarmMessage, filename); |
794 | return; | 802 | return; |
795 | } | 803 | } |
796 | if ( mess.left( 11 ) == "timer_alarm") { | 804 | if ( mess.left( 11 ) == "timer_alarm") { |
797 | //mTimerTime = 0; | 805 | //mTimerTime = 0; |
798 | startAlarm( mess.mid( 11 ), filename ); | 806 | startAlarm( mess.mid( 11 ), filename ); |
@@ -2459,257 +2467,259 @@ void CalendarView::writeFilterSettings(KConfig *config) | |||
2459 | } | 2467 | } |
2460 | config->setGroup("General"); | 2468 | config->setGroup("General"); |
2461 | config->writeEntry("CalendarFilters",filterList); | 2469 | config->writeEntry("CalendarFilters",filterList); |
2462 | 2470 | ||
2463 | config->setGroup("FilterView"); | 2471 | config->setGroup("FilterView"); |
2464 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2472 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2465 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2473 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2466 | } | 2474 | } |
2467 | 2475 | ||
2468 | 2476 | ||
2469 | void CalendarView::goToday() | 2477 | void CalendarView::goToday() |
2470 | { | 2478 | { |
2471 | if ( mViewManager->currentView()->isMonthView() ) | 2479 | if ( mViewManager->currentView()->isMonthView() ) |
2472 | mNavigator->selectTodayMonth(); | 2480 | mNavigator->selectTodayMonth(); |
2473 | else | 2481 | else |
2474 | mNavigator->selectToday(); | 2482 | mNavigator->selectToday(); |
2475 | } | 2483 | } |
2476 | 2484 | ||
2477 | void CalendarView::goNext() | 2485 | void CalendarView::goNext() |
2478 | { | 2486 | { |
2479 | mNavigator->selectNext(); | 2487 | mNavigator->selectNext(); |
2480 | } | 2488 | } |
2481 | 2489 | ||
2482 | void CalendarView::goPrevious() | 2490 | void CalendarView::goPrevious() |
2483 | { | 2491 | { |
2484 | mNavigator->selectPrevious(); | 2492 | mNavigator->selectPrevious(); |
2485 | } | 2493 | } |
2486 | void CalendarView::goNextMonth() | 2494 | void CalendarView::goNextMonth() |
2487 | { | 2495 | { |
2488 | mNavigator->selectNextMonth(); | 2496 | mNavigator->selectNextMonth(); |
2489 | } | 2497 | } |
2490 | 2498 | ||
2491 | void CalendarView::goPreviousMonth() | 2499 | void CalendarView::goPreviousMonth() |
2492 | { | 2500 | { |
2493 | mNavigator->selectPreviousMonth(); | 2501 | mNavigator->selectPreviousMonth(); |
2494 | } | 2502 | } |
2495 | 2503 | ||
2496 | void CalendarView::updateConfig() | 2504 | void CalendarView::updateConfig() |
2497 | { | 2505 | { |
2498 | if ( KOPrefs::instance()->mUseAppColors ) | 2506 | if ( KOPrefs::instance()->mUseAppColors ) |
2499 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2507 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2500 | emit configChanged(); | 2508 | emit configChanged(); |
2501 | mTodoList->updateConfig(); | 2509 | mTodoList->updateConfig(); |
2502 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2510 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2503 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2511 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2504 | // To make the "fill window" configurations work | 2512 | // To make the "fill window" configurations work |
2505 | //mViewManager->raiseCurrentView(); | 2513 | //mViewManager->raiseCurrentView(); |
2506 | } | 2514 | } |
2507 | 2515 | ||
2508 | 2516 | ||
2509 | void CalendarView::eventChanged(Event *event) | 2517 | void CalendarView::eventChanged(Event *event) |
2510 | { | 2518 | { |
2511 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2519 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2512 | //updateUnmanagedViews(); | 2520 | //updateUnmanagedViews(); |
2513 | } | 2521 | } |
2514 | 2522 | ||
2515 | void CalendarView::eventAdded(Event *event) | 2523 | void CalendarView::eventAdded(Event *event) |
2516 | { | 2524 | { |
2517 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2525 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2518 | } | 2526 | } |
2519 | 2527 | ||
2520 | void CalendarView::eventToBeDeleted(Event *) | 2528 | void CalendarView::eventToBeDeleted(Event *) |
2521 | { | 2529 | { |
2522 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2530 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2523 | } | 2531 | } |
2524 | 2532 | ||
2525 | void CalendarView::eventDeleted() | 2533 | void CalendarView::eventDeleted() |
2526 | { | 2534 | { |
2527 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2535 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2528 | } | 2536 | } |
2529 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2537 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2530 | { | 2538 | { |
2531 | changeIncidenceDisplay((Incidence *)which, action); | 2539 | changeIncidenceDisplay((Incidence *)which, action); |
2532 | mDateNavigator->updateView(); //LR | 2540 | mDateNavigator->updateView(); //LR |
2533 | //mDialogManager->updateSearchDialog(); | 2541 | //mDialogManager->updateSearchDialog(); |
2534 | 2542 | ||
2535 | if (which) { | 2543 | if (which) { |
2536 | mViewManager->updateWNview(); | 2544 | mViewManager->updateWNview(); |
2537 | //mTodoList->updateView(); | 2545 | //mTodoList->updateView(); |
2538 | } | 2546 | } |
2539 | 2547 | ||
2540 | } | 2548 | } |
2541 | 2549 | ||
2542 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2550 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2543 | { | 2551 | { |
2544 | updateUnmanagedViews(); | 2552 | updateUnmanagedViews(); |
2545 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2553 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2546 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2554 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2547 | mCalendar->checkAlarmForIncidence( 0, true ); | 2555 | mCalendar->checkAlarmForIncidence( 0, true ); |
2548 | if ( mEventViewerDialog ) | 2556 | if ( mEventViewerDialog ) |
2549 | mEventViewerDialog->hide(); | 2557 | mEventViewerDialog->hide(); |
2550 | } | 2558 | } |
2551 | else | 2559 | else |
2552 | mCalendar->checkAlarmForIncidence( which , false ); | 2560 | mCalendar->checkAlarmForIncidence( which , false ); |
2553 | } | 2561 | } |
2554 | 2562 | ||
2555 | // most of the changeEventDisplays() right now just call the view's | 2563 | // most of the changeEventDisplays() right now just call the view's |
2556 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2564 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2557 | void CalendarView::changeEventDisplay(Event *which, int action) | 2565 | void CalendarView::changeEventDisplay(Event *which, int action) |
2558 | { | 2566 | { |
2559 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2567 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2560 | changeIncidenceDisplay((Incidence *)which, action); | 2568 | changeIncidenceDisplay((Incidence *)which, action); |
2561 | mDateNavigator->updateView(); | 2569 | mDateNavigator->updateView(); |
2562 | //mDialogManager->updateSearchDialog(); | 2570 | //mDialogManager->updateSearchDialog(); |
2563 | 2571 | ||
2564 | if (which) { | 2572 | if (which) { |
2565 | // If there is an event view visible update the display | 2573 | // If there is an event view visible update the display |
2566 | mViewManager->currentView()->changeEventDisplay(which,action); | 2574 | mViewManager->currentView()->changeEventDisplay(which,action); |
2567 | // TODO: check, if update needed | 2575 | // TODO: check, if update needed |
2568 | // if (which->getTodoStatus()) { | 2576 | // if (which->getTodoStatus()) { |
2569 | mTodoList->updateView(); | 2577 | mTodoList->updateView(); |
2570 | // } | 2578 | // } |
2571 | } else { | 2579 | } else { |
2572 | mViewManager->currentView()->updateView(); | 2580 | mViewManager->currentView()->updateView(); |
2573 | } | 2581 | } |
2574 | } | 2582 | } |
2575 | 2583 | ||
2576 | 2584 | ||
2577 | void CalendarView::updateTodoViews() | 2585 | void CalendarView::updateTodoViews() |
2578 | { | 2586 | { |
2579 | mTodoList->updateView(); | 2587 | mTodoList->updateView(); |
2580 | mViewManager->currentView()->updateView(); | 2588 | mViewManager->currentView()->updateView(); |
2581 | 2589 | ||
2582 | } | 2590 | } |
2583 | 2591 | ||
2584 | 2592 | ||
2585 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2593 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2586 | { | 2594 | { |
2595 | #ifdef DESKTOP_VERSION | ||
2587 | mDateScrollBar->setValue( start.dayOfYear()-1); | 2596 | mDateScrollBar->setValue( start.dayOfYear()-1); |
2597 | #endif | ||
2588 | mTodoList->updateView(); | 2598 | mTodoList->updateView(); |
2589 | mViewManager->updateView(start, end); | 2599 | mViewManager->updateView(start, end); |
2590 | //mDateNavigator->updateView(); | 2600 | //mDateNavigator->updateView(); |
2591 | } | 2601 | } |
2592 | 2602 | ||
2593 | void CalendarView::clearAllViews() | 2603 | void CalendarView::clearAllViews() |
2594 | { | 2604 | { |
2595 | mTodoList->clearList(); | 2605 | mTodoList->clearList(); |
2596 | mViewManager->clearAllViews(); | 2606 | mViewManager->clearAllViews(); |
2597 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2607 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2598 | if ( sd ) { | 2608 | if ( sd ) { |
2599 | KOListView* kol = sd->listview(); | 2609 | KOListView* kol = sd->listview(); |
2600 | if ( kol ) | 2610 | if ( kol ) |
2601 | kol->clearList(); | 2611 | kol->clearList(); |
2602 | } | 2612 | } |
2603 | } | 2613 | } |
2604 | void CalendarView::updateView() | 2614 | void CalendarView::updateView() |
2605 | { | 2615 | { |
2606 | DateList tmpList = mNavigator->selectedDates(); | 2616 | DateList tmpList = mNavigator->selectedDates(); |
2607 | 2617 | ||
2608 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2618 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2609 | mTodoList->updateView(); | 2619 | mTodoList->updateView(); |
2610 | // We assume that the navigator only selects consecutive days. | 2620 | // We assume that the navigator only selects consecutive days. |
2611 | updateView( tmpList.first(), tmpList.last() ); | 2621 | updateView( tmpList.first(), tmpList.last() ); |
2612 | } | 2622 | } |
2613 | 2623 | ||
2614 | void CalendarView::updateUnmanagedViews() | 2624 | void CalendarView::updateUnmanagedViews() |
2615 | { | 2625 | { |
2616 | mDateNavigator->updateDayMatrix(); | 2626 | mDateNavigator->updateDayMatrix(); |
2617 | } | 2627 | } |
2618 | 2628 | ||
2619 | int CalendarView::msgItemDelete(const QString name) | 2629 | int CalendarView::msgItemDelete(const QString name) |
2620 | { | 2630 | { |
2621 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2631 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2622 | i18n("This item will be\npermanently deleted."), | 2632 | i18n("This item will be\npermanently deleted."), |
2623 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2633 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2624 | } | 2634 | } |
2625 | 2635 | ||
2626 | 2636 | ||
2627 | void CalendarView::edit_cut() | 2637 | void CalendarView::edit_cut() |
2628 | { | 2638 | { |
2629 | Event *anEvent=0; | 2639 | Event *anEvent=0; |
2630 | 2640 | ||
2631 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2641 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2632 | 2642 | ||
2633 | if (mViewManager->currentView()->isEventView()) { | 2643 | if (mViewManager->currentView()->isEventView()) { |
2634 | if ( incidence && incidence->typeID() == eventID ) { | 2644 | if ( incidence && incidence->typeID() == eventID ) { |
2635 | anEvent = static_cast<Event *>(incidence); | 2645 | anEvent = static_cast<Event *>(incidence); |
2636 | } | 2646 | } |
2637 | } | 2647 | } |
2638 | 2648 | ||
2639 | if (!anEvent) { | 2649 | if (!anEvent) { |
2640 | KNotifyClient::beep(); | 2650 | KNotifyClient::beep(); |
2641 | return; | 2651 | return; |
2642 | } | 2652 | } |
2643 | DndFactory factory( mCalendar ); | 2653 | DndFactory factory( mCalendar ); |
2644 | factory.cutIncidence(anEvent); | 2654 | factory.cutIncidence(anEvent); |
2645 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2655 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2646 | } | 2656 | } |
2647 | 2657 | ||
2648 | void CalendarView::edit_copy() | 2658 | void CalendarView::edit_copy() |
2649 | { | 2659 | { |
2650 | Event *anEvent=0; | 2660 | Event *anEvent=0; |
2651 | 2661 | ||
2652 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2662 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2653 | 2663 | ||
2654 | if (mViewManager->currentView()->isEventView()) { | 2664 | if (mViewManager->currentView()->isEventView()) { |
2655 | if ( incidence && incidence->typeID() == eventID ) { | 2665 | if ( incidence && incidence->typeID() == eventID ) { |
2656 | anEvent = static_cast<Event *>(incidence); | 2666 | anEvent = static_cast<Event *>(incidence); |
2657 | } | 2667 | } |
2658 | } | 2668 | } |
2659 | 2669 | ||
2660 | if (!anEvent) { | 2670 | if (!anEvent) { |
2661 | KNotifyClient::beep(); | 2671 | KNotifyClient::beep(); |
2662 | return; | 2672 | return; |
2663 | } | 2673 | } |
2664 | DndFactory factory( mCalendar ); | 2674 | DndFactory factory( mCalendar ); |
2665 | factory.copyIncidence(anEvent); | 2675 | factory.copyIncidence(anEvent); |
2666 | } | 2676 | } |
2667 | 2677 | ||
2668 | void CalendarView::edit_paste() | 2678 | void CalendarView::edit_paste() |
2669 | { | 2679 | { |
2670 | QDate date = mNavigator->selectedDates().first(); | 2680 | QDate date = mNavigator->selectedDates().first(); |
2671 | 2681 | ||
2672 | DndFactory factory( mCalendar ); | 2682 | DndFactory factory( mCalendar ); |
2673 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2683 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2674 | 2684 | ||
2675 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2685 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2676 | } | 2686 | } |
2677 | void CalendarView::edit_global_options() | 2687 | void CalendarView::edit_global_options() |
2678 | { | 2688 | { |
2679 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2689 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2680 | emit save(); | 2690 | emit save(); |
2681 | emit saveStopTimer(); | 2691 | emit saveStopTimer(); |
2682 | mDialogManager->showGlobalOptionsDialog(); | 2692 | mDialogManager->showGlobalOptionsDialog(); |
2683 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2693 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2684 | emit saveStopTimer(); | 2694 | emit saveStopTimer(); |
2685 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2695 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2686 | i18n("Timezone settings"),i18n("Reload"))) { | 2696 | i18n("Timezone settings"),i18n("Reload"))) { |
2687 | qDebug("KO: TZ reload cancelled "); | 2697 | qDebug("KO: TZ reload cancelled "); |
2688 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2698 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2689 | return; | 2699 | return; |
2690 | } | 2700 | } |
2691 | qDebug("KO: Timezone change "); | 2701 | qDebug("KO: Timezone change "); |
2692 | loadCalendars(); | 2702 | loadCalendars(); |
2693 | setModified(true); | 2703 | setModified(true); |
2694 | } | 2704 | } |
2695 | else | 2705 | else |
2696 | qDebug("KO: No tz change "); | 2706 | qDebug("KO: No tz change "); |
2697 | } | 2707 | } |
2698 | void CalendarView::edit_options() | 2708 | void CalendarView::edit_options() |
2699 | { | 2709 | { |
2700 | mDialogManager->showOptionsDialog(); | 2710 | mDialogManager->showOptionsDialog(); |
2701 | } | 2711 | } |
2702 | 2712 | ||
2703 | 2713 | ||
2704 | void CalendarView::slotSelectPickerDate( QDate d) | 2714 | void CalendarView::slotSelectPickerDate( QDate d) |
2705 | { | 2715 | { |
2706 | mDateFrame->hide(); | 2716 | mDateFrame->hide(); |
2707 | if ( mDatePickerMode == 1 ) { | 2717 | if ( mDatePickerMode == 1 ) { |
2708 | mNavigator->slotDaySelect( d ); | 2718 | mNavigator->slotDaySelect( d ); |
2709 | } else if ( mDatePickerMode == 2 ) { | 2719 | } else if ( mDatePickerMode == 2 ) { |
2710 | if ( mMoveIncidence->typeID() == todoID ) { | 2720 | if ( mMoveIncidence->typeID() == todoID ) { |
2711 | Todo * to = (Todo *) mMoveIncidence; | 2721 | Todo * to = (Todo *) mMoveIncidence; |
2712 | QTime tim; | 2722 | QTime tim; |
2713 | int len = 0; | 2723 | int len = 0; |
2714 | if ( to->hasStartDate() && to->hasDueDate() ) | 2724 | if ( to->hasStartDate() && to->hasDueDate() ) |
2715 | len = to->dtStart().secsTo( to->dtDue()); | 2725 | len = to->dtStart().secsTo( to->dtDue()); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index c89bbf7..f7e5366 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -410,246 +410,248 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
410 | bool isReadOnly(); | 410 | bool isReadOnly(); |
411 | /** set state of calendar to read-only */ | 411 | /** set state of calendar to read-only */ |
412 | void setReadOnly(bool readOnly=true); | 412 | void setReadOnly(bool readOnly=true); |
413 | 413 | ||
414 | void eventUpdated(Incidence *); | 414 | void eventUpdated(Incidence *); |
415 | 415 | ||
416 | /* iTIP scheduling actions */ | 416 | /* iTIP scheduling actions */ |
417 | void schedule_publish(Incidence *incidence = 0); | 417 | void schedule_publish(Incidence *incidence = 0); |
418 | void schedule_request(Incidence *incidence = 0); | 418 | void schedule_request(Incidence *incidence = 0); |
419 | void schedule_refresh(Incidence *incidence = 0); | 419 | void schedule_refresh(Incidence *incidence = 0); |
420 | void schedule_cancel(Incidence *incidence = 0); | 420 | void schedule_cancel(Incidence *incidence = 0); |
421 | void schedule_add(Incidence *incidence = 0); | 421 | void schedule_add(Incidence *incidence = 0); |
422 | void schedule_reply(Incidence *incidence = 0); | 422 | void schedule_reply(Incidence *incidence = 0); |
423 | void schedule_counter(Incidence *incidence = 0); | 423 | void schedule_counter(Incidence *incidence = 0); |
424 | void schedule_declinecounter(Incidence *incidence = 0); | 424 | void schedule_declinecounter(Incidence *incidence = 0); |
425 | void schedule_publish_freebusy(int daysToPublish = 30); | 425 | void schedule_publish_freebusy(int daysToPublish = 30); |
426 | 426 | ||
427 | void openAddressbook(); | 427 | void openAddressbook(); |
428 | 428 | ||
429 | void editFilters(); | 429 | void editFilters(); |
430 | void toggleFilerEnabled(); | 430 | void toggleFilerEnabled(); |
431 | QPtrList<CalFilter> filters(); | 431 | QPtrList<CalFilter> filters(); |
432 | void toggleFilter(); | 432 | void toggleFilter(); |
433 | void showFilter(bool visible); | 433 | void showFilter(bool visible); |
434 | void updateFilter(); | 434 | void updateFilter(); |
435 | void filterEdited(); | 435 | void filterEdited(); |
436 | void selectFilter( int ); | 436 | void selectFilter( int ); |
437 | KOFilterView *filterView(); | 437 | KOFilterView *filterView(); |
438 | 438 | ||
439 | void showIntro(); | 439 | void showIntro(); |
440 | 440 | ||
441 | /** Move the curdatepient view date to today */ | 441 | /** Move the curdatepient view date to today */ |
442 | void goToday(); | 442 | void goToday(); |
443 | 443 | ||
444 | /** Move to the next date(s) in the current view */ | 444 | /** Move to the next date(s) in the current view */ |
445 | void goNext(); | 445 | void goNext(); |
446 | 446 | ||
447 | /** Move to the previous date(s) in the current view */ | 447 | /** Move to the previous date(s) in the current view */ |
448 | void goPrevious(); | 448 | void goPrevious(); |
449 | /** Move to the next date(s) in the current view */ | 449 | /** Move to the next date(s) in the current view */ |
450 | void goNextMonth(); | 450 | void goNextMonth(); |
451 | 451 | ||
452 | /** Move to the previous date(s) in the current view */ | 452 | /** Move to the previous date(s) in the current view */ |
453 | void goPreviousMonth(); | 453 | void goPreviousMonth(); |
454 | 454 | ||
455 | void toggleExpand(); | 455 | void toggleExpand(); |
456 | void toggleDateNavigatorWidget(); | 456 | void toggleDateNavigatorWidget(); |
457 | void toggleAllDaySize(); | 457 | void toggleAllDaySize(); |
458 | void dialogClosing(Incidence *); | 458 | void dialogClosing(Incidence *); |
459 | 459 | ||
460 | /** Look for new messages in the inbox */ | 460 | /** Look for new messages in the inbox */ |
461 | void lookForIncomingMessages(); | 461 | void lookForIncomingMessages(); |
462 | /** Look for new messages in the outbox */ | 462 | /** Look for new messages in the outbox */ |
463 | void lookForOutgoingMessages(); | 463 | void lookForOutgoingMessages(); |
464 | 464 | ||
465 | void processMainViewSelection( Incidence * ); | 465 | void processMainViewSelection( Incidence * ); |
466 | void processTodoListSelection( Incidence * ); | 466 | void processTodoListSelection( Incidence * ); |
467 | 467 | ||
468 | void processIncidenceSelection( Incidence * ); | 468 | void processIncidenceSelection( Incidence * ); |
469 | 469 | ||
470 | void purgeCompleted(); | 470 | void purgeCompleted(); |
471 | bool removeCompletedSubTodos( Todo* ); | 471 | bool removeCompletedSubTodos( Todo* ); |
472 | void slotCalendarChanged(); | 472 | void slotCalendarChanged(); |
473 | bool importBday(); | 473 | bool importBday(); |
474 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 474 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
475 | bool importQtopia( const QString &categoriesFile, | 475 | bool importQtopia( const QString &categoriesFile, |
476 | const QString &datebookFile, | 476 | const QString &datebookFile, |
477 | const QString &tasklistFile ); | 477 | const QString &tasklistFile ); |
478 | void syncExternal( int mode ); | 478 | void syncExternal( int mode ); |
479 | void slotSelectPickerDate( QDate ) ; | 479 | void slotSelectPickerDate( QDate ) ; |
480 | void showDatePicker() ; | 480 | void showDatePicker() ; |
481 | void showDatePickerPopup() ; | 481 | void showDatePickerPopup() ; |
482 | void moveIncidence(Incidence *) ; | 482 | void moveIncidence(Incidence *) ; |
483 | void beamIncidence(Incidence *) ; | 483 | void beamIncidence(Incidence *) ; |
484 | void beamCalendar() ; | 484 | void beamCalendar() ; |
485 | void beamFilteredCalendar() ; | 485 | void beamFilteredCalendar() ; |
486 | void beamIncidenceList(QPtrList<Incidence>) ; | 486 | void beamIncidenceList(QPtrList<Incidence>) ; |
487 | void manageCategories(); | 487 | void manageCategories(); |
488 | int addCategories(); | 488 | int addCategories(); |
489 | void removeCategories(); | 489 | void removeCategories(); |
490 | void setSyncDevice( QString ); | 490 | void setSyncDevice( QString ); |
491 | void setSyncName( QString ); | 491 | void setSyncName( QString ); |
492 | void showDay( QDate ); | 492 | void showDay( QDate ); |
493 | void undo_delete(); | 493 | void undo_delete(); |
494 | protected slots: | 494 | protected slots: |
495 | void resetFocus(); | 495 | void resetFocus(); |
496 | void scrollBarValue(int); | 496 | void scrollBarValue(int); |
497 | void slotViewerClosed(); | 497 | void slotViewerClosed(); |
498 | void timerAlarm(); | 498 | void timerAlarm(); |
499 | void suspendAlarm(); | 499 | void suspendAlarm(); |
500 | void beamDone( Ir *ir ); | 500 | void beamDone( Ir *ir ); |
501 | /** Select a view or adapt the current view to display the specified dates. */ | 501 | /** Select a view or adapt the current view to display the specified dates. */ |
502 | void showDates( const KCal::DateList & ); | 502 | void showDates( const KCal::DateList & ); |
503 | void selectWeekNum ( int ); | 503 | void selectWeekNum ( int ); |
504 | 504 | ||
505 | public: | 505 | public: |
506 | // show a standard warning | 506 | // show a standard warning |
507 | // returns KMsgBox::yesNoCancel() | 507 | // returns KMsgBox::yesNoCancel() |
508 | int msgCalModified(); | 508 | int msgCalModified(); |
509 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 509 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
510 | 510 | ||
511 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 511 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
512 | virtual void removeSyncInfo( QString syncProfile); | 512 | virtual void removeSyncInfo( QString syncProfile); |
513 | void setSyncManager(KSyncManager* manager); | 513 | void setSyncManager(KSyncManager* manager); |
514 | void setLoadedFileVersion(QDateTime); | 514 | void setLoadedFileVersion(QDateTime); |
515 | bool checkFileVersion(QString fn); | 515 | bool checkFileVersion(QString fn); |
516 | bool checkAllFileVersions(); | 516 | bool checkAllFileVersions(); |
517 | bool checkFileChanged(QString fn); | 517 | bool checkFileChanged(QString fn); |
518 | Event* getLastSyncEvent(); | 518 | Event* getLastSyncEvent(); |
519 | /** Adapt navigation units correpsonding to step size of navigation of the | 519 | /** Adapt navigation units correpsonding to step size of navigation of the |
520 | * current view. | 520 | * current view. |
521 | */ | 521 | */ |
522 | void adaptNavigationUnits(); | 522 | void adaptNavigationUnits(); |
523 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 523 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
524 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 524 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
525 | //Attendee* getYourAttendee(Event *event); | 525 | //Attendee* getYourAttendee(Event *event); |
526 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 526 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
527 | void setScrollBarStep(int val ); | 527 | void setScrollBarStep(int val ); |
528 | 528 | ||
529 | protected: | 529 | protected: |
530 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 530 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
531 | 531 | ||
532 | // returns KMsgBox::OKCandel() | 532 | // returns KMsgBox::OKCandel() |
533 | int msgItemDelete(const QString name); | 533 | int msgItemDelete(const QString name); |
534 | void showEventEditor(); | 534 | void showEventEditor(); |
535 | void showTodoEditor(); | 535 | void showTodoEditor(); |
536 | Todo *selectedTodo(); | 536 | Todo *selectedTodo(); |
537 | private: | 537 | private: |
538 | #ifdef DESKTOP_VERSION | ||
538 | QScrollBar * mDateScrollBar; | 539 | QScrollBar * mDateScrollBar; |
540 | #endif | ||
539 | QDateTime mNextAlarmDateTime; | 541 | QDateTime mNextAlarmDateTime; |
540 | bool mViewerCallerIsSearchDialog; | 542 | bool mViewerCallerIsSearchDialog; |
541 | bool mBlockShowDates; | 543 | bool mBlockShowDates; |
542 | KSyncManager* mSyncManager; | 544 | KSyncManager* mSyncManager; |
543 | AlarmDialog * mAlarmDialog; | 545 | AlarmDialog * mAlarmDialog; |
544 | QString mAlarmNotification; | 546 | QString mAlarmNotification; |
545 | QString mSuspendAlarmNotification; | 547 | QString mSuspendAlarmNotification; |
546 | QTimer* mSuspendTimer; | 548 | QTimer* mSuspendTimer; |
547 | QTimer* mAlarmTimer; | 549 | QTimer* mAlarmTimer; |
548 | QTimer* mRecheckAlarmTimer; | 550 | QTimer* mRecheckAlarmTimer; |
549 | void computeAlarm( QString ); | 551 | void computeAlarm( QString ); |
550 | void startAlarm( QString, QString ); | 552 | void startAlarm( QString, QString ); |
551 | void setSyncEventsReadOnly(); | 553 | void setSyncEventsReadOnly(); |
552 | 554 | ||
553 | QDateTime loadedFileVersion; | 555 | QDateTime loadedFileVersion; |
554 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 556 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
555 | void checkExternalId( Incidence * inc ); | 557 | void checkExternalId( Incidence * inc ); |
556 | int mGlobalSyncMode; | 558 | int mGlobalSyncMode; |
557 | QString mCurrentSyncDevice; | 559 | QString mCurrentSyncDevice; |
558 | QString mCurrentSyncName; | 560 | QString mCurrentSyncName; |
559 | void init(); | 561 | void init(); |
560 | int mDatePickerMode; | 562 | int mDatePickerMode; |
561 | bool mFlagEditDescription; | 563 | bool mFlagEditDescription; |
562 | QDateTime mLastCalendarSync; | 564 | QDateTime mLastCalendarSync; |
563 | void createPrinter(); | 565 | void createPrinter(); |
564 | 566 | ||
565 | void calendarModified( bool, Calendar * ); | 567 | void calendarModified( bool, Calendar * ); |
566 | 568 | ||
567 | CalPrinter *mCalPrinter; | 569 | CalPrinter *mCalPrinter; |
568 | 570 | ||
569 | QSplitter *mPanner; | 571 | QSplitter *mPanner; |
570 | QSplitter *mLeftSplitter; | 572 | QSplitter *mLeftSplitter; |
571 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 573 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
572 | QWidgetStack *mRightFrame; | 574 | QWidgetStack *mRightFrame; |
573 | 575 | ||
574 | KDatePicker* mDatePicker; | 576 | KDatePicker* mDatePicker; |
575 | QVBox* mDateFrame; | 577 | QVBox* mDateFrame; |
576 | 578 | ||
577 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 579 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
578 | 580 | ||
579 | KOFilterView *mFilterView; | 581 | KOFilterView *mFilterView; |
580 | KOCalEditView *mCalEditView; | 582 | KOCalEditView *mCalEditView; |
581 | 583 | ||
582 | ResourceView *mResourceView; | 584 | ResourceView *mResourceView; |
583 | 585 | ||
584 | // calendar object for this viewing instance | 586 | // calendar object for this viewing instance |
585 | Calendar *mCalendar; | 587 | Calendar *mCalendar; |
586 | 588 | ||
587 | CalendarResourceManager *mResourceManager; | 589 | CalendarResourceManager *mResourceManager; |
588 | 590 | ||
589 | FileStorage *mStorage; | 591 | FileStorage *mStorage; |
590 | 592 | ||
591 | DateNavigator *mNavigator; | 593 | DateNavigator *mNavigator; |
592 | 594 | ||
593 | KOViewManager *mViewManager; | 595 | KOViewManager *mViewManager; |
594 | KODialogManager *mDialogManager; | 596 | KODialogManager *mDialogManager; |
595 | 597 | ||
596 | // Calendar filters | 598 | // Calendar filters |
597 | QPtrList<CalFilter> mFilters; | 599 | QPtrList<CalFilter> mFilters; |
598 | 600 | ||
599 | // various housekeeping variables. | 601 | // various housekeeping variables. |
600 | bool mModified; // flag indicating if calendar is modified | 602 | bool mModified; // flag indicating if calendar is modified |
601 | bool mReadOnly; // flag indicating if calendar is read-only | 603 | bool mReadOnly; // flag indicating if calendar is read-only |
602 | QDate mSaveSingleDate; | 604 | QDate mSaveSingleDate; |
603 | 605 | ||
604 | Incidence *mSelectedIncidence; | 606 | Incidence *mSelectedIncidence; |
605 | Incidence *mMoveIncidence; | 607 | Incidence *mMoveIncidence; |
606 | QDate mMoveIncidenceOldDate; | 608 | QDate mMoveIncidenceOldDate; |
607 | KOTodoView *mTodoList; | 609 | KOTodoView *mTodoList; |
608 | KOEventEditor * mEventEditor; | 610 | KOEventEditor * mEventEditor; |
609 | KOTodoEditor * mTodoEditor; | 611 | KOTodoEditor * mTodoEditor; |
610 | KOEventViewerDialog * mEventViewerDialog; | 612 | KOEventViewerDialog * mEventViewerDialog; |
611 | void keyPressEvent ( QKeyEvent *e) ; | 613 | void keyPressEvent ( QKeyEvent *e) ; |
612 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 614 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
613 | }; | 615 | }; |
614 | 616 | ||
615 | 617 | ||
616 | class CalendarViewVisitor : public Incidence::Visitor | 618 | class CalendarViewVisitor : public Incidence::Visitor |
617 | { | 619 | { |
618 | public: | 620 | public: |
619 | CalendarViewVisitor() : mView( 0 ) {} | 621 | CalendarViewVisitor() : mView( 0 ) {} |
620 | 622 | ||
621 | bool act( Incidence *incidence, CalendarView *view ) | 623 | bool act( Incidence *incidence, CalendarView *view ) |
622 | { | 624 | { |
623 | mView = view; | 625 | mView = view; |
624 | return incidence->accept( *this ); | 626 | return incidence->accept( *this ); |
625 | } | 627 | } |
626 | 628 | ||
627 | protected: | 629 | protected: |
628 | CalendarView *mView; | 630 | CalendarView *mView; |
629 | }; | 631 | }; |
630 | 632 | ||
631 | class ShowIncidenceVisitor : public CalendarViewVisitor | 633 | class ShowIncidenceVisitor : public CalendarViewVisitor |
632 | { | 634 | { |
633 | protected: | 635 | protected: |
634 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 636 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
635 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 637 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
636 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 638 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
637 | }; | 639 | }; |
638 | 640 | ||
639 | class EditIncidenceVisitor : public CalendarViewVisitor | 641 | class EditIncidenceVisitor : public CalendarViewVisitor |
640 | { | 642 | { |
641 | protected: | 643 | protected: |
642 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 644 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
643 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 645 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
644 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 646 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
645 | }; | 647 | }; |
646 | 648 | ||
647 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 649 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
648 | { | 650 | { |
649 | protected: | 651 | protected: |
650 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 652 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
651 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 653 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
652 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 654 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
653 | }; | 655 | }; |
654 | 656 | ||
655 | #endif | 657 | #endif |