-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 26 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
4 files changed, 23 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index f9af769..8f05276 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -312,386 +312,386 @@ void CalendarView::init() | |||
312 | // mDateNavigator->blockSignals( true ); | 312 | // mDateNavigator->blockSignals( true ); |
313 | leftFrameLayout->addWidget( mDateNavigator ); | 313 | leftFrameLayout->addWidget( mDateNavigator ); |
314 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 314 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
315 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 315 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
316 | mTodoList->setNavigator( mNavigator ); | 316 | mTodoList->setNavigator( mNavigator ); |
317 | 317 | ||
318 | if ( QApplication::desktop()->width() < 480 ) { | 318 | if ( QApplication::desktop()->width() < 480 ) { |
319 | leftFrameLayout->addWidget(mFilterView); | 319 | leftFrameLayout->addWidget(mFilterView); |
320 | leftFrameLayout->addWidget(mTodoList, 2 ); | 320 | leftFrameLayout->addWidget(mTodoList, 2 ); |
321 | 321 | ||
322 | } else { | 322 | } else { |
323 | leftFrameLayout->addWidget(mTodoList,2 ); | 323 | leftFrameLayout->addWidget(mTodoList,2 ); |
324 | leftFrameLayout->addWidget(mFilterView ); | 324 | leftFrameLayout->addWidget(mFilterView ); |
325 | } | 325 | } |
326 | mFilterView->hide(); | 326 | mFilterView->hide(); |
327 | QWidget *rightBox = new QWidget( mainBox ); | 327 | QWidget *rightBox = new QWidget( mainBox ); |
328 | mainBoxLayout->addWidget ( rightBox, 10 ); | 328 | mainBoxLayout->addWidget ( rightBox, 10 ); |
329 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 329 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
330 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 330 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
331 | mRightFrame = new QWidgetStack( rightBox ); | 331 | mRightFrame = new QWidgetStack( rightBox ); |
332 | rightLayout->addWidget( mNavigatorBar ); | 332 | rightLayout->addWidget( mNavigatorBar ); |
333 | rightLayout->addWidget( mRightFrame, 10 ); | 333 | rightLayout->addWidget( mRightFrame, 10 ); |
334 | 334 | ||
335 | mLeftFrame = leftFrame; | 335 | mLeftFrame = leftFrame; |
336 | if ( KOPrefs::instance()->mVerticalScreen ) { | 336 | if ( KOPrefs::instance()->mVerticalScreen ) { |
337 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 337 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
338 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 338 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
339 | } else { | 339 | } else { |
340 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 340 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
341 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 341 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
342 | } | 342 | } |
343 | if ( !KOPrefs::instance()->mShowDateNavigator) | 343 | if ( !KOPrefs::instance()->mShowDateNavigator) |
344 | mDateNavigator->hide(); | 344 | mDateNavigator->hide(); |
345 | //qDebug("Calendarview Size %d %d ", width(), height()); | 345 | //qDebug("Calendarview Size %d %d ", width(), height()); |
346 | #endif | 346 | #endif |
347 | 347 | ||
348 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 348 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
349 | SLOT( showDates( const KCal::DateList & ) ) ); | 349 | SLOT( showDates( const KCal::DateList & ) ) ); |
350 | 350 | ||
351 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 351 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
352 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 352 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
353 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
354 | mNavigator, SLOT( selectPreviousYear() ) ); | 354 | mNavigator, SLOT( selectPreviousYear() ) ); |
355 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
356 | mNavigator, SLOT( selectNextYear() ) ); | 356 | mNavigator, SLOT( selectNextYear() ) ); |
357 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 357 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
358 | mNavigator, SLOT( selectPreviousMonth() ) ); | 358 | mNavigator, SLOT( selectPreviousMonth() ) ); |
359 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 359 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
360 | mNavigator, SLOT( selectNextMonth() ) ); | 360 | mNavigator, SLOT( selectNextMonth() ) ); |
361 | 361 | ||
362 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 362 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
363 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 363 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
364 | 364 | ||
365 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 365 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
366 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 366 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
367 | 367 | ||
368 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
369 | mNavigator, SLOT( selectPreviousYear() ) ); | 369 | mNavigator, SLOT( selectPreviousYear() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 370 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
371 | mNavigator, SLOT( selectNextYear() ) ); | 371 | mNavigator, SLOT( selectNextYear() ) ); |
372 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 372 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
373 | mNavigator, SLOT( selectPreviousMonth() ) ); | 373 | mNavigator, SLOT( selectPreviousMonth() ) ); |
374 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 374 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
375 | mNavigator, SLOT( selectNextMonth() ) ); | 375 | mNavigator, SLOT( selectNextMonth() ) ); |
376 | 376 | ||
377 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 377 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
378 | mNavigator, SLOT( selectPrevious() ) ); | 378 | mNavigator, SLOT( selectPrevious() ) ); |
379 | connect( mDateNavigator, SIGNAL( goNext() ), | 379 | connect( mDateNavigator, SIGNAL( goNext() ), |
380 | mNavigator, SLOT( selectNext() ) ); | 380 | mNavigator, SLOT( selectNext() ) ); |
381 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 381 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
382 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 382 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
383 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 383 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
384 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 384 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
385 | 385 | ||
386 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 386 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
387 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 387 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
388 | 388 | ||
389 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 389 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
390 | SLOT( eventAdded( Event *) ) ); | 390 | SLOT( eventAdded( Event *) ) ); |
391 | 391 | ||
392 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 392 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
393 | 393 | ||
394 | connect( this, SIGNAL( configChanged() ), | 394 | connect( this, SIGNAL( configChanged() ), |
395 | mDateNavigator, SLOT( updateConfig() ) ); | 395 | mDateNavigator, SLOT( updateConfig() ) ); |
396 | 396 | ||
397 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 397 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
398 | SLOT( newTodo() ) ); | 398 | SLOT( newTodo() ) ); |
399 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 399 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
400 | SLOT( newSubTodo( Todo * ) ) ); | 400 | SLOT( newSubTodo( Todo * ) ) ); |
401 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 401 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
402 | SLOT( editTodo( Todo * ) ) ); | 402 | SLOT( editTodo( Todo * ) ) ); |
403 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 403 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
404 | SLOT( showTodo( Todo *) ) ); | 404 | SLOT( showTodo( Todo *) ) ); |
405 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 405 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
406 | SLOT( deleteTodo( Todo *) ) ); | 406 | SLOT( deleteTodo( Todo *) ) ); |
407 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 407 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
408 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 408 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
409 | SLOT( purgeCompleted() ) ); | 409 | SLOT( purgeCompleted() ) ); |
410 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 410 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
411 | SIGNAL( todoModified( Todo *, int ) ) ); | 411 | SIGNAL( todoModified( Todo *, int ) ) ); |
412 | 412 | ||
413 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 413 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
414 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 414 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
415 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 415 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
416 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 416 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
417 | 417 | ||
418 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 418 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
419 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 419 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
420 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 420 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
421 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 421 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
422 | 422 | ||
423 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 423 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
424 | this, SLOT ( todo_unsub( Todo * ) ) ); | 424 | this, SLOT ( todo_unsub( Todo * ) ) ); |
425 | 425 | ||
426 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 426 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
427 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 427 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
428 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 428 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
429 | SLOT( updateTodo( Todo *, int ) ) ); | 429 | SLOT( updateTodo( Todo *, int ) ) ); |
430 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 430 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
431 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 431 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
432 | 432 | ||
433 | 433 | ||
434 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 434 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
435 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 435 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
436 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 436 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
437 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 437 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
438 | 438 | ||
439 | 439 | ||
440 | 440 | ||
441 | 441 | ||
442 | 442 | ||
443 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 443 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
444 | SLOT(checkClipboard())); | 444 | SLOT(checkClipboard())); |
445 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 445 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
446 | SLOT( processTodoListSelection( Incidence * ) ) ); | 446 | SLOT( processTodoListSelection( Incidence * ) ) ); |
447 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 447 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
448 | 448 | ||
449 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 449 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
450 | 450 | ||
451 | mDateFrame = new QVBox(0,0,WType_Popup); | 451 | mDateFrame = new QVBox(0,0,WType_Popup); |
452 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 452 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
453 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 453 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
454 | mDateFrame->setLineWidth(3); | 454 | mDateFrame->setLineWidth(3); |
455 | mDateFrame->hide(); | 455 | mDateFrame->hide(); |
456 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 456 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
457 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 457 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
458 | 458 | ||
459 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 459 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
460 | 460 | ||
461 | mEventEditor = mDialogManager->getEventEditor(); | 461 | mEventEditor = mDialogManager->getEventEditor(); |
462 | mTodoEditor = mDialogManager->getTodoEditor(); | 462 | mTodoEditor = mDialogManager->getTodoEditor(); |
463 | 463 | ||
464 | mFlagEditDescription = false; | 464 | mFlagEditDescription = false; |
465 | 465 | ||
466 | mSuspendTimer = new QTimer( this ); | 466 | mSuspendTimer = new QTimer( this ); |
467 | mAlarmTimer = new QTimer( this ); | 467 | mAlarmTimer = new QTimer( this ); |
468 | mRecheckAlarmTimer = new QTimer( this ); | 468 | mRecheckAlarmTimer = new QTimer( this ); |
469 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 469 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
470 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 470 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
471 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 471 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
472 | mAlarmDialog = new AlarmDialog( this ); | 472 | mAlarmDialog = new AlarmDialog( this ); |
473 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 473 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
474 | mAlarmDialog->setServerNotification( false ); | 474 | mAlarmDialog->setServerNotification( false ); |
475 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 475 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
476 | 476 | ||
477 | 477 | ||
478 | #ifndef DESKTOP_VERSION | 478 | #ifndef DESKTOP_VERSION |
479 | //US listen for arriving address resultsets | 479 | //US listen for arriving address resultsets |
480 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 480 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
481 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 481 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
482 | #endif | 482 | #endif |
483 | 483 | ||
484 | } | 484 | } |
485 | 485 | ||
486 | 486 | ||
487 | CalendarView::~CalendarView() | 487 | CalendarView::~CalendarView() |
488 | { | 488 | { |
489 | // kdDebug() << "~CalendarView()" << endl; | 489 | // kdDebug() << "~CalendarView()" << endl; |
490 | //qDebug("CalendarView::~CalendarView() "); | 490 | //qDebug("CalendarView::~CalendarView() "); |
491 | delete mDialogManager; | 491 | delete mDialogManager; |
492 | delete mViewManager; | 492 | delete mViewManager; |
493 | delete mStorage; | 493 | delete mStorage; |
494 | delete mDateFrame ; | 494 | delete mDateFrame ; |
495 | delete beamDialog; | 495 | delete beamDialog; |
496 | //kdDebug() << "~CalendarView() done" << endl; | 496 | //kdDebug() << "~CalendarView() done" << endl; |
497 | } | 497 | } |
498 | 498 | ||
499 | void CalendarView::showDay( QDate d ) | 499 | void CalendarView::showDay( QDate d ) |
500 | { | 500 | { |
501 | dateNavigator()->blockSignals( true ); | 501 | dateNavigator()->blockSignals( true ); |
502 | dateNavigator()->selectDate( d ); | 502 | dateNavigator()->selectDate( d ); |
503 | dateNavigator()->blockSignals( false ); | 503 | dateNavigator()->blockSignals( false ); |
504 | mViewManager->showWeekView(); | 504 | mViewManager->showDayView(); |
505 | dateNavigator()->selectDate( d ); | 505 | //dateNavigator()->selectDate( d ); |
506 | } | 506 | } |
507 | void CalendarView::timerAlarm() | 507 | void CalendarView::timerAlarm() |
508 | { | 508 | { |
509 | //qDebug("CalendarView::timerAlarm() "); | 509 | //qDebug("CalendarView::timerAlarm() "); |
510 | computeAlarm(mAlarmNotification ); | 510 | computeAlarm(mAlarmNotification ); |
511 | } | 511 | } |
512 | 512 | ||
513 | void CalendarView::suspendAlarm() | 513 | void CalendarView::suspendAlarm() |
514 | { | 514 | { |
515 | //qDebug(" CalendarView::suspendAlarm() "); | 515 | //qDebug(" CalendarView::suspendAlarm() "); |
516 | computeAlarm(mSuspendAlarmNotification ); | 516 | computeAlarm(mSuspendAlarmNotification ); |
517 | 517 | ||
518 | } | 518 | } |
519 | 519 | ||
520 | void CalendarView::startAlarm( QString mess , QString filename) | 520 | void CalendarView::startAlarm( QString mess , QString filename) |
521 | { | 521 | { |
522 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 522 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
523 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 523 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
524 | 524 | ||
525 | } | 525 | } |
526 | 526 | ||
527 | void CalendarView::checkNextTimerAlarm() | 527 | void CalendarView::checkNextTimerAlarm() |
528 | { | 528 | { |
529 | mCalendar->checkAlarmForIncidence( 0, true ); | 529 | mCalendar->checkAlarmForIncidence( 0, true ); |
530 | } | 530 | } |
531 | 531 | ||
532 | void CalendarView::computeAlarm( QString msg ) | 532 | void CalendarView::computeAlarm( QString msg ) |
533 | { | 533 | { |
534 | 534 | ||
535 | QString mess = msg; | 535 | QString mess = msg; |
536 | QString mAlarmMessage = mess.mid( 9 ); | 536 | QString mAlarmMessage = mess.mid( 9 ); |
537 | QString filename = MainWindow::resourcePath(); | 537 | QString filename = MainWindow::resourcePath(); |
538 | filename += "koalarm.wav"; | 538 | filename += "koalarm.wav"; |
539 | QString tempfilename; | 539 | QString tempfilename; |
540 | if ( mess.left( 13 ) == "suspend_alarm") { | 540 | if ( mess.left( 13 ) == "suspend_alarm") { |
541 | bool error = false; | 541 | bool error = false; |
542 | int len = mess.mid( 13 ).find("+++"); | 542 | int len = mess.mid( 13 ).find("+++"); |
543 | if ( len < 2 ) | 543 | if ( len < 2 ) |
544 | error = true; | 544 | error = true; |
545 | else { | 545 | else { |
546 | tempfilename = mess.mid( 13, len ); | 546 | tempfilename = mess.mid( 13, len ); |
547 | if ( !QFile::exists( tempfilename ) ) | 547 | if ( !QFile::exists( tempfilename ) ) |
548 | error = true; | 548 | error = true; |
549 | } | 549 | } |
550 | if ( ! error ) { | 550 | if ( ! error ) { |
551 | filename = tempfilename; | 551 | filename = tempfilename; |
552 | } | 552 | } |
553 | mAlarmMessage = mess.mid( 13+len+3 ); | 553 | mAlarmMessage = mess.mid( 13+len+3 ); |
554 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 554 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
555 | startAlarm( mAlarmMessage, filename); | 555 | startAlarm( mAlarmMessage, filename); |
556 | return; | 556 | return; |
557 | } | 557 | } |
558 | if ( mess.left( 11 ) == "timer_alarm") { | 558 | if ( mess.left( 11 ) == "timer_alarm") { |
559 | //mTimerTime = 0; | 559 | //mTimerTime = 0; |
560 | startAlarm( mess.mid( 11 ), filename ); | 560 | startAlarm( mess.mid( 11 ), filename ); |
561 | return; | 561 | return; |
562 | } | 562 | } |
563 | if ( mess.left( 10 ) == "proc_alarm") { | 563 | if ( mess.left( 10 ) == "proc_alarm") { |
564 | bool error = false; | 564 | bool error = false; |
565 | int len = mess.mid( 10 ).find("+++"); | 565 | int len = mess.mid( 10 ).find("+++"); |
566 | if ( len < 2 ) | 566 | if ( len < 2 ) |
567 | error = true; | 567 | error = true; |
568 | else { | 568 | else { |
569 | tempfilename = mess.mid( 10, len ); | 569 | tempfilename = mess.mid( 10, len ); |
570 | if ( !QFile::exists( tempfilename ) ) | 570 | if ( !QFile::exists( tempfilename ) ) |
571 | error = true; | 571 | error = true; |
572 | } | 572 | } |
573 | if ( error ) { | 573 | if ( error ) { |
574 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 574 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
575 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 575 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
576 | } else { | 576 | } else { |
577 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 577 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
578 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 578 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
579 | #ifndef _WIN32_ | 579 | #ifndef _WIN32_ |
580 | if ( vfork () == 0 ) { | 580 | if ( vfork () == 0 ) { |
581 | execl ( tempfilename.latin1(), 0 ); | 581 | execl ( tempfilename.latin1(), 0 ); |
582 | return; | 582 | return; |
583 | } | 583 | } |
584 | #else | 584 | #else |
585 | QProcess* p = new QProcess(); | 585 | QProcess* p = new QProcess(); |
586 | p->addArgument( tempfilename.latin1() ); | 586 | p->addArgument( tempfilename.latin1() ); |
587 | p->start(); | 587 | p->start(); |
588 | return; | 588 | return; |
589 | #endif | 589 | #endif |
590 | 590 | ||
591 | return; | 591 | return; |
592 | } | 592 | } |
593 | 593 | ||
594 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 594 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
595 | } | 595 | } |
596 | if ( mess.left( 11 ) == "audio_alarm") { | 596 | if ( mess.left( 11 ) == "audio_alarm") { |
597 | bool error = false; | 597 | bool error = false; |
598 | int len = mess.mid( 11 ).find("+++"); | 598 | int len = mess.mid( 11 ).find("+++"); |
599 | if ( len < 2 ) | 599 | if ( len < 2 ) |
600 | error = true; | 600 | error = true; |
601 | else { | 601 | else { |
602 | tempfilename = mess.mid( 11, len ); | 602 | tempfilename = mess.mid( 11, len ); |
603 | if ( !QFile::exists( tempfilename ) ) | 603 | if ( !QFile::exists( tempfilename ) ) |
604 | error = true; | 604 | error = true; |
605 | } | 605 | } |
606 | if ( ! error ) { | 606 | if ( ! error ) { |
607 | filename = tempfilename; | 607 | filename = tempfilename; |
608 | } | 608 | } |
609 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 609 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
610 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 610 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
611 | } | 611 | } |
612 | if ( mess.left( 9 ) == "cal_alarm") { | 612 | if ( mess.left( 9 ) == "cal_alarm") { |
613 | mAlarmMessage = mess.mid( 9 ) ; | 613 | mAlarmMessage = mess.mid( 9 ) ; |
614 | } | 614 | } |
615 | 615 | ||
616 | startAlarm( mAlarmMessage, filename ); | 616 | startAlarm( mAlarmMessage, filename ); |
617 | 617 | ||
618 | 618 | ||
619 | } | 619 | } |
620 | 620 | ||
621 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 621 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
622 | { | 622 | { |
623 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 623 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
624 | 624 | ||
625 | mSuspendAlarmNotification = noti; | 625 | mSuspendAlarmNotification = noti; |
626 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 626 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
627 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 627 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
628 | mSuspendTimer->start( ms , true ); | 628 | mSuspendTimer->start( ms , true ); |
629 | 629 | ||
630 | } | 630 | } |
631 | 631 | ||
632 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 632 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
633 | { | 633 | { |
634 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 634 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
635 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 635 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
636 | #ifndef DESKTOP_VERSION | 636 | #ifndef DESKTOP_VERSION |
637 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 637 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
638 | #endif | 638 | #endif |
639 | return; | 639 | return; |
640 | } | 640 | } |
641 | int maxSec; | 641 | int maxSec; |
642 | //maxSec = 5; //testing only | 642 | //maxSec = 5; //testing only |
643 | maxSec = 86400+3600; // one day+1hour | 643 | maxSec = 86400+3600; // one day+1hour |
644 | mAlarmNotification = noti; | 644 | mAlarmNotification = noti; |
645 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 645 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
646 | if ( sec > maxSec ) { | 646 | if ( sec > maxSec ) { |
647 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 647 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
648 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 648 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
649 | return; | 649 | return; |
650 | } else { | 650 | } else { |
651 | mRecheckAlarmTimer->stop(); | 651 | mRecheckAlarmTimer->stop(); |
652 | } | 652 | } |
653 | //qDebug("Alarm timer started with secs: %d ", sec); | 653 | //qDebug("Alarm timer started with secs: %d ", sec); |
654 | mAlarmTimer->start( sec *1000 , true ); | 654 | mAlarmTimer->start( sec *1000 , true ); |
655 | 655 | ||
656 | } | 656 | } |
657 | // called by mRecheckAlarmTimer to get next alarm | 657 | // called by mRecheckAlarmTimer to get next alarm |
658 | // we need this, because a QTimer has only a max range of 25 days | 658 | // we need this, because a QTimer has only a max range of 25 days |
659 | void CalendarView::recheckTimerAlarm() | 659 | void CalendarView::recheckTimerAlarm() |
660 | { | 660 | { |
661 | mAlarmTimer->stop(); | 661 | mAlarmTimer->stop(); |
662 | mRecheckAlarmTimer->stop(); | 662 | mRecheckAlarmTimer->stop(); |
663 | mCalendar->checkAlarmForIncidence( 0, true ); | 663 | mCalendar->checkAlarmForIncidence( 0, true ); |
664 | } | 664 | } |
665 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 665 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
666 | { | 666 | { |
667 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 667 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
668 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 668 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
669 | #ifndef DESKTOP_VERSION | 669 | #ifndef DESKTOP_VERSION |
670 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 670 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
671 | #endif | 671 | #endif |
672 | return; | 672 | return; |
673 | } | 673 | } |
674 | mAlarmTimer->stop(); | 674 | mAlarmTimer->stop(); |
675 | } | 675 | } |
676 | void CalendarView::selectWeekNum ( int num ) | 676 | void CalendarView::selectWeekNum ( int num ) |
677 | { | 677 | { |
678 | dateNavigator()->blockSignals( true ); | 678 | dateNavigator()->blockSignals( true ); |
679 | dateNavigator()->selectWeek( num ); | 679 | dateNavigator()->selectWeek( num ); |
680 | dateNavigator()->blockSignals( false ); | 680 | dateNavigator()->blockSignals( false ); |
681 | mViewManager->showWeekView(); | 681 | mViewManager->showWeekView(); |
682 | } | 682 | } |
683 | KOViewManager *CalendarView::viewManager() | 683 | KOViewManager *CalendarView::viewManager() |
684 | { | 684 | { |
685 | return mViewManager; | 685 | return mViewManager; |
686 | } | 686 | } |
687 | 687 | ||
688 | KODialogManager *CalendarView::dialogManager() | 688 | KODialogManager *CalendarView::dialogManager() |
689 | { | 689 | { |
690 | return mDialogManager; | 690 | return mDialogManager; |
691 | } | 691 | } |
692 | 692 | ||
693 | QDate CalendarView::startDate() | 693 | QDate CalendarView::startDate() |
694 | { | 694 | { |
695 | DateList dates = mNavigator->selectedDates(); | 695 | DateList dates = mNavigator->selectedDates(); |
696 | 696 | ||
697 | return dates.first(); | 697 | return dates.first(); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 842f6eb..b819eec 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1115 +1,1125 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qtooltip.h> | 27 | #include <qtooltip.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPRINTER | 44 | #ifndef KORG_NOPRINTER |
45 | #include "calprinter.h" | 45 | #include "calprinter.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #ifndef KORG_NOPLUGINS | 48 | #ifndef KORG_NOPLUGINS |
49 | #include "kocore.h" | 49 | #include "kocore.h" |
50 | #endif | 50 | #endif |
51 | #include "koglobals.h" | 51 | #include "koglobals.h" |
52 | #include <libkcal/kincidenceformatter.h> | 52 | #include <libkcal/kincidenceformatter.h> |
53 | 53 | ||
54 | #include "komonthview.h" | 54 | #include "komonthview.h" |
55 | 55 | ||
56 | #define PIXMAP_SIZE 5 | 56 | #define PIXMAP_SIZE 5 |
57 | #ifdef DESKTOP_VERSION | 57 | #ifdef DESKTOP_VERSION |
58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
59 | #endif | 59 | #endif |
60 | class KNOWhatsThis :public QWhatsThis | 60 | class KNOWhatsThis :public QWhatsThis |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 63 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | virtual QString text( const QPoint& p) | 66 | virtual QString text( const QPoint& p) |
67 | { | 67 | { |
68 | return _wid->getWhatsThisText(p) ; | 68 | return _wid->getWhatsThisText(p) ; |
69 | }; | 69 | }; |
70 | private: | 70 | private: |
71 | KNoScrollListBox* _wid; | 71 | KNoScrollListBox* _wid; |
72 | 72 | ||
73 | }; | 73 | }; |
74 | 74 | ||
75 | 75 | ||
76 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 76 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
77 | : QListBox(parent, name) | 77 | : QListBox(parent, name, WRepaintNoErase) |
78 | { | 78 | { |
79 | #ifndef DESKTOP_VERSION | 79 | #ifndef DESKTOP_VERSION |
80 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 80 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
81 | #endif | 81 | #endif |
82 | mWT = new KNOWhatsThis(this); | 82 | mWT = new KNOWhatsThis(this); |
83 | } | 83 | } |
84 | KNoScrollListBox::~KNoScrollListBox() | 84 | KNoScrollListBox::~KNoScrollListBox() |
85 | { | 85 | { |
86 | delete mWT; | 86 | delete mWT; |
87 | } | 87 | } |
88 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 88 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
89 | { | 89 | { |
90 | QListBoxItem* item = itemAt ( p ); | 90 | QListBoxItem* item = itemAt ( p ); |
91 | if ( ! item ) { | 91 | if ( ! item ) { |
92 | return i18n("Click in the cell\nto add an event!"); | 92 | return i18n("Click in the cell\nto add an event!"); |
93 | } | 93 | } |
94 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 94 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
95 | } | 95 | } |
96 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 96 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
97 | { | 97 | { |
98 | 98 | ||
99 | switch(e->key()) { | 99 | switch(e->key()) { |
100 | case Key_Right: | 100 | case Key_Right: |
101 | // if ( e->state() == Qt::ControlButton ) | 101 | // if ( e->state() == Qt::ControlButton ) |
102 | { | 102 | { |
103 | e->ignore(); | 103 | e->ignore(); |
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | scrollBy(4,0); | 106 | scrollBy(4,0); |
107 | break; | 107 | break; |
108 | case Key_Left: | 108 | case Key_Left: |
109 | // if ( e->state() == Qt::ControlButton ) | 109 | // if ( e->state() == Qt::ControlButton ) |
110 | { | 110 | { |
111 | e->ignore(); | 111 | e->ignore(); |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | scrollBy(-4,0); | 114 | scrollBy(-4,0); |
115 | break; | 115 | break; |
116 | case Key_Up: | 116 | case Key_Up: |
117 | if(!count()) break; | 117 | if(!count()) break; |
118 | setCurrentItem((currentItem()+count()-1)%count()); | 118 | setCurrentItem((currentItem()+count()-1)%count()); |
119 | if(!itemVisible(currentItem())) { | 119 | if(!itemVisible(currentItem())) { |
120 | if((unsigned int) currentItem() == (count()-1)) { | 120 | if((unsigned int) currentItem() == (count()-1)) { |
121 | setTopItem(currentItem()-numItemsVisible()+1); | 121 | setTopItem(currentItem()-numItemsVisible()+1); |
122 | } else { | 122 | } else { |
123 | setTopItem(topItem()-1); | 123 | setTopItem(topItem()-1); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | break; | 126 | break; |
127 | case Key_Down: | 127 | case Key_Down: |
128 | if(!count()) break; | 128 | if(!count()) break; |
129 | setCurrentItem((currentItem()+1)%count()); | 129 | setCurrentItem((currentItem()+1)%count()); |
130 | if(!itemVisible(currentItem())) { | 130 | if(!itemVisible(currentItem())) { |
131 | if(currentItem() == 0) { | 131 | if(currentItem() == 0) { |
132 | setTopItem(0); | 132 | setTopItem(0); |
133 | } else { | 133 | } else { |
134 | setTopItem(topItem()+1); | 134 | setTopItem(topItem()+1); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | break; | 137 | break; |
138 | case Key_Shift: | 138 | case Key_Shift: |
139 | emit shiftDown(); | 139 | emit shiftDown(); |
140 | break; | 140 | break; |
141 | default: | 141 | default: |
142 | e->ignore(); | 142 | e->ignore(); |
143 | break; | 143 | break; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 147 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
148 | { | 148 | { |
149 | switch(e->key()) { | 149 | switch(e->key()) { |
150 | case Key_Shift: | 150 | case Key_Shift: |
151 | emit shiftUp(); | 151 | emit shiftUp(); |
152 | break; | 152 | break; |
153 | default: | 153 | default: |
154 | break; | 154 | break; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 158 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
159 | { | 159 | { |
160 | QListBox::mousePressEvent(e); | 160 | QListBox::mousePressEvent(e); |
161 | 161 | ||
162 | if(e->button() == RightButton) { | 162 | if(e->button() == RightButton) { |
163 | emit rightClick(); | 163 | emit rightClick(); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 167 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
168 | : QListBoxItem() | 168 | : QListBoxItem() |
169 | { | 169 | { |
170 | setText( s ); | 170 | setText( s ); |
171 | 171 | ||
172 | mIncidence = incidence; | 172 | mIncidence = incidence; |
173 | mDate = qd; | 173 | mDate = qd; |
174 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 174 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
175 | mRecur = false; | 175 | mRecur = false; |
176 | mAlarm = false; | 176 | mAlarm = false; |
177 | mReply = false; | 177 | mReply = false; |
178 | mInfo = false; | 178 | mInfo = false; |
179 | } | 179 | } |
180 | 180 | ||
181 | void MonthViewItem::paint(QPainter *p) | 181 | void MonthViewItem::paint(QPainter *p) |
182 | { | 182 | { |
183 | #if QT_VERSION >= 0x030000 | 183 | #if QT_VERSION >= 0x030000 |
184 | bool sel = isSelected(); | 184 | bool sel = isSelected(); |
185 | #else | 185 | #else |
186 | bool sel = selected(); | 186 | bool sel = selected(); |
187 | #endif | 187 | #endif |
188 | 188 | ||
189 | 189 | ||
190 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 190 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
191 | { | 191 | { |
192 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 192 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
193 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 193 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
194 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 194 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
195 | } | 195 | } |
196 | int x = 1; | 196 | int x = 1; |
197 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 197 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
198 | int size = PIXMAP_SIZE; | 198 | int size = PIXMAP_SIZE; |
199 | if ( QApplication::desktop()->width() < 300 ) | 199 | if ( QApplication::desktop()->width() < 300 ) |
200 | size = 3; | 200 | size = 3; |
201 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 201 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
202 | if ( mInfo ) { | 202 | if ( mInfo ) { |
203 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 203 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
204 | x += size + 1; | 204 | x += size + 1; |
205 | } | 205 | } |
206 | if ( mRecur ) { | 206 | if ( mRecur ) { |
207 | p->fillRect ( x, y,size,size, Qt::blue ); | 207 | p->fillRect ( x, y,size,size, Qt::blue ); |
208 | x += size + 1; | 208 | x += size + 1; |
209 | } | 209 | } |
210 | if ( mAlarm ) { | 210 | if ( mAlarm ) { |
211 | p->fillRect ( x, y,size,size, Qt::red ); | 211 | p->fillRect ( x, y,size,size, Qt::red ); |
212 | x += size + 1; | 212 | x += size + 1; |
213 | } | 213 | } |
214 | if ( mReply ) { | 214 | if ( mReply ) { |
215 | p->fillRect ( x, y,size,size, Qt::yellow ); | 215 | p->fillRect ( x, y,size,size, Qt::yellow ); |
216 | x += size + 1; | 216 | x += size + 1; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | QFontMetrics fm = p->fontMetrics(); | 219 | QFontMetrics fm = p->fontMetrics(); |
220 | int yPos; | 220 | int yPos; |
221 | int pmheight = size; | 221 | int pmheight = size; |
222 | if( pmheight < fm.height() ) | 222 | if( pmheight < fm.height() ) |
223 | yPos = fm.ascent() + fm.leading()/2; | 223 | yPos = fm.ascent() + fm.leading()/2; |
224 | else | 224 | else |
225 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 225 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
226 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 226 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
227 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 227 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
228 | p->drawText( x, yPos, text() ); | 228 | p->drawText( x, yPos, text() ); |
229 | if ( mIncidence->cancelled() ) { | 229 | if ( mIncidence->cancelled() ) { |
230 | int wid = fm.width( text() ); | 230 | int wid = fm.width( text() ); |
231 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); | 231 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); |
232 | } | 232 | } |
233 | 233 | ||
234 | } | 234 | } |
235 | 235 | ||
236 | int MonthViewItem::height(const QListBox *lb) const | 236 | int MonthViewItem::height(const QListBox *lb) const |
237 | { | 237 | { |
238 | return lb->fontMetrics().lineSpacing()+1; | 238 | return lb->fontMetrics().lineSpacing()+1; |
239 | } | 239 | } |
240 | 240 | ||
241 | int MonthViewItem::width(const QListBox *lb) const | 241 | int MonthViewItem::width(const QListBox *lb) const |
242 | { | 242 | { |
243 | int size = PIXMAP_SIZE; | 243 | int size = PIXMAP_SIZE; |
244 | if ( QApplication::desktop()->width() < 300 ) | 244 | if ( QApplication::desktop()->width() < 300 ) |
245 | size = 3; | 245 | size = 3; |
246 | int x = 1; | 246 | int x = 1; |
247 | if ( mInfo ) { | 247 | if ( mInfo ) { |
248 | x += size + 1; | 248 | x += size + 1; |
249 | } | 249 | } |
250 | if( mRecur ) { | 250 | if( mRecur ) { |
251 | x += size+1; | 251 | x += size+1; |
252 | } | 252 | } |
253 | if( mAlarm ) { | 253 | if( mAlarm ) { |
254 | x += size+1; | 254 | x += size+1; |
255 | } | 255 | } |
256 | if( mReply ) { | 256 | if( mReply ) { |
257 | x += size+1; | 257 | x += size+1; |
258 | } | 258 | } |
259 | 259 | ||
260 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 260 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | MonthViewCell::MonthViewCell( KOMonthView *parent) | 264 | MonthViewCell::MonthViewCell( KOMonthView *parent) |
265 | : QWidget( parent ), | 265 | : QWidget( parent ), |
266 | mMonthView( parent ) | 266 | mMonthView( parent ) |
267 | { | 267 | { |
268 | 268 | ||
269 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 269 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
270 | 270 | ||
271 | // mLabel = new QLabel( this );QPushButton | 271 | // mLabel = new QLabel( this );QPushButton |
272 | mLabel = new QPushButton( this ); | 272 | mLabel = new QPushButton( this ); |
273 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 273 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
274 | //mLabel->setLineWidth( 1 ); | 274 | //mLabel->setLineWidth( 1 ); |
275 | //mLabel->setAlignment( AlignCenter ); | 275 | //mLabel->setAlignment( AlignCenter ); |
276 | mLabel->setFlat( true ); | 276 | mLabel->setFlat( true ); |
277 | mItemList = new KNoScrollListBox( this ); | 277 | mItemList = new KNoScrollListBox( this ); |
278 | mItemList->setMinimumSize( 10, 10 ); | 278 | mItemList->setMinimumSize( 10, 10 ); |
279 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 279 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
280 | mItemList->setLineWidth( 1 ); | 280 | mItemList->setLineWidth( 1 ); |
281 | topLayout->addWidget( mItemList ); | 281 | topLayout->addWidget( mItemList ); |
282 | mLabel->raise(); | 282 | mLabel->raise(); |
283 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 283 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
284 | mStandardPalette = palette(); | 284 | mStandardPalette = palette(); |
285 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 285 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
286 | 286 | ||
287 | enableScrollBars( false ); | 287 | enableScrollBars( false ); |
288 | updateConfig(); | 288 | updateConfig(); |
289 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 289 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
290 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 290 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
291 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 291 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
292 | SLOT( defaultAction( QListBoxItem * ) ) ); | 292 | SLOT( defaultAction( QListBoxItem * ) ) ); |
293 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 293 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
294 | const QPoint &) ), | 294 | const QPoint &) ), |
295 | SLOT( contextMenu( QListBoxItem * ) ) ); | 295 | SLOT( contextMenu( QListBoxItem * ) ) ); |
296 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 296 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
297 | SLOT( selection( QListBoxItem * ) ) ); | 297 | SLOT( selection( QListBoxItem * ) ) ); |
298 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 298 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
299 | SLOT( cellClicked( QListBoxItem * ) ) ); | 299 | SLOT( cellClicked( QListBoxItem * ) ) ); |
300 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 300 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
301 | SLOT( selection( QListBoxItem * ) ) ); | 301 | SLOT( selection( QListBoxItem * ) ) ); |
302 | } | 302 | } |
303 | #ifdef DESKTOP_VERSION | 303 | #ifdef DESKTOP_VERSION |
304 | QToolTipGroup *MonthViewCell::toolTipGroup() | 304 | QToolTipGroup *MonthViewCell::toolTipGroup() |
305 | { | 305 | { |
306 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 306 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
307 | return mToolTipGroup; | 307 | return mToolTipGroup; |
308 | } | 308 | } |
309 | #endif | 309 | #endif |
310 | 310 | ||
311 | void MonthViewCell::setDate( const QDate &date ) | 311 | void MonthViewCell::setDate( const QDate &date ) |
312 | { | 312 | { |
313 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 313 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
314 | mDate = date; | 314 | mDate = date; |
315 | 315 | ||
316 | 316 | ||
317 | 317 | ||
318 | //resizeEvent( 0 ); | 318 | //resizeEvent( 0 ); |
319 | } | 319 | } |
320 | 320 | ||
321 | QDate MonthViewCell::date() const | 321 | QDate MonthViewCell::date() const |
322 | { | 322 | { |
323 | return mDate; | 323 | return mDate; |
324 | } | 324 | } |
325 | 325 | ||
326 | void MonthViewCell::setPrimary( bool primary ) | 326 | void MonthViewCell::setPrimary( bool primary ) |
327 | { | 327 | { |
328 | mPrimary = primary; | 328 | mPrimary = primary; |
329 | //setMyPalette(); | 329 | //setMyPalette(); |
330 | } | 330 | } |
331 | void MonthViewCell::setMyPalette() | 331 | void MonthViewCell::setMyPalette() |
332 | { | 332 | { |
333 | 333 | ||
334 | if ( mHoliday) { | 334 | if ( mHoliday) { |
335 | setPalette( mHolidayPalette ); | 335 | setPalette( mHolidayPalette ); |
336 | } else { | 336 | } else { |
337 | if ( mPrimary ) { | 337 | if ( mPrimary ) { |
338 | setPalette( mPrimaryPalette ); | 338 | setPalette( mPrimaryPalette ); |
339 | } else { | 339 | } else { |
340 | setPalette( mNonPrimaryPalette ); | 340 | setPalette( mNonPrimaryPalette ); |
341 | } | 341 | } |
342 | } | 342 | } |
343 | QPalette pal = palette(); | 343 | QPalette pal = palette(); |
344 | 344 | ||
345 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 345 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
346 | } | 346 | } |
347 | QPalette MonthViewCell::getPalette () | 347 | QPalette MonthViewCell::getPalette () |
348 | { | 348 | { |
349 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 349 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
350 | return mStandardPalette; | 350 | return mStandardPalette; |
351 | if ( mHoliday) { | 351 | if ( mHoliday) { |
352 | return mHolidayPalette ; | 352 | return mHolidayPalette ; |
353 | } else { | 353 | } else { |
354 | if ( mPrimary ) { | 354 | if ( mPrimary ) { |
355 | return mPrimaryPalette ; | 355 | return mPrimaryPalette ; |
356 | } | 356 | } |
357 | } | 357 | } |
358 | return mNonPrimaryPalette; | 358 | return mNonPrimaryPalette; |
359 | } | 359 | } |
360 | bool MonthViewCell::isPrimary() const | 360 | bool MonthViewCell::isPrimary() const |
361 | { | 361 | { |
362 | return mPrimary; | 362 | return mPrimary; |
363 | } | 363 | } |
364 | 364 | ||
365 | void MonthViewCell::setHoliday( bool holiday ) | 365 | void MonthViewCell::setHoliday( bool holiday ) |
366 | { | 366 | { |
367 | mHoliday = holiday; | 367 | mHoliday = holiday; |
368 | //setMyPalette(); | 368 | //setMyPalette(); |
369 | } | 369 | } |
370 | 370 | ||
371 | void MonthViewCell::setHoliday( const QString &holiday ) | 371 | void MonthViewCell::setHoliday( const QString &holiday ) |
372 | { | 372 | { |
373 | mHolidayString = holiday; | 373 | mHolidayString = holiday; |
374 | 374 | ||
375 | if ( !holiday.isEmpty() ) { | 375 | if ( !holiday.isEmpty() ) { |
376 | setHoliday( true ); | 376 | setHoliday( true ); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 379 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
380 | { | 380 | { |
381 | 381 | ||
382 | e->ignore(); | 382 | e->ignore(); |
383 | 383 | ||
384 | } | 384 | } |
385 | void MonthViewCell::clear() | ||
386 | { | ||
387 | mItemList->clear(); | ||
388 | QApplication::removePostedEvents ( mItemList ); | ||
389 | QApplication::removePostedEvents ( mLabel ); | ||
390 | QApplication::removePostedEvents ( this ); | ||
391 | } | ||
385 | void MonthViewCell::updateCell() | 392 | void MonthViewCell::updateCell() |
386 | { | 393 | { |
387 | if ( !mMonthView->isUpdatePossible() ) | 394 | if ( !mMonthView->isUpdatePossible() ) |
388 | return; | 395 | return; |
389 | if ( !isVisible() ){ | 396 | /* |
397 | if ( !isVisible() ){ | ||
390 | return; | 398 | return; |
391 | } | 399 | } |
400 | */ | ||
401 | // qDebug("MonthViewCell::updateCell() "); | ||
392 | setPrimary( mDate.month()%2 ); | 402 | setPrimary( mDate.month()%2 ); |
393 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 403 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
394 | if ( mDate == QDate::currentDate() ) { | 404 | if ( mDate == QDate::currentDate() ) { |
395 | mItemList->setLineWidth( 3 ); | 405 | mItemList->setLineWidth( 3 ); |
396 | } else { | 406 | } else { |
397 | mItemList->setLineWidth( 1 ); | 407 | mItemList->setLineWidth( 1 ); |
398 | } | 408 | } |
399 | mItemList->clear(); | 409 | mItemList->clear(); |
400 | 410 | ||
401 | |||
402 | |||
403 | #ifdef DESKTOP_VERSION | 411 | #ifdef DESKTOP_VERSION |
404 | QToolTip::remove(this); | 412 | QToolTip::remove(this); |
405 | #endif | 413 | #endif |
406 | QString tipText(""); | 414 | QString tipText(""); |
407 | //qApp->processEvents(); | 415 | //qApp->processEvents(); |
408 | if ( !mHolidayString.isEmpty() ) { | 416 | if ( !mHolidayString.isEmpty() ) { |
409 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 417 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
410 | item->setPalette( mHolidayPalette ); | 418 | item->setPalette( mHolidayPalette ); |
411 | mItemList->insertItem( item ); | 419 | mItemList->insertItem( item ); |
412 | tipText += mHolidayString+"\n"; | 420 | tipText += mHolidayString+"\n"; |
413 | } | 421 | } |
414 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 422 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
415 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 423 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
416 | Event *event; | 424 | Event *event; |
417 | for( event = events.first(); event; event = events.next() ) { // for event | 425 | for( event = events.first(); event; event = events.next() ) { // for event |
418 | 426 | ||
419 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 427 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
420 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 428 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
421 | continue; | 429 | continue; |
422 | else | 430 | else |
423 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 431 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
424 | continue; | 432 | continue; |
425 | } | 433 | } |
426 | 434 | ||
427 | if ( event->categories().contains("Holiday") || | 435 | if ( event->categories().contains("Holiday") || |
428 | event->categories().contains(i18n("Holiday"))) { | 436 | event->categories().contains(i18n("Holiday"))) { |
429 | setHoliday( true ); | 437 | setHoliday( true ); |
430 | if ( mDate.dayOfWeek() == 7 ) | 438 | if ( mDate.dayOfWeek() == 7 ) |
431 | mItemList->setLineWidth( 3 ); | 439 | mItemList->setLineWidth( 3 ); |
432 | } | 440 | } |
433 | QString text; | 441 | QString text; |
434 | if (event->isMultiDay()) { | 442 | if (event->isMultiDay()) { |
435 | QString prefix = "<->"; | 443 | QString prefix = "<->"; |
436 | if ( event->doesRecur() ) { | 444 | if ( event->doesRecur() ) { |
437 | if ( event->recursOn( mDate) ) | 445 | if ( event->recursOn( mDate) ) |
438 | prefix ="->" ; | 446 | prefix ="->" ; |
439 | else { | 447 | else { |
440 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 448 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
441 | if ( event->recursOn( mDate.addDays( -days)) ) | 449 | if ( event->recursOn( mDate.addDays( -days)) ) |
442 | prefix ="<-" ; | 450 | prefix ="<-" ; |
443 | } | 451 | } |
444 | 452 | ||
445 | } else { | 453 | } else { |
446 | if (mDate == event->dtStart().date()) { | 454 | if (mDate == event->dtStart().date()) { |
447 | prefix ="->" ; | 455 | prefix ="->" ; |
448 | } else if (mDate == event->dtEnd().date()) { | 456 | } else if (mDate == event->dtEnd().date()) { |
449 | prefix ="<-" ; | 457 | prefix ="<-" ; |
450 | } | 458 | } |
451 | } | 459 | } |
452 | text = prefix + event->summary(); | 460 | text = prefix + event->summary(); |
453 | tipText += text; | 461 | tipText += text; |
454 | } else { | 462 | } else { |
455 | if (event->doesFloat()) { | 463 | if (event->doesFloat()) { |
456 | text = event->summary(); | 464 | text = event->summary(); |
457 | tipText += text; | 465 | tipText += text; |
458 | } | 466 | } |
459 | else { | 467 | else { |
460 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 468 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
461 | text += " " + event->summary(); | 469 | text += " " + event->summary(); |
462 | tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 470 | tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
463 | } | 471 | } |
464 | } | 472 | } |
465 | 473 | ||
466 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 474 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
467 | QPalette pal; | 475 | QPalette pal; |
468 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 476 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
469 | QStringList categories = event->categories(); | 477 | QStringList categories = event->categories(); |
470 | QString cat = categories.first(); | 478 | QString cat = categories.first(); |
471 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 479 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
472 | pal = getPalette(); | 480 | pal = getPalette(); |
473 | if (cat.isEmpty()) { | 481 | if (cat.isEmpty()) { |
474 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 482 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
475 | } else { | 483 | } else { |
476 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 484 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
477 | } | 485 | } |
478 | 486 | ||
479 | } else { | 487 | } else { |
480 | if (cat.isEmpty()) { | 488 | if (cat.isEmpty()) { |
481 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 489 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
482 | } else { | 490 | } else { |
483 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 491 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
484 | } | 492 | } |
485 | } | 493 | } |
486 | 494 | ||
487 | } else { | 495 | } else { |
488 | pal = mStandardPalette ; | 496 | pal = mStandardPalette ; |
489 | } | 497 | } |
490 | item->setPalette( pal ); | 498 | item->setPalette( pal ); |
491 | item->setRecur( event->recurrence()->doesRecur() ); | 499 | item->setRecur( event->recurrence()->doesRecur() ); |
492 | item->setAlarm( event->isAlarmEnabled() ); | 500 | item->setAlarm( event->isAlarmEnabled() ); |
493 | item->setMoreInfo( event->description().length() > 0 ); | 501 | item->setMoreInfo( event->description().length() > 0 ); |
494 | #ifdef DESKTOP_VERSION | 502 | #ifdef DESKTOP_VERSION |
495 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 503 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
496 | KOPrefs::instance()->email()); | 504 | KOPrefs::instance()->email()); |
497 | if ( me != 0 ) { | 505 | if ( me != 0 ) { |
498 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 506 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
499 | item->setReply(true); | 507 | item->setReply(true); |
500 | else | 508 | else |
501 | item->setReply(false); | 509 | item->setReply(false); |
502 | } else | 510 | } else |
503 | item->setReply(false); | 511 | item->setReply(false); |
504 | #endif | 512 | #endif |
505 | mItemList->insertItem( item ); | 513 | mItemList->insertItem( item ); |
506 | tipText += "\n"; | 514 | tipText += "\n"; |
507 | 515 | ||
508 | } | 516 | } |
509 | 517 | ||
510 | // insert due todos | 518 | // insert due todos |
511 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 519 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
512 | Todo *todo; | 520 | Todo *todo; |
513 | for(todo = todos.first(); todo; todo = todos.next()) { | 521 | for(todo = todos.first(); todo; todo = todos.next()) { |
514 | QString text; | 522 | QString text; |
515 | if (todo->hasDueDate()) { | 523 | if (todo->hasDueDate()) { |
516 | if (!todo->doesFloat()) { | 524 | if (!todo->doesFloat()) { |
517 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 525 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
518 | text += " "; | 526 | text += " "; |
519 | } | 527 | } |
520 | } | 528 | } |
521 | text += i18n("To-Do: %1").arg(todo->summary()); | 529 | text += i18n("To-Do: %1").arg(todo->summary()); |
522 | 530 | ||
523 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 531 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
524 | //item->setPalette( mStandardPalette ); | 532 | //item->setPalette( mStandardPalette ); |
525 | QPalette pal; | 533 | QPalette pal; |
526 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 534 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
527 | QStringList categories = todo->categories(); | 535 | QStringList categories = todo->categories(); |
528 | QString cat = categories.first(); | 536 | QString cat = categories.first(); |
529 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 537 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
530 | pal = getPalette(); | 538 | pal = getPalette(); |
531 | if (cat.isEmpty()) { | 539 | if (cat.isEmpty()) { |
532 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 540 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
533 | } else { | 541 | } else { |
534 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 542 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
535 | } | 543 | } |
536 | 544 | ||
537 | } else { | 545 | } else { |
538 | if (cat.isEmpty()) { | 546 | if (cat.isEmpty()) { |
539 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 547 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
540 | } else { | 548 | } else { |
541 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 549 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
542 | } | 550 | } |
543 | } | 551 | } |
544 | 552 | ||
545 | } else { | 553 | } else { |
546 | pal = mStandardPalette ; | 554 | pal = mStandardPalette ; |
547 | } | 555 | } |
548 | item->setPalette( pal ); | 556 | item->setPalette( pal ); |
549 | mItemList->insertItem( item ); | 557 | mItemList->insertItem( item ); |
550 | tipText += text+"\n"; | 558 | tipText += text+"\n"; |
551 | } | 559 | } |
552 | #ifdef DESKTOP_VERSION | 560 | #ifdef DESKTOP_VERSION |
553 | if (tipText != "") | 561 | if (tipText != "") |
554 | QToolTip::add(this,tipText,toolTipGroup(),""); | 562 | QToolTip::add(this,tipText,toolTipGroup(),""); |
555 | #endif | 563 | #endif |
556 | 564 | ||
557 | //setMyPalette(); | 565 | //setMyPalette(); |
558 | setMyPalette(); | 566 | setMyPalette(); |
559 | QString text; | 567 | QString text; |
560 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 568 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
561 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 569 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
562 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 570 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
563 | mLabel->resize( mLabelBigSize ); | 571 | mLabel->resize( mLabelBigSize ); |
564 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 572 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
565 | } else { | 573 | } else { |
566 | mLabel->resize( mLabelSize ); | 574 | mLabel->resize( mLabelSize ); |
567 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 575 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
568 | } | 576 | } |
577 | |||
569 | mLabel->setText( text ); | 578 | mLabel->setText( text ); |
570 | resizeEvent( 0 ); | 579 | resizeEvent( 0 ); |
571 | // if ( isVisible()) | 580 | // if ( isVisible()) |
572 | qApp->processEvents(); | 581 | //qApp->processEvents(); |
573 | } | 582 | } |
574 | 583 | ||
575 | void MonthViewCell::updateConfig() | 584 | void MonthViewCell::updateConfig() |
576 | { | 585 | { |
577 | 586 | ||
578 | setFont( KOPrefs::instance()->mMonthViewFont ); | 587 | setFont( KOPrefs::instance()->mMonthViewFont ); |
579 | 588 | ||
580 | QFontMetrics fm( font() ); | 589 | QFontMetrics fm( font() ); |
581 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 590 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
582 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 591 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
583 | mHolidayPalette = mStandardPalette; | 592 | mHolidayPalette = mStandardPalette; |
584 | mPrimaryPalette = mStandardPalette; | 593 | mPrimaryPalette = mStandardPalette; |
585 | mNonPrimaryPalette = mStandardPalette; | 594 | mNonPrimaryPalette = mStandardPalette; |
586 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 595 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
587 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 596 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
588 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 597 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
589 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 598 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
590 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 599 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
591 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 600 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
592 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 601 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
593 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 602 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
594 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 603 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
595 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 604 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
596 | } | 605 | } |
597 | updateCell(); | 606 | updateCell(); |
598 | } | 607 | } |
599 | 608 | ||
600 | void MonthViewCell::enableScrollBars( bool enabled ) | 609 | void MonthViewCell::enableScrollBars( bool enabled ) |
601 | { | 610 | { |
602 | if ( enabled ) { | 611 | if ( enabled ) { |
603 | mItemList->setVScrollBarMode(QScrollView::Auto); | 612 | mItemList->setVScrollBarMode(QScrollView::Auto); |
604 | mItemList->setHScrollBarMode(QScrollView::Auto); | 613 | mItemList->setHScrollBarMode(QScrollView::Auto); |
605 | } else { | 614 | } else { |
606 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 615 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
607 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 616 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
608 | } | 617 | } |
609 | } | 618 | } |
610 | 619 | ||
611 | Incidence *MonthViewCell::selectedIncidence() | 620 | Incidence *MonthViewCell::selectedIncidence() |
612 | { | 621 | { |
613 | int index = mItemList->currentItem(); | 622 | int index = mItemList->currentItem(); |
614 | if ( index < 0 ) return 0; | 623 | if ( index < 0 ) return 0; |
615 | 624 | ||
616 | MonthViewItem *item = | 625 | MonthViewItem *item = |
617 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 626 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
618 | 627 | ||
619 | if ( !item ) return 0; | 628 | if ( !item ) return 0; |
620 | 629 | ||
621 | return item->incidence(); | 630 | return item->incidence(); |
622 | } | 631 | } |
623 | 632 | ||
624 | QDate MonthViewCell::selectedIncidenceDate() | 633 | QDate MonthViewCell::selectedIncidenceDate() |
625 | { | 634 | { |
626 | QDate qd; | 635 | QDate qd; |
627 | int index = mItemList->currentItem(); | 636 | int index = mItemList->currentItem(); |
628 | if ( index < 0 ) return qd; | 637 | if ( index < 0 ) return qd; |
629 | 638 | ||
630 | MonthViewItem *item = | 639 | MonthViewItem *item = |
631 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 640 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
632 | 641 | ||
633 | if ( !item ) return qd; | 642 | if ( !item ) return qd; |
634 | 643 | ||
635 | return item->incidenceDate(); | 644 | return item->incidenceDate(); |
636 | } | 645 | } |
637 | 646 | ||
638 | void MonthViewCell::deselect() | 647 | void MonthViewCell::deselect() |
639 | { | 648 | { |
640 | mItemList->clearSelection(); | 649 | mItemList->clearSelection(); |
641 | enableScrollBars( false ); | 650 | enableScrollBars( false ); |
642 | // updateCell(); | 651 | // updateCell(); |
643 | } | 652 | } |
644 | void MonthViewCell::select() | 653 | void MonthViewCell::select() |
645 | { | 654 | { |
646 | ;// updateCell(); | 655 | ;// updateCell(); |
647 | } | 656 | } |
648 | 657 | ||
649 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 658 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
650 | { | 659 | { |
651 | if ( !mMonthView->isUpdatePossible() ) | 660 | if ( !mMonthView->isUpdatePossible() ) |
652 | return; | 661 | return; |
653 | if ( !isVisible() ){ | 662 | if ( !isVisible() ){ |
654 | return; | 663 | return; |
655 | } | 664 | } |
656 | int size = height() - mLabel->height(); | 665 | int size = height() - mLabel->height(); |
657 | if ( size > 0 ) | 666 | if ( size > 0 ) |
658 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 667 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
659 | size = width() - mLabel->width(); | 668 | size = width() - mLabel->width(); |
660 | if ( size > 0 ) | 669 | if ( size > 0 ) |
661 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 670 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
662 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 671 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
663 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 672 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
664 | } | 673 | } |
665 | 674 | ||
666 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 675 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
667 | { | 676 | { |
668 | if ( !item ) return; | 677 | if ( !item ) return; |
669 | 678 | ||
670 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 679 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
671 | Incidence *incidence = eventItem->incidence(); | 680 | Incidence *incidence = eventItem->incidence(); |
672 | if ( incidence ) mMonthView->defaultAction( incidence ); | 681 | if ( incidence ) mMonthView->defaultAction( incidence ); |
673 | } | 682 | } |
674 | void MonthViewCell::showDay() | 683 | void MonthViewCell::showDay() |
675 | { | 684 | { |
676 | emit showDaySignal( date() ); | 685 | emit showDaySignal( date() ); |
677 | } | 686 | } |
678 | void MonthViewCell::newEvent() | 687 | void MonthViewCell::newEvent() |
679 | { | 688 | { |
680 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 689 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
681 | emit newEventSignal( dt ); | 690 | emit newEventSignal( dt ); |
682 | } | 691 | } |
683 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 692 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
684 | { | 693 | { |
685 | static QListBoxItem * lastClicked = 0; | 694 | static QListBoxItem * lastClicked = 0; |
686 | if ( item == 0 ) { | 695 | if ( item == 0 ) { |
687 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 696 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
688 | emit newEventSignal( dt ); | 697 | emit newEventSignal( dt ); |
689 | return; | 698 | return; |
690 | } | 699 | } |
691 | /* | 700 | /* |
692 | if ( lastClicked ) | 701 | if ( lastClicked ) |
693 | if ( ! item ) { | 702 | if ( ! item ) { |
694 | if ( lastClicked->listBox() != item->listBox() ) | 703 | if ( lastClicked->listBox() != item->listBox() ) |
695 | lastClicked->listBox()->clearSelection(); | 704 | lastClicked->listBox()->clearSelection(); |
696 | } | 705 | } |
697 | */ | 706 | */ |
698 | 707 | ||
699 | mMonthView->setSelectedCell( this ); | 708 | mMonthView->setSelectedCell( this ); |
700 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); | 709 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); |
701 | select(); | 710 | select(); |
702 | } | 711 | } |
703 | 712 | ||
704 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 713 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
705 | { | 714 | { |
706 | if ( !item ) return; | 715 | if ( !item ) return; |
707 | 716 | ||
708 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 717 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
709 | Incidence *incidence = eventItem->incidence(); | 718 | Incidence *incidence = eventItem->incidence(); |
710 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 719 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
711 | } | 720 | } |
712 | 721 | ||
713 | void MonthViewCell::selection( QListBoxItem *item ) | 722 | void MonthViewCell::selection( QListBoxItem *item ) |
714 | { | 723 | { |
715 | if ( !item ) return; | 724 | if ( !item ) return; |
716 | 725 | ||
717 | mMonthView->setSelectedCell( this ); | 726 | mMonthView->setSelectedCell( this ); |
718 | } | 727 | } |
719 | 728 | ||
720 | 729 | ||
721 | // ******************************************************************************* | 730 | // ******************************************************************************* |
722 | // ******************************************************************************* | 731 | // ******************************************************************************* |
723 | // ******************************************************************************* | 732 | // ******************************************************************************* |
724 | 733 | ||
725 | 734 | ||
726 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 735 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
727 | : KOEventView( calendar, parent, name ), | 736 | : KOEventView( calendar, parent, name ), |
728 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 737 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
729 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 738 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
730 | { | 739 | { |
731 | updatePossible = false; | 740 | updatePossible = false; |
732 | mCells.setAutoDelete( true ); | 741 | mCells.setAutoDelete( true ); |
733 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 742 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
734 | // mDayLayout = new QGridLayout( this ); | 743 | // mDayLayout = new QGridLayout( this ); |
735 | // create the day of the week labels (Sun, Mon, etc) and add them to | 744 | // create the day of the week labels (Sun, Mon, etc) and add them to |
736 | // the layout. | 745 | // the layout. |
737 | mDayLabels.resize( mDaysPerWeek ); | 746 | mDayLabels.resize( mDaysPerWeek ); |
738 | QFont bfont = font(); | 747 | QFont bfont = font(); |
739 | if ( QApplication::desktop()->width() < 650 ) { | 748 | if ( QApplication::desktop()->width() < 650 ) { |
740 | bfont.setPointSize( bfont.pointSize() - 2 ); | 749 | bfont.setPointSize( bfont.pointSize() - 2 ); |
741 | } | 750 | } |
742 | bfont.setBold( true ); | 751 | bfont.setBold( true ); |
743 | int i; | 752 | int i; |
744 | 753 | ||
745 | for( i = 0; i < mDaysPerWeek; i++ ) { | 754 | for( i = 0; i < mDaysPerWeek; i++ ) { |
746 | QLabel *label = new QLabel( this ); | 755 | QLabel *label = new QLabel( this ); |
747 | label->setFont(bfont); | 756 | label->setFont(bfont); |
748 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 757 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
749 | label->setLineWidth(1); | 758 | label->setLineWidth(1); |
750 | label->setAlignment(AlignCenter); | 759 | label->setAlignment(AlignCenter); |
751 | mDayLabels.insert( i, label ); | 760 | mDayLabels.insert( i, label ); |
752 | } | 761 | } |
753 | 762 | ||
754 | bfont.setBold( false ); | 763 | bfont.setBold( false ); |
755 | mWeekLabels.resize( mNumWeeks+1 ); | 764 | mWeekLabels.resize( mNumWeeks+1 ); |
756 | for( i = 0; i < mNumWeeks+1; i++ ) { | 765 | for( i = 0; i < mNumWeeks+1; i++ ) { |
757 | KOWeekButton *label = new KOWeekButton( this ); | 766 | KOWeekButton *label = new KOWeekButton( this ); |
758 | label->setFont(bfont); | 767 | label->setFont(bfont); |
759 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 768 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); |
760 | label->setFlat(true); | 769 | label->setFlat(true); |
761 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 770 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); |
762 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 771 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
763 | //label->setLineWidth(1); | 772 | //label->setLineWidth(1); |
764 | //label->setAlignment(AlignCenter); | 773 | //label->setAlignment(AlignCenter); |
765 | mWeekLabels.insert( i, label ); | 774 | mWeekLabels.insert( i, label ); |
766 | } | 775 | } |
767 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 776 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
768 | int row, col; | 777 | int row, col; |
769 | mCells.resize( mNumCells ); | 778 | mCells.resize( mNumCells ); |
770 | for( row = 0; row < mNumWeeks; ++row ) { | 779 | for( row = 0; row < mNumWeeks; ++row ) { |
771 | for( col = 0; col < mDaysPerWeek; ++col ) { | 780 | for( col = 0; col < mDaysPerWeek; ++col ) { |
772 | MonthViewCell *cell = new MonthViewCell( this ); | 781 | MonthViewCell *cell = new MonthViewCell( this ); |
773 | mCells.insert( row * mDaysPerWeek + col, cell ); | 782 | mCells.insert( row * mDaysPerWeek + col, cell ); |
774 | 783 | ||
775 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 784 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
776 | SLOT( defaultAction( Incidence * ) ) ); | 785 | SLOT( defaultAction( Incidence * ) ) ); |
777 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 786 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
778 | SIGNAL( newEventSignal( QDateTime ) ) ); | 787 | SIGNAL( newEventSignal( QDateTime ) ) ); |
779 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 788 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
780 | SIGNAL( showDaySignal( QDate ) ) ); | 789 | SIGNAL( showDaySignal( QDate ) ) ); |
781 | } | 790 | } |
782 | } | 791 | } |
783 | 792 | ||
784 | mContextMenu = eventPopup(); | 793 | mContextMenu = eventPopup(); |
785 | // updateConfig(); //useless here | 794 | // updateConfig(); //useless here |
786 | 795 | ||
787 | emit incidenceSelected( 0 ); | 796 | emit incidenceSelected( 0 ); |
788 | } | 797 | } |
789 | 798 | ||
790 | KOMonthView::~KOMonthView() | 799 | KOMonthView::~KOMonthView() |
791 | { | 800 | { |
792 | delete mContextMenu; | 801 | delete mContextMenu; |
793 | } | 802 | } |
794 | 803 | ||
795 | int KOMonthView::maxDatesHint() | 804 | int KOMonthView::maxDatesHint() |
796 | { | 805 | { |
797 | return mNumCells; | 806 | return mNumCells; |
798 | } | 807 | } |
799 | 808 | ||
800 | int KOMonthView::currentDateCount() | 809 | int KOMonthView::currentDateCount() |
801 | { | 810 | { |
802 | return mNumCells; | 811 | return mNumCells; |
803 | } | 812 | } |
804 | 813 | ||
805 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 814 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
806 | { | 815 | { |
807 | QPtrList<Incidence> selected; | 816 | QPtrList<Incidence> selected; |
808 | 817 | ||
809 | if ( mSelectedCell ) { | 818 | if ( mSelectedCell ) { |
810 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 819 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
811 | if ( incidence ) selected.append( incidence ); | 820 | if ( incidence ) selected.append( incidence ); |
812 | } | 821 | } |
813 | 822 | ||
814 | return selected; | 823 | return selected; |
815 | } | 824 | } |
816 | 825 | ||
817 | DateList KOMonthView::selectedDates() | 826 | DateList KOMonthView::selectedDates() |
818 | { | 827 | { |
819 | DateList selected; | 828 | DateList selected; |
820 | 829 | ||
821 | if ( mSelectedCell ) { | 830 | if ( mSelectedCell ) { |
822 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 831 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
823 | if ( qd.isValid() ) selected.append( qd ); | 832 | if ( qd.isValid() ) selected.append( qd ); |
824 | } | 833 | } |
825 | 834 | ||
826 | return selected; | 835 | return selected; |
827 | } | 836 | } |
828 | 837 | ||
829 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 838 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
830 | const QDate &td) | 839 | const QDate &td) |
831 | { | 840 | { |
832 | #ifndef KORG_NOPRINTER | 841 | #ifndef KORG_NOPRINTER |
833 | calPrinter->preview(CalPrinter::Month, fd, td); | 842 | calPrinter->preview(CalPrinter::Month, fd, td); |
834 | #endif | 843 | #endif |
835 | } | 844 | } |
836 | 845 | ||
837 | void KOMonthView::updateConfig() | 846 | void KOMonthView::updateConfig() |
838 | { | 847 | { |
839 | 848 | ||
840 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 849 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
841 | 850 | ||
842 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 851 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
843 | mWidthLongDayLabel = 0; | 852 | mWidthLongDayLabel = 0; |
844 | 853 | ||
845 | for (int i = 0; i < 7; i++) { | 854 | for (int i = 0; i < 7; i++) { |
846 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 855 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
847 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 856 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
848 | } | 857 | } |
849 | bool temp = mShowSatSunComp ; | 858 | bool temp = mShowSatSunComp ; |
850 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 859 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
851 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 860 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
852 | computeLayout(); | 861 | computeLayout(); |
853 | updateDayLabels(); | 862 | updateDayLabels(); |
854 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 863 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
855 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 864 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
856 | //resizeEvent( 0 ); | 865 | //resizeEvent( 0 ); |
857 | for (uint i = 0; i < mCells.count(); ++i) { | 866 | for (uint i = 0; i < mCells.count(); ++i) { |
858 | mCells[i]->updateConfig(); | 867 | mCells[i]->updateConfig(); |
859 | } | 868 | } |
860 | #ifdef DESKTOP_VERSION | 869 | #ifdef DESKTOP_VERSION |
861 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 870 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
862 | #endif | 871 | #endif |
863 | } | 872 | } |
864 | 873 | ||
865 | void KOMonthView::updateDayLabels() | 874 | void KOMonthView::updateDayLabels() |
866 | { | 875 | { |
867 | 876 | ||
868 | for (int i = 0; i < 7; i++) { | 877 | for (int i = 0; i < 7; i++) { |
869 | if (mWeekStartsMonday) { | 878 | if (mWeekStartsMonday) { |
870 | bool show = mShortDayLabels; | 879 | bool show = mShortDayLabels; |
871 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 880 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
872 | show = true; | 881 | show = true; |
873 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 882 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
874 | } else { | 883 | } else { |
875 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 884 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
876 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 885 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
877 | 886 | ||
878 | } | 887 | } |
879 | } | 888 | } |
880 | } | 889 | } |
881 | 890 | ||
882 | void KOMonthView::showDates(const QDate &start, const QDate &) | 891 | void KOMonthView::showDates(const QDate &start, const QDate &) |
883 | { | 892 | { |
884 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 893 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
885 | 894 | ||
886 | 895 | ||
887 | mStartDate = start; | 896 | mStartDate = start; |
888 | 897 | ||
889 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 898 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
890 | 899 | ||
891 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 900 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
892 | mStartDate = mStartDate.addDays( -1 ); | 901 | mStartDate = mStartDate.addDays( -1 ); |
893 | } | 902 | } |
894 | 903 | ||
895 | bool primary = false; | 904 | bool primary = false; |
896 | uint i; | 905 | uint i; |
897 | for( i = 0; i < mCells.size(); ++i ) { | 906 | for( i = 0; i < mCells.size(); ++i ) { |
898 | QDate date = mStartDate.addDays( i ); | 907 | QDate date = mStartDate.addDays( i ); |
899 | mCells[i]->setDate( date ); | 908 | mCells[i]->setDate( date ); |
900 | 909 | ||
901 | #ifndef KORG_NOPLUGINS | 910 | #ifndef KORG_NOPLUGINS |
902 | // add holiday, if present | 911 | // add holiday, if present |
903 | QString hstring(KOCore::self()->holiday(date)); | 912 | QString hstring(KOCore::self()->holiday(date)); |
904 | mCells[i]->setHoliday( hstring ); | 913 | mCells[i]->setHoliday( hstring ); |
905 | #endif | 914 | #endif |
906 | 915 | ||
907 | } | 916 | } |
908 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 917 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
909 | for( i = 0; i < 6; ++i ) { | 918 | for( i = 0; i < 6; ++i ) { |
910 | int wno; | 919 | int wno; |
911 | // remember, according to ISO 8601, the first week of the year is the | 920 | // remember, according to ISO 8601, the first week of the year is the |
912 | // first week that contains a thursday. Thus we must subtract off 4, | 921 | // first week that contains a thursday. Thus we must subtract off 4, |
913 | // not just 1. | 922 | // not just 1. |
914 | int dayOfYear = date.dayOfYear(); | 923 | int dayOfYear = date.dayOfYear(); |
915 | if (dayOfYear % 7 != 0) | 924 | if (dayOfYear % 7 != 0) |
916 | wno = dayOfYear / 7 + 1; | 925 | wno = dayOfYear / 7 + 1; |
917 | else | 926 | else |
918 | wno =dayOfYear / 7; | 927 | wno =dayOfYear / 7; |
919 | mWeekLabels[i]->setWeekNum( wno ); | 928 | mWeekLabels[i]->setWeekNum( wno ); |
920 | date = date.addDays( 7 ); | 929 | date = date.addDays( 7 ); |
921 | } | 930 | } |
922 | updateView(); | 931 | updateView(); |
923 | } | 932 | } |
924 | 933 | ||
925 | void KOMonthView::showEvents(QPtrList<Event>) | 934 | void KOMonthView::showEvents(QPtrList<Event>) |
926 | { | 935 | { |
927 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 936 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
928 | } | 937 | } |
929 | 938 | ||
930 | void KOMonthView::changeEventDisplay(Event *, int) | 939 | void KOMonthView::changeEventDisplay(Event *, int) |
931 | { | 940 | { |
932 | // this should be re-written to be much more efficient, but this | 941 | // this should be re-written to be much more efficient, but this |
933 | // quick-and-dirty-hack gets the job done for right now. | 942 | // quick-and-dirty-hack gets the job done for right now. |
934 | updateView(); | 943 | updateView(); |
935 | } | 944 | } |
936 | 945 | ||
937 | void KOMonthView::updateView() | 946 | void KOMonthView::updateView() |
938 | { | 947 | { |
939 | static int iii = 0; | ||
940 | ++iii; | ||
941 | if ( !updatePossible ) | 948 | if ( !updatePossible ) |
942 | return; | 949 | return; |
943 | uint i; | 950 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
951 | int i; | ||
944 | for( i = 0; i < mCells.count(); ++i ) { | 952 | for( i = 0; i < mCells.count(); ++i ) { |
945 | mCells[i]->updateCell(); | 953 | mCells[i]->updateCell(); |
946 | } | 954 | } |
955 | |||
947 | //qDebug("KOMonthView::updateView() "); | 956 | //qDebug("KOMonthView::updateView() "); |
948 | processSelectionChange(); | 957 | processSelectionChange(); |
958 | // qDebug("---------------------------------------------------------------------+ "); | ||
949 | } | 959 | } |
950 | 960 | ||
951 | void KOMonthView::resizeEvent(QResizeEvent * e) | 961 | void KOMonthView::resizeEvent(QResizeEvent * e) |
952 | { | 962 | { |
953 | computeLayout(); | 963 | computeLayout(); |
954 | } | 964 | } |
955 | void KOMonthView::computeLayout() | 965 | void KOMonthView::computeLayout() |
956 | { | 966 | { |
957 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 967 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
958 | // note this only changes the text if the requested size crosses the | 968 | // note this only changes the text if the requested size crosses the |
959 | // threshold between big enough to support the full name and not big | 969 | // threshold between big enough to support the full name and not big |
960 | // enough. | 970 | // enough. |
961 | 971 | ||
962 | int daysToShow = 7; | 972 | int daysToShow = 7; |
963 | bool combinedSatSun = false; | 973 | bool combinedSatSun = false; |
964 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 974 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
965 | daysToShow = 6; | 975 | daysToShow = 6; |
966 | combinedSatSun = true; | 976 | combinedSatSun = true; |
967 | } | 977 | } |
968 | int tWid = topLevelWidget()->size().width(); | 978 | int tWid = topLevelWidget()->size().width(); |
969 | int tHei = topLevelWidget()->size().height(); | 979 | int tHei = topLevelWidget()->size().height(); |
970 | 980 | ||
971 | int wid = size().width();//e | 981 | int wid = size().width();//e |
972 | int hei = size().height()-1; | 982 | int hei = size().height()-1; |
973 | 983 | ||
974 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 984 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
975 | return; | 985 | return; |
976 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 986 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
977 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 987 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
978 | int weeklabelwid = fm.width( "888" ); | 988 | int weeklabelwid = fm.width( "888" ); |
979 | wid -= weeklabelwid; | 989 | wid -= weeklabelwid; |
980 | 990 | ||
981 | int colWid = wid / daysToShow; | 991 | int colWid = wid / daysToShow; |
982 | int lastCol = wid - ( colWid*6 ); | 992 | int lastCol = wid - ( colWid*6 ); |
983 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 993 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
984 | int cellHei = (hei - dayLabelHei) /6; | 994 | int cellHei = (hei - dayLabelHei) /6; |
985 | int colModulo = wid % daysToShow; | 995 | int colModulo = wid % daysToShow; |
986 | int rowModulo = (hei- dayLabelHei) % 6; | 996 | int rowModulo = (hei- dayLabelHei) % 6; |
987 | //qDebug("rowmod %d ", rowModulo); | 997 | //qDebug("rowmod %d ", rowModulo); |
988 | int i; | 998 | int i; |
989 | int x,y,w,h; | 999 | int x,y,w,h; |
990 | x= 0; | 1000 | x= 0; |
991 | y= 0; | 1001 | y= 0; |
992 | w = colWid; | 1002 | w = colWid; |
993 | h = dayLabelHei ; | 1003 | h = dayLabelHei ; |
994 | for ( i = 0; i < 7; i++) { | 1004 | for ( i = 0; i < 7; i++) { |
995 | if ( i == daysToShow-colModulo ) | 1005 | if ( i == daysToShow-colModulo ) |
996 | ++w; | 1006 | ++w; |
997 | if ( combinedSatSun ) { | 1007 | if ( combinedSatSun ) { |
998 | if ( i >= daysToShow-1 ) { | 1008 | if ( i >= daysToShow-1 ) { |
999 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1009 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1000 | x -= w/2 ; | 1010 | x -= w/2 ; |
1001 | } | 1011 | } |
1002 | else | 1012 | else |
1003 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1013 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1004 | } else | 1014 | } else |
1005 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1015 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1006 | x += w; | 1016 | x += w; |
1007 | } | 1017 | } |
1008 | x= 0; | 1018 | x= 0; |
1009 | y= dayLabelHei; | 1019 | y= dayLabelHei; |
1010 | w = colWid; | 1020 | w = colWid; |
1011 | h = cellHei ; | 1021 | h = cellHei ; |
1012 | for ( i = 0; i < mCells.count(); ++i) { | 1022 | for ( i = 0; i < mCells.count(); ++i) { |
1013 | 1023 | ||
1014 | w = colWid; | 1024 | w = colWid; |
1015 | if ( ((i) % 7) >= 7-colModulo ) { | 1025 | if ( ((i) % 7) >= 7-colModulo ) { |
1016 | ++w; | 1026 | ++w; |
1017 | } | 1027 | } |
1018 | if ( i == (6-rowModulo)*7) | 1028 | if ( i == (6-rowModulo)*7) |
1019 | ++h; | 1029 | ++h; |
1020 | if ( combinedSatSun ) { | 1030 | if ( combinedSatSun ) { |
1021 | if ( (i)%7 >= daysToShow-1 ) { | 1031 | if ( (i)%7 >= daysToShow-1 ) { |
1022 | if ( (i)%7 == daysToShow-1 ) { | 1032 | if ( (i)%7 == daysToShow-1 ) { |
1023 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1033 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1024 | x -= w ;y += h/2; | 1034 | x -= w ;y += h/2; |
1025 | } else { | 1035 | } else { |
1026 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1036 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1027 | y -= h/2; | 1037 | y -= h/2; |
1028 | } | 1038 | } |
1029 | } else | 1039 | } else |
1030 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1040 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1031 | 1041 | ||
1032 | } | 1042 | } |
1033 | else | 1043 | else |
1034 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1044 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1035 | x += w; | 1045 | x += w; |
1036 | if ( x + w/2 > wid ) { | 1046 | if ( x + w/2 > wid ) { |
1037 | x = 0; | 1047 | x = 0; |
1038 | y += h; | 1048 | y += h; |
1039 | } | 1049 | } |
1040 | } | 1050 | } |
1041 | y= dayLabelHei; | 1051 | y= dayLabelHei; |
1042 | h = cellHei ; | 1052 | h = cellHei ; |
1043 | for ( i = 0; i < 6; i++) { | 1053 | for ( i = 0; i < 6; i++) { |
1044 | if ( i == (6-rowModulo)) | 1054 | if ( i == (6-rowModulo)) |
1045 | ++h; | 1055 | ++h; |
1046 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1056 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1047 | y += h; | 1057 | y += h; |
1048 | } | 1058 | } |
1049 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1059 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1050 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1060 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1051 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1061 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1052 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1062 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1053 | updateDayLabels(); | 1063 | updateDayLabels(); |
1054 | bool forceUpdate = !updatePossible; | 1064 | bool forceUpdate = !updatePossible; |
1055 | updatePossible = true; | 1065 | updatePossible = true; |
1056 | if ( forceUpdate ) | 1066 | if ( forceUpdate ) |
1057 | updateView(); | 1067 | updateView(); |
1058 | } | 1068 | } |
1059 | 1069 | ||
1060 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1070 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1061 | { | 1071 | { |
1062 | mContextMenu->showIncidencePopup(incidence); | 1072 | mContextMenu->showIncidencePopup(incidence); |
1063 | /* | 1073 | /* |
1064 | if( incidence && incidence->type() == "Event" ) { | 1074 | if( incidence && incidence->type() == "Event" ) { |
1065 | Event *event = static_cast<Event *>(incidence); | 1075 | Event *event = static_cast<Event *>(incidence); |
1066 | mContextMenu->showEventPopup(event); | 1076 | mContextMenu->showEventPopup(event); |
1067 | } else { | 1077 | } else { |
1068 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1078 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1069 | } | 1079 | } |
1070 | */ | 1080 | */ |
1071 | } | 1081 | } |
1072 | MonthViewCell * KOMonthView::selectedCell( ) | 1082 | MonthViewCell * KOMonthView::selectedCell( ) |
1073 | { | 1083 | { |
1074 | return mSelectedCell; | 1084 | return mSelectedCell; |
1075 | } | 1085 | } |
1076 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1086 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1077 | { | 1087 | { |
1078 | // qDebug("KOMonthView::setSelectedCell "); | 1088 | // qDebug("KOMonthView::setSelectedCell "); |
1079 | if ( mSelectedCell && mSelectedCell != cell ) { | 1089 | if ( mSelectedCell && mSelectedCell != cell ) { |
1080 | MonthViewCell * mvc = mSelectedCell; | 1090 | MonthViewCell * mvc = mSelectedCell; |
1081 | mSelectedCell = cell; | 1091 | mSelectedCell = cell; |
1082 | mvc->deselect(); | 1092 | mvc->deselect(); |
1083 | } else | 1093 | } else |
1084 | mSelectedCell = cell; | 1094 | mSelectedCell = cell; |
1085 | // if ( mSelectedCell ) | 1095 | // if ( mSelectedCell ) |
1086 | // mSelectedCell->select(); | 1096 | // mSelectedCell->select(); |
1087 | if ( !mSelectedCell ) | 1097 | if ( !mSelectedCell ) |
1088 | emit incidenceSelected( 0 ); | 1098 | emit incidenceSelected( 0 ); |
1089 | else | 1099 | else |
1090 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1100 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1091 | } | 1101 | } |
1092 | 1102 | ||
1093 | void KOMonthView::processSelectionChange() | 1103 | void KOMonthView::processSelectionChange() |
1094 | { | 1104 | { |
1095 | QPtrList<Incidence> incidences = selectedIncidences(); | 1105 | QPtrList<Incidence> incidences = selectedIncidences(); |
1096 | if (incidences.count() > 0) { | 1106 | if (incidences.count() > 0) { |
1097 | emit incidenceSelected( incidences.first() ); | 1107 | emit incidenceSelected( incidences.first() ); |
1098 | } else { | 1108 | } else { |
1099 | emit incidenceSelected( 0 ); | 1109 | emit incidenceSelected( 0 ); |
1100 | } | 1110 | } |
1101 | } | 1111 | } |
1102 | 1112 | ||
1103 | void KOMonthView::clearSelection() | 1113 | void KOMonthView::clearSelection() |
1104 | { | 1114 | { |
1105 | if ( mSelectedCell ) { | 1115 | if ( mSelectedCell ) { |
1106 | mSelectedCell->deselect(); | 1116 | mSelectedCell->deselect(); |
1107 | mSelectedCell = 0; | 1117 | mSelectedCell = 0; |
1108 | } | 1118 | } |
1109 | } | 1119 | } |
1110 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1120 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1111 | { | 1121 | { |
1112 | 1122 | ||
1113 | e->ignore(); | 1123 | e->ignore(); |
1114 | 1124 | ||
1115 | } | 1125 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 727f511..a965bf3 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,271 +1,272 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qintdict.h> | 29 | #include <qintdict.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qvaluelist.h> | 31 | #include <qvaluelist.h> |
32 | #include <qptrvector.h> | 32 | #include <qptrvector.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | #include <libkcal/event.h> | 35 | #include <libkcal/event.h> |
36 | 36 | ||
37 | #include "koeventview.h" | 37 | #include "koeventview.h" |
38 | 38 | ||
39 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
40 | class QToolTipGroup; | 40 | class QToolTipGroup; |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | class KNOWhatsThis; | 43 | class KNOWhatsThis; |
44 | class KOWeekButton : public QPushButton | 44 | class KOWeekButton : public QPushButton |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 48 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
49 | QPushButton( parent, name) | 49 | QPushButton( parent, name) |
50 | { | 50 | { |
51 | connect( this, SIGNAL( clicked() ), | 51 | connect( this, SIGNAL( clicked() ), |
52 | SLOT( bottonClicked() )); | 52 | SLOT( bottonClicked() )); |
53 | mNumber = -1; | 53 | mNumber = -1; |
54 | } | 54 | } |
55 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 55 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
56 | signals: | 56 | signals: |
57 | void selectWeekNum ( int ); | 57 | void selectWeekNum ( int ); |
58 | private: | 58 | private: |
59 | int mNumber; | 59 | int mNumber; |
60 | private slots : | 60 | private slots : |
61 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 61 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
62 | }; | 62 | }; |
63 | 63 | ||
64 | class KNoScrollListBox: public QListBox | 64 | class KNoScrollListBox: public QListBox |
65 | { | 65 | { |
66 | Q_OBJECT | 66 | Q_OBJECT |
67 | public: | 67 | public: |
68 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 68 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
69 | ~KNoScrollListBox(); | 69 | ~KNoScrollListBox(); |
70 | QString getWhatsThisText(QPoint p) ; | 70 | QString getWhatsThisText(QPoint p) ; |
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | void shiftDown(); | 73 | void shiftDown(); |
74 | void shiftUp(); | 74 | void shiftUp(); |
75 | void rightClick(); | 75 | void rightClick(); |
76 | 76 | ||
77 | protected slots: | 77 | protected slots: |
78 | void keyPressEvent(QKeyEvent *); | 78 | void keyPressEvent(QKeyEvent *); |
79 | void keyReleaseEvent(QKeyEvent *); | 79 | void keyReleaseEvent(QKeyEvent *); |
80 | void mousePressEvent(QMouseEvent *); | 80 | void mousePressEvent(QMouseEvent *); |
81 | 81 | ||
82 | private: | 82 | private: |
83 | KNOWhatsThis * mWT; | 83 | KNOWhatsThis * mWT; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | 86 | ||
87 | class MonthViewItem: public QListBoxItem | 87 | class MonthViewItem: public QListBoxItem |
88 | { | 88 | { |
89 | public: | 89 | public: |
90 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 90 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
91 | 91 | ||
92 | void setRecur(bool on) { mRecur = on; } | 92 | void setRecur(bool on) { mRecur = on; } |
93 | void setAlarm(bool on) { mAlarm = on; } | 93 | void setAlarm(bool on) { mAlarm = on; } |
94 | void setReply(bool on) { mReply = on; } | 94 | void setReply(bool on) { mReply = on; } |
95 | void setMoreInfo(bool on) { mInfo = on; } | 95 | void setMoreInfo(bool on) { mInfo = on; } |
96 | 96 | ||
97 | 97 | ||
98 | void setPalette(const QPalette &p) { mPalette = p; } | 98 | void setPalette(const QPalette &p) { mPalette = p; } |
99 | QPalette palette() const { return mPalette; } | 99 | QPalette palette() const { return mPalette; } |
100 | 100 | ||
101 | Incidence *incidence() const { return mIncidence; } | 101 | Incidence *incidence() const { return mIncidence; } |
102 | QDate incidenceDate() { return mDate; } | 102 | QDate incidenceDate() { return mDate; } |
103 | 103 | ||
104 | protected: | 104 | protected: |
105 | virtual void paint(QPainter *); | 105 | virtual void paint(QPainter *); |
106 | virtual int height(const QListBox *) const; | 106 | virtual int height(const QListBox *) const; |
107 | virtual int width(const QListBox *) const; | 107 | virtual int width(const QListBox *) const; |
108 | 108 | ||
109 | private: | 109 | private: |
110 | bool mRecur; | 110 | bool mRecur; |
111 | bool mAlarm; | 111 | bool mAlarm; |
112 | bool mReply; | 112 | bool mReply; |
113 | bool mInfo; | 113 | bool mInfo; |
114 | 114 | ||
115 | QPalette mPalette; | 115 | QPalette mPalette; |
116 | QDate mDate; | 116 | QDate mDate; |
117 | 117 | ||
118 | Incidence *mIncidence; | 118 | Incidence *mIncidence; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | 121 | ||
122 | class KOMonthView; | 122 | class KOMonthView; |
123 | 123 | ||
124 | class MonthViewCell : public QWidget | 124 | class MonthViewCell : public QWidget |
125 | { | 125 | { |
126 | Q_OBJECT | 126 | Q_OBJECT |
127 | public: | 127 | public: |
128 | MonthViewCell( KOMonthView * ); | 128 | MonthViewCell( KOMonthView * ); |
129 | 129 | ||
130 | void setDate( const QDate & ); | 130 | void setDate( const QDate & ); |
131 | QDate date() const; | 131 | QDate date() const; |
132 | 132 | ||
133 | void setPrimary( bool ); | 133 | void setPrimary( bool ); |
134 | bool isPrimary() const; | 134 | bool isPrimary() const; |
135 | 135 | ||
136 | void setHoliday( bool ); | 136 | void setHoliday( bool ); |
137 | void setHoliday( const QString & ); | 137 | void setHoliday( const QString & ); |
138 | 138 | ||
139 | void updateCell(); | 139 | void updateCell(); |
140 | 140 | ||
141 | void updateConfig(); | 141 | void updateConfig(); |
142 | 142 | ||
143 | void enableScrollBars( bool ); | 143 | void enableScrollBars( bool ); |
144 | 144 | ||
145 | Incidence *selectedIncidence(); | 145 | Incidence *selectedIncidence(); |
146 | QDate selectedIncidenceDate(); | 146 | QDate selectedIncidenceDate(); |
147 | 147 | ||
148 | void deselect(); | 148 | void deselect(); |
149 | void select(); | 149 | void select(); |
150 | void clear(); | ||
150 | 151 | ||
151 | #ifdef DESKTOP_VERSION | 152 | #ifdef DESKTOP_VERSION |
152 | static QToolTipGroup *toolTipGroup(); | 153 | static QToolTipGroup *toolTipGroup(); |
153 | #endif | 154 | #endif |
154 | signals: | 155 | signals: |
155 | void defaultAction( Incidence * ); | 156 | void defaultAction( Incidence * ); |
156 | void newEventSignal( QDateTime ); | 157 | void newEventSignal( QDateTime ); |
157 | void showDaySignal( QDate ); | 158 | void showDaySignal( QDate ); |
158 | 159 | ||
159 | protected: | 160 | protected: |
160 | void resizeEvent( QResizeEvent * ); | 161 | void resizeEvent( QResizeEvent * ); |
161 | 162 | ||
162 | protected slots: | 163 | protected slots: |
163 | void defaultAction( QListBoxItem * ); | 164 | void defaultAction( QListBoxItem * ); |
164 | void contextMenu( QListBoxItem * ); | 165 | void contextMenu( QListBoxItem * ); |
165 | void selection( QListBoxItem * ); | 166 | void selection( QListBoxItem * ); |
166 | void cellClicked( QListBoxItem * ); | 167 | void cellClicked( QListBoxItem * ); |
167 | void newEvent(); | 168 | void newEvent(); |
168 | void showDay(); | 169 | void showDay(); |
169 | 170 | ||
170 | private: | 171 | private: |
171 | KOMonthView *mMonthView; | 172 | KOMonthView *mMonthView; |
172 | 173 | ||
173 | QDate mDate; | 174 | QDate mDate; |
174 | bool mPrimary; | 175 | bool mPrimary; |
175 | bool mHoliday; | 176 | bool mHoliday; |
176 | QString mHolidayString; | 177 | QString mHolidayString; |
177 | 178 | ||
178 | //QLabel *mLabel; | 179 | //QLabel *mLabel; |
179 | QPushButton *mLabel; | 180 | QPushButton *mLabel; |
180 | QListBox *mItemList; | 181 | QListBox *mItemList; |
181 | #ifdef DESKTOP_VERSION | 182 | #ifdef DESKTOP_VERSION |
182 | static QToolTipGroup *mToolTipGroup; | 183 | static QToolTipGroup *mToolTipGroup; |
183 | #endif | 184 | #endif |
184 | QSize mLabelSize; | 185 | QSize mLabelSize; |
185 | QSize mLabelBigSize; | 186 | QSize mLabelBigSize; |
186 | QPalette mHolidayPalette; | 187 | QPalette mHolidayPalette; |
187 | QPalette mStandardPalette; | 188 | QPalette mStandardPalette; |
188 | QPalette mPrimaryPalette; | 189 | QPalette mPrimaryPalette; |
189 | QPalette mNonPrimaryPalette; | 190 | QPalette mNonPrimaryPalette; |
190 | void setMyPalette(); | 191 | void setMyPalette(); |
191 | QPalette getPalette (); | 192 | QPalette getPalette (); |
192 | void keyPressEvent ( QKeyEvent * ) ; | 193 | void keyPressEvent ( QKeyEvent * ) ; |
193 | 194 | ||
194 | }; | 195 | }; |
195 | 196 | ||
196 | 197 | ||
197 | class KOMonthView: public KOEventView | 198 | class KOMonthView: public KOEventView |
198 | { | 199 | { |
199 | Q_OBJECT | 200 | Q_OBJECT |
200 | public: | 201 | public: |
201 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 202 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
202 | ~KOMonthView(); | 203 | ~KOMonthView(); |
203 | 204 | ||
204 | /** Returns maximum number of days supported by the komonthview */ | 205 | /** Returns maximum number of days supported by the komonthview */ |
205 | virtual int maxDatesHint(); | 206 | virtual int maxDatesHint(); |
206 | 207 | ||
207 | /** Returns number of currently shown dates. */ | 208 | /** Returns number of currently shown dates. */ |
208 | virtual int currentDateCount(); | 209 | virtual int currentDateCount(); |
209 | 210 | ||
210 | /** returns the currently selected events */ | 211 | /** returns the currently selected events */ |
211 | virtual QPtrList<Incidence> selectedIncidences(); | 212 | virtual QPtrList<Incidence> selectedIncidences(); |
212 | 213 | ||
213 | /** returns dates of the currently selected events */ | 214 | /** returns dates of the currently selected events */ |
214 | virtual DateList selectedDates(); | 215 | virtual DateList selectedDates(); |
215 | 216 | ||
216 | virtual void printPreview(CalPrinter *calPrinter, | 217 | virtual void printPreview(CalPrinter *calPrinter, |
217 | const QDate &, const QDate &); | 218 | const QDate &, const QDate &); |
218 | bool isMonthView() { return true; } | 219 | bool isMonthView() { return true; } |
219 | bool isUpdatePossible() { return updatePossible; } | 220 | bool isUpdatePossible() { return updatePossible; } |
220 | 221 | ||
221 | MonthViewCell * selectedCell(); | 222 | MonthViewCell * selectedCell(); |
222 | public slots: | 223 | public slots: |
223 | virtual void updateView(); | 224 | virtual void updateView(); |
224 | virtual void updateConfig(); | 225 | virtual void updateConfig(); |
225 | virtual void showDates(const QDate &start, const QDate &end); | 226 | virtual void showDates(const QDate &start, const QDate &end); |
226 | virtual void showEvents(QPtrList<Event> eventList); | 227 | virtual void showEvents(QPtrList<Event> eventList); |
227 | 228 | ||
228 | void changeEventDisplay(Event *, int); | 229 | void changeEventDisplay(Event *, int); |
229 | 230 | ||
230 | void clearSelection(); | 231 | void clearSelection(); |
231 | 232 | ||
232 | void showContextMenu( Incidence * ); | 233 | void showContextMenu( Incidence * ); |
233 | 234 | ||
234 | void setSelectedCell( MonthViewCell * ); | 235 | void setSelectedCell( MonthViewCell * ); |
235 | 236 | ||
236 | protected slots: | 237 | protected slots: |
237 | void processSelectionChange(); | 238 | void processSelectionChange(); |
238 | signals: | 239 | signals: |
239 | void selectWeekNum ( int ); | 240 | void selectWeekNum ( int ); |
240 | void showDaySignal( QDate ); | 241 | void showDaySignal( QDate ); |
241 | protected: | 242 | protected: |
242 | void resizeEvent(QResizeEvent *); | 243 | void resizeEvent(QResizeEvent *); |
243 | void viewChanged(); | 244 | void viewChanged(); |
244 | void updateDayLabels(); | 245 | void updateDayLabels(); |
245 | 246 | ||
246 | private: | 247 | private: |
247 | bool updatePossible; | 248 | bool updatePossible; |
248 | int mDaysPerWeek; | 249 | int mDaysPerWeek; |
249 | int mNumWeeks; | 250 | int mNumWeeks; |
250 | int mNumCells; | 251 | int mNumCells; |
251 | bool mWeekStartsMonday; | 252 | bool mWeekStartsMonday; |
252 | bool mShowSatSunComp; | 253 | bool mShowSatSunComp; |
253 | void computeLayout(); | 254 | void computeLayout(); |
254 | 255 | ||
255 | QPtrVector<MonthViewCell> mCells; | 256 | QPtrVector<MonthViewCell> mCells; |
256 | QPtrVector<QLabel> mDayLabels; | 257 | QPtrVector<QLabel> mDayLabels; |
257 | QPtrVector<KOWeekButton> mWeekLabels; | 258 | QPtrVector<KOWeekButton> mWeekLabels; |
258 | 259 | ||
259 | bool mShortDayLabels; | 260 | bool mShortDayLabels; |
260 | int mWidthLongDayLabel; | 261 | int mWidthLongDayLabel; |
261 | 262 | ||
262 | QDate mStartDate; | 263 | QDate mStartDate; |
263 | 264 | ||
264 | MonthViewCell *mSelectedCell; | 265 | MonthViewCell *mSelectedCell; |
265 | 266 | ||
266 | KOEventPopupMenu *mContextMenu; | 267 | KOEventPopupMenu *mContextMenu; |
267 | void keyPressEvent ( QKeyEvent * ) ; | 268 | void keyPressEvent ( QKeyEvent * ) ; |
268 | 269 | ||
269 | }; | 270 | }; |
270 | 271 | ||
271 | #endif | 272 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 00a5842..f6b7718 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,350 +1,351 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOViewManager::writeSettings(KConfig *config) | 101 | void KOViewManager::writeSettings(KConfig *config) |
102 | { | 102 | { |
103 | config->setGroup("General"); | 103 | config->setGroup("General"); |
104 | 104 | ||
105 | QString view; | 105 | QString view; |
106 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 106 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
107 | else if (mCurrentView == mMonthView) view = "Month"; | 107 | else if (mCurrentView == mMonthView) view = "Month"; |
108 | else if (mCurrentView == mListView) view = "List"; | 108 | else if (mCurrentView == mListView) view = "List"; |
109 | else if (mCurrentView == mJournalView) view = "Journal"; | 109 | else if (mCurrentView == mJournalView) view = "Journal"; |
110 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 110 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
111 | else if (mCurrentView == mTodoView) view = "Todo"; | 111 | else if (mCurrentView == mTodoView) view = "Todo"; |
112 | else view = "Agenda"; | 112 | else view = "Agenda"; |
113 | 113 | ||
114 | config->writeEntry("Current View",view); | 114 | config->writeEntry("Current View",view); |
115 | 115 | ||
116 | if (mAgendaView) { | 116 | if (mAgendaView) { |
117 | mAgendaView->writeSettings(config); | 117 | mAgendaView->writeSettings(config); |
118 | } | 118 | } |
119 | if (mTimeSpanView) { | 119 | if (mTimeSpanView) { |
120 | mTimeSpanView->writeSettings(config); | 120 | mTimeSpanView->writeSettings(config); |
121 | } | 121 | } |
122 | if (mListView) { | 122 | if (mListView) { |
123 | mListView->writeSettings(config); | 123 | mListView->writeSettings(config); |
124 | } | 124 | } |
125 | if (mTodoView) { | 125 | if (mTodoView) { |
126 | mTodoView->saveLayout(config,"Todo View"); | 126 | mTodoView->saveLayout(config,"Todo View"); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 130 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
131 | { | 131 | { |
132 | 132 | ||
133 | //mFlagShowNextxDays = false; | 133 | //mFlagShowNextxDays = false; |
134 | //if(view == mCurrentView) return; | 134 | //if(view == mCurrentView) return; |
135 | if ( view == 0 ) { | 135 | if ( view == 0 ) { |
136 | view = mCurrentView; | 136 | view = mCurrentView; |
137 | if ( view == 0 ) | 137 | if ( view == 0 ) |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | bool full = fullScreen; | 140 | bool full = fullScreen; |
141 | if(view == mCurrentView && view != mWhatsNextView ) { | 141 | if(view == mCurrentView && view != mWhatsNextView ) { |
142 | if ( mCurrentAgendaView < 0 ) | 142 | if ( mCurrentAgendaView < 0 ) |
143 | return; | 143 | return; |
144 | full = mMainView->leftFrame()->isVisible(); | 144 | full = mMainView->leftFrame()->isVisible(); |
145 | } else { | 145 | } else { |
146 | mCurrentView = view; | 146 | mCurrentView = view; |
147 | 147 | ||
148 | // bool full = fullScreen; | 148 | // bool full = fullScreen; |
149 | bool isFull = !mMainView->leftFrame()->isVisible(); | 149 | bool isFull = !mMainView->leftFrame()->isVisible(); |
150 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 150 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
151 | full = true; | 151 | full = true; |
152 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 152 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
153 | full = false; | 153 | full = false; |
154 | } | 154 | } |
155 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 155 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
156 | raiseCurrentView( full ); | 156 | //raiseCurrentView( full ); |
157 | mMainView->processIncidenceSelection( 0 ); | 157 | mMainView->processIncidenceSelection( 0 ); |
158 | mMainView->updateView(); | 158 | mMainView->updateView(); |
159 | raiseCurrentView( full ); | ||
159 | mMainView->adaptNavigationUnits(); | 160 | mMainView->adaptNavigationUnits(); |
160 | } | 161 | } |
161 | 162 | ||
162 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 163 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
163 | { | 164 | { |
164 | //qDebug("raiseCurrentView "); | 165 | //qDebug("raiseCurrentView "); |
165 | mCurrentAgendaView = 0; | 166 | mCurrentAgendaView = 0; |
166 | int wid = mMainView->width() ; | 167 | int wid = mMainView->width() ; |
167 | int hei = mMainView->height(); | 168 | int hei = mMainView->height(); |
168 | if ( mCurrentView == mMonthView ) { | 169 | if ( mCurrentView == mMonthView ) { |
169 | mMainView->navigatorBar()->show(); | 170 | mMainView->navigatorBar()->show(); |
170 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 171 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
171 | //mMainView->navigatorBar()->hide(); | 172 | //mMainView->navigatorBar()->hide(); |
172 | } else { | 173 | } else { |
173 | mMainView->navigatorBar()->hide(); | 174 | mMainView->navigatorBar()->hide(); |
174 | } | 175 | } |
175 | if ( fullScreen ) { | 176 | if ( fullScreen ) { |
176 | mMainView->leftFrame()->hide(); | 177 | mMainView->leftFrame()->hide(); |
177 | } else { | 178 | } else { |
178 | mMainView->leftFrame()->show(); | 179 | mMainView->leftFrame()->show(); |
179 | if ( KOPrefs::instance()->mVerticalScreen ) | 180 | if ( KOPrefs::instance()->mVerticalScreen ) |
180 | hei -= mMainView->leftFrame()->height(); | 181 | hei -= mMainView->leftFrame()->height(); |
181 | else | 182 | else |
182 | wid -= mMainView->leftFrame()->width(); | 183 | wid -= mMainView->leftFrame()->width(); |
183 | } | 184 | } |
184 | 185 | ||
185 | if ( globalFlagBlockAgenda == 5 ) { | 186 | if ( globalFlagBlockAgenda == 5 ) { |
186 | globalFlagBlockAgenda = 4; | 187 | globalFlagBlockAgenda = 4; |
187 | globalFlagBlockAgendaItemPaint = 1; | 188 | globalFlagBlockAgendaItemPaint = 1; |
188 | } | 189 | } |
189 | mMainView->viewStack()->raiseWidget(mCurrentView); | 190 | mMainView->viewStack()->raiseWidget(mCurrentView); |
190 | if ( globalFlagBlockAgenda == 4 ) { | 191 | if ( globalFlagBlockAgenda == 4 ) { |
191 | if ( mCurrentView == mAgendaView ) { | 192 | if ( mCurrentView == mAgendaView ) { |
192 | //globalFlagBlockAgenda =1 ; | 193 | //globalFlagBlockAgenda =1 ; |
193 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 194 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
194 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 195 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
195 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 196 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
196 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 197 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
197 | qApp->processEvents(); | 198 | qApp->processEvents(); |
198 | //qDebug("qApp->processEvents() "); | 199 | //qDebug("qApp->processEvents() "); |
199 | globalFlagBlockAgenda = 0; | 200 | globalFlagBlockAgenda = 0; |
200 | mAgendaView->repaintAgenda(); | 201 | mAgendaView->repaintAgenda(); |
201 | 202 | ||
202 | } | 203 | } |
203 | globalFlagBlockAgenda = 0; | 204 | globalFlagBlockAgenda = 0; |
204 | } | 205 | } |
205 | //qDebug("raiseCurrentView ende "); | 206 | //qDebug("raiseCurrentView ende "); |
206 | } | 207 | } |
207 | 208 | ||
208 | void KOViewManager::updateView() | 209 | void KOViewManager::updateView() |
209 | { | 210 | { |
210 | // qDebug("KOViewManager::updateView() "); | 211 | // qDebug("KOViewManager::updateView() "); |
211 | // if we are updating mTodoView, we get endless recursion | 212 | // if we are updating mTodoView, we get endless recursion |
212 | if ( mTodoView == mCurrentView ) | 213 | if ( mTodoView == mCurrentView ) |
213 | return; | 214 | return; |
214 | if ( mCurrentView ) mCurrentView->updateView(); | 215 | if ( mCurrentView ) mCurrentView->updateView(); |
215 | 216 | ||
216 | } | 217 | } |
217 | 218 | ||
218 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 219 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
219 | { | 220 | { |
220 | // kdDebug() << "KOViewManager::updateView()" << endl; | 221 | // kdDebug() << "KOViewManager::updateView()" << endl; |
221 | 222 | ||
222 | if (mCurrentView) mCurrentView->showDates(start, end); | 223 | if (mCurrentView) mCurrentView->showDates(start, end); |
223 | 224 | ||
224 | if (mTodoView) mTodoView->updateView(); | 225 | if (mTodoView) mTodoView->updateView(); |
225 | } | 226 | } |
226 | 227 | ||
227 | 228 | ||
228 | void KOViewManager::updateWNview() | 229 | void KOViewManager::updateWNview() |
229 | { | 230 | { |
230 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 231 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
231 | mWhatsNextView->updateView(); | 232 | mWhatsNextView->updateView(); |
232 | 233 | ||
233 | } | 234 | } |
234 | void KOViewManager::showWhatsNextView() | 235 | void KOViewManager::showWhatsNextView() |
235 | { | 236 | { |
236 | if (!mWhatsNextView) { | 237 | if (!mWhatsNextView) { |
237 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 238 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
238 | "KOViewManager::WhatsNextView"); | 239 | "KOViewManager::WhatsNextView"); |
239 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 240 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
240 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 241 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
241 | addView(mWhatsNextView); | 242 | addView(mWhatsNextView); |
242 | connect(this, SIGNAL( printWNV() ), | 243 | connect(this, SIGNAL( printWNV() ), |
243 | mWhatsNextView, SLOT( printMe() ) ); | 244 | mWhatsNextView, SLOT( printMe() ) ); |
244 | } | 245 | } |
245 | globalFlagBlockAgenda = 1; | 246 | globalFlagBlockAgenda = 1; |
246 | showView(mWhatsNextView, true ); | 247 | showView(mWhatsNextView, true ); |
247 | //mWhatsNextView->updateView(); | 248 | //mWhatsNextView->updateView(); |
248 | 249 | ||
249 | } | 250 | } |
250 | 251 | ||
251 | void KOViewManager::showListView() | 252 | void KOViewManager::showListView() |
252 | { | 253 | { |
253 | if (!mListView) { | 254 | if (!mListView) { |
254 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 255 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
255 | addView(mListView); | 256 | addView(mListView); |
256 | 257 | ||
257 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 258 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
258 | mMainView, SLOT(showIncidence(Incidence *))); | 259 | mMainView, SLOT(showIncidence(Incidence *))); |
259 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 260 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
260 | mMainView, SLOT(editIncidence(Incidence *))); | 261 | mMainView, SLOT(editIncidence(Incidence *))); |
261 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 262 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
262 | mMainView, SLOT(deleteIncidence(Incidence *))); | 263 | mMainView, SLOT(deleteIncidence(Incidence *))); |
263 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 264 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
264 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 265 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
265 | connect( mListView, SIGNAL( signalNewEvent() ), | 266 | connect( mListView, SIGNAL( signalNewEvent() ), |
266 | mMainView, SLOT( newEvent() ) ); | 267 | mMainView, SLOT( newEvent() ) ); |
267 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 268 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
268 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 269 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
269 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 270 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
270 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 271 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
271 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 272 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
272 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 273 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
273 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 274 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
274 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 275 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
275 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 276 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
276 | } | 277 | } |
277 | // bool temp = mFlagShowNextxDays; | 278 | // bool temp = mFlagShowNextxDays; |
278 | //globalFlagBlockPainting = true; | 279 | //globalFlagBlockPainting = true; |
279 | globalFlagBlockAgenda = 1; | 280 | globalFlagBlockAgenda = 1; |
280 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 281 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
281 | mMainView->setBlockShowDates( true ); | 282 | mMainView->setBlockShowDates( true ); |
282 | mMainView->dateNavigator()->selectMonth(); | 283 | mMainView->dateNavigator()->selectMonth(); |
283 | mMainView->setBlockShowDates( false ); | 284 | mMainView->setBlockShowDates( false ); |
284 | } | 285 | } |
285 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 286 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
286 | //mFlagShowNextxDays = temp; | 287 | //mFlagShowNextxDays = temp; |
287 | } | 288 | } |
288 | 289 | ||
289 | void KOViewManager::showAgendaView( bool fullScreen ) | 290 | void KOViewManager::showAgendaView( bool fullScreen ) |
290 | { | 291 | { |
291 | 292 | ||
292 | mMainView->dialogManager()->hideSearchDialog(); | 293 | mMainView->dialogManager()->hideSearchDialog(); |
293 | // qDebug("KOViewManager::showAgendaView "); | 294 | // qDebug("KOViewManager::showAgendaView "); |
294 | bool full; | 295 | bool full; |
295 | full = fullScreen; | 296 | full = fullScreen; |
296 | if (!mAgendaView) { | 297 | if (!mAgendaView) { |
297 | full = false; | 298 | full = false; |
298 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 299 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
299 | addView(mAgendaView); | 300 | addView(mAgendaView); |
300 | #ifndef DESKTOP_VERSION | 301 | #ifndef DESKTOP_VERSION |
301 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 302 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
302 | #endif | 303 | #endif |
303 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 304 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
304 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 305 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
305 | 306 | ||
306 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 307 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
307 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 308 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
308 | mMainView, SLOT(newEvent(QDateTime))); | 309 | mMainView, SLOT(newEvent(QDateTime))); |
309 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 310 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
310 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 311 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
311 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 312 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
312 | mMainView, SLOT(newEvent(QDate))); | 313 | mMainView, SLOT(newEvent(QDate))); |
313 | 314 | ||
314 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 315 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
315 | mMainView, SLOT(editIncidence(Incidence *))); | 316 | mMainView, SLOT(editIncidence(Incidence *))); |
316 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 317 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
317 | mMainView, SLOT(showIncidence(Incidence *))); | 318 | mMainView, SLOT(showIncidence(Incidence *))); |
318 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 319 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
319 | mMainView, SLOT(deleteIncidence(Incidence *))); | 320 | mMainView, SLOT(deleteIncidence(Incidence *))); |
320 | 321 | ||
321 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 322 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
322 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 323 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
323 | 324 | ||
324 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 325 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
325 | mMainView, SLOT( toggleExpand() ) ); | 326 | mMainView, SLOT( toggleExpand() ) ); |
326 | 327 | ||
327 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 328 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
328 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 329 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
329 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 330 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
330 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 331 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
331 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 332 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
332 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 333 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
333 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 334 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
334 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 335 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
335 | SLOT( updateTodo( Todo *, int ) ) ); | 336 | SLOT( updateTodo( Todo *, int ) ) ); |
336 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 337 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
337 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 338 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
338 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 339 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
339 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 340 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
340 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 341 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
341 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 342 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
342 | mAgendaView->readSettings(); | 343 | mAgendaView->readSettings(); |
343 | mAgendaView->updateConfig(); | 344 | mAgendaView->updateConfig(); |
344 | } | 345 | } |
345 | 346 | ||
346 | showView( mAgendaView, full); | 347 | showView( mAgendaView, full); |
347 | 348 | ||
348 | } | 349 | } |
349 | 350 | ||
350 | void KOViewManager::showDayView() | 351 | void KOViewManager::showDayView() |