-rw-r--r-- | korganizer/calendarview.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 4b3f806..558fc55 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2622,96 +2622,105 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | |||
2622 | else | 2622 | else |
2623 | mCalendar->checkAlarmForIncidence( which , false ); | 2623 | mCalendar->checkAlarmForIncidence( which , false ); |
2624 | } | 2624 | } |
2625 | 2625 | ||
2626 | // most of the changeEventDisplays() right now just call the view's | 2626 | // most of the changeEventDisplays() right now just call the view's |
2627 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2627 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2628 | void CalendarView::changeEventDisplay(Event *which, int action) | 2628 | void CalendarView::changeEventDisplay(Event *which, int action) |
2629 | { | 2629 | { |
2630 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2630 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2631 | changeIncidenceDisplay((Incidence *)which, action); | 2631 | changeIncidenceDisplay((Incidence *)which, action); |
2632 | mDateNavigator->updateView(); | 2632 | mDateNavigator->updateView(); |
2633 | //mDialogManager->updateSearchDialog(); | 2633 | //mDialogManager->updateSearchDialog(); |
2634 | 2634 | ||
2635 | if (which) { | 2635 | if (which) { |
2636 | // If there is an event view visible update the display | 2636 | // If there is an event view visible update the display |
2637 | mViewManager->currentView()->changeEventDisplay(which,action); | 2637 | mViewManager->currentView()->changeEventDisplay(which,action); |
2638 | // TODO: check, if update needed | 2638 | // TODO: check, if update needed |
2639 | // if (which->getTodoStatus()) { | 2639 | // if (which->getTodoStatus()) { |
2640 | mTodoList->updateView(); | 2640 | mTodoList->updateView(); |
2641 | // } | 2641 | // } |
2642 | } else { | 2642 | } else { |
2643 | mViewManager->currentView()->updateView(); | 2643 | mViewManager->currentView()->updateView(); |
2644 | } | 2644 | } |
2645 | } | 2645 | } |
2646 | 2646 | ||
2647 | 2647 | ||
2648 | void CalendarView::updateTodoViews() | 2648 | void CalendarView::updateTodoViews() |
2649 | { | 2649 | { |
2650 | mTodoList->updateView(); | 2650 | mTodoList->updateView(); |
2651 | mViewManager->currentView()->updateView(); | 2651 | mViewManager->currentView()->updateView(); |
2652 | 2652 | ||
2653 | } | 2653 | } |
2654 | 2654 | ||
2655 | 2655 | ||
2656 | 2656 | ||
2657 | void CalendarView::clearAllViews() | 2657 | void CalendarView::clearAllViews() |
2658 | { | 2658 | { |
2659 | mTodoList->clearList(); | 2659 | mTodoList->clearList(); |
2660 | mViewManager->clearAllViews(); | 2660 | mViewManager->clearAllViews(); |
2661 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2661 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2662 | if ( sd ) { | 2662 | if ( sd ) { |
2663 | KOListView* kol = sd->listview(); | 2663 | KOListView* kol = sd->listview(); |
2664 | if ( kol ) | 2664 | if ( kol ) |
2665 | kol->clearList(); | 2665 | kol->clearList(); |
2666 | } | 2666 | } |
2667 | } | 2667 | } |
2668 | void CalendarView::updateView() | 2668 | void CalendarView::updateView() |
2669 | { | 2669 | { |
2670 | static bool clearallviews = false; | ||
2671 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | ||
2672 | if ( clearallviews ) { | ||
2673 | clearAllViews(); | ||
2674 | clearallviews = false; | ||
2675 | } | ||
2676 | return; | ||
2677 | } | ||
2678 | clearallviews = true; | ||
2670 | DateList tmpList = mNavigator->selectedDates(); | 2679 | DateList tmpList = mNavigator->selectedDates(); |
2671 | 2680 | ||
2672 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2681 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2673 | mTodoList->updateView(); | 2682 | mTodoList->updateView(); |
2674 | // We assume that the navigator only selects consecutive days. | 2683 | // We assume that the navigator only selects consecutive days. |
2675 | updateView( tmpList.first(), tmpList.last() ); | 2684 | updateView( tmpList.first(), tmpList.last() ); |
2676 | } | 2685 | } |
2677 | 2686 | ||
2678 | void CalendarView::updateUnmanagedViews() | 2687 | void CalendarView::updateUnmanagedViews() |
2679 | { | 2688 | { |
2680 | mDateNavigator->updateDayMatrix(); | 2689 | mDateNavigator->updateDayMatrix(); |
2681 | } | 2690 | } |
2682 | 2691 | ||
2683 | int CalendarView::msgItemDelete(const QString name) | 2692 | int CalendarView::msgItemDelete(const QString name) |
2684 | { | 2693 | { |
2685 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2694 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2686 | i18n("This item will be\npermanently deleted."), | 2695 | i18n("This item will be\npermanently deleted."), |
2687 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2696 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2688 | } | 2697 | } |
2689 | 2698 | ||
2690 | 2699 | ||
2691 | void CalendarView::edit_cut() | 2700 | void CalendarView::edit_cut() |
2692 | { | 2701 | { |
2693 | Event *anEvent=0; | 2702 | Event *anEvent=0; |
2694 | 2703 | ||
2695 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2704 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2696 | 2705 | ||
2697 | if (mViewManager->currentView()->isEventView()) { | 2706 | if (mViewManager->currentView()->isEventView()) { |
2698 | if ( incidence && incidence->typeID() == eventID ) { | 2707 | if ( incidence && incidence->typeID() == eventID ) { |
2699 | anEvent = static_cast<Event *>(incidence); | 2708 | anEvent = static_cast<Event *>(incidence); |
2700 | } | 2709 | } |
2701 | } | 2710 | } |
2702 | 2711 | ||
2703 | if (!anEvent) { | 2712 | if (!anEvent) { |
2704 | KNotifyClient::beep(); | 2713 | KNotifyClient::beep(); |
2705 | return; | 2714 | return; |
2706 | } | 2715 | } |
2707 | DndFactory factory( mCalendar ); | 2716 | DndFactory factory( mCalendar ); |
2708 | factory.cutIncidence(anEvent); | 2717 | factory.cutIncidence(anEvent); |
2709 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2718 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2710 | } | 2719 | } |
2711 | 2720 | ||
2712 | void CalendarView::edit_copy() | 2721 | void CalendarView::edit_copy() |
2713 | { | 2722 | { |
2714 | Event *anEvent=0; | 2723 | Event *anEvent=0; |
2715 | 2724 | ||
2716 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2725 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2717 | 2726 | ||
@@ -4366,96 +4375,101 @@ void CalendarView::editIncidence() | |||
4366 | if ( incidence ) { | 4375 | if ( incidence ) { |
4367 | EditIncidenceVisitor v; | 4376 | EditIncidenceVisitor v; |
4368 | v.act( incidence, this ); | 4377 | v.act( incidence, this ); |
4369 | } | 4378 | } |
4370 | } | 4379 | } |
4371 | 4380 | ||
4372 | void CalendarView::deleteIncidence() | 4381 | void CalendarView::deleteIncidence() |
4373 | { | 4382 | { |
4374 | Incidence *incidence = currentSelection(); | 4383 | Incidence *incidence = currentSelection(); |
4375 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4384 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4376 | if ( incidence ) { | 4385 | if ( incidence ) { |
4377 | deleteIncidence(incidence); | 4386 | deleteIncidence(incidence); |
4378 | } | 4387 | } |
4379 | } | 4388 | } |
4380 | void CalendarView::showIncidence(QString uid) | 4389 | void CalendarView::showIncidence(QString uid) |
4381 | { | 4390 | { |
4382 | Incidence *inc = mCalendar->incidence( uid ); | 4391 | Incidence *inc = mCalendar->incidence( uid ); |
4383 | if ( inc ) | 4392 | if ( inc ) |
4384 | showIncidence( inc ); | 4393 | showIncidence( inc ); |
4385 | } | 4394 | } |
4386 | void CalendarView::showIncidence(Incidence *incidence) | 4395 | void CalendarView::showIncidence(Incidence *incidence) |
4387 | { | 4396 | { |
4388 | mViewerCallerIsSearchDialog = false; | 4397 | mViewerCallerIsSearchDialog = false; |
4389 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 4398 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
4390 | if ( sender() && mDialogManager->getSearchDialog() ) { | 4399 | if ( sender() && mDialogManager->getSearchDialog() ) { |
4391 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 4400 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
4392 | mViewerCallerIsSearchDialog = true; | 4401 | mViewerCallerIsSearchDialog = true; |
4393 | } | 4402 | } |
4394 | } | 4403 | } |
4395 | if ( incidence ) { | 4404 | if ( incidence ) { |
4396 | ShowIncidenceVisitor v; | 4405 | ShowIncidenceVisitor v; |
4397 | v.act( incidence, this ); | 4406 | v.act( incidence, this ); |
4398 | } | 4407 | } |
4399 | } | 4408 | } |
4400 | 4409 | ||
4401 | void CalendarView::editIncidence(Incidence *incidence) | 4410 | void CalendarView::editIncidence(Incidence *incidence) |
4402 | { | 4411 | { |
4403 | if ( incidence ) { | 4412 | if ( incidence ) { |
4404 | 4413 | ||
4405 | EditIncidenceVisitor v; | 4414 | EditIncidenceVisitor v; |
4406 | v.act( incidence, this ); | 4415 | v.act( incidence, this ); |
4407 | 4416 | ||
4408 | } | 4417 | } |
4409 | } | 4418 | } |
4410 | 4419 | ||
4411 | void CalendarView::deleteIncidence(Incidence *incidence) | 4420 | void CalendarView::deleteIncidence(Incidence *incidence) |
4412 | { | 4421 | { |
4413 | //qDebug(" CalendarView::deleteIncidence "); | 4422 | //qDebug(" CalendarView::deleteIncidence "); |
4423 | if ( incidence == 0 ) { | ||
4424 | updateView(); | ||
4425 | emit updateSearchDialog(); | ||
4426 | return; | ||
4427 | } | ||
4414 | if ( incidence ) { | 4428 | if ( incidence ) { |
4415 | DeleteIncidenceVisitor v; | 4429 | DeleteIncidenceVisitor v; |
4416 | v.act( incidence, this ); | 4430 | v.act( incidence, this ); |
4417 | } | 4431 | } |
4418 | } | 4432 | } |
4419 | 4433 | ||
4420 | 4434 | ||
4421 | void CalendarView::lookForOutgoingMessages() | 4435 | void CalendarView::lookForOutgoingMessages() |
4422 | { | 4436 | { |
4423 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 4437 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
4424 | ogd->loadMessages(); | 4438 | ogd->loadMessages(); |
4425 | } | 4439 | } |
4426 | 4440 | ||
4427 | void CalendarView::lookForIncomingMessages() | 4441 | void CalendarView::lookForIncomingMessages() |
4428 | { | 4442 | { |
4429 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 4443 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
4430 | icd->retrieve(); | 4444 | icd->retrieve(); |
4431 | } | 4445 | } |
4432 | 4446 | ||
4433 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 4447 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
4434 | { | 4448 | { |
4435 | bool deleteTodo = true; | 4449 | bool deleteTodo = true; |
4436 | QPtrList<Incidence> subTodos; | 4450 | QPtrList<Incidence> subTodos; |
4437 | Incidence *aTodo; | 4451 | Incidence *aTodo; |
4438 | subTodos = t->relations(); | 4452 | subTodos = t->relations(); |
4439 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 4453 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
4440 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 4454 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
4441 | deleteTodo = false; | 4455 | deleteTodo = false; |
4442 | } | 4456 | } |
4443 | if ( deleteTodo ) { | 4457 | if ( deleteTodo ) { |
4444 | if ( t->isCompleted() && !t->doesRecur()) { | 4458 | if ( t->isCompleted() && !t->doesRecur()) { |
4445 | checkExternalId( t ); | 4459 | checkExternalId( t ); |
4446 | mCalendar->deleteTodo( t ); | 4460 | mCalendar->deleteTodo( t ); |
4447 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4461 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
4448 | } | 4462 | } |
4449 | else | 4463 | else |
4450 | deleteTodo = false; | 4464 | deleteTodo = false; |
4451 | } | 4465 | } |
4452 | return deleteTodo; | 4466 | return deleteTodo; |
4453 | 4467 | ||
4454 | } | 4468 | } |
4455 | void CalendarView::purgeCompleted() | 4469 | void CalendarView::purgeCompleted() |
4456 | { | 4470 | { |
4457 | int result = KMessageBox::warningContinueCancel(this, | 4471 | int result = KMessageBox::warningContinueCancel(this, |
4458 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 4472 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
4459 | 4473 | ||
4460 | if (result == KMessageBox::Continue) { | 4474 | if (result == KMessageBox::Continue) { |
4461 | 4475 | ||