-rw-r--r-- | korganizer/calendarview.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index db33017..cca73f2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1971,385 +1971,384 @@ void CalendarView::writeSettings() | |||
1971 | void CalendarView::readFilterSettings(KConfig *config) | 1971 | void CalendarView::readFilterSettings(KConfig *config) |
1972 | { | 1972 | { |
1973 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1973 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1974 | 1974 | ||
1975 | mFilters.clear(); | 1975 | mFilters.clear(); |
1976 | 1976 | ||
1977 | config->setGroup("General"); | 1977 | config->setGroup("General"); |
1978 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1978 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1979 | 1979 | ||
1980 | QStringList::ConstIterator it = filterList.begin(); | 1980 | QStringList::ConstIterator it = filterList.begin(); |
1981 | QStringList::ConstIterator end = filterList.end(); | 1981 | QStringList::ConstIterator end = filterList.end(); |
1982 | while(it != end) { | 1982 | while(it != end) { |
1983 | // kdDebug() << " filter: " << (*it) << endl; | 1983 | // kdDebug() << " filter: " << (*it) << endl; |
1984 | 1984 | ||
1985 | CalFilter *filter; | 1985 | CalFilter *filter; |
1986 | filter = new CalFilter(*it); | 1986 | filter = new CalFilter(*it); |
1987 | config->setGroup("Filter_" + (*it)); | 1987 | config->setGroup("Filter_" + (*it)); |
1988 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1988 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1989 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1989 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1990 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1990 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1991 | mFilters.append(filter); | 1991 | mFilters.append(filter); |
1992 | 1992 | ||
1993 | ++it; | 1993 | ++it; |
1994 | } | 1994 | } |
1995 | 1995 | ||
1996 | if (mFilters.count() == 0) { | 1996 | if (mFilters.count() == 0) { |
1997 | CalFilter *filter = new CalFilter(i18n("Default")); | 1997 | CalFilter *filter = new CalFilter(i18n("Default")); |
1998 | mFilters.append(filter); | 1998 | mFilters.append(filter); |
1999 | } | 1999 | } |
2000 | mFilterView->updateFilters(); | 2000 | mFilterView->updateFilters(); |
2001 | config->setGroup("FilterView"); | 2001 | config->setGroup("FilterView"); |
2002 | 2002 | ||
2003 | mFilterView->blockSignals(true); | 2003 | mFilterView->blockSignals(true); |
2004 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2004 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2005 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2005 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2006 | mFilterView->blockSignals(false); | 2006 | mFilterView->blockSignals(false); |
2007 | // We do it manually to avoid it being done twice by the above calls | 2007 | // We do it manually to avoid it being done twice by the above calls |
2008 | updateFilter(); | 2008 | updateFilter(); |
2009 | } | 2009 | } |
2010 | 2010 | ||
2011 | void CalendarView::writeFilterSettings(KConfig *config) | 2011 | void CalendarView::writeFilterSettings(KConfig *config) |
2012 | { | 2012 | { |
2013 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2013 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2014 | 2014 | ||
2015 | QStringList filterList; | 2015 | QStringList filterList; |
2016 | 2016 | ||
2017 | CalFilter *filter = mFilters.first(); | 2017 | CalFilter *filter = mFilters.first(); |
2018 | while(filter) { | 2018 | while(filter) { |
2019 | // kdDebug() << " fn: " << filter->name() << endl; | 2019 | // kdDebug() << " fn: " << filter->name() << endl; |
2020 | filterList << filter->name(); | 2020 | filterList << filter->name(); |
2021 | config->setGroup("Filter_" + filter->name()); | 2021 | config->setGroup("Filter_" + filter->name()); |
2022 | config->writeEntry("Criteria",filter->criteria()); | 2022 | config->writeEntry("Criteria",filter->criteria()); |
2023 | config->writeEntry("CategoryList",filter->categoryList()); | 2023 | config->writeEntry("CategoryList",filter->categoryList()); |
2024 | filter = mFilters.next(); | 2024 | filter = mFilters.next(); |
2025 | } | 2025 | } |
2026 | config->setGroup("General"); | 2026 | config->setGroup("General"); |
2027 | config->writeEntry("CalendarFilters",filterList); | 2027 | config->writeEntry("CalendarFilters",filterList); |
2028 | 2028 | ||
2029 | config->setGroup("FilterView"); | 2029 | config->setGroup("FilterView"); |
2030 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2030 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2031 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2031 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2032 | } | 2032 | } |
2033 | 2033 | ||
2034 | 2034 | ||
2035 | void CalendarView::goToday() | 2035 | void CalendarView::goToday() |
2036 | { | 2036 | { |
2037 | if ( mViewManager->currentView()->isMonthView() ) | 2037 | if ( mViewManager->currentView()->isMonthView() ) |
2038 | mNavigator->selectTodayMonth(); | 2038 | mNavigator->selectTodayMonth(); |
2039 | else | 2039 | else |
2040 | mNavigator->selectToday(); | 2040 | mNavigator->selectToday(); |
2041 | } | 2041 | } |
2042 | 2042 | ||
2043 | void CalendarView::goNext() | 2043 | void CalendarView::goNext() |
2044 | { | 2044 | { |
2045 | mNavigator->selectNext(); | 2045 | mNavigator->selectNext(); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | void CalendarView::goPrevious() | 2048 | void CalendarView::goPrevious() |
2049 | { | 2049 | { |
2050 | mNavigator->selectPrevious(); | 2050 | mNavigator->selectPrevious(); |
2051 | } | 2051 | } |
2052 | void CalendarView::goNextMonth() | 2052 | void CalendarView::goNextMonth() |
2053 | { | 2053 | { |
2054 | mNavigator->selectNextMonth(); | 2054 | mNavigator->selectNextMonth(); |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | void CalendarView::goPreviousMonth() | 2057 | void CalendarView::goPreviousMonth() |
2058 | { | 2058 | { |
2059 | mNavigator->selectPreviousMonth(); | 2059 | mNavigator->selectPreviousMonth(); |
2060 | } | 2060 | } |
2061 | void CalendarView::writeLocale() | 2061 | void CalendarView::writeLocale() |
2062 | { | 2062 | { |
2063 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2063 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2064 | #if 0 | 2064 | #if 0 |
2065 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2065 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2066 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2066 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2067 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2067 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2068 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2068 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2069 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2069 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2070 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2070 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2071 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2071 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2072 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2072 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2073 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2073 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2074 | KOPrefs::instance()->mDaylightsavingStart, | 2074 | KOPrefs::instance()->mDaylightsavingStart, |
2075 | KOPrefs::instance()->mDaylightsavingEnd ); | 2075 | KOPrefs::instance()->mDaylightsavingEnd ); |
2076 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2076 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2077 | #endif | 2077 | #endif |
2078 | } | 2078 | } |
2079 | void CalendarView::updateConfig() | 2079 | void CalendarView::updateConfig() |
2080 | { | 2080 | { |
2081 | writeLocale(); | 2081 | writeLocale(); |
2082 | if ( KOPrefs::instance()->mUseAppColors ) | 2082 | if ( KOPrefs::instance()->mUseAppColors ) |
2083 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2083 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2084 | emit configChanged(); | 2084 | emit configChanged(); |
2085 | mTodoList->updateConfig(); | 2085 | mTodoList->updateConfig(); |
2086 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2086 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2087 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2087 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2088 | // To make the "fill window" configurations work | 2088 | // To make the "fill window" configurations work |
2089 | //mViewManager->raiseCurrentView(); | 2089 | //mViewManager->raiseCurrentView(); |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | 2092 | ||
2093 | void CalendarView::eventChanged(Event *event) | 2093 | void CalendarView::eventChanged(Event *event) |
2094 | { | 2094 | { |
2095 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2095 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2096 | //updateUnmanagedViews(); | 2096 | //updateUnmanagedViews(); |
2097 | } | 2097 | } |
2098 | 2098 | ||
2099 | void CalendarView::eventAdded(Event *event) | 2099 | void CalendarView::eventAdded(Event *event) |
2100 | { | 2100 | { |
2101 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2101 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | void CalendarView::eventToBeDeleted(Event *) | 2104 | void CalendarView::eventToBeDeleted(Event *) |
2105 | { | 2105 | { |
2106 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2106 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2107 | } | 2107 | } |
2108 | 2108 | ||
2109 | void CalendarView::eventDeleted() | 2109 | void CalendarView::eventDeleted() |
2110 | { | 2110 | { |
2111 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2111 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2112 | } | 2112 | } |
2113 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2113 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2114 | { | 2114 | { |
2115 | changeIncidenceDisplay((Incidence *)which, action); | 2115 | changeIncidenceDisplay((Incidence *)which, action); |
2116 | mDateNavigator->updateView(); //LR | 2116 | mDateNavigator->updateView(); //LR |
2117 | //mDialogManager->updateSearchDialog(); | 2117 | //mDialogManager->updateSearchDialog(); |
2118 | 2118 | ||
2119 | if (which) { | 2119 | if (which) { |
2120 | mViewManager->updateWNview(); | 2120 | mViewManager->updateWNview(); |
2121 | //mTodoList->updateView(); | 2121 | //mTodoList->updateView(); |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | } | 2124 | } |
2125 | 2125 | ||
2126 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2126 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2127 | { | 2127 | { |
2128 | updateUnmanagedViews(); | 2128 | updateUnmanagedViews(); |
2129 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2129 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2130 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2130 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2131 | mCalendar->checkAlarmForIncidence( 0, true ); | 2131 | mCalendar->checkAlarmForIncidence( 0, true ); |
2132 | if ( mEventViewerDialog ) | 2132 | if ( mEventViewerDialog ) |
2133 | mEventViewerDialog->hide(); | 2133 | mEventViewerDialog->hide(); |
2134 | } | 2134 | } |
2135 | else | 2135 | else |
2136 | mCalendar->checkAlarmForIncidence( which , false ); | 2136 | mCalendar->checkAlarmForIncidence( which , false ); |
2137 | } | 2137 | } |
2138 | 2138 | ||
2139 | // most of the changeEventDisplays() right now just call the view's | 2139 | // most of the changeEventDisplays() right now just call the view's |
2140 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2140 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2141 | void CalendarView::changeEventDisplay(Event *which, int action) | 2141 | void CalendarView::changeEventDisplay(Event *which, int action) |
2142 | { | 2142 | { |
2143 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2143 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2144 | changeIncidenceDisplay((Incidence *)which, action); | 2144 | changeIncidenceDisplay((Incidence *)which, action); |
2145 | mDateNavigator->updateView(); | 2145 | mDateNavigator->updateView(); |
2146 | //mDialogManager->updateSearchDialog(); | 2146 | //mDialogManager->updateSearchDialog(); |
2147 | 2147 | ||
2148 | if (which) { | 2148 | if (which) { |
2149 | // If there is an event view visible update the display | 2149 | // If there is an event view visible update the display |
2150 | mViewManager->currentView()->changeEventDisplay(which,action); | 2150 | mViewManager->currentView()->changeEventDisplay(which,action); |
2151 | // TODO: check, if update needed | 2151 | // TODO: check, if update needed |
2152 | // if (which->getTodoStatus()) { | 2152 | // if (which->getTodoStatus()) { |
2153 | mTodoList->updateView(); | 2153 | mTodoList->updateView(); |
2154 | // } | 2154 | // } |
2155 | } else { | 2155 | } else { |
2156 | mViewManager->currentView()->updateView(); | 2156 | mViewManager->currentView()->updateView(); |
2157 | } | 2157 | } |
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | 2160 | ||
2161 | void CalendarView::updateTodoViews() | 2161 | void CalendarView::updateTodoViews() |
2162 | { | 2162 | { |
2163 | |||
2164 | mTodoList->updateView(); | 2163 | mTodoList->updateView(); |
2165 | mViewManager->currentView()->updateView(); | 2164 | mViewManager->currentView()->updateView(); |
2166 | 2165 | ||
2167 | } | 2166 | } |
2168 | 2167 | ||
2169 | 2168 | ||
2170 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2169 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2171 | { | 2170 | { |
2172 | mTodoList->updateView(); | 2171 | mTodoList->updateView(); |
2173 | mViewManager->updateView(start, end); | 2172 | mViewManager->updateView(start, end); |
2174 | //mDateNavigator->updateView(); | 2173 | //mDateNavigator->updateView(); |
2175 | } | 2174 | } |
2176 | 2175 | ||
2177 | void CalendarView::updateView() | 2176 | void CalendarView::updateView() |
2178 | { | 2177 | { |
2179 | DateList tmpList = mNavigator->selectedDates(); | 2178 | DateList tmpList = mNavigator->selectedDates(); |
2180 | 2179 | ||
2181 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2180 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2182 | mTodoList->updateView(); | 2181 | mTodoList->updateView(); |
2183 | // We assume that the navigator only selects consecutive days. | 2182 | // We assume that the navigator only selects consecutive days. |
2184 | updateView( tmpList.first(), tmpList.last() ); | 2183 | updateView( tmpList.first(), tmpList.last() ); |
2185 | } | 2184 | } |
2186 | 2185 | ||
2187 | void CalendarView::updateUnmanagedViews() | 2186 | void CalendarView::updateUnmanagedViews() |
2188 | { | 2187 | { |
2189 | mDateNavigator->updateDayMatrix(); | 2188 | mDateNavigator->updateDayMatrix(); |
2190 | } | 2189 | } |
2191 | 2190 | ||
2192 | int CalendarView::msgItemDelete(const QString name) | 2191 | int CalendarView::msgItemDelete(const QString name) |
2193 | { | 2192 | { |
2194 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2193 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2195 | i18n("This item will be\npermanently deleted."), | 2194 | i18n("This item will be\npermanently deleted."), |
2196 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2195 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2197 | } | 2196 | } |
2198 | 2197 | ||
2199 | 2198 | ||
2200 | void CalendarView::edit_cut() | 2199 | void CalendarView::edit_cut() |
2201 | { | 2200 | { |
2202 | Event *anEvent=0; | 2201 | Event *anEvent=0; |
2203 | 2202 | ||
2204 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2203 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2205 | 2204 | ||
2206 | if (mViewManager->currentView()->isEventView()) { | 2205 | if (mViewManager->currentView()->isEventView()) { |
2207 | if ( incidence && incidence->type() == "Event" ) { | 2206 | if ( incidence && incidence->type() == "Event" ) { |
2208 | anEvent = static_cast<Event *>(incidence); | 2207 | anEvent = static_cast<Event *>(incidence); |
2209 | } | 2208 | } |
2210 | } | 2209 | } |
2211 | 2210 | ||
2212 | if (!anEvent) { | 2211 | if (!anEvent) { |
2213 | KNotifyClient::beep(); | 2212 | KNotifyClient::beep(); |
2214 | return; | 2213 | return; |
2215 | } | 2214 | } |
2216 | DndFactory factory( mCalendar ); | 2215 | DndFactory factory( mCalendar ); |
2217 | factory.cutIncidence(anEvent); | 2216 | factory.cutIncidence(anEvent); |
2218 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2217 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2219 | } | 2218 | } |
2220 | 2219 | ||
2221 | void CalendarView::edit_copy() | 2220 | void CalendarView::edit_copy() |
2222 | { | 2221 | { |
2223 | Event *anEvent=0; | 2222 | Event *anEvent=0; |
2224 | 2223 | ||
2225 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2224 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2226 | 2225 | ||
2227 | if (mViewManager->currentView()->isEventView()) { | 2226 | if (mViewManager->currentView()->isEventView()) { |
2228 | if ( incidence && incidence->type() == "Event" ) { | 2227 | if ( incidence && incidence->type() == "Event" ) { |
2229 | anEvent = static_cast<Event *>(incidence); | 2228 | anEvent = static_cast<Event *>(incidence); |
2230 | } | 2229 | } |
2231 | } | 2230 | } |
2232 | 2231 | ||
2233 | if (!anEvent) { | 2232 | if (!anEvent) { |
2234 | KNotifyClient::beep(); | 2233 | KNotifyClient::beep(); |
2235 | return; | 2234 | return; |
2236 | } | 2235 | } |
2237 | DndFactory factory( mCalendar ); | 2236 | DndFactory factory( mCalendar ); |
2238 | factory.copyIncidence(anEvent); | 2237 | factory.copyIncidence(anEvent); |
2239 | } | 2238 | } |
2240 | 2239 | ||
2241 | void CalendarView::edit_paste() | 2240 | void CalendarView::edit_paste() |
2242 | { | 2241 | { |
2243 | QDate date = mNavigator->selectedDates().first(); | 2242 | QDate date = mNavigator->selectedDates().first(); |
2244 | 2243 | ||
2245 | DndFactory factory( mCalendar ); | 2244 | DndFactory factory( mCalendar ); |
2246 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2245 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2247 | 2246 | ||
2248 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2247 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2249 | } | 2248 | } |
2250 | 2249 | ||
2251 | void CalendarView::edit_options() | 2250 | void CalendarView::edit_options() |
2252 | { | 2251 | { |
2253 | mDialogManager->showOptionsDialog(); | 2252 | mDialogManager->showOptionsDialog(); |
2254 | //writeSettings(); | 2253 | //writeSettings(); |
2255 | } | 2254 | } |
2256 | 2255 | ||
2257 | 2256 | ||
2258 | void CalendarView::slotSelectPickerDate( QDate d) | 2257 | void CalendarView::slotSelectPickerDate( QDate d) |
2259 | { | 2258 | { |
2260 | mDateFrame->hide(); | 2259 | mDateFrame->hide(); |
2261 | if ( mDatePickerMode == 1 ) { | 2260 | if ( mDatePickerMode == 1 ) { |
2262 | mNavigator->slotDaySelect( d ); | 2261 | mNavigator->slotDaySelect( d ); |
2263 | } else if ( mDatePickerMode == 2 ) { | 2262 | } else if ( mDatePickerMode == 2 ) { |
2264 | if ( mMoveIncidence->type() == "Todo" ) { | 2263 | if ( mMoveIncidence->type() == "Todo" ) { |
2265 | Todo * to = (Todo *) mMoveIncidence; | 2264 | Todo * to = (Todo *) mMoveIncidence; |
2266 | QTime tim; | 2265 | QTime tim; |
2267 | if ( to->hasDueDate() ) | 2266 | if ( to->hasDueDate() ) |
2268 | tim = to->dtDue().time(); | 2267 | tim = to->dtDue().time(); |
2269 | else { | 2268 | else { |
2270 | tim = QTime ( 0,0,0 ); | 2269 | tim = QTime ( 0,0,0 ); |
2271 | to->setFloats( true ); | 2270 | to->setFloats( true ); |
2272 | to->setHasDueDate( true ); | 2271 | to->setHasDueDate( true ); |
2273 | } | 2272 | } |
2274 | QDateTime dt ( d,tim ); | 2273 | QDateTime dt ( d,tim ); |
2275 | to->setDtDue( dt ); | 2274 | to->setDtDue( dt ); |
2276 | todoChanged( to ); | 2275 | todoChanged( to ); |
2277 | } else { | 2276 | } else { |
2278 | if ( mMoveIncidence->doesRecur() ) { | 2277 | if ( mMoveIncidence->doesRecur() ) { |
2279 | #if 0 | 2278 | #if 0 |
2280 | // PENDING implement this | 2279 | // PENDING implement this |
2281 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2280 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2282 | mCalendar()->addIncidence( newInc ); | 2281 | mCalendar()->addIncidence( newInc ); |
2283 | if ( mMoveIncidence->type() == "Todo" ) | 2282 | if ( mMoveIncidence->type() == "Todo" ) |
2284 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2283 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2285 | else | 2284 | else |
2286 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2285 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2287 | mMoveIncidence = newInc; | 2286 | mMoveIncidence = newInc; |
2288 | 2287 | ||
2289 | #endif | 2288 | #endif |
2290 | } | 2289 | } |
2291 | QTime tim = mMoveIncidence->dtStart().time(); | 2290 | QTime tim = mMoveIncidence->dtStart().time(); |
2292 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2291 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2293 | QDateTime dt ( d,tim ); | 2292 | QDateTime dt ( d,tim ); |
2294 | mMoveIncidence->setDtStart( dt ); | 2293 | mMoveIncidence->setDtStart( dt ); |
2295 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2294 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2296 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2295 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2297 | } | 2296 | } |
2298 | 2297 | ||
2299 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2298 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2300 | } | 2299 | } |
2301 | } | 2300 | } |
2302 | 2301 | ||
2303 | void CalendarView::removeCategories() | 2302 | void CalendarView::removeCategories() |
2304 | { | 2303 | { |
2305 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2304 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2306 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2305 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2307 | QStringList catIncList; | 2306 | QStringList catIncList; |
2308 | QStringList newCatList; | 2307 | QStringList newCatList; |
2309 | Incidence* inc = incList.first(); | 2308 | Incidence* inc = incList.first(); |
2310 | int i; | 2309 | int i; |
2311 | int count = 0; | 2310 | int count = 0; |
2312 | while ( inc ) { | 2311 | while ( inc ) { |
2313 | newCatList.clear(); | 2312 | newCatList.clear(); |
2314 | catIncList = inc->categories() ; | 2313 | catIncList = inc->categories() ; |
2315 | for( i = 0; i< catIncList.count(); ++i ) { | 2314 | for( i = 0; i< catIncList.count(); ++i ) { |
2316 | if ( catList.contains (catIncList[i])) | 2315 | if ( catList.contains (catIncList[i])) |
2317 | newCatList.append( catIncList[i] ); | 2316 | newCatList.append( catIncList[i] ); |
2318 | } | 2317 | } |
2319 | newCatList.sort(); | 2318 | newCatList.sort(); |
2320 | inc->setCategories( newCatList.join(",") ); | 2319 | inc->setCategories( newCatList.join(",") ); |
2321 | inc = incList.next(); | 2320 | inc = incList.next(); |
2322 | } | 2321 | } |
2323 | } | 2322 | } |
2324 | 2323 | ||
2325 | int CalendarView::addCategories() | 2324 | int CalendarView::addCategories() |
2326 | { | 2325 | { |
2327 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2326 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2328 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2327 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2329 | QStringList catIncList; | 2328 | QStringList catIncList; |
2330 | Incidence* inc = incList.first(); | 2329 | Incidence* inc = incList.first(); |
2331 | int i; | 2330 | int i; |
2332 | int count = 0; | 2331 | int count = 0; |
2333 | while ( inc ) { | 2332 | while ( inc ) { |
2334 | catIncList = inc->categories() ; | 2333 | catIncList = inc->categories() ; |
2335 | for( i = 0; i< catIncList.count(); ++i ) { | 2334 | for( i = 0; i< catIncList.count(); ++i ) { |
2336 | if ( !catList.contains (catIncList[i])) { | 2335 | if ( !catList.contains (catIncList[i])) { |
2337 | catList.append( catIncList[i] ); | 2336 | catList.append( catIncList[i] ); |
2338 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2337 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2339 | ++count; | 2338 | ++count; |
2340 | } | 2339 | } |
2341 | } | 2340 | } |
2342 | inc = incList.next(); | 2341 | inc = incList.next(); |
2343 | } | 2342 | } |
2344 | catList.sort(); | 2343 | catList.sort(); |
2345 | KOPrefs::instance()->mCustomCategories = catList; | 2344 | KOPrefs::instance()->mCustomCategories = catList; |
2346 | return count; | 2345 | return count; |
2347 | } | 2346 | } |
2348 | 2347 | ||
2349 | void CalendarView::manageCategories() | 2348 | void CalendarView::manageCategories() |
2350 | { | 2349 | { |
2351 | KOCatPrefs* cp = new KOCatPrefs(); | 2350 | KOCatPrefs* cp = new KOCatPrefs(); |
2352 | cp->show(); | 2351 | cp->show(); |
2353 | int w =cp->sizeHint().width() ; | 2352 | int w =cp->sizeHint().width() ; |
2354 | int h = cp->sizeHint().height() ; | 2353 | int h = cp->sizeHint().height() ; |
2355 | int dw = QApplication::desktop()->width(); | 2354 | int dw = QApplication::desktop()->width(); |