-rw-r--r-- | korganizer/calendarview.cpp | 46 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 10 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 7 |
7 files changed, 70 insertions, 6 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 543897a..15c5dd9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -302,384 +302,391 @@ void CalendarView::init() | |||
302 | } else { | 302 | } else { |
303 | mainBoxLayout = new QHBoxLayout(mainBox); | 303 | mainBoxLayout = new QHBoxLayout(mainBox); |
304 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 304 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
305 | } | 305 | } |
306 | topLayout->addWidget( mainBox ); | 306 | topLayout->addWidget( mainBox ); |
307 | mainBoxLayout->addWidget (leftFrame); | 307 | mainBoxLayout->addWidget (leftFrame); |
308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
309 | "CalendarView::DateNavigator", QDate::currentDate()); | 309 | "CalendarView::DateNavigator", QDate::currentDate()); |
310 | // mDateNavigator->blockSignals( true ); | 310 | // mDateNavigator->blockSignals( true ); |
311 | leftFrameLayout->addWidget( mDateNavigator ); | 311 | leftFrameLayout->addWidget( mDateNavigator ); |
312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
314 | 314 | ||
315 | if ( QApplication::desktop()->width() < 480 ) { | 315 | if ( QApplication::desktop()->width() < 480 ) { |
316 | leftFrameLayout->addWidget(mFilterView); | 316 | leftFrameLayout->addWidget(mFilterView); |
317 | leftFrameLayout->addWidget(mTodoList, 2 ); | 317 | leftFrameLayout->addWidget(mTodoList, 2 ); |
318 | 318 | ||
319 | } else { | 319 | } else { |
320 | leftFrameLayout->addWidget(mTodoList,2 ); | 320 | leftFrameLayout->addWidget(mTodoList,2 ); |
321 | leftFrameLayout->addWidget(mFilterView ); | 321 | leftFrameLayout->addWidget(mFilterView ); |
322 | } | 322 | } |
323 | mFilterView->hide(); | 323 | mFilterView->hide(); |
324 | QWidget *rightBox = new QWidget( mainBox ); | 324 | QWidget *rightBox = new QWidget( mainBox ); |
325 | mainBoxLayout->addWidget ( rightBox, 10 ); | 325 | mainBoxLayout->addWidget ( rightBox, 10 ); |
326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
328 | mRightFrame = new QWidgetStack( rightBox ); | 328 | mRightFrame = new QWidgetStack( rightBox ); |
329 | rightLayout->addWidget( mNavigatorBar ); | 329 | rightLayout->addWidget( mNavigatorBar ); |
330 | rightLayout->addWidget( mRightFrame, 10 ); | 330 | rightLayout->addWidget( mRightFrame, 10 ); |
331 | 331 | ||
332 | mLeftFrame = leftFrame; | 332 | mLeftFrame = leftFrame; |
333 | if ( KOPrefs::instance()->mVerticalScreen ) { | 333 | if ( KOPrefs::instance()->mVerticalScreen ) { |
334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
336 | } else { | 336 | } else { |
337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
339 | } | 339 | } |
340 | 340 | ||
341 | //qDebug("Calendarview Size %d %d ", width(), height()); | 341 | //qDebug("Calendarview Size %d %d ", width(), height()); |
342 | #endif | 342 | #endif |
343 | 343 | ||
344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
345 | SLOT( showDates( const KCal::DateList & ) ) ); | 345 | SLOT( showDates( const KCal::DateList & ) ) ); |
346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
348 | 348 | ||
349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
350 | mNavigator, SLOT( selectPreviousYear() ) ); | 350 | mNavigator, SLOT( selectPreviousYear() ) ); |
351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
352 | mNavigator, SLOT( selectNextYear() ) ); | 352 | mNavigator, SLOT( selectNextYear() ) ); |
353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
354 | mNavigator, SLOT( selectPreviousMonth() ) ); | 354 | mNavigator, SLOT( selectPreviousMonth() ) ); |
355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
356 | mNavigator, SLOT( selectNextMonth() ) ); | 356 | mNavigator, SLOT( selectNextMonth() ) ); |
357 | 357 | ||
358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
360 | 360 | ||
361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
363 | 363 | ||
364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
365 | mNavigator, SLOT( selectPreviousYear() ) ); | 365 | mNavigator, SLOT( selectPreviousYear() ) ); |
366 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 366 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
367 | mNavigator, SLOT( selectNextYear() ) ); | 367 | mNavigator, SLOT( selectNextYear() ) ); |
368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
369 | mNavigator, SLOT( selectPreviousMonth() ) ); | 369 | mNavigator, SLOT( selectPreviousMonth() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
371 | mNavigator, SLOT( selectNextMonth() ) ); | 371 | mNavigator, SLOT( selectNextMonth() ) ); |
372 | 372 | ||
373 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 373 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
374 | mNavigator, SLOT( selectPrevious() ) ); | 374 | mNavigator, SLOT( selectPrevious() ) ); |
375 | connect( mDateNavigator, SIGNAL( goNext() ), | 375 | connect( mDateNavigator, SIGNAL( goNext() ), |
376 | mNavigator, SLOT( selectNext() ) ); | 376 | mNavigator, SLOT( selectNext() ) ); |
377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
381 | 381 | ||
382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
384 | 384 | ||
385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
386 | SLOT( eventAdded( Event *) ) ); | 386 | SLOT( eventAdded( Event *) ) ); |
387 | 387 | ||
388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
389 | 389 | ||
390 | connect( this, SIGNAL( configChanged() ), | 390 | connect( this, SIGNAL( configChanged() ), |
391 | mDateNavigator, SLOT( updateConfig() ) ); | 391 | mDateNavigator, SLOT( updateConfig() ) ); |
392 | 392 | ||
393 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 393 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
394 | SLOT( newTodo() ) ); | 394 | SLOT( newTodo() ) ); |
395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
396 | SLOT( newSubTodo( Todo * ) ) ); | 396 | SLOT( newSubTodo( Todo * ) ) ); |
397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
398 | SLOT( editTodo( Todo * ) ) ); | 398 | SLOT( editTodo( Todo * ) ) ); |
399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
400 | SLOT( showTodo( Todo *) ) ); | 400 | SLOT( showTodo( Todo *) ) ); |
401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
402 | SLOT( deleteTodo( Todo *) ) ); | 402 | SLOT( deleteTodo( Todo *) ) ); |
403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
405 | SLOT( purgeCompleted() ) ); | 405 | SLOT( purgeCompleted() ) ); |
406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
407 | SIGNAL( todoModified( Todo *, int ) ) ); | 407 | SIGNAL( todoModified( Todo *, int ) ) ); |
408 | 408 | ||
409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
412 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 412 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
413 | 413 | ||
414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
415 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 415 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
417 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 417 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
418 | 418 | ||
419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
420 | this, SLOT ( todo_unsub( Todo * ) ) ); | 420 | this, SLOT ( todo_unsub( Todo * ) ) ); |
421 | 421 | ||
422 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 422 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
423 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 423 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
424 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 424 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
425 | SLOT( updateTodo( Todo *, int ) ) ); | 425 | SLOT( updateTodo( Todo *, int ) ) ); |
426 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 426 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
427 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 427 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
428 | 428 | ||
429 | 429 | ||
430 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 430 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
431 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 431 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
432 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 432 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
433 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 433 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
434 | 434 | ||
435 | 435 | ||
436 | 436 | ||
437 | 437 | ||
438 | 438 | ||
439 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 439 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
440 | SLOT(checkClipboard())); | 440 | SLOT(checkClipboard())); |
441 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 441 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
442 | SLOT( processTodoListSelection( Incidence * ) ) ); | 442 | SLOT( processTodoListSelection( Incidence * ) ) ); |
443 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 443 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
444 | 444 | ||
445 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 445 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
446 | 446 | ||
447 | mDateFrame = new QVBox(0,0,WType_Popup); | 447 | mDateFrame = new QVBox(0,0,WType_Popup); |
448 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 448 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
449 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 449 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
450 | mDateFrame->setLineWidth(3); | 450 | mDateFrame->setLineWidth(3); |
451 | mDateFrame->hide(); | 451 | mDateFrame->hide(); |
452 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 452 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
453 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 453 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
454 | 454 | ||
455 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 455 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
456 | 456 | ||
457 | mEventEditor = mDialogManager->getEventEditor(); | 457 | mEventEditor = mDialogManager->getEventEditor(); |
458 | mTodoEditor = mDialogManager->getTodoEditor(); | 458 | mTodoEditor = mDialogManager->getTodoEditor(); |
459 | 459 | ||
460 | mFlagEditDescription = false; | 460 | mFlagEditDescription = false; |
461 | 461 | ||
462 | mSuspendTimer = new QTimer( this ); | 462 | mSuspendTimer = new QTimer( this ); |
463 | mAlarmTimer = new QTimer( this ); | 463 | mAlarmTimer = new QTimer( this ); |
464 | mRecheckAlarmTimer = new QTimer( this ); | 464 | mRecheckAlarmTimer = new QTimer( this ); |
465 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 465 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
466 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 466 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
467 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 467 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
468 | mAlarmDialog = new AlarmDialog( this ); | 468 | mAlarmDialog = new AlarmDialog( this ); |
469 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 469 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
470 | mAlarmDialog->setServerNotification( false ); | 470 | mAlarmDialog->setServerNotification( false ); |
471 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 471 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
472 | 472 | ||
473 | 473 | ||
474 | #ifndef DESKTOP_VERSION | 474 | #ifndef DESKTOP_VERSION |
475 | //US listen for arriving address resultsets | 475 | //US listen for arriving address resultsets |
476 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 476 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
477 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 477 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
478 | #endif | 478 | #endif |
479 | 479 | ||
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | CalendarView::~CalendarView() | 483 | CalendarView::~CalendarView() |
484 | { | 484 | { |
485 | // kdDebug() << "~CalendarView()" << endl; | 485 | // kdDebug() << "~CalendarView()" << endl; |
486 | //qDebug("CalendarView::~CalendarView() "); | 486 | //qDebug("CalendarView::~CalendarView() "); |
487 | delete mDialogManager; | 487 | delete mDialogManager; |
488 | delete mViewManager; | 488 | delete mViewManager; |
489 | delete mStorage; | 489 | delete mStorage; |
490 | delete mDateFrame ; | 490 | delete mDateFrame ; |
491 | delete beamDialog; | 491 | delete beamDialog; |
492 | //kdDebug() << "~CalendarView() done" << endl; | 492 | //kdDebug() << "~CalendarView() done" << endl; |
493 | } | 493 | } |
494 | |||
495 | void CalendarView::showDay( QDate d ) | ||
496 | { | ||
497 | dateNavigator()->selectDate( d ); | ||
498 | mViewManager->showWeekView(); | ||
499 | dateNavigator()->selectDate( d ); | ||
500 | } | ||
494 | void CalendarView::timerAlarm() | 501 | void CalendarView::timerAlarm() |
495 | { | 502 | { |
496 | //qDebug("CalendarView::timerAlarm() "); | 503 | //qDebug("CalendarView::timerAlarm() "); |
497 | computeAlarm(mAlarmNotification ); | 504 | computeAlarm(mAlarmNotification ); |
498 | } | 505 | } |
499 | 506 | ||
500 | void CalendarView::suspendAlarm() | 507 | void CalendarView::suspendAlarm() |
501 | { | 508 | { |
502 | //qDebug(" CalendarView::suspendAlarm() "); | 509 | //qDebug(" CalendarView::suspendAlarm() "); |
503 | computeAlarm(mSuspendAlarmNotification ); | 510 | computeAlarm(mSuspendAlarmNotification ); |
504 | 511 | ||
505 | } | 512 | } |
506 | 513 | ||
507 | void CalendarView::startAlarm( QString mess , QString filename) | 514 | void CalendarView::startAlarm( QString mess , QString filename) |
508 | { | 515 | { |
509 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 516 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
510 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 517 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
511 | 518 | ||
512 | } | 519 | } |
513 | 520 | ||
514 | void CalendarView::checkNextTimerAlarm() | 521 | void CalendarView::checkNextTimerAlarm() |
515 | { | 522 | { |
516 | mCalendar->checkAlarmForIncidence( 0, true ); | 523 | mCalendar->checkAlarmForIncidence( 0, true ); |
517 | } | 524 | } |
518 | 525 | ||
519 | void CalendarView::computeAlarm( QString msg ) | 526 | void CalendarView::computeAlarm( QString msg ) |
520 | { | 527 | { |
521 | 528 | ||
522 | QString mess = msg; | 529 | QString mess = msg; |
523 | QString mAlarmMessage = mess.mid( 9 ); | 530 | QString mAlarmMessage = mess.mid( 9 ); |
524 | QString filename = MainWindow::resourcePath(); | 531 | QString filename = MainWindow::resourcePath(); |
525 | filename += "koalarm.wav"; | 532 | filename += "koalarm.wav"; |
526 | QString tempfilename; | 533 | QString tempfilename; |
527 | if ( mess.left( 13 ) == "suspend_alarm") { | 534 | if ( mess.left( 13 ) == "suspend_alarm") { |
528 | bool error = false; | 535 | bool error = false; |
529 | int len = mess.mid( 13 ).find("+++"); | 536 | int len = mess.mid( 13 ).find("+++"); |
530 | if ( len < 2 ) | 537 | if ( len < 2 ) |
531 | error = true; | 538 | error = true; |
532 | else { | 539 | else { |
533 | tempfilename = mess.mid( 13, len ); | 540 | tempfilename = mess.mid( 13, len ); |
534 | if ( !QFile::exists( tempfilename ) ) | 541 | if ( !QFile::exists( tempfilename ) ) |
535 | error = true; | 542 | error = true; |
536 | } | 543 | } |
537 | if ( ! error ) { | 544 | if ( ! error ) { |
538 | filename = tempfilename; | 545 | filename = tempfilename; |
539 | } | 546 | } |
540 | mAlarmMessage = mess.mid( 13+len+3 ); | 547 | mAlarmMessage = mess.mid( 13+len+3 ); |
541 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 548 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
542 | startAlarm( mAlarmMessage, filename); | 549 | startAlarm( mAlarmMessage, filename); |
543 | return; | 550 | return; |
544 | } | 551 | } |
545 | if ( mess.left( 11 ) == "timer_alarm") { | 552 | if ( mess.left( 11 ) == "timer_alarm") { |
546 | //mTimerTime = 0; | 553 | //mTimerTime = 0; |
547 | startAlarm( mess.mid( 11 ), filename ); | 554 | startAlarm( mess.mid( 11 ), filename ); |
548 | return; | 555 | return; |
549 | } | 556 | } |
550 | if ( mess.left( 10 ) == "proc_alarm") { | 557 | if ( mess.left( 10 ) == "proc_alarm") { |
551 | bool error = false; | 558 | bool error = false; |
552 | int len = mess.mid( 10 ).find("+++"); | 559 | int len = mess.mid( 10 ).find("+++"); |
553 | if ( len < 2 ) | 560 | if ( len < 2 ) |
554 | error = true; | 561 | error = true; |
555 | else { | 562 | else { |
556 | tempfilename = mess.mid( 10, len ); | 563 | tempfilename = mess.mid( 10, len ); |
557 | if ( !QFile::exists( tempfilename ) ) | 564 | if ( !QFile::exists( tempfilename ) ) |
558 | error = true; | 565 | error = true; |
559 | } | 566 | } |
560 | if ( error ) { | 567 | if ( error ) { |
561 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 568 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
562 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 569 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
563 | } else { | 570 | } else { |
564 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 571 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
565 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 572 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
566 | #ifndef _WIN32_ | 573 | #ifndef _WIN32_ |
567 | if ( vfork () == 0 ) { | 574 | if ( vfork () == 0 ) { |
568 | execl ( tempfilename.latin1(), 0 ); | 575 | execl ( tempfilename.latin1(), 0 ); |
569 | return; | 576 | return; |
570 | } | 577 | } |
571 | #else | 578 | #else |
572 | QProcess* p = new QProcess(); | 579 | QProcess* p = new QProcess(); |
573 | p->addArgument( tempfilename.latin1() ); | 580 | p->addArgument( tempfilename.latin1() ); |
574 | p->start(); | 581 | p->start(); |
575 | return; | 582 | return; |
576 | #endif | 583 | #endif |
577 | 584 | ||
578 | return; | 585 | return; |
579 | } | 586 | } |
580 | 587 | ||
581 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 588 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
582 | } | 589 | } |
583 | if ( mess.left( 11 ) == "audio_alarm") { | 590 | if ( mess.left( 11 ) == "audio_alarm") { |
584 | bool error = false; | 591 | bool error = false; |
585 | int len = mess.mid( 11 ).find("+++"); | 592 | int len = mess.mid( 11 ).find("+++"); |
586 | if ( len < 2 ) | 593 | if ( len < 2 ) |
587 | error = true; | 594 | error = true; |
588 | else { | 595 | else { |
589 | tempfilename = mess.mid( 11, len ); | 596 | tempfilename = mess.mid( 11, len ); |
590 | if ( !QFile::exists( tempfilename ) ) | 597 | if ( !QFile::exists( tempfilename ) ) |
591 | error = true; | 598 | error = true; |
592 | } | 599 | } |
593 | if ( ! error ) { | 600 | if ( ! error ) { |
594 | filename = tempfilename; | 601 | filename = tempfilename; |
595 | } | 602 | } |
596 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 603 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
597 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 604 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
598 | } | 605 | } |
599 | if ( mess.left( 9 ) == "cal_alarm") { | 606 | if ( mess.left( 9 ) == "cal_alarm") { |
600 | mAlarmMessage = mess.mid( 9 ) ; | 607 | mAlarmMessage = mess.mid( 9 ) ; |
601 | } | 608 | } |
602 | 609 | ||
603 | startAlarm( mAlarmMessage, filename ); | 610 | startAlarm( mAlarmMessage, filename ); |
604 | 611 | ||
605 | 612 | ||
606 | } | 613 | } |
607 | 614 | ||
608 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 615 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
609 | { | 616 | { |
610 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 617 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
611 | 618 | ||
612 | mSuspendAlarmNotification = noti; | 619 | mSuspendAlarmNotification = noti; |
613 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 620 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
614 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 621 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
615 | mSuspendTimer->start( ms , true ); | 622 | mSuspendTimer->start( ms , true ); |
616 | 623 | ||
617 | } | 624 | } |
618 | 625 | ||
619 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 626 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
620 | { | 627 | { |
621 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 628 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
622 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 629 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
623 | #ifndef DESKTOP_VERSION | 630 | #ifndef DESKTOP_VERSION |
624 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 631 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
625 | #endif | 632 | #endif |
626 | return; | 633 | return; |
627 | } | 634 | } |
628 | int maxSec; | 635 | int maxSec; |
629 | //maxSec = 5; //testing only | 636 | //maxSec = 5; //testing only |
630 | maxSec = 86400+3600; // one day+1hour | 637 | maxSec = 86400+3600; // one day+1hour |
631 | mAlarmNotification = noti; | 638 | mAlarmNotification = noti; |
632 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 639 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
633 | if ( sec > maxSec ) { | 640 | if ( sec > maxSec ) { |
634 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 641 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
635 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 642 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
636 | return; | 643 | return; |
637 | } else { | 644 | } else { |
638 | mRecheckAlarmTimer->stop(); | 645 | mRecheckAlarmTimer->stop(); |
639 | } | 646 | } |
640 | //qDebug("Alarm timer started with secs: %d ", sec); | 647 | //qDebug("Alarm timer started with secs: %d ", sec); |
641 | mAlarmTimer->start( sec *1000 , true ); | 648 | mAlarmTimer->start( sec *1000 , true ); |
642 | 649 | ||
643 | } | 650 | } |
644 | // called by mRecheckAlarmTimer to get next alarm | 651 | // called by mRecheckAlarmTimer to get next alarm |
645 | // we need this, because a QTimer has only a max range of 25 days | 652 | // we need this, because a QTimer has only a max range of 25 days |
646 | void CalendarView::recheckTimerAlarm() | 653 | void CalendarView::recheckTimerAlarm() |
647 | { | 654 | { |
648 | mAlarmTimer->stop(); | 655 | mAlarmTimer->stop(); |
649 | mRecheckAlarmTimer->stop(); | 656 | mRecheckAlarmTimer->stop(); |
650 | mCalendar->checkAlarmForIncidence( 0, true ); | 657 | mCalendar->checkAlarmForIncidence( 0, true ); |
651 | } | 658 | } |
652 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 659 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
653 | { | 660 | { |
654 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 661 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
655 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 662 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
656 | #ifndef DESKTOP_VERSION | 663 | #ifndef DESKTOP_VERSION |
657 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 664 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
658 | #endif | 665 | #endif |
659 | return; | 666 | return; |
660 | } | 667 | } |
661 | mAlarmTimer->stop(); | 668 | mAlarmTimer->stop(); |
662 | } | 669 | } |
663 | void CalendarView::selectWeekNum ( int num ) | 670 | void CalendarView::selectWeekNum ( int num ) |
664 | { | 671 | { |
665 | dateNavigator()->selectWeek( num ); | 672 | dateNavigator()->selectWeek( num ); |
666 | mViewManager->showWeekView(); | 673 | mViewManager->showWeekView(); |
667 | } | 674 | } |
668 | KOViewManager *CalendarView::viewManager() | 675 | KOViewManager *CalendarView::viewManager() |
669 | { | 676 | { |
670 | return mViewManager; | 677 | return mViewManager; |
671 | } | 678 | } |
672 | 679 | ||
673 | KODialogManager *CalendarView::dialogManager() | 680 | KODialogManager *CalendarView::dialogManager() |
674 | { | 681 | { |
675 | return mDialogManager; | 682 | return mDialogManager; |
676 | } | 683 | } |
677 | 684 | ||
678 | QDate CalendarView::startDate() | 685 | QDate CalendarView::startDate() |
679 | { | 686 | { |
680 | DateList dates = mNavigator->selectedDates(); | 687 | DateList dates = mNavigator->selectedDates(); |
681 | 688 | ||
682 | return dates.first(); | 689 | return dates.first(); |
683 | } | 690 | } |
684 | 691 | ||
685 | QDate CalendarView::endDate() | 692 | QDate CalendarView::endDate() |
@@ -2020,601 +2027,617 @@ void CalendarView::writeLocale() | |||
2020 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2027 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2021 | #if 0 | 2028 | #if 0 |
2022 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2029 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2023 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2030 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2024 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2031 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2025 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2032 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2026 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2033 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2027 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2034 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2028 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2035 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2029 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2036 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2030 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2037 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2031 | KOPrefs::instance()->mDaylightsavingStart, | 2038 | KOPrefs::instance()->mDaylightsavingStart, |
2032 | KOPrefs::instance()->mDaylightsavingEnd ); | 2039 | KOPrefs::instance()->mDaylightsavingEnd ); |
2033 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2040 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2034 | #endif | 2041 | #endif |
2035 | } | 2042 | } |
2036 | void CalendarView::updateConfig() | 2043 | void CalendarView::updateConfig() |
2037 | { | 2044 | { |
2038 | writeLocale(); | 2045 | writeLocale(); |
2039 | if ( KOPrefs::instance()->mUseAppColors ) | 2046 | if ( KOPrefs::instance()->mUseAppColors ) |
2040 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2047 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2041 | emit configChanged(); | 2048 | emit configChanged(); |
2042 | mTodoList->updateConfig(); | 2049 | mTodoList->updateConfig(); |
2043 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2050 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2044 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2051 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2045 | // To make the "fill window" configurations work | 2052 | // To make the "fill window" configurations work |
2046 | //mViewManager->raiseCurrentView(); | 2053 | //mViewManager->raiseCurrentView(); |
2047 | } | 2054 | } |
2048 | 2055 | ||
2049 | 2056 | ||
2050 | void CalendarView::eventChanged(Event *event) | 2057 | void CalendarView::eventChanged(Event *event) |
2051 | { | 2058 | { |
2052 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2059 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2053 | //updateUnmanagedViews(); | 2060 | //updateUnmanagedViews(); |
2054 | } | 2061 | } |
2055 | 2062 | ||
2056 | void CalendarView::eventAdded(Event *event) | 2063 | void CalendarView::eventAdded(Event *event) |
2057 | { | 2064 | { |
2058 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2065 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2059 | } | 2066 | } |
2060 | 2067 | ||
2061 | void CalendarView::eventToBeDeleted(Event *) | 2068 | void CalendarView::eventToBeDeleted(Event *) |
2062 | { | 2069 | { |
2063 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2070 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2064 | } | 2071 | } |
2065 | 2072 | ||
2066 | void CalendarView::eventDeleted() | 2073 | void CalendarView::eventDeleted() |
2067 | { | 2074 | { |
2068 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2075 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2069 | } | 2076 | } |
2070 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2077 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2071 | { | 2078 | { |
2072 | changeIncidenceDisplay((Incidence *)which, action); | 2079 | changeIncidenceDisplay((Incidence *)which, action); |
2073 | mDateNavigator->updateView(); //LR | 2080 | mDateNavigator->updateView(); //LR |
2074 | //mDialogManager->updateSearchDialog(); | 2081 | //mDialogManager->updateSearchDialog(); |
2075 | 2082 | ||
2076 | if (which) { | 2083 | if (which) { |
2077 | mViewManager->updateWNview(); | 2084 | mViewManager->updateWNview(); |
2078 | //mTodoList->updateView(); | 2085 | //mTodoList->updateView(); |
2079 | } | 2086 | } |
2080 | 2087 | ||
2081 | } | 2088 | } |
2082 | 2089 | ||
2083 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2090 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2084 | { | 2091 | { |
2085 | updateUnmanagedViews(); | 2092 | updateUnmanagedViews(); |
2086 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2093 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2087 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2094 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2088 | mCalendar->checkAlarmForIncidence( 0, true ); | 2095 | mCalendar->checkAlarmForIncidence( 0, true ); |
2089 | if ( mEventViewerDialog ) | 2096 | if ( mEventViewerDialog ) |
2090 | mEventViewerDialog->hide(); | 2097 | mEventViewerDialog->hide(); |
2091 | } | 2098 | } |
2092 | else | 2099 | else |
2093 | mCalendar->checkAlarmForIncidence( which , false ); | 2100 | mCalendar->checkAlarmForIncidence( which , false ); |
2094 | } | 2101 | } |
2095 | 2102 | ||
2096 | // most of the changeEventDisplays() right now just call the view's | 2103 | // most of the changeEventDisplays() right now just call the view's |
2097 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2104 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2098 | void CalendarView::changeEventDisplay(Event *which, int action) | 2105 | void CalendarView::changeEventDisplay(Event *which, int action) |
2099 | { | 2106 | { |
2100 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2107 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2101 | changeIncidenceDisplay((Incidence *)which, action); | 2108 | changeIncidenceDisplay((Incidence *)which, action); |
2102 | mDateNavigator->updateView(); | 2109 | mDateNavigator->updateView(); |
2103 | //mDialogManager->updateSearchDialog(); | 2110 | //mDialogManager->updateSearchDialog(); |
2104 | 2111 | ||
2105 | if (which) { | 2112 | if (which) { |
2106 | // If there is an event view visible update the display | 2113 | // If there is an event view visible update the display |
2107 | mViewManager->currentView()->changeEventDisplay(which,action); | 2114 | mViewManager->currentView()->changeEventDisplay(which,action); |
2108 | // TODO: check, if update needed | 2115 | // TODO: check, if update needed |
2109 | // if (which->getTodoStatus()) { | 2116 | // if (which->getTodoStatus()) { |
2110 | mTodoList->updateView(); | 2117 | mTodoList->updateView(); |
2111 | // } | 2118 | // } |
2112 | } else { | 2119 | } else { |
2113 | mViewManager->currentView()->updateView(); | 2120 | mViewManager->currentView()->updateView(); |
2114 | } | 2121 | } |
2115 | } | 2122 | } |
2116 | 2123 | ||
2117 | 2124 | ||
2118 | void CalendarView::updateTodoViews() | 2125 | void CalendarView::updateTodoViews() |
2119 | { | 2126 | { |
2120 | 2127 | ||
2121 | mTodoList->updateView(); | 2128 | mTodoList->updateView(); |
2122 | mViewManager->currentView()->updateView(); | 2129 | mViewManager->currentView()->updateView(); |
2123 | 2130 | ||
2124 | } | 2131 | } |
2125 | 2132 | ||
2126 | 2133 | ||
2127 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2134 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2128 | { | 2135 | { |
2129 | mTodoList->updateView(); | 2136 | mTodoList->updateView(); |
2130 | mViewManager->updateView(start, end); | 2137 | mViewManager->updateView(start, end); |
2131 | //mDateNavigator->updateView(); | 2138 | //mDateNavigator->updateView(); |
2132 | } | 2139 | } |
2133 | 2140 | ||
2134 | void CalendarView::updateView() | 2141 | void CalendarView::updateView() |
2135 | { | 2142 | { |
2136 | DateList tmpList = mNavigator->selectedDates(); | 2143 | DateList tmpList = mNavigator->selectedDates(); |
2137 | 2144 | ||
2138 | // We assume that the navigator only selects consecutive days. | 2145 | // We assume that the navigator only selects consecutive days. |
2139 | updateView( tmpList.first(), tmpList.last() ); | 2146 | updateView( tmpList.first(), tmpList.last() ); |
2140 | } | 2147 | } |
2141 | 2148 | ||
2142 | void CalendarView::updateUnmanagedViews() | 2149 | void CalendarView::updateUnmanagedViews() |
2143 | { | 2150 | { |
2144 | mDateNavigator->updateDayMatrix(); | 2151 | mDateNavigator->updateDayMatrix(); |
2145 | } | 2152 | } |
2146 | 2153 | ||
2147 | int CalendarView::msgItemDelete() | 2154 | int CalendarView::msgItemDelete() |
2148 | { | 2155 | { |
2149 | return KMessageBox::warningContinueCancel(this, | 2156 | return KMessageBox::warningContinueCancel(this, |
2150 | i18n("This item will be\npermanently deleted."), | 2157 | i18n("This item will be\npermanently deleted."), |
2151 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2158 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2152 | } | 2159 | } |
2153 | 2160 | ||
2154 | 2161 | ||
2155 | void CalendarView::edit_cut() | 2162 | void CalendarView::edit_cut() |
2156 | { | 2163 | { |
2157 | Event *anEvent=0; | 2164 | Event *anEvent=0; |
2158 | 2165 | ||
2159 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2166 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2160 | 2167 | ||
2161 | if (mViewManager->currentView()->isEventView()) { | 2168 | if (mViewManager->currentView()->isEventView()) { |
2162 | if ( incidence && incidence->type() == "Event" ) { | 2169 | if ( incidence && incidence->type() == "Event" ) { |
2163 | anEvent = static_cast<Event *>(incidence); | 2170 | anEvent = static_cast<Event *>(incidence); |
2164 | } | 2171 | } |
2165 | } | 2172 | } |
2166 | 2173 | ||
2167 | if (!anEvent) { | 2174 | if (!anEvent) { |
2168 | KNotifyClient::beep(); | 2175 | KNotifyClient::beep(); |
2169 | return; | 2176 | return; |
2170 | } | 2177 | } |
2171 | DndFactory factory( mCalendar ); | 2178 | DndFactory factory( mCalendar ); |
2172 | factory.cutEvent(anEvent); | 2179 | factory.cutEvent(anEvent); |
2173 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2180 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2174 | } | 2181 | } |
2175 | 2182 | ||
2176 | void CalendarView::edit_copy() | 2183 | void CalendarView::edit_copy() |
2177 | { | 2184 | { |
2178 | Event *anEvent=0; | 2185 | Event *anEvent=0; |
2179 | 2186 | ||
2180 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2187 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2181 | 2188 | ||
2182 | if (mViewManager->currentView()->isEventView()) { | 2189 | if (mViewManager->currentView()->isEventView()) { |
2183 | if ( incidence && incidence->type() == "Event" ) { | 2190 | if ( incidence && incidence->type() == "Event" ) { |
2184 | anEvent = static_cast<Event *>(incidence); | 2191 | anEvent = static_cast<Event *>(incidence); |
2185 | } | 2192 | } |
2186 | } | 2193 | } |
2187 | 2194 | ||
2188 | if (!anEvent) { | 2195 | if (!anEvent) { |
2189 | KNotifyClient::beep(); | 2196 | KNotifyClient::beep(); |
2190 | return; | 2197 | return; |
2191 | } | 2198 | } |
2192 | DndFactory factory( mCalendar ); | 2199 | DndFactory factory( mCalendar ); |
2193 | factory.copyEvent(anEvent); | 2200 | factory.copyEvent(anEvent); |
2194 | } | 2201 | } |
2195 | 2202 | ||
2196 | void CalendarView::edit_paste() | 2203 | void CalendarView::edit_paste() |
2197 | { | 2204 | { |
2198 | QDate date = mNavigator->selectedDates().first(); | 2205 | QDate date = mNavigator->selectedDates().first(); |
2199 | 2206 | ||
2200 | DndFactory factory( mCalendar ); | 2207 | DndFactory factory( mCalendar ); |
2201 | Event *pastedEvent = factory.pasteEvent( date ); | 2208 | Event *pastedEvent = factory.pasteEvent( date ); |
2202 | 2209 | ||
2203 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2210 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2204 | } | 2211 | } |
2205 | 2212 | ||
2206 | void CalendarView::edit_options() | 2213 | void CalendarView::edit_options() |
2207 | { | 2214 | { |
2208 | mDialogManager->showOptionsDialog(); | 2215 | mDialogManager->showOptionsDialog(); |
2209 | //writeSettings(); | 2216 | //writeSettings(); |
2210 | } | 2217 | } |
2211 | 2218 | ||
2219 | |||
2212 | void CalendarView::slotSelectPickerDate( QDate d) | 2220 | void CalendarView::slotSelectPickerDate( QDate d) |
2213 | { | 2221 | { |
2214 | mDateFrame->hide(); | 2222 | mDateFrame->hide(); |
2215 | if ( mDatePickerMode == 1 ) { | 2223 | if ( mDatePickerMode == 1 ) { |
2216 | mNavigator->slotDaySelect( d ); | 2224 | mNavigator->slotDaySelect( d ); |
2217 | } else if ( mDatePickerMode == 2 ) { | 2225 | } else if ( mDatePickerMode == 2 ) { |
2218 | if ( mMoveIncidence->type() == "Todo" ) { | 2226 | if ( mMoveIncidence->type() == "Todo" ) { |
2219 | Todo * to = (Todo *) mMoveIncidence; | 2227 | Todo * to = (Todo *) mMoveIncidence; |
2220 | QTime tim; | 2228 | QTime tim; |
2221 | if ( to->hasDueDate() ) | 2229 | if ( to->hasDueDate() ) |
2222 | tim = to->dtDue().time(); | 2230 | tim = to->dtDue().time(); |
2223 | else { | 2231 | else { |
2224 | tim = QTime ( 0,0,0 ); | 2232 | tim = QTime ( 0,0,0 ); |
2225 | to->setFloats( true ); | 2233 | to->setFloats( true ); |
2226 | to->setHasDueDate( true ); | 2234 | to->setHasDueDate( true ); |
2227 | } | 2235 | } |
2228 | QDateTime dt ( d,tim ); | 2236 | QDateTime dt ( d,tim ); |
2229 | to->setDtDue( dt ); | 2237 | to->setDtDue( dt ); |
2230 | todoChanged( to ); | 2238 | todoChanged( to ); |
2231 | } else { | 2239 | } else { |
2240 | if ( mMoveIncidence->doesRecur() ) { | ||
2241 | #if 0 | ||
2242 | // PENDING implement this | ||
2243 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | ||
2244 | mCalendar()->addIncidence( newInc ); | ||
2245 | if ( mMoveIncidence->type() == "Todo" ) | ||
2246 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | ||
2247 | else | ||
2248 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | ||
2249 | mMoveIncidence = newInc; | ||
2250 | |||
2251 | #endif | ||
2252 | } | ||
2232 | QTime tim = mMoveIncidence->dtStart().time(); | 2253 | QTime tim = mMoveIncidence->dtStart().time(); |
2233 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2254 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2234 | QDateTime dt ( d,tim ); | 2255 | QDateTime dt ( d,tim ); |
2235 | mMoveIncidence->setDtStart( dt ); | 2256 | mMoveIncidence->setDtStart( dt ); |
2236 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2257 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2237 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2258 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2238 | } | 2259 | } |
2239 | 2260 | ||
2240 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2261 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2241 | } | 2262 | } |
2242 | } | 2263 | } |
2243 | 2264 | ||
2244 | void CalendarView::removeCategories() | 2265 | void CalendarView::removeCategories() |
2245 | { | 2266 | { |
2246 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2267 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2247 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2268 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2248 | QStringList catIncList; | 2269 | QStringList catIncList; |
2249 | QStringList newCatList; | 2270 | QStringList newCatList; |
2250 | Incidence* inc = incList.first(); | 2271 | Incidence* inc = incList.first(); |
2251 | int i; | 2272 | int i; |
2252 | int count = 0; | 2273 | int count = 0; |
2253 | while ( inc ) { | 2274 | while ( inc ) { |
2254 | newCatList.clear(); | 2275 | newCatList.clear(); |
2255 | catIncList = inc->categories() ; | 2276 | catIncList = inc->categories() ; |
2256 | for( i = 0; i< catIncList.count(); ++i ) { | 2277 | for( i = 0; i< catIncList.count(); ++i ) { |
2257 | if ( catList.contains (catIncList[i])) | 2278 | if ( catList.contains (catIncList[i])) |
2258 | newCatList.append( catIncList[i] ); | 2279 | newCatList.append( catIncList[i] ); |
2259 | } | 2280 | } |
2260 | newCatList.sort(); | 2281 | newCatList.sort(); |
2261 | inc->setCategories( newCatList.join(",") ); | 2282 | inc->setCategories( newCatList.join(",") ); |
2262 | inc = incList.next(); | 2283 | inc = incList.next(); |
2263 | } | 2284 | } |
2264 | } | 2285 | } |
2265 | 2286 | ||
2266 | int CalendarView::addCategories() | 2287 | int CalendarView::addCategories() |
2267 | { | 2288 | { |
2268 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2289 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2269 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2290 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2270 | QStringList catIncList; | 2291 | QStringList catIncList; |
2271 | Incidence* inc = incList.first(); | 2292 | Incidence* inc = incList.first(); |
2272 | int i; | 2293 | int i; |
2273 | int count = 0; | 2294 | int count = 0; |
2274 | while ( inc ) { | 2295 | while ( inc ) { |
2275 | catIncList = inc->categories() ; | 2296 | catIncList = inc->categories() ; |
2276 | for( i = 0; i< catIncList.count(); ++i ) { | 2297 | for( i = 0; i< catIncList.count(); ++i ) { |
2277 | if ( !catList.contains (catIncList[i])) { | 2298 | if ( !catList.contains (catIncList[i])) { |
2278 | catList.append( catIncList[i] ); | 2299 | catList.append( catIncList[i] ); |
2279 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2300 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2280 | ++count; | 2301 | ++count; |
2281 | } | 2302 | } |
2282 | } | 2303 | } |
2283 | inc = incList.next(); | 2304 | inc = incList.next(); |
2284 | } | 2305 | } |
2285 | catList.sort(); | 2306 | catList.sort(); |
2286 | KOPrefs::instance()->mCustomCategories = catList; | 2307 | KOPrefs::instance()->mCustomCategories = catList; |
2287 | return count; | 2308 | return count; |
2288 | } | 2309 | } |
2289 | 2310 | ||
2290 | void CalendarView::manageCategories() | 2311 | void CalendarView::manageCategories() |
2291 | { | 2312 | { |
2292 | KOCatPrefs* cp = new KOCatPrefs(); | 2313 | KOCatPrefs* cp = new KOCatPrefs(); |
2293 | cp->show(); | 2314 | cp->show(); |
2294 | int w =cp->sizeHint().width() ; | 2315 | int w =cp->sizeHint().width() ; |
2295 | int h = cp->sizeHint().height() ; | 2316 | int h = cp->sizeHint().height() ; |
2296 | int dw = QApplication::desktop()->width(); | 2317 | int dw = QApplication::desktop()->width(); |
2297 | int dh = QApplication::desktop()->height(); | 2318 | int dh = QApplication::desktop()->height(); |
2298 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2319 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2299 | if ( !cp->exec() ) { | 2320 | if ( !cp->exec() ) { |
2300 | delete cp; | 2321 | delete cp; |
2301 | return; | 2322 | return; |
2302 | } | 2323 | } |
2303 | int count = 0; | 2324 | int count = 0; |
2304 | if ( cp->addCat() ) { | 2325 | if ( cp->addCat() ) { |
2305 | count = addCategories(); | 2326 | count = addCategories(); |
2306 | if ( count ) { | 2327 | if ( count ) { |
2307 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2328 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2308 | writeSettings(); | 2329 | writeSettings(); |
2309 | } else | 2330 | } else |
2310 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2331 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2311 | } else { | 2332 | } else { |
2312 | removeCategories(); | 2333 | removeCategories(); |
2313 | updateView(); | 2334 | updateView(); |
2314 | } | 2335 | } |
2315 | delete cp; | 2336 | delete cp; |
2316 | } | 2337 | } |
2317 | 2338 | ||
2318 | void CalendarView::beamIncidence(Incidence * Inc) | 2339 | void CalendarView::beamIncidence(Incidence * Inc) |
2319 | { | 2340 | { |
2320 | QPtrList<Incidence> delSel ; | 2341 | QPtrList<Incidence> delSel ; |
2321 | delSel.append(Inc); | 2342 | delSel.append(Inc); |
2322 | beamIncidenceList( delSel ); | 2343 | beamIncidenceList( delSel ); |
2323 | } | 2344 | } |
2324 | void CalendarView::beamCalendar() | 2345 | void CalendarView::beamCalendar() |
2325 | { | 2346 | { |
2326 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2347 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2327 | //qDebug("beamCalendar() "); | 2348 | //qDebug("beamCalendar() "); |
2328 | beamIncidenceList( delSel ); | 2349 | beamIncidenceList( delSel ); |
2329 | } | 2350 | } |
2330 | void CalendarView::beamFilteredCalendar() | 2351 | void CalendarView::beamFilteredCalendar() |
2331 | { | 2352 | { |
2332 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2353 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2333 | //qDebug("beamFilteredCalendar() "); | 2354 | //qDebug("beamFilteredCalendar() "); |
2334 | beamIncidenceList( delSel ); | 2355 | beamIncidenceList( delSel ); |
2335 | } | 2356 | } |
2336 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2357 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2337 | { | 2358 | { |
2338 | if ( beamDialog->exec () == QDialog::Rejected ) | 2359 | if ( beamDialog->exec () == QDialog::Rejected ) |
2339 | return; | 2360 | return; |
2340 | #ifdef DESKTOP_VERSION | 2361 | #ifdef DESKTOP_VERSION |
2341 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2362 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2342 | #else | 2363 | #else |
2343 | QString fn = "/tmp/kopibeamfile"; | 2364 | QString fn = "/tmp/kopibeamfile"; |
2344 | #endif | 2365 | #endif |
2345 | QString mes; | 2366 | QString mes; |
2346 | bool createbup = true; | 2367 | bool createbup = true; |
2347 | if ( createbup ) { | 2368 | if ( createbup ) { |
2348 | QString description = "\n"; | 2369 | QString description = "\n"; |
2349 | CalendarLocal* cal = new CalendarLocal(); | 2370 | CalendarLocal* cal = new CalendarLocal(); |
2350 | if ( beamDialog->beamLocal() ) | 2371 | if ( beamDialog->beamLocal() ) |
2351 | cal->setLocalTime(); | 2372 | cal->setLocalTime(); |
2352 | else | 2373 | else |
2353 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2374 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2354 | Incidence *incidence = delSel.first(); | 2375 | Incidence *incidence = delSel.first(); |
2355 | bool addText = false; | 2376 | bool addText = false; |
2356 | if ( delSel.count() < 10 ) | 2377 | if ( delSel.count() < 10 ) |
2357 | addText = true; | 2378 | addText = true; |
2358 | else { | 2379 | else { |
2359 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2380 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2360 | } | 2381 | } |
2361 | while ( incidence ) { | 2382 | while ( incidence ) { |
2362 | Incidence *in = incidence->clone(); | 2383 | Incidence *in = incidence->clone(); |
2363 | if ( ! in->summary().isEmpty() ) { | 2384 | if ( ! in->summary().isEmpty() ) { |
2364 | in->setDescription(""); | 2385 | in->setDescription(""); |
2365 | } else { | 2386 | } else { |
2366 | in->setSummary( in->description().left(20)); | 2387 | in->setSummary( in->description().left(20)); |
2367 | in->setDescription(""); | 2388 | in->setDescription(""); |
2368 | } | 2389 | } |
2369 | if ( addText ) | 2390 | if ( addText ) |
2370 | description += in->summary() + "\n"; | 2391 | description += in->summary() + "\n"; |
2371 | cal->addIncidence( in ); | 2392 | cal->addIncidence( in ); |
2372 | incidence = delSel.next(); | 2393 | incidence = delSel.next(); |
2373 | } | 2394 | } |
2374 | if ( beamDialog->beamVcal() ) { | 2395 | if ( beamDialog->beamVcal() ) { |
2375 | fn += ".vcs"; | 2396 | fn += ".vcs"; |
2376 | FileStorage storage( cal, fn, new VCalFormat ); | 2397 | FileStorage storage( cal, fn, new VCalFormat ); |
2377 | storage.save(); | 2398 | storage.save(); |
2378 | } else { | 2399 | } else { |
2379 | fn += ".ics"; | 2400 | fn += ".ics"; |
2380 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2401 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2381 | storage.save(); | 2402 | storage.save(); |
2382 | } | 2403 | } |
2383 | delete cal; | 2404 | delete cal; |
2384 | mes = i18n("KO/Pi: Ready for beaming"); | 2405 | mes = i18n("KO/Pi: Ready for beaming"); |
2385 | topLevelWidget()->setCaption(mes); | 2406 | topLevelWidget()->setCaption(mes); |
2386 | KApplication::convert2latin1( fn ); | 2407 | KApplication::convert2latin1( fn ); |
2387 | #ifndef DESKTOP_VERSION | 2408 | #ifndef DESKTOP_VERSION |
2388 | Ir *ir = new Ir( this ); | 2409 | Ir *ir = new Ir( this ); |
2389 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2410 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2390 | ir->send( fn, description, "text/x-vCalendar" ); | 2411 | ir->send( fn, description, "text/x-vCalendar" ); |
2391 | #endif | 2412 | #endif |
2392 | } | 2413 | } |
2393 | } | 2414 | } |
2394 | void CalendarView::beamDone( Ir *ir ) | 2415 | void CalendarView::beamDone( Ir *ir ) |
2395 | { | 2416 | { |
2396 | #ifndef DESKTOP_VERSION | 2417 | #ifndef DESKTOP_VERSION |
2397 | delete ir; | 2418 | delete ir; |
2398 | #endif | 2419 | #endif |
2399 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2420 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2400 | topLevelWidget()->raise(); | 2421 | topLevelWidget()->raise(); |
2401 | } | 2422 | } |
2402 | 2423 | ||
2403 | void CalendarView::moveIncidence(Incidence * inc ) | 2424 | void CalendarView::moveIncidence(Incidence * inc ) |
2404 | { | 2425 | { |
2405 | if ( !inc ) return; | 2426 | if ( !inc ) return; |
2406 | // qDebug("showDatePickerForIncidence( ) "); | 2427 | // qDebug("showDatePickerForIncidence( ) "); |
2407 | if ( mDateFrame->isVisible() ) | 2428 | if ( mDateFrame->isVisible() ) |
2408 | mDateFrame->hide(); | 2429 | mDateFrame->hide(); |
2409 | else { | 2430 | else { |
2410 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2431 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2411 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2432 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2412 | int dw = QApplication::desktop()->width(); | 2433 | int dw = QApplication::desktop()->width(); |
2413 | int dh = QApplication::desktop()->height(); | 2434 | int dh = QApplication::desktop()->height(); |
2414 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2435 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2415 | mDateFrame->show(); | 2436 | mDateFrame->show(); |
2416 | } | 2437 | } |
2417 | mDatePickerMode = 2; | 2438 | mDatePickerMode = 2; |
2418 | mMoveIncidence = inc ; | 2439 | mMoveIncidence = inc ; |
2419 | QDate da; | 2440 | QDate da; |
2420 | if ( mMoveIncidence->type() == "Todo" ) { | 2441 | if ( mMoveIncidence->type() == "Todo" ) { |
2421 | Todo * to = (Todo *) mMoveIncidence; | 2442 | Todo * to = (Todo *) mMoveIncidence; |
2422 | if ( to->hasDueDate() ) | 2443 | if ( to->hasDueDate() ) |
2423 | da = to->dtDue().date(); | 2444 | da = to->dtDue().date(); |
2424 | else | 2445 | else |
2425 | da = QDate::currentDate(); | 2446 | da = QDate::currentDate(); |
2426 | } else { | 2447 | } else { |
2427 | da = mMoveIncidence->dtStart().date(); | 2448 | da = mMoveIncidence->dtStart().date(); |
2428 | } | 2449 | } |
2450 | //PENDING set date for recurring incidence to date of recurrence | ||
2451 | //mMoveIncidenceOldDate; | ||
2429 | mDatePicker->setDate( da ); | 2452 | mDatePicker->setDate( da ); |
2430 | } | 2453 | } |
2431 | void CalendarView::showDatePicker( ) | 2454 | void CalendarView::showDatePicker( ) |
2432 | { | 2455 | { |
2433 | //qDebug("CalendarView::showDatePicker( ) "); | 2456 | //qDebug("CalendarView::showDatePicker( ) "); |
2434 | if ( mDateFrame->isVisible() ) | 2457 | if ( mDateFrame->isVisible() ) |
2435 | mDateFrame->hide(); | 2458 | mDateFrame->hide(); |
2436 | else { | 2459 | else { |
2437 | int w =mDatePicker->sizeHint().width() ; | 2460 | int w =mDatePicker->sizeHint().width() ; |
2438 | int h = mDatePicker->sizeHint().height() ; | 2461 | int h = mDatePicker->sizeHint().height() ; |
2439 | int dw = QApplication::desktop()->width(); | 2462 | int dw = QApplication::desktop()->width(); |
2440 | int dh = QApplication::desktop()->height(); | 2463 | int dh = QApplication::desktop()->height(); |
2441 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2464 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2442 | mDateFrame->show(); | 2465 | mDateFrame->show(); |
2443 | } | 2466 | } |
2444 | mDatePickerMode = 1; | 2467 | mDatePickerMode = 1; |
2445 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2468 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2446 | } | 2469 | } |
2447 | 2470 | ||
2448 | void CalendarView::showEventEditor() | 2471 | void CalendarView::showEventEditor() |
2449 | { | 2472 | { |
2450 | #ifdef DESKTOP_VERSION | 2473 | #ifdef DESKTOP_VERSION |
2451 | mEventEditor->show(); | 2474 | mEventEditor->show(); |
2452 | #else | 2475 | #else |
2453 | if ( mEventEditor->width() != QApplication::desktop()->width() ) { | 2476 | if ( mEventEditor->width() != QApplication::desktop()->width() ) { |
2454 | qDebug("CalendarView: recreate mEventEditor "); | 2477 | qDebug("CalendarView: recreate mEventEditor "); |
2455 | delete mEventEditor; | 2478 | delete mEventEditor; |
2456 | mEventEditor = mDialogManager->getEventEditor(); | 2479 | mEventEditor = mDialogManager->getEventEditor(); |
2457 | } | 2480 | } |
2458 | mEventEditor->showMaximized(); | 2481 | mEventEditor->showMaximized(); |
2459 | #endif | 2482 | #endif |
2460 | } | 2483 | } |
2461 | void CalendarView::showTodoEditor() | 2484 | void CalendarView::showTodoEditor() |
2462 | { | 2485 | { |
2463 | #ifdef DESKTOP_VERSION | 2486 | #ifdef DESKTOP_VERSION |
2464 | mTodoEditor->show(); | 2487 | mTodoEditor->show(); |
2465 | #else | 2488 | #else |
2466 | if ( mTodoEditor->width() != QApplication::desktop()->width() ) { | 2489 | if ( mTodoEditor->width() != QApplication::desktop()->width() ) { |
2467 | qDebug("CalendarView: recreate mTodoEditor "); | 2490 | qDebug("CalendarView: recreate mTodoEditor "); |
2468 | delete mTodoEditor; | 2491 | delete mTodoEditor; |
2469 | mTodoEditor = mDialogManager->getTodoEditor(); | 2492 | mTodoEditor = mDialogManager->getTodoEditor(); |
2470 | } | 2493 | } |
2471 | mTodoEditor->showMaximized(); | 2494 | mTodoEditor->showMaximized(); |
2472 | #endif | 2495 | #endif |
2473 | } | 2496 | } |
2474 | 2497 | ||
2475 | void CalendarView::cloneIncidence() | 2498 | void CalendarView::cloneIncidence() |
2476 | { | 2499 | { |
2477 | Incidence *incidence = currentSelection(); | 2500 | Incidence *incidence = currentSelection(); |
2478 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2501 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2479 | if ( incidence ) { | 2502 | if ( incidence ) { |
2480 | cloneIncidence(incidence); | 2503 | cloneIncidence(incidence); |
2481 | } | 2504 | } |
2482 | } | 2505 | } |
2483 | void CalendarView::moveIncidence() | 2506 | void CalendarView::moveIncidence() |
2484 | { | 2507 | { |
2485 | Incidence *incidence = currentSelection(); | 2508 | Incidence *incidence = currentSelection(); |
2486 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2509 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2487 | if ( incidence ) { | 2510 | if ( incidence ) { |
2488 | moveIncidence(incidence); | 2511 | moveIncidence(incidence); |
2489 | } | 2512 | } |
2490 | } | 2513 | } |
2491 | void CalendarView::beamIncidence() | 2514 | void CalendarView::beamIncidence() |
2492 | { | 2515 | { |
2493 | Incidence *incidence = currentSelection(); | 2516 | Incidence *incidence = currentSelection(); |
2494 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2517 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2495 | if ( incidence ) { | 2518 | if ( incidence ) { |
2496 | beamIncidence(incidence); | 2519 | beamIncidence(incidence); |
2497 | } | 2520 | } |
2498 | } | 2521 | } |
2499 | void CalendarView::toggleCancelIncidence() | 2522 | void CalendarView::toggleCancelIncidence() |
2500 | { | 2523 | { |
2501 | Incidence *incidence = currentSelection(); | 2524 | Incidence *incidence = currentSelection(); |
2502 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2525 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2503 | if ( incidence ) { | 2526 | if ( incidence ) { |
2504 | cancelIncidence(incidence); | 2527 | cancelIncidence(incidence); |
2505 | } | 2528 | } |
2506 | } | 2529 | } |
2507 | 2530 | ||
2508 | 2531 | ||
2509 | void CalendarView::cancelIncidence(Incidence * inc ) | 2532 | void CalendarView::cancelIncidence(Incidence * inc ) |
2510 | { | 2533 | { |
2511 | inc->setCancelled( ! inc->cancelled() ); | 2534 | inc->setCancelled( ! inc->cancelled() ); |
2512 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2535 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2513 | updateView(); | 2536 | updateView(); |
2514 | } | 2537 | } |
2515 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2538 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2516 | { | 2539 | { |
2517 | Incidence * newInc = orgInc->clone(); | 2540 | Incidence * newInc = orgInc->clone(); |
2518 | newInc->recreate(); | 2541 | newInc->recreate(); |
2519 | 2542 | ||
2520 | if ( newInc->type() == "Todo" ) { | 2543 | if ( newInc->type() == "Todo" ) { |
2521 | Todo* t = (Todo*) newInc; | 2544 | Todo* t = (Todo*) newInc; |
2522 | mTodoEditor->editTodo( t ); | 2545 | mTodoEditor->editTodo( t ); |
2523 | showTodoEditor(); | 2546 | showTodoEditor(); |
2524 | if ( mTodoEditor->exec() ) { | 2547 | if ( mTodoEditor->exec() ) { |
2525 | mCalendar->addTodo( t ); | 2548 | mCalendar->addTodo( t ); |
2526 | updateView(); | 2549 | updateView(); |
2527 | } else { | 2550 | } else { |
2528 | delete t; | 2551 | delete t; |
2529 | } | 2552 | } |
2530 | } | 2553 | } |
2531 | else { | 2554 | else { |
2532 | Event* e = (Event*) newInc; | 2555 | Event* e = (Event*) newInc; |
2533 | mEventEditor->editEvent( e ); | 2556 | mEventEditor->editEvent( e ); |
2534 | showEventEditor(); | 2557 | showEventEditor(); |
2535 | if ( mEventEditor->exec() ) { | 2558 | if ( mEventEditor->exec() ) { |
2536 | mCalendar->addEvent( e ); | 2559 | mCalendar->addEvent( e ); |
2537 | updateView(); | 2560 | updateView(); |
2538 | } else { | 2561 | } else { |
2539 | delete e; | 2562 | delete e; |
2540 | } | 2563 | } |
2541 | } | 2564 | } |
2542 | } | 2565 | } |
2543 | 2566 | ||
2544 | void CalendarView::newEvent() | 2567 | void CalendarView::newEvent() |
2545 | { | 2568 | { |
2546 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2569 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2547 | KOAgendaView *aView = mViewManager->agendaView(); | 2570 | KOAgendaView *aView = mViewManager->agendaView(); |
2548 | if (aView) { | 2571 | if (aView) { |
2549 | if (aView->selectionStart().isValid()) { | 2572 | if (aView->selectionStart().isValid()) { |
2550 | if (aView->selectedIsAllDay()) { | 2573 | if (aView->selectedIsAllDay()) { |
2551 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2574 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2552 | } else { | 2575 | } else { |
2553 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2576 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2554 | } | 2577 | } |
2555 | return; | 2578 | return; |
2556 | } | 2579 | } |
2557 | } | 2580 | } |
2558 | 2581 | ||
2559 | QDate date = mNavigator->selectedDates().first(); | 2582 | QDate date = mNavigator->selectedDates().first(); |
2560 | QDateTime current = QDateTime::currentDateTime(); | 2583 | QDateTime current = QDateTime::currentDateTime(); |
2561 | if ( date <= current.date() ) { | 2584 | if ( date <= current.date() ) { |
2562 | int hour = current.time().hour() +1; | 2585 | int hour = current.time().hour() +1; |
2563 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2586 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2564 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2587 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2565 | } else | 2588 | } else |
2566 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2589 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2567 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2590 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2568 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2591 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2569 | } | 2592 | } |
2570 | 2593 | ||
2571 | void CalendarView::newEvent(QDateTime fh) | 2594 | void CalendarView::newEvent(QDateTime fh) |
2572 | { | 2595 | { |
2573 | newEvent(fh, | 2596 | newEvent(fh, |
2574 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2597 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2575 | } | 2598 | } |
2576 | 2599 | ||
2577 | void CalendarView::newEvent(QDate dt) | 2600 | void CalendarView::newEvent(QDate dt) |
2578 | { | 2601 | { |
2579 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2602 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2580 | QDateTime(dt, QTime(0,0,0)), true); | 2603 | QDateTime(dt, QTime(0,0,0)), true); |
2581 | } | 2604 | } |
2582 | 2605 | ||
2583 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2606 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2584 | { | 2607 | { |
2585 | 2608 | ||
2586 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2609 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2587 | if ( mFilterView->filtersEnabled() ) { | 2610 | if ( mFilterView->filtersEnabled() ) { |
2588 | CalFilter *filter = mFilterView->selectedFilter(); | 2611 | CalFilter *filter = mFilterView->selectedFilter(); |
2589 | if (filter && filter->showCategories()) { | 2612 | if (filter && filter->showCategories()) { |
2590 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2613 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2591 | } | 2614 | } |
2592 | if ( filter ) | 2615 | if ( filter ) |
2593 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2616 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2594 | } | 2617 | } |
2595 | showEventEditor(); | 2618 | showEventEditor(); |
2596 | } | 2619 | } |
2597 | void CalendarView::todoAdded(Todo * t) | 2620 | void CalendarView::todoAdded(Todo * t) |
2598 | { | 2621 | { |
2599 | 2622 | ||
2600 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2623 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2601 | updateTodoViews(); | 2624 | updateTodoViews(); |
2602 | } | 2625 | } |
2603 | void CalendarView::todoChanged(Todo * t) | 2626 | void CalendarView::todoChanged(Todo * t) |
2604 | { | 2627 | { |
2605 | emit todoModified( t, 4 ); | 2628 | emit todoModified( t, 4 ); |
2606 | // updateTodoViews(); | 2629 | // updateTodoViews(); |
2607 | } | 2630 | } |
2608 | void CalendarView::todoToBeDeleted(Todo *) | 2631 | void CalendarView::todoToBeDeleted(Todo *) |
2609 | { | 2632 | { |
2610 | //qDebug("todoToBeDeleted(Todo *) "); | 2633 | //qDebug("todoToBeDeleted(Todo *) "); |
2611 | updateTodoViews(); | 2634 | updateTodoViews(); |
2612 | } | 2635 | } |
2613 | void CalendarView::todoDeleted() | 2636 | void CalendarView::todoDeleted() |
2614 | { | 2637 | { |
2615 | //qDebug(" todoDeleted()"); | 2638 | //qDebug(" todoDeleted()"); |
2616 | updateTodoViews(); | 2639 | updateTodoViews(); |
2617 | } | 2640 | } |
2618 | 2641 | ||
2619 | 2642 | ||
2620 | 2643 | ||
@@ -2695,434 +2718,434 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog() | |||
2695 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2718 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2696 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2719 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2697 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2720 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2698 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2721 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2699 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2722 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2700 | mEventViewerDialog->resize( 640, 480 ); | 2723 | mEventViewerDialog->resize( 640, 480 ); |
2701 | 2724 | ||
2702 | } | 2725 | } |
2703 | return mEventViewerDialog; | 2726 | return mEventViewerDialog; |
2704 | } | 2727 | } |
2705 | void CalendarView::showEvent(Event *event) | 2728 | void CalendarView::showEvent(Event *event) |
2706 | { | 2729 | { |
2707 | getEventViewerDialog()->setEvent(event); | 2730 | getEventViewerDialog()->setEvent(event); |
2708 | getEventViewerDialog()->showMe(); | 2731 | getEventViewerDialog()->showMe(); |
2709 | } | 2732 | } |
2710 | 2733 | ||
2711 | void CalendarView::showTodo(Todo *event) | 2734 | void CalendarView::showTodo(Todo *event) |
2712 | { | 2735 | { |
2713 | getEventViewerDialog()->setTodo(event); | 2736 | getEventViewerDialog()->setTodo(event); |
2714 | getEventViewerDialog()->showMe(); | 2737 | getEventViewerDialog()->showMe(); |
2715 | } | 2738 | } |
2716 | void CalendarView::showJournal( Journal *jour ) | 2739 | void CalendarView::showJournal( Journal *jour ) |
2717 | { | 2740 | { |
2718 | getEventViewerDialog()->setJournal(jour); | 2741 | getEventViewerDialog()->setJournal(jour); |
2719 | getEventViewerDialog()->showMe(); | 2742 | getEventViewerDialog()->showMe(); |
2720 | 2743 | ||
2721 | } | 2744 | } |
2722 | // void CalendarView::todoModified (Todo *event, int changed) | 2745 | // void CalendarView::todoModified (Todo *event, int changed) |
2723 | // { | 2746 | // { |
2724 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2747 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2725 | // // kdDebug() << "Todo modified and open" << endl; | 2748 | // // kdDebug() << "Todo modified and open" << endl; |
2726 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2749 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2727 | // // temp->modified (changed); | 2750 | // // temp->modified (changed); |
2728 | 2751 | ||
2729 | // // } | 2752 | // // } |
2730 | 2753 | ||
2731 | // mViewManager->updateView(); | 2754 | // mViewManager->updateView(); |
2732 | // } | 2755 | // } |
2733 | 2756 | ||
2734 | void CalendarView::appointment_show() | 2757 | void CalendarView::appointment_show() |
2735 | { | 2758 | { |
2736 | Event *anEvent = 0; | 2759 | Event *anEvent = 0; |
2737 | 2760 | ||
2738 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2761 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2739 | 2762 | ||
2740 | if (mViewManager->currentView()->isEventView()) { | 2763 | if (mViewManager->currentView()->isEventView()) { |
2741 | if ( incidence && incidence->type() == "Event" ) { | 2764 | if ( incidence && incidence->type() == "Event" ) { |
2742 | anEvent = static_cast<Event *>(incidence); | 2765 | anEvent = static_cast<Event *>(incidence); |
2743 | } | 2766 | } |
2744 | } | 2767 | } |
2745 | 2768 | ||
2746 | if (!anEvent) { | 2769 | if (!anEvent) { |
2747 | KNotifyClient::beep(); | 2770 | KNotifyClient::beep(); |
2748 | return; | 2771 | return; |
2749 | } | 2772 | } |
2750 | 2773 | ||
2751 | showEvent(anEvent); | 2774 | showEvent(anEvent); |
2752 | } | 2775 | } |
2753 | 2776 | ||
2754 | void CalendarView::appointment_edit() | 2777 | void CalendarView::appointment_edit() |
2755 | { | 2778 | { |
2756 | Event *anEvent = 0; | 2779 | Event *anEvent = 0; |
2757 | 2780 | ||
2758 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2781 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2759 | 2782 | ||
2760 | if (mViewManager->currentView()->isEventView()) { | 2783 | if (mViewManager->currentView()->isEventView()) { |
2761 | if ( incidence && incidence->type() == "Event" ) { | 2784 | if ( incidence && incidence->type() == "Event" ) { |
2762 | anEvent = static_cast<Event *>(incidence); | 2785 | anEvent = static_cast<Event *>(incidence); |
2763 | } | 2786 | } |
2764 | } | 2787 | } |
2765 | 2788 | ||
2766 | if (!anEvent) { | 2789 | if (!anEvent) { |
2767 | KNotifyClient::beep(); | 2790 | KNotifyClient::beep(); |
2768 | return; | 2791 | return; |
2769 | } | 2792 | } |
2770 | 2793 | ||
2771 | editEvent(anEvent); | 2794 | editEvent(anEvent); |
2772 | } | 2795 | } |
2773 | 2796 | ||
2774 | void CalendarView::appointment_delete() | 2797 | void CalendarView::appointment_delete() |
2775 | { | 2798 | { |
2776 | Event *anEvent = 0; | 2799 | Event *anEvent = 0; |
2777 | 2800 | ||
2778 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2801 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2779 | 2802 | ||
2780 | if (mViewManager->currentView()->isEventView()) { | 2803 | if (mViewManager->currentView()->isEventView()) { |
2781 | if ( incidence && incidence->type() == "Event" ) { | 2804 | if ( incidence && incidence->type() == "Event" ) { |
2782 | anEvent = static_cast<Event *>(incidence); | 2805 | anEvent = static_cast<Event *>(incidence); |
2783 | } | 2806 | } |
2784 | } | 2807 | } |
2785 | 2808 | ||
2786 | if (!anEvent) { | 2809 | if (!anEvent) { |
2787 | KNotifyClient::beep(); | 2810 | KNotifyClient::beep(); |
2788 | return; | 2811 | return; |
2789 | } | 2812 | } |
2790 | 2813 | ||
2791 | deleteEvent(anEvent); | 2814 | deleteEvent(anEvent); |
2792 | } | 2815 | } |
2793 | 2816 | ||
2794 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 2817 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
2795 | { | 2818 | { |
2796 | if (!sub) return; | 2819 | if (!sub) return; |
2797 | if (!parent) return; | 2820 | if (!parent) return; |
2798 | if ( sub->relatedTo() ) | 2821 | if ( sub->relatedTo() ) |
2799 | sub->relatedTo()->removeRelation(sub); | 2822 | sub->relatedTo()->removeRelation(sub); |
2800 | sub->setRelatedTo(parent); | 2823 | sub->setRelatedTo(parent); |
2801 | sub->setRelatedToUid(parent->uid()); | 2824 | sub->setRelatedToUid(parent->uid()); |
2802 | parent->addRelation(sub); | 2825 | parent->addRelation(sub); |
2803 | sub->updated(); | 2826 | sub->updated(); |
2804 | parent->updated(); | 2827 | parent->updated(); |
2805 | setModified(true); | 2828 | setModified(true); |
2806 | updateView(); | 2829 | updateView(); |
2807 | } | 2830 | } |
2808 | void CalendarView::todo_unsub(Todo *anTodo ) | 2831 | void CalendarView::todo_unsub(Todo *anTodo ) |
2809 | { | 2832 | { |
2810 | // Todo *anTodo = selectedTodo(); | 2833 | // Todo *anTodo = selectedTodo(); |
2811 | if (!anTodo) return; | 2834 | if (!anTodo) return; |
2812 | if (!anTodo->relatedTo()) return; | 2835 | if (!anTodo->relatedTo()) return; |
2813 | anTodo->relatedTo()->removeRelation(anTodo); | 2836 | anTodo->relatedTo()->removeRelation(anTodo); |
2814 | anTodo->setRelatedTo(0); | 2837 | anTodo->setRelatedTo(0); |
2815 | anTodo->updated(); | 2838 | anTodo->updated(); |
2816 | anTodo->setRelatedToUid(""); | 2839 | anTodo->setRelatedToUid(""); |
2817 | setModified(true); | 2840 | setModified(true); |
2818 | updateView(); | 2841 | updateView(); |
2819 | } | 2842 | } |
2820 | 2843 | ||
2821 | void CalendarView::deleteTodo(Todo *todo) | 2844 | void CalendarView::deleteTodo(Todo *todo) |
2822 | { | 2845 | { |
2823 | if (!todo) { | 2846 | if (!todo) { |
2824 | KNotifyClient::beep(); | 2847 | KNotifyClient::beep(); |
2825 | return; | 2848 | return; |
2826 | } | 2849 | } |
2827 | if (KOPrefs::instance()->mConfirm) { | 2850 | if (KOPrefs::instance()->mConfirm) { |
2828 | switch (msgItemDelete()) { | 2851 | switch (msgItemDelete()) { |
2829 | case KMessageBox::Continue: // OK | 2852 | case KMessageBox::Continue: // OK |
2830 | if (!todo->relations().isEmpty()) { | 2853 | if (!todo->relations().isEmpty()) { |
2831 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2854 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2832 | i18n("Delete To-Do")); | 2855 | i18n("Delete To-Do")); |
2833 | } else { | 2856 | } else { |
2834 | checkExternalId( todo ); | 2857 | checkExternalId( todo ); |
2835 | calendar()->deleteTodo(todo); | 2858 | calendar()->deleteTodo(todo); |
2836 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2859 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2837 | updateView(); | 2860 | updateView(); |
2838 | } | 2861 | } |
2839 | break; | 2862 | break; |
2840 | } // switch | 2863 | } // switch |
2841 | } else { | 2864 | } else { |
2842 | if (!todo->relations().isEmpty()) { | 2865 | if (!todo->relations().isEmpty()) { |
2843 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2866 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2844 | i18n("Delete To-Do")); | 2867 | i18n("Delete To-Do")); |
2845 | } else { | 2868 | } else { |
2846 | checkExternalId( todo ); | 2869 | checkExternalId( todo ); |
2847 | mCalendar->deleteTodo(todo); | 2870 | mCalendar->deleteTodo(todo); |
2848 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2871 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2849 | updateView(); | 2872 | updateView(); |
2850 | } | 2873 | } |
2851 | } | 2874 | } |
2852 | emit updateSearchDialog(); | 2875 | emit updateSearchDialog(); |
2853 | } | 2876 | } |
2854 | void CalendarView::deleteJournal(Journal *jour) | 2877 | void CalendarView::deleteJournal(Journal *jour) |
2855 | { | 2878 | { |
2856 | if (!jour) { | 2879 | if (!jour) { |
2857 | KNotifyClient::beep(); | 2880 | KNotifyClient::beep(); |
2858 | return; | 2881 | return; |
2859 | } | 2882 | } |
2860 | if (KOPrefs::instance()->mConfirm) { | 2883 | if (KOPrefs::instance()->mConfirm) { |
2861 | switch (msgItemDelete()) { | 2884 | switch (msgItemDelete()) { |
2862 | case KMessageBox::Continue: // OK | 2885 | case KMessageBox::Continue: // OK |
2863 | calendar()->deleteJournal(jour); | 2886 | calendar()->deleteJournal(jour); |
2864 | updateView(); | 2887 | updateView(); |
2865 | break; | 2888 | break; |
2866 | } // switch | 2889 | } // switch |
2867 | } else { | 2890 | } else { |
2868 | calendar()->deleteJournal(jour);; | 2891 | calendar()->deleteJournal(jour);; |
2869 | updateView(); | 2892 | updateView(); |
2870 | } | 2893 | } |
2871 | emit updateSearchDialog(); | 2894 | emit updateSearchDialog(); |
2872 | } | 2895 | } |
2873 | 2896 | ||
2874 | void CalendarView::deleteEvent(Event *anEvent) | 2897 | void CalendarView::deleteEvent(Event *anEvent) |
2875 | { | 2898 | { |
2876 | if (!anEvent) { | 2899 | if (!anEvent) { |
2877 | KNotifyClient::beep(); | 2900 | KNotifyClient::beep(); |
2878 | return; | 2901 | return; |
2879 | } | 2902 | } |
2880 | 2903 | ||
2881 | if (anEvent->recurrence()->doesRecur()) { | 2904 | if (anEvent->recurrence()->doesRecur()) { |
2882 | QDate itemDate = mViewManager->currentSelectionDate(); | 2905 | QDate itemDate = mViewManager->currentSelectionDate(); |
2883 | int km; | 2906 | int km; |
2884 | if (!itemDate.isValid()) { | 2907 | if (!itemDate.isValid()) { |
2885 | //kdDebug() << "Date Not Valid" << endl; | 2908 | //kdDebug() << "Date Not Valid" << endl; |
2886 | if (KOPrefs::instance()->mConfirm) { | 2909 | if (KOPrefs::instance()->mConfirm) { |
2887 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2910 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
2888 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 2911 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
2889 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 2912 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
2890 | if ( km == KMessageBox::Continue ) | 2913 | if ( km == KMessageBox::Continue ) |
2891 | km = KMessageBox::No; // No = all below | 2914 | km = KMessageBox::No; // No = all below |
2892 | } else | 2915 | } else |
2893 | km = KMessageBox::No; | 2916 | km = KMessageBox::No; |
2894 | } else { | 2917 | } else { |
2895 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + | 2918 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + |
2896 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 2919 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
2897 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 2920 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
2898 | i18n("KO/Pi Confirmation"),i18n("Current"), | 2921 | i18n("KO/Pi Confirmation"),i18n("Current"), |
2899 | i18n("All")); | 2922 | i18n("All")); |
2900 | } | 2923 | } |
2901 | switch(km) { | 2924 | switch(km) { |
2902 | 2925 | ||
2903 | case KMessageBox::No: // Continue // all | 2926 | case KMessageBox::No: // Continue // all |
2904 | //qDebug("KMessageBox::No "); | 2927 | //qDebug("KMessageBox::No "); |
2905 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2928 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2906 | schedule(Scheduler::Cancel,anEvent); | 2929 | schedule(Scheduler::Cancel,anEvent); |
2907 | 2930 | ||
2908 | checkExternalId( anEvent); | 2931 | checkExternalId( anEvent); |
2909 | mCalendar->deleteEvent(anEvent); | 2932 | mCalendar->deleteEvent(anEvent); |
2910 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 2933 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
2911 | break; | 2934 | break; |
2912 | 2935 | ||
2913 | // Disabled because it does not work | 2936 | // Disabled because it does not work |
2914 | //#if 0 | 2937 | //#if 0 |
2915 | case KMessageBox::Yes: // just this one | 2938 | case KMessageBox::Yes: // just this one |
2916 | //QDate qd = mNavigator->selectedDates().first(); | 2939 | //QDate qd = mNavigator->selectedDates().first(); |
2917 | //if (!qd.isValid()) { | 2940 | //if (!qd.isValid()) { |
2918 | // kdDebug() << "no date selected, or invalid date" << endl; | 2941 | // kdDebug() << "no date selected, or invalid date" << endl; |
2919 | // KNotifyClient::beep(); | 2942 | // KNotifyClient::beep(); |
2920 | // return; | 2943 | // return; |
2921 | //} | 2944 | //} |
2922 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 2945 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
2923 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 2946 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
2924 | anEvent->addExDate(itemDate); | 2947 | anEvent->addExDate(itemDate); |
2925 | int duration = anEvent->recurrence()->duration(); | 2948 | int duration = anEvent->recurrence()->duration(); |
2926 | if ( duration > 0 ) { | 2949 | if ( duration > 0 ) { |
2927 | anEvent->recurrence()->setDuration( duration - 1 ); | 2950 | anEvent->recurrence()->setDuration( duration - 1 ); |
2928 | } | 2951 | } |
2929 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 2952 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
2930 | } | 2953 | } |
2931 | break; | 2954 | break; |
2932 | //#endif | 2955 | //#endif |
2933 | } // switch | 2956 | } // switch |
2934 | } else { | 2957 | } else { |
2935 | if (KOPrefs::instance()->mConfirm) { | 2958 | if (KOPrefs::instance()->mConfirm) { |
2936 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2959 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
2937 | i18n("\nAre you sure you want\nto delete this event?"), | 2960 | i18n("\nAre you sure you want\nto delete this event?"), |
2938 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 2961 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
2939 | case KMessageBox::Continue: // OK | 2962 | case KMessageBox::Continue: // OK |
2940 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2963 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2941 | schedule(Scheduler::Cancel,anEvent); | 2964 | schedule(Scheduler::Cancel,anEvent); |
2942 | checkExternalId( anEvent); | 2965 | checkExternalId( anEvent); |
2943 | mCalendar->deleteEvent(anEvent); | 2966 | mCalendar->deleteEvent(anEvent); |
2944 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2967 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2945 | break; | 2968 | break; |
2946 | } // switch | 2969 | } // switch |
2947 | } else { | 2970 | } else { |
2948 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2971 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2949 | schedule(Scheduler::Cancel,anEvent); | 2972 | schedule(Scheduler::Cancel,anEvent); |
2950 | checkExternalId( anEvent); | 2973 | checkExternalId( anEvent); |
2951 | mCalendar->deleteEvent(anEvent); | 2974 | mCalendar->deleteEvent(anEvent); |
2952 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2975 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2953 | } | 2976 | } |
2954 | } // if-else | 2977 | } // if-else |
2955 | emit updateSearchDialog(); | 2978 | emit updateSearchDialog(); |
2956 | } | 2979 | } |
2957 | 2980 | ||
2958 | bool CalendarView::deleteEvent(const QString &uid) | 2981 | bool CalendarView::deleteEvent(const QString &uid) |
2959 | { | 2982 | { |
2960 | Event *ev = mCalendar->event(uid); | 2983 | Event *ev = mCalendar->event(uid); |
2961 | if (ev) { | 2984 | if (ev) { |
2962 | deleteEvent(ev); | 2985 | deleteEvent(ev); |
2963 | return true; | 2986 | return true; |
2964 | } else { | 2987 | } else { |
2965 | return false; | 2988 | return false; |
2966 | } | 2989 | } |
2967 | } | 2990 | } |
2968 | 2991 | ||
2969 | /*****************************************************************************/ | 2992 | /*****************************************************************************/ |
2970 | 2993 | ||
2971 | void CalendarView::action_mail() | 2994 | void CalendarView::action_mail() |
2972 | { | 2995 | { |
2973 | #ifndef KORG_NOMAIL | 2996 | #ifndef KORG_NOMAIL |
2974 | KOMailClient mailClient; | 2997 | KOMailClient mailClient; |
2975 | 2998 | ||
2976 | Incidence *incidence = currentSelection(); | 2999 | Incidence *incidence = currentSelection(); |
2977 | 3000 | ||
2978 | if (!incidence) { | 3001 | if (!incidence) { |
2979 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3002 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2980 | return; | 3003 | return; |
2981 | } | 3004 | } |
2982 | if(incidence->attendeeCount() == 0 ) { | 3005 | if(incidence->attendeeCount() == 0 ) { |
2983 | KMessageBox::sorry(this, | 3006 | KMessageBox::sorry(this, |
2984 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3007 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2985 | return; | 3008 | return; |
2986 | } | 3009 | } |
2987 | 3010 | ||
2988 | CalendarLocal cal_tmp; | 3011 | CalendarLocal cal_tmp; |
2989 | Event *event = 0; | 3012 | Event *event = 0; |
2990 | Event *ev = 0; | 3013 | Event *ev = 0; |
2991 | if ( incidence && incidence->type() == "Event" ) { | 3014 | if ( incidence && incidence->type() == "Event" ) { |
2992 | event = static_cast<Event *>(incidence); | 3015 | event = static_cast<Event *>(incidence); |
2993 | ev = new Event(*event); | 3016 | ev = new Event(*event); |
2994 | cal_tmp.addEvent(ev); | 3017 | cal_tmp.addEvent(ev); |
2995 | } | 3018 | } |
2996 | ICalFormat mForm(); | 3019 | ICalFormat mForm(); |
2997 | QString attachment = mForm.toString( &cal_tmp ); | 3020 | QString attachment = mForm.toString( &cal_tmp ); |
2998 | if (ev) delete(ev); | 3021 | if (ev) delete(ev); |
2999 | 3022 | ||
3000 | mailClient.mailAttendees(currentSelection(), attachment); | 3023 | mailClient.mailAttendees(currentSelection(), attachment); |
3001 | 3024 | ||
3002 | #endif | 3025 | #endif |
3003 | 3026 | ||
3004 | #if 0 | 3027 | #if 0 |
3005 | Event *anEvent = 0; | 3028 | Event *anEvent = 0; |
3006 | if (mViewManager->currentView()->isEventView()) { | 3029 | if (mViewManager->currentView()->isEventView()) { |
3007 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3030 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3008 | } | 3031 | } |
3009 | 3032 | ||
3010 | if (!anEvent) { | 3033 | if (!anEvent) { |
3011 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3034 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3012 | return; | 3035 | return; |
3013 | } | 3036 | } |
3014 | if(anEvent->attendeeCount() == 0 ) { | 3037 | if(anEvent->attendeeCount() == 0 ) { |
3015 | KMessageBox::sorry(this, | 3038 | KMessageBox::sorry(this, |
3016 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3039 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3017 | return; | 3040 | return; |
3018 | } | 3041 | } |
3019 | 3042 | ||
3020 | mailobject.emailEvent(anEvent); | 3043 | mailobject.emailEvent(anEvent); |
3021 | #endif | 3044 | #endif |
3022 | } | 3045 | } |
3023 | 3046 | ||
3024 | 3047 | ||
3025 | void CalendarView::schedule_publish(Incidence *incidence) | 3048 | void CalendarView::schedule_publish(Incidence *incidence) |
3026 | { | 3049 | { |
3027 | Event *event = 0; | 3050 | Event *event = 0; |
3028 | Todo *todo = 0; | 3051 | Todo *todo = 0; |
3029 | 3052 | ||
3030 | if (incidence == 0) { | 3053 | if (incidence == 0) { |
3031 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3054 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3032 | if (incidence == 0) { | 3055 | if (incidence == 0) { |
3033 | incidence = mTodoList->selectedIncidences().first(); | 3056 | incidence = mTodoList->selectedIncidences().first(); |
3034 | } | 3057 | } |
3035 | } | 3058 | } |
3036 | if ( incidence && incidence->type() == "Event" ) { | 3059 | if ( incidence && incidence->type() == "Event" ) { |
3037 | event = static_cast<Event *>(incidence); | 3060 | event = static_cast<Event *>(incidence); |
3038 | } else { | 3061 | } else { |
3039 | if ( incidence && incidence->type() == "Todo" ) { | 3062 | if ( incidence && incidence->type() == "Todo" ) { |
3040 | todo = static_cast<Todo *>(incidence); | 3063 | todo = static_cast<Todo *>(incidence); |
3041 | } | 3064 | } |
3042 | } | 3065 | } |
3043 | 3066 | ||
3044 | if (!event && !todo) { | 3067 | if (!event && !todo) { |
3045 | KMessageBox::sorry(this,i18n("No event selected.")); | 3068 | KMessageBox::sorry(this,i18n("No event selected.")); |
3046 | return; | 3069 | return; |
3047 | } | 3070 | } |
3048 | 3071 | ||
3049 | PublishDialog *publishdlg = new PublishDialog(); | 3072 | PublishDialog *publishdlg = new PublishDialog(); |
3050 | if (incidence->attendeeCount()>0) { | 3073 | if (incidence->attendeeCount()>0) { |
3051 | QPtrList<Attendee> attendees = incidence->attendees(); | 3074 | QPtrList<Attendee> attendees = incidence->attendees(); |
3052 | attendees.first(); | 3075 | attendees.first(); |
3053 | while ( attendees.current()!=0 ) { | 3076 | while ( attendees.current()!=0 ) { |
3054 | publishdlg->addAttendee(attendees.current()); | 3077 | publishdlg->addAttendee(attendees.current()); |
3055 | attendees.next(); | 3078 | attendees.next(); |
3056 | } | 3079 | } |
3057 | } | 3080 | } |
3058 | bool send = true; | 3081 | bool send = true; |
3059 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3082 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3060 | if ( publishdlg->exec() != QDialog::Accepted ) | 3083 | if ( publishdlg->exec() != QDialog::Accepted ) |
3061 | send = false; | 3084 | send = false; |
3062 | } | 3085 | } |
3063 | if ( send ) { | 3086 | if ( send ) { |
3064 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3087 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3065 | if ( event ) { | 3088 | if ( event ) { |
3066 | Event *ev = new Event(*event); | 3089 | Event *ev = new Event(*event); |
3067 | ev->registerObserver(0); | 3090 | ev->registerObserver(0); |
3068 | ev->clearAttendees(); | 3091 | ev->clearAttendees(); |
3069 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3092 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3070 | delete(ev); | 3093 | delete(ev); |
3071 | } | 3094 | } |
3072 | } else { | 3095 | } else { |
3073 | if ( todo ) { | 3096 | if ( todo ) { |
3074 | Todo *ev = new Todo(*todo); | 3097 | Todo *ev = new Todo(*todo); |
3075 | ev->registerObserver(0); | 3098 | ev->registerObserver(0); |
3076 | ev->clearAttendees(); | 3099 | ev->clearAttendees(); |
3077 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3100 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3078 | delete(ev); | 3101 | delete(ev); |
3079 | } | 3102 | } |
3080 | } | 3103 | } |
3081 | } | 3104 | } |
3082 | } | 3105 | } |
3083 | delete publishdlg; | 3106 | delete publishdlg; |
3084 | } | 3107 | } |
3085 | 3108 | ||
3086 | void CalendarView::schedule_request(Incidence *incidence) | 3109 | void CalendarView::schedule_request(Incidence *incidence) |
3087 | { | 3110 | { |
3088 | schedule(Scheduler::Request,incidence); | 3111 | schedule(Scheduler::Request,incidence); |
3089 | } | 3112 | } |
3090 | 3113 | ||
3091 | void CalendarView::schedule_refresh(Incidence *incidence) | 3114 | void CalendarView::schedule_refresh(Incidence *incidence) |
3092 | { | 3115 | { |
3093 | schedule(Scheduler::Refresh,incidence); | 3116 | schedule(Scheduler::Refresh,incidence); |
3094 | } | 3117 | } |
3095 | 3118 | ||
3096 | void CalendarView::schedule_cancel(Incidence *incidence) | 3119 | void CalendarView::schedule_cancel(Incidence *incidence) |
3097 | { | 3120 | { |
3098 | schedule(Scheduler::Cancel,incidence); | 3121 | schedule(Scheduler::Cancel,incidence); |
3099 | } | 3122 | } |
3100 | 3123 | ||
3101 | void CalendarView::schedule_add(Incidence *incidence) | 3124 | void CalendarView::schedule_add(Incidence *incidence) |
3102 | { | 3125 | { |
3103 | schedule(Scheduler::Add,incidence); | 3126 | schedule(Scheduler::Add,incidence); |
3104 | } | 3127 | } |
3105 | 3128 | ||
3106 | void CalendarView::schedule_reply(Incidence *incidence) | 3129 | void CalendarView::schedule_reply(Incidence *incidence) |
3107 | { | 3130 | { |
3108 | schedule(Scheduler::Reply,incidence); | 3131 | schedule(Scheduler::Reply,incidence); |
3109 | } | 3132 | } |
3110 | 3133 | ||
3111 | void CalendarView::schedule_counter(Incidence *incidence) | 3134 | void CalendarView::schedule_counter(Incidence *incidence) |
3112 | { | 3135 | { |
3113 | schedule(Scheduler::Counter,incidence); | 3136 | schedule(Scheduler::Counter,incidence); |
3114 | } | 3137 | } |
3115 | 3138 | ||
3116 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3139 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3117 | { | 3140 | { |
3118 | schedule(Scheduler::Declinecounter,incidence); | 3141 | schedule(Scheduler::Declinecounter,incidence); |
3119 | } | 3142 | } |
3120 | 3143 | ||
3121 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3144 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3122 | { | 3145 | { |
3123 | QDateTime start = QDateTime::currentDateTime(); | 3146 | QDateTime start = QDateTime::currentDateTime(); |
3124 | QDateTime end = start.addDays(daysToPublish); | 3147 | QDateTime end = start.addDays(daysToPublish); |
3125 | 3148 | ||
3126 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3149 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3127 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3150 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3128 | 3151 | ||
@@ -3610,192 +3633,209 @@ Todo *CalendarView::selectedTodo() | |||
3610 | return static_cast<Todo *>( incidence ); | 3633 | return static_cast<Todo *>( incidence ); |
3611 | } | 3634 | } |
3612 | 3635 | ||
3613 | incidence = mTodoList->selectedIncidences().first(); | 3636 | incidence = mTodoList->selectedIncidences().first(); |
3614 | if ( incidence && incidence->type() == "Todo" ) { | 3637 | if ( incidence && incidence->type() == "Todo" ) { |
3615 | return static_cast<Todo *>( incidence ); | 3638 | return static_cast<Todo *>( incidence ); |
3616 | } | 3639 | } |
3617 | 3640 | ||
3618 | return 0; | 3641 | return 0; |
3619 | } | 3642 | } |
3620 | 3643 | ||
3621 | void CalendarView::dialogClosing(Incidence *in) | 3644 | void CalendarView::dialogClosing(Incidence *in) |
3622 | { | 3645 | { |
3623 | // mDialogList.remove(in); | 3646 | // mDialogList.remove(in); |
3624 | } | 3647 | } |
3625 | 3648 | ||
3626 | void CalendarView::showIncidence() | 3649 | void CalendarView::showIncidence() |
3627 | { | 3650 | { |
3628 | Incidence *incidence = currentSelection(); | 3651 | Incidence *incidence = currentSelection(); |
3629 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3652 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3630 | if ( incidence ) { | 3653 | if ( incidence ) { |
3631 | ShowIncidenceVisitor v; | 3654 | ShowIncidenceVisitor v; |
3632 | v.act( incidence, this ); | 3655 | v.act( incidence, this ); |
3633 | } | 3656 | } |
3634 | } | 3657 | } |
3635 | void CalendarView::editIncidenceDescription() | 3658 | void CalendarView::editIncidenceDescription() |
3636 | { | 3659 | { |
3637 | mFlagEditDescription = true; | 3660 | mFlagEditDescription = true; |
3638 | editIncidence(); | 3661 | editIncidence(); |
3639 | mFlagEditDescription = false; | 3662 | mFlagEditDescription = false; |
3640 | } | 3663 | } |
3641 | void CalendarView::editIncidence() | 3664 | void CalendarView::editIncidence() |
3642 | { | 3665 | { |
3643 | // qDebug("editIncidence() "); | 3666 | // qDebug("editIncidence() "); |
3644 | Incidence *incidence = currentSelection(); | 3667 | Incidence *incidence = currentSelection(); |
3645 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3668 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3646 | if ( incidence ) { | 3669 | if ( incidence ) { |
3647 | EditIncidenceVisitor v; | 3670 | EditIncidenceVisitor v; |
3648 | v.act( incidence, this ); | 3671 | v.act( incidence, this ); |
3649 | } | 3672 | } |
3650 | } | 3673 | } |
3651 | 3674 | ||
3652 | void CalendarView::deleteIncidence() | 3675 | void CalendarView::deleteIncidence() |
3653 | { | 3676 | { |
3654 | Incidence *incidence = currentSelection(); | 3677 | Incidence *incidence = currentSelection(); |
3655 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3678 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3656 | if ( incidence ) { | 3679 | if ( incidence ) { |
3657 | deleteIncidence(incidence); | 3680 | deleteIncidence(incidence); |
3658 | } | 3681 | } |
3659 | } | 3682 | } |
3660 | 3683 | ||
3661 | void CalendarView::showIncidence(Incidence *incidence) | 3684 | void CalendarView::showIncidence(Incidence *incidence) |
3662 | { | 3685 | { |
3663 | if ( incidence ) { | 3686 | if ( incidence ) { |
3664 | ShowIncidenceVisitor v; | 3687 | ShowIncidenceVisitor v; |
3665 | v.act( incidence, this ); | 3688 | v.act( incidence, this ); |
3666 | } | 3689 | } |
3667 | } | 3690 | } |
3668 | 3691 | ||
3669 | void CalendarView::editIncidence(Incidence *incidence) | 3692 | void CalendarView::editIncidence(Incidence *incidence) |
3670 | { | 3693 | { |
3671 | if ( incidence ) { | 3694 | if ( incidence ) { |
3672 | 3695 | ||
3673 | EditIncidenceVisitor v; | 3696 | EditIncidenceVisitor v; |
3674 | v.act( incidence, this ); | 3697 | v.act( incidence, this ); |
3675 | 3698 | ||
3676 | } | 3699 | } |
3677 | } | 3700 | } |
3678 | 3701 | ||
3679 | void CalendarView::deleteIncidence(Incidence *incidence) | 3702 | void CalendarView::deleteIncidence(Incidence *incidence) |
3680 | { | 3703 | { |
3681 | //qDebug(" CalendarView::deleteIncidence "); | 3704 | //qDebug(" CalendarView::deleteIncidence "); |
3682 | if ( incidence ) { | 3705 | if ( incidence ) { |
3683 | DeleteIncidenceVisitor v; | 3706 | DeleteIncidenceVisitor v; |
3684 | v.act( incidence, this ); | 3707 | v.act( incidence, this ); |
3685 | } | 3708 | } |
3686 | } | 3709 | } |
3687 | 3710 | ||
3688 | 3711 | ||
3689 | void CalendarView::lookForOutgoingMessages() | 3712 | void CalendarView::lookForOutgoingMessages() |
3690 | { | 3713 | { |
3691 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3714 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3692 | ogd->loadMessages(); | 3715 | ogd->loadMessages(); |
3693 | } | 3716 | } |
3694 | 3717 | ||
3695 | void CalendarView::lookForIncomingMessages() | 3718 | void CalendarView::lookForIncomingMessages() |
3696 | { | 3719 | { |
3697 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3720 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3698 | icd->retrieve(); | 3721 | icd->retrieve(); |
3699 | } | 3722 | } |
3700 | 3723 | ||
3701 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3724 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3702 | { | 3725 | { |
3703 | bool deleteTodo = true; | 3726 | bool deleteTodo = true; |
3704 | QPtrList<Incidence> subTodos; | 3727 | QPtrList<Incidence> subTodos; |
3705 | Incidence *aTodo; | 3728 | Incidence *aTodo; |
3706 | subTodos = t->relations(); | 3729 | subTodos = t->relations(); |
3707 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3730 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3708 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3731 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3709 | deleteTodo = false; | 3732 | deleteTodo = false; |
3710 | } | 3733 | } |
3711 | if ( deleteTodo ) { | 3734 | if ( deleteTodo ) { |
3712 | if ( t->isCompleted() ) { | 3735 | if ( t->isCompleted() ) { |
3713 | checkExternalId( t ); | 3736 | checkExternalId( t ); |
3714 | mCalendar->deleteTodo( t ); | 3737 | mCalendar->deleteTodo( t ); |
3715 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3738 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3716 | } | 3739 | } |
3717 | else | 3740 | else |
3718 | deleteTodo = false; | 3741 | deleteTodo = false; |
3719 | } | 3742 | } |
3720 | return deleteTodo; | 3743 | return deleteTodo; |
3721 | 3744 | ||
3722 | } | 3745 | } |
3723 | void CalendarView::purgeCompleted() | 3746 | void CalendarView::purgeCompleted() |
3724 | { | 3747 | { |
3725 | int result = KMessageBox::warningContinueCancel(this, | 3748 | int result = KMessageBox::warningContinueCancel(this, |
3726 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3749 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3727 | 3750 | ||
3728 | if (result == KMessageBox::Continue) { | 3751 | if (result == KMessageBox::Continue) { |
3729 | 3752 | ||
3730 | QPtrList<Todo> todoCal; | 3753 | QPtrList<Todo> todoCal; |
3731 | QPtrList<Todo> rootTodos; | 3754 | QPtrList<Todo> rootTodos; |
3732 | //QPtrList<Incidence> rel; | 3755 | //QPtrList<Incidence> rel; |
3733 | Todo *aTodo;//, *rTodo; | 3756 | Todo *aTodo;//, *rTodo; |
3734 | Incidence *rIncidence; | 3757 | Incidence *rIncidence; |
3735 | bool childDelete = false; | 3758 | bool childDelete = false; |
3736 | bool deletedOne = true; | 3759 | bool deletedOne = true; |
3737 | todoCal = calendar()->todos(); | 3760 | todoCal = calendar()->todos(); |
3738 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3761 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3739 | if ( !aTodo->relatedTo() ) | 3762 | if ( !aTodo->relatedTo() ) |
3740 | rootTodos.append( aTodo ); | 3763 | rootTodos.append( aTodo ); |
3741 | } | 3764 | } |
3742 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3765 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3743 | removeCompletedSubTodos( aTodo ); | 3766 | removeCompletedSubTodos( aTodo ); |
3744 | } | 3767 | } |
3745 | 3768 | ||
3746 | updateView(); | 3769 | updateView(); |
3747 | } | 3770 | } |
3748 | } | 3771 | } |
3749 | 3772 | ||
3750 | void CalendarView::slotCalendarChanged() | 3773 | void CalendarView::slotCalendarChanged() |
3751 | { | 3774 | { |
3752 | ; | 3775 | ; |
3753 | } | 3776 | } |
3754 | 3777 | ||
3755 | NavigatorBar *CalendarView::navigatorBar() | 3778 | NavigatorBar *CalendarView::navigatorBar() |
3756 | { | 3779 | { |
3757 | return mNavigatorBar; | 3780 | return mNavigatorBar; |
3758 | } | 3781 | } |
3759 | 3782 | ||
3760 | 3783 | ||
3761 | 3784 | ||
3762 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3785 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3763 | { | 3786 | { |
3764 | //qDebug(" alendarView::keyPressEvent "); | 3787 | //qDebug(" alendarView::keyPressEvent "); |
3765 | e->ignore(); | 3788 | e->ignore(); |
3766 | } | 3789 | } |
3767 | 3790 | ||
3768 | 3791 | ||
3769 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3792 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3770 | { | 3793 | { |
3771 | // mSyncManager = manager; | 3794 | // mSyncManager = manager; |
3772 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3795 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3773 | qDebug("SyncKDE request detected!"); | 3796 | qDebug("SyncKDE request detected!"); |
3774 | } | 3797 | } |
3775 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3798 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3776 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3799 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3777 | return syncCalendar( filename, mode ); | 3800 | return syncCalendar( filename, mode ); |
3778 | } | 3801 | } |
3779 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3802 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3780 | { | 3803 | { |
3781 | //mSyncManager = manager; | 3804 | //mSyncManager = manager; |
3782 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3805 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3783 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3806 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3784 | if ( resource == "sharp" ) | 3807 | if ( resource == "sharp" ) |
3785 | syncExternal( 0 ); | 3808 | syncExternal( 0 ); |
3786 | if ( resource == "phone" ) | 3809 | if ( resource == "phone" ) |
3787 | syncExternal( 1 ); | 3810 | syncExternal( 1 ); |
3788 | // pending setmodified | 3811 | // pending setmodified |
3789 | return true; | 3812 | return true; |
3790 | } | 3813 | } |
3791 | void CalendarView::setSyncManager(KSyncManager* manager) | 3814 | void CalendarView::setSyncManager(KSyncManager* manager) |
3792 | { | 3815 | { |
3793 | mSyncManager = manager; | 3816 | mSyncManager = manager; |
3794 | } | 3817 | } |
3795 | 3818 | ||
3796 | void CalendarView::removeSyncInfo( QString syncProfile) | 3819 | void CalendarView::removeSyncInfo( QString syncProfile) |
3797 | { | 3820 | { |
3798 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); | 3821 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); |
3799 | mCalendar->removeSyncInfo( syncProfile ); | 3822 | mCalendar->removeSyncInfo( syncProfile ); |
3800 | 3823 | ||
3801 | } | 3824 | } |
3825 | |||
3826 | void CalendarView::undo_delete() | ||
3827 | { | ||
3828 | //qDebug("undo_delete() "); | ||
3829 | Incidence* undo = mCalendar->undoIncidence(); | ||
3830 | if ( !undo ) { | ||
3831 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | ||
3832 | i18n("KO/Pi")); | ||
3833 | return; | ||
3834 | } | ||
3835 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | ||
3836 | i18n("\nAre you sure you want\nto restore this?"), | ||
3837 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | ||
3838 | mCalendar->undoDeleteIncidence(); | ||
3839 | updateView(); | ||
3840 | } | ||
3841 | } | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 437a51c..646973d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -261,345 +261,348 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
261 | /** create new todo */ | 261 | /** create new todo */ |
262 | void newTodo(); | 262 | void newTodo(); |
263 | /** create new todo with a parent todo */ | 263 | /** create new todo with a parent todo */ |
264 | void newSubTodo(); | 264 | void newSubTodo(); |
265 | /** create new todo with a parent todo */ | 265 | /** create new todo with a parent todo */ |
266 | void newSubTodo(Todo *); | 266 | void newSubTodo(Todo *); |
267 | /** Delete todo */ | 267 | /** Delete todo */ |
268 | void deleteTodo(Todo *); | 268 | void deleteTodo(Todo *); |
269 | 269 | ||
270 | 270 | ||
271 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 271 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
272 | * emitted as result. */ | 272 | * emitted as result. */ |
273 | void checkClipboard(); | 273 | void checkClipboard(); |
274 | 274 | ||
275 | /** using the KConfig associated with the kapp variable, read in the | 275 | /** using the KConfig associated with the kapp variable, read in the |
276 | * settings from the config file. | 276 | * settings from the config file. |
277 | */ | 277 | */ |
278 | void readSettings(); | 278 | void readSettings(); |
279 | 279 | ||
280 | /** write current state to config file. */ | 280 | /** write current state to config file. */ |
281 | void writeSettings(); | 281 | void writeSettings(); |
282 | 282 | ||
283 | /** read settings for calendar filters */ | 283 | /** read settings for calendar filters */ |
284 | void readFilterSettings(KConfig *config); | 284 | void readFilterSettings(KConfig *config); |
285 | 285 | ||
286 | /** write settings for calendar filters */ | 286 | /** write settings for calendar filters */ |
287 | void writeFilterSettings(KConfig *config); | 287 | void writeFilterSettings(KConfig *config); |
288 | 288 | ||
289 | /** passes on the message that an event has changed to the currently | 289 | /** passes on the message that an event has changed to the currently |
290 | * activated view so that it can make appropriate display changes. */ | 290 | * activated view so that it can make appropriate display changes. */ |
291 | void changeEventDisplay(Event *, int); | 291 | void changeEventDisplay(Event *, int); |
292 | void changeIncidenceDisplay(Incidence *, int); | 292 | void changeIncidenceDisplay(Incidence *, int); |
293 | void changeTodoDisplay(Todo *, int); | 293 | void changeTodoDisplay(Todo *, int); |
294 | 294 | ||
295 | void eventAdded(Event *); | 295 | void eventAdded(Event *); |
296 | void eventChanged(Event *); | 296 | void eventChanged(Event *); |
297 | void eventToBeDeleted(Event *); | 297 | void eventToBeDeleted(Event *); |
298 | void eventDeleted(); | 298 | void eventDeleted(); |
299 | 299 | ||
300 | void todoAdded(Todo *); | 300 | void todoAdded(Todo *); |
301 | void todoChanged(Todo *); | 301 | void todoChanged(Todo *); |
302 | void todoToBeDeleted(Todo *); | 302 | void todoToBeDeleted(Todo *); |
303 | void todoDeleted(); | 303 | void todoDeleted(); |
304 | 304 | ||
305 | void updateView(const QDate &start, const QDate &end); | 305 | void updateView(const QDate &start, const QDate &end); |
306 | void updateView(); | 306 | void updateView(); |
307 | 307 | ||
308 | /** Full update of visible todo views */ | 308 | /** Full update of visible todo views */ |
309 | void updateTodoViews(); | 309 | void updateTodoViews(); |
310 | 310 | ||
311 | void updateUnmanagedViews(); | 311 | void updateUnmanagedViews(); |
312 | 312 | ||
313 | /** cut the current appointment to the clipboard */ | 313 | /** cut the current appointment to the clipboard */ |
314 | void edit_cut(); | 314 | void edit_cut(); |
315 | 315 | ||
316 | /** copy the current appointment(s) to the clipboard */ | 316 | /** copy the current appointment(s) to the clipboard */ |
317 | void edit_copy(); | 317 | void edit_copy(); |
318 | 318 | ||
319 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 319 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
320 | void edit_paste(); | 320 | void edit_paste(); |
321 | 321 | ||
322 | /** edit viewing and configuration options. */ | 322 | /** edit viewing and configuration options. */ |
323 | void edit_options(); | 323 | void edit_options(); |
324 | /** | 324 | /** |
325 | Functions for printing, previewing a print, and setting up printing | 325 | Functions for printing, previewing a print, and setting up printing |
326 | parameters. | 326 | parameters. |
327 | */ | 327 | */ |
328 | void print(); | 328 | void print(); |
329 | void printSetup(); | 329 | void printSetup(); |
330 | void printPreview(); | 330 | void printPreview(); |
331 | 331 | ||
332 | /** Export as iCalendar file */ | 332 | /** Export as iCalendar file */ |
333 | void exportICalendar(); | 333 | void exportICalendar(); |
334 | 334 | ||
335 | /** Export as vCalendar file */ | 335 | /** Export as vCalendar file */ |
336 | bool exportVCalendar( QString fn); | 336 | bool exportVCalendar( QString fn); |
337 | 337 | ||
338 | /** pop up a dialog to show an existing appointment. */ | 338 | /** pop up a dialog to show an existing appointment. */ |
339 | void appointment_show(); | 339 | void appointment_show(); |
340 | /** | 340 | /** |
341 | * pop up an Appointment Dialog to edit an existing appointment.Get | 341 | * pop up an Appointment Dialog to edit an existing appointment.Get |
342 | * information on the appointment from the list of unique IDs that is | 342 | * information on the appointment from the list of unique IDs that is |
343 | * currently in the View, called currIds. | 343 | * currently in the View, called currIds. |
344 | */ | 344 | */ |
345 | void appointment_edit(); | 345 | void appointment_edit(); |
346 | /** | 346 | /** |
347 | * pop up dialog confirming deletion of currently selected event in the | 347 | * pop up dialog confirming deletion of currently selected event in the |
348 | * View. | 348 | * View. |
349 | */ | 349 | */ |
350 | void appointment_delete(); | 350 | void appointment_delete(); |
351 | 351 | ||
352 | /** mails the currently selected event to a particular user as a vCalendar | 352 | /** mails the currently selected event to a particular user as a vCalendar |
353 | attachment. */ | 353 | attachment. */ |
354 | void action_mail(); | 354 | void action_mail(); |
355 | 355 | ||
356 | /* frees a subtodo from it's relation */ | 356 | /* frees a subtodo from it's relation */ |
357 | void todo_unsub( Todo * ); | 357 | void todo_unsub( Todo * ); |
358 | void todo_resub( Todo * parent, Todo * sub ); | 358 | void todo_resub( Todo * parent, Todo * sub ); |
359 | 359 | ||
360 | /** Take ownership of selected event. */ | 360 | /** Take ownership of selected event. */ |
361 | void takeOverEvent(); | 361 | void takeOverEvent(); |
362 | 362 | ||
363 | /** Take ownership of all events in calendar. */ | 363 | /** Take ownership of all events in calendar. */ |
364 | void takeOverCalendar(); | 364 | void takeOverCalendar(); |
365 | 365 | ||
366 | /** query whether or not the calendar is "dirty". */ | 366 | /** query whether or not the calendar is "dirty". */ |
367 | bool isModified(); | 367 | bool isModified(); |
368 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 368 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
369 | void setModified(bool modified=true); | 369 | void setModified(bool modified=true); |
370 | 370 | ||
371 | /** query if the calendar is read-only. */ | 371 | /** query if the calendar is read-only. */ |
372 | bool isReadOnly(); | 372 | bool isReadOnly(); |
373 | /** set state of calendar to read-only */ | 373 | /** set state of calendar to read-only */ |
374 | void setReadOnly(bool readOnly=true); | 374 | void setReadOnly(bool readOnly=true); |
375 | 375 | ||
376 | void eventUpdated(Incidence *); | 376 | void eventUpdated(Incidence *); |
377 | 377 | ||
378 | /* iTIP scheduling actions */ | 378 | /* iTIP scheduling actions */ |
379 | void schedule_publish(Incidence *incidence = 0); | 379 | void schedule_publish(Incidence *incidence = 0); |
380 | void schedule_request(Incidence *incidence = 0); | 380 | void schedule_request(Incidence *incidence = 0); |
381 | void schedule_refresh(Incidence *incidence = 0); | 381 | void schedule_refresh(Incidence *incidence = 0); |
382 | void schedule_cancel(Incidence *incidence = 0); | 382 | void schedule_cancel(Incidence *incidence = 0); |
383 | void schedule_add(Incidence *incidence = 0); | 383 | void schedule_add(Incidence *incidence = 0); |
384 | void schedule_reply(Incidence *incidence = 0); | 384 | void schedule_reply(Incidence *incidence = 0); |
385 | void schedule_counter(Incidence *incidence = 0); | 385 | void schedule_counter(Incidence *incidence = 0); |
386 | void schedule_declinecounter(Incidence *incidence = 0); | 386 | void schedule_declinecounter(Incidence *incidence = 0); |
387 | void schedule_publish_freebusy(int daysToPublish = 30); | 387 | void schedule_publish_freebusy(int daysToPublish = 30); |
388 | 388 | ||
389 | void openAddressbook(); | 389 | void openAddressbook(); |
390 | 390 | ||
391 | void editFilters(); | 391 | void editFilters(); |
392 | void toggleFilerEnabled(); | 392 | void toggleFilerEnabled(); |
393 | QPtrList<CalFilter> filters(); | 393 | QPtrList<CalFilter> filters(); |
394 | void toggleFilter(); | 394 | void toggleFilter(); |
395 | void showFilter(bool visible); | 395 | void showFilter(bool visible); |
396 | void updateFilter(); | 396 | void updateFilter(); |
397 | void filterEdited(); | 397 | void filterEdited(); |
398 | void selectFilter( int ); | 398 | void selectFilter( int ); |
399 | KOFilterView *filterView(); | 399 | KOFilterView *filterView(); |
400 | 400 | ||
401 | void showIntro(); | 401 | void showIntro(); |
402 | 402 | ||
403 | /** Move the curdatepient view date to today */ | 403 | /** Move the curdatepient view date to today */ |
404 | void goToday(); | 404 | void goToday(); |
405 | 405 | ||
406 | /** Move to the next date(s) in the current view */ | 406 | /** Move to the next date(s) in the current view */ |
407 | void goNext(); | 407 | void goNext(); |
408 | 408 | ||
409 | /** Move to the previous date(s) in the current view */ | 409 | /** Move to the previous date(s) in the current view */ |
410 | void goPrevious(); | 410 | void goPrevious(); |
411 | /** Move to the next date(s) in the current view */ | 411 | /** Move to the next date(s) in the current view */ |
412 | void goNextMonth(); | 412 | void goNextMonth(); |
413 | 413 | ||
414 | /** Move to the previous date(s) in the current view */ | 414 | /** Move to the previous date(s) in the current view */ |
415 | void goPreviousMonth(); | 415 | void goPreviousMonth(); |
416 | 416 | ||
417 | void toggleExpand(); | 417 | void toggleExpand(); |
418 | void toggleDateNavigatorWidget(); | 418 | void toggleDateNavigatorWidget(); |
419 | void toggleAllDaySize(); | 419 | void toggleAllDaySize(); |
420 | void dialogClosing(Incidence *); | 420 | void dialogClosing(Incidence *); |
421 | 421 | ||
422 | /** Look for new messages in the inbox */ | 422 | /** Look for new messages in the inbox */ |
423 | void lookForIncomingMessages(); | 423 | void lookForIncomingMessages(); |
424 | /** Look for new messages in the outbox */ | 424 | /** Look for new messages in the outbox */ |
425 | void lookForOutgoingMessages(); | 425 | void lookForOutgoingMessages(); |
426 | 426 | ||
427 | void processMainViewSelection( Incidence * ); | 427 | void processMainViewSelection( Incidence * ); |
428 | void processTodoListSelection( Incidence * ); | 428 | void processTodoListSelection( Incidence * ); |
429 | 429 | ||
430 | void processIncidenceSelection( Incidence * ); | 430 | void processIncidenceSelection( Incidence * ); |
431 | 431 | ||
432 | void purgeCompleted(); | 432 | void purgeCompleted(); |
433 | bool removeCompletedSubTodos( Todo* ); | 433 | bool removeCompletedSubTodos( Todo* ); |
434 | void slotCalendarChanged(); | 434 | void slotCalendarChanged(); |
435 | bool importBday(); | 435 | bool importBday(); |
436 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 436 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
437 | bool importQtopia( const QString &categoriesFile, | 437 | bool importQtopia( const QString &categoriesFile, |
438 | const QString &datebookFile, | 438 | const QString &datebookFile, |
439 | const QString &tasklistFile ); | 439 | const QString &tasklistFile ); |
440 | void syncExternal( int mode ); | 440 | void syncExternal( int mode ); |
441 | void slotSelectPickerDate( QDate ) ; | 441 | void slotSelectPickerDate( QDate ) ; |
442 | void showDatePicker( ) ; | 442 | void showDatePicker( ) ; |
443 | void moveIncidence(Incidence *) ; | 443 | void moveIncidence(Incidence *) ; |
444 | void beamIncidence(Incidence *) ; | 444 | void beamIncidence(Incidence *) ; |
445 | void beamCalendar() ; | 445 | void beamCalendar() ; |
446 | void beamFilteredCalendar() ; | 446 | void beamFilteredCalendar() ; |
447 | void beamIncidenceList(QPtrList<Incidence>) ; | 447 | void beamIncidenceList(QPtrList<Incidence>) ; |
448 | void manageCategories(); | 448 | void manageCategories(); |
449 | int addCategories(); | 449 | int addCategories(); |
450 | void removeCategories(); | 450 | void removeCategories(); |
451 | void setSyncDevice( QString ); | 451 | void setSyncDevice( QString ); |
452 | void setSyncName( QString ); | 452 | void setSyncName( QString ); |
453 | void showDay( QDate ); | ||
454 | void undo_delete(); | ||
453 | protected slots: | 455 | protected slots: |
454 | void timerAlarm(); | 456 | void timerAlarm(); |
455 | void suspendAlarm(); | 457 | void suspendAlarm(); |
456 | void beamDone( Ir *ir ); | 458 | void beamDone( Ir *ir ); |
457 | /** Select a view or adapt the current view to display the specified dates. */ | 459 | /** Select a view or adapt the current view to display the specified dates. */ |
458 | void showDates( const KCal::DateList & ); | 460 | void showDates( const KCal::DateList & ); |
459 | void selectWeekNum ( int ); | 461 | void selectWeekNum ( int ); |
460 | 462 | ||
461 | public: | 463 | public: |
462 | // show a standard warning | 464 | // show a standard warning |
463 | // returns KMsgBox::yesNoCancel() | 465 | // returns KMsgBox::yesNoCancel() |
464 | int msgCalModified(); | 466 | int msgCalModified(); |
465 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 467 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
466 | 468 | ||
467 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 469 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
468 | virtual void removeSyncInfo( QString syncProfile); | 470 | virtual void removeSyncInfo( QString syncProfile); |
469 | void setSyncManager(KSyncManager* manager); | 471 | void setSyncManager(KSyncManager* manager); |
470 | void setLoadedFileVersion(QDateTime); | 472 | void setLoadedFileVersion(QDateTime); |
471 | bool checkFileVersion(QString fn); | 473 | bool checkFileVersion(QString fn); |
472 | bool checkFileChanged(QString fn); | 474 | bool checkFileChanged(QString fn); |
473 | Event* getLastSyncEvent(); | 475 | Event* getLastSyncEvent(); |
474 | /** Adapt navigation units correpsonding to step size of navigation of the | 476 | /** Adapt navigation units correpsonding to step size of navigation of the |
475 | * current view. | 477 | * current view. |
476 | */ | 478 | */ |
477 | void adaptNavigationUnits(); | 479 | void adaptNavigationUnits(); |
478 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 480 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
479 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 481 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
480 | //Attendee* getYourAttendee(Event *event); | 482 | //Attendee* getYourAttendee(Event *event); |
481 | protected: | 483 | protected: |
482 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 484 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
483 | 485 | ||
484 | // returns KMsgBox::OKCandel() | 486 | // returns KMsgBox::OKCandel() |
485 | int msgItemDelete(); | 487 | int msgItemDelete(); |
486 | void showEventEditor(); | 488 | void showEventEditor(); |
487 | void showTodoEditor(); | 489 | void showTodoEditor(); |
488 | void writeLocale(); | 490 | void writeLocale(); |
489 | Todo *selectedTodo(); | 491 | Todo *selectedTodo(); |
490 | 492 | ||
491 | private: | 493 | private: |
492 | KSyncManager* mSyncManager; | 494 | KSyncManager* mSyncManager; |
493 | AlarmDialog * mAlarmDialog; | 495 | AlarmDialog * mAlarmDialog; |
494 | QString mAlarmNotification; | 496 | QString mAlarmNotification; |
495 | QString mSuspendAlarmNotification; | 497 | QString mSuspendAlarmNotification; |
496 | QTimer* mSuspendTimer; | 498 | QTimer* mSuspendTimer; |
497 | QTimer* mAlarmTimer; | 499 | QTimer* mAlarmTimer; |
498 | QTimer* mRecheckAlarmTimer; | 500 | QTimer* mRecheckAlarmTimer; |
499 | void computeAlarm( QString ); | 501 | void computeAlarm( QString ); |
500 | void startAlarm( QString, QString ); | 502 | void startAlarm( QString, QString ); |
501 | void setSyncEventsReadOnly(); | 503 | void setSyncEventsReadOnly(); |
502 | 504 | ||
503 | QDateTime loadedFileVersion; | 505 | QDateTime loadedFileVersion; |
504 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 506 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
505 | void checkExternalId( Incidence * inc ); | 507 | void checkExternalId( Incidence * inc ); |
506 | int mGlobalSyncMode; | 508 | int mGlobalSyncMode; |
507 | QString mCurrentSyncDevice; | 509 | QString mCurrentSyncDevice; |
508 | QString mCurrentSyncName; | 510 | QString mCurrentSyncName; |
509 | KOBeamPrefs* beamDialog; | 511 | KOBeamPrefs* beamDialog; |
510 | void init(); | 512 | void init(); |
511 | int mDatePickerMode; | 513 | int mDatePickerMode; |
512 | bool mFlagEditDescription; | 514 | bool mFlagEditDescription; |
513 | QDateTime mLastCalendarSync; | 515 | QDateTime mLastCalendarSync; |
514 | void createPrinter(); | 516 | void createPrinter(); |
515 | 517 | ||
516 | void calendarModified( bool, Calendar * ); | 518 | void calendarModified( bool, Calendar * ); |
517 | 519 | ||
518 | CalPrinter *mCalPrinter; | 520 | CalPrinter *mCalPrinter; |
519 | 521 | ||
520 | QSplitter *mPanner; | 522 | QSplitter *mPanner; |
521 | QSplitter *mLeftSplitter; | 523 | QSplitter *mLeftSplitter; |
522 | QWidget *mLeftFrame; | 524 | QWidget *mLeftFrame; |
523 | QWidgetStack *mRightFrame; | 525 | QWidgetStack *mRightFrame; |
524 | 526 | ||
525 | KDatePicker* mDatePicker; | 527 | KDatePicker* mDatePicker; |
526 | QVBox* mDateFrame; | 528 | QVBox* mDateFrame; |
527 | NavigatorBar *mNavigatorBar; | 529 | NavigatorBar *mNavigatorBar; |
528 | 530 | ||
529 | KDateNavigator *mDateNavigator; // widget showing small month view. | 531 | KDateNavigator *mDateNavigator; // widget showing small month view. |
530 | 532 | ||
531 | KOFilterView *mFilterView; | 533 | KOFilterView *mFilterView; |
532 | 534 | ||
533 | ResourceView *mResourceView; | 535 | ResourceView *mResourceView; |
534 | 536 | ||
535 | // calendar object for this viewing instance | 537 | // calendar object for this viewing instance |
536 | Calendar *mCalendar; | 538 | Calendar *mCalendar; |
537 | 539 | ||
538 | CalendarResourceManager *mResourceManager; | 540 | CalendarResourceManager *mResourceManager; |
539 | 541 | ||
540 | FileStorage *mStorage; | 542 | FileStorage *mStorage; |
541 | 543 | ||
542 | DateNavigator *mNavigator; | 544 | DateNavigator *mNavigator; |
543 | 545 | ||
544 | KOViewManager *mViewManager; | 546 | KOViewManager *mViewManager; |
545 | KODialogManager *mDialogManager; | 547 | KODialogManager *mDialogManager; |
546 | 548 | ||
547 | // Calendar filters | 549 | // Calendar filters |
548 | QPtrList<CalFilter> mFilters; | 550 | QPtrList<CalFilter> mFilters; |
549 | 551 | ||
550 | // various housekeeping variables. | 552 | // various housekeeping variables. |
551 | bool mModified; // flag indicating if calendar is modified | 553 | bool mModified; // flag indicating if calendar is modified |
552 | bool mReadOnly; // flag indicating if calendar is read-only | 554 | bool mReadOnly; // flag indicating if calendar is read-only |
553 | QDate mSaveSingleDate; | 555 | QDate mSaveSingleDate; |
554 | 556 | ||
555 | Incidence *mSelectedIncidence; | 557 | Incidence *mSelectedIncidence; |
556 | Incidence *mMoveIncidence; | 558 | Incidence *mMoveIncidence; |
559 | QDate mMoveIncidenceOldDate; | ||
557 | KOTodoView *mTodoList; | 560 | KOTodoView *mTodoList; |
558 | KOEventEditor * mEventEditor; | 561 | KOEventEditor * mEventEditor; |
559 | KOTodoEditor * mTodoEditor; | 562 | KOTodoEditor * mTodoEditor; |
560 | KOEventViewerDialog * mEventViewerDialog; | 563 | KOEventViewerDialog * mEventViewerDialog; |
561 | void keyPressEvent ( QKeyEvent *e) ; | 564 | void keyPressEvent ( QKeyEvent *e) ; |
562 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 565 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
563 | }; | 566 | }; |
564 | 567 | ||
565 | 568 | ||
566 | class CalendarViewVisitor : public Incidence::Visitor | 569 | class CalendarViewVisitor : public Incidence::Visitor |
567 | { | 570 | { |
568 | public: | 571 | public: |
569 | CalendarViewVisitor() : mView( 0 ) {} | 572 | CalendarViewVisitor() : mView( 0 ) {} |
570 | 573 | ||
571 | bool act( Incidence *incidence, CalendarView *view ) | 574 | bool act( Incidence *incidence, CalendarView *view ) |
572 | { | 575 | { |
573 | mView = view; | 576 | mView = view; |
574 | return incidence->accept( *this ); | 577 | return incidence->accept( *this ); |
575 | } | 578 | } |
576 | 579 | ||
577 | protected: | 580 | protected: |
578 | CalendarView *mView; | 581 | CalendarView *mView; |
579 | }; | 582 | }; |
580 | 583 | ||
581 | class ShowIncidenceVisitor : public CalendarViewVisitor | 584 | class ShowIncidenceVisitor : public CalendarViewVisitor |
582 | { | 585 | { |
583 | protected: | 586 | protected: |
584 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 587 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
585 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 588 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
586 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 589 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
587 | }; | 590 | }; |
588 | 591 | ||
589 | class EditIncidenceVisitor : public CalendarViewVisitor | 592 | class EditIncidenceVisitor : public CalendarViewVisitor |
590 | { | 593 | { |
591 | protected: | 594 | protected: |
592 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 595 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
593 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 596 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
594 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 597 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
595 | }; | 598 | }; |
596 | 599 | ||
597 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 600 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
598 | { | 601 | { |
599 | protected: | 602 | protected: |
600 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 603 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
601 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 604 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
602 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 605 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
603 | }; | 606 | }; |
604 | 607 | ||
605 | #endif | 608 | #endif |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index f027343..46184ac 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,355 +1,357 @@ | |||
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 <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
60 | const char *name,WFlags) : | 60 | const char *name,WFlags) : |
61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
62 | { | 62 | { |
63 | #ifndef DESKTOP_VERSION | 63 | #ifndef DESKTOP_VERSION |
64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
65 | #endif | 65 | #endif |
66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
67 | setWFlags ( wflags); | 67 | setWFlags ( wflags); |
68 | mAllDay = allday; | 68 | mAllDay = allday; |
69 | init ( incidence, qd ); | 69 | init ( incidence, qd ); |
70 | setMouseTracking(true); | 70 | setMouseTracking(true); |
71 | //setAcceptDrops(true); | 71 | //setAcceptDrops(true); |
72 | xPaintCoord = -1; | 72 | xPaintCoord = -1; |
73 | yPaintCoord = -1; | 73 | yPaintCoord = -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
77 | { | 77 | { |
78 | mIncidence = incidence; | 78 | mIncidence = incidence; |
79 | mDate = qd; | 79 | mDate = qd; |
80 | mFirstMultiItem = 0; | 80 | mFirstMultiItem = 0; |
81 | mNextMultiItem = 0; | 81 | mNextMultiItem = 0; |
82 | mLastMultiItem = 0; | 82 | mLastMultiItem = 0; |
83 | computeText(); | 83 | computeText(); |
84 | 84 | ||
85 | if ( (incidence->type() == "Todo") && | 85 | if ( (incidence->type() == "Todo") && |
86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
90 | else | 90 | else |
91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | QStringList categories = mIncidence->categories(); | 94 | QStringList categories = mIncidence->categories(); |
95 | QString cat = categories.first(); | 95 | QString cat = categories.first(); |
96 | if (cat.isEmpty()) { | 96 | if (cat.isEmpty()) { |
97 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 97 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
98 | } else { | 98 | } else { |
99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 102 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
103 | mBackgroundColor.dark(),mBackgroundColor.light(), | 103 | mBackgroundColor.dark(),mBackgroundColor.light(), |
104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
105 | setBackgroundColor( mBackgroundColor ); | 105 | setBackgroundColor( mBackgroundColor ); |
106 | 106 | ||
107 | setCellXY(0,0,1); | 107 | setCellXY(0,0,1); |
108 | setCellXWidth(0); | 108 | setCellXWidth(0); |
109 | setSubCell(0); | 109 | setSubCell(0); |
110 | setSubCells(1); | 110 | setSubCells(1); |
111 | setMultiItem(0,0,0); | 111 | setMultiItem(0,0,0); |
112 | startMove(); | 112 | startMove(); |
113 | mSelected = true; | 113 | mSelected = true; |
114 | select(false); | 114 | select(false); |
115 | QString tipText = mIncidence->summary(); | 115 | QString tipText = mIncidence->summary(); |
116 | // QToolTip::add(this,tipText); | 116 | // QToolTip::add(this,tipText); |
117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
118 | if ( !mIncidence->doesFloat() ) | 118 | if ( !mIncidence->doesFloat() ) |
119 | if ( mIncidence->type() == "Event" ) { | 119 | if ( mIncidence->type() == "Event" ) { |
120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
123 | } | 123 | } |
124 | else { | 124 | else { |
125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | else if ( mIncidence->type() == "Todo" ) { | 129 | else if ( mIncidence->type() == "Todo" ) { |
130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); | 130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); |
131 | } | 131 | } |
132 | 132 | ||
133 | if (!mIncidence->location().isEmpty()) { | 133 | if (!mIncidence->location().isEmpty()) { |
134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
135 | } | 135 | } |
136 | QToolTip::add(this,tipText,toolTipGroup(),""); | 136 | QToolTip::add(this,tipText,toolTipGroup(),""); |
137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
138 | mFontPixelSize = fontinf.height();; | 138 | mFontPixelSize = fontinf.height();; |
139 | hide(); | 139 | hide(); |
140 | xPaintCoord = -1; | 140 | xPaintCoord = -1; |
141 | yPaintCoord = -1; | 141 | yPaintCoord = -1; |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | KOAgendaItem::~KOAgendaItem() | 145 | KOAgendaItem::~KOAgendaItem() |
146 | { | 146 | { |
147 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 147 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
148 | 148 | ||
149 | } | 149 | } |
150 | 150 | ||
151 | void KOAgendaItem::recreateIncidence() | 151 | void KOAgendaItem::recreateIncidence() |
152 | { | 152 | { |
153 | #if 0 | ||
153 | Incidence* newInc = mIncidence->clone(); | 154 | Incidence* newInc = mIncidence->clone(); |
154 | newInc->recreate(); | 155 | newInc->recreate(); |
155 | if ( mIncidence->doesRecur() ) { | 156 | if ( mIncidence->doesRecur() ) { |
156 | mIncidence->addExDate( mDate ); | 157 | mIncidence->addExDate( mDate ); |
157 | newInc->recurrence()->unsetRecurs(); | 158 | newInc->recurrence()->unsetRecurs(); |
158 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 159 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
159 | QTime tim = mIncidence->dtStart().time(); | 160 | QTime tim = mIncidence->dtStart().time(); |
160 | newInc->setDtStart( QDateTime(mDate, tim) ); | 161 | newInc->setDtStart( QDateTime(mDate, tim) ); |
161 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 162 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
162 | } | 163 | } |
163 | mIncidence = newInc; | 164 | #endif |
165 | mIncidence = mIncidence->recreateCloneException( mDate ); | ||
164 | } | 166 | } |
165 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 167 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
166 | { | 168 | { |
167 | int size = AGENDA_ICON_SIZE; | 169 | int size = AGENDA_ICON_SIZE; |
168 | 170 | ||
169 | int yOff = 0; | 171 | int yOff = 0; |
170 | int xOff = 0; | 172 | int xOff = 0; |
171 | int x = pos().x() +3; | 173 | int x = pos().x() +3; |
172 | int y; | 174 | int y; |
173 | if ( mAllDay ) | 175 | if ( mAllDay ) |
174 | y = pos().y()+3; | 176 | y = pos().y()+3; |
175 | else | 177 | else |
176 | y = mCellYTop * ( height() / cellHeight() ) +3; | 178 | y = mCellYTop * ( height() / cellHeight() ) +3; |
177 | if (mIncidence->cancelled()) { | 179 | if (mIncidence->cancelled()) { |
178 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 180 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
179 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 181 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
180 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 182 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
181 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 183 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
182 | if ( horLayout ) | 184 | if ( horLayout ) |
183 | ++xOff; | 185 | ++xOff; |
184 | else | 186 | else |
185 | ++yOff; | 187 | ++yOff; |
186 | } | 188 | } |
187 | if (mIncidence->isAlarmEnabled()) { | 189 | if (mIncidence->isAlarmEnabled()) { |
188 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 190 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
189 | if ( horLayout ) | 191 | if ( horLayout ) |
190 | ++xOff; | 192 | ++xOff; |
191 | else | 193 | else |
192 | ++yOff; | 194 | ++yOff; |
193 | } | 195 | } |
194 | if (mIncidence->recurrence()->doesRecur()) { | 196 | if (mIncidence->recurrence()->doesRecur()) { |
195 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 197 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
196 | if ( horLayout ) | 198 | if ( horLayout ) |
197 | ++xOff; | 199 | ++xOff; |
198 | else | 200 | else |
199 | ++yOff; | 201 | ++yOff; |
200 | } | 202 | } |
201 | if (mIncidence->description().length() > 0) { | 203 | if (mIncidence->description().length() > 0) { |
202 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 204 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
203 | if ( horLayout ) | 205 | if ( horLayout ) |
204 | ++xOff; | 206 | ++xOff; |
205 | else | 207 | else |
206 | ++yOff; | 208 | ++yOff; |
207 | } | 209 | } |
208 | if (mIncidence->isReadOnly()) { | 210 | if (mIncidence->isReadOnly()) { |
209 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 211 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
210 | if ( horLayout ) | 212 | if ( horLayout ) |
211 | ++xOff; | 213 | ++xOff; |
212 | else | 214 | else |
213 | ++yOff; | 215 | ++yOff; |
214 | } | 216 | } |
215 | 217 | ||
216 | if (mIncidence->attendeeCount()>0) { | 218 | if (mIncidence->attendeeCount()>0) { |
217 | 219 | ||
218 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 220 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
219 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 221 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
220 | if ( horLayout ) | 222 | if ( horLayout ) |
221 | ++xOff; | 223 | ++xOff; |
222 | else | 224 | else |
223 | ++yOff; | 225 | ++yOff; |
224 | } else { | 226 | } else { |
225 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 227 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
226 | if (me!=0) { | 228 | if (me!=0) { |
227 | 229 | ||
228 | 230 | ||
229 | } else { | 231 | } else { |
230 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 232 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
231 | if ( horLayout ) | 233 | if ( horLayout ) |
232 | ++xOff; | 234 | ++xOff; |
233 | else | 235 | else |
234 | ++yOff; | 236 | ++yOff; |
235 | 237 | ||
236 | } | 238 | } |
237 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 239 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
238 | if ( horLayout ) | 240 | if ( horLayout ) |
239 | ++xOff; | 241 | ++xOff; |
240 | else | 242 | else |
241 | ++yOff; | 243 | ++yOff; |
242 | 244 | ||
243 | } | 245 | } |
244 | 246 | ||
245 | } | 247 | } |
246 | return ( yOff || xOff ); | 248 | return ( yOff || xOff ); |
247 | } | 249 | } |
248 | 250 | ||
249 | 251 | ||
250 | void KOAgendaItem::select(bool selected) | 252 | void KOAgendaItem::select(bool selected) |
251 | { | 253 | { |
252 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 254 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
253 | if (mSelected == selected) return; | 255 | if (mSelected == selected) return; |
254 | mSelected = selected; | 256 | mSelected = selected; |
255 | if ( ! isVisible() ) | 257 | if ( ! isVisible() ) |
256 | return; | 258 | return; |
257 | if ( firstMultiItem() ) | 259 | if ( firstMultiItem() ) |
258 | firstMultiItem()->select( selected ); | 260 | firstMultiItem()->select( selected ); |
259 | if ( !firstMultiItem() && nextMultiItem() ) { | 261 | if ( !firstMultiItem() && nextMultiItem() ) { |
260 | KOAgendaItem * placeItem = nextMultiItem(); | 262 | KOAgendaItem * placeItem = nextMultiItem(); |
261 | while ( placeItem ) { | 263 | while ( placeItem ) { |
262 | placeItem->select( selected ); | 264 | placeItem->select( selected ); |
263 | placeItem = placeItem->nextMultiItem(); | 265 | placeItem = placeItem->nextMultiItem(); |
264 | } | 266 | } |
265 | } | 267 | } |
266 | globalFlagBlockAgendaItemUpdate = 0; | 268 | globalFlagBlockAgendaItemUpdate = 0; |
267 | paintMe( selected ); | 269 | paintMe( selected ); |
268 | globalFlagBlockAgendaItemUpdate = 1; | 270 | globalFlagBlockAgendaItemUpdate = 1; |
269 | repaint( false ); | 271 | repaint( false ); |
270 | } | 272 | } |
271 | 273 | ||
272 | 274 | ||
273 | /* | 275 | /* |
274 | The eventFilter has to filter the mouse events of the agenda item childs. The | 276 | The eventFilter has to filter the mouse events of the agenda item childs. The |
275 | events are fed into the event handling method of KOAgendaItem. This allows the | 277 | events are fed into the event handling method of KOAgendaItem. This allows the |
276 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 278 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
277 | */ | 279 | */ |
278 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 280 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
279 | { | 281 | { |
280 | if (e->type() == QEvent::MouseButtonPress || | 282 | if (e->type() == QEvent::MouseButtonPress || |
281 | e->type() == QEvent::MouseButtonDblClick || | 283 | e->type() == QEvent::MouseButtonDblClick || |
282 | e->type() == QEvent::MouseButtonRelease || | 284 | e->type() == QEvent::MouseButtonRelease || |
283 | e->type() == QEvent::MouseMove) { | 285 | e->type() == QEvent::MouseMove) { |
284 | QMouseEvent *me = (QMouseEvent *)e; | 286 | QMouseEvent *me = (QMouseEvent *)e; |
285 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 287 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
286 | mapToGlobal(me->pos())); | 288 | mapToGlobal(me->pos())); |
287 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 289 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
288 | return event(&returnEvent); | 290 | return event(&returnEvent); |
289 | } else { | 291 | } else { |
290 | return false; | 292 | return false; |
291 | } | 293 | } |
292 | } | 294 | } |
293 | void KOAgendaItem::repaintMe( ) | 295 | void KOAgendaItem::repaintMe( ) |
294 | { | 296 | { |
295 | paintMe ( mSelected ); | 297 | paintMe ( mSelected ); |
296 | } | 298 | } |
297 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 299 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
298 | { | 300 | { |
299 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 301 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
300 | return; | 302 | return; |
301 | QPainter pa; | 303 | QPainter pa; |
302 | 304 | ||
303 | if ( mSelected ) { | 305 | if ( mSelected ) { |
304 | pa.begin( paintPixSel() ); | 306 | pa.begin( paintPixSel() ); |
305 | } else { | 307 | } else { |
306 | if ( mAllDay ) | 308 | if ( mAllDay ) |
307 | pa.begin( paintPixAllday() ); | 309 | pa.begin( paintPixAllday() ); |
308 | else | 310 | else |
309 | pa.begin( paintPix() ); | 311 | pa.begin( paintPix() ); |
310 | } | 312 | } |
311 | int x, yy, w, h; | 313 | int x, yy, w, h; |
312 | float nfh; | 314 | float nfh; |
313 | x = pos().x(); w = width(); h = height (); | 315 | x = pos().x(); w = width(); h = height (); |
314 | if ( mAllDay ) | 316 | if ( mAllDay ) |
315 | yy = y(); | 317 | yy = y(); |
316 | else | 318 | else |
317 | yy = mCellYTop * ( height() / cellHeight() ); | 319 | yy = mCellYTop * ( height() / cellHeight() ); |
318 | xPaintCoord= x; | 320 | xPaintCoord= x; |
319 | yPaintCoord = yy; | 321 | yPaintCoord = yy; |
320 | wPaintCoord = width(); | 322 | wPaintCoord = width(); |
321 | hPaintCoord = height(); | 323 | hPaintCoord = height(); |
322 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 324 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
323 | if ( paint == 0 ) | 325 | if ( paint == 0 ) |
324 | paint = &pa; | 326 | paint = &pa; |
325 | bool horLayout = ( w < h ); | 327 | bool horLayout = ( w < h ); |
326 | int maxhei = mFontPixelSize+4; | 328 | int maxhei = mFontPixelSize+4; |
327 | if ( horLayout ) | 329 | if ( horLayout ) |
328 | maxhei += AGENDA_ICON_SIZE -4; | 330 | maxhei += AGENDA_ICON_SIZE -4; |
329 | bool small = ( h < maxhei ); | 331 | bool small = ( h < maxhei ); |
330 | if ( ! small ) | 332 | if ( ! small ) |
331 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 333 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
332 | else { | 334 | else { |
333 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 335 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
334 | f.setBold( false ); | 336 | f.setBold( false ); |
335 | int fh = f.pointSize(); | 337 | int fh = f.pointSize(); |
336 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 338 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
337 | if ( nfh < 6 ) | 339 | if ( nfh < 6 ) |
338 | nfh = 6; | 340 | nfh = 6; |
339 | f.setPointSize( nfh ); | 341 | f.setPointSize( nfh ); |
340 | paint->setFont(f); | 342 | paint->setFont(f); |
341 | } | 343 | } |
342 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 344 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
343 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 345 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
344 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 346 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
345 | if ( mIncidence->type() == "Todo" ) { | 347 | if ( mIncidence->type() == "Todo" ) { |
346 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 348 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
347 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 349 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
348 | int yyy = yy+3; | 350 | int yyy = yy+3; |
349 | if ( tempTodo->isCompleted() ) | 351 | if ( tempTodo->isCompleted() ) |
350 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 352 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
351 | else { | 353 | else { |
352 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 354 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
353 | 355 | ||
354 | } | 356 | } |
355 | } | 357 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 7d1e82f..08232e2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -92,832 +92,838 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
92 | { | 92 | { |
93 | 93 | ||
94 | switch(e->key()) { | 94 | switch(e->key()) { |
95 | case Key_Right: | 95 | case Key_Right: |
96 | // if ( e->state() == Qt::ControlButton ) | 96 | // if ( e->state() == Qt::ControlButton ) |
97 | { | 97 | { |
98 | e->ignore(); | 98 | e->ignore(); |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | scrollBy(4,0); | 101 | scrollBy(4,0); |
102 | break; | 102 | break; |
103 | case Key_Left: | 103 | case Key_Left: |
104 | // if ( e->state() == Qt::ControlButton ) | 104 | // if ( e->state() == Qt::ControlButton ) |
105 | { | 105 | { |
106 | e->ignore(); | 106 | e->ignore(); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | scrollBy(-4,0); | 109 | scrollBy(-4,0); |
110 | break; | 110 | break; |
111 | case Key_Up: | 111 | case Key_Up: |
112 | if(!count()) break; | 112 | if(!count()) break; |
113 | setCurrentItem((currentItem()+count()-1)%count()); | 113 | setCurrentItem((currentItem()+count()-1)%count()); |
114 | if(!itemVisible(currentItem())) { | 114 | if(!itemVisible(currentItem())) { |
115 | if((unsigned int) currentItem() == (count()-1)) { | 115 | if((unsigned int) currentItem() == (count()-1)) { |
116 | setTopItem(currentItem()-numItemsVisible()+1); | 116 | setTopItem(currentItem()-numItemsVisible()+1); |
117 | } else { | 117 | } else { |
118 | setTopItem(topItem()-1); | 118 | setTopItem(topItem()-1); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | break; | 121 | break; |
122 | case Key_Down: | 122 | case Key_Down: |
123 | if(!count()) break; | 123 | if(!count()) break; |
124 | setCurrentItem((currentItem()+1)%count()); | 124 | setCurrentItem((currentItem()+1)%count()); |
125 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
126 | if(currentItem() == 0) { | 126 | if(currentItem() == 0) { |
127 | setTopItem(0); | 127 | setTopItem(0); |
128 | } else { | 128 | } else { |
129 | setTopItem(topItem()+1); | 129 | setTopItem(topItem()+1); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | break; | 132 | break; |
133 | case Key_Shift: | 133 | case Key_Shift: |
134 | emit shiftDown(); | 134 | emit shiftDown(); |
135 | break; | 135 | break; |
136 | default: | 136 | default: |
137 | e->ignore(); | 137 | e->ignore(); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 142 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
143 | { | 143 | { |
144 | switch(e->key()) { | 144 | switch(e->key()) { |
145 | case Key_Shift: | 145 | case Key_Shift: |
146 | emit shiftUp(); | 146 | emit shiftUp(); |
147 | break; | 147 | break; |
148 | default: | 148 | default: |
149 | break; | 149 | break; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 153 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
154 | { | 154 | { |
155 | QListBox::mousePressEvent(e); | 155 | QListBox::mousePressEvent(e); |
156 | 156 | ||
157 | if(e->button() == RightButton) { | 157 | if(e->button() == RightButton) { |
158 | emit rightClick(); | 158 | emit rightClick(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 162 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
163 | : QListBoxItem() | 163 | : QListBoxItem() |
164 | { | 164 | { |
165 | setText( s ); | 165 | setText( s ); |
166 | 166 | ||
167 | mIncidence = incidence; | 167 | mIncidence = incidence; |
168 | mDate = qd; | 168 | mDate = qd; |
169 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 169 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
170 | mRecur = false; | 170 | mRecur = false; |
171 | mAlarm = false; | 171 | mAlarm = false; |
172 | mReply = false; | 172 | mReply = false; |
173 | mInfo = false; | 173 | mInfo = false; |
174 | } | 174 | } |
175 | 175 | ||
176 | void MonthViewItem::paint(QPainter *p) | 176 | void MonthViewItem::paint(QPainter *p) |
177 | { | 177 | { |
178 | #if QT_VERSION >= 0x030000 | 178 | #if QT_VERSION >= 0x030000 |
179 | bool sel = isSelected(); | 179 | bool sel = isSelected(); |
180 | #else | 180 | #else |
181 | bool sel = selected(); | 181 | bool sel = selected(); |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | 184 | ||
185 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 185 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
186 | { | 186 | { |
187 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 187 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
188 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 188 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
189 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 189 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
190 | } | 190 | } |
191 | int x = 1; | 191 | int x = 1; |
192 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 192 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
193 | int size = PIXMAP_SIZE; | 193 | int size = PIXMAP_SIZE; |
194 | if ( QApplication::desktop()->width() < 300 ) | 194 | if ( QApplication::desktop()->width() < 300 ) |
195 | size = 3; | 195 | size = 3; |
196 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 196 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
197 | if ( mInfo ) { | 197 | if ( mInfo ) { |
198 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 198 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
199 | x += size + 1; | 199 | x += size + 1; |
200 | } | 200 | } |
201 | if ( mRecur ) { | 201 | if ( mRecur ) { |
202 | p->fillRect ( x, y,size,size, Qt::blue ); | 202 | p->fillRect ( x, y,size,size, Qt::blue ); |
203 | x += size + 1; | 203 | x += size + 1; |
204 | } | 204 | } |
205 | if ( mAlarm ) { | 205 | if ( mAlarm ) { |
206 | p->fillRect ( x, y,size,size, Qt::red ); | 206 | p->fillRect ( x, y,size,size, Qt::red ); |
207 | x += size + 1; | 207 | x += size + 1; |
208 | } | 208 | } |
209 | if ( mReply ) { | 209 | if ( mReply ) { |
210 | p->fillRect ( x, y,size,size, Qt::yellow ); | 210 | p->fillRect ( x, y,size,size, Qt::yellow ); |
211 | x += size + 1; | 211 | x += size + 1; |
212 | } | 212 | } |
213 | } | 213 | } |
214 | QFontMetrics fm = p->fontMetrics(); | 214 | QFontMetrics fm = p->fontMetrics(); |
215 | int yPos; | 215 | int yPos; |
216 | int pmheight = size; | 216 | int pmheight = size; |
217 | if( pmheight < fm.height() ) | 217 | if( pmheight < fm.height() ) |
218 | yPos = fm.ascent() + fm.leading()/2; | 218 | yPos = fm.ascent() + fm.leading()/2; |
219 | else | 219 | else |
220 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 220 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
221 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 221 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
222 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 222 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
223 | p->drawText( x, yPos, text() ); | 223 | p->drawText( x, yPos, text() ); |
224 | if ( mIncidence->cancelled() ) { | 224 | if ( mIncidence->cancelled() ) { |
225 | int wid = fm.width( text() ); | 225 | int wid = fm.width( text() ); |
226 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); | 226 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); |
227 | } | 227 | } |
228 | 228 | ||
229 | } | 229 | } |
230 | 230 | ||
231 | int MonthViewItem::height(const QListBox *lb) const | 231 | int MonthViewItem::height(const QListBox *lb) const |
232 | { | 232 | { |
233 | return lb->fontMetrics().lineSpacing()+1; | 233 | return lb->fontMetrics().lineSpacing()+1; |
234 | } | 234 | } |
235 | 235 | ||
236 | int MonthViewItem::width(const QListBox *lb) const | 236 | int MonthViewItem::width(const QListBox *lb) const |
237 | { | 237 | { |
238 | int size = PIXMAP_SIZE; | 238 | int size = PIXMAP_SIZE; |
239 | if ( QApplication::desktop()->width() < 300 ) | 239 | if ( QApplication::desktop()->width() < 300 ) |
240 | size = 3; | 240 | size = 3; |
241 | int x = 1; | 241 | int x = 1; |
242 | if ( mInfo ) { | 242 | if ( mInfo ) { |
243 | x += size + 1; | 243 | x += size + 1; |
244 | } | 244 | } |
245 | if( mRecur ) { | 245 | if( mRecur ) { |
246 | x += size+1; | 246 | x += size+1; |
247 | } | 247 | } |
248 | if( mAlarm ) { | 248 | if( mAlarm ) { |
249 | x += size+1; | 249 | x += size+1; |
250 | } | 250 | } |
251 | if( mReply ) { | 251 | if( mReply ) { |
252 | x += size+1; | 252 | x += size+1; |
253 | } | 253 | } |
254 | 254 | ||
255 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 255 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | MonthViewCell::MonthViewCell( KOMonthView *parent) | 259 | MonthViewCell::MonthViewCell( KOMonthView *parent) |
260 | : QWidget( parent ), | 260 | : QWidget( parent ), |
261 | mMonthView( parent ) | 261 | mMonthView( parent ) |
262 | { | 262 | { |
263 | 263 | ||
264 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 264 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
265 | 265 | ||
266 | // mLabel = new QLabel( this );QPushButton | 266 | // mLabel = new QLabel( this );QPushButton |
267 | mLabel = new QPushButton( this ); | 267 | mLabel = new QPushButton( this ); |
268 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 268 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
269 | //mLabel->setLineWidth( 1 ); | 269 | //mLabel->setLineWidth( 1 ); |
270 | //mLabel->setAlignment( AlignCenter ); | 270 | //mLabel->setAlignment( AlignCenter ); |
271 | mLabel->setFlat( true ); | 271 | mLabel->setFlat( true ); |
272 | mItemList = new KNoScrollListBox( this ); | 272 | mItemList = new KNoScrollListBox( this ); |
273 | mItemList->setMinimumSize( 10, 10 ); | 273 | mItemList->setMinimumSize( 10, 10 ); |
274 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 274 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
275 | mItemList->setLineWidth( 1 ); | 275 | mItemList->setLineWidth( 1 ); |
276 | topLayout->addWidget( mItemList ); | 276 | topLayout->addWidget( mItemList ); |
277 | mLabel->raise(); | 277 | mLabel->raise(); |
278 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 278 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
279 | mStandardPalette = palette(); | 279 | mStandardPalette = palette(); |
280 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 280 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
281 | 281 | ||
282 | enableScrollBars( false ); | 282 | enableScrollBars( false ); |
283 | updateConfig(); | 283 | updateConfig(); |
284 | connect( mLabel, SIGNAL( clicked( )), | 284 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
285 | SLOT( newEvent() )); | 285 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
286 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 286 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
287 | SLOT( defaultAction( QListBoxItem * ) ) ); | 287 | SLOT( defaultAction( QListBoxItem * ) ) ); |
288 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 288 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
289 | const QPoint &) ), | 289 | const QPoint &) ), |
290 | SLOT( contextMenu( QListBoxItem * ) ) ); | 290 | SLOT( contextMenu( QListBoxItem * ) ) ); |
291 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 291 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
292 | SLOT( selection( QListBoxItem * ) ) ); | 292 | SLOT( selection( QListBoxItem * ) ) ); |
293 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 293 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
294 | SLOT( cellClicked( QListBoxItem * ) ) ); | 294 | SLOT( cellClicked( QListBoxItem * ) ) ); |
295 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 295 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
296 | SLOT( selection( QListBoxItem * ) ) ); | 296 | SLOT( selection( QListBoxItem * ) ) ); |
297 | } | 297 | } |
298 | 298 | ||
299 | void MonthViewCell::setDate( const QDate &date ) | 299 | void MonthViewCell::setDate( const QDate &date ) |
300 | { | 300 | { |
301 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 301 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
302 | 302 | ||
303 | mDate = date; | 303 | mDate = date; |
304 | 304 | ||
305 | QString text; | 305 | QString text; |
306 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 306 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
307 | if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 307 | if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
308 | text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; | 308 | text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; |
309 | mLabel->resize( mLabelBigSize ); | 309 | mLabel->resize( mLabelBigSize ); |
310 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 310 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
311 | } else { | 311 | } else { |
312 | mLabel->resize( mLabelSize ); | 312 | mLabel->resize( mLabelSize ); |
313 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 313 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
314 | } | 314 | } |
315 | mLabel->setText( text ); | 315 | mLabel->setText( text ); |
316 | 316 | ||
317 | //resizeEvent( 0 ); | 317 | //resizeEvent( 0 ); |
318 | } | 318 | } |
319 | 319 | ||
320 | QDate MonthViewCell::date() const | 320 | QDate MonthViewCell::date() const |
321 | { | 321 | { |
322 | return mDate; | 322 | return mDate; |
323 | } | 323 | } |
324 | 324 | ||
325 | void MonthViewCell::setPrimary( bool primary ) | 325 | void MonthViewCell::setPrimary( bool primary ) |
326 | { | 326 | { |
327 | mPrimary = primary; | 327 | mPrimary = primary; |
328 | //setMyPalette(); | 328 | //setMyPalette(); |
329 | } | 329 | } |
330 | void MonthViewCell::setMyPalette() | 330 | void MonthViewCell::setMyPalette() |
331 | { | 331 | { |
332 | 332 | ||
333 | if ( mHoliday) { | 333 | if ( mHoliday) { |
334 | setPalette( mHolidayPalette ); | 334 | setPalette( mHolidayPalette ); |
335 | } else { | 335 | } else { |
336 | if ( mPrimary ) { | 336 | if ( mPrimary ) { |
337 | setPalette( mPrimaryPalette ); | 337 | setPalette( mPrimaryPalette ); |
338 | } else { | 338 | } else { |
339 | setPalette( mNonPrimaryPalette ); | 339 | setPalette( mNonPrimaryPalette ); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | QPalette pal = palette(); | 342 | QPalette pal = palette(); |
343 | 343 | ||
344 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 344 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
345 | } | 345 | } |
346 | QPalette MonthViewCell::getPalette () | 346 | QPalette MonthViewCell::getPalette () |
347 | { | 347 | { |
348 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 348 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
349 | return mStandardPalette; | 349 | return mStandardPalette; |
350 | if ( mHoliday) { | 350 | if ( mHoliday) { |
351 | return mHolidayPalette ; | 351 | return mHolidayPalette ; |
352 | } else { | 352 | } else { |
353 | if ( mPrimary ) { | 353 | if ( mPrimary ) { |
354 | return mPrimaryPalette ; | 354 | return mPrimaryPalette ; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | return mNonPrimaryPalette; | 357 | return mNonPrimaryPalette; |
358 | } | 358 | } |
359 | bool MonthViewCell::isPrimary() const | 359 | bool MonthViewCell::isPrimary() const |
360 | { | 360 | { |
361 | return mPrimary; | 361 | return mPrimary; |
362 | } | 362 | } |
363 | 363 | ||
364 | void MonthViewCell::setHoliday( bool holiday ) | 364 | void MonthViewCell::setHoliday( bool holiday ) |
365 | { | 365 | { |
366 | mHoliday = holiday; | 366 | mHoliday = holiday; |
367 | //setMyPalette(); | 367 | //setMyPalette(); |
368 | } | 368 | } |
369 | 369 | ||
370 | void MonthViewCell::setHoliday( const QString &holiday ) | 370 | void MonthViewCell::setHoliday( const QString &holiday ) |
371 | { | 371 | { |
372 | mHolidayString = holiday; | 372 | mHolidayString = holiday; |
373 | 373 | ||
374 | if ( !holiday.isEmpty() ) { | 374 | if ( !holiday.isEmpty() ) { |
375 | setHoliday( true ); | 375 | setHoliday( true ); |
376 | } | 376 | } |
377 | } | 377 | } |
378 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 378 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
379 | { | 379 | { |
380 | 380 | ||
381 | e->ignore(); | 381 | e->ignore(); |
382 | 382 | ||
383 | } | 383 | } |
384 | void MonthViewCell::updateCell() | 384 | void MonthViewCell::updateCell() |
385 | { | 385 | { |
386 | 386 | ||
387 | setPrimary( mDate.month()%2 ); | 387 | setPrimary( mDate.month()%2 ); |
388 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 388 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
389 | if ( mDate == QDate::currentDate() ) { | 389 | if ( mDate == QDate::currentDate() ) { |
390 | mItemList->setLineWidth( 3 ); | 390 | mItemList->setLineWidth( 3 ); |
391 | } else { | 391 | } else { |
392 | mItemList->setLineWidth( 1 ); | 392 | mItemList->setLineWidth( 1 ); |
393 | } | 393 | } |
394 | mItemList->clear(); | 394 | mItemList->clear(); |
395 | //qApp->processEvents(); | 395 | //qApp->processEvents(); |
396 | if ( !mHolidayString.isEmpty() ) { | 396 | if ( !mHolidayString.isEmpty() ) { |
397 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 397 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
398 | item->setPalette( mHolidayPalette ); | 398 | item->setPalette( mHolidayPalette ); |
399 | mItemList->insertItem( item ); | 399 | mItemList->insertItem( item ); |
400 | } | 400 | } |
401 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 401 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
402 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 402 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
403 | Event *event; | 403 | Event *event; |
404 | for( event = events.first(); event; event = events.next() ) { | 404 | for( event = events.first(); event; event = events.next() ) { |
405 | if ( event->categories().contains("Holiday") || | 405 | if ( event->categories().contains("Holiday") || |
406 | event->categories().contains(i18n("Holiday"))) { | 406 | event->categories().contains(i18n("Holiday"))) { |
407 | setHoliday( true ); | 407 | setHoliday( true ); |
408 | if ( mDate.dayOfWeek() == 7 ) | 408 | if ( mDate.dayOfWeek() == 7 ) |
409 | mItemList->setLineWidth( 3 ); | 409 | mItemList->setLineWidth( 3 ); |
410 | } | 410 | } |
411 | QString text; | 411 | QString text; |
412 | if (event->isMultiDay()) { | 412 | if (event->isMultiDay()) { |
413 | QString prefix = "<->"; | 413 | QString prefix = "<->"; |
414 | if ( event->doesRecur() ) { | 414 | if ( event->doesRecur() ) { |
415 | if ( event->recursOn( mDate) ) | 415 | if ( event->recursOn( mDate) ) |
416 | prefix ="->" ; | 416 | prefix ="->" ; |
417 | else { | 417 | else { |
418 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 418 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
419 | if ( event->recursOn( mDate.addDays( -days)) ) | 419 | if ( event->recursOn( mDate.addDays( -days)) ) |
420 | prefix ="<-" ; | 420 | prefix ="<-" ; |
421 | } | 421 | } |
422 | 422 | ||
423 | } else { | 423 | } else { |
424 | if (mDate == event->dtStart().date()) { | 424 | if (mDate == event->dtStart().date()) { |
425 | prefix ="->" ; | 425 | prefix ="->" ; |
426 | } else if (mDate == event->dtEnd().date()) { | 426 | } else if (mDate == event->dtEnd().date()) { |
427 | prefix ="<-" ; | 427 | prefix ="<-" ; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | text = prefix + event->summary(); | 430 | text = prefix + event->summary(); |
431 | } else { | 431 | } else { |
432 | if (event->doesFloat()) | 432 | if (event->doesFloat()) |
433 | text = event->summary(); | 433 | text = event->summary(); |
434 | else { | 434 | else { |
435 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 435 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
436 | text += " " + event->summary(); | 436 | text += " " + event->summary(); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 440 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
441 | QPalette pal; | 441 | QPalette pal; |
442 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 442 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
443 | QStringList categories = event->categories(); | 443 | QStringList categories = event->categories(); |
444 | QString cat = categories.first(); | 444 | QString cat = categories.first(); |
445 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 445 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
446 | pal = getPalette(); | 446 | pal = getPalette(); |
447 | if (cat.isEmpty()) { | 447 | if (cat.isEmpty()) { |
448 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 448 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
449 | } else { | 449 | } else { |
450 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 450 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
451 | } | 451 | } |
452 | 452 | ||
453 | } else { | 453 | } else { |
454 | if (cat.isEmpty()) { | 454 | if (cat.isEmpty()) { |
455 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 455 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
456 | } else { | 456 | } else { |
457 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 457 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
458 | } | 458 | } |
459 | } | 459 | } |
460 | 460 | ||
461 | } else { | 461 | } else { |
462 | pal = mStandardPalette ; | 462 | pal = mStandardPalette ; |
463 | } | 463 | } |
464 | item->setPalette( pal ); | 464 | item->setPalette( pal ); |
465 | item->setRecur( event->recurrence()->doesRecur() ); | 465 | item->setRecur( event->recurrence()->doesRecur() ); |
466 | item->setAlarm( event->isAlarmEnabled() ); | 466 | item->setAlarm( event->isAlarmEnabled() ); |
467 | item->setMoreInfo( event->description().length() > 0 ); | 467 | item->setMoreInfo( event->description().length() > 0 ); |
468 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 468 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
469 | KOPrefs::instance()->email()); | 469 | KOPrefs::instance()->email()); |
470 | if ( me != 0 ) { | 470 | if ( me != 0 ) { |
471 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 471 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
472 | item->setReply(true); | 472 | item->setReply(true); |
473 | else | 473 | else |
474 | item->setReply(false); | 474 | item->setReply(false); |
475 | } else | 475 | } else |
476 | item->setReply(false); | 476 | item->setReply(false); |
477 | bool insert = true; | 477 | bool insert = true; |
478 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 478 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
479 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 479 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
480 | insert = false; | 480 | insert = false; |
481 | else | 481 | else |
482 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 482 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
483 | insert = false; | 483 | insert = false; |
484 | 484 | ||
485 | } | 485 | } |
486 | if ( insert ) | 486 | if ( insert ) |
487 | mItemList->insertItem( item ); | 487 | mItemList->insertItem( item ); |
488 | } | 488 | } |
489 | 489 | ||
490 | // insert due todos | 490 | // insert due todos |
491 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 491 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
492 | Todo *todo; | 492 | Todo *todo; |
493 | for(todo = todos.first(); todo; todo = todos.next()) { | 493 | for(todo = todos.first(); todo; todo = todos.next()) { |
494 | QString text; | 494 | QString text; |
495 | if (todo->hasDueDate()) { | 495 | if (todo->hasDueDate()) { |
496 | if (!todo->doesFloat()) { | 496 | if (!todo->doesFloat()) { |
497 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 497 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
498 | text += " "; | 498 | text += " "; |
499 | } | 499 | } |
500 | } | 500 | } |
501 | text += i18n("To-Do: %1").arg(todo->summary()); | 501 | text += i18n("To-Do: %1").arg(todo->summary()); |
502 | 502 | ||
503 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 503 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
504 | //item->setPalette( mStandardPalette ); | 504 | //item->setPalette( mStandardPalette ); |
505 | QPalette pal; | 505 | QPalette pal; |
506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
507 | QStringList categories = todo->categories(); | 507 | QStringList categories = todo->categories(); |
508 | QString cat = categories.first(); | 508 | QString cat = categories.first(); |
509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
510 | pal = getPalette(); | 510 | pal = getPalette(); |
511 | if (cat.isEmpty()) { | 511 | if (cat.isEmpty()) { |
512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
513 | } else { | 513 | } else { |
514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
515 | } | 515 | } |
516 | 516 | ||
517 | } else { | 517 | } else { |
518 | if (cat.isEmpty()) { | 518 | if (cat.isEmpty()) { |
519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
520 | } else { | 520 | } else { |
521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | } else { | 525 | } else { |
526 | pal = mStandardPalette ; | 526 | pal = mStandardPalette ; |
527 | } | 527 | } |
528 | item->setPalette( pal ); | 528 | item->setPalette( pal ); |
529 | mItemList->insertItem( item ); | 529 | mItemList->insertItem( item ); |
530 | } | 530 | } |
531 | //setMyPalette(); | 531 | //setMyPalette(); |
532 | setMyPalette(); | 532 | setMyPalette(); |
533 | resizeEvent( 0 ); | 533 | resizeEvent( 0 ); |
534 | // if ( isVisible()) | 534 | // if ( isVisible()) |
535 | // qApp->processEvents(); | 535 | // qApp->processEvents(); |
536 | } | 536 | } |
537 | 537 | ||
538 | void MonthViewCell::updateConfig() | 538 | void MonthViewCell::updateConfig() |
539 | { | 539 | { |
540 | 540 | ||
541 | setFont( KOPrefs::instance()->mMonthViewFont ); | 541 | setFont( KOPrefs::instance()->mMonthViewFont ); |
542 | 542 | ||
543 | QFontMetrics fm( font() ); | 543 | QFontMetrics fm( font() ); |
544 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 544 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
545 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 545 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
546 | mHolidayPalette = mStandardPalette; | 546 | mHolidayPalette = mStandardPalette; |
547 | mPrimaryPalette = mStandardPalette; | 547 | mPrimaryPalette = mStandardPalette; |
548 | mNonPrimaryPalette = mStandardPalette; | 548 | mNonPrimaryPalette = mStandardPalette; |
549 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 549 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
550 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 550 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
551 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 551 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
552 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 552 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
553 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 553 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
554 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 554 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
555 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 555 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
556 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 556 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
557 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 557 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
558 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 558 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
559 | } | 559 | } |
560 | updateCell(); | 560 | updateCell(); |
561 | } | 561 | } |
562 | 562 | ||
563 | void MonthViewCell::enableScrollBars( bool enabled ) | 563 | void MonthViewCell::enableScrollBars( bool enabled ) |
564 | { | 564 | { |
565 | if ( enabled ) { | 565 | if ( enabled ) { |
566 | mItemList->setVScrollBarMode(QScrollView::Auto); | 566 | mItemList->setVScrollBarMode(QScrollView::Auto); |
567 | mItemList->setHScrollBarMode(QScrollView::Auto); | 567 | mItemList->setHScrollBarMode(QScrollView::Auto); |
568 | } else { | 568 | } else { |
569 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 569 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
570 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 570 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
571 | } | 571 | } |
572 | } | 572 | } |
573 | 573 | ||
574 | Incidence *MonthViewCell::selectedIncidence() | 574 | Incidence *MonthViewCell::selectedIncidence() |
575 | { | 575 | { |
576 | int index = mItemList->currentItem(); | 576 | int index = mItemList->currentItem(); |
577 | if ( index < 0 ) return 0; | 577 | if ( index < 0 ) return 0; |
578 | 578 | ||
579 | MonthViewItem *item = | 579 | MonthViewItem *item = |
580 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 580 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
581 | 581 | ||
582 | if ( !item ) return 0; | 582 | if ( !item ) return 0; |
583 | 583 | ||
584 | return item->incidence(); | 584 | return item->incidence(); |
585 | } | 585 | } |
586 | 586 | ||
587 | QDate MonthViewCell::selectedIncidenceDate() | 587 | QDate MonthViewCell::selectedIncidenceDate() |
588 | { | 588 | { |
589 | QDate qd; | 589 | QDate qd; |
590 | int index = mItemList->currentItem(); | 590 | int index = mItemList->currentItem(); |
591 | if ( index < 0 ) return qd; | 591 | if ( index < 0 ) return qd; |
592 | 592 | ||
593 | MonthViewItem *item = | 593 | MonthViewItem *item = |
594 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 594 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
595 | 595 | ||
596 | if ( !item ) return qd; | 596 | if ( !item ) return qd; |
597 | 597 | ||
598 | return item->incidenceDate(); | 598 | return item->incidenceDate(); |
599 | } | 599 | } |
600 | 600 | ||
601 | void MonthViewCell::deselect() | 601 | void MonthViewCell::deselect() |
602 | { | 602 | { |
603 | mItemList->clearSelection(); | 603 | mItemList->clearSelection(); |
604 | enableScrollBars( false ); | 604 | enableScrollBars( false ); |
605 | // updateCell(); | 605 | // updateCell(); |
606 | } | 606 | } |
607 | void MonthViewCell::select() | 607 | void MonthViewCell::select() |
608 | { | 608 | { |
609 | ;// updateCell(); | 609 | ;// updateCell(); |
610 | } | 610 | } |
611 | 611 | ||
612 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 612 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
613 | { | 613 | { |
614 | int size = height() - mLabel->height(); | 614 | int size = height() - mLabel->height(); |
615 | if ( size > 0 ) | 615 | if ( size > 0 ) |
616 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 616 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
617 | size = width() - mLabel->width(); | 617 | size = width() - mLabel->width(); |
618 | if ( size > 0 ) | 618 | if ( size > 0 ) |
619 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 619 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
620 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 620 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
621 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 621 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
622 | } | 622 | } |
623 | 623 | ||
624 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 624 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
625 | { | 625 | { |
626 | if ( !item ) return; | 626 | if ( !item ) return; |
627 | 627 | ||
628 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 628 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
629 | Incidence *incidence = eventItem->incidence(); | 629 | Incidence *incidence = eventItem->incidence(); |
630 | if ( incidence ) mMonthView->defaultAction( incidence ); | 630 | if ( incidence ) mMonthView->defaultAction( incidence ); |
631 | } | 631 | } |
632 | void MonthViewCell::showDay() | ||
633 | { | ||
634 | emit showDaySignal( date() ); | ||
635 | } | ||
632 | void MonthViewCell::newEvent() | 636 | void MonthViewCell::newEvent() |
633 | { | 637 | { |
634 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 638 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
635 | emit newEventSignal( dt ); | 639 | emit newEventSignal( dt ); |
636 | } | 640 | } |
637 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 641 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
638 | { | 642 | { |
639 | static QListBoxItem * lastClicked = 0; | 643 | static QListBoxItem * lastClicked = 0; |
640 | if ( item == 0 ) { | 644 | if ( item == 0 ) { |
641 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 645 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
642 | emit newEventSignal( dt ); | 646 | emit newEventSignal( dt ); |
643 | return; | 647 | return; |
644 | } | 648 | } |
645 | /* | 649 | /* |
646 | if ( lastClicked ) | 650 | if ( lastClicked ) |
647 | if ( ! item ) { | 651 | if ( ! item ) { |
648 | if ( lastClicked->listBox() != item->listBox() ) | 652 | if ( lastClicked->listBox() != item->listBox() ) |
649 | lastClicked->listBox()->clearSelection(); | 653 | lastClicked->listBox()->clearSelection(); |
650 | } | 654 | } |
651 | */ | 655 | */ |
652 | 656 | ||
653 | mMonthView->setSelectedCell( this ); | 657 | mMonthView->setSelectedCell( this ); |
654 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); | 658 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); |
655 | select(); | 659 | select(); |
656 | } | 660 | } |
657 | 661 | ||
658 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 662 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
659 | { | 663 | { |
660 | if ( !item ) return; | 664 | if ( !item ) return; |
661 | 665 | ||
662 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 666 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
663 | Incidence *incidence = eventItem->incidence(); | 667 | Incidence *incidence = eventItem->incidence(); |
664 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 668 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
665 | } | 669 | } |
666 | 670 | ||
667 | void MonthViewCell::selection( QListBoxItem *item ) | 671 | void MonthViewCell::selection( QListBoxItem *item ) |
668 | { | 672 | { |
669 | if ( !item ) return; | 673 | if ( !item ) return; |
670 | 674 | ||
671 | mMonthView->setSelectedCell( this ); | 675 | mMonthView->setSelectedCell( this ); |
672 | } | 676 | } |
673 | 677 | ||
674 | 678 | ||
675 | // ******************************************************************************* | 679 | // ******************************************************************************* |
676 | // ******************************************************************************* | 680 | // ******************************************************************************* |
677 | // ******************************************************************************* | 681 | // ******************************************************************************* |
678 | 682 | ||
679 | 683 | ||
680 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 684 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
681 | : KOEventView( calendar, parent, name ), | 685 | : KOEventView( calendar, parent, name ), |
682 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 686 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
683 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 687 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
684 | { | 688 | { |
685 | mCells.setAutoDelete( true ); | 689 | mCells.setAutoDelete( true ); |
686 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 690 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
687 | // mDayLayout = new QGridLayout( this ); | 691 | // mDayLayout = new QGridLayout( this ); |
688 | // create the day of the week labels (Sun, Mon, etc) and add them to | 692 | // create the day of the week labels (Sun, Mon, etc) and add them to |
689 | // the layout. | 693 | // the layout. |
690 | mDayLabels.resize( mDaysPerWeek ); | 694 | mDayLabels.resize( mDaysPerWeek ); |
691 | QFont bfont = font(); | 695 | QFont bfont = font(); |
692 | if ( QApplication::desktop()->width() < 650 ) { | 696 | if ( QApplication::desktop()->width() < 650 ) { |
693 | bfont.setPointSize( bfont.pointSize() - 2 ); | 697 | bfont.setPointSize( bfont.pointSize() - 2 ); |
694 | } | 698 | } |
695 | bfont.setBold( true ); | 699 | bfont.setBold( true ); |
696 | int i; | 700 | int i; |
697 | 701 | ||
698 | for( i = 0; i < mDaysPerWeek; i++ ) { | 702 | for( i = 0; i < mDaysPerWeek; i++ ) { |
699 | QLabel *label = new QLabel( this ); | 703 | QLabel *label = new QLabel( this ); |
700 | label->setFont(bfont); | 704 | label->setFont(bfont); |
701 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 705 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
702 | label->setLineWidth(1); | 706 | label->setLineWidth(1); |
703 | label->setAlignment(AlignCenter); | 707 | label->setAlignment(AlignCenter); |
704 | mDayLabels.insert( i, label ); | 708 | mDayLabels.insert( i, label ); |
705 | } | 709 | } |
706 | 710 | ||
707 | bfont.setBold( false ); | 711 | bfont.setBold( false ); |
708 | mWeekLabels.resize( mNumWeeks+1 ); | 712 | mWeekLabels.resize( mNumWeeks+1 ); |
709 | for( i = 0; i < mNumWeeks+1; i++ ) { | 713 | for( i = 0; i < mNumWeeks+1; i++ ) { |
710 | KOWeekButton *label = new KOWeekButton( this ); | 714 | KOWeekButton *label = new KOWeekButton( this ); |
711 | label->setFont(bfont); | 715 | label->setFont(bfont); |
712 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 716 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); |
713 | label->setFlat(true); | 717 | label->setFlat(true); |
714 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 718 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); |
715 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 719 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
716 | //label->setLineWidth(1); | 720 | //label->setLineWidth(1); |
717 | //label->setAlignment(AlignCenter); | 721 | //label->setAlignment(AlignCenter); |
718 | mWeekLabels.insert( i, label ); | 722 | mWeekLabels.insert( i, label ); |
719 | } | 723 | } |
720 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 724 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
721 | int row, col; | 725 | int row, col; |
722 | mCells.resize( mNumCells ); | 726 | mCells.resize( mNumCells ); |
723 | for( row = 0; row < mNumWeeks; ++row ) { | 727 | for( row = 0; row < mNumWeeks; ++row ) { |
724 | for( col = 0; col < mDaysPerWeek; ++col ) { | 728 | for( col = 0; col < mDaysPerWeek; ++col ) { |
725 | MonthViewCell *cell = new MonthViewCell( this ); | 729 | MonthViewCell *cell = new MonthViewCell( this ); |
726 | mCells.insert( row * mDaysPerWeek + col, cell ); | 730 | mCells.insert( row * mDaysPerWeek + col, cell ); |
727 | 731 | ||
728 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 732 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
729 | SLOT( defaultAction( Incidence * ) ) ); | 733 | SLOT( defaultAction( Incidence * ) ) ); |
730 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 734 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
731 | SIGNAL( newEventSignal( QDateTime ) ) ); | 735 | SIGNAL( newEventSignal( QDateTime ) ) ); |
736 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | ||
737 | SIGNAL( showDaySignal( QDate ) ) ); | ||
732 | } | 738 | } |
733 | } | 739 | } |
734 | 740 | ||
735 | mContextMenu = eventPopup(); | 741 | mContextMenu = eventPopup(); |
736 | // updateConfig(); //useless here | 742 | // updateConfig(); //useless here |
737 | 743 | ||
738 | emit incidenceSelected( 0 ); | 744 | emit incidenceSelected( 0 ); |
739 | } | 745 | } |
740 | 746 | ||
741 | KOMonthView::~KOMonthView() | 747 | KOMonthView::~KOMonthView() |
742 | { | 748 | { |
743 | delete mContextMenu; | 749 | delete mContextMenu; |
744 | } | 750 | } |
745 | 751 | ||
746 | int KOMonthView::maxDatesHint() | 752 | int KOMonthView::maxDatesHint() |
747 | { | 753 | { |
748 | return mNumCells; | 754 | return mNumCells; |
749 | } | 755 | } |
750 | 756 | ||
751 | int KOMonthView::currentDateCount() | 757 | int KOMonthView::currentDateCount() |
752 | { | 758 | { |
753 | return mNumCells; | 759 | return mNumCells; |
754 | } | 760 | } |
755 | 761 | ||
756 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 762 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
757 | { | 763 | { |
758 | QPtrList<Incidence> selected; | 764 | QPtrList<Incidence> selected; |
759 | 765 | ||
760 | if ( mSelectedCell ) { | 766 | if ( mSelectedCell ) { |
761 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 767 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
762 | if ( incidence ) selected.append( incidence ); | 768 | if ( incidence ) selected.append( incidence ); |
763 | } | 769 | } |
764 | 770 | ||
765 | return selected; | 771 | return selected; |
766 | } | 772 | } |
767 | 773 | ||
768 | DateList KOMonthView::selectedDates() | 774 | DateList KOMonthView::selectedDates() |
769 | { | 775 | { |
770 | DateList selected; | 776 | DateList selected; |
771 | 777 | ||
772 | if ( mSelectedCell ) { | 778 | if ( mSelectedCell ) { |
773 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 779 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
774 | if ( qd.isValid() ) selected.append( qd ); | 780 | if ( qd.isValid() ) selected.append( qd ); |
775 | } | 781 | } |
776 | 782 | ||
777 | return selected; | 783 | return selected; |
778 | } | 784 | } |
779 | 785 | ||
780 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 786 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
781 | const QDate &td) | 787 | const QDate &td) |
782 | { | 788 | { |
783 | #ifndef KORG_NOPRINTER | 789 | #ifndef KORG_NOPRINTER |
784 | calPrinter->preview(CalPrinter::Month, fd, td); | 790 | calPrinter->preview(CalPrinter::Month, fd, td); |
785 | #endif | 791 | #endif |
786 | } | 792 | } |
787 | 793 | ||
788 | void KOMonthView::updateConfig() | 794 | void KOMonthView::updateConfig() |
789 | { | 795 | { |
790 | 796 | ||
791 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 797 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
792 | 798 | ||
793 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 799 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
794 | mWidthLongDayLabel = 0; | 800 | mWidthLongDayLabel = 0; |
795 | 801 | ||
796 | for (int i = 0; i < 7; i++) { | 802 | for (int i = 0; i < 7; i++) { |
797 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 803 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
798 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 804 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
799 | } | 805 | } |
800 | bool temp = mShowSatSunComp ; | 806 | bool temp = mShowSatSunComp ; |
801 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 807 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
802 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 808 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
803 | computeLayout(); | 809 | computeLayout(); |
804 | updateDayLabels(); | 810 | updateDayLabels(); |
805 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 811 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
806 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 812 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
807 | //resizeEvent( 0 ); | 813 | //resizeEvent( 0 ); |
808 | for (uint i = 0; i < mCells.count(); ++i) { | 814 | for (uint i = 0; i < mCells.count(); ++i) { |
809 | mCells[i]->updateConfig(); | 815 | mCells[i]->updateConfig(); |
810 | } | 816 | } |
811 | } | 817 | } |
812 | 818 | ||
813 | void KOMonthView::updateDayLabels() | 819 | void KOMonthView::updateDayLabels() |
814 | { | 820 | { |
815 | 821 | ||
816 | for (int i = 0; i < 7; i++) { | 822 | for (int i = 0; i < 7; i++) { |
817 | if (mWeekStartsMonday) { | 823 | if (mWeekStartsMonday) { |
818 | bool show = mShortDayLabels; | 824 | bool show = mShortDayLabels; |
819 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 825 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
820 | show = true; | 826 | show = true; |
821 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 827 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
822 | } else { | 828 | } else { |
823 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 829 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
824 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 830 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
825 | 831 | ||
826 | } | 832 | } |
827 | } | 833 | } |
828 | } | 834 | } |
829 | 835 | ||
830 | void KOMonthView::showDates(const QDate &start, const QDate &) | 836 | void KOMonthView::showDates(const QDate &start, const QDate &) |
831 | { | 837 | { |
832 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 838 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
833 | 839 | ||
834 | 840 | ||
835 | mStartDate = start; | 841 | mStartDate = start; |
836 | 842 | ||
837 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 843 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
838 | 844 | ||
839 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 845 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
840 | mStartDate = mStartDate.addDays( -1 ); | 846 | mStartDate = mStartDate.addDays( -1 ); |
841 | } | 847 | } |
842 | 848 | ||
843 | bool primary = false; | 849 | bool primary = false; |
844 | uint i; | 850 | uint i; |
845 | for( i = 0; i < mCells.size(); ++i ) { | 851 | for( i = 0; i < mCells.size(); ++i ) { |
846 | QDate date = mStartDate.addDays( i ); | 852 | QDate date = mStartDate.addDays( i ); |
847 | mCells[i]->setDate( date ); | 853 | mCells[i]->setDate( date ); |
848 | 854 | ||
849 | #ifndef KORG_NOPLUGINS | 855 | #ifndef KORG_NOPLUGINS |
850 | // add holiday, if present | 856 | // add holiday, if present |
851 | QString hstring(KOCore::self()->holiday(date)); | 857 | QString hstring(KOCore::self()->holiday(date)); |
852 | mCells[i]->setHoliday( hstring ); | 858 | mCells[i]->setHoliday( hstring ); |
853 | #endif | 859 | #endif |
854 | 860 | ||
855 | } | 861 | } |
856 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 862 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
857 | for( i = 0; i < 6; ++i ) { | 863 | for( i = 0; i < 6; ++i ) { |
858 | int wno; | 864 | int wno; |
859 | // remember, according to ISO 8601, the first week of the year is the | 865 | // remember, according to ISO 8601, the first week of the year is the |
860 | // first week that contains a thursday. Thus we must subtract off 4, | 866 | // first week that contains a thursday. Thus we must subtract off 4, |
861 | // not just 1. | 867 | // not just 1. |
862 | int dayOfYear = date.dayOfYear(); | 868 | int dayOfYear = date.dayOfYear(); |
863 | if (dayOfYear % 7 != 0) | 869 | if (dayOfYear % 7 != 0) |
864 | wno = dayOfYear / 7 + 1; | 870 | wno = dayOfYear / 7 + 1; |
865 | else | 871 | else |
866 | wno =dayOfYear / 7; | 872 | wno =dayOfYear / 7; |
867 | mWeekLabels[i]->setWeekNum( wno ); | 873 | mWeekLabels[i]->setWeekNum( wno ); |
868 | date = date.addDays( 7 ); | 874 | date = date.addDays( 7 ); |
869 | } | 875 | } |
870 | updateView(); | 876 | updateView(); |
871 | } | 877 | } |
872 | 878 | ||
873 | void KOMonthView::showEvents(QPtrList<Event>) | 879 | void KOMonthView::showEvents(QPtrList<Event>) |
874 | { | 880 | { |
875 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 881 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
876 | } | 882 | } |
877 | 883 | ||
878 | void KOMonthView::changeEventDisplay(Event *, int) | 884 | void KOMonthView::changeEventDisplay(Event *, int) |
879 | { | 885 | { |
880 | // this should be re-written to be much more efficient, but this | 886 | // this should be re-written to be much more efficient, but this |
881 | // quick-and-dirty-hack gets the job done for right now. | 887 | // quick-and-dirty-hack gets the job done for right now. |
882 | updateView(); | 888 | updateView(); |
883 | } | 889 | } |
884 | 890 | ||
885 | void KOMonthView::updateView() | 891 | void KOMonthView::updateView() |
886 | { | 892 | { |
887 | 893 | ||
888 | uint i; | 894 | uint i; |
889 | for( i = 0; i < mCells.count(); ++i ) { | 895 | for( i = 0; i < mCells.count(); ++i ) { |
890 | mCells[i]->updateCell(); | 896 | mCells[i]->updateCell(); |
891 | } | 897 | } |
892 | //qDebug("KOMonthView::updateView() "); | 898 | //qDebug("KOMonthView::updateView() "); |
893 | processSelectionChange(); | 899 | processSelectionChange(); |
894 | } | 900 | } |
895 | 901 | ||
896 | void KOMonthView::resizeEvent(QResizeEvent * e) | 902 | void KOMonthView::resizeEvent(QResizeEvent * e) |
897 | { | 903 | { |
898 | computeLayout(); | 904 | computeLayout(); |
899 | } | 905 | } |
900 | void KOMonthView::computeLayout() | 906 | void KOMonthView::computeLayout() |
901 | { | 907 | { |
902 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 908 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
903 | // note this only changes the text if the requested size crosses the | 909 | // note this only changes the text if the requested size crosses the |
904 | // threshold between big enough to support the full name and not big | 910 | // threshold between big enough to support the full name and not big |
905 | // enough. | 911 | // enough. |
906 | 912 | ||
907 | int daysToShow = 7; | 913 | int daysToShow = 7; |
908 | bool combinedSatSun = false; | 914 | bool combinedSatSun = false; |
909 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 915 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
910 | daysToShow = 6; | 916 | daysToShow = 6; |
911 | combinedSatSun = true; | 917 | combinedSatSun = true; |
912 | } | 918 | } |
913 | int tWid = topLevelWidget()->size().width(); | 919 | int tWid = topLevelWidget()->size().width(); |
914 | int tHei = topLevelWidget()->size().height(); | 920 | int tHei = topLevelWidget()->size().height(); |
915 | 921 | ||
916 | int wid = size().width();//e | 922 | int wid = size().width();//e |
917 | int hei = size().height()-1; | 923 | int hei = size().height()-1; |
918 | 924 | ||
919 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 925 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
920 | return; | 926 | return; |
921 | 927 | ||
922 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 928 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
923 | int weeklabelwid = fm.width( "888" ); | 929 | int weeklabelwid = fm.width( "888" ); |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index e94952f..5124057 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,253 +1,256 @@ | |||
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 | class KOWeekButton : public QPushButton | 39 | class KOWeekButton : public QPushButton |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 43 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
44 | QPushButton( parent, name) | 44 | QPushButton( parent, name) |
45 | { | 45 | { |
46 | connect( this, SIGNAL( clicked() ), | 46 | connect( this, SIGNAL( clicked() ), |
47 | SLOT( bottonClicked() )); | 47 | SLOT( bottonClicked() )); |
48 | mNumber = -1; | 48 | mNumber = -1; |
49 | } | 49 | } |
50 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 50 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
51 | signals: | 51 | signals: |
52 | void selectWeekNum ( int ); | 52 | void selectWeekNum ( int ); |
53 | private: | 53 | private: |
54 | int mNumber; | 54 | int mNumber; |
55 | private slots : | 55 | private slots : |
56 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 56 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
57 | }; | 57 | }; |
58 | 58 | ||
59 | class KNoScrollListBox: public QListBox | 59 | class KNoScrollListBox: public QListBox |
60 | { | 60 | { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | public: | 62 | public: |
63 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 63 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
64 | ~KNoScrollListBox() {} | 64 | ~KNoScrollListBox() {} |
65 | QString getWhatsThisText(QPoint p) ; | 65 | QString getWhatsThisText(QPoint p) ; |
66 | 66 | ||
67 | signals: | 67 | signals: |
68 | void shiftDown(); | 68 | void shiftDown(); |
69 | void shiftUp(); | 69 | void shiftUp(); |
70 | void rightClick(); | 70 | void rightClick(); |
71 | 71 | ||
72 | protected slots: | 72 | protected slots: |
73 | void keyPressEvent(QKeyEvent *); | 73 | void keyPressEvent(QKeyEvent *); |
74 | void keyReleaseEvent(QKeyEvent *); | 74 | void keyReleaseEvent(QKeyEvent *); |
75 | void mousePressEvent(QMouseEvent *); | 75 | void mousePressEvent(QMouseEvent *); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | class MonthViewItem: public QListBoxItem | 79 | class MonthViewItem: public QListBoxItem |
80 | { | 80 | { |
81 | public: | 81 | public: |
82 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 82 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
83 | 83 | ||
84 | void setRecur(bool on) { mRecur = on; } | 84 | void setRecur(bool on) { mRecur = on; } |
85 | void setAlarm(bool on) { mAlarm = on; } | 85 | void setAlarm(bool on) { mAlarm = on; } |
86 | void setReply(bool on) { mReply = on; } | 86 | void setReply(bool on) { mReply = on; } |
87 | void setMoreInfo(bool on) { mInfo = on; } | 87 | void setMoreInfo(bool on) { mInfo = on; } |
88 | 88 | ||
89 | 89 | ||
90 | void setPalette(const QPalette &p) { mPalette = p; } | 90 | void setPalette(const QPalette &p) { mPalette = p; } |
91 | QPalette palette() const { return mPalette; } | 91 | QPalette palette() const { return mPalette; } |
92 | 92 | ||
93 | Incidence *incidence() const { return mIncidence; } | 93 | Incidence *incidence() const { return mIncidence; } |
94 | QDate incidenceDate() { return mDate; } | 94 | QDate incidenceDate() { return mDate; } |
95 | 95 | ||
96 | protected: | 96 | protected: |
97 | virtual void paint(QPainter *); | 97 | virtual void paint(QPainter *); |
98 | virtual int height(const QListBox *) const; | 98 | virtual int height(const QListBox *) const; |
99 | virtual int width(const QListBox *) const; | 99 | virtual int width(const QListBox *) const; |
100 | 100 | ||
101 | private: | 101 | private: |
102 | bool mRecur; | 102 | bool mRecur; |
103 | bool mAlarm; | 103 | bool mAlarm; |
104 | bool mReply; | 104 | bool mReply; |
105 | bool mInfo; | 105 | bool mInfo; |
106 | 106 | ||
107 | QPalette mPalette; | 107 | QPalette mPalette; |
108 | QDate mDate; | 108 | QDate mDate; |
109 | 109 | ||
110 | Incidence *mIncidence; | 110 | Incidence *mIncidence; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | 113 | ||
114 | class KOMonthView; | 114 | class KOMonthView; |
115 | 115 | ||
116 | class MonthViewCell : public QWidget | 116 | class MonthViewCell : public QWidget |
117 | { | 117 | { |
118 | Q_OBJECT | 118 | Q_OBJECT |
119 | public: | 119 | public: |
120 | MonthViewCell( KOMonthView * ); | 120 | MonthViewCell( KOMonthView * ); |
121 | 121 | ||
122 | void setDate( const QDate & ); | 122 | void setDate( const QDate & ); |
123 | QDate date() const; | 123 | QDate date() const; |
124 | 124 | ||
125 | void setPrimary( bool ); | 125 | void setPrimary( bool ); |
126 | bool isPrimary() const; | 126 | bool isPrimary() const; |
127 | 127 | ||
128 | void setHoliday( bool ); | 128 | void setHoliday( bool ); |
129 | void setHoliday( const QString & ); | 129 | void setHoliday( const QString & ); |
130 | 130 | ||
131 | void updateCell(); | 131 | void updateCell(); |
132 | 132 | ||
133 | void updateConfig(); | 133 | void updateConfig(); |
134 | 134 | ||
135 | void enableScrollBars( bool ); | 135 | void enableScrollBars( bool ); |
136 | 136 | ||
137 | Incidence *selectedIncidence(); | 137 | Incidence *selectedIncidence(); |
138 | QDate selectedIncidenceDate(); | 138 | QDate selectedIncidenceDate(); |
139 | 139 | ||
140 | void deselect(); | 140 | void deselect(); |
141 | void select(); | 141 | void select(); |
142 | 142 | ||
143 | signals: | 143 | signals: |
144 | void defaultAction( Incidence * ); | 144 | void defaultAction( Incidence * ); |
145 | void newEventSignal( QDateTime ); | 145 | void newEventSignal( QDateTime ); |
146 | void showDaySignal( QDate ); | ||
146 | 147 | ||
147 | protected: | 148 | protected: |
148 | void resizeEvent( QResizeEvent * ); | 149 | void resizeEvent( QResizeEvent * ); |
149 | 150 | ||
150 | protected slots: | 151 | protected slots: |
151 | void defaultAction( QListBoxItem * ); | 152 | void defaultAction( QListBoxItem * ); |
152 | void contextMenu( QListBoxItem * ); | 153 | void contextMenu( QListBoxItem * ); |
153 | void selection( QListBoxItem * ); | 154 | void selection( QListBoxItem * ); |
154 | void cellClicked( QListBoxItem * ); | 155 | void cellClicked( QListBoxItem * ); |
155 | void newEvent(); | 156 | void newEvent(); |
157 | void showDay(); | ||
156 | 158 | ||
157 | private: | 159 | private: |
158 | KOMonthView *mMonthView; | 160 | KOMonthView *mMonthView; |
159 | 161 | ||
160 | QDate mDate; | 162 | QDate mDate; |
161 | bool mPrimary; | 163 | bool mPrimary; |
162 | bool mHoliday; | 164 | bool mHoliday; |
163 | QString mHolidayString; | 165 | QString mHolidayString; |
164 | 166 | ||
165 | //QLabel *mLabel; | 167 | //QLabel *mLabel; |
166 | QPushButton *mLabel; | 168 | QPushButton *mLabel; |
167 | QListBox *mItemList; | 169 | QListBox *mItemList; |
168 | 170 | ||
169 | QSize mLabelSize; | 171 | QSize mLabelSize; |
170 | QSize mLabelBigSize; | 172 | QSize mLabelBigSize; |
171 | QPalette mHolidayPalette; | 173 | QPalette mHolidayPalette; |
172 | QPalette mStandardPalette; | 174 | QPalette mStandardPalette; |
173 | QPalette mPrimaryPalette; | 175 | QPalette mPrimaryPalette; |
174 | QPalette mNonPrimaryPalette; | 176 | QPalette mNonPrimaryPalette; |
175 | void setMyPalette(); | 177 | void setMyPalette(); |
176 | QPalette getPalette (); | 178 | QPalette getPalette (); |
177 | void keyPressEvent ( QKeyEvent * ) ; | 179 | void keyPressEvent ( QKeyEvent * ) ; |
178 | 180 | ||
179 | }; | 181 | }; |
180 | 182 | ||
181 | 183 | ||
182 | class KOMonthView: public KOEventView | 184 | class KOMonthView: public KOEventView |
183 | { | 185 | { |
184 | Q_OBJECT | 186 | Q_OBJECT |
185 | public: | 187 | public: |
186 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 188 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
187 | ~KOMonthView(); | 189 | ~KOMonthView(); |
188 | 190 | ||
189 | /** Returns maximum number of days supported by the komonthview */ | 191 | /** Returns maximum number of days supported by the komonthview */ |
190 | virtual int maxDatesHint(); | 192 | virtual int maxDatesHint(); |
191 | 193 | ||
192 | /** Returns number of currently shown dates. */ | 194 | /** Returns number of currently shown dates. */ |
193 | virtual int currentDateCount(); | 195 | virtual int currentDateCount(); |
194 | 196 | ||
195 | /** returns the currently selected events */ | 197 | /** returns the currently selected events */ |
196 | virtual QPtrList<Incidence> selectedIncidences(); | 198 | virtual QPtrList<Incidence> selectedIncidences(); |
197 | 199 | ||
198 | /** returns dates of the currently selected events */ | 200 | /** returns dates of the currently selected events */ |
199 | virtual DateList selectedDates(); | 201 | virtual DateList selectedDates(); |
200 | 202 | ||
201 | virtual void printPreview(CalPrinter *calPrinter, | 203 | virtual void printPreview(CalPrinter *calPrinter, |
202 | const QDate &, const QDate &); | 204 | const QDate &, const QDate &); |
203 | bool isMonthView() { return true; } | 205 | bool isMonthView() { return true; } |
204 | 206 | ||
205 | MonthViewCell * selectedCell(); | 207 | MonthViewCell * selectedCell(); |
206 | public slots: | 208 | public slots: |
207 | virtual void updateView(); | 209 | virtual void updateView(); |
208 | virtual void updateConfig(); | 210 | virtual void updateConfig(); |
209 | virtual void showDates(const QDate &start, const QDate &end); | 211 | virtual void showDates(const QDate &start, const QDate &end); |
210 | virtual void showEvents(QPtrList<Event> eventList); | 212 | virtual void showEvents(QPtrList<Event> eventList); |
211 | 213 | ||
212 | void changeEventDisplay(Event *, int); | 214 | void changeEventDisplay(Event *, int); |
213 | 215 | ||
214 | void clearSelection(); | 216 | void clearSelection(); |
215 | 217 | ||
216 | void showContextMenu( Incidence * ); | 218 | void showContextMenu( Incidence * ); |
217 | 219 | ||
218 | void setSelectedCell( MonthViewCell * ); | 220 | void setSelectedCell( MonthViewCell * ); |
219 | 221 | ||
220 | protected slots: | 222 | protected slots: |
221 | void processSelectionChange(); | 223 | void processSelectionChange(); |
222 | signals: | 224 | signals: |
223 | void selectWeekNum ( int ); | 225 | void selectWeekNum ( int ); |
226 | void showDaySignal( QDate ); | ||
224 | protected: | 227 | protected: |
225 | void resizeEvent(QResizeEvent *); | 228 | void resizeEvent(QResizeEvent *); |
226 | void viewChanged(); | 229 | void viewChanged(); |
227 | void updateDayLabels(); | 230 | void updateDayLabels(); |
228 | 231 | ||
229 | private: | 232 | private: |
230 | int mDaysPerWeek; | 233 | int mDaysPerWeek; |
231 | int mNumWeeks; | 234 | int mNumWeeks; |
232 | int mNumCells; | 235 | int mNumCells; |
233 | bool mWeekStartsMonday; | 236 | bool mWeekStartsMonday; |
234 | bool mShowSatSunComp; | 237 | bool mShowSatSunComp; |
235 | void computeLayout(); | 238 | void computeLayout(); |
236 | 239 | ||
237 | QPtrVector<MonthViewCell> mCells; | 240 | QPtrVector<MonthViewCell> mCells; |
238 | QPtrVector<QLabel> mDayLabels; | 241 | QPtrVector<QLabel> mDayLabels; |
239 | QPtrVector<KOWeekButton> mWeekLabels; | 242 | QPtrVector<KOWeekButton> mWeekLabels; |
240 | 243 | ||
241 | bool mShortDayLabels; | 244 | bool mShortDayLabels; |
242 | int mWidthLongDayLabel; | 245 | int mWidthLongDayLabel; |
243 | 246 | ||
244 | QDate mStartDate; | 247 | QDate mStartDate; |
245 | 248 | ||
246 | MonthViewCell *mSelectedCell; | 249 | MonthViewCell *mSelectedCell; |
247 | 250 | ||
248 | KOEventPopupMenu *mContextMenu; | 251 | KOEventPopupMenu *mContextMenu; |
249 | void keyPressEvent ( QKeyEvent * ) ; | 252 | void keyPressEvent ( QKeyEvent * ) ; |
250 | 253 | ||
251 | }; | 254 | }; |
252 | 255 | ||
253 | #endif | 256 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 391f98c..6e151f9 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,226 +1,227 @@ | |||
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 "calendarview.h" | 36 | #include "calendarview.h" |
36 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
37 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
38 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
39 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
40 | #include "komonthview.h" | 41 | #include "komonthview.h" |
41 | #include "kolistview.h" | 42 | #include "kolistview.h" |
42 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
43 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
44 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
45 | #include "koprefs.h" | 46 | #include "koprefs.h" |
46 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
47 | 48 | ||
48 | #include "koviewmanager.h" | 49 | #include "koviewmanager.h" |
49 | //extern bool externFlagMonthviewBlockPainting; | 50 | //extern bool externFlagMonthviewBlockPainting; |
50 | 51 | ||
51 | //bool globalFlagBlockPainting = false; | 52 | //bool globalFlagBlockPainting = false; |
52 | int globalFlagBlockAgenda = 0; | 53 | int globalFlagBlockAgenda = 0; |
53 | int globalFlagBlockLabel = 0; | 54 | int globalFlagBlockLabel = 0; |
54 | int globalFlagBlockAgendaItemPaint = 1; | 55 | int globalFlagBlockAgendaItemPaint = 1; |
55 | int globalFlagBlockAgendaItemUpdate = 1; | 56 | int globalFlagBlockAgendaItemUpdate = 1; |
56 | 57 | ||
57 | 58 | ||
58 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 59 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
59 | QObject(), mMainView( mainView ) | 60 | QObject(), mMainView( mainView ) |
60 | { | 61 | { |
61 | mCurrentView = 0; | 62 | mCurrentView = 0; |
62 | 63 | ||
63 | mWhatsNextView = 0; | 64 | mWhatsNextView = 0; |
64 | mTodoView = 0; | 65 | mTodoView = 0; |
65 | mAgendaView = 0; | 66 | mAgendaView = 0; |
66 | mMonthView = 0; | 67 | mMonthView = 0; |
67 | mListView = 0; | 68 | mListView = 0; |
68 | mJournalView = 0; | 69 | mJournalView = 0; |
69 | mTimeSpanView = 0; | 70 | mTimeSpanView = 0; |
70 | mCurrentAgendaView = 0 ; | 71 | mCurrentAgendaView = 0 ; |
71 | mFlagShowNextxDays = false; | 72 | mFlagShowNextxDays = false; |
72 | } | 73 | } |
73 | 74 | ||
74 | KOViewManager::~KOViewManager() | 75 | KOViewManager::~KOViewManager() |
75 | { | 76 | { |
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||
79 | KOrg::BaseView *KOViewManager::currentView() | 80 | KOrg::BaseView *KOViewManager::currentView() |
80 | { | 81 | { |
81 | return mCurrentView; | 82 | return mCurrentView; |
82 | } | 83 | } |
83 | 84 | ||
84 | void KOViewManager::readSettings(KConfig *config) | 85 | void KOViewManager::readSettings(KConfig *config) |
85 | { | 86 | { |
86 | config->setGroup("General"); | 87 | config->setGroup("General"); |
87 | QString view = config->readEntry("Current View"); | 88 | QString view = config->readEntry("Current View"); |
88 | if (view == "WhatsNext") showWhatsNextView(); | 89 | if (view == "WhatsNext") showWhatsNextView(); |
89 | else if (view == "Month") showMonthView(); | 90 | else if (view == "Month") showMonthView(); |
90 | else if (view == "List") showListView(); | 91 | else if (view == "List") showListView(); |
91 | else if (view == "Journal") showJournalView(); | 92 | else if (view == "Journal") showJournalView(); |
92 | else if (view == "TimeSpan") showTimeSpanView(); | 93 | else if (view == "TimeSpan") showTimeSpanView(); |
93 | else if (view == "Todo") showTodoView(); | 94 | else if (view == "Todo") showTodoView(); |
94 | else { | 95 | else { |
95 | showAgendaView(); | 96 | showAgendaView(); |
96 | } | 97 | } |
97 | } | 98 | } |
98 | 99 | ||
99 | void KOViewManager::writeSettings(KConfig *config) | 100 | void KOViewManager::writeSettings(KConfig *config) |
100 | { | 101 | { |
101 | config->setGroup("General"); | 102 | config->setGroup("General"); |
102 | 103 | ||
103 | QString view; | 104 | QString view; |
104 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 105 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
105 | else if (mCurrentView == mMonthView) view = "Month"; | 106 | else if (mCurrentView == mMonthView) view = "Month"; |
106 | else if (mCurrentView == mListView) view = "List"; | 107 | else if (mCurrentView == mListView) view = "List"; |
107 | else if (mCurrentView == mJournalView) view = "Journal"; | 108 | else if (mCurrentView == mJournalView) view = "Journal"; |
108 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 109 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
109 | else if (mCurrentView == mTodoView) view = "Todo"; | 110 | else if (mCurrentView == mTodoView) view = "Todo"; |
110 | else view = "Agenda"; | 111 | else view = "Agenda"; |
111 | 112 | ||
112 | config->writeEntry("Current View",view); | 113 | config->writeEntry("Current View",view); |
113 | 114 | ||
114 | if (mAgendaView) { | 115 | if (mAgendaView) { |
115 | mAgendaView->writeSettings(config); | 116 | mAgendaView->writeSettings(config); |
116 | } | 117 | } |
117 | if (mTimeSpanView) { | 118 | if (mTimeSpanView) { |
118 | mTimeSpanView->writeSettings(config); | 119 | mTimeSpanView->writeSettings(config); |
119 | } | 120 | } |
120 | if (mListView) { | 121 | if (mListView) { |
121 | mListView->writeSettings(config); | 122 | mListView->writeSettings(config); |
122 | } | 123 | } |
123 | if (mTodoView) { | 124 | if (mTodoView) { |
124 | mTodoView->saveLayout(config,"Todo View"); | 125 | mTodoView->saveLayout(config,"Todo View"); |
125 | } | 126 | } |
126 | } | 127 | } |
127 | 128 | ||
128 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 129 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
129 | { | 130 | { |
130 | 131 | ||
131 | //mFlagShowNextxDays = false; | 132 | //mFlagShowNextxDays = false; |
132 | //if(view == mCurrentView) return; | 133 | //if(view == mCurrentView) return; |
133 | if ( view == 0 ) { | 134 | if ( view == 0 ) { |
134 | view = mCurrentView; | 135 | view = mCurrentView; |
135 | if ( view == 0 ) | 136 | if ( view == 0 ) |
136 | return; | 137 | return; |
137 | } | 138 | } |
138 | bool full = fullScreen; | 139 | bool full = fullScreen; |
139 | if(view == mCurrentView && view != mWhatsNextView ) { | 140 | if(view == mCurrentView && view != mWhatsNextView ) { |
140 | if ( mCurrentAgendaView < 0 ) | 141 | if ( mCurrentAgendaView < 0 ) |
141 | return; | 142 | return; |
142 | full = mMainView->leftFrame()->isVisible(); | 143 | full = mMainView->leftFrame()->isVisible(); |
143 | } else { | 144 | } else { |
144 | mCurrentView = view; | 145 | mCurrentView = view; |
145 | 146 | ||
146 | // bool full = fullScreen; | 147 | // bool full = fullScreen; |
147 | bool isFull = !mMainView->leftFrame()->isVisible(); | 148 | bool isFull = !mMainView->leftFrame()->isVisible(); |
148 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 149 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
149 | full = true; | 150 | full = true; |
150 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 151 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
151 | full = false; | 152 | full = false; |
152 | } | 153 | } |
153 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 154 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
154 | raiseCurrentView( full ); | 155 | raiseCurrentView( full ); |
155 | mMainView->processIncidenceSelection( 0 ); | 156 | mMainView->processIncidenceSelection( 0 ); |
156 | mMainView->updateView(); | 157 | mMainView->updateView(); |
157 | mMainView->adaptNavigationUnits(); | 158 | mMainView->adaptNavigationUnits(); |
158 | } | 159 | } |
159 | 160 | ||
160 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 161 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
161 | { | 162 | { |
162 | //qDebug("raiseCurrentView "); | 163 | //qDebug("raiseCurrentView "); |
163 | mCurrentAgendaView = 0; | 164 | mCurrentAgendaView = 0; |
164 | int wid = mMainView->width() ; | 165 | int wid = mMainView->width() ; |
165 | int hei = mMainView->height(); | 166 | int hei = mMainView->height(); |
166 | if ( mCurrentView == mMonthView ) { | 167 | if ( mCurrentView == mMonthView ) { |
167 | mMainView->navigatorBar()->show(); | 168 | mMainView->navigatorBar()->show(); |
168 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 169 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
169 | //mMainView->navigatorBar()->hide(); | 170 | //mMainView->navigatorBar()->hide(); |
170 | } else { | 171 | } else { |
171 | mMainView->navigatorBar()->hide(); | 172 | mMainView->navigatorBar()->hide(); |
172 | } | 173 | } |
173 | if ( fullScreen ) { | 174 | if ( fullScreen ) { |
174 | mMainView->leftFrame()->hide(); | 175 | mMainView->leftFrame()->hide(); |
175 | } else { | 176 | } else { |
176 | mMainView->leftFrame()->show(); | 177 | mMainView->leftFrame()->show(); |
177 | if ( KOPrefs::instance()->mVerticalScreen ) | 178 | if ( KOPrefs::instance()->mVerticalScreen ) |
178 | hei -= mMainView->leftFrame()->height(); | 179 | hei -= mMainView->leftFrame()->height(); |
179 | else | 180 | else |
180 | wid -= mMainView->leftFrame()->width(); | 181 | wid -= mMainView->leftFrame()->width(); |
181 | } | 182 | } |
182 | 183 | ||
183 | if ( globalFlagBlockAgenda == 5 ) { | 184 | if ( globalFlagBlockAgenda == 5 ) { |
184 | globalFlagBlockAgenda = 4; | 185 | globalFlagBlockAgenda = 4; |
185 | globalFlagBlockAgendaItemPaint = 1; | 186 | globalFlagBlockAgendaItemPaint = 1; |
186 | } | 187 | } |
187 | mMainView->viewStack()->raiseWidget(mCurrentView); | 188 | mMainView->viewStack()->raiseWidget(mCurrentView); |
188 | if ( globalFlagBlockAgenda == 4 ) { | 189 | if ( globalFlagBlockAgenda == 4 ) { |
189 | if ( mCurrentView == mAgendaView ) { | 190 | if ( mCurrentView == mAgendaView ) { |
190 | //globalFlagBlockAgenda =1 ; | 191 | //globalFlagBlockAgenda =1 ; |
191 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 192 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
192 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 193 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
193 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 194 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
194 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 195 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
195 | qApp->processEvents(); | 196 | qApp->processEvents(); |
196 | //qDebug("qApp->processEvents() "); | 197 | //qDebug("qApp->processEvents() "); |
197 | globalFlagBlockAgenda = 0; | 198 | globalFlagBlockAgenda = 0; |
198 | mAgendaView->repaintAgenda(); | 199 | mAgendaView->repaintAgenda(); |
199 | 200 | ||
200 | } | 201 | } |
201 | globalFlagBlockAgenda = 0; | 202 | globalFlagBlockAgenda = 0; |
202 | } | 203 | } |
203 | //qDebug("raiseCurrentView ende "); | 204 | //qDebug("raiseCurrentView ende "); |
204 | } | 205 | } |
205 | 206 | ||
206 | void KOViewManager::updateView() | 207 | void KOViewManager::updateView() |
207 | { | 208 | { |
208 | // qDebug("KOViewManager::updateView() "); | 209 | // qDebug("KOViewManager::updateView() "); |
209 | // if we are updating mTodoView, we get endless recursion | 210 | // if we are updating mTodoView, we get endless recursion |
210 | if ( mTodoView == mCurrentView ) | 211 | if ( mTodoView == mCurrentView ) |
211 | return; | 212 | return; |
212 | if ( mCurrentView ) mCurrentView->updateView(); | 213 | if ( mCurrentView ) mCurrentView->updateView(); |
213 | 214 | ||
214 | } | 215 | } |
215 | 216 | ||
216 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 217 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
217 | { | 218 | { |
218 | // kdDebug() << "KOViewManager::updateView()" << endl; | 219 | // kdDebug() << "KOViewManager::updateView()" << endl; |
219 | 220 | ||
220 | if (mCurrentView) mCurrentView->showDates(start, end); | 221 | if (mCurrentView) mCurrentView->showDates(start, end); |
221 | 222 | ||
222 | if (mTodoView) mTodoView->updateView(); | 223 | if (mTodoView) mTodoView->updateView(); |
223 | } | 224 | } |
224 | 225 | ||
225 | 226 | ||
226 | void KOViewManager::updateWNview() | 227 | void KOViewManager::updateWNview() |
@@ -255,323 +256,325 @@ void KOViewManager::showListView() | |||
255 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 256 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
256 | mMainView, SLOT(editIncidence(Incidence *))); | 257 | mMainView, SLOT(editIncidence(Incidence *))); |
257 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 258 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
258 | mMainView, SLOT(deleteIncidence(Incidence *))); | 259 | mMainView, SLOT(deleteIncidence(Incidence *))); |
259 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 260 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
260 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 261 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
261 | connect( mListView, SIGNAL( signalNewEvent() ), | 262 | connect( mListView, SIGNAL( signalNewEvent() ), |
262 | mMainView, SLOT( newEvent() ) ); | 263 | mMainView, SLOT( newEvent() ) ); |
263 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 264 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
264 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 265 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
265 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 266 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
266 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 267 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
267 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 268 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
268 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 269 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
269 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 270 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
270 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 271 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
271 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 272 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
272 | } | 273 | } |
273 | // bool temp = mFlagShowNextxDays; | 274 | // bool temp = mFlagShowNextxDays; |
274 | //globalFlagBlockPainting = true; | 275 | //globalFlagBlockPainting = true; |
275 | globalFlagBlockAgenda = 1; | 276 | globalFlagBlockAgenda = 1; |
276 | if ( KOPrefs::instance()->mListViewMonthTimespan ) | 277 | if ( KOPrefs::instance()->mListViewMonthTimespan ) |
277 | mMainView->dateNavigator()->selectMonth(); | 278 | mMainView->dateNavigator()->selectMonth(); |
278 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 279 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
279 | //mFlagShowNextxDays = temp; | 280 | //mFlagShowNextxDays = temp; |
280 | } | 281 | } |
281 | 282 | ||
282 | void KOViewManager::showAgendaView( bool fullScreen ) | 283 | void KOViewManager::showAgendaView( bool fullScreen ) |
283 | { | 284 | { |
284 | 285 | ||
285 | mMainView->dialogManager()->hideSearchDialog(); | 286 | mMainView->dialogManager()->hideSearchDialog(); |
286 | // qDebug("KOViewManager::showAgendaView "); | 287 | // qDebug("KOViewManager::showAgendaView "); |
287 | bool full; | 288 | bool full; |
288 | full = fullScreen; | 289 | full = fullScreen; |
289 | if (!mAgendaView) { | 290 | if (!mAgendaView) { |
290 | full = false; | 291 | full = false; |
291 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 292 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
292 | addView(mAgendaView); | 293 | addView(mAgendaView); |
293 | #ifndef DESKTOP_VERSION | 294 | #ifndef DESKTOP_VERSION |
294 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 295 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
295 | #endif | 296 | #endif |
296 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 297 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
297 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 298 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
298 | 299 | ||
299 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 300 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
300 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 301 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
301 | mMainView, SLOT(newEvent(QDateTime))); | 302 | mMainView, SLOT(newEvent(QDateTime))); |
302 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 303 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
303 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 304 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
304 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 305 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
305 | mMainView, SLOT(newEvent(QDate))); | 306 | mMainView, SLOT(newEvent(QDate))); |
306 | 307 | ||
307 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 308 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
308 | mMainView, SLOT(editIncidence(Incidence *))); | 309 | mMainView, SLOT(editIncidence(Incidence *))); |
309 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 310 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
310 | mMainView, SLOT(showIncidence(Incidence *))); | 311 | mMainView, SLOT(showIncidence(Incidence *))); |
311 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 312 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
312 | mMainView, SLOT(deleteIncidence(Incidence *))); | 313 | mMainView, SLOT(deleteIncidence(Incidence *))); |
313 | 314 | ||
314 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 315 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 316 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
316 | 317 | ||
317 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 318 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
318 | mMainView, SLOT( toggleExpand() ) ); | 319 | mMainView, SLOT( toggleExpand() ) ); |
319 | 320 | ||
320 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 321 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
321 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 322 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
322 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 323 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
323 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 324 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
324 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 325 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
325 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 326 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
326 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 327 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
327 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 328 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
328 | SLOT( updateTodo( Todo *, int ) ) ); | 329 | SLOT( updateTodo( Todo *, int ) ) ); |
329 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 330 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
330 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 331 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
331 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 332 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 333 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
333 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 334 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 335 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
335 | mAgendaView->readSettings(); | 336 | mAgendaView->readSettings(); |
336 | mAgendaView->updateConfig(); | 337 | mAgendaView->updateConfig(); |
337 | } | 338 | } |
338 | 339 | ||
339 | showView( mAgendaView, full); | 340 | showView( mAgendaView, full); |
340 | 341 | ||
341 | } | 342 | } |
342 | 343 | ||
343 | void KOViewManager::showDayView() | 344 | void KOViewManager::showDayView() |
344 | { | 345 | { |
345 | mFlagShowNextxDays = false; | 346 | mFlagShowNextxDays = false; |
346 | globalFlagBlockLabel = 1; | 347 | globalFlagBlockLabel = 1; |
347 | globalFlagBlockAgenda = 1; | 348 | globalFlagBlockAgenda = 1; |
348 | if ( mCurrentAgendaView != 1 ) | 349 | if ( mCurrentAgendaView != 1 ) |
349 | mCurrentAgendaView = -1; | 350 | mCurrentAgendaView = -1; |
350 | showAgendaView(); | 351 | showAgendaView(); |
351 | qApp->processEvents(); | 352 | qApp->processEvents(); |
352 | globalFlagBlockAgenda = 2; | 353 | globalFlagBlockAgenda = 2; |
353 | globalFlagBlockLabel = 0; | 354 | globalFlagBlockLabel = 0; |
354 | mMainView->dateNavigator()->selectDates( 1 ); | 355 | mMainView->dateNavigator()->selectDates( 1 ); |
355 | mCurrentAgendaView = 1 ; | 356 | mCurrentAgendaView = 1 ; |
356 | 357 | ||
357 | } | 358 | } |
358 | 359 | ||
359 | void KOViewManager::showWorkWeekView() | 360 | void KOViewManager::showWorkWeekView() |
360 | { | 361 | { |
361 | mFlagShowNextxDays = false; | 362 | mFlagShowNextxDays = false; |
362 | globalFlagBlockAgenda = 1; | 363 | globalFlagBlockAgenda = 1; |
363 | globalFlagBlockLabel = 1; | 364 | globalFlagBlockLabel = 1; |
364 | if ( mCurrentAgendaView != 5 ) | 365 | if ( mCurrentAgendaView != 5 ) |
365 | mCurrentAgendaView = -1; | 366 | mCurrentAgendaView = -1; |
366 | showAgendaView(); | 367 | showAgendaView(); |
367 | qApp->processEvents(); | 368 | qApp->processEvents(); |
368 | globalFlagBlockAgenda = 2; | 369 | globalFlagBlockAgenda = 2; |
369 | globalFlagBlockLabel = 0; | 370 | globalFlagBlockLabel = 0; |
370 | mMainView->dateNavigator()->selectWorkWeek(); | 371 | mMainView->dateNavigator()->selectWorkWeek(); |
371 | mCurrentAgendaView = 5 ; | 372 | mCurrentAgendaView = 5 ; |
372 | 373 | ||
373 | } | 374 | } |
374 | 375 | ||
375 | void KOViewManager::showWeekView() | 376 | void KOViewManager::showWeekView() |
376 | { | 377 | { |
377 | /* | 378 | /* |
378 | globalFlagBlockAgenda = 2; | 379 | globalFlagBlockAgenda = 2; |
379 | qDebug("4globalFlagBlockAgenda = 2; "); | 380 | qDebug("4globalFlagBlockAgenda = 2; "); |
380 | //globalFlagBlockPainting = true; | 381 | //globalFlagBlockPainting = true; |
381 | mMainView->dateNavigator()->selectWeek(); | 382 | mMainView->dateNavigator()->selectWeek(); |
382 | showAgendaView(); | 383 | showAgendaView(); |
383 | */ | 384 | */ |
384 | 385 | ||
385 | 386 | ||
386 | mFlagShowNextxDays = false; | 387 | mFlagShowNextxDays = false; |
387 | globalFlagBlockAgenda = 1; | 388 | globalFlagBlockAgenda = 1; |
388 | globalFlagBlockLabel = 1; | 389 | globalFlagBlockLabel = 1; |
389 | if ( mCurrentAgendaView != 7 ) | 390 | if ( mCurrentAgendaView != 7 ) |
390 | mCurrentAgendaView = -1; | 391 | mCurrentAgendaView = -1; |
391 | showAgendaView(); | 392 | showAgendaView(); |
392 | qApp->processEvents(); | 393 | qApp->processEvents(); |
393 | globalFlagBlockAgenda = 2; | 394 | globalFlagBlockAgenda = 2; |
394 | globalFlagBlockLabel = 0; | 395 | globalFlagBlockLabel = 0; |
395 | mMainView->dateNavigator()->selectWeek(); | 396 | mMainView->dateNavigator()->selectWeek(); |
396 | mCurrentAgendaView = 7 ; | 397 | mCurrentAgendaView = 7 ; |
397 | } | 398 | } |
398 | 399 | ||
399 | void KOViewManager::showNextXView() | 400 | void KOViewManager::showNextXView() |
400 | { | 401 | { |
401 | 402 | ||
402 | globalFlagBlockAgenda = 1; | 403 | globalFlagBlockAgenda = 1; |
403 | if ( mCurrentAgendaView != 3 ) | 404 | if ( mCurrentAgendaView != 3 ) |
404 | mCurrentAgendaView = -1; | 405 | mCurrentAgendaView = -1; |
405 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 406 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
406 | globalFlagBlockAgenda = 2; | 407 | globalFlagBlockAgenda = 2; |
407 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 408 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
408 | KOPrefs::instance()->mNextXDays ); | 409 | KOPrefs::instance()->mNextXDays ); |
409 | mFlagShowNextxDays = true; | 410 | mFlagShowNextxDays = true; |
410 | mCurrentAgendaView = 3 ; | 411 | mCurrentAgendaView = 3 ; |
411 | } | 412 | } |
412 | bool KOViewManager::showsNextDays() | 413 | bool KOViewManager::showsNextDays() |
413 | { | 414 | { |
414 | return mFlagShowNextxDays; | 415 | return mFlagShowNextxDays; |
415 | } | 416 | } |
416 | void KOViewManager::showMonthView() | 417 | void KOViewManager::showMonthView() |
417 | { | 418 | { |
418 | if (!mMonthView) { | 419 | if (!mMonthView) { |
419 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 420 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
420 | 421 | ||
421 | addView(mMonthView); | 422 | addView(mMonthView); |
422 | // mMonthView->show(); | 423 | // mMonthView->show(); |
423 | // SIGNALS/SLOTS FOR MONTH VIEW | 424 | // SIGNALS/SLOTS FOR MONTH VIEW |
424 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 425 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
425 | mMainView, SLOT(newEvent(QDateTime))); | 426 | mMainView, SLOT(newEvent(QDateTime))); |
426 | 427 | ||
427 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 428 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
428 | mMainView, SLOT(showIncidence(Incidence *))); | 429 | mMainView, SLOT(showIncidence(Incidence *))); |
429 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 430 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
430 | mMainView, SLOT(editIncidence(Incidence *))); | 431 | mMainView, SLOT(editIncidence(Incidence *))); |
431 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 432 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
432 | mMainView, SLOT(deleteIncidence(Incidence *))); | 433 | mMainView, SLOT(deleteIncidence(Incidence *))); |
433 | 434 | ||
434 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 435 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
435 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 436 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
436 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 437 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
437 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 438 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
438 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 439 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
439 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 440 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
440 | 441 | ||
441 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 442 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 443 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
443 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 444 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 445 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
445 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 446 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
446 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 447 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
448 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | ||
449 | mMainView, SLOT ( showDay( QDate ) ) ); | ||
447 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 450 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
448 | mMonthView->updateConfig(); | 451 | mMonthView->updateConfig(); |
449 | } | 452 | } |
450 | 453 | ||
451 | globalFlagBlockAgenda = 1; | 454 | globalFlagBlockAgenda = 1; |
452 | //mFlagShowNextxDays = false; | 455 | //mFlagShowNextxDays = false; |
453 | // if(mMonthView == mCurrentView) return; | 456 | // if(mMonthView == mCurrentView) return; |
454 | mMainView->dateNavigator()->selectMonth(); | 457 | mMainView->dateNavigator()->selectMonth(); |
455 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 458 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
456 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 459 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
457 | 460 | ||
458 | showView(mMonthView, true ); | 461 | showView(mMonthView, true ); |
459 | 462 | ||
460 | } | 463 | } |
461 | 464 | ||
462 | void KOViewManager::showTodoView() | 465 | void KOViewManager::showTodoView() |
463 | { | 466 | { |
464 | //mFlagShowNextxDays = false; | 467 | //mFlagShowNextxDays = false; |
465 | if ( !mTodoView ) { | 468 | if ( !mTodoView ) { |
466 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 469 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
467 | "KOViewManager::TodoView" ); | 470 | "KOViewManager::TodoView" ); |
468 | 471 | ||
469 | addView( mTodoView ); | 472 | addView( mTodoView ); |
470 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 473 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
471 | 474 | ||
472 | // SIGNALS/SLOTS FOR TODO VIEW | 475 | // SIGNALS/SLOTS FOR TODO VIEW |
473 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 476 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
474 | mMainView, SLOT( newTodo() ) ); | 477 | mMainView, SLOT( newTodo() ) ); |
475 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 478 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
476 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 479 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
477 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 480 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
478 | mMainView, SLOT( showTodo( Todo * ) ) ); | 481 | mMainView, SLOT( showTodo( Todo * ) ) ); |
479 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 482 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
480 | mMainView, SLOT( editTodo( Todo * ) ) ); | 483 | mMainView, SLOT( editTodo( Todo * ) ) ); |
481 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 484 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
482 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 485 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
483 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 486 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
484 | mMainView, SLOT( purgeCompleted() ) ); | 487 | mMainView, SLOT( purgeCompleted() ) ); |
485 | 488 | ||
486 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 489 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
487 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 490 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
488 | 491 | ||
489 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 492 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
490 | SLOT( updateConfig() ) ); | 493 | SLOT( updateConfig() ) ); |
491 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 494 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
492 | SLOT( updateTodo( Todo *, int ) ) ); | 495 | SLOT( updateTodo( Todo *, int ) ) ); |
493 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 496 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
494 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 497 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
495 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 498 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
496 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 499 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
497 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 500 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
498 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 501 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
499 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 502 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
500 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 503 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
501 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 504 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
502 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 505 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
503 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 506 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
504 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 507 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
505 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 508 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
506 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 509 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
507 | KConfig *config = KOGlobals::config(); | 510 | KConfig *config = KOGlobals::config(); |
508 | mTodoView->restoreLayout(config,"Todo View"); | 511 | mTodoView->restoreLayout(config,"Todo View"); |
509 | } | 512 | } |
510 | 513 | ||
511 | globalFlagBlockAgenda = 1; | 514 | globalFlagBlockAgenda = 1; |
512 | showView( mTodoView, true ); | 515 | showView( mTodoView, true ); |
513 | 516 | ||
514 | } | 517 | } |
515 | 518 | ||
516 | void KOViewManager::showJournalView() | 519 | void KOViewManager::showJournalView() |
517 | { | 520 | { |
518 | //mFlagShowNextxDays = false; | 521 | //mFlagShowNextxDays = false; |
519 | if (!mJournalView) { | 522 | if (!mJournalView) { |
520 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 523 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
521 | "KOViewManager::JournalView"); | 524 | "KOViewManager::JournalView"); |
522 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 525 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
523 | SLOT( updateConfig() ) ); | 526 | SLOT( updateConfig() ) ); |
524 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 527 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
525 | addView(mJournalView); | 528 | addView(mJournalView); |
526 | } | 529 | } |
527 | 530 | ||
528 | showView(mJournalView); | 531 | showView(mJournalView); |
529 | } | 532 | } |
530 | 533 | ||
531 | void KOViewManager::showTimeSpanView() | 534 | void KOViewManager::showTimeSpanView() |
532 | { | 535 | { |
533 | //mFlagShowNextxDays = false; | 536 | //mFlagShowNextxDays = false; |
534 | if (!mTimeSpanView) { | 537 | if (!mTimeSpanView) { |
535 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 538 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
536 | "KOViewManager::TimeSpanView"); | 539 | "KOViewManager::TimeSpanView"); |
537 | addView(mTimeSpanView); | 540 | addView(mTimeSpanView); |
538 | 541 | ||
539 | mTimeSpanView->readSettings(); | 542 | mTimeSpanView->readSettings(); |
540 | } | 543 | } |
541 | 544 | ||
542 | showView(mTimeSpanView); | 545 | showView(mTimeSpanView); |
543 | } | 546 | } |
544 | 547 | ||
545 | Incidence *KOViewManager::currentSelection() | 548 | Incidence *KOViewManager::currentSelection() |
546 | { | 549 | { |
547 | if (!mCurrentView) return 0; | 550 | if (!mCurrentView) return 0; |
548 | if ( mCurrentView == mListView ) { | 551 | if ( mCurrentView == mListView ) { |
549 | if ( mListView->currentItem() ) | 552 | if ( mListView->currentItem() ) |
550 | return mListView->currentItem(); | 553 | return mListView->currentItem(); |
551 | } | 554 | } |
552 | return mCurrentView->selectedIncidences().first(); | 555 | return mCurrentView->selectedIncidences().first(); |
553 | } | 556 | } |
554 | 557 | ||
555 | QDate KOViewManager::currentSelectionDate() | 558 | QDate KOViewManager::currentSelectionDate() |
556 | { | 559 | { |
557 | QDate qd; | 560 | QDate qd; |
558 | if (mCurrentView) { | 561 | if (mCurrentView) { |
559 | DateList qvl = mCurrentView->selectedDates(); | 562 | DateList qvl = mCurrentView->selectedDates(); |
560 | if (!qvl.isEmpty()) qd = qvl.first(); | 563 | if (!qvl.isEmpty()) qd = qvl.first(); |
561 | } | 564 | } |
562 | return qd; | 565 | return qd; |
563 | } | 566 | } |
564 | 567 | ||
565 | void KOViewManager::addView(KOrg::BaseView *view) | 568 | void KOViewManager::addView(KOrg::BaseView *view) |
566 | { | 569 | { |
567 | #if QT_VERSION >= 300 | 570 | #if QT_VERSION >= 300 |
568 | mMainView->viewStack()->addWidget( view ); | 571 | mMainView->viewStack()->addWidget( view ); |
569 | #else | 572 | #else |
570 | mMainView->viewStack()->addWidget( view, 1 ); | 573 | mMainView->viewStack()->addWidget( view, 1 ); |
571 | #endif | 574 | #endif |
572 | } | 575 | } |
573 | 576 | ||
574 | void KOViewManager::setDocumentId( const QString &id ) | 577 | void KOViewManager::setDocumentId( const QString &id ) |
575 | { | 578 | { |
576 | if (mTodoView) mTodoView->setDocumentId( id ); | 579 | if (mTodoView) mTodoView->setDocumentId( id ); |
577 | } | 580 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 46ae6a0..a652c05 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -387,384 +387,391 @@ void MainWindow::closeEvent( QCloseEvent* ce ) | |||
387 | 387 | ||
388 | } | 388 | } |
389 | 389 | ||
390 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 390 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
391 | { | 391 | { |
392 | QDataStream stream( data, IO_ReadOnly ); | 392 | QDataStream stream( data, IO_ReadOnly ); |
393 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 393 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
394 | //QString datamess; | 394 | //QString datamess; |
395 | //qDebug("message "); | 395 | //qDebug("message "); |
396 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 396 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
397 | 397 | ||
398 | if ( cmsg == "setDocument(QString)" ) { | 398 | if ( cmsg == "setDocument(QString)" ) { |
399 | QDataStream stream( data, IO_ReadOnly ); | 399 | QDataStream stream( data, IO_ReadOnly ); |
400 | QString fileName; | 400 | QString fileName; |
401 | stream >> fileName; | 401 | stream >> fileName; |
402 | //qDebug("filename %s ", fileName.latin1()); | 402 | //qDebug("filename %s ", fileName.latin1()); |
403 | showMaximized(); | 403 | showMaximized(); |
404 | raise(); | 404 | raise(); |
405 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 405 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
406 | mSyncManager->slotSyncMenu( 1002 ); | 406 | mSyncManager->slotSyncMenu( 1002 ); |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | 409 | ||
410 | if ( cmsg == "-writeFile" ) { | 410 | if ( cmsg == "-writeFile" ) { |
411 | // I made from the "-writeFile" an "-writeAlarm" | 411 | // I made from the "-writeFile" an "-writeAlarm" |
412 | mView->viewManager()->showWhatsNextView(); | 412 | mView->viewManager()->showWhatsNextView(); |
413 | mCalendar->checkAlarmForIncidence( 0, true); | 413 | mCalendar->checkAlarmForIncidence( 0, true); |
414 | showMaximized(); | 414 | showMaximized(); |
415 | raise(); | 415 | raise(); |
416 | return; | 416 | return; |
417 | 417 | ||
418 | } | 418 | } |
419 | if ( cmsg == "-writeFileSilent" ) { | 419 | if ( cmsg == "-writeFileSilent" ) { |
420 | // I made from the "-writeFile" an "-writeAlarm" | 420 | // I made from the "-writeFile" an "-writeAlarm" |
421 | // mView->viewManager()->showWhatsNextView(); | 421 | // mView->viewManager()->showWhatsNextView(); |
422 | mCalendar->checkAlarmForIncidence( 0, true); | 422 | mCalendar->checkAlarmForIncidence( 0, true); |
423 | //showMaximized(); | 423 | //showMaximized(); |
424 | //raise(); | 424 | //raise(); |
425 | hide(); | 425 | hide(); |
426 | return; | 426 | return; |
427 | } | 427 | } |
428 | if ( cmsg == "-newCountdown" ) { | 428 | if ( cmsg == "-newCountdown" ) { |
429 | qDebug("newCountdown "); | 429 | qDebug("newCountdown "); |
430 | 430 | ||
431 | } | 431 | } |
432 | QString msg ; | 432 | QString msg ; |
433 | QString allmsg = cmsg; | 433 | QString allmsg = cmsg; |
434 | while ( allmsg.length() > 0 ) { | 434 | while ( allmsg.length() > 0 ) { |
435 | int nextC = allmsg.find( "-", 1 ); | 435 | int nextC = allmsg.find( "-", 1 ); |
436 | if ( nextC == -1 ) { | 436 | if ( nextC == -1 ) { |
437 | msg = allmsg; | 437 | msg = allmsg; |
438 | allmsg = ""; | 438 | allmsg = ""; |
439 | } else{ | 439 | } else{ |
440 | msg = allmsg.left( nextC ); | 440 | msg = allmsg.left( nextC ); |
441 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 441 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
442 | } | 442 | } |
443 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 443 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
444 | if ( msg == "-newEvent" ) { | 444 | if ( msg == "-newEvent" ) { |
445 | mView->newEvent(); | 445 | mView->newEvent(); |
446 | } | 446 | } |
447 | if ( msg == "-newTodo" ) { | 447 | if ( msg == "-newTodo" ) { |
448 | mView->newTodo(); | 448 | mView->newTodo(); |
449 | 449 | ||
450 | } | 450 | } |
451 | if ( msg == "-showWN" ) { | 451 | if ( msg == "-showWN" ) { |
452 | mView->viewManager()->showWhatsNextView(); | 452 | mView->viewManager()->showWhatsNextView(); |
453 | } | 453 | } |
454 | if ( msg == "-showTodo" ) { | 454 | if ( msg == "-showTodo" ) { |
455 | mView->viewManager()->showTodoView(); | 455 | mView->viewManager()->showTodoView(); |
456 | } | 456 | } |
457 | if ( msg == "-showList" ) { | 457 | if ( msg == "-showList" ) { |
458 | mView->viewManager()->showListView(); | 458 | mView->viewManager()->showListView(); |
459 | } | 459 | } |
460 | else if ( msg == "-showDay" ) { | 460 | else if ( msg == "-showDay" ) { |
461 | mView->viewManager()->showDayView(); | 461 | mView->viewManager()->showDayView(); |
462 | } | 462 | } |
463 | else if ( msg == "-showWWeek" ) { | 463 | else if ( msg == "-showWWeek" ) { |
464 | mView->viewManager()->showWorkWeekView(); | 464 | mView->viewManager()->showWorkWeekView(); |
465 | } | 465 | } |
466 | else if ( msg == "-ringSync" ) { | 466 | else if ( msg == "-ringSync" ) { |
467 | mSyncManager->multiSync( false ); | 467 | mSyncManager->multiSync( false ); |
468 | } | 468 | } |
469 | else if ( msg == "-showWeek" ) { | 469 | else if ( msg == "-showWeek" ) { |
470 | mView->viewManager()->showWeekView(); | 470 | mView->viewManager()->showWeekView(); |
471 | } | 471 | } |
472 | else if ( msg == "-showTodo" ) { | 472 | else if ( msg == "-showTodo" ) { |
473 | mView->viewManager()->showTodoView(); | 473 | mView->viewManager()->showTodoView(); |
474 | } | 474 | } |
475 | else if ( msg == "-showJournal" ) { | 475 | else if ( msg == "-showJournal" ) { |
476 | mView->dateNavigator()->selectDates( 1 ); | 476 | mView->dateNavigator()->selectDates( 1 ); |
477 | mView->dateNavigator()->selectToday(); | 477 | mView->dateNavigator()->selectToday(); |
478 | mView->viewManager()->showJournalView(); | 478 | mView->viewManager()->showJournalView(); |
479 | } | 479 | } |
480 | else if ( msg == "-showKO" ) { | 480 | else if ( msg == "-showKO" ) { |
481 | mView->viewManager()->showNextXView(); | 481 | mView->viewManager()->showNextXView(); |
482 | } | 482 | } |
483 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 483 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
484 | mView->viewManager()->showWhatsNextView(); | 484 | mView->viewManager()->showWhatsNextView(); |
485 | } | 485 | } |
486 | else if ( msg == "-showNextXView" ) { | 486 | else if ( msg == "-showNextXView" ) { |
487 | mView->viewManager()->showNextXView(); | 487 | mView->viewManager()->showNextXView(); |
488 | } | 488 | } |
489 | 489 | ||
490 | 490 | ||
491 | } | 491 | } |
492 | 492 | ||
493 | showMaximized(); | 493 | showMaximized(); |
494 | raise(); | 494 | raise(); |
495 | } | 495 | } |
496 | 496 | ||
497 | QPixmap MainWindow::loadPixmap( QString name ) | 497 | QPixmap MainWindow::loadPixmap( QString name ) |
498 | { | 498 | { |
499 | return SmallIcon( name ); | 499 | return SmallIcon( name ); |
500 | 500 | ||
501 | } | 501 | } |
502 | void MainWindow::initActions() | 502 | void MainWindow::initActions() |
503 | { | 503 | { |
504 | //KOPrefs::instance()->mShowFullMenu | 504 | //KOPrefs::instance()->mShowFullMenu |
505 | iconToolBar->clear(); | 505 | iconToolBar->clear(); |
506 | KOPrefs *p = KOPrefs::instance(); | 506 | KOPrefs *p = KOPrefs::instance(); |
507 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 507 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
508 | 508 | ||
509 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 509 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
510 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 510 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
511 | QPopupMenu *importMenu = new QPopupMenu( this ); | 511 | QPopupMenu *importMenu = new QPopupMenu( this ); |
512 | selectFilterMenu = new QPopupMenu( this ); | 512 | selectFilterMenu = new QPopupMenu( this ); |
513 | selectFilterMenu->setCheckable( true ); | 513 | selectFilterMenu->setCheckable( true ); |
514 | syncMenu = new QPopupMenu( this ); | 514 | syncMenu = new QPopupMenu( this ); |
515 | configureAgendaMenu = new QPopupMenu( this ); | 515 | configureAgendaMenu = new QPopupMenu( this ); |
516 | configureToolBarMenu = new QPopupMenu( this ); | 516 | configureToolBarMenu = new QPopupMenu( this ); |
517 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 517 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
518 | if ( KOPrefs::instance()->mShowFullMenu ) { | 518 | if ( KOPrefs::instance()->mShowFullMenu ) { |
519 | QMenuBar *menuBar1; | 519 | QMenuBar *menuBar1; |
520 | menuBar1 = menuBar(); | 520 | menuBar1 = menuBar(); |
521 | menuBar1->insertItem( i18n("File"), importMenu ); | 521 | menuBar1->insertItem( i18n("File"), importMenu ); |
522 | menuBar1->insertItem( i18n("View"), viewMenu ); | 522 | menuBar1->insertItem( i18n("View"), viewMenu ); |
523 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 523 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
524 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 524 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
525 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 525 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
526 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 526 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
527 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 527 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
528 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 528 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
529 | } else { | 529 | } else { |
530 | QPEMenuBar *menuBar1; | 530 | QPEMenuBar *menuBar1; |
531 | menuBar1 = new QPEMenuBar( iconToolBar ); | 531 | menuBar1 = new QPEMenuBar( iconToolBar ); |
532 | QPopupMenu *menuBar = new QPopupMenu( this ); | 532 | QPopupMenu *menuBar = new QPopupMenu( this ); |
533 | menuBar1->insertItem( i18n("ME"), menuBar); | 533 | menuBar1->insertItem( i18n("ME"), menuBar); |
534 | menuBar->insertItem( i18n("File"), importMenu ); | 534 | menuBar->insertItem( i18n("File"), importMenu ); |
535 | menuBar->insertItem( i18n("View"), viewMenu ); | 535 | menuBar->insertItem( i18n("View"), viewMenu ); |
536 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 536 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
537 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 537 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
538 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 538 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
539 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 539 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
540 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 540 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
541 | menuBar->insertItem( i18n("Help"), helpMenu ); | 541 | menuBar->insertItem( i18n("Help"), helpMenu ); |
542 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 542 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
543 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 543 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
544 | } | 544 | } |
545 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 545 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
546 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 546 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
547 | 547 | ||
548 | // ****************** | 548 | // ****************** |
549 | QAction *action; | 549 | QAction *action; |
550 | QIconSet icon; | 550 | QIconSet icon; |
551 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 551 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
552 | configureToolBarMenu->setCheckable( true ); | 552 | configureToolBarMenu->setCheckable( true ); |
553 | 553 | ||
554 | QString pathString = ""; | 554 | QString pathString = ""; |
555 | if ( !p->mToolBarMiniIcons ) { | 555 | if ( !p->mToolBarMiniIcons ) { |
556 | if ( QApplication::desktop()->width() < 480 ) | 556 | if ( QApplication::desktop()->width() < 480 ) |
557 | pathString += "icons16/"; | 557 | pathString += "icons16/"; |
558 | } else | 558 | } else |
559 | pathString += "iconsmini/"; | 559 | pathString += "iconsmini/"; |
560 | configureAgendaMenu->setCheckable( true ); | 560 | configureAgendaMenu->setCheckable( true ); |
561 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 561 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
562 | configureAgendaMenu->insertSeparator(); | 562 | configureAgendaMenu->insertSeparator(); |
563 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 563 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
564 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 564 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
565 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 565 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
566 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 566 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
567 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 567 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
568 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 568 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
569 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 569 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
570 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 570 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
571 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 571 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
572 | 572 | ||
573 | icon = loadPixmap( pathString + "configure" ); | 573 | icon = loadPixmap( pathString + "configure" ); |
574 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 574 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
575 | action->addTo( actionMenu ); | 575 | action->addTo( actionMenu ); |
576 | connect( action, SIGNAL( activated() ), | 576 | connect( action, SIGNAL( activated() ), |
577 | mView, SLOT( edit_options() ) ); | 577 | mView, SLOT( edit_options() ) ); |
578 | actionMenu->insertSeparator(); | 578 | actionMenu->insertSeparator(); |
579 | |||
580 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | ||
581 | action->addTo( actionMenu ); | ||
582 | connect( action, SIGNAL( activated() ), | ||
583 | mView, SLOT( undo_delete() ) ); | ||
584 | actionMenu->insertSeparator(); | ||
585 | |||
579 | icon = loadPixmap( pathString + "newevent" ); | 586 | icon = loadPixmap( pathString + "newevent" ); |
580 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 587 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
581 | configureToolBarMenu->insertSeparator(); | 588 | configureToolBarMenu->insertSeparator(); |
582 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 589 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
583 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 590 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
584 | ne_action->addTo( actionMenu ); | 591 | ne_action->addTo( actionMenu ); |
585 | connect( ne_action, SIGNAL( activated() ), | 592 | connect( ne_action, SIGNAL( activated() ), |
586 | mView, SLOT( newEvent() ) ); | 593 | mView, SLOT( newEvent() ) ); |
587 | icon = loadPixmap( pathString + "newtodo" ); | 594 | icon = loadPixmap( pathString + "newtodo" ); |
588 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 595 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
589 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 596 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
590 | nt_action->addTo( actionMenu ); | 597 | nt_action->addTo( actionMenu ); |
591 | connect( nt_action, SIGNAL( activated() ), | 598 | connect( nt_action, SIGNAL( activated() ), |
592 | mView, SLOT( newTodo() ) ); | 599 | mView, SLOT( newTodo() ) ); |
593 | icon = loadPixmap( pathString + "navi" ); | 600 | icon = loadPixmap( pathString + "navi" ); |
594 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 601 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
595 | action->addTo( viewMenu ); | 602 | action->addTo( viewMenu ); |
596 | connect( action, SIGNAL( activated() ), | 603 | connect( action, SIGNAL( activated() ), |
597 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 604 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
598 | icon = loadPixmap( pathString + "filter" ); | 605 | icon = loadPixmap( pathString + "filter" ); |
599 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 606 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
600 | action->addTo( viewMenu ); | 607 | action->addTo( viewMenu ); |
601 | connect( action, SIGNAL( activated() ), | 608 | connect( action, SIGNAL( activated() ), |
602 | mView, SLOT( toggleFilter() ) ); | 609 | mView, SLOT( toggleFilter() ) ); |
603 | 610 | ||
604 | 611 | ||
605 | viewMenu->insertSeparator(); | 612 | viewMenu->insertSeparator(); |
606 | icon = loadPixmap( pathString + "picker" ); | 613 | icon = loadPixmap( pathString + "picker" ); |
607 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 614 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
608 | action->addTo( viewMenu ); | 615 | action->addTo( viewMenu ); |
609 | connect( action, SIGNAL( activated() ), | 616 | connect( action, SIGNAL( activated() ), |
610 | mView, SLOT( showDatePicker() ) ); | 617 | mView, SLOT( showDatePicker() ) ); |
611 | action->addTo( iconToolBar ); | 618 | action->addTo( iconToolBar ); |
612 | viewMenu->insertSeparator(); | 619 | viewMenu->insertSeparator(); |
613 | icon = loadPixmap( pathString + "list" ); | 620 | icon = loadPixmap( pathString + "list" ); |
614 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 621 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
615 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 622 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
616 | showlist_action->addTo( viewMenu ); | 623 | showlist_action->addTo( viewMenu ); |
617 | connect( showlist_action, SIGNAL( activated() ), | 624 | connect( showlist_action, SIGNAL( activated() ), |
618 | mView->viewManager(), SLOT( showListView() ) ); | 625 | mView->viewManager(), SLOT( showListView() ) ); |
619 | 626 | ||
620 | 627 | ||
621 | icon = loadPixmap( pathString + "day" ); | 628 | icon = loadPixmap( pathString + "day" ); |
622 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 629 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
623 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 630 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
624 | day1_action->addTo( viewMenu ); | 631 | day1_action->addTo( viewMenu ); |
625 | // action->addTo( toolBar ); | 632 | // action->addTo( toolBar ); |
626 | connect( day1_action, SIGNAL( activated() ), | 633 | connect( day1_action, SIGNAL( activated() ), |
627 | mView->viewManager(), SLOT( showDayView() ) ); | 634 | mView->viewManager(), SLOT( showDayView() ) ); |
628 | 635 | ||
629 | icon = loadPixmap( pathString + "workweek" ); | 636 | icon = loadPixmap( pathString + "workweek" ); |
630 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 637 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
631 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 638 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
632 | day5_action->addTo( viewMenu ); | 639 | day5_action->addTo( viewMenu ); |
633 | connect( day5_action, SIGNAL( activated() ), | 640 | connect( day5_action, SIGNAL( activated() ), |
634 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 641 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
635 | 642 | ||
636 | icon = loadPixmap( pathString + "week" ); | 643 | icon = loadPixmap( pathString + "week" ); |
637 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 644 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
638 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 645 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
639 | day7_action->addTo( viewMenu ); | 646 | day7_action->addTo( viewMenu ); |
640 | connect( day7_action, SIGNAL( activated() ), | 647 | connect( day7_action, SIGNAL( activated() ), |
641 | mView->viewManager(), SLOT( showWeekView() ) ); | 648 | mView->viewManager(), SLOT( showWeekView() ) ); |
642 | 649 | ||
643 | icon = loadPixmap( pathString + "month" ); | 650 | icon = loadPixmap( pathString + "month" ); |
644 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 651 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
645 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 652 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
646 | month_action->addTo( viewMenu ); | 653 | month_action->addTo( viewMenu ); |
647 | connect( month_action, SIGNAL( activated() ), | 654 | connect( month_action, SIGNAL( activated() ), |
648 | mView->viewManager(), SLOT( showMonthView() ) ); | 655 | mView->viewManager(), SLOT( showMonthView() ) ); |
649 | 656 | ||
650 | icon = loadPixmap( pathString + "todo" ); | 657 | icon = loadPixmap( pathString + "todo" ); |
651 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 658 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
652 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 659 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
653 | todoview_action->addTo( viewMenu ); | 660 | todoview_action->addTo( viewMenu ); |
654 | connect( todoview_action, SIGNAL( activated() ), | 661 | connect( todoview_action, SIGNAL( activated() ), |
655 | mView->viewManager(), SLOT( showTodoView() ) ); | 662 | mView->viewManager(), SLOT( showTodoView() ) ); |
656 | 663 | ||
657 | icon = loadPixmap( pathString + "journal" ); | 664 | icon = loadPixmap( pathString + "journal" ); |
658 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 665 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
659 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 666 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
660 | viewjournal_action->addTo( viewMenu ); | 667 | viewjournal_action->addTo( viewMenu ); |
661 | connect( viewjournal_action, SIGNAL( activated() ), | 668 | connect( viewjournal_action, SIGNAL( activated() ), |
662 | mView->viewManager(), SLOT( showJournalView() ) ); | 669 | mView->viewManager(), SLOT( showJournalView() ) ); |
663 | 670 | ||
664 | icon = loadPixmap( pathString + "xdays" ); | 671 | icon = loadPixmap( pathString + "xdays" ); |
665 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 672 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
666 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 673 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
667 | xdays_action->addTo( viewMenu ); | 674 | xdays_action->addTo( viewMenu ); |
668 | connect( xdays_action, SIGNAL( activated() ), | 675 | connect( xdays_action, SIGNAL( activated() ), |
669 | mView->viewManager(), SLOT( showNextXView() ) ); | 676 | mView->viewManager(), SLOT( showNextXView() ) ); |
670 | 677 | ||
671 | icon = loadPixmap( pathString + "whatsnext" ); | 678 | icon = loadPixmap( pathString + "whatsnext" ); |
672 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 679 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
673 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 680 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
674 | whatsnext_action->addTo( viewMenu ); | 681 | whatsnext_action->addTo( viewMenu ); |
675 | connect( whatsnext_action, SIGNAL( activated() ), | 682 | connect( whatsnext_action, SIGNAL( activated() ), |
676 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 683 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
677 | 684 | ||
678 | #if 0 | 685 | #if 0 |
679 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 686 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
680 | action->addTo( viewMenu ); | 687 | action->addTo( viewMenu ); |
681 | connect( action, SIGNAL( activated() ), | 688 | connect( action, SIGNAL( activated() ), |
682 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 689 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
683 | #endif | 690 | #endif |
684 | 691 | ||
685 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 692 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
686 | this ); | 693 | this ); |
687 | mNewSubTodoAction->addTo( actionMenu ); | 694 | mNewSubTodoAction->addTo( actionMenu ); |
688 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 695 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
689 | mView, SLOT( newSubTodo() ) ); | 696 | mView, SLOT( newSubTodo() ) ); |
690 | 697 | ||
691 | actionMenu->insertSeparator(); | 698 | actionMenu->insertSeparator(); |
692 | 699 | ||
693 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 700 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
694 | mShowAction->addTo( actionMenu ); | 701 | mShowAction->addTo( actionMenu ); |
695 | connect( mShowAction, SIGNAL( activated() ), | 702 | connect( mShowAction, SIGNAL( activated() ), |
696 | mView, SLOT( showIncidence() ) ); | 703 | mView, SLOT( showIncidence() ) ); |
697 | 704 | ||
698 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 705 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
699 | mEditAction->addTo( actionMenu ); | 706 | mEditAction->addTo( actionMenu ); |
700 | connect( mEditAction, SIGNAL( activated() ), | 707 | connect( mEditAction, SIGNAL( activated() ), |
701 | mView, SLOT( editIncidence() ) ); | 708 | mView, SLOT( editIncidence() ) ); |
702 | 709 | ||
703 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 710 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
704 | mDeleteAction->addTo( actionMenu ); | 711 | mDeleteAction->addTo( actionMenu ); |
705 | connect( mDeleteAction, SIGNAL( activated() ), | 712 | connect( mDeleteAction, SIGNAL( activated() ), |
706 | mView, SLOT( deleteIncidence() ) ); | 713 | mView, SLOT( deleteIncidence() ) ); |
707 | 714 | ||
708 | 715 | ||
709 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 716 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
710 | mCloneAction->addTo( actionMenu ); | 717 | mCloneAction->addTo( actionMenu ); |
711 | connect( mCloneAction, SIGNAL( activated() ), | 718 | connect( mCloneAction, SIGNAL( activated() ), |
712 | mView, SLOT( cloneIncidence() ) ); | 719 | mView, SLOT( cloneIncidence() ) ); |
713 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 720 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
714 | mMoveAction->addTo( actionMenu ); | 721 | mMoveAction->addTo( actionMenu ); |
715 | connect( mMoveAction, SIGNAL( activated() ), | 722 | connect( mMoveAction, SIGNAL( activated() ), |
716 | mView, SLOT( moveIncidence() ) ); | 723 | mView, SLOT( moveIncidence() ) ); |
717 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 724 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
718 | mBeamAction->addTo( actionMenu ); | 725 | mBeamAction->addTo( actionMenu ); |
719 | connect( mBeamAction, SIGNAL( activated() ), | 726 | connect( mBeamAction, SIGNAL( activated() ), |
720 | mView, SLOT( beamIncidence() ) ); | 727 | mView, SLOT( beamIncidence() ) ); |
721 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 728 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
722 | mCancelAction->addTo( actionMenu ); | 729 | mCancelAction->addTo( actionMenu ); |
723 | connect( mCancelAction, SIGNAL( activated() ), | 730 | connect( mCancelAction, SIGNAL( activated() ), |
724 | mView, SLOT( toggleCancelIncidence() ) ); | 731 | mView, SLOT( toggleCancelIncidence() ) ); |
725 | 732 | ||
726 | actionMenu->insertSeparator(); | 733 | actionMenu->insertSeparator(); |
727 | 734 | ||
728 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 735 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
729 | this ); | 736 | this ); |
730 | action->addTo( actionMenu ); | 737 | action->addTo( actionMenu ); |
731 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 738 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
732 | 739 | ||
733 | icon = loadPixmap( pathString + "search" ); | 740 | icon = loadPixmap( pathString + "search" ); |
734 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 741 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
735 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 742 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
736 | search_action->addTo( actionMenu ); | 743 | search_action->addTo( actionMenu ); |
737 | connect( search_action, SIGNAL( activated() ), | 744 | connect( search_action, SIGNAL( activated() ), |
738 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 745 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
739 | 746 | ||
740 | icon = loadPixmap( pathString + "today" ); | 747 | icon = loadPixmap( pathString + "today" ); |
741 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 748 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
742 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 749 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
743 | today_action->addTo( actionMenu ); | 750 | today_action->addTo( actionMenu ); |
744 | connect( today_action, SIGNAL( activated() ), | 751 | connect( today_action, SIGNAL( activated() ), |
745 | mView, SLOT( goToday() ) ); | 752 | mView, SLOT( goToday() ) ); |
746 | 753 | ||
747 | if ( KOPrefs::instance()->mShowFullMenu ) { | 754 | if ( KOPrefs::instance()->mShowFullMenu ) { |
748 | actionMenu->insertSeparator(); | 755 | actionMenu->insertSeparator(); |
749 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 756 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
750 | 757 | ||
751 | } | 758 | } |
752 | // actionMenu->insertSeparator(); | 759 | // actionMenu->insertSeparator(); |
753 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 760 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
754 | this ); | 761 | this ); |
755 | action->addTo( importMenu ); | 762 | action->addTo( importMenu ); |
756 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 763 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
757 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 764 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
758 | this ); | 765 | this ); |
759 | action->addTo( importMenu ); | 766 | action->addTo( importMenu ); |
760 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 767 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
761 | importMenu->insertSeparator(); | 768 | importMenu->insertSeparator(); |
762 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 769 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
763 | this ); | 770 | this ); |
764 | action->addTo( importMenu ); | 771 | action->addTo( importMenu ); |
765 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 772 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
766 | #ifndef DESKTOP_VERSION | 773 | #ifndef DESKTOP_VERSION |
767 | importMenu->insertSeparator(); | 774 | importMenu->insertSeparator(); |
768 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 775 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
769 | this ); | 776 | this ); |
770 | action->addTo( importMenu ); | 777 | action->addTo( importMenu ); |