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 /korganizer | |
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 | |||
@@ -435,96 +435,97 @@ void CalendarView::init() | |||
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 ) |
@@ -2482,113 +2483,125 @@ void CalendarView::moveIncidence(Incidence * inc ) | |||
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 ) |
@@ -2748,97 +2761,97 @@ 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 | ||
@@ -3922,53 +3935,54 @@ bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | |||
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 | |||
@@ -1136,97 +1136,120 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
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 | } |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 38bd93a..042a789 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -719,48 +719,66 @@ void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | |||
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 | |||
@@ -62,96 +62,97 @@ class KOAgendaItem : public QWidget | |||
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; |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 8bada3b..e2c8e6e 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -29,100 +29,107 @@ | |||
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 | } |
@@ -213,71 +220,73 @@ void KOEventViewerDialog::showIncidence() | |||
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 | ||