author | zautrix <zautrix> | 2004-12-13 12:35:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-12-13 12:35:00 (UTC) |
commit | 7ac6c21e832b7d16bd0888d0b66252b6e152005a (patch) (unidiff) | |
tree | c7610e0e25020f19af82ac6257c2debab2638316 /korganizer | |
parent | 17b25691f0332e648dd1d800e89ccf4e1da8955d (diff) | |
download | kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.zip kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.tar.gz kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.tar.bz2 |
many bugfixes
-rw-r--r-- | korganizer/calendarview.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 15c5dd9..a46cd87 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2412,362 +2412,364 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | |||
2412 | #endif | 2412 | #endif |
2413 | } | 2413 | } |
2414 | } | 2414 | } |
2415 | void CalendarView::beamDone( Ir *ir ) | 2415 | void CalendarView::beamDone( Ir *ir ) |
2416 | { | 2416 | { |
2417 | #ifndef DESKTOP_VERSION | 2417 | #ifndef DESKTOP_VERSION |
2418 | delete ir; | 2418 | delete ir; |
2419 | #endif | 2419 | #endif |
2420 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2420 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2421 | topLevelWidget()->raise(); | 2421 | topLevelWidget()->raise(); |
2422 | } | 2422 | } |
2423 | 2423 | ||
2424 | void CalendarView::moveIncidence(Incidence * inc ) | 2424 | void CalendarView::moveIncidence(Incidence * inc ) |
2425 | { | 2425 | { |
2426 | if ( !inc ) return; | 2426 | if ( !inc ) return; |
2427 | // qDebug("showDatePickerForIncidence( ) "); | 2427 | // qDebug("showDatePickerForIncidence( ) "); |
2428 | if ( mDateFrame->isVisible() ) | 2428 | if ( mDateFrame->isVisible() ) |
2429 | mDateFrame->hide(); | 2429 | mDateFrame->hide(); |
2430 | else { | 2430 | else { |
2431 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2431 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2432 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2432 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2433 | int dw = QApplication::desktop()->width(); | 2433 | int dw = QApplication::desktop()->width(); |
2434 | int dh = QApplication::desktop()->height(); | 2434 | int dh = QApplication::desktop()->height(); |
2435 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2435 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2436 | mDateFrame->show(); | 2436 | mDateFrame->show(); |
2437 | } | 2437 | } |
2438 | mDatePickerMode = 2; | 2438 | mDatePickerMode = 2; |
2439 | mMoveIncidence = inc ; | 2439 | mMoveIncidence = inc ; |
2440 | QDate da; | 2440 | QDate da; |
2441 | if ( mMoveIncidence->type() == "Todo" ) { | 2441 | if ( mMoveIncidence->type() == "Todo" ) { |
2442 | Todo * to = (Todo *) mMoveIncidence; | 2442 | Todo * to = (Todo *) mMoveIncidence; |
2443 | if ( to->hasDueDate() ) | 2443 | if ( to->hasDueDate() ) |
2444 | da = to->dtDue().date(); | 2444 | da = to->dtDue().date(); |
2445 | else | 2445 | else |
2446 | da = QDate::currentDate(); | 2446 | da = QDate::currentDate(); |
2447 | } else { | 2447 | } else { |
2448 | da = mMoveIncidence->dtStart().date(); | 2448 | da = mMoveIncidence->dtStart().date(); |
2449 | } | 2449 | } |
2450 | //PENDING set date for recurring incidence to date of recurrence | 2450 | //PENDING set date for recurring incidence to date of recurrence |
2451 | //mMoveIncidenceOldDate; | 2451 | //mMoveIncidenceOldDate; |
2452 | mDatePicker->setDate( da ); | 2452 | mDatePicker->setDate( da ); |
2453 | } | 2453 | } |
2454 | void CalendarView::showDatePicker( ) | 2454 | void CalendarView::showDatePicker( ) |
2455 | { | 2455 | { |
2456 | //qDebug("CalendarView::showDatePicker( ) "); | 2456 | //qDebug("CalendarView::showDatePicker( ) "); |
2457 | if ( mDateFrame->isVisible() ) | 2457 | if ( mDateFrame->isVisible() ) |
2458 | mDateFrame->hide(); | 2458 | mDateFrame->hide(); |
2459 | else { | 2459 | else { |
2460 | int w =mDatePicker->sizeHint().width() ; | 2460 | int w =mDatePicker->sizeHint().width() ; |
2461 | int h = mDatePicker->sizeHint().height() ; | 2461 | int h = mDatePicker->sizeHint().height() ; |
2462 | int dw = QApplication::desktop()->width(); | 2462 | int dw = QApplication::desktop()->width(); |
2463 | int dh = QApplication::desktop()->height(); | 2463 | int dh = QApplication::desktop()->height(); |
2464 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2464 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2465 | mDateFrame->show(); | 2465 | mDateFrame->show(); |
2466 | } | 2466 | } |
2467 | mDatePickerMode = 1; | 2467 | mDatePickerMode = 1; |
2468 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2468 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2469 | } | 2469 | } |
2470 | 2470 | ||
2471 | void CalendarView::showEventEditor() | 2471 | void CalendarView::showEventEditor() |
2472 | { | 2472 | { |
2473 | #ifdef DESKTOP_VERSION | 2473 | #ifdef DESKTOP_VERSION |
2474 | mEventEditor->show(); | 2474 | mEventEditor->show(); |
2475 | #else | 2475 | #else |
2476 | if ( mEventEditor->width() != QApplication::desktop()->width() ) { | 2476 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2477 | qDebug("CalendarView: recreate mEventEditor "); | 2477 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2478 | qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | ||
2478 | delete mEventEditor; | 2479 | delete mEventEditor; |
2479 | mEventEditor = mDialogManager->getEventEditor(); | 2480 | mEventEditor = mDialogManager->getEventEditor(); |
2480 | } | 2481 | } |
2481 | mEventEditor->showMaximized(); | 2482 | mEventEditor->showMaximized(); |
2482 | #endif | 2483 | #endif |
2483 | } | 2484 | } |
2484 | void CalendarView::showTodoEditor() | 2485 | void CalendarView::showTodoEditor() |
2485 | { | 2486 | { |
2486 | #ifdef DESKTOP_VERSION | 2487 | #ifdef DESKTOP_VERSION |
2487 | mTodoEditor->show(); | 2488 | mTodoEditor->show(); |
2488 | #else | 2489 | #else |
2489 | if ( mTodoEditor->width() != QApplication::desktop()->width() ) { | 2490 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2490 | qDebug("CalendarView: recreate mTodoEditor "); | 2491 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2492 | qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | ||
2491 | delete mTodoEditor; | 2493 | delete mTodoEditor; |
2492 | mTodoEditor = mDialogManager->getTodoEditor(); | 2494 | mTodoEditor = mDialogManager->getTodoEditor(); |
2493 | } | 2495 | } |
2494 | mTodoEditor->showMaximized(); | 2496 | mTodoEditor->showMaximized(); |
2495 | #endif | 2497 | #endif |
2496 | } | 2498 | } |
2497 | 2499 | ||
2498 | void CalendarView::cloneIncidence() | 2500 | void CalendarView::cloneIncidence() |
2499 | { | 2501 | { |
2500 | Incidence *incidence = currentSelection(); | 2502 | Incidence *incidence = currentSelection(); |
2501 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2503 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2502 | if ( incidence ) { | 2504 | if ( incidence ) { |
2503 | cloneIncidence(incidence); | 2505 | cloneIncidence(incidence); |
2504 | } | 2506 | } |
2505 | } | 2507 | } |
2506 | void CalendarView::moveIncidence() | 2508 | void CalendarView::moveIncidence() |
2507 | { | 2509 | { |
2508 | Incidence *incidence = currentSelection(); | 2510 | Incidence *incidence = currentSelection(); |
2509 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2511 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2510 | if ( incidence ) { | 2512 | if ( incidence ) { |
2511 | moveIncidence(incidence); | 2513 | moveIncidence(incidence); |
2512 | } | 2514 | } |
2513 | } | 2515 | } |
2514 | void CalendarView::beamIncidence() | 2516 | void CalendarView::beamIncidence() |
2515 | { | 2517 | { |
2516 | Incidence *incidence = currentSelection(); | 2518 | Incidence *incidence = currentSelection(); |
2517 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2519 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2518 | if ( incidence ) { | 2520 | if ( incidence ) { |
2519 | beamIncidence(incidence); | 2521 | beamIncidence(incidence); |
2520 | } | 2522 | } |
2521 | } | 2523 | } |
2522 | void CalendarView::toggleCancelIncidence() | 2524 | void CalendarView::toggleCancelIncidence() |
2523 | { | 2525 | { |
2524 | Incidence *incidence = currentSelection(); | 2526 | Incidence *incidence = currentSelection(); |
2525 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2527 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2526 | if ( incidence ) { | 2528 | if ( incidence ) { |
2527 | cancelIncidence(incidence); | 2529 | cancelIncidence(incidence); |
2528 | } | 2530 | } |
2529 | } | 2531 | } |
2530 | 2532 | ||
2531 | 2533 | ||
2532 | void CalendarView::cancelIncidence(Incidence * inc ) | 2534 | void CalendarView::cancelIncidence(Incidence * inc ) |
2533 | { | 2535 | { |
2534 | inc->setCancelled( ! inc->cancelled() ); | 2536 | inc->setCancelled( ! inc->cancelled() ); |
2535 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2537 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2536 | updateView(); | 2538 | updateView(); |
2537 | } | 2539 | } |
2538 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2540 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2539 | { | 2541 | { |
2540 | Incidence * newInc = orgInc->clone(); | 2542 | Incidence * newInc = orgInc->clone(); |
2541 | newInc->recreate(); | 2543 | newInc->recreate(); |
2542 | 2544 | ||
2543 | if ( newInc->type() == "Todo" ) { | 2545 | if ( newInc->type() == "Todo" ) { |
2544 | Todo* t = (Todo*) newInc; | 2546 | Todo* t = (Todo*) newInc; |
2545 | mTodoEditor->editTodo( t ); | ||
2546 | showTodoEditor(); | 2547 | showTodoEditor(); |
2548 | mTodoEditor->editTodo( t ); | ||
2547 | if ( mTodoEditor->exec() ) { | 2549 | if ( mTodoEditor->exec() ) { |
2548 | mCalendar->addTodo( t ); | 2550 | mCalendar->addTodo( t ); |
2549 | updateView(); | 2551 | updateView(); |
2550 | } else { | 2552 | } else { |
2551 | delete t; | 2553 | delete t; |
2552 | } | 2554 | } |
2553 | } | 2555 | } |
2554 | else { | 2556 | else { |
2555 | Event* e = (Event*) newInc; | 2557 | Event* e = (Event*) newInc; |
2556 | mEventEditor->editEvent( e ); | ||
2557 | showEventEditor(); | 2558 | showEventEditor(); |
2559 | mEventEditor->editEvent( e ); | ||
2558 | if ( mEventEditor->exec() ) { | 2560 | if ( mEventEditor->exec() ) { |
2559 | mCalendar->addEvent( e ); | 2561 | mCalendar->addEvent( e ); |
2560 | updateView(); | 2562 | updateView(); |
2561 | } else { | 2563 | } else { |
2562 | delete e; | 2564 | delete e; |
2563 | } | 2565 | } |
2564 | } | 2566 | } |
2565 | } | 2567 | } |
2566 | 2568 | ||
2567 | void CalendarView::newEvent() | 2569 | void CalendarView::newEvent() |
2568 | { | 2570 | { |
2569 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2571 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2570 | KOAgendaView *aView = mViewManager->agendaView(); | 2572 | KOAgendaView *aView = mViewManager->agendaView(); |
2571 | if (aView) { | 2573 | if (aView) { |
2572 | if (aView->selectionStart().isValid()) { | 2574 | if (aView->selectionStart().isValid()) { |
2573 | if (aView->selectedIsAllDay()) { | 2575 | if (aView->selectedIsAllDay()) { |
2574 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2576 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2575 | } else { | 2577 | } else { |
2576 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2578 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2577 | } | 2579 | } |
2578 | return; | 2580 | return; |
2579 | } | 2581 | } |
2580 | } | 2582 | } |
2581 | 2583 | ||
2582 | QDate date = mNavigator->selectedDates().first(); | 2584 | QDate date = mNavigator->selectedDates().first(); |
2583 | QDateTime current = QDateTime::currentDateTime(); | 2585 | QDateTime current = QDateTime::currentDateTime(); |
2584 | if ( date <= current.date() ) { | 2586 | if ( date <= current.date() ) { |
2585 | int hour = current.time().hour() +1; | 2587 | int hour = current.time().hour() +1; |
2586 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2588 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2587 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2589 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2588 | } else | 2590 | } else |
2589 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2591 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2590 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2592 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2591 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2593 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2592 | } | 2594 | } |
2593 | 2595 | ||
2594 | void CalendarView::newEvent(QDateTime fh) | 2596 | void CalendarView::newEvent(QDateTime fh) |
2595 | { | 2597 | { |
2596 | newEvent(fh, | 2598 | newEvent(fh, |
2597 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2599 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2598 | } | 2600 | } |
2599 | 2601 | ||
2600 | void CalendarView::newEvent(QDate dt) | 2602 | void CalendarView::newEvent(QDate dt) |
2601 | { | 2603 | { |
2602 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2604 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2603 | QDateTime(dt, QTime(0,0,0)), true); | 2605 | QDateTime(dt, QTime(0,0,0)), true); |
2604 | } | 2606 | } |
2605 | 2607 | ||
2606 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2608 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2607 | { | 2609 | { |
2608 | 2610 | ||
2611 | showEventEditor(); | ||
2609 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2612 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2610 | if ( mFilterView->filtersEnabled() ) { | 2613 | if ( mFilterView->filtersEnabled() ) { |
2611 | CalFilter *filter = mFilterView->selectedFilter(); | 2614 | CalFilter *filter = mFilterView->selectedFilter(); |
2612 | if (filter && filter->showCategories()) { | 2615 | if (filter && filter->showCategories()) { |
2613 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2616 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2614 | } | 2617 | } |
2615 | if ( filter ) | 2618 | if ( filter ) |
2616 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2619 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2617 | } | 2620 | } |
2618 | showEventEditor(); | ||
2619 | } | 2621 | } |
2620 | void CalendarView::todoAdded(Todo * t) | 2622 | void CalendarView::todoAdded(Todo * t) |
2621 | { | 2623 | { |
2622 | 2624 | ||
2623 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2625 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2624 | updateTodoViews(); | 2626 | updateTodoViews(); |
2625 | } | 2627 | } |
2626 | void CalendarView::todoChanged(Todo * t) | 2628 | void CalendarView::todoChanged(Todo * t) |
2627 | { | 2629 | { |
2628 | emit todoModified( t, 4 ); | 2630 | emit todoModified( t, 4 ); |
2629 | // updateTodoViews(); | 2631 | // updateTodoViews(); |
2630 | } | 2632 | } |
2631 | void CalendarView::todoToBeDeleted(Todo *) | 2633 | void CalendarView::todoToBeDeleted(Todo *) |
2632 | { | 2634 | { |
2633 | //qDebug("todoToBeDeleted(Todo *) "); | 2635 | //qDebug("todoToBeDeleted(Todo *) "); |
2634 | updateTodoViews(); | 2636 | updateTodoViews(); |
2635 | } | 2637 | } |
2636 | void CalendarView::todoDeleted() | 2638 | void CalendarView::todoDeleted() |
2637 | { | 2639 | { |
2638 | //qDebug(" todoDeleted()"); | 2640 | //qDebug(" todoDeleted()"); |
2639 | updateTodoViews(); | 2641 | updateTodoViews(); |
2640 | } | 2642 | } |
2641 | 2643 | ||
2642 | 2644 | ||
2643 | 2645 | ||
2644 | void CalendarView::newTodo() | 2646 | void CalendarView::newTodo() |
2645 | { | 2647 | { |
2646 | 2648 | ||
2649 | showTodoEditor(); | ||
2647 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); | 2650 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); |
2648 | if ( mFilterView->filtersEnabled() ) { | 2651 | if ( mFilterView->filtersEnabled() ) { |
2649 | CalFilter *filter = mFilterView->selectedFilter(); | 2652 | CalFilter *filter = mFilterView->selectedFilter(); |
2650 | if (filter && filter->showCategories()) { | 2653 | if (filter && filter->showCategories()) { |
2651 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2654 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2652 | } | 2655 | } |
2653 | if ( filter ) | 2656 | if ( filter ) |
2654 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2657 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2655 | } | 2658 | } |
2656 | showTodoEditor(); | ||
2657 | } | 2659 | } |
2658 | 2660 | ||
2659 | void CalendarView::newSubTodo() | 2661 | void CalendarView::newSubTodo() |
2660 | { | 2662 | { |
2661 | Todo *todo = selectedTodo(); | 2663 | Todo *todo = selectedTodo(); |
2662 | if ( todo ) newSubTodo( todo ); | 2664 | if ( todo ) newSubTodo( todo ); |
2663 | } | 2665 | } |
2664 | 2666 | ||
2665 | void CalendarView::newSubTodo(Todo *parentEvent) | 2667 | void CalendarView::newSubTodo(Todo *parentEvent) |
2666 | { | 2668 | { |
2667 | 2669 | ||
2668 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | ||
2669 | showTodoEditor(); | 2670 | showTodoEditor(); |
2671 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | ||
2670 | } | 2672 | } |
2671 | 2673 | ||
2672 | void CalendarView::newFloatingEvent() | 2674 | void CalendarView::newFloatingEvent() |
2673 | { | 2675 | { |
2674 | DateList tmpList = mNavigator->selectedDates(); | 2676 | DateList tmpList = mNavigator->selectedDates(); |
2675 | QDate date = tmpList.first(); | 2677 | QDate date = tmpList.first(); |
2676 | 2678 | ||
2677 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2679 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2678 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2680 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2679 | } | 2681 | } |
2680 | 2682 | ||
2681 | 2683 | ||
2682 | void CalendarView::editEvent( Event *event ) | 2684 | void CalendarView::editEvent( Event *event ) |
2683 | { | 2685 | { |
2684 | 2686 | ||
2685 | if ( !event ) return; | 2687 | if ( !event ) return; |
2686 | if ( event->isReadOnly() ) { | 2688 | if ( event->isReadOnly() ) { |
2687 | showEvent( event ); | 2689 | showEvent( event ); |
2688 | return; | 2690 | return; |
2689 | } | 2691 | } |
2690 | mEventEditor->editEvent( event , mFlagEditDescription); | ||
2691 | showEventEditor(); | 2692 | showEventEditor(); |
2693 | mEventEditor->editEvent( event , mFlagEditDescription); | ||
2692 | } | 2694 | } |
2693 | void CalendarView::editJournal( Journal *jour ) | 2695 | void CalendarView::editJournal( Journal *jour ) |
2694 | { | 2696 | { |
2695 | if ( !jour ) return; | 2697 | if ( !jour ) return; |
2696 | mDialogManager->hideSearchDialog(); | 2698 | mDialogManager->hideSearchDialog(); |
2697 | mViewManager->showJournalView(); | 2699 | mViewManager->showJournalView(); |
2698 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2700 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2699 | } | 2701 | } |
2700 | void CalendarView::editTodo( Todo *todo ) | 2702 | void CalendarView::editTodo( Todo *todo ) |
2701 | { | 2703 | { |
2702 | if ( !todo ) return; | 2704 | if ( !todo ) return; |
2703 | 2705 | ||
2704 | if ( todo->isReadOnly() ) { | 2706 | if ( todo->isReadOnly() ) { |
2705 | showTodo( todo ); | 2707 | showTodo( todo ); |
2706 | return; | 2708 | return; |
2707 | } | 2709 | } |
2708 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | ||
2709 | showTodoEditor(); | 2710 | showTodoEditor(); |
2711 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | ||
2710 | 2712 | ||
2711 | } | 2713 | } |
2712 | 2714 | ||
2713 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2715 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2714 | { | 2716 | { |
2715 | if ( !mEventViewerDialog ) { | 2717 | if ( !mEventViewerDialog ) { |
2716 | mEventViewerDialog = new KOEventViewerDialog(this); | 2718 | mEventViewerDialog = new KOEventViewerDialog(this); |
2717 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2719 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2718 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2720 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2719 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2721 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2720 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2722 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2721 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2723 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2722 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2724 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2723 | mEventViewerDialog->resize( 640, 480 ); | 2725 | mEventViewerDialog->resize( 640, 480 ); |
2724 | 2726 | ||
2725 | } | 2727 | } |
2726 | return mEventViewerDialog; | 2728 | return mEventViewerDialog; |
2727 | } | 2729 | } |
2728 | void CalendarView::showEvent(Event *event) | 2730 | void CalendarView::showEvent(Event *event) |
2729 | { | 2731 | { |
2730 | getEventViewerDialog()->setEvent(event); | 2732 | getEventViewerDialog()->setEvent(event); |
2731 | getEventViewerDialog()->showMe(); | 2733 | getEventViewerDialog()->showMe(); |
2732 | } | 2734 | } |
2733 | 2735 | ||
2734 | void CalendarView::showTodo(Todo *event) | 2736 | void CalendarView::showTodo(Todo *event) |
2735 | { | 2737 | { |
2736 | getEventViewerDialog()->setTodo(event); | 2738 | getEventViewerDialog()->setTodo(event); |
2737 | getEventViewerDialog()->showMe(); | 2739 | getEventViewerDialog()->showMe(); |
2738 | } | 2740 | } |
2739 | void CalendarView::showJournal( Journal *jour ) | 2741 | void CalendarView::showJournal( Journal *jour ) |
2740 | { | 2742 | { |
2741 | getEventViewerDialog()->setJournal(jour); | 2743 | getEventViewerDialog()->setJournal(jour); |
2742 | getEventViewerDialog()->showMe(); | 2744 | getEventViewerDialog()->showMe(); |
2743 | 2745 | ||
2744 | } | 2746 | } |
2745 | // void CalendarView::todoModified (Todo *event, int changed) | 2747 | // void CalendarView::todoModified (Todo *event, int changed) |
2746 | // { | 2748 | // { |
2747 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2749 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2748 | // // kdDebug() << "Todo modified and open" << endl; | 2750 | // // kdDebug() << "Todo modified and open" << endl; |
2749 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2751 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2750 | // // temp->modified (changed); | 2752 | // // temp->modified (changed); |
2751 | 2753 | ||
2752 | // // } | 2754 | // // } |
2753 | 2755 | ||
2754 | // mViewManager->updateView(); | 2756 | // mViewManager->updateView(); |
2755 | // } | 2757 | // } |
2756 | 2758 | ||
2757 | void CalendarView::appointment_show() | 2759 | void CalendarView::appointment_show() |
2758 | { | 2760 | { |
2759 | Event *anEvent = 0; | 2761 | Event *anEvent = 0; |
2760 | 2762 | ||
2761 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2763 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2762 | 2764 | ||
2763 | if (mViewManager->currentView()->isEventView()) { | 2765 | if (mViewManager->currentView()->isEventView()) { |
2764 | if ( incidence && incidence->type() == "Event" ) { | 2766 | if ( incidence && incidence->type() == "Event" ) { |
2765 | anEvent = static_cast<Event *>(incidence); | 2767 | anEvent = static_cast<Event *>(incidence); |
2766 | } | 2768 | } |
2767 | } | 2769 | } |
2768 | 2770 | ||
2769 | if (!anEvent) { | 2771 | if (!anEvent) { |
2770 | KNotifyClient::beep(); | 2772 | KNotifyClient::beep(); |
2771 | return; | 2773 | return; |
2772 | } | 2774 | } |
2773 | 2775 | ||