-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 | |||
@@ -399,122 +399,125 @@ void CalendarView::init() | |||
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 & ) ) ); |
@@ -604,115 +607,120 @@ void CalendarView::init() | |||
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; |
@@ -2539,97 +2547,99 @@ void CalendarView::changeTodoDisplay(Todo *which, int action) | |||
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); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index c89bbf7..f7e5366 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -490,97 +490,99 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
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 | ||