author | zautrix <zautrix> | 2005-07-10 20:17:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-10 20:17:14 (UTC) |
commit | bf95dce0b9143e3c9b9aeb3cdfda24cb5325dd33 (patch) (unidiff) | |
tree | 19849ae249cb104db250d6e60e60de4ffef0acbc | |
parent | f06311e58cb5887fd673eb1c2c48acf7cd987ad9 (diff) | |
download | kdepimpi-bf95dce0b9143e3c9b9aeb3cdfda24cb5325dd33.zip kdepimpi-bf95dce0b9143e3c9b9aeb3cdfda24cb5325dd33.tar.gz kdepimpi-bf95dce0b9143e3c9b9aeb3cdfda24cb5325dd33.tar.bz2 |
fix
-rw-r--r-- | korganizer/calendarview.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 427d71b..9674921 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2587,385 +2587,389 @@ void CalendarView::writeSettings() | |||
2587 | x = wid->geometry().x(); | 2587 | x = wid->geometry().x(); |
2588 | y = wid->geometry().y(); | 2588 | y = wid->geometry().y(); |
2589 | w = wid->width(); | 2589 | w = wid->width(); |
2590 | h = wid->height(); | 2590 | h = wid->height(); |
2591 | list.clear(); | 2591 | list.clear(); |
2592 | list << QString::number( x ); | 2592 | list << QString::number( x ); |
2593 | list << QString::number( y ); | 2593 | list << QString::number( y ); |
2594 | list << QString::number( w ); | 2594 | list << QString::number( w ); |
2595 | list << QString::number( h ); | 2595 | list << QString::number( h ); |
2596 | config->writeEntry("SearchLayout",list ); | 2596 | config->writeEntry("SearchLayout",list ); |
2597 | } | 2597 | } |
2598 | #endif | 2598 | #endif |
2599 | 2599 | ||
2600 | 2600 | ||
2601 | config->sync(); | 2601 | config->sync(); |
2602 | } | 2602 | } |
2603 | 2603 | ||
2604 | void CalendarView::readFilterSettings(KConfig *config) | 2604 | void CalendarView::readFilterSettings(KConfig *config) |
2605 | { | 2605 | { |
2606 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2606 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2607 | 2607 | ||
2608 | mFilters.clear(); | 2608 | mFilters.clear(); |
2609 | 2609 | ||
2610 | config->setGroup("General"); | 2610 | config->setGroup("General"); |
2611 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2611 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2612 | 2612 | ||
2613 | QStringList::ConstIterator it = filterList.begin(); | 2613 | QStringList::ConstIterator it = filterList.begin(); |
2614 | QStringList::ConstIterator end = filterList.end(); | 2614 | QStringList::ConstIterator end = filterList.end(); |
2615 | while(it != end) { | 2615 | while(it != end) { |
2616 | // kdDebug() << " filter: " << (*it) << endl; | 2616 | // kdDebug() << " filter: " << (*it) << endl; |
2617 | 2617 | ||
2618 | CalFilter *filter; | 2618 | CalFilter *filter; |
2619 | filter = new CalFilter(*it); | 2619 | filter = new CalFilter(*it); |
2620 | config->setGroup("Filter_" + (*it).utf8()); | 2620 | config->setGroup("Filter_" + (*it).utf8()); |
2621 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2621 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2622 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2622 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2623 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2623 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2624 | mFilters.append(filter); | 2624 | mFilters.append(filter); |
2625 | 2625 | ||
2626 | ++it; | 2626 | ++it; |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | if (mFilters.count() == 0) { | 2629 | if (mFilters.count() == 0) { |
2630 | CalFilter *filter = new CalFilter(i18n("Default")); | 2630 | CalFilter *filter = new CalFilter(i18n("Default")); |
2631 | mFilters.append(filter); | 2631 | mFilters.append(filter); |
2632 | } | 2632 | } |
2633 | mFilterView->updateFilters(); | 2633 | mFilterView->updateFilters(); |
2634 | config->setGroup("FilterView"); | 2634 | config->setGroup("FilterView"); |
2635 | 2635 | ||
2636 | mFilterView->blockSignals(true); | 2636 | mFilterView->blockSignals(true); |
2637 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2637 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2638 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2638 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2639 | mFilterView->blockSignals(false); | 2639 | mFilterView->blockSignals(false); |
2640 | // We do it manually to avoid it being done twice by the above calls | 2640 | // We do it manually to avoid it being done twice by the above calls |
2641 | updateFilter(); | 2641 | updateFilter(); |
2642 | } | 2642 | } |
2643 | 2643 | ||
2644 | void CalendarView::writeFilterSettings(KConfig *config) | 2644 | void CalendarView::writeFilterSettings(KConfig *config) |
2645 | { | 2645 | { |
2646 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2646 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2647 | 2647 | ||
2648 | QStringList filterList; | 2648 | QStringList filterList; |
2649 | 2649 | ||
2650 | CalFilter *filter = mFilters.first(); | 2650 | CalFilter *filter = mFilters.first(); |
2651 | while(filter) { | 2651 | while(filter) { |
2652 | // kdDebug() << " fn: " << filter->name() << endl; | 2652 | // kdDebug() << " fn: " << filter->name() << endl; |
2653 | filterList << filter->name(); | 2653 | filterList << filter->name(); |
2654 | config->setGroup("Filter_" + filter->name().utf8()); | 2654 | config->setGroup("Filter_" + filter->name().utf8()); |
2655 | config->writeEntry("Criteria",filter->criteria()); | 2655 | config->writeEntry("Criteria",filter->criteria()); |
2656 | config->writeEntry("CategoryList",filter->categoryList()); | 2656 | config->writeEntry("CategoryList",filter->categoryList()); |
2657 | filter = mFilters.next(); | 2657 | filter = mFilters.next(); |
2658 | } | 2658 | } |
2659 | config->setGroup("General"); | 2659 | config->setGroup("General"); |
2660 | config->writeEntry("CalendarFilters",filterList); | 2660 | config->writeEntry("CalendarFilters",filterList); |
2661 | 2661 | ||
2662 | config->setGroup("FilterView"); | 2662 | config->setGroup("FilterView"); |
2663 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2663 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2664 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2664 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2665 | } | 2665 | } |
2666 | 2666 | ||
2667 | 2667 | ||
2668 | void CalendarView::goToday() | 2668 | void CalendarView::goToday() |
2669 | { | 2669 | { |
2670 | if ( mViewManager->currentView()->isMonthView() ) | 2670 | if ( mViewManager->currentView()->isMonthView() ) |
2671 | mNavigator->selectTodayMonth(); | 2671 | mNavigator->selectTodayMonth(); |
2672 | else | 2672 | else |
2673 | mNavigator->selectToday(); | 2673 | mNavigator->selectToday(); |
2674 | } | 2674 | } |
2675 | 2675 | ||
2676 | void CalendarView::goNext() | 2676 | void CalendarView::goNext() |
2677 | { | 2677 | { |
2678 | mNavigator->selectNext(); | 2678 | mNavigator->selectNext(); |
2679 | } | 2679 | } |
2680 | 2680 | ||
2681 | void CalendarView::goPrevious() | 2681 | void CalendarView::goPrevious() |
2682 | { | 2682 | { |
2683 | mNavigator->selectPrevious(); | 2683 | mNavigator->selectPrevious(); |
2684 | } | 2684 | } |
2685 | void CalendarView::goNextMonth() | 2685 | void CalendarView::goNextMonth() |
2686 | { | 2686 | { |
2687 | mNavigator->selectNextMonth(); | 2687 | mNavigator->selectNextMonth(); |
2688 | } | 2688 | } |
2689 | 2689 | ||
2690 | void CalendarView::goPreviousMonth() | 2690 | void CalendarView::goPreviousMonth() |
2691 | { | 2691 | { |
2692 | mNavigator->selectPreviousMonth(); | 2692 | mNavigator->selectPreviousMonth(); |
2693 | } | 2693 | } |
2694 | 2694 | ||
2695 | void CalendarView::updateConfig() | 2695 | void CalendarView::updateConfig() |
2696 | { | 2696 | { |
2697 | if ( KOPrefs::instance()->mUseAppColors ) | 2697 | if ( KOPrefs::instance()->mUseAppColors ) |
2698 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2698 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2699 | emit configChanged(); | 2699 | emit configChanged(); |
2700 | mTodoList->updateConfig(); | 2700 | mTodoList->updateConfig(); |
2701 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2701 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2703 | // To make the "fill window" configurations work | 2703 | // To make the "fill window" configurations work |
2704 | //mViewManager->raiseCurrentView(); | 2704 | //mViewManager->raiseCurrentView(); |
2705 | } | 2705 | } |
2706 | 2706 | ||
2707 | 2707 | ||
2708 | void CalendarView::eventChanged(Event *event) | 2708 | void CalendarView::eventChanged(Event *event) |
2709 | { | 2709 | { |
2710 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2710 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2711 | //updateUnmanagedViews(); | 2711 | //updateUnmanagedViews(); |
2712 | } | 2712 | } |
2713 | 2713 | ||
2714 | void CalendarView::eventAdded(Event *event) | 2714 | void CalendarView::eventAdded(Event *event) |
2715 | { | 2715 | { |
2716 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2716 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2717 | } | 2717 | } |
2718 | 2718 | ||
2719 | void CalendarView::eventToBeDeleted(Event *) | 2719 | void CalendarView::eventToBeDeleted(Event *) |
2720 | { | 2720 | { |
2721 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2721 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | void CalendarView::eventDeleted() | 2724 | void CalendarView::eventDeleted() |
2725 | { | 2725 | { |
2726 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2726 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2727 | } | 2727 | } |
2728 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2728 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2729 | { | 2729 | { |
2730 | changeIncidenceDisplay((Incidence *)which, action); | 2730 | changeIncidenceDisplay((Incidence *)which, action); |
2731 | mDateNavigator->updateView(); //LR | 2731 | mDateNavigator->updateView(); //LR |
2732 | //mDialogManager->updateSearchDialog(); | 2732 | //mDialogManager->updateSearchDialog(); |
2733 | 2733 | ||
2734 | if (which) { | 2734 | if (which) { |
2735 | mViewManager->updateWNview(); | 2735 | mViewManager->updateWNview(); |
2736 | //mTodoList->updateView(); | 2736 | //mTodoList->updateView(); |
2737 | } | 2737 | } |
2738 | 2738 | ||
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2741 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2742 | { | 2742 | { |
2743 | updateUnmanagedViews(); | 2743 | updateUnmanagedViews(); |
2744 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2744 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2745 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2745 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2746 | mCalendar->checkAlarmForIncidence( 0, true ); | 2746 | mCalendar->checkAlarmForIncidence( 0, true ); |
2747 | if ( mEventViewerDialog ) | 2747 | if ( mEventViewerDialog ) |
2748 | mEventViewerDialog->hide(); | 2748 | mEventViewerDialog->hide(); |
2749 | } | 2749 | } |
2750 | else | 2750 | else |
2751 | mCalendar->checkAlarmForIncidence( which , false ); | 2751 | mCalendar->checkAlarmForIncidence( which , false ); |
2752 | } | 2752 | } |
2753 | 2753 | ||
2754 | // most of the changeEventDisplays() right now just call the view's | 2754 | // most of the changeEventDisplays() right now just call the view's |
2755 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2755 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2756 | void CalendarView::changeEventDisplay(Event *which, int action) | 2756 | void CalendarView::changeEventDisplay(Event *which, int action) |
2757 | { | 2757 | { |
2758 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2758 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2759 | changeIncidenceDisplay((Incidence *)which, action); | 2759 | changeIncidenceDisplay((Incidence *)which, action); |
2760 | static bool clearallviews = false; | 2760 | static bool clearallviews = false; |
2761 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2761 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2762 | if ( clearallviews ) { | 2762 | if ( clearallviews ) { |
2763 | clearAllViews(); | 2763 | clearAllViews(); |
2764 | clearallviews = false; | 2764 | clearallviews = false; |
2765 | } | 2765 | } |
2766 | return; | 2766 | return; |
2767 | } | 2767 | } |
2768 | clearallviews = true; | 2768 | clearallviews = true; |
2769 | mDateNavigator->updateView(); | 2769 | mDateNavigator->updateView(); |
2770 | //mDialogManager->updateSearchDialog(); | 2770 | //mDialogManager->updateSearchDialog(); |
2771 | if (which) { | 2771 | if (which) { |
2772 | // If there is an event view visible update the display | 2772 | // If there is an event view visible update the display |
2773 | mViewManager->currentView()->changeEventDisplay(which,action); | 2773 | mViewManager->currentView()->changeEventDisplay(which,action); |
2774 | // TODO: check, if update needed | 2774 | // TODO: check, if update needed |
2775 | // if (which->getTodoStatus()) { | 2775 | // if (which->getTodoStatus()) { |
2776 | mTodoList->updateView(); | 2776 | mTodoList->updateView(); |
2777 | if ( action != KOGlobals::EVENTDELETED ) { | 2777 | if ( action != KOGlobals::EVENTDELETED ) { |
2778 | mConflictingEvent = which ; | 2778 | mConflictingEvent = which ; |
2779 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); | 2779 | int time = 1000; |
2780 | #ifdef DESKTOP_VERSION | ||
2781 | time = 500; | ||
2782 | #endif | ||
2783 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | ||
2780 | } | 2784 | } |
2781 | // } | 2785 | // } |
2782 | } else { | 2786 | } else { |
2783 | mViewManager->currentView()->updateView(); | 2787 | mViewManager->currentView()->updateView(); |
2784 | } | 2788 | } |
2785 | } | 2789 | } |
2786 | void CalendarView::checkConflictForEvent() | 2790 | void CalendarView::checkConflictForEvent() |
2787 | { | 2791 | { |
2788 | 2792 | ||
2789 | if (!KOPrefs::instance()->mConfirm) | 2793 | if (!KOPrefs::instance()->mConfirm) |
2790 | return; | 2794 | return; |
2791 | if ( ! mConflictingEvent ) return; | 2795 | if ( ! mConflictingEvent ) return; |
2792 | QDateTime current = QDateTime::currentDateTime(); | 2796 | QDateTime current = QDateTime::currentDateTime(); |
2793 | if ( ! mConflictingEvent->matchTime( ¤t, 0 ) ) { | 2797 | if ( ! mConflictingEvent->matchTime( ¤t, 0 ) ) { |
2794 | mConflictingEvent = 0; | 2798 | mConflictingEvent = 0; |
2795 | return; | 2799 | return; |
2796 | } | 2800 | } |
2797 | QPtrList<Event> testlist = mCalendar->events(); | 2801 | QPtrList<Event> testlist = mCalendar->events(); |
2798 | Event * test = testlist.first(); | 2802 | Event * test = testlist.first(); |
2799 | QDateTime conflict; | 2803 | QDateTime conflict; |
2800 | QDateTime retVal; | 2804 | QDateTime retVal; |
2801 | bool found = false; | 2805 | bool found = false; |
2802 | Event * cE = 0; | 2806 | Event * cE = 0; |
2803 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 2807 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
2804 | while ( test ) { | 2808 | while ( test ) { |
2805 | qApp->processEvents(); | 2809 | qApp->processEvents(); |
2806 | bool skip = false; | 2810 | bool skip = false; |
2807 | if ( found ) | 2811 | if ( found ) |
2808 | skip = !test->matchTime( ¤t, &conflict ); | 2812 | skip = !test->matchTime( ¤t, &conflict ); |
2809 | else | 2813 | else |
2810 | skip = !test->matchTime( ¤t, 0 ); | 2814 | skip = !test->matchTime( ¤t, 0 ); |
2811 | if ( !skip && !test->doesFloat() ) { | 2815 | if ( !skip && !test->doesFloat() ) { |
2812 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 2816 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2813 | if ( ! found ) { | 2817 | if ( ! found ) { |
2814 | conflict = retVal; | 2818 | conflict = retVal; |
2815 | cE = test; | 2819 | cE = test; |
2816 | } else { | 2820 | } else { |
2817 | if ( retVal < conflict ) { | 2821 | if ( retVal < conflict ) { |
2818 | conflict = retVal; | 2822 | conflict = retVal; |
2819 | cE = test; | 2823 | cE = test; |
2820 | } | 2824 | } |
2821 | } | 2825 | } |
2822 | found = true; | 2826 | found = true; |
2823 | } | 2827 | } |
2824 | } | 2828 | } |
2825 | test = testlist.next(); | 2829 | test = testlist.next(); |
2826 | } | 2830 | } |
2827 | if ( found ) { | 2831 | if ( found ) { |
2828 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2832 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2829 | qApp->processEvents(); | 2833 | qApp->processEvents(); |
2830 | int km = KMessageBox::warningContinueCancel(this,mess, | 2834 | int km = KMessageBox::warningContinueCancel(this,mess, |
2831 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2835 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2832 | if ( km != KMessageBox::Continue ) | 2836 | if ( km != KMessageBox::Continue ) |
2833 | return; | 2837 | return; |
2834 | 2838 | ||
2835 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2839 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2836 | mViewManager->showDayView(); | 2840 | mViewManager->showDayView(); |
2837 | mNavigator->slotDaySelect( conflict.date() ); | 2841 | mNavigator->slotDaySelect( conflict.date() ); |
2838 | int hour = conflict.time().hour(); | 2842 | int hour = conflict.time().hour(); |
2839 | mViewManager->agendaView()->setStartHour( hour ); | 2843 | mViewManager->agendaView()->setStartHour( hour ); |
2840 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2844 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2841 | } else | 2845 | } else |
2842 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 2846 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
2843 | mConflictingEvent = 0; | 2847 | mConflictingEvent = 0; |
2844 | return; | 2848 | return; |
2845 | 2849 | ||
2846 | } | 2850 | } |
2847 | 2851 | ||
2848 | void CalendarView::updateTodoViews() | 2852 | void CalendarView::updateTodoViews() |
2849 | { | 2853 | { |
2850 | mTodoList->updateView(); | 2854 | mTodoList->updateView(); |
2851 | mViewManager->currentView()->updateView(); | 2855 | mViewManager->currentView()->updateView(); |
2852 | 2856 | ||
2853 | } | 2857 | } |
2854 | 2858 | ||
2855 | 2859 | ||
2856 | 2860 | ||
2857 | void CalendarView::clearAllViews() | 2861 | void CalendarView::clearAllViews() |
2858 | { | 2862 | { |
2859 | mTodoList->clearList(); | 2863 | mTodoList->clearList(); |
2860 | mViewManager->clearAllViews(); | 2864 | mViewManager->clearAllViews(); |
2861 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2865 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2862 | if ( sd ) { | 2866 | if ( sd ) { |
2863 | KOListView* kol = sd->listview(); | 2867 | KOListView* kol = sd->listview(); |
2864 | if ( kol ) | 2868 | if ( kol ) |
2865 | kol->clearList(); | 2869 | kol->clearList(); |
2866 | } | 2870 | } |
2867 | } | 2871 | } |
2868 | void CalendarView::updateView() | 2872 | void CalendarView::updateView() |
2869 | { | 2873 | { |
2870 | static bool clearallviews = false; | 2874 | static bool clearallviews = false; |
2871 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2875 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2872 | if ( clearallviews ) { | 2876 | if ( clearallviews ) { |
2873 | clearAllViews(); | 2877 | clearAllViews(); |
2874 | clearallviews = false; | 2878 | clearallviews = false; |
2875 | } | 2879 | } |
2876 | return; | 2880 | return; |
2877 | } | 2881 | } |
2878 | clearallviews = true; | 2882 | clearallviews = true; |
2879 | DateList tmpList = mNavigator->selectedDates(); | 2883 | DateList tmpList = mNavigator->selectedDates(); |
2880 | 2884 | ||
2881 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2885 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2882 | mTodoList->updateView(); | 2886 | mTodoList->updateView(); |
2883 | // We assume that the navigator only selects consecutive days. | 2887 | // We assume that the navigator only selects consecutive days. |
2884 | updateView( tmpList.first(), tmpList.last() ); | 2888 | updateView( tmpList.first(), tmpList.last() ); |
2885 | } | 2889 | } |
2886 | 2890 | ||
2887 | void CalendarView::updateUnmanagedViews() | 2891 | void CalendarView::updateUnmanagedViews() |
2888 | { | 2892 | { |
2889 | mDateNavigator->updateDayMatrix(); | 2893 | mDateNavigator->updateDayMatrix(); |
2890 | } | 2894 | } |
2891 | 2895 | ||
2892 | int CalendarView::msgItemDelete(const QString name) | 2896 | int CalendarView::msgItemDelete(const QString name) |
2893 | { | 2897 | { |
2894 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2898 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2895 | i18n("This item will be\npermanently deleted."), | 2899 | i18n("This item will be\npermanently deleted."), |
2896 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2900 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2897 | } | 2901 | } |
2898 | 2902 | ||
2899 | 2903 | ||
2900 | void CalendarView::edit_cut() | 2904 | void CalendarView::edit_cut() |
2901 | { | 2905 | { |
2902 | Event *anEvent=0; | 2906 | Event *anEvent=0; |
2903 | 2907 | ||
2904 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2908 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2905 | 2909 | ||
2906 | if (mViewManager->currentView()->isEventView()) { | 2910 | if (mViewManager->currentView()->isEventView()) { |
2907 | if ( incidence && incidence->typeID() == eventID ) { | 2911 | if ( incidence && incidence->typeID() == eventID ) { |
2908 | anEvent = static_cast<Event *>(incidence); | 2912 | anEvent = static_cast<Event *>(incidence); |
2909 | } | 2913 | } |
2910 | } | 2914 | } |
2911 | 2915 | ||
2912 | if (!anEvent) { | 2916 | if (!anEvent) { |
2913 | KNotifyClient::beep(); | 2917 | KNotifyClient::beep(); |
2914 | return; | 2918 | return; |
2915 | } | 2919 | } |
2916 | DndFactory factory( mCalendar ); | 2920 | DndFactory factory( mCalendar ); |
2917 | factory.cutIncidence(anEvent); | 2921 | factory.cutIncidence(anEvent); |
2918 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2922 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2919 | } | 2923 | } |
2920 | 2924 | ||
2921 | void CalendarView::edit_copy() | 2925 | void CalendarView::edit_copy() |
2922 | { | 2926 | { |
2923 | Event *anEvent=0; | 2927 | Event *anEvent=0; |
2924 | 2928 | ||
2925 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2929 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2926 | 2930 | ||
2927 | if (mViewManager->currentView()->isEventView()) { | 2931 | if (mViewManager->currentView()->isEventView()) { |
2928 | if ( incidence && incidence->typeID() == eventID ) { | 2932 | if ( incidence && incidence->typeID() == eventID ) { |
2929 | anEvent = static_cast<Event *>(incidence); | 2933 | anEvent = static_cast<Event *>(incidence); |
2930 | } | 2934 | } |
2931 | } | 2935 | } |
2932 | 2936 | ||
2933 | if (!anEvent) { | 2937 | if (!anEvent) { |
2934 | KNotifyClient::beep(); | 2938 | KNotifyClient::beep(); |
2935 | return; | 2939 | return; |
2936 | } | 2940 | } |
2937 | DndFactory factory( mCalendar ); | 2941 | DndFactory factory( mCalendar ); |
2938 | factory.copyIncidence(anEvent); | 2942 | factory.copyIncidence(anEvent); |
2939 | } | 2943 | } |
2940 | 2944 | ||
2941 | void CalendarView::edit_paste() | 2945 | void CalendarView::edit_paste() |
2942 | { | 2946 | { |
2943 | QDate date = mNavigator->selectedDates().first(); | 2947 | QDate date = mNavigator->selectedDates().first(); |
2944 | 2948 | ||
2945 | DndFactory factory( mCalendar ); | 2949 | DndFactory factory( mCalendar ); |
2946 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2950 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2947 | 2951 | ||
2948 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2952 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2949 | } | 2953 | } |
2950 | void CalendarView::edit_global_options() | 2954 | void CalendarView::edit_global_options() |
2951 | { | 2955 | { |
2952 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2956 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2953 | emit save(); | 2957 | emit save(); |
2954 | emit saveStopTimer(); | 2958 | emit saveStopTimer(); |
2955 | mDialogManager->showGlobalOptionsDialog(); | 2959 | mDialogManager->showGlobalOptionsDialog(); |
2956 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2960 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2957 | emit saveStopTimer(); | 2961 | emit saveStopTimer(); |
2958 | 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!"), | 2962 | 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!"), |
2959 | i18n("Timezone settings"),i18n("Reload"))) { | 2963 | i18n("Timezone settings"),i18n("Reload"))) { |
2960 | qDebug("KO: TZ reload cancelled "); | 2964 | qDebug("KO: TZ reload cancelled "); |
2961 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2965 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2962 | return; | 2966 | return; |
2963 | } | 2967 | } |
2964 | qDebug("KO: Timezone change "); | 2968 | qDebug("KO: Timezone change "); |
2965 | loadCalendars(); | 2969 | loadCalendars(); |
2966 | setModified(true); | 2970 | setModified(true); |
2967 | } | 2971 | } |
2968 | else | 2972 | else |
2969 | qDebug("KO: No tz change "); | 2973 | qDebug("KO: No tz change "); |
2970 | } | 2974 | } |
2971 | void CalendarView::edit_options() | 2975 | void CalendarView::edit_options() |