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