author | zautrix <zautrix> | 2005-02-23 21:53:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-23 21:53:18 (UTC) |
commit | 4a9bf75c2ef12a40be3aea1d147f3703aee48638 (patch) (unidiff) | |
tree | 62b2e4d0b63487ff2818c18f8bc1a3233df46e76 | |
parent | 31f24d21cd23bb7e4033e7ffa000e6c979133ce7 (diff) | |
download | kdepimpi-4a9bf75c2ef12a40be3aea1d147f3703aee48638.zip kdepimpi-4a9bf75c2ef12a40be3aea1d147f3703aee48638.tar.gz kdepimpi-4a9bf75c2ef12a40be3aea1d147f3703aee48638.tar.bz2 |
morelayout fixes
-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 25 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 18 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 11 |
5 files changed, 68 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1009956..d6918d3 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -355,256 +355,257 @@ void CalendarView::init() | |||
355 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 355 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
356 | 356 | ||
357 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 357 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
358 | mNavigator, SLOT( selectPreviousYear() ) ); | 358 | mNavigator, SLOT( selectPreviousYear() ) ); |
359 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 359 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
360 | mNavigator, SLOT( selectNextYear() ) ); | 360 | mNavigator, SLOT( selectNextYear() ) ); |
361 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 361 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
362 | mNavigator, SLOT( selectPreviousMonth() ) ); | 362 | mNavigator, SLOT( selectPreviousMonth() ) ); |
363 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 363 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
364 | mNavigator, SLOT( selectNextMonth() ) ); | 364 | mNavigator, SLOT( selectNextMonth() ) ); |
365 | 365 | ||
366 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 366 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
367 | mNavigator, SLOT( selectPrevious() ) ); | 367 | mNavigator, SLOT( selectPrevious() ) ); |
368 | connect( mDateNavigator, SIGNAL( goNext() ), | 368 | connect( mDateNavigator, SIGNAL( goNext() ), |
369 | mNavigator, SLOT( selectNext() ) ); | 369 | mNavigator, SLOT( selectNext() ) ); |
370 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 370 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
371 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 371 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
372 | 372 | ||
373 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 373 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
374 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 374 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
375 | 375 | ||
376 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 376 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
377 | SLOT( eventAdded( Event *) ) ); | 377 | SLOT( eventAdded( Event *) ) ); |
378 | 378 | ||
379 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 379 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
380 | 380 | ||
381 | connect( this, SIGNAL( configChanged() ), | 381 | connect( this, SIGNAL( configChanged() ), |
382 | mDateNavigator, SLOT( updateConfig() ) ); | 382 | mDateNavigator, SLOT( updateConfig() ) ); |
383 | 383 | ||
384 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 384 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
385 | SLOT( newTodo() ) ); | 385 | SLOT( newTodo() ) ); |
386 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 386 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
387 | SLOT( newSubTodo( Todo * ) ) ); | 387 | SLOT( newSubTodo( Todo * ) ) ); |
388 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 388 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
389 | SLOT( editTodo( Todo * ) ) ); | 389 | SLOT( editTodo( Todo * ) ) ); |
390 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 390 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
391 | SLOT( showTodo( Todo *) ) ); | 391 | SLOT( showTodo( Todo *) ) ); |
392 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 392 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
393 | SLOT( deleteTodo( Todo *) ) ); | 393 | SLOT( deleteTodo( Todo *) ) ); |
394 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 394 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
395 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 395 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
396 | SLOT( purgeCompleted() ) ); | 396 | SLOT( purgeCompleted() ) ); |
397 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 397 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
398 | SIGNAL( todoModified( Todo *, int ) ) ); | 398 | SIGNAL( todoModified( Todo *, int ) ) ); |
399 | 399 | ||
400 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 400 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
401 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 401 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
402 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 402 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
403 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 403 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
404 | 404 | ||
405 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 405 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
406 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 406 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
407 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 407 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
408 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 408 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
409 | 409 | ||
410 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 410 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
411 | this, SLOT ( todo_unsub( Todo * ) ) ); | 411 | this, SLOT ( todo_unsub( Todo * ) ) ); |
412 | 412 | ||
413 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 413 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
414 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 414 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
415 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 415 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
416 | SLOT( updateTodo( Todo *, int ) ) ); | 416 | SLOT( updateTodo( Todo *, int ) ) ); |
417 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 417 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
418 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 418 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
419 | 419 | ||
420 | 420 | ||
421 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 421 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
422 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 422 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
423 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 423 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
424 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 424 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
425 | 425 | ||
426 | 426 | ||
427 | 427 | ||
428 | 428 | ||
429 | 429 | ||
430 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 430 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
431 | SLOT(checkClipboard())); | 431 | SLOT(checkClipboard())); |
432 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 432 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
433 | SLOT( processTodoListSelection( Incidence * ) ) ); | 433 | SLOT( processTodoListSelection( Incidence * ) ) ); |
434 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 434 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
435 | 435 | ||
436 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 436 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
437 | 437 | ||
438 | mDateFrame = new QVBox(0,0,WType_Popup); | 438 | mDateFrame = new QVBox(0,0,WType_Popup); |
439 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 439 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
440 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 440 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
441 | mDateFrame->setLineWidth(3); | 441 | mDateFrame->setLineWidth(3); |
442 | mDateFrame->hide(); | 442 | mDateFrame->hide(); |
443 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 443 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
444 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 444 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
445 | 445 | ||
446 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 446 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
447 | 447 | ||
448 | mEventEditor = mDialogManager->getEventEditor(); | 448 | mEventEditor = mDialogManager->getEventEditor(); |
449 | mTodoEditor = mDialogManager->getTodoEditor(); | 449 | mTodoEditor = mDialogManager->getTodoEditor(); |
450 | 450 | ||
451 | mFlagEditDescription = false; | 451 | mFlagEditDescription = false; |
452 | 452 | ||
453 | mSuspendTimer = new QTimer( this ); | 453 | mSuspendTimer = new QTimer( this ); |
454 | mAlarmTimer = new QTimer( this ); | 454 | mAlarmTimer = new QTimer( this ); |
455 | mRecheckAlarmTimer = new QTimer( this ); | 455 | mRecheckAlarmTimer = new QTimer( this ); |
456 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 456 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
457 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 457 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
458 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 458 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
459 | mAlarmDialog = new AlarmDialog( this ); | 459 | mAlarmDialog = new AlarmDialog( this ); |
460 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 460 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
461 | mAlarmDialog->setServerNotification( false ); | 461 | mAlarmDialog->setServerNotification( false ); |
462 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 462 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
463 | 463 | ||
464 | 464 | ||
465 | #ifndef DESKTOP_VERSION | 465 | #ifndef DESKTOP_VERSION |
466 | //US listen for arriving address resultsets | 466 | //US listen for arriving address resultsets |
467 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 467 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
468 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 468 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
469 | #endif | 469 | #endif |
470 | 470 | ||
471 | } | 471 | } |
472 | 472 | ||
473 | 473 | ||
474 | CalendarView::~CalendarView() | 474 | CalendarView::~CalendarView() |
475 | { | 475 | { |
476 | // kdDebug() << "~CalendarView()" << endl; | 476 | // kdDebug() << "~CalendarView()" << endl; |
477 | //qDebug("CalendarView::~CalendarView() "); | 477 | //qDebug("CalendarView::~CalendarView() "); |
478 | delete mDialogManager; | 478 | delete mDialogManager; |
479 | delete mViewManager; | 479 | delete mViewManager; |
480 | delete mStorage; | 480 | delete mStorage; |
481 | delete mDateFrame ; | 481 | delete mDateFrame ; |
482 | delete beamDialog; | 482 | delete beamDialog; |
483 | delete mEventViewerDialog; | ||
483 | //kdDebug() << "~CalendarView() done" << endl; | 484 | //kdDebug() << "~CalendarView() done" << endl; |
484 | } | 485 | } |
485 | 486 | ||
486 | void CalendarView::showDay( QDate d ) | 487 | void CalendarView::showDay( QDate d ) |
487 | { | 488 | { |
488 | dateNavigator()->blockSignals( true ); | 489 | dateNavigator()->blockSignals( true ); |
489 | dateNavigator()->selectDate( d ); | 490 | dateNavigator()->selectDate( d ); |
490 | dateNavigator()->blockSignals( false ); | 491 | dateNavigator()->blockSignals( false ); |
491 | mViewManager->showDayView(); | 492 | mViewManager->showDayView(); |
492 | //dateNavigator()->selectDate( d ); | 493 | //dateNavigator()->selectDate( d ); |
493 | } | 494 | } |
494 | void CalendarView::timerAlarm() | 495 | void CalendarView::timerAlarm() |
495 | { | 496 | { |
496 | //qDebug("CalendarView::timerAlarm() "); | 497 | //qDebug("CalendarView::timerAlarm() "); |
497 | computeAlarm(mAlarmNotification ); | 498 | computeAlarm(mAlarmNotification ); |
498 | } | 499 | } |
499 | 500 | ||
500 | void CalendarView::suspendAlarm() | 501 | void CalendarView::suspendAlarm() |
501 | { | 502 | { |
502 | //qDebug(" CalendarView::suspendAlarm() "); | 503 | //qDebug(" CalendarView::suspendAlarm() "); |
503 | computeAlarm(mSuspendAlarmNotification ); | 504 | computeAlarm(mSuspendAlarmNotification ); |
504 | 505 | ||
505 | } | 506 | } |
506 | 507 | ||
507 | void CalendarView::startAlarm( QString mess , QString filename) | 508 | void CalendarView::startAlarm( QString mess , QString filename) |
508 | { | 509 | { |
509 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 510 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
510 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 511 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
511 | 512 | ||
512 | } | 513 | } |
513 | 514 | ||
514 | void CalendarView::checkNextTimerAlarm() | 515 | void CalendarView::checkNextTimerAlarm() |
515 | { | 516 | { |
516 | mCalendar->checkAlarmForIncidence( 0, true ); | 517 | mCalendar->checkAlarmForIncidence( 0, true ); |
517 | } | 518 | } |
518 | 519 | ||
519 | void CalendarView::computeAlarm( QString msg ) | 520 | void CalendarView::computeAlarm( QString msg ) |
520 | { | 521 | { |
521 | 522 | ||
522 | QString mess = msg; | 523 | QString mess = msg; |
523 | QString mAlarmMessage = mess.mid( 9 ); | 524 | QString mAlarmMessage = mess.mid( 9 ); |
524 | QString filename = MainWindow::resourcePath(); | 525 | QString filename = MainWindow::resourcePath(); |
525 | filename += "koalarm.wav"; | 526 | filename += "koalarm.wav"; |
526 | QString tempfilename; | 527 | QString tempfilename; |
527 | if ( mess.left( 13 ) == "suspend_alarm") { | 528 | if ( mess.left( 13 ) == "suspend_alarm") { |
528 | bool error = false; | 529 | bool error = false; |
529 | int len = mess.mid( 13 ).find("+++"); | 530 | int len = mess.mid( 13 ).find("+++"); |
530 | if ( len < 2 ) | 531 | if ( len < 2 ) |
531 | error = true; | 532 | error = true; |
532 | else { | 533 | else { |
533 | tempfilename = mess.mid( 13, len ); | 534 | tempfilename = mess.mid( 13, len ); |
534 | if ( !QFile::exists( tempfilename ) ) | 535 | if ( !QFile::exists( tempfilename ) ) |
535 | error = true; | 536 | error = true; |
536 | } | 537 | } |
537 | if ( ! error ) { | 538 | if ( ! error ) { |
538 | filename = tempfilename; | 539 | filename = tempfilename; |
539 | } | 540 | } |
540 | mAlarmMessage = mess.mid( 13+len+3 ); | 541 | mAlarmMessage = mess.mid( 13+len+3 ); |
541 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 542 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
542 | startAlarm( mAlarmMessage, filename); | 543 | startAlarm( mAlarmMessage, filename); |
543 | return; | 544 | return; |
544 | } | 545 | } |
545 | if ( mess.left( 11 ) == "timer_alarm") { | 546 | if ( mess.left( 11 ) == "timer_alarm") { |
546 | //mTimerTime = 0; | 547 | //mTimerTime = 0; |
547 | startAlarm( mess.mid( 11 ), filename ); | 548 | startAlarm( mess.mid( 11 ), filename ); |
548 | return; | 549 | return; |
549 | } | 550 | } |
550 | if ( mess.left( 10 ) == "proc_alarm") { | 551 | if ( mess.left( 10 ) == "proc_alarm") { |
551 | bool error = false; | 552 | bool error = false; |
552 | int len = mess.mid( 10 ).find("+++"); | 553 | int len = mess.mid( 10 ).find("+++"); |
553 | if ( len < 2 ) | 554 | if ( len < 2 ) |
554 | error = true; | 555 | error = true; |
555 | else { | 556 | else { |
556 | tempfilename = mess.mid( 10, len ); | 557 | tempfilename = mess.mid( 10, len ); |
557 | if ( !QFile::exists( tempfilename ) ) | 558 | if ( !QFile::exists( tempfilename ) ) |
558 | error = true; | 559 | error = true; |
559 | } | 560 | } |
560 | if ( error ) { | 561 | if ( error ) { |
561 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 562 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
562 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 563 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
563 | } else { | 564 | } else { |
564 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 565 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
565 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 566 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
566 | #ifndef _WIN32_ | 567 | #ifndef _WIN32_ |
567 | if ( vfork () == 0 ) { | 568 | if ( vfork () == 0 ) { |
568 | execl ( tempfilename.latin1(), 0 ); | 569 | execl ( tempfilename.latin1(), 0 ); |
569 | return; | 570 | return; |
570 | } | 571 | } |
571 | #else | 572 | #else |
572 | QProcess* p = new QProcess(); | 573 | QProcess* p = new QProcess(); |
573 | p->addArgument( tempfilename.latin1() ); | 574 | p->addArgument( tempfilename.latin1() ); |
574 | p->start(); | 575 | p->start(); |
575 | return; | 576 | return; |
576 | #endif | 577 | #endif |
577 | 578 | ||
578 | return; | 579 | return; |
579 | } | 580 | } |
580 | 581 | ||
581 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 582 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
582 | } | 583 | } |
583 | if ( mess.left( 11 ) == "audio_alarm") { | 584 | if ( mess.left( 11 ) == "audio_alarm") { |
584 | bool error = false; | 585 | bool error = false; |
585 | int len = mess.mid( 11 ).find("+++"); | 586 | int len = mess.mid( 11 ).find("+++"); |
586 | if ( len < 2 ) | 587 | if ( len < 2 ) |
587 | error = true; | 588 | error = true; |
588 | else { | 589 | else { |
589 | tempfilename = mess.mid( 11, len ); | 590 | tempfilename = mess.mid( 11, len ); |
590 | if ( !QFile::exists( tempfilename ) ) | 591 | if ( !QFile::exists( tempfilename ) ) |
591 | error = true; | 592 | error = true; |
592 | } | 593 | } |
593 | if ( ! error ) { | 594 | if ( ! error ) { |
594 | filename = tempfilename; | 595 | filename = tempfilename; |
595 | } | 596 | } |
596 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 597 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
597 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 598 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
598 | } | 599 | } |
599 | if ( mess.left( 9 ) == "cal_alarm") { | 600 | if ( mess.left( 9 ) == "cal_alarm") { |
600 | mAlarmMessage = mess.mid( 9 ) ; | 601 | mAlarmMessage = mess.mid( 9 ) ; |
601 | } | 602 | } |
602 | 603 | ||
603 | startAlarm( mAlarmMessage, filename ); | 604 | startAlarm( mAlarmMessage, filename ); |
604 | 605 | ||
605 | 606 | ||
606 | } | 607 | } |
607 | 608 | ||
608 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 609 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
609 | { | 610 | { |
610 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 611 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
@@ -2402,523 +2403,535 @@ void CalendarView::beamCalendar() | |||
2402 | beamIncidenceList( delSel ); | 2403 | beamIncidenceList( delSel ); |
2403 | } | 2404 | } |
2404 | void CalendarView::beamFilteredCalendar() | 2405 | void CalendarView::beamFilteredCalendar() |
2405 | { | 2406 | { |
2406 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2407 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2407 | //qDebug("beamFilteredCalendar() "); | 2408 | //qDebug("beamFilteredCalendar() "); |
2408 | beamIncidenceList( delSel ); | 2409 | beamIncidenceList( delSel ); |
2409 | } | 2410 | } |
2410 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2411 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2411 | { | 2412 | { |
2412 | if ( beamDialog->exec () == QDialog::Rejected ) | 2413 | if ( beamDialog->exec () == QDialog::Rejected ) |
2413 | return; | 2414 | return; |
2414 | #ifdef DESKTOP_VERSION | 2415 | #ifdef DESKTOP_VERSION |
2415 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2416 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2416 | #else | 2417 | #else |
2417 | QString fn = "/tmp/kopibeamfile"; | 2418 | QString fn = "/tmp/kopibeamfile"; |
2418 | #endif | 2419 | #endif |
2419 | QString mes; | 2420 | QString mes; |
2420 | bool createbup = true; | 2421 | bool createbup = true; |
2421 | if ( createbup ) { | 2422 | if ( createbup ) { |
2422 | QString description = "\n"; | 2423 | QString description = "\n"; |
2423 | CalendarLocal* cal = new CalendarLocal(); | 2424 | CalendarLocal* cal = new CalendarLocal(); |
2424 | if ( beamDialog->beamLocal() ) | 2425 | if ( beamDialog->beamLocal() ) |
2425 | cal->setLocalTime(); | 2426 | cal->setLocalTime(); |
2426 | else | 2427 | else |
2427 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2428 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2428 | Incidence *incidence = delSel.first(); | 2429 | Incidence *incidence = delSel.first(); |
2429 | bool addText = false; | 2430 | bool addText = false; |
2430 | if ( delSel.count() < 10 ) | 2431 | if ( delSel.count() < 10 ) |
2431 | addText = true; | 2432 | addText = true; |
2432 | else { | 2433 | else { |
2433 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2434 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2434 | } | 2435 | } |
2435 | while ( incidence ) { | 2436 | while ( incidence ) { |
2436 | Incidence *in = incidence->clone(); | 2437 | Incidence *in = incidence->clone(); |
2437 | if ( ! in->summary().isEmpty() ) { | 2438 | if ( ! in->summary().isEmpty() ) { |
2438 | in->setDescription(""); | 2439 | in->setDescription(""); |
2439 | } else { | 2440 | } else { |
2440 | in->setSummary( in->description().left(20)); | 2441 | in->setSummary( in->description().left(20)); |
2441 | in->setDescription(""); | 2442 | in->setDescription(""); |
2442 | } | 2443 | } |
2443 | if ( addText ) | 2444 | if ( addText ) |
2444 | description += in->summary() + "\n"; | 2445 | description += in->summary() + "\n"; |
2445 | cal->addIncidence( in ); | 2446 | cal->addIncidence( in ); |
2446 | incidence = delSel.next(); | 2447 | incidence = delSel.next(); |
2447 | } | 2448 | } |
2448 | if ( beamDialog->beamVcal() ) { | 2449 | if ( beamDialog->beamVcal() ) { |
2449 | fn += ".vcs"; | 2450 | fn += ".vcs"; |
2450 | FileStorage storage( cal, fn, new VCalFormat ); | 2451 | FileStorage storage( cal, fn, new VCalFormat ); |
2451 | storage.save(); | 2452 | storage.save(); |
2452 | } else { | 2453 | } else { |
2453 | fn += ".ics"; | 2454 | fn += ".ics"; |
2454 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2455 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2455 | storage.save(); | 2456 | storage.save(); |
2456 | } | 2457 | } |
2457 | delete cal; | 2458 | delete cal; |
2458 | mes = i18n("KO/Pi: Ready for beaming"); | 2459 | mes = i18n("KO/Pi: Ready for beaming"); |
2459 | topLevelWidget()->setCaption(mes); | 2460 | topLevelWidget()->setCaption(mes); |
2460 | KApplication::convert2latin1( fn ); | 2461 | KApplication::convert2latin1( fn ); |
2461 | #ifndef DESKTOP_VERSION | 2462 | #ifndef DESKTOP_VERSION |
2462 | Ir *ir = new Ir( this ); | 2463 | Ir *ir = new Ir( this ); |
2463 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2464 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2464 | ir->send( fn, description, "text/x-vCalendar" ); | 2465 | ir->send( fn, description, "text/x-vCalendar" ); |
2465 | #endif | 2466 | #endif |
2466 | } | 2467 | } |
2467 | } | 2468 | } |
2468 | void CalendarView::beamDone( Ir *ir ) | 2469 | void CalendarView::beamDone( Ir *ir ) |
2469 | { | 2470 | { |
2470 | #ifndef DESKTOP_VERSION | 2471 | #ifndef DESKTOP_VERSION |
2471 | delete ir; | 2472 | delete ir; |
2472 | #endif | 2473 | #endif |
2473 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2474 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2474 | topLevelWidget()->raise(); | 2475 | topLevelWidget()->raise(); |
2475 | } | 2476 | } |
2476 | 2477 | ||
2477 | void CalendarView::moveIncidence(Incidence * inc ) | 2478 | void CalendarView::moveIncidence(Incidence * inc ) |
2478 | { | 2479 | { |
2479 | if ( !inc ) return; | 2480 | if ( !inc ) return; |
2480 | showDatePickerPopup(); | 2481 | showDatePickerPopup(); |
2481 | mDatePickerMode = 2; | 2482 | mDatePickerMode = 2; |
2482 | mMoveIncidence = inc ; | 2483 | mMoveIncidence = inc ; |
2483 | QDate da; | 2484 | QDate da; |
2484 | if ( mMoveIncidence->type() == "Todo" ) { | 2485 | if ( mMoveIncidence->type() == "Todo" ) { |
2485 | Todo * to = (Todo *) mMoveIncidence; | 2486 | Todo * to = (Todo *) mMoveIncidence; |
2486 | if ( to->hasDueDate() ) | 2487 | if ( to->hasDueDate() ) |
2487 | da = to->dtDue().date(); | 2488 | da = to->dtDue().date(); |
2488 | else | 2489 | else |
2489 | da = QDate::currentDate(); | 2490 | da = QDate::currentDate(); |
2490 | } else { | 2491 | } else { |
2491 | da = mMoveIncidence->dtStart().date(); | 2492 | da = mMoveIncidence->dtStart().date(); |
2492 | } | 2493 | } |
2493 | //PENDING set date for recurring incidence to date of recurrence | 2494 | //PENDING set date for recurring incidence to date of recurrence |
2494 | //mMoveIncidenceOldDate; | 2495 | //mMoveIncidenceOldDate; |
2495 | mDatePicker->setDate( da ); | 2496 | mDatePicker->setDate( da ); |
2496 | } | 2497 | } |
2497 | void CalendarView::showDatePickerPopup() | 2498 | void CalendarView::showDatePickerPopup() |
2498 | { | 2499 | { |
2499 | if ( mDateFrame->isVisible() ) | 2500 | if ( mDateFrame->isVisible() ) |
2500 | mDateFrame->hide(); | 2501 | mDateFrame->hide(); |
2501 | else { | 2502 | else { |
2502 | int offX = 0, offY = 0; | 2503 | int offX = 0, offY = 0; |
2503 | #ifdef DESKTOP_VERSION | 2504 | #ifdef DESKTOP_VERSION |
2504 | int w =mDatePicker->sizeHint().width() ; | 2505 | int w =mDatePicker->sizeHint().width() ; |
2505 | int h = mDatePicker->sizeHint().height() ; | 2506 | int h = mDatePicker->sizeHint().height() ; |
2506 | int dw = topLevelWidget()->width(); | 2507 | int dw = topLevelWidget()->width(); |
2507 | int dh = topLevelWidget()->height(); | 2508 | int dh = topLevelWidget()->height(); |
2508 | offX = topLevelWidget()->x(); | 2509 | offX = topLevelWidget()->x(); |
2509 | offY = topLevelWidget()->y(); | 2510 | offY = topLevelWidget()->y(); |
2510 | #else | 2511 | #else |
2511 | int w =mDatePicker->sizeHint().width() ; | 2512 | int w =mDatePicker->sizeHint().width() ; |
2512 | int h = mDatePicker->sizeHint().height() ; | 2513 | int h = mDatePicker->sizeHint().height() ; |
2513 | int dw = QApplication::desktop()->width(); | 2514 | int dw = QApplication::desktop()->width(); |
2514 | int dh = QApplication::desktop()->height(); | 2515 | int dh = QApplication::desktop()->height(); |
2515 | #endif | 2516 | #endif |
2516 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 2517 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
2517 | mDateFrame->show(); | 2518 | mDateFrame->show(); |
2518 | } | 2519 | } |
2519 | } | 2520 | } |
2520 | void CalendarView::showDatePicker( ) | 2521 | void CalendarView::showDatePicker( ) |
2521 | { | 2522 | { |
2522 | showDatePickerPopup(); | 2523 | showDatePickerPopup(); |
2523 | mDatePickerMode = 1; | 2524 | mDatePickerMode = 1; |
2524 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2525 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2525 | } | 2526 | } |
2526 | 2527 | ||
2527 | void CalendarView::showEventEditor() | 2528 | void CalendarView::showEventEditor() |
2528 | { | 2529 | { |
2529 | #ifdef DESKTOP_VERSION | 2530 | #ifdef DESKTOP_VERSION |
2531 | int x,y,w,h; | ||
2532 | x = mEventEditor->geometry().x(); | ||
2533 | y = mEventEditor->geometry().y(); | ||
2534 | w = mEventEditor->width(); | ||
2535 | h = mEventEditor->height(); | ||
2530 | mEventEditor->show(); | 2536 | mEventEditor->show(); |
2537 | mEventEditor->setGeometry(x,y,w,h); | ||
2531 | #else | 2538 | #else |
2532 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2539 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2533 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2540 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2534 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2541 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2535 | qApp->processEvents(); | 2542 | qApp->processEvents(); |
2536 | delete mEventEditor; | 2543 | delete mEventEditor; |
2537 | mEventEditor = mDialogManager->getEventEditor(); | 2544 | mEventEditor = mDialogManager->getEventEditor(); |
2538 | topLevelWidget()->setCaption( i18n("") ); | 2545 | topLevelWidget()->setCaption( i18n("") ); |
2539 | } | 2546 | } |
2540 | mEventEditor->showMaximized(); | 2547 | mEventEditor->showMaximized(); |
2541 | #endif | 2548 | #endif |
2542 | } | 2549 | } |
2543 | void CalendarView::showTodoEditor() | 2550 | void CalendarView::showTodoEditor() |
2544 | { | 2551 | { |
2545 | #ifdef DESKTOP_VERSION | 2552 | #ifdef DESKTOP_VERSION |
2553 | int x,y,w,h; | ||
2554 | x = mTodoEditor->geometry().x(); | ||
2555 | y = mTodoEditor->geometry().y(); | ||
2556 | w = mTodoEditor->width(); | ||
2557 | h = mTodoEditor->height(); | ||
2546 | mTodoEditor->show(); | 2558 | mTodoEditor->show(); |
2559 | mTodoEditor->setGeometry(x,y,w,h); | ||
2547 | #else | 2560 | #else |
2548 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2561 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2549 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2562 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2550 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2563 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2551 | qApp->processEvents(); | 2564 | qApp->processEvents(); |
2552 | delete mTodoEditor; | 2565 | delete mTodoEditor; |
2553 | mTodoEditor = mDialogManager->getTodoEditor(); | 2566 | mTodoEditor = mDialogManager->getTodoEditor(); |
2554 | topLevelWidget()->setCaption( i18n("") ); | 2567 | topLevelWidget()->setCaption( i18n("") ); |
2555 | } | 2568 | } |
2556 | mTodoEditor->showMaximized(); | 2569 | mTodoEditor->showMaximized(); |
2557 | #endif | 2570 | #endif |
2558 | } | 2571 | } |
2559 | 2572 | ||
2560 | void CalendarView::cloneIncidence() | 2573 | void CalendarView::cloneIncidence() |
2561 | { | 2574 | { |
2562 | Incidence *incidence = currentSelection(); | 2575 | Incidence *incidence = currentSelection(); |
2563 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2576 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2564 | if ( incidence ) { | 2577 | if ( incidence ) { |
2565 | cloneIncidence(incidence); | 2578 | cloneIncidence(incidence); |
2566 | } | 2579 | } |
2567 | } | 2580 | } |
2568 | void CalendarView::moveIncidence() | 2581 | void CalendarView::moveIncidence() |
2569 | { | 2582 | { |
2570 | Incidence *incidence = currentSelection(); | 2583 | Incidence *incidence = currentSelection(); |
2571 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2584 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2572 | if ( incidence ) { | 2585 | if ( incidence ) { |
2573 | moveIncidence(incidence); | 2586 | moveIncidence(incidence); |
2574 | } | 2587 | } |
2575 | } | 2588 | } |
2576 | void CalendarView::beamIncidence() | 2589 | void CalendarView::beamIncidence() |
2577 | { | 2590 | { |
2578 | Incidence *incidence = currentSelection(); | 2591 | Incidence *incidence = currentSelection(); |
2579 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2592 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2580 | if ( incidence ) { | 2593 | if ( incidence ) { |
2581 | beamIncidence(incidence); | 2594 | beamIncidence(incidence); |
2582 | } | 2595 | } |
2583 | } | 2596 | } |
2584 | void CalendarView::toggleCancelIncidence() | 2597 | void CalendarView::toggleCancelIncidence() |
2585 | { | 2598 | { |
2586 | Incidence *incidence = currentSelection(); | 2599 | Incidence *incidence = currentSelection(); |
2587 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2600 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2588 | if ( incidence ) { | 2601 | if ( incidence ) { |
2589 | cancelIncidence(incidence); | 2602 | cancelIncidence(incidence); |
2590 | } | 2603 | } |
2591 | } | 2604 | } |
2592 | 2605 | ||
2593 | 2606 | ||
2594 | void CalendarView::cancelIncidence(Incidence * inc ) | 2607 | void CalendarView::cancelIncidence(Incidence * inc ) |
2595 | { | 2608 | { |
2596 | inc->setCancelled( ! inc->cancelled() ); | 2609 | inc->setCancelled( ! inc->cancelled() ); |
2597 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2610 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2598 | updateView(); | 2611 | updateView(); |
2599 | } | 2612 | } |
2600 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2613 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2601 | { | 2614 | { |
2602 | Incidence * newInc = orgInc->clone(); | 2615 | Incidence * newInc = orgInc->clone(); |
2603 | newInc->recreate(); | 2616 | newInc->recreate(); |
2604 | 2617 | ||
2605 | if ( newInc->type() == "Todo" ) { | 2618 | if ( newInc->type() == "Todo" ) { |
2606 | Todo* t = (Todo*) newInc; | 2619 | Todo* t = (Todo*) newInc; |
2607 | showTodoEditor(); | 2620 | showTodoEditor(); |
2608 | mTodoEditor->editTodo( t ); | 2621 | mTodoEditor->editTodo( t ); |
2609 | if ( mTodoEditor->exec() ) { | 2622 | if ( mTodoEditor->exec() ) { |
2610 | mCalendar->addTodo( t ); | 2623 | mCalendar->addTodo( t ); |
2611 | updateView(); | 2624 | updateView(); |
2612 | } else { | 2625 | } else { |
2613 | delete t; | 2626 | delete t; |
2614 | } | 2627 | } |
2615 | } | 2628 | } |
2616 | else { | 2629 | else { |
2617 | Event* e = (Event*) newInc; | 2630 | Event* e = (Event*) newInc; |
2618 | showEventEditor(); | 2631 | showEventEditor(); |
2619 | mEventEditor->editEvent( e ); | 2632 | mEventEditor->editEvent( e ); |
2620 | if ( mEventEditor->exec() ) { | 2633 | if ( mEventEditor->exec() ) { |
2621 | mCalendar->addEvent( e ); | 2634 | mCalendar->addEvent( e ); |
2622 | updateView(); | 2635 | updateView(); |
2623 | } else { | 2636 | } else { |
2624 | delete e; | 2637 | delete e; |
2625 | } | 2638 | } |
2626 | } | 2639 | } |
2627 | setActiveWindow(); | 2640 | setActiveWindow(); |
2628 | } | 2641 | } |
2629 | 2642 | ||
2630 | void CalendarView::newEvent() | 2643 | void CalendarView::newEvent() |
2631 | { | 2644 | { |
2632 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2645 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2633 | KOAgendaView *aView = mViewManager->agendaView(); | 2646 | KOAgendaView *aView = mViewManager->agendaView(); |
2634 | if (aView) { | 2647 | if (aView) { |
2635 | if (aView->selectionStart().isValid()) { | 2648 | if (aView->selectionStart().isValid()) { |
2636 | if (aView->selectedIsAllDay()) { | 2649 | if (aView->selectedIsAllDay()) { |
2637 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2650 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2638 | } else { | 2651 | } else { |
2639 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2652 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2640 | } | 2653 | } |
2641 | return; | 2654 | return; |
2642 | } | 2655 | } |
2643 | } | 2656 | } |
2644 | 2657 | ||
2645 | QDate date = mNavigator->selectedDates().first(); | 2658 | QDate date = mNavigator->selectedDates().first(); |
2646 | QDateTime current = QDateTime::currentDateTime(); | 2659 | QDateTime current = QDateTime::currentDateTime(); |
2647 | if ( date <= current.date() ) { | 2660 | if ( date <= current.date() ) { |
2648 | int hour = current.time().hour() +1; | 2661 | int hour = current.time().hour() +1; |
2649 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2662 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2650 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2663 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2651 | } else | 2664 | } else |
2652 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2665 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2653 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2666 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2654 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2667 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2655 | } | 2668 | } |
2656 | 2669 | ||
2657 | void CalendarView::newEvent(QDateTime fh) | 2670 | void CalendarView::newEvent(QDateTime fh) |
2658 | { | 2671 | { |
2659 | newEvent(fh, | 2672 | newEvent(fh, |
2660 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2673 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2661 | } | 2674 | } |
2662 | 2675 | ||
2663 | void CalendarView::newEvent(QDate dt) | 2676 | void CalendarView::newEvent(QDate dt) |
2664 | { | 2677 | { |
2665 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2678 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2666 | QDateTime(dt, QTime(0,0,0)), true); | 2679 | QDateTime(dt, QTime(0,0,0)), true); |
2667 | } | 2680 | } |
2668 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 2681 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
2669 | { | 2682 | { |
2670 | newEvent(fromHint, toHint, false); | 2683 | newEvent(fromHint, toHint, false); |
2671 | } | 2684 | } |
2672 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2685 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2673 | { | 2686 | { |
2674 | 2687 | ||
2675 | showEventEditor(); | 2688 | showEventEditor(); |
2676 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2689 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2677 | if ( mFilterView->filtersEnabled() ) { | 2690 | if ( mFilterView->filtersEnabled() ) { |
2678 | CalFilter *filter = mFilterView->selectedFilter(); | 2691 | CalFilter *filter = mFilterView->selectedFilter(); |
2679 | if (filter && filter->showCategories()) { | 2692 | if (filter && filter->showCategories()) { |
2680 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2693 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2681 | } | 2694 | } |
2682 | if ( filter ) | 2695 | if ( filter ) |
2683 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2696 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2684 | } | 2697 | } |
2685 | mEventEditor->exec(); | 2698 | mEventEditor->exec(); |
2686 | setActiveWindow(); | 2699 | setActiveWindow(); |
2687 | } | 2700 | } |
2688 | void CalendarView::todoAdded(Todo * t) | 2701 | void CalendarView::todoAdded(Todo * t) |
2689 | { | 2702 | { |
2690 | 2703 | ||
2691 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2704 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2692 | updateTodoViews(); | 2705 | updateTodoViews(); |
2693 | } | 2706 | } |
2694 | void CalendarView::todoChanged(Todo * t) | 2707 | void CalendarView::todoChanged(Todo * t) |
2695 | { | 2708 | { |
2696 | emit todoModified( t, 4 ); | 2709 | emit todoModified( t, 4 ); |
2697 | // updateTodoViews(); | 2710 | // updateTodoViews(); |
2698 | } | 2711 | } |
2699 | void CalendarView::todoToBeDeleted(Todo *) | 2712 | void CalendarView::todoToBeDeleted(Todo *) |
2700 | { | 2713 | { |
2701 | //qDebug("todoToBeDeleted(Todo *) "); | 2714 | //qDebug("todoToBeDeleted(Todo *) "); |
2702 | updateTodoViews(); | 2715 | updateTodoViews(); |
2703 | } | 2716 | } |
2704 | void CalendarView::todoDeleted() | 2717 | void CalendarView::todoDeleted() |
2705 | { | 2718 | { |
2706 | //qDebug(" todoDeleted()"); | 2719 | //qDebug(" todoDeleted()"); |
2707 | updateTodoViews(); | 2720 | updateTodoViews(); |
2708 | } | 2721 | } |
2709 | 2722 | ||
2710 | 2723 | ||
2711 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 2724 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
2712 | { | 2725 | { |
2713 | showTodoEditor(); | 2726 | showTodoEditor(); |
2714 | mTodoEditor->newTodo(dt,0,allday); | 2727 | mTodoEditor->newTodo(dt,0,allday); |
2715 | if ( mFilterView->filtersEnabled() ) { | 2728 | if ( mFilterView->filtersEnabled() ) { |
2716 | CalFilter *filter = mFilterView->selectedFilter(); | 2729 | CalFilter *filter = mFilterView->selectedFilter(); |
2717 | if (filter && filter->showCategories()) { | 2730 | if (filter && filter->showCategories()) { |
2718 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2731 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2719 | } | 2732 | } |
2720 | if ( filter ) | 2733 | if ( filter ) |
2721 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2734 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2722 | } | 2735 | } |
2723 | mTodoEditor->exec(); | 2736 | mTodoEditor->exec(); |
2724 | setActiveWindow(); | 2737 | setActiveWindow(); |
2725 | } | 2738 | } |
2726 | 2739 | ||
2727 | void CalendarView::newTodo() | 2740 | void CalendarView::newTodo() |
2728 | { | 2741 | { |
2729 | newTodoDateTime( QDateTime(),true ); | 2742 | newTodoDateTime( QDateTime(),true ); |
2730 | } | 2743 | } |
2731 | 2744 | ||
2732 | void CalendarView::newSubTodo() | 2745 | void CalendarView::newSubTodo() |
2733 | { | 2746 | { |
2734 | Todo *todo = selectedTodo(); | 2747 | Todo *todo = selectedTodo(); |
2735 | if ( todo ) newSubTodo( todo ); | 2748 | if ( todo ) newSubTodo( todo ); |
2736 | } | 2749 | } |
2737 | 2750 | ||
2738 | void CalendarView::newSubTodo(Todo *parentEvent) | 2751 | void CalendarView::newSubTodo(Todo *parentEvent) |
2739 | { | 2752 | { |
2740 | 2753 | ||
2741 | showTodoEditor(); | 2754 | showTodoEditor(); |
2742 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 2755 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
2743 | mTodoEditor->exec(); | 2756 | mTodoEditor->exec(); |
2744 | setActiveWindow(); | 2757 | setActiveWindow(); |
2745 | } | 2758 | } |
2746 | 2759 | ||
2747 | void CalendarView::newFloatingEvent() | 2760 | void CalendarView::newFloatingEvent() |
2748 | { | 2761 | { |
2749 | DateList tmpList = mNavigator->selectedDates(); | 2762 | DateList tmpList = mNavigator->selectedDates(); |
2750 | QDate date = tmpList.first(); | 2763 | QDate date = tmpList.first(); |
2751 | 2764 | ||
2752 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2765 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2753 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2766 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2754 | } | 2767 | } |
2755 | 2768 | ||
2756 | 2769 | ||
2757 | void CalendarView::editEvent( Event *event ) | 2770 | void CalendarView::editEvent( Event *event ) |
2758 | { | 2771 | { |
2759 | 2772 | ||
2760 | if ( !event ) return; | 2773 | if ( !event ) return; |
2761 | if ( event->isReadOnly() ) { | 2774 | if ( event->isReadOnly() ) { |
2762 | showEvent( event ); | 2775 | showEvent( event ); |
2763 | return; | 2776 | return; |
2764 | } | 2777 | } |
2765 | showEventEditor(); | 2778 | showEventEditor(); |
2766 | mEventEditor->editEvent( event , mFlagEditDescription); | 2779 | mEventEditor->editEvent( event , mFlagEditDescription); |
2767 | mEventEditor->exec(); | 2780 | mEventEditor->exec(); |
2768 | setActiveWindow(); | 2781 | setActiveWindow(); |
2769 | 2782 | ||
2770 | } | 2783 | } |
2771 | void CalendarView::editJournal( Journal *jour ) | 2784 | void CalendarView::editJournal( Journal *jour ) |
2772 | { | 2785 | { |
2773 | if ( !jour ) return; | 2786 | if ( !jour ) return; |
2774 | mDialogManager->hideSearchDialog(); | 2787 | mDialogManager->hideSearchDialog(); |
2775 | mViewManager->showJournalView(); | 2788 | mViewManager->showJournalView(); |
2776 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2789 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2777 | } | 2790 | } |
2778 | void CalendarView::editTodo( Todo *todo ) | 2791 | void CalendarView::editTodo( Todo *todo ) |
2779 | { | 2792 | { |
2780 | if ( !todo ) return; | 2793 | if ( !todo ) return; |
2781 | 2794 | ||
2782 | if ( todo->isReadOnly() ) { | 2795 | if ( todo->isReadOnly() ) { |
2783 | showTodo( todo ); | 2796 | showTodo( todo ); |
2784 | return; | 2797 | return; |
2785 | } | 2798 | } |
2786 | showTodoEditor(); | 2799 | showTodoEditor(); |
2787 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2800 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2788 | mTodoEditor->exec(); | 2801 | mTodoEditor->exec(); |
2789 | setActiveWindow(); | 2802 | setActiveWindow(); |
2790 | 2803 | ||
2791 | } | 2804 | } |
2792 | 2805 | ||
2793 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2806 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2794 | { | 2807 | { |
2795 | if ( !mEventViewerDialog ) { | 2808 | if ( !mEventViewerDialog ) { |
2796 | mEventViewerDialog = new KOEventViewerDialog(this); | 2809 | mEventViewerDialog = new KOEventViewerDialog(0); |
2797 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2810 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2798 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2811 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2799 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2812 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2800 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2813 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2801 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2814 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2802 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2815 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2803 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 2816 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
2804 | this, SLOT( slotViewerClosed() ) ); | 2817 | this, SLOT( slotViewerClosed() ) ); |
2805 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 2818 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
2806 | this, SLOT( todoChanged(Todo *) ) ); | 2819 | this, SLOT( todoChanged(Todo *) ) ); |
2807 | mEventViewerDialog->resize( 640, 480 ); | 2820 | mEventViewerDialog->resize( 640, 480 ); |
2808 | 2821 | ||
2809 | } | 2822 | } |
2810 | return mEventViewerDialog; | 2823 | return mEventViewerDialog; |
2811 | } | 2824 | } |
2812 | void CalendarView::showEvent(Event *event) | 2825 | void CalendarView::showEvent(Event *event) |
2813 | { | 2826 | { |
2814 | getEventViewerDialog()->setEvent(event); | 2827 | getEventViewerDialog()->setEvent(event); |
2815 | getEventViewerDialog()->showMe(); | 2828 | getEventViewerDialog()->showMe(); |
2816 | } | 2829 | } |
2817 | 2830 | ||
2818 | void CalendarView::showTodo(Todo *event) | 2831 | void CalendarView::showTodo(Todo *event) |
2819 | { | 2832 | { |
2820 | getEventViewerDialog()->setTodo(event); | 2833 | getEventViewerDialog()->setTodo(event); |
2821 | getEventViewerDialog()->showMe(); | 2834 | getEventViewerDialog()->showMe(); |
2822 | } | 2835 | } |
2823 | void CalendarView::showJournal( Journal *jour ) | 2836 | void CalendarView::showJournal( Journal *jour ) |
2824 | { | 2837 | { |
2825 | getEventViewerDialog()->setJournal(jour); | 2838 | getEventViewerDialog()->setJournal(jour); |
2826 | getEventViewerDialog()->showMe(); | 2839 | getEventViewerDialog()->showMe(); |
2827 | 2840 | ||
2828 | } | 2841 | } |
2829 | // void CalendarView::todoModified (Todo *event, int changed) | 2842 | // void CalendarView::todoModified (Todo *event, int changed) |
2830 | // { | 2843 | // { |
2831 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2844 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2832 | // // kdDebug() << "Todo modified and open" << endl; | 2845 | // // kdDebug() << "Todo modified and open" << endl; |
2833 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2846 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2834 | // // temp->modified (changed); | 2847 | // // temp->modified (changed); |
2835 | 2848 | ||
2836 | // // } | 2849 | // // } |
2837 | 2850 | ||
2838 | // mViewManager->updateView(); | 2851 | // mViewManager->updateView(); |
2839 | // } | 2852 | // } |
2840 | 2853 | ||
2841 | void CalendarView::appointment_show() | 2854 | void CalendarView::appointment_show() |
2842 | { | 2855 | { |
2843 | Event *anEvent = 0; | 2856 | Event *anEvent = 0; |
2844 | 2857 | ||
2845 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2858 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2846 | 2859 | ||
2847 | if (mViewManager->currentView()->isEventView()) { | 2860 | if (mViewManager->currentView()->isEventView()) { |
2848 | if ( incidence && incidence->type() == "Event" ) { | 2861 | if ( incidence && incidence->type() == "Event" ) { |
2849 | anEvent = static_cast<Event *>(incidence); | 2862 | anEvent = static_cast<Event *>(incidence); |
2850 | } | 2863 | } |
2851 | } | 2864 | } |
2852 | 2865 | ||
2853 | if (!anEvent) { | 2866 | if (!anEvent) { |
2854 | KNotifyClient::beep(); | 2867 | KNotifyClient::beep(); |
2855 | return; | 2868 | return; |
2856 | } | 2869 | } |
2857 | 2870 | ||
2858 | showEvent(anEvent); | 2871 | showEvent(anEvent); |
2859 | } | 2872 | } |
2860 | 2873 | ||
2861 | void CalendarView::appointment_edit() | 2874 | void CalendarView::appointment_edit() |
2862 | { | 2875 | { |
2863 | Event *anEvent = 0; | 2876 | Event *anEvent = 0; |
2864 | 2877 | ||
2865 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2878 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2866 | 2879 | ||
2867 | if (mViewManager->currentView()->isEventView()) { | 2880 | if (mViewManager->currentView()->isEventView()) { |
2868 | if ( incidence && incidence->type() == "Event" ) { | 2881 | if ( incidence && incidence->type() == "Event" ) { |
2869 | anEvent = static_cast<Event *>(incidence); | 2882 | anEvent = static_cast<Event *>(incidence); |
2870 | } | 2883 | } |
2871 | } | 2884 | } |
2872 | 2885 | ||
2873 | if (!anEvent) { | 2886 | if (!anEvent) { |
2874 | KNotifyClient::beep(); | 2887 | KNotifyClient::beep(); |
2875 | return; | 2888 | return; |
2876 | } | 2889 | } |
2877 | 2890 | ||
2878 | editEvent(anEvent); | 2891 | editEvent(anEvent); |
2879 | } | 2892 | } |
2880 | 2893 | ||
2881 | void CalendarView::appointment_delete() | 2894 | void CalendarView::appointment_delete() |
2882 | { | 2895 | { |
2883 | Event *anEvent = 0; | 2896 | Event *anEvent = 0; |
2884 | 2897 | ||
2885 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2898 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2886 | 2899 | ||
2887 | if (mViewManager->currentView()->isEventView()) { | 2900 | if (mViewManager->currentView()->isEventView()) { |
2888 | if ( incidence && incidence->type() == "Event" ) { | 2901 | if ( incidence && incidence->type() == "Event" ) { |
2889 | anEvent = static_cast<Event *>(incidence); | 2902 | anEvent = static_cast<Event *>(incidence); |
2890 | } | 2903 | } |
2891 | } | 2904 | } |
2892 | 2905 | ||
2893 | if (!anEvent) { | 2906 | if (!anEvent) { |
2894 | KNotifyClient::beep(); | 2907 | KNotifyClient::beep(); |
2895 | return; | 2908 | return; |
2896 | } | 2909 | } |
2897 | 2910 | ||
2898 | deleteEvent(anEvent); | 2911 | deleteEvent(anEvent); |
2899 | } | 2912 | } |
2900 | 2913 | ||
2901 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 2914 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
2902 | { | 2915 | { |
2903 | if (!sub) return; | 2916 | if (!sub) return; |
2904 | if (!parent) return; | 2917 | if (!parent) return; |
2905 | if ( sub->relatedTo() ) | 2918 | if ( sub->relatedTo() ) |
2906 | sub->relatedTo()->removeRelation(sub); | 2919 | sub->relatedTo()->removeRelation(sub); |
2907 | sub->setRelatedTo(parent); | 2920 | sub->setRelatedTo(parent); |
2908 | sub->setRelatedToUid(parent->uid()); | 2921 | sub->setRelatedToUid(parent->uid()); |
2909 | parent->addRelation(sub); | 2922 | parent->addRelation(sub); |
2910 | sub->updated(); | 2923 | sub->updated(); |
2911 | parent->updated(); | 2924 | parent->updated(); |
2912 | setModified(true); | 2925 | setModified(true); |
2913 | updateView(); | 2926 | updateView(); |
2914 | } | 2927 | } |
2915 | void CalendarView::todo_unsub(Todo *anTodo ) | 2928 | void CalendarView::todo_unsub(Todo *anTodo ) |
2916 | { | 2929 | { |
2917 | // Todo *anTodo = selectedTodo(); | 2930 | // Todo *anTodo = selectedTodo(); |
2918 | if (!anTodo) return; | 2931 | if (!anTodo) return; |
2919 | if (!anTodo->relatedTo()) return; | 2932 | if (!anTodo->relatedTo()) return; |
2920 | anTodo->relatedTo()->removeRelation(anTodo); | 2933 | anTodo->relatedTo()->removeRelation(anTodo); |
2921 | anTodo->setRelatedTo(0); | 2934 | anTodo->setRelatedTo(0); |
2922 | anTodo->updated(); | 2935 | anTodo->updated(); |
2923 | anTodo->setRelatedToUid(""); | 2936 | anTodo->setRelatedToUid(""); |
2924 | setModified(true); | 2937 | setModified(true); |
@@ -3842,133 +3855,134 @@ bool CalendarView::removeCompletedSubTodos( Todo* t ) | |||
3842 | bool deleteTodo = true; | 3855 | bool deleteTodo = true; |
3843 | QPtrList<Incidence> subTodos; | 3856 | QPtrList<Incidence> subTodos; |
3844 | Incidence *aTodo; | 3857 | Incidence *aTodo; |
3845 | subTodos = t->relations(); | 3858 | subTodos = t->relations(); |
3846 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3859 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3847 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3860 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3848 | deleteTodo = false; | 3861 | deleteTodo = false; |
3849 | } | 3862 | } |
3850 | if ( deleteTodo ) { | 3863 | if ( deleteTodo ) { |
3851 | if ( t->isCompleted() && !t->doesRecur()) { | 3864 | if ( t->isCompleted() && !t->doesRecur()) { |
3852 | checkExternalId( t ); | 3865 | checkExternalId( t ); |
3853 | mCalendar->deleteTodo( t ); | 3866 | mCalendar->deleteTodo( t ); |
3854 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3867 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3855 | } | 3868 | } |
3856 | else | 3869 | else |
3857 | deleteTodo = false; | 3870 | deleteTodo = false; |
3858 | } | 3871 | } |
3859 | return deleteTodo; | 3872 | return deleteTodo; |
3860 | 3873 | ||
3861 | } | 3874 | } |
3862 | void CalendarView::purgeCompleted() | 3875 | void CalendarView::purgeCompleted() |
3863 | { | 3876 | { |
3864 | int result = KMessageBox::warningContinueCancel(this, | 3877 | int result = KMessageBox::warningContinueCancel(this, |
3865 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3878 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3866 | 3879 | ||
3867 | if (result == KMessageBox::Continue) { | 3880 | if (result == KMessageBox::Continue) { |
3868 | 3881 | ||
3869 | QPtrList<Todo> todoCal; | 3882 | QPtrList<Todo> todoCal; |
3870 | QPtrList<Todo> rootTodos; | 3883 | QPtrList<Todo> rootTodos; |
3871 | //QPtrList<Incidence> rel; | 3884 | //QPtrList<Incidence> rel; |
3872 | Todo *aTodo;//, *rTodo; | 3885 | Todo *aTodo;//, *rTodo; |
3873 | Incidence *rIncidence; | 3886 | Incidence *rIncidence; |
3874 | bool childDelete = false; | 3887 | bool childDelete = false; |
3875 | bool deletedOne = true; | 3888 | bool deletedOne = true; |
3876 | todoCal = calendar()->todos(); | 3889 | todoCal = calendar()->todos(); |
3877 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3890 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3878 | if ( !aTodo->relatedTo() ) | 3891 | if ( !aTodo->relatedTo() ) |
3879 | rootTodos.append( aTodo ); | 3892 | rootTodos.append( aTodo ); |
3880 | } | 3893 | } |
3881 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3894 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3882 | removeCompletedSubTodos( aTodo ); | 3895 | removeCompletedSubTodos( aTodo ); |
3883 | } | 3896 | } |
3884 | 3897 | ||
3885 | updateView(); | 3898 | updateView(); |
3886 | } | 3899 | } |
3887 | } | 3900 | } |
3888 | 3901 | ||
3889 | void CalendarView::slotCalendarChanged() | 3902 | void CalendarView::slotCalendarChanged() |
3890 | { | 3903 | { |
3891 | ; | 3904 | ; |
3892 | } | 3905 | } |
3893 | 3906 | ||
3894 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3907 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3895 | { | 3908 | { |
3896 | //qDebug(" alendarView::keyPressEvent "); | 3909 | //qDebug(" alendarView::keyPressEvent "); |
3897 | e->ignore(); | 3910 | e->ignore(); |
3898 | } | 3911 | } |
3899 | 3912 | ||
3900 | 3913 | ||
3901 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3914 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3902 | { | 3915 | { |
3903 | // mSyncManager = manager; | 3916 | // mSyncManager = manager; |
3904 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3917 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3905 | qDebug("KO: SyncKDE request detected!"); | 3918 | qDebug("KO: SyncKDE request detected!"); |
3906 | } | 3919 | } |
3907 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3920 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3908 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3921 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3909 | return syncCalendar( filename, mode ); | 3922 | return syncCalendar( filename, mode ); |
3910 | } | 3923 | } |
3911 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3924 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3912 | { | 3925 | { |
3913 | //mSyncManager = manager; | 3926 | //mSyncManager = manager; |
3914 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3927 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3915 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3928 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3916 | if ( resource == "sharp" ) | 3929 | if ( resource == "sharp" ) |
3917 | syncExternal( 0 ); | 3930 | syncExternal( 0 ); |
3918 | if ( resource == "phone" ) | 3931 | if ( resource == "phone" ) |
3919 | syncExternal( 1 ); | 3932 | syncExternal( 1 ); |
3920 | // pending setmodified | 3933 | // pending setmodified |
3921 | return true; | 3934 | return true; |
3922 | } | 3935 | } |
3923 | void CalendarView::setSyncManager(KSyncManager* manager) | 3936 | void CalendarView::setSyncManager(KSyncManager* manager) |
3924 | { | 3937 | { |
3925 | mSyncManager = manager; | 3938 | mSyncManager = manager; |
3926 | } | 3939 | } |
3927 | 3940 | ||
3928 | void CalendarView::removeSyncInfo( QString syncProfile) | 3941 | void CalendarView::removeSyncInfo( QString syncProfile) |
3929 | { | 3942 | { |
3930 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 3943 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
3931 | mCalendar->removeSyncInfo( syncProfile ); | 3944 | mCalendar->removeSyncInfo( syncProfile ); |
3932 | 3945 | ||
3933 | } | 3946 | } |
3934 | 3947 | ||
3935 | void CalendarView::undo_delete() | 3948 | void CalendarView::undo_delete() |
3936 | { | 3949 | { |
3937 | //qDebug("undo_delete() "); | 3950 | //qDebug("undo_delete() "); |
3938 | Incidence* undo = mCalendar->undoIncidence(); | 3951 | Incidence* undo = mCalendar->undoIncidence(); |
3939 | if ( !undo ) { | 3952 | if ( !undo ) { |
3940 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 3953 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
3941 | i18n("KO/Pi")); | 3954 | i18n("KO/Pi")); |
3942 | return; | 3955 | return; |
3943 | } | 3956 | } |
3944 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 3957 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
3945 | i18n("\nAre you sure you want\nto restore this?"), | 3958 | i18n("\nAre you sure you want\nto restore this?"), |
3946 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 3959 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
3947 | mCalendar->undoDeleteIncidence(); | 3960 | mCalendar->undoDeleteIncidence(); |
3948 | updateView(); | 3961 | updateView(); |
3949 | } | 3962 | } |
3950 | } | 3963 | } |
3951 | 3964 | ||
3952 | void CalendarView::slotViewerClosed() | 3965 | void CalendarView::slotViewerClosed() |
3953 | { | 3966 | { |
3954 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 3967 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
3955 | } | 3968 | } |
3956 | 3969 | ||
3957 | void CalendarView::resetFocus() | 3970 | void CalendarView::resetFocus() |
3958 | { | 3971 | { |
3959 | if ( mViewerCallerIsSearchDialog ) { | 3972 | if ( mViewerCallerIsSearchDialog ) { |
3960 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 3973 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
3961 | mDialogManager->getSearchDialog()->raise(); | 3974 | mDialogManager->getSearchDialog()->raise(); |
3962 | mDialogManager->getSearchDialog()->setActiveWindow(); | 3975 | mDialogManager->getSearchDialog()->setActiveWindow(); |
3963 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 3976 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
3964 | } else | 3977 | } else |
3965 | mViewerCallerIsSearchDialog = false; | 3978 | mViewerCallerIsSearchDialog = false; |
3966 | } | 3979 | } |
3967 | if ( !mViewerCallerIsSearchDialog ) { | 3980 | if ( !mViewerCallerIsSearchDialog ) { |
3968 | //mViewManager->currentView()->setFocus(); | 3981 | //mViewManager->currentView()->setFocus(); |
3969 | //qDebug("sssssssssssssssset focus "); | 3982 | //qDebug("sssssssssssssssset focus "); |
3983 | topLevelWidget()->raise(); | ||
3970 | setActiveWindow(); | 3984 | setActiveWindow(); |
3971 | //setFocus(); | 3985 | //setFocus(); |
3972 | } | 3986 | } |
3973 | mViewerCallerIsSearchDialog = false; | 3987 | mViewerCallerIsSearchDialog = false; |
3974 | } | 3988 | } |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 195b1fa..ec81d44 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1056,257 +1056,280 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | if (conflictItems.count() > 0) { | 1061 | if (conflictItems.count() > 0) { |
1062 | // Look for unused sub cell and insert item | 1062 | // Look for unused sub cell and insert item |
1063 | int i; | 1063 | int i; |
1064 | for(i=0;i<maxSubCells;++i) { | 1064 | for(i=0;i<maxSubCells;++i) { |
1065 | if (!subCellDict.find(i)) { | 1065 | if (!subCellDict.find(i)) { |
1066 | placeItem->setSubCell(i); | 1066 | placeItem->setSubCell(i); |
1067 | break; | 1067 | break; |
1068 | } | 1068 | } |
1069 | } | 1069 | } |
1070 | if (i == maxSubCells) { | 1070 | if (i == maxSubCells) { |
1071 | placeItem->setSubCell(maxSubCells); | 1071 | placeItem->setSubCell(maxSubCells); |
1072 | maxSubCells++; // add new item to number of sub cells | 1072 | maxSubCells++; // add new item to number of sub cells |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | // Prepare for sub cell geometry adjustment | 1075 | // Prepare for sub cell geometry adjustment |
1076 | int newSubCellWidth; | 1076 | int newSubCellWidth; |
1077 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1077 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1078 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1078 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1079 | conflictItems.append(placeItem); | 1079 | conflictItems.append(placeItem); |
1080 | 1080 | ||
1081 | 1081 | ||
1082 | // Adjust sub cell geometry of all direct conflict items | 1082 | // Adjust sub cell geometry of all direct conflict items |
1083 | for ( item=conflictItems.first(); item != 0; | 1083 | for ( item=conflictItems.first(); item != 0; |
1084 | item=conflictItems.next() ) { | 1084 | item=conflictItems.next() ) { |
1085 | item->setSubCells(maxSubCells); | 1085 | item->setSubCells(maxSubCells); |
1086 | if (mAllDayMode) { | 1086 | if (mAllDayMode) { |
1087 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1087 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1088 | } else { | 1088 | } else { |
1089 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1089 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1090 | } | 1090 | } |
1091 | int x,y; | 1091 | int x,y; |
1092 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1092 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1093 | if (mAllDayMode) { | 1093 | if (mAllDayMode) { |
1094 | y += item->subCell() * newSubCellWidth; | 1094 | y += item->subCell() * newSubCellWidth; |
1095 | } else { | 1095 | } else { |
1096 | x += item->subCell() * newSubCellWidth; | 1096 | x += item->subCell() * newSubCellWidth; |
1097 | } | 1097 | } |
1098 | moveChild(item,x,y); | 1098 | moveChild(item,x,y); |
1099 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1099 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1100 | //item->updateItem(); | 1100 | //item->updateItem(); |
1101 | } | 1101 | } |
1102 | // Adjust sub cell geometry of all conflict items of all conflict items | 1102 | // Adjust sub cell geometry of all conflict items of all conflict items |
1103 | for ( item=conflictItems.first(); item != 0; | 1103 | for ( item=conflictItems.first(); item != 0; |
1104 | item=conflictItems.next() ) { | 1104 | item=conflictItems.next() ) { |
1105 | if ( placeItem != item ) { | 1105 | if ( placeItem != item ) { |
1106 | KOAgendaItem *item2; | 1106 | KOAgendaItem *item2; |
1107 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | 1107 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); |
1108 | for ( item2=conflictItems2.first(); item2 != 0; | 1108 | for ( item2=conflictItems2.first(); item2 != 0; |
1109 | item2=conflictItems2.next() ) { | 1109 | item2=conflictItems2.next() ) { |
1110 | if ( item2->subCells() != maxSubCells) { | 1110 | if ( item2->subCells() != maxSubCells) { |
1111 | item2->setSubCells(maxSubCells); | 1111 | item2->setSubCells(maxSubCells); |
1112 | if (mAllDayMode) { | 1112 | if (mAllDayMode) { |
1113 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1113 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1114 | } else { | 1114 | } else { |
1115 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1115 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
1116 | } | 1116 | } |
1117 | int x,y; | 1117 | int x,y; |
1118 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | 1118 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); |
1119 | if (mAllDayMode) { | 1119 | if (mAllDayMode) { |
1120 | y += item2->subCell() * newSubCellWidth; | 1120 | y += item2->subCell() * newSubCellWidth; |
1121 | } else { | 1121 | } else { |
1122 | x += item2->subCell() * newSubCellWidth; | 1122 | x += item2->subCell() * newSubCellWidth; |
1123 | } | 1123 | } |
1124 | moveChild(item2,x,y); | 1124 | moveChild(item2,x,y); |
1125 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1125 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1126 | } | 1126 | } |
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | } | 1129 | } |
1130 | } else { | 1130 | } else { |
1131 | placeItem->setSubCell(0); | 1131 | placeItem->setSubCell(0); |
1132 | placeItem->setSubCells(1); | 1132 | placeItem->setSubCells(1); |
1133 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1133 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1134 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1134 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1135 | int x,y; | 1135 | int x,y; |
1136 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1136 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1137 | moveChild(placeItem,x,y); | 1137 | moveChild(placeItem,x,y); |
1138 | } | 1138 | } |
1139 | placeItem->setConflictItems(conflictItems); | 1139 | placeItem->setConflictItems(conflictItems); |
1140 | // for ( item=conflictItems.first(); item != 0; | 1140 | // for ( item=conflictItems.first(); item != 0; |
1141 | // item=conflictItems.next() ) { | 1141 | // item=conflictItems.next() ) { |
1142 | // //item->updateItem(); | 1142 | // //item->updateItem(); |
1143 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1143 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1144 | // } | 1144 | // } |
1145 | // placeItem->updateItem(); | 1145 | // placeItem->updateItem(); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1148 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1149 | { | 1149 | { |
1150 | if ( globalFlagBlockAgenda ) | 1150 | if ( globalFlagBlockAgenda ) |
1151 | return; | 1151 | return; |
1152 | //qDebug("KOAgenda::drawContents "); | 1152 | //qDebug("KOAgenda::drawContents "); |
1153 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1153 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1154 | ;//drawContentsToPainter(); | 1154 | ;//drawContentsToPainter(); |
1155 | 1155 | ||
1156 | QPaintDevice* pd = p->device(); | 1156 | QPaintDevice* pd = p->device(); |
1157 | p->end(); | 1157 | p->end(); |
1158 | int vx, vy; | 1158 | int vx, vy; |
1159 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1159 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1160 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1160 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1161 | mSelectionCellX * mGridSpacingX; | 1161 | mSelectionCellX * mGridSpacingX; |
1162 | contentsToViewport ( cx, cy, vx,vy); | 1162 | contentsToViewport ( cx, cy, vx,vy); |
1163 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1163 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1164 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1164 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1165 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1165 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1166 | 1166 | ||
1167 | if ( mSelectionHeight > 0 ) { | 1167 | if ( mSelectionHeight > 0 ) { |
1168 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1168 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1169 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1169 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1170 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1170 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1171 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1171 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1172 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1172 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1173 | } | 1173 | } |
1174 | } | 1174 | } |
1175 | //qDebug("btbl "); | 1175 | //qDebug("btbl "); |
1176 | p->begin( pd ); | 1176 | p->begin( pd ); |
1177 | //qDebug("end "); | 1177 | //qDebug("end "); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | void KOAgenda::finishUpdate() | 1180 | void KOAgenda::finishUpdate() |
1181 | { | 1181 | { |
1182 | 1182 | ||
1183 | KOAgendaItem *item; | 1183 | KOAgendaItem *item; |
1184 | globalFlagBlockAgendaItemPaint = 1; | 1184 | globalFlagBlockAgendaItemPaint = 1; |
1185 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems | ||
1186 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | ||
1187 | if ( !item->checkLayout() ) { | ||
1188 | //qDebug(" conflictitem found "); | ||
1189 | int newSubCellWidth; | ||
1190 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); | ||
1191 | else newSubCellWidth = mGridSpacingX / item->subCells(); | ||
1192 | |||
1193 | if (mAllDayMode) { | ||
1194 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | ||
1195 | } else { | ||
1196 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | ||
1197 | } | ||
1198 | int x,y; | ||
1199 | gridToContents(item->cellX(),item->cellYTop(),x,y); | ||
1200 | if (mAllDayMode) { | ||
1201 | y += item->subCell() * newSubCellWidth; | ||
1202 | } else { | ||
1203 | x += item->subCell() * newSubCellWidth; | ||
1204 | } | ||
1205 | moveChild(item,x,y); | ||
1206 | } | ||
1207 | } | ||
1185 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1208 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1186 | if ( !item->isVisible() ) | 1209 | if ( !item->isVisible() ) |
1187 | item->show(); | 1210 | item->show(); |
1188 | 1211 | ||
1189 | } | 1212 | } |
1190 | globalFlagBlockAgendaItemUpdate = 0; | 1213 | globalFlagBlockAgendaItemUpdate = 0; |
1191 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1214 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1192 | item->repaintMe( ); | 1215 | item->repaintMe( ); |
1193 | } | 1216 | } |
1194 | globalFlagBlockAgendaItemUpdate = 1; | 1217 | globalFlagBlockAgendaItemUpdate = 1; |
1195 | qApp->processEvents(); | 1218 | qApp->processEvents(); |
1196 | globalFlagBlockAgendaItemPaint = 0; | 1219 | globalFlagBlockAgendaItemPaint = 0; |
1197 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1220 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1198 | item->repaint( false ); | 1221 | item->repaint( false ); |
1199 | } | 1222 | } |
1200 | 1223 | ||
1201 | } | 1224 | } |
1202 | 1225 | ||
1203 | /* | 1226 | /* |
1204 | Draw grid in the background of the agenda. | 1227 | Draw grid in the background of the agenda. |
1205 | */ | 1228 | */ |
1206 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1229 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1207 | { | 1230 | { |
1208 | 1231 | ||
1209 | 1232 | ||
1210 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1233 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1211 | return; | 1234 | return; |
1212 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1235 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1213 | return; | 1236 | return; |
1214 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1237 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1215 | if ( ch < 1 ) | 1238 | if ( ch < 1 ) |
1216 | ch = 1; | 1239 | ch = 1; |
1217 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1240 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1218 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1241 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1219 | } | 1242 | } |
1220 | mCurPixWid = contentsWidth(); | 1243 | mCurPixWid = contentsWidth(); |
1221 | mCurPixHei = ch; | 1244 | mCurPixHei = ch; |
1222 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { | 1245 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { |
1223 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); | 1246 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); |
1224 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1247 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1225 | } | 1248 | } |
1226 | mPixPainter.begin( &mPaintPixmap) ; | 1249 | mPixPainter.begin( &mPaintPixmap) ; |
1227 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1250 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1228 | QPainter * p ; | 1251 | QPainter * p ; |
1229 | if (paint == 0) { | 1252 | if (paint == 0) { |
1230 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1253 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1231 | p = &mPixPainter; | 1254 | p = &mPixPainter; |
1232 | } | 1255 | } |
1233 | else | 1256 | else |
1234 | p = paint ; | 1257 | p = paint ; |
1235 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1258 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1236 | 1259 | ||
1237 | //--cx;++cw; | 1260 | //--cx;++cw; |
1238 | int lGridSpacingY = mGridSpacingY*2; | 1261 | int lGridSpacingY = mGridSpacingY*2; |
1239 | int selDay; | 1262 | int selDay; |
1240 | if ( !backgroundOnly ) | 1263 | if ( !backgroundOnly ) |
1241 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1264 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1242 | { | 1265 | { |
1243 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { | 1266 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { |
1244 | int x1 = cx; | 1267 | int x1 = cx; |
1245 | int y1 = 0; | 1268 | int y1 = 0; |
1246 | if (y1 < cy) y1 = cy; | 1269 | if (y1 < cy) y1 = cy; |
1247 | int x2 = cx+cw-1; | 1270 | int x2 = cx+cw-1; |
1248 | int y2 = contentsHeight(); | 1271 | int y2 = contentsHeight(); |
1249 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1272 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1250 | if (x2 >= x1 && y2 >= y1) { | 1273 | if (x2 >= x1 && y2 >= y1) { |
1251 | int gxStart = selDay; | 1274 | int gxStart = selDay; |
1252 | int gxEnd = gxStart ; | 1275 | int gxEnd = gxStart ; |
1253 | int xStart = KOGlobals::self()->reverseLayout() ? | 1276 | int xStart = KOGlobals::self()->reverseLayout() ? |
1254 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1277 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1255 | gxStart*mGridSpacingX; | 1278 | gxStart*mGridSpacingX; |
1256 | if (xStart < x1) xStart = x1; | 1279 | if (xStart < x1) xStart = x1; |
1257 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1280 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1258 | (mColumns - gxStart)*mGridSpacingX-1 : | 1281 | (mColumns - gxStart)*mGridSpacingX-1 : |
1259 | (gxStart+1)*mGridSpacingX-1; | 1282 | (gxStart+1)*mGridSpacingX-1; |
1260 | if (xEnd > x2) xEnd = x2; | 1283 | if (xEnd > x2) xEnd = x2; |
1261 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1284 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1262 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1285 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1263 | KOPrefs::instance()->mAgendaBgColor.light()); | 1286 | KOPrefs::instance()->mAgendaBgColor.light()); |
1264 | else | 1287 | else |
1265 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1288 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1266 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1289 | KOPrefs::instance()->mAgendaBgColor.dark()); |
1267 | 1290 | ||
1268 | } | 1291 | } |
1269 | } | 1292 | } |
1270 | } | 1293 | } |
1271 | // Highlight working hours | 1294 | // Highlight working hours |
1272 | 1295 | ||
1273 | if ( !backgroundOnly ) | 1296 | if ( !backgroundOnly ) |
1274 | if (mWorkingHoursEnable) { | 1297 | if (mWorkingHoursEnable) { |
1275 | int x1 = cx; | 1298 | int x1 = cx; |
1276 | int y1 = mWorkingHoursYTop; | 1299 | int y1 = mWorkingHoursYTop; |
1277 | if (y1 < cy) y1 = cy; | 1300 | if (y1 < cy) y1 = cy; |
1278 | int x2 = cx+cw-1; | 1301 | int x2 = cx+cw-1; |
1279 | // int x2 = mGridSpacingX * 5 - 1; | 1302 | // int x2 = mGridSpacingX * 5 - 1; |
1280 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1303 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1281 | int y2 = mWorkingHoursYBottom; | 1304 | int y2 = mWorkingHoursYBottom; |
1282 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1305 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1283 | 1306 | ||
1284 | if (x2 >= x1 && y2 >= y1) { | 1307 | if (x2 >= x1 && y2 >= y1) { |
1285 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1308 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1286 | int gxStart = x1/mGridSpacingX; | 1309 | int gxStart = x1/mGridSpacingX; |
1287 | int gxEnd = x2/mGridSpacingX; | 1310 | int gxEnd = x2/mGridSpacingX; |
1288 | while(gxStart <= gxEnd) { | 1311 | while(gxStart <= gxEnd) { |
1289 | if (gxStart < int(mHolidayMask->count()) && | 1312 | if (gxStart < int(mHolidayMask->count()) && |
1290 | !mHolidayMask->at(gxStart)) { | 1313 | !mHolidayMask->at(gxStart)) { |
1291 | int xStart = KOGlobals::self()->reverseLayout() ? | 1314 | int xStart = KOGlobals::self()->reverseLayout() ? |
1292 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1315 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1293 | gxStart*mGridSpacingX; | 1316 | gxStart*mGridSpacingX; |
1294 | if (xStart < x1) xStart = x1; | 1317 | if (xStart < x1) xStart = x1; |
1295 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1318 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1296 | (mColumns - gxStart)*mGridSpacingX-1 : | 1319 | (mColumns - gxStart)*mGridSpacingX-1 : |
1297 | (gxStart+1)*mGridSpacingX-1; | 1320 | (gxStart+1)*mGridSpacingX-1; |
1298 | if (xEnd > x2) xEnd = x2; | 1321 | if (xEnd > x2) xEnd = x2; |
1299 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { | 1322 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { |
1300 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1323 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1301 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1324 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1302 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1325 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1303 | else | 1326 | else |
1304 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1327 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1305 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1328 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1306 | } else { | 1329 | } else { |
1307 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1330 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1308 | KOPrefs::instance()->mWorkingHoursColor); | 1331 | KOPrefs::instance()->mWorkingHoursColor); |
1309 | } | 1332 | } |
1310 | } | 1333 | } |
1311 | ++gxStart; | 1334 | ++gxStart; |
1312 | } | 1335 | } |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 38bd93a..042a789 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -639,128 +639,146 @@ void KOAgendaItem::setSubCells(int subCells) | |||
639 | } | 639 | } |
640 | 640 | ||
641 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 641 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
642 | KOAgendaItem *last) | 642 | KOAgendaItem *last) |
643 | { | 643 | { |
644 | mFirstMultiItem = first; | 644 | mFirstMultiItem = first; |
645 | mNextMultiItem = next; | 645 | mNextMultiItem = next; |
646 | mLastMultiItem = last; | 646 | mLastMultiItem = last; |
647 | } | 647 | } |
648 | 648 | ||
649 | void KOAgendaItem::startMove() | 649 | void KOAgendaItem::startMove() |
650 | { | 650 | { |
651 | mStartCellX = mCellX; | 651 | mStartCellX = mCellX; |
652 | mStartCellXWidth = mCellXWidth; | 652 | mStartCellXWidth = mCellXWidth; |
653 | mStartCellYTop = mCellYTop; | 653 | mStartCellYTop = mCellYTop; |
654 | mStartCellYBottom = mCellYBottom; | 654 | mStartCellYBottom = mCellYBottom; |
655 | } | 655 | } |
656 | 656 | ||
657 | void KOAgendaItem::resetMove() | 657 | void KOAgendaItem::resetMove() |
658 | { | 658 | { |
659 | mCellX = mStartCellX; | 659 | mCellX = mStartCellX; |
660 | mCellXWidth = mStartCellXWidth; | 660 | mCellXWidth = mStartCellXWidth; |
661 | mCellYTop = mStartCellYTop; | 661 | mCellYTop = mStartCellYTop; |
662 | mCellYBottom = mStartCellYBottom; | 662 | mCellYBottom = mStartCellYBottom; |
663 | } | 663 | } |
664 | 664 | ||
665 | void KOAgendaItem::moveRelative(int dx, int dy) | 665 | void KOAgendaItem::moveRelative(int dx, int dy) |
666 | { | 666 | { |
667 | int newX = cellX() + dx; | 667 | int newX = cellX() + dx; |
668 | int newXWidth = cellXWidth() + dx; | 668 | int newXWidth = cellXWidth() + dx; |
669 | int newYTop = cellYTop() + dy; | 669 | int newYTop = cellYTop() + dy; |
670 | int newYBottom = cellYBottom() + dy; | 670 | int newYBottom = cellYBottom() + dy; |
671 | setCellXY(newX,newYTop,newYBottom); | 671 | setCellXY(newX,newYTop,newYBottom); |
672 | setCellXWidth(newXWidth); | 672 | setCellXWidth(newXWidth); |
673 | } | 673 | } |
674 | 674 | ||
675 | void KOAgendaItem::expandTop(int dy) | 675 | void KOAgendaItem::expandTop(int dy) |
676 | { | 676 | { |
677 | int newYTop = cellYTop() + dy; | 677 | int newYTop = cellYTop() + dy; |
678 | int newYBottom = cellYBottom(); | 678 | int newYBottom = cellYBottom(); |
679 | if (newYTop > newYBottom) newYTop = newYBottom; | 679 | if (newYTop > newYBottom) newYTop = newYBottom; |
680 | setCellY(newYTop, newYBottom); | 680 | setCellY(newYTop, newYBottom); |
681 | } | 681 | } |
682 | 682 | ||
683 | void KOAgendaItem::expandBottom(int dy) | 683 | void KOAgendaItem::expandBottom(int dy) |
684 | { | 684 | { |
685 | int newYTop = cellYTop(); | 685 | int newYTop = cellYTop(); |
686 | int newYBottom = cellYBottom() + dy; | 686 | int newYBottom = cellYBottom() + dy; |
687 | if (newYBottom < newYTop) newYBottom = newYTop; | 687 | if (newYBottom < newYTop) newYBottom = newYTop; |
688 | setCellY(newYTop, newYBottom); | 688 | setCellY(newYTop, newYBottom); |
689 | } | 689 | } |
690 | 690 | ||
691 | void KOAgendaItem::expandLeft(int dx) | 691 | void KOAgendaItem::expandLeft(int dx) |
692 | { | 692 | { |
693 | int newX = cellX() + dx; | 693 | int newX = cellX() + dx; |
694 | int newXWidth = cellXWidth(); | 694 | int newXWidth = cellXWidth(); |
695 | if (newX > newXWidth) newX = newXWidth; | 695 | if (newX > newXWidth) newX = newXWidth; |
696 | setCellX(newX,newXWidth); | 696 | setCellX(newX,newXWidth); |
697 | } | 697 | } |
698 | 698 | ||
699 | void KOAgendaItem::expandRight(int dx) | 699 | void KOAgendaItem::expandRight(int dx) |
700 | { | 700 | { |
701 | int newX = cellX(); | 701 | int newX = cellX(); |
702 | int newXWidth = cellXWidth() + dx; | 702 | int newXWidth = cellXWidth() + dx; |
703 | if (newXWidth < newX) newXWidth = newX; | 703 | if (newXWidth < newX) newXWidth = newX; |
704 | setCellX(newX,newXWidth); | 704 | setCellX(newX,newXWidth); |
705 | } | 705 | } |
706 | 706 | ||
707 | QToolTipGroup *KOAgendaItem::toolTipGroup() | 707 | QToolTipGroup *KOAgendaItem::toolTipGroup() |
708 | { | 708 | { |
709 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 709 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
710 | return mToolTipGroup; | 710 | return mToolTipGroup; |
711 | } | 711 | } |
712 | 712 | ||
713 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | 713 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) |
714 | { | 714 | { |
715 | #ifndef KORG_NODND | 715 | #ifndef KORG_NODND |
716 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || | 716 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || |
717 | !QTextDrag::canDecode( e ) ) { | 717 | !QTextDrag::canDecode( e ) ) { |
718 | e->ignore(); | 718 | e->ignore(); |
719 | return; | 719 | return; |
720 | } | 720 | } |
721 | e->accept(); | 721 | e->accept(); |
722 | #endif | 722 | #endif |
723 | } | 723 | } |
724 | 724 | ||
725 | void KOAgendaItem::dropEvent( QDropEvent *e ) | 725 | void KOAgendaItem::dropEvent( QDropEvent *e ) |
726 | { | 726 | { |
727 | #ifndef KORG_NODND | 727 | #ifndef KORG_NODND |
728 | QString text; | 728 | QString text; |
729 | if(QTextDrag::decode(e,text)) | 729 | if(QTextDrag::decode(e,text)) |
730 | { | 730 | { |
731 | kdDebug() << "Dropped : " << text << endl; | 731 | kdDebug() << "Dropped : " << text << endl; |
732 | QStringList emails = QStringList::split(",",text); | 732 | QStringList emails = QStringList::split(",",text); |
733 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 733 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
734 | kdDebug() << " Email: " << (*it) << endl; | 734 | kdDebug() << " Email: " << (*it) << endl; |
735 | int pos = (*it).find("<"); | 735 | int pos = (*it).find("<"); |
736 | QString name = (*it).left(pos); | 736 | QString name = (*it).left(pos); |
737 | QString email = (*it).mid(pos); | 737 | QString email = (*it).mid(pos); |
738 | if (!email.isEmpty()) { | 738 | if (!email.isEmpty()) { |
739 | mIncidence->addAttendee(new Attendee(name,email)); | 739 | mIncidence->addAttendee(new Attendee(name,email)); |
740 | } | 740 | } |
741 | } | 741 | } |
742 | } | 742 | } |
743 | #endif | 743 | #endif |
744 | } | 744 | } |
745 | 745 | ||
746 | 746 | ||
747 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() | 747 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() |
748 | { | 748 | { |
749 | return mConflictItems; | 749 | return mConflictItems; |
750 | } | 750 | } |
751 | 751 | ||
752 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) | 752 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) |
753 | { | 753 | { |
754 | mConflictItems = ci; | 754 | mConflictItems = ci; |
755 | KOAgendaItem *item; | 755 | KOAgendaItem *item; |
756 | for ( item=mConflictItems.first(); item != 0; | 756 | for ( item=mConflictItems.first(); item != 0; |
757 | item=mConflictItems.next() ) { | 757 | item=mConflictItems.next() ) { |
758 | item->addConflictItem(this); | 758 | item->addConflictItem(this); |
759 | } | 759 | } |
760 | } | 760 | } |
761 | 761 | ||
762 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) | 762 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) |
763 | { | 763 | { |
764 | if (mConflictItems.find(ci)<0) | 764 | if (mConflictItems.find(ci)<0) |
765 | mConflictItems.append(ci); | 765 | mConflictItems.append(ci); |
766 | } | 766 | } |
767 | |||
768 | bool KOAgendaItem::checkLayout() | ||
769 | { | ||
770 | if ( !mConflictItems.count() ) | ||
771 | return true; | ||
772 | int max = 0; | ||
773 | KOAgendaItem *item; | ||
774 | for ( item=mConflictItems.first(); item != 0; | ||
775 | item=mConflictItems.next() ) { | ||
776 | if ( item->subCells() > max ) | ||
777 | max = item->subCells(); | ||
778 | } | ||
779 | if ( max > subCells() ) { | ||
780 | setSubCells( max ); | ||
781 | return false; | ||
782 | } | ||
783 | return true; | ||
784 | } | ||
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index 5b8f420..b4dba79 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h | |||
@@ -1,161 +1,162 @@ | |||
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 | #ifndef KOAGENDAITEM_H | 19 | #ifndef KOAGENDAITEM_H |
20 | #define KOAGENDAITEM_H | 20 | #define KOAGENDAITEM_H |
21 | 21 | ||
22 | #include <qframe.h> | 22 | #include <qframe.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qpalette.h> | 26 | #include <qpalette.h> |
27 | 27 | ||
28 | #include <libkcal/incidence.h> | 28 | #include <libkcal/incidence.h> |
29 | 29 | ||
30 | class QToolTipGroup; | 30 | class QToolTipGroup; |
31 | class QDragEnterEvent; | 31 | class QDragEnterEvent; |
32 | class QDropEvent; | 32 | class QDropEvent; |
33 | 33 | ||
34 | using namespace KCal; | 34 | using namespace KCal; |
35 | 35 | ||
36 | /* | 36 | /* |
37 | The KOAgendaItem has to make sure that it receives all mouse events, which are | 37 | The KOAgendaItem has to make sure that it receives all mouse events, which are |
38 | to be used for dragging and resizing. That means it has to be installed as | 38 | to be used for dragging and resizing. That means it has to be installed as |
39 | eventfiler for its children, if it has children, and it has to pass mouse | 39 | eventfiler for its children, if it has children, and it has to pass mouse |
40 | events from the cildren to itself. See eventFilter(). | 40 | events from the cildren to itself. See eventFilter(). |
41 | */ | 41 | */ |
42 | class KOAgendaItem : public QWidget | 42 | class KOAgendaItem : public QWidget |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, | 46 | KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, |
47 | WFlags f=0 ); | 47 | WFlags f=0 ); |
48 | ~KOAgendaItem(); | 48 | ~KOAgendaItem(); |
49 | QString getWhatsThisText(); | 49 | QString getWhatsThisText(); |
50 | void init ( Incidence *incidence, QDate qd ); | 50 | void init ( Incidence *incidence, QDate qd ); |
51 | int cellX() { return mCellX; } | 51 | int cellX() { return mCellX; } |
52 | int cellXWidth() { return mCellXWidth; } | 52 | int cellXWidth() { return mCellXWidth; } |
53 | int cellYTop() { return mCellYTop; } | 53 | int cellYTop() { return mCellYTop; } |
54 | int cellYBottom() { return mCellYBottom; } | 54 | int cellYBottom() { return mCellYBottom; } |
55 | int cellHeight(); | 55 | int cellHeight(); |
56 | int cellWidth(); | 56 | int cellWidth(); |
57 | int subCell() { return mSubCell; } | 57 | int subCell() { return mSubCell; } |
58 | int subCells() { return mSubCells; } | 58 | int subCells() { return mSubCells; } |
59 | 59 | ||
60 | void setCellXY(int X, int YTop, int YBottom); | 60 | void setCellXY(int X, int YTop, int YBottom); |
61 | void setCellY(int YTop, int YBottom); | 61 | void setCellY(int YTop, int YBottom); |
62 | void setCellX(int XLeft, int XRight); | 62 | void setCellX(int XLeft, int XRight); |
63 | void setCellXWidth(int xwidth); | 63 | void setCellXWidth(int xwidth); |
64 | void setSubCell(int subCell); | 64 | void setSubCell(int subCell); |
65 | void setSubCells(int subCells); | 65 | void setSubCells(int subCells); |
66 | 66 | ||
67 | /** Start movement */ | 67 | /** Start movement */ |
68 | void startMove(); | 68 | void startMove(); |
69 | /** Reset to original values */ | 69 | /** Reset to original values */ |
70 | void resetMove(); | 70 | void resetMove(); |
71 | 71 | ||
72 | void moveRelative(int dx,int dy); | 72 | void moveRelative(int dx,int dy); |
73 | void expandTop(int dy); | 73 | void expandTop(int dy); |
74 | void expandBottom(int dy); | 74 | void expandBottom(int dy); |
75 | void expandLeft(int dx); | 75 | void expandLeft(int dx); |
76 | void expandRight(int dx); | 76 | void expandRight(int dx); |
77 | int mLastMoveXPos; | 77 | int mLastMoveXPos; |
78 | 78 | ||
79 | void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 79 | void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
80 | KOAgendaItem *last); | 80 | KOAgendaItem *last); |
81 | KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } | 81 | KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } |
82 | KOAgendaItem *nextMultiItem() { return mNextMultiItem; } | 82 | KOAgendaItem *nextMultiItem() { return mNextMultiItem; } |
83 | KOAgendaItem *lastMultiItem() { return mLastMultiItem; } | 83 | KOAgendaItem *lastMultiItem() { return mLastMultiItem; } |
84 | 84 | ||
85 | Incidence *incidence() const { return mIncidence; } | 85 | Incidence *incidence() const { return mIncidence; } |
86 | QDate itemDate() { return mDate; } | 86 | QDate itemDate() { return mDate; } |
87 | 87 | ||
88 | /** Update the date of this item's occurence (not in the event) */ | 88 | /** Update the date of this item's occurence (not in the event) */ |
89 | void setItemDate(QDate qd); | 89 | void setItemDate(QDate qd); |
90 | 90 | ||
91 | void setText ( const QString & text ) { mDisplayedText = text; } | 91 | void setText ( const QString & text ) { mDisplayedText = text; } |
92 | QString text () { return mDisplayedText; } | 92 | QString text () { return mDisplayedText; } |
93 | 93 | ||
94 | virtual bool eventFilter ( QObject *, QEvent * ); | 94 | virtual bool eventFilter ( QObject *, QEvent * ); |
95 | 95 | ||
96 | static QToolTipGroup *toolTipGroup(); | 96 | static QToolTipGroup *toolTipGroup(); |
97 | 97 | ||
98 | QPtrList<KOAgendaItem> conflictItems(); | 98 | QPtrList<KOAgendaItem> conflictItems(); |
99 | void setConflictItems(QPtrList<KOAgendaItem>); | 99 | void setConflictItems(QPtrList<KOAgendaItem>); |
100 | void addConflictItem(KOAgendaItem *ci); | 100 | void addConflictItem(KOAgendaItem *ci); |
101 | void paintMe( bool, QPainter* painter = 0 ); | 101 | void paintMe( bool, QPainter* painter = 0 ); |
102 | void repaintMe(); | 102 | void repaintMe(); |
103 | static void resizePixmap( int, int ); | 103 | static void resizePixmap( int, int ); |
104 | static QPixmap * paintPix(); | 104 | static QPixmap * paintPix(); |
105 | static QPixmap * paintPixSel(); | 105 | static QPixmap * paintPixSel(); |
106 | static QPixmap * paintPixAllday(); | 106 | static QPixmap * paintPixAllday(); |
107 | void updateItem(); | 107 | void updateItem(); |
108 | void computeText(); | 108 | void computeText(); |
109 | void recreateIncidence(); | 109 | void recreateIncidence(); |
110 | bool checkLayout(); | ||
110 | public slots: | 111 | public slots: |
111 | bool updateIcons( QPainter *, bool ); | 112 | bool updateIcons( QPainter *, bool ); |
112 | void select(bool=true); | 113 | void select(bool=true); |
113 | 114 | ||
114 | protected: | 115 | protected: |
115 | void dragEnterEvent(QDragEnterEvent *e); | 116 | void dragEnterEvent(QDragEnterEvent *e); |
116 | void dropEvent(QDropEvent *e); | 117 | void dropEvent(QDropEvent *e); |
117 | void paintEvent ( QPaintEvent * ); | 118 | void paintEvent ( QPaintEvent * ); |
118 | void resizeEvent ( QResizeEvent *ev ); | 119 | void resizeEvent ( QResizeEvent *ev ); |
119 | 120 | ||
120 | private: | 121 | private: |
121 | bool mAllDay; | 122 | bool mAllDay; |
122 | int mCellX; | 123 | int mCellX; |
123 | int mCellXWidth; | 124 | int mCellXWidth; |
124 | int mCellYTop,mCellYBottom; | 125 | int mCellYTop,mCellYBottom; |
125 | int mSubCell; // subcell number of this item | 126 | int mSubCell; // subcell number of this item |
126 | int mSubCells; // Total number of subcells in cell of this item | 127 | int mSubCells; // Total number of subcells in cell of this item |
127 | int xPaintCoord; | 128 | int xPaintCoord; |
128 | int yPaintCoord; | 129 | int yPaintCoord; |
129 | int wPaintCoord; | 130 | int wPaintCoord; |
130 | int hPaintCoord; | 131 | int hPaintCoord; |
131 | // Variables to remember start position | 132 | // Variables to remember start position |
132 | int mStartCellX; | 133 | int mStartCellX; |
133 | int mStartCellXWidth; | 134 | int mStartCellXWidth; |
134 | int mStartCellYTop,mStartCellYBottom; | 135 | int mStartCellYTop,mStartCellYBottom; |
135 | int mLastMovePos; | 136 | int mLastMovePos; |
136 | 137 | ||
137 | // Multi item pointers | 138 | // Multi item pointers |
138 | KOAgendaItem *mFirstMultiItem; | 139 | KOAgendaItem *mFirstMultiItem; |
139 | KOAgendaItem *mNextMultiItem; | 140 | KOAgendaItem *mNextMultiItem; |
140 | KOAgendaItem *mLastMultiItem; | 141 | KOAgendaItem *mLastMultiItem; |
141 | 142 | ||
142 | int mFontPixelSize; | 143 | int mFontPixelSize; |
143 | Incidence *mIncidence; // corresponding event or todo | 144 | Incidence *mIncidence; // corresponding event or todo |
144 | QDate mDate; //date this events occurs (for recurrence) | 145 | QDate mDate; //date this events occurs (for recurrence) |
145 | //void showIcon( QLabel*, int ); | 146 | //void showIcon( QLabel*, int ); |
146 | //QLabel *mTodoIconLabel; | 147 | //QLabel *mTodoIconLabel; |
147 | //QLabel *mItemLabel; | 148 | //QLabel *mItemLabel; |
148 | //QWidget *mIconBox; | 149 | //QWidget *mIconBox; |
149 | //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; | 150 | //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; |
150 | //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; | 151 | //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; |
151 | //QLabel *mIconMoreInfo; | 152 | //QLabel *mIconMoreInfo; |
152 | static QToolTipGroup *mToolTipGroup; | 153 | static QToolTipGroup *mToolTipGroup; |
153 | 154 | ||
154 | QColor mBackgroundColor; | 155 | QColor mBackgroundColor; |
155 | QColorGroup mColorGroup; | 156 | QColorGroup mColorGroup; |
156 | QString mDisplayedText; | 157 | QString mDisplayedText; |
157 | bool mSelected; | 158 | bool mSelected; |
158 | QPtrList<KOAgendaItem> mConflictItems; | 159 | QPtrList<KOAgendaItem> mConflictItems; |
159 | }; | 160 | }; |
160 | 161 | ||
161 | #endif // KOAGENDAITEM_H | 162 | #endif // KOAGENDAITEM_H |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 8bada3b..e2c8e6e 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -1,283 +1,292 @@ | |||
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 <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | 25 | ||
26 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
27 | #include "koprefs.h" | 27 | #include "koprefs.h" |
28 | #include <libkcal/todo.h> | 28 | #include <libkcal/todo.h> |
29 | #include "qapp.h" | 29 | #include "qapp.h" |
30 | 30 | ||
31 | #include "koeventviewerdialog.h" | 31 | #include "koeventviewerdialog.h" |
32 | extern int globalFlagBlockAgenda; | 32 | extern int globalFlagBlockAgenda; |
33 | 33 | ||
34 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 34 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
35 | : KDialogBase(parent,name, | 35 | : KDialogBase(parent,name, |
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | true , | 37 | true , |
38 | #else | 38 | #else |
39 | false, | 39 | false, |
40 | #endif | 40 | #endif |
41 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 41 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
42 | { | 42 | { |
43 | sendSignalViewerClosed = true; | 43 | sendSignalViewerClosed = true; |
44 | mEventViewer = new KOEventViewer(this); | 44 | mEventViewer = new KOEventViewer(this); |
45 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 45 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
46 | setMainWidget(mEventViewer); | 46 | setMainWidget(mEventViewer); |
47 | setButtonText(Ok, i18n("Edit") ); | 47 | setButtonText(Ok, i18n("Edit") ); |
48 | 48 | ||
49 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 49 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
50 | SLOT(editIncidence())); | 50 | SLOT(editIncidence())); |
51 | QObject::connect(this,SIGNAL(user1Clicked()), | 51 | QObject::connect(this,SIGNAL(user1Clicked()), |
52 | SLOT(showIncidence())); | 52 | SLOT(showIncidence())); |
53 | mIncidence = 0; | 53 | mIncidence = 0; |
54 | // TODO: Set a sensible size (based on the content?). | 54 | // TODO: Set a sensible size (based on the content?). |
55 | //showMaximized(); | 55 | //showMaximized(); |
56 | //qDebug("++++++++++++KOEventViewerDialog() "); | 56 | //qDebug("++++++++++++KOEventViewerDialog() "); |
57 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 57 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
58 | // setFixedSize( 240,284 ); | 58 | // setFixedSize( 240,284 ); |
59 | // move( 0, 15 ); | 59 | // move( 0, 15 ); |
60 | // } else { | 60 | // } else { |
61 | // setMinimumSize(300,200); | 61 | // setMinimumSize(300,200); |
62 | // resize(320,300); | 62 | // resize(320,300); |
63 | // } | 63 | // } |
64 | mSyncMode = false; | 64 | mSyncMode = false; |
65 | mSyncResult = 0; | 65 | mSyncResult = 0; |
66 | 66 | ||
67 | } | 67 | } |
68 | 68 | ||
69 | KOEventViewerDialog::~KOEventViewerDialog() | 69 | KOEventViewerDialog::~KOEventViewerDialog() |
70 | { | 70 | { |
71 | //qDebug("-------~KOEventViewerDialog() "); | 71 | //qDebug("-------~KOEventViewerDialog() "); |
72 | } | 72 | } |
73 | void KOEventViewerDialog::showMe() | 73 | void KOEventViewerDialog::showMe() |
74 | { | 74 | { |
75 | 75 | ||
76 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
77 | int x,y,w,h; | ||
78 | x = geometry().x(); | ||
79 | y = geometry().y(); | ||
80 | w = width(); | ||
81 | h = height(); | ||
77 | show(); | 82 | show(); |
83 | setGeometry(x,y,w,h); | ||
78 | #else | 84 | #else |
79 | showMaximized(); | 85 | showMaximized(); |
80 | #endif | 86 | #endif |
87 | raise(); | ||
81 | setActiveWindow(); | 88 | setActiveWindow(); |
82 | mEventViewer->setFocus(); | 89 | mEventViewer->setFocus(); |
83 | 90 | ||
84 | } | 91 | } |
85 | void KOEventViewerDialog::setSyncMode( bool b ) | 92 | void KOEventViewerDialog::setSyncMode( bool b ) |
86 | { | 93 | { |
87 | mSyncMode = b; | 94 | mSyncMode = b; |
88 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 95 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
89 | if ( mSyncMode ) { | 96 | if ( mSyncMode ) { |
90 | findButton( Close )->setText( i18n("Cancel Sync")); | 97 | findButton( Close )->setText( i18n("Cancel Sync")); |
91 | findButton( Ok )->setText( i18n("Remote")); | 98 | findButton( Ok )->setText( i18n("Remote")); |
92 | findButton( User1 )->setText( i18n("Local")); | 99 | findButton( User1 )->setText( i18n("Local")); |
93 | } else { | 100 | } else { |
94 | findButton( Close )->setText( i18n("Close")); | 101 | findButton( Close )->setText( i18n("Close")); |
95 | findButton( Ok )->setText( i18n("Edit")); | 102 | findButton( Ok )->setText( i18n("Edit")); |
96 | findButton( User1 )->setText( i18n("Agenda")); | 103 | findButton( User1 )->setText( i18n("Agenda")); |
97 | } | 104 | } |
98 | mEventViewer->setSyncMode( b ); | 105 | mEventViewer->setSyncMode( b ); |
99 | } | 106 | } |
100 | void KOEventViewerDialog::setColorMode( int m ) | 107 | void KOEventViewerDialog::setColorMode( int m ) |
101 | { | 108 | { |
102 | mEventViewer->setColorMode( m ); | 109 | mEventViewer->setColorMode( m ); |
103 | } | 110 | } |
104 | int KOEventViewerDialog::executeS( bool local ) | 111 | int KOEventViewerDialog::executeS( bool local ) |
105 | { | 112 | { |
106 | mSyncResult = 3; | 113 | mSyncResult = 3; |
107 | if ( local ) | 114 | if ( local ) |
108 | findButton( User1 )->setFocus(); | 115 | findButton( User1 )->setFocus(); |
109 | else | 116 | else |
110 | findButton( Ok )->setFocus(); | 117 | findButton( Ok )->setFocus(); |
111 | exec(); | 118 | exec(); |
112 | return mSyncResult; | 119 | return mSyncResult; |
113 | } | 120 | } |
114 | 121 | ||
115 | void KOEventViewerDialog::updateConfig() | 122 | void KOEventViewerDialog::updateConfig() |
116 | { | 123 | { |
117 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 124 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
118 | 125 | ||
119 | } | 126 | } |
120 | void KOEventViewerDialog::setEvent(Event *event) | 127 | void KOEventViewerDialog::setEvent(Event *event) |
121 | { | 128 | { |
122 | mEventViewer->setEvent(event); | 129 | mEventViewer->setEvent(event); |
123 | mIncidence = event; | 130 | mIncidence = event; |
124 | mEventViewer->setFocus(); | 131 | mEventViewer->setFocus(); |
125 | //findButton( Close )->setFocus(); | 132 | //findButton( Close )->setFocus(); |
126 | if ( !mSyncMode ) { | 133 | if ( !mSyncMode ) { |
127 | findButton( User1 )->setText( i18n("Agenda")); | 134 | findButton( User1 )->setText( i18n("Agenda")); |
128 | } | 135 | } |
129 | } | 136 | } |
130 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 137 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
131 | { | 138 | { |
132 | if ( in->type() == "Event" ) | 139 | if ( in->type() == "Event" ) |
133 | setEvent( (Event*) in ); | 140 | setEvent( (Event*) in ); |
134 | else if ( in->type() =="Todo" ) | 141 | else if ( in->type() =="Todo" ) |
135 | setTodo( (Todo*) in ); | 142 | setTodo( (Todo*) in ); |
136 | else if ( in->type() =="Journal" ) | 143 | else if ( in->type() =="Journal" ) |
137 | setJournal( (Journal*) in ); | 144 | setJournal( (Journal*) in ); |
138 | } | 145 | } |
139 | void KOEventViewerDialog::addIncidence(Incidence *in) | 146 | void KOEventViewerDialog::addIncidence(Incidence *in) |
140 | { | 147 | { |
141 | if ( in->type() == "Event" ) | 148 | if ( in->type() == "Event" ) |
142 | addEvent( (Event*) in ); | 149 | addEvent( (Event*) in ); |
143 | else if ( in->type() =="Todo" ) | 150 | else if ( in->type() =="Todo" ) |
144 | mEventViewer->setTodo( (Todo*) in, false ); | 151 | mEventViewer->setTodo( (Todo*) in, false ); |
145 | else if ( in->type() =="Journal" ) | 152 | else if ( in->type() =="Journal" ) |
146 | mEventViewer->setJournal( (Journal*) in, false ); | 153 | mEventViewer->setJournal( (Journal*) in, false ); |
147 | if ( mSyncMode ) { | 154 | if ( mSyncMode ) { |
148 | findButton( User1 )->setFocus(); | 155 | findButton( User1 )->setFocus(); |
149 | setCaption(i18n("Conflict! Please choose entry")); | 156 | setCaption(i18n("Conflict! Please choose entry")); |
150 | } | 157 | } |
151 | } | 158 | } |
152 | 159 | ||
153 | void KOEventViewerDialog::addEvent(Event *event) | 160 | void KOEventViewerDialog::addEvent(Event *event) |
154 | { | 161 | { |
155 | mEventViewer->addEvent(event); | 162 | mEventViewer->addEvent(event); |
156 | mIncidence = event; | 163 | mIncidence = event; |
157 | mEventViewer->setFocus(); | 164 | mEventViewer->setFocus(); |
158 | //findButton( Close )->setFocus(); | 165 | //findButton( Close )->setFocus(); |
159 | if ( !mSyncMode ) { | 166 | if ( !mSyncMode ) { |
160 | findButton( User1 )->setText( i18n("Agenda")); | 167 | findButton( User1 )->setText( i18n("Agenda")); |
161 | } | 168 | } |
162 | } | 169 | } |
163 | 170 | ||
164 | void KOEventViewerDialog::setTodo(Todo *event) | 171 | void KOEventViewerDialog::setTodo(Todo *event) |
165 | { | 172 | { |
166 | mEventViewer->setTodo(event); | 173 | mEventViewer->setTodo(event); |
167 | mIncidence = (Incidence*)event; | 174 | mIncidence = (Incidence*)event; |
168 | mEventViewer->setFocus(); | 175 | mEventViewer->setFocus(); |
169 | //findButton( Close )->setFocus(); | 176 | //findButton( Close )->setFocus(); |
170 | if ( !mSyncMode ) { | 177 | if ( !mSyncMode ) { |
171 | findButton( User1 )->setText( i18n("Set complete")); | 178 | findButton( User1 )->setText( i18n("Set complete")); |
172 | } | 179 | } |
173 | } | 180 | } |
174 | void KOEventViewerDialog::setJournal(Journal *j) | 181 | void KOEventViewerDialog::setJournal(Journal *j) |
175 | { | 182 | { |
176 | mEventViewer->setJournal(j); | 183 | mEventViewer->setJournal(j); |
177 | mIncidence = (Incidence*)j; | 184 | mIncidence = (Incidence*)j; |
178 | mEventViewer->setFocus(); | 185 | mEventViewer->setFocus(); |
179 | //findButton( Close )->setFocus(); | 186 | //findButton( Close )->setFocus(); |
180 | if ( !mSyncMode ) { | 187 | if ( !mSyncMode ) { |
181 | findButton( User1 )->setText( i18n("Agenda")); | 188 | findButton( User1 )->setText( i18n("Agenda")); |
182 | } | 189 | } |
183 | } | 190 | } |
184 | 191 | ||
185 | void KOEventViewerDialog::addText(QString text) | 192 | void KOEventViewerDialog::addText(QString text) |
186 | { | 193 | { |
187 | mEventViewer->addText(text); | 194 | mEventViewer->addText(text); |
188 | mEventViewer->setFocus(); | 195 | mEventViewer->setFocus(); |
189 | //findButton( Close )->setFocus(); | 196 | //findButton( Close )->setFocus(); |
190 | } | 197 | } |
191 | void KOEventViewerDialog::editIncidence() | 198 | void KOEventViewerDialog::editIncidence() |
192 | { | 199 | { |
193 | sendSignalViewerClosed = false; | 200 | sendSignalViewerClosed = false; |
194 | if ( mSyncMode ) { | 201 | if ( mSyncMode ) { |
195 | mSyncResult = 2; | 202 | mSyncResult = 2; |
196 | accept(); | 203 | accept(); |
197 | return; | 204 | return; |
198 | } | 205 | } |
199 | if ( mIncidence ){ | 206 | if ( mIncidence ){ |
200 | #ifndef DESKTOP_VERSION | 207 | #ifndef DESKTOP_VERSION |
201 | hide(); | 208 | hide(); |
202 | #endif | 209 | #endif |
203 | emit editIncidence( mIncidence ); | 210 | emit editIncidence( mIncidence ); |
204 | } | 211 | } |
205 | } | 212 | } |
206 | void KOEventViewerDialog::showIncidence() | 213 | void KOEventViewerDialog::showIncidence() |
207 | { | 214 | { |
208 | sendSignalViewerClosed = false; | 215 | sendSignalViewerClosed = false; |
209 | if ( mSyncMode ) { | 216 | if ( mSyncMode ) { |
210 | mSyncResult = 1; | 217 | mSyncResult = 1; |
211 | accept(); | 218 | accept(); |
212 | return; | 219 | return; |
213 | } | 220 | } |
214 | 221 | ||
215 | if ( mIncidence ){ | 222 | if ( mIncidence ){ |
216 | #ifndef DESKTOP_VERSION | 223 | #ifndef DESKTOP_VERSION |
217 | hide(); | 224 | hide(); |
218 | #endif | 225 | #endif |
219 | QDate date; | 226 | QDate date; |
220 | if ( mIncidence->type() == "Todo" ) { | 227 | if ( mIncidence->type() == "Todo" ) { |
221 | /* | 228 | /* |
222 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 229 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
223 | date = ((Todo*)mIncidence)->dtDue().date(); | 230 | date = ((Todo*)mIncidence)->dtDue().date(); |
224 | else { | 231 | else { |
225 | globalFlagBlockAgenda = 2; | 232 | globalFlagBlockAgenda = 2; |
226 | emit showAgendaView( false ); | 233 | emit showAgendaView( false ); |
227 | return; | 234 | return; |
228 | } | 235 | } |
229 | */ | 236 | */ |
230 | ((Todo*)mIncidence)->setCompleted( true ); | 237 | ((Todo*)mIncidence)->setCompleted( true ); |
231 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 238 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
232 | hide(); | 239 | hide(); |
233 | emit todoCompleted(((Todo*)mIncidence)); | 240 | emit todoCompleted(((Todo*)mIncidence)); |
234 | return; | 241 | return; |
235 | 242 | ||
236 | } else | 243 | } else |
237 | date = mIncidence->dtStart().date(); | 244 | date = mIncidence->dtStart().date(); |
238 | globalFlagBlockAgenda = 1; | 245 | globalFlagBlockAgenda = 1; |
239 | emit showAgendaView( false ); | 246 | emit showAgendaView( false ); |
240 | globalFlagBlockAgenda = 2; | 247 | globalFlagBlockAgenda = 2; |
241 | emit jumpToTime( date ); | 248 | emit jumpToTime( date ); |
242 | } | 249 | } |
243 | } | 250 | } |
244 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 251 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
245 | { | 252 | { |
246 | switch ( e->key() ) { | 253 | switch ( e->key() ) { |
247 | 254 | ||
248 | case Qt::Key_A : | 255 | case Qt::Key_A : |
249 | case Qt::Key_L : | 256 | case Qt::Key_L : |
250 | showIncidence(); | 257 | showIncidence(); |
251 | break; | 258 | break; |
252 | case Qt::Key_E : | 259 | case Qt::Key_E : |
253 | case Qt::Key_R : | 260 | case Qt::Key_R : |
254 | editIncidence(); | 261 | editIncidence(); |
255 | break; | 262 | break; |
256 | case Qt::Key_C: | 263 | case Qt::Key_C: |
257 | case Qt::Key_Escape: | 264 | case Qt::Key_Escape: |
258 | close(); | 265 | close(); |
259 | break; | 266 | break; |
260 | case Qt::Key_I: | 267 | case Qt::Key_I: |
261 | accept(); | 268 | sendSignalViewerClosed = true; |
269 | slotViewerClosed(); | ||
270 | //accept(); | ||
262 | break; | 271 | break; |
263 | default: | 272 | default: |
264 | KDialogBase::keyPressEvent ( e ); | 273 | KDialogBase::keyPressEvent ( e ); |
265 | break; | 274 | break; |
266 | } | 275 | } |
267 | 276 | ||
268 | } | 277 | } |
269 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | 278 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) |
270 | { | 279 | { |
271 | KDialogBase::hideEvent ( e ); | 280 | KDialogBase::hideEvent ( e ); |
272 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | 281 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); |
273 | } | 282 | } |
274 | 283 | ||
275 | void KOEventViewerDialog::slotViewerClosed() | 284 | void KOEventViewerDialog::slotViewerClosed() |
276 | { | 285 | { |
277 | if ( sendSignalViewerClosed ) { | 286 | if ( sendSignalViewerClosed ) { |
278 | //qDebug("KOEventViewerDialog::hideEvent "); | 287 | //qDebug("KOEventViewerDialog::hideEvent "); |
279 | emit signalViewerClosed(); | 288 | emit signalViewerClosed(); |
280 | } | 289 | } |
281 | sendSignalViewerClosed = true; | 290 | sendSignalViewerClosed = true; |
282 | } | 291 | } |
283 | 292 | ||