author | zautrix <zautrix> | 2005-07-06 14:53:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 14:53:38 (UTC) |
commit | 2038f7363c31e1a0ab139a1184cbed10086e1862 (patch) (unidiff) | |
tree | 532bc409b7046938614417a8043455de0e86c8fe | |
parent | 2e8199c8aa82c018d24d67c299a09b2aa6a786f1 (diff) | |
download | kdepimpi-2038f7363c31e1a0ab139a1184cbed10086e1862.zip kdepimpi-2038f7363c31e1a0ab139a1184cbed10086e1862.tar.gz kdepimpi-2038f7363c31e1a0ab139a1184cbed10086e1862.tar.bz2 |
huhu
-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 558fc55..98e0ac1 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2440,384 +2440,398 @@ void CalendarView::writeSettings() | |||
2440 | list.clear(); | 2440 | list.clear(); |
2441 | list << QString::number( x ); | 2441 | list << QString::number( x ); |
2442 | list << QString::number( y ); | 2442 | list << QString::number( y ); |
2443 | list << QString::number( w ); | 2443 | list << QString::number( w ); |
2444 | list << QString::number( h ); | 2444 | list << QString::number( h ); |
2445 | config->writeEntry("EditTodoLayout",list ); | 2445 | config->writeEntry("EditTodoLayout",list ); |
2446 | wid = getEventViewerDialog(); | 2446 | wid = getEventViewerDialog(); |
2447 | x = wid->geometry().x(); | 2447 | x = wid->geometry().x(); |
2448 | y = wid->geometry().y(); | 2448 | y = wid->geometry().y(); |
2449 | w = wid->width(); | 2449 | w = wid->width(); |
2450 | h = wid->height(); | 2450 | h = wid->height(); |
2451 | list.clear(); | 2451 | list.clear(); |
2452 | list << QString::number( x ); | 2452 | list << QString::number( x ); |
2453 | list << QString::number( y ); | 2453 | list << QString::number( y ); |
2454 | list << QString::number( w ); | 2454 | list << QString::number( w ); |
2455 | list << QString::number( h ); | 2455 | list << QString::number( h ); |
2456 | config->writeEntry("ViewerLayout",list ); | 2456 | config->writeEntry("ViewerLayout",list ); |
2457 | wid = mDialogManager->getSearchDialog(); | 2457 | wid = mDialogManager->getSearchDialog(); |
2458 | if ( wid ) { | 2458 | if ( wid ) { |
2459 | x = wid->geometry().x(); | 2459 | x = wid->geometry().x(); |
2460 | y = wid->geometry().y(); | 2460 | y = wid->geometry().y(); |
2461 | w = wid->width(); | 2461 | w = wid->width(); |
2462 | h = wid->height(); | 2462 | h = wid->height(); |
2463 | list.clear(); | 2463 | list.clear(); |
2464 | list << QString::number( x ); | 2464 | list << QString::number( x ); |
2465 | list << QString::number( y ); | 2465 | list << QString::number( y ); |
2466 | list << QString::number( w ); | 2466 | list << QString::number( w ); |
2467 | list << QString::number( h ); | 2467 | list << QString::number( h ); |
2468 | config->writeEntry("SearchLayout",list ); | 2468 | config->writeEntry("SearchLayout",list ); |
2469 | } | 2469 | } |
2470 | #endif | 2470 | #endif |
2471 | 2471 | ||
2472 | 2472 | ||
2473 | config->sync(); | 2473 | config->sync(); |
2474 | } | 2474 | } |
2475 | 2475 | ||
2476 | void CalendarView::readFilterSettings(KConfig *config) | 2476 | void CalendarView::readFilterSettings(KConfig *config) |
2477 | { | 2477 | { |
2478 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2478 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2479 | 2479 | ||
2480 | mFilters.clear(); | 2480 | mFilters.clear(); |
2481 | 2481 | ||
2482 | config->setGroup("General"); | 2482 | config->setGroup("General"); |
2483 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2483 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2484 | 2484 | ||
2485 | QStringList::ConstIterator it = filterList.begin(); | 2485 | QStringList::ConstIterator it = filterList.begin(); |
2486 | QStringList::ConstIterator end = filterList.end(); | 2486 | QStringList::ConstIterator end = filterList.end(); |
2487 | while(it != end) { | 2487 | while(it != end) { |
2488 | // kdDebug() << " filter: " << (*it) << endl; | 2488 | // kdDebug() << " filter: " << (*it) << endl; |
2489 | 2489 | ||
2490 | CalFilter *filter; | 2490 | CalFilter *filter; |
2491 | filter = new CalFilter(*it); | 2491 | filter = new CalFilter(*it); |
2492 | config->setGroup("Filter_" + (*it).utf8()); | 2492 | config->setGroup("Filter_" + (*it).utf8()); |
2493 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2493 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2494 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2494 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2495 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2495 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2496 | mFilters.append(filter); | 2496 | mFilters.append(filter); |
2497 | 2497 | ||
2498 | ++it; | 2498 | ++it; |
2499 | } | 2499 | } |
2500 | 2500 | ||
2501 | if (mFilters.count() == 0) { | 2501 | if (mFilters.count() == 0) { |
2502 | CalFilter *filter = new CalFilter(i18n("Default")); | 2502 | CalFilter *filter = new CalFilter(i18n("Default")); |
2503 | mFilters.append(filter); | 2503 | mFilters.append(filter); |
2504 | } | 2504 | } |
2505 | mFilterView->updateFilters(); | 2505 | mFilterView->updateFilters(); |
2506 | config->setGroup("FilterView"); | 2506 | config->setGroup("FilterView"); |
2507 | 2507 | ||
2508 | mFilterView->blockSignals(true); | 2508 | mFilterView->blockSignals(true); |
2509 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2509 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2510 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2510 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2511 | mFilterView->blockSignals(false); | 2511 | mFilterView->blockSignals(false); |
2512 | // We do it manually to avoid it being done twice by the above calls | 2512 | // We do it manually to avoid it being done twice by the above calls |
2513 | updateFilter(); | 2513 | updateFilter(); |
2514 | } | 2514 | } |
2515 | 2515 | ||
2516 | void CalendarView::writeFilterSettings(KConfig *config) | 2516 | void CalendarView::writeFilterSettings(KConfig *config) |
2517 | { | 2517 | { |
2518 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2518 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2519 | 2519 | ||
2520 | QStringList filterList; | 2520 | QStringList filterList; |
2521 | 2521 | ||
2522 | CalFilter *filter = mFilters.first(); | 2522 | CalFilter *filter = mFilters.first(); |
2523 | while(filter) { | 2523 | while(filter) { |
2524 | // kdDebug() << " fn: " << filter->name() << endl; | 2524 | // kdDebug() << " fn: " << filter->name() << endl; |
2525 | filterList << filter->name(); | 2525 | filterList << filter->name(); |
2526 | config->setGroup("Filter_" + filter->name().utf8()); | 2526 | config->setGroup("Filter_" + filter->name().utf8()); |
2527 | config->writeEntry("Criteria",filter->criteria()); | 2527 | config->writeEntry("Criteria",filter->criteria()); |
2528 | config->writeEntry("CategoryList",filter->categoryList()); | 2528 | config->writeEntry("CategoryList",filter->categoryList()); |
2529 | filter = mFilters.next(); | 2529 | filter = mFilters.next(); |
2530 | } | 2530 | } |
2531 | config->setGroup("General"); | 2531 | config->setGroup("General"); |
2532 | config->writeEntry("CalendarFilters",filterList); | 2532 | config->writeEntry("CalendarFilters",filterList); |
2533 | 2533 | ||
2534 | config->setGroup("FilterView"); | 2534 | config->setGroup("FilterView"); |
2535 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2535 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2536 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2536 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2537 | } | 2537 | } |
2538 | 2538 | ||
2539 | 2539 | ||
2540 | void CalendarView::goToday() | 2540 | void CalendarView::goToday() |
2541 | { | 2541 | { |
2542 | if ( mViewManager->currentView()->isMonthView() ) | 2542 | if ( mViewManager->currentView()->isMonthView() ) |
2543 | mNavigator->selectTodayMonth(); | 2543 | mNavigator->selectTodayMonth(); |
2544 | else | 2544 | else |
2545 | mNavigator->selectToday(); | 2545 | mNavigator->selectToday(); |
2546 | } | 2546 | } |
2547 | 2547 | ||
2548 | void CalendarView::goNext() | 2548 | void CalendarView::goNext() |
2549 | { | 2549 | { |
2550 | mNavigator->selectNext(); | 2550 | mNavigator->selectNext(); |
2551 | } | 2551 | } |
2552 | 2552 | ||
2553 | void CalendarView::goPrevious() | 2553 | void CalendarView::goPrevious() |
2554 | { | 2554 | { |
2555 | mNavigator->selectPrevious(); | 2555 | mNavigator->selectPrevious(); |
2556 | } | 2556 | } |
2557 | void CalendarView::goNextMonth() | 2557 | void CalendarView::goNextMonth() |
2558 | { | 2558 | { |
2559 | mNavigator->selectNextMonth(); | 2559 | mNavigator->selectNextMonth(); |
2560 | } | 2560 | } |
2561 | 2561 | ||
2562 | void CalendarView::goPreviousMonth() | 2562 | void CalendarView::goPreviousMonth() |
2563 | { | 2563 | { |
2564 | mNavigator->selectPreviousMonth(); | 2564 | mNavigator->selectPreviousMonth(); |
2565 | } | 2565 | } |
2566 | 2566 | ||
2567 | void CalendarView::updateConfig() | 2567 | void CalendarView::updateConfig() |
2568 | { | 2568 | { |
2569 | if ( KOPrefs::instance()->mUseAppColors ) | 2569 | if ( KOPrefs::instance()->mUseAppColors ) |
2570 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2570 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2571 | emit configChanged(); | 2571 | emit configChanged(); |
2572 | mTodoList->updateConfig(); | 2572 | mTodoList->updateConfig(); |
2573 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2573 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2574 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2574 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2575 | // To make the "fill window" configurations work | 2575 | // To make the "fill window" configurations work |
2576 | //mViewManager->raiseCurrentView(); | 2576 | //mViewManager->raiseCurrentView(); |
2577 | } | 2577 | } |
2578 | 2578 | ||
2579 | 2579 | ||
2580 | void CalendarView::eventChanged(Event *event) | 2580 | void CalendarView::eventChanged(Event *event) |
2581 | { | 2581 | { |
2582 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2582 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2583 | //updateUnmanagedViews(); | 2583 | //updateUnmanagedViews(); |
2584 | } | 2584 | } |
2585 | 2585 | ||
2586 | void CalendarView::eventAdded(Event *event) | 2586 | void CalendarView::eventAdded(Event *event) |
2587 | { | 2587 | { |
2588 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2588 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2589 | } | 2589 | } |
2590 | 2590 | ||
2591 | void CalendarView::eventToBeDeleted(Event *) | 2591 | void CalendarView::eventToBeDeleted(Event *) |
2592 | { | 2592 | { |
2593 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2593 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2594 | } | 2594 | } |
2595 | 2595 | ||
2596 | void CalendarView::eventDeleted() | 2596 | void CalendarView::eventDeleted() |
2597 | { | 2597 | { |
2598 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2598 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2599 | } | 2599 | } |
2600 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2600 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2601 | { | 2601 | { |
2602 | changeIncidenceDisplay((Incidence *)which, action); | 2602 | changeIncidenceDisplay((Incidence *)which, action); |
2603 | mDateNavigator->updateView(); //LR | 2603 | mDateNavigator->updateView(); //LR |
2604 | //mDialogManager->updateSearchDialog(); | 2604 | //mDialogManager->updateSearchDialog(); |
2605 | 2605 | ||
2606 | if (which) { | 2606 | if (which) { |
2607 | mViewManager->updateWNview(); | 2607 | mViewManager->updateWNview(); |
2608 | //mTodoList->updateView(); | 2608 | //mTodoList->updateView(); |
2609 | } | 2609 | } |
2610 | 2610 | ||
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2613 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2614 | { | 2614 | { |
2615 | updateUnmanagedViews(); | 2615 | updateUnmanagedViews(); |
2616 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2616 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2617 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2617 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2618 | mCalendar->checkAlarmForIncidence( 0, true ); | 2618 | mCalendar->checkAlarmForIncidence( 0, true ); |
2619 | if ( mEventViewerDialog ) | 2619 | if ( mEventViewerDialog ) |
2620 | mEventViewerDialog->hide(); | 2620 | mEventViewerDialog->hide(); |
2621 | } | 2621 | } |
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 | |||
2633 | |||
2634 | static bool clearallviews = false; | ||
2635 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | ||
2636 | if ( clearallviews ) { | ||
2637 | clearAllViews(); | ||
2638 | clearallviews = false; | ||
2639 | } | ||
2640 | return; | ||
2641 | } | ||
2642 | clearallviews = true; | ||
2643 | |||
2644 | |||
2645 | |||
2632 | mDateNavigator->updateView(); | 2646 | mDateNavigator->updateView(); |
2633 | //mDialogManager->updateSearchDialog(); | 2647 | //mDialogManager->updateSearchDialog(); |
2634 | 2648 | ||
2635 | if (which) { | 2649 | if (which) { |
2636 | // If there is an event view visible update the display | 2650 | // If there is an event view visible update the display |
2637 | mViewManager->currentView()->changeEventDisplay(which,action); | 2651 | mViewManager->currentView()->changeEventDisplay(which,action); |
2638 | // TODO: check, if update needed | 2652 | // TODO: check, if update needed |
2639 | // if (which->getTodoStatus()) { | 2653 | // if (which->getTodoStatus()) { |
2640 | mTodoList->updateView(); | 2654 | mTodoList->updateView(); |
2641 | // } | 2655 | // } |
2642 | } else { | 2656 | } else { |
2643 | mViewManager->currentView()->updateView(); | 2657 | mViewManager->currentView()->updateView(); |
2644 | } | 2658 | } |
2645 | } | 2659 | } |
2646 | 2660 | ||
2647 | 2661 | ||
2648 | void CalendarView::updateTodoViews() | 2662 | void CalendarView::updateTodoViews() |
2649 | { | 2663 | { |
2650 | mTodoList->updateView(); | 2664 | mTodoList->updateView(); |
2651 | mViewManager->currentView()->updateView(); | 2665 | mViewManager->currentView()->updateView(); |
2652 | 2666 | ||
2653 | } | 2667 | } |
2654 | 2668 | ||
2655 | 2669 | ||
2656 | 2670 | ||
2657 | void CalendarView::clearAllViews() | 2671 | void CalendarView::clearAllViews() |
2658 | { | 2672 | { |
2659 | mTodoList->clearList(); | 2673 | mTodoList->clearList(); |
2660 | mViewManager->clearAllViews(); | 2674 | mViewManager->clearAllViews(); |
2661 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2675 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2662 | if ( sd ) { | 2676 | if ( sd ) { |
2663 | KOListView* kol = sd->listview(); | 2677 | KOListView* kol = sd->listview(); |
2664 | if ( kol ) | 2678 | if ( kol ) |
2665 | kol->clearList(); | 2679 | kol->clearList(); |
2666 | } | 2680 | } |
2667 | } | 2681 | } |
2668 | void CalendarView::updateView() | 2682 | void CalendarView::updateView() |
2669 | { | 2683 | { |
2670 | static bool clearallviews = false; | 2684 | static bool clearallviews = false; |
2671 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2685 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2672 | if ( clearallviews ) { | 2686 | if ( clearallviews ) { |
2673 | clearAllViews(); | 2687 | clearAllViews(); |
2674 | clearallviews = false; | 2688 | clearallviews = false; |
2675 | } | 2689 | } |
2676 | return; | 2690 | return; |
2677 | } | 2691 | } |
2678 | clearallviews = true; | 2692 | clearallviews = true; |
2679 | DateList tmpList = mNavigator->selectedDates(); | 2693 | DateList tmpList = mNavigator->selectedDates(); |
2680 | 2694 | ||
2681 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2695 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2682 | mTodoList->updateView(); | 2696 | mTodoList->updateView(); |
2683 | // We assume that the navigator only selects consecutive days. | 2697 | // We assume that the navigator only selects consecutive days. |
2684 | updateView( tmpList.first(), tmpList.last() ); | 2698 | updateView( tmpList.first(), tmpList.last() ); |
2685 | } | 2699 | } |
2686 | 2700 | ||
2687 | void CalendarView::updateUnmanagedViews() | 2701 | void CalendarView::updateUnmanagedViews() |
2688 | { | 2702 | { |
2689 | mDateNavigator->updateDayMatrix(); | 2703 | mDateNavigator->updateDayMatrix(); |
2690 | } | 2704 | } |
2691 | 2705 | ||
2692 | int CalendarView::msgItemDelete(const QString name) | 2706 | int CalendarView::msgItemDelete(const QString name) |
2693 | { | 2707 | { |
2694 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2708 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2695 | i18n("This item will be\npermanently deleted."), | 2709 | i18n("This item will be\npermanently deleted."), |
2696 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2710 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2697 | } | 2711 | } |
2698 | 2712 | ||
2699 | 2713 | ||
2700 | void CalendarView::edit_cut() | 2714 | void CalendarView::edit_cut() |
2701 | { | 2715 | { |
2702 | Event *anEvent=0; | 2716 | Event *anEvent=0; |
2703 | 2717 | ||
2704 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2718 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2705 | 2719 | ||
2706 | if (mViewManager->currentView()->isEventView()) { | 2720 | if (mViewManager->currentView()->isEventView()) { |
2707 | if ( incidence && incidence->typeID() == eventID ) { | 2721 | if ( incidence && incidence->typeID() == eventID ) { |
2708 | anEvent = static_cast<Event *>(incidence); | 2722 | anEvent = static_cast<Event *>(incidence); |
2709 | } | 2723 | } |
2710 | } | 2724 | } |
2711 | 2725 | ||
2712 | if (!anEvent) { | 2726 | if (!anEvent) { |
2713 | KNotifyClient::beep(); | 2727 | KNotifyClient::beep(); |
2714 | return; | 2728 | return; |
2715 | } | 2729 | } |
2716 | DndFactory factory( mCalendar ); | 2730 | DndFactory factory( mCalendar ); |
2717 | factory.cutIncidence(anEvent); | 2731 | factory.cutIncidence(anEvent); |
2718 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2732 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2719 | } | 2733 | } |
2720 | 2734 | ||
2721 | void CalendarView::edit_copy() | 2735 | void CalendarView::edit_copy() |
2722 | { | 2736 | { |
2723 | Event *anEvent=0; | 2737 | Event *anEvent=0; |
2724 | 2738 | ||
2725 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2739 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2726 | 2740 | ||
2727 | if (mViewManager->currentView()->isEventView()) { | 2741 | if (mViewManager->currentView()->isEventView()) { |
2728 | if ( incidence && incidence->typeID() == eventID ) { | 2742 | if ( incidence && incidence->typeID() == eventID ) { |
2729 | anEvent = static_cast<Event *>(incidence); | 2743 | anEvent = static_cast<Event *>(incidence); |
2730 | } | 2744 | } |
2731 | } | 2745 | } |
2732 | 2746 | ||
2733 | if (!anEvent) { | 2747 | if (!anEvent) { |
2734 | KNotifyClient::beep(); | 2748 | KNotifyClient::beep(); |
2735 | return; | 2749 | return; |
2736 | } | 2750 | } |
2737 | DndFactory factory( mCalendar ); | 2751 | DndFactory factory( mCalendar ); |
2738 | factory.copyIncidence(anEvent); | 2752 | factory.copyIncidence(anEvent); |
2739 | } | 2753 | } |
2740 | 2754 | ||
2741 | void CalendarView::edit_paste() | 2755 | void CalendarView::edit_paste() |
2742 | { | 2756 | { |
2743 | QDate date = mNavigator->selectedDates().first(); | 2757 | QDate date = mNavigator->selectedDates().first(); |
2744 | 2758 | ||
2745 | DndFactory factory( mCalendar ); | 2759 | DndFactory factory( mCalendar ); |
2746 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2760 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2747 | 2761 | ||
2748 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2762 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2749 | } | 2763 | } |
2750 | void CalendarView::edit_global_options() | 2764 | void CalendarView::edit_global_options() |
2751 | { | 2765 | { |
2752 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2766 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2753 | emit save(); | 2767 | emit save(); |
2754 | emit saveStopTimer(); | 2768 | emit saveStopTimer(); |
2755 | mDialogManager->showGlobalOptionsDialog(); | 2769 | mDialogManager->showGlobalOptionsDialog(); |
2756 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2770 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2757 | emit saveStopTimer(); | 2771 | emit saveStopTimer(); |
2758 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2772 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2759 | i18n("Timezone settings"),i18n("Reload"))) { | 2773 | i18n("Timezone settings"),i18n("Reload"))) { |
2760 | qDebug("KO: TZ reload cancelled "); | 2774 | qDebug("KO: TZ reload cancelled "); |
2761 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2775 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2762 | return; | 2776 | return; |
2763 | } | 2777 | } |
2764 | qDebug("KO: Timezone change "); | 2778 | qDebug("KO: Timezone change "); |
2765 | loadCalendars(); | 2779 | loadCalendars(); |
2766 | setModified(true); | 2780 | setModified(true); |
2767 | } | 2781 | } |
2768 | else | 2782 | else |
2769 | qDebug("KO: No tz change "); | 2783 | qDebug("KO: No tz change "); |
2770 | } | 2784 | } |
2771 | void CalendarView::edit_options() | 2785 | void CalendarView::edit_options() |
2772 | { | 2786 | { |
2773 | mDialogManager->showOptionsDialog(); | 2787 | mDialogManager->showOptionsDialog(); |
2774 | } | 2788 | } |
2775 | 2789 | ||
2776 | 2790 | ||
2777 | void CalendarView::slotSelectPickerDate( QDate d) | 2791 | void CalendarView::slotSelectPickerDate( QDate d) |
2778 | { | 2792 | { |
2779 | mDateFrame->hide(); | 2793 | mDateFrame->hide(); |
2780 | if ( mDatePickerMode == 1 ) { | 2794 | if ( mDatePickerMode == 1 ) { |
2781 | mNavigator->slotDaySelect( d ); | 2795 | mNavigator->slotDaySelect( d ); |
2782 | } else if ( mDatePickerMode == 2 ) { | 2796 | } else if ( mDatePickerMode == 2 ) { |
2783 | if ( mMoveIncidence->typeID() == todoID ) { | 2797 | if ( mMoveIncidence->typeID() == todoID ) { |
2784 | Todo * to = (Todo *) mMoveIncidence; | 2798 | Todo * to = (Todo *) mMoveIncidence; |
2785 | QTime tim; | 2799 | QTime tim; |
2786 | int len = 0; | 2800 | int len = 0; |
2787 | if ( to->hasStartDate() && to->hasDueDate() ) | 2801 | if ( to->hasStartDate() && to->hasDueDate() ) |
2788 | len = to->dtStart().secsTo( to->dtDue()); | 2802 | len = to->dtStart().secsTo( to->dtDue()); |
2789 | if ( to->hasDueDate() ) | 2803 | if ( to->hasDueDate() ) |
2790 | tim = to->dtDue().time(); | 2804 | tim = to->dtDue().time(); |
2791 | else { | 2805 | else { |
2792 | tim = QTime ( 0,0,0 ); | 2806 | tim = QTime ( 0,0,0 ); |
2793 | to->setFloats( true ); | 2807 | to->setFloats( true ); |
2794 | to->setHasDueDate( true ); | 2808 | to->setHasDueDate( true ); |
2795 | } | 2809 | } |
2796 | QDateTime dt ( d,tim ); | 2810 | QDateTime dt ( d,tim ); |
2797 | to->setDtDue( dt ); | 2811 | to->setDtDue( dt ); |
2798 | 2812 | ||
2799 | if ( to->hasStartDate() ) { | 2813 | if ( to->hasStartDate() ) { |
2800 | if ( len>0 ) | 2814 | if ( len>0 ) |
2801 | to->setDtStart(to->dtDue().addSecs( -len )); | 2815 | to->setDtStart(to->dtDue().addSecs( -len )); |
2802 | else | 2816 | else |
2803 | if (to->dtStart() > to->dtDue() ) | 2817 | if (to->dtStart() > to->dtDue() ) |
2804 | to->setDtStart(to->dtDue().addDays( -3 )); | 2818 | to->setDtStart(to->dtDue().addDays( -3 )); |
2805 | } | 2819 | } |
2806 | 2820 | ||
2807 | todoChanged( to ); | 2821 | todoChanged( to ); |
2808 | } else { | 2822 | } else { |
2809 | if ( mMoveIncidence->doesRecur() ) { | 2823 | if ( mMoveIncidence->doesRecur() ) { |
2810 | #if 0 | 2824 | #if 0 |
2811 | // PENDING implement this | 2825 | // PENDING implement this |
2812 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2826 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2813 | mCalendar()->addIncidence( newInc ); | 2827 | mCalendar()->addIncidence( newInc ); |
2814 | if ( mMoveIncidence->typeID() == todoID ) | 2828 | if ( mMoveIncidence->typeID() == todoID ) |
2815 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2829 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2816 | else | 2830 | else |
2817 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2831 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2818 | mMoveIncidence = newInc; | 2832 | mMoveIncidence = newInc; |
2819 | 2833 | ||
2820 | #endif | 2834 | #endif |
2821 | } | 2835 | } |
2822 | QTime tim = mMoveIncidence->dtStart().time(); | 2836 | QTime tim = mMoveIncidence->dtStart().time(); |
2823 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2837 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |