-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 | |||
@@ -2460,47 +2460,49 @@ void CalendarView::showDatePicker( ) | |||
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() |
@@ -2529,45 +2531,45 @@ void CalendarView::toggleCancelIncidence() | |||
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()) { |
@@ -2593,133 +2595,133 @@ void CalendarView::newEvent() | |||
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 | } |