author | zautrix <zautrix> | 2005-01-31 11:47:44 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 11:47:44 (UTC) |
commit | 0ee7cc932ca9c973b086f847a38d29531a815712 (patch) (unidiff) | |
tree | c16662cdcfffb31d517ff700aa6dcd13f2f8c643 | |
parent | 3e0b1c7cd48903b6886e081210cd83b7441b48ac (diff) | |
download | kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.zip kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.gz kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.bz2 |
many fixes
-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 17 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 13 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 |
6 files changed, 28 insertions, 8 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(); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4cefb26..770a42b 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -784,372 +784,373 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
784 | mWeekLabels.insert( i, label ); | 784 | mWeekLabels.insert( i, label ); |
785 | } | 785 | } |
786 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 786 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
787 | int row, col; | 787 | int row, col; |
788 | mCells.resize( mNumCells ); | 788 | mCells.resize( mNumCells ); |
789 | for( row = 0; row < mNumWeeks; ++row ) { | 789 | for( row = 0; row < mNumWeeks; ++row ) { |
790 | for( col = 0; col < mDaysPerWeek; ++col ) { | 790 | for( col = 0; col < mDaysPerWeek; ++col ) { |
791 | MonthViewCell *cell = new MonthViewCell( this ); | 791 | MonthViewCell *cell = new MonthViewCell( this ); |
792 | mCells.insert( row * mDaysPerWeek + col, cell ); | 792 | mCells.insert( row * mDaysPerWeek + col, cell ); |
793 | 793 | ||
794 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 794 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
795 | SLOT( defaultAction( Incidence * ) ) ); | 795 | SLOT( defaultAction( Incidence * ) ) ); |
796 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 796 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
797 | SIGNAL( newEventSignal( QDateTime ) ) ); | 797 | SIGNAL( newEventSignal( QDateTime ) ) ); |
798 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 798 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
799 | SIGNAL( showDaySignal( QDate ) ) ); | 799 | SIGNAL( showDaySignal( QDate ) ) ); |
800 | } | 800 | } |
801 | } | 801 | } |
802 | 802 | ||
803 | mContextMenu = eventPopup(); | 803 | mContextMenu = eventPopup(); |
804 | // updateConfig(); //useless here | 804 | // updateConfig(); //useless here |
805 | 805 | ||
806 | emit incidenceSelected( 0 ); | 806 | emit incidenceSelected( 0 ); |
807 | } | 807 | } |
808 | 808 | ||
809 | KOMonthView::~KOMonthView() | 809 | KOMonthView::~KOMonthView() |
810 | { | 810 | { |
811 | delete mContextMenu; | 811 | delete mContextMenu; |
812 | } | 812 | } |
813 | 813 | ||
814 | int KOMonthView::maxDatesHint() | 814 | int KOMonthView::maxDatesHint() |
815 | { | 815 | { |
816 | return mNumCells; | 816 | return mNumCells; |
817 | } | 817 | } |
818 | 818 | ||
819 | int KOMonthView::currentDateCount() | 819 | int KOMonthView::currentDateCount() |
820 | { | 820 | { |
821 | return mNumCells; | 821 | return mNumCells; |
822 | } | 822 | } |
823 | 823 | ||
824 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 824 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
825 | { | 825 | { |
826 | QPtrList<Incidence> selected; | 826 | QPtrList<Incidence> selected; |
827 | 827 | ||
828 | if ( mSelectedCell ) { | 828 | if ( mSelectedCell ) { |
829 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 829 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
830 | if ( incidence ) selected.append( incidence ); | 830 | if ( incidence ) selected.append( incidence ); |
831 | } | 831 | } |
832 | 832 | ||
833 | return selected; | 833 | return selected; |
834 | } | 834 | } |
835 | 835 | ||
836 | DateList KOMonthView::selectedDates() | 836 | DateList KOMonthView::selectedDates() |
837 | { | 837 | { |
838 | DateList selected; | 838 | DateList selected; |
839 | 839 | ||
840 | if ( mSelectedCell ) { | 840 | if ( mSelectedCell ) { |
841 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 841 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
842 | if ( qd.isValid() ) selected.append( qd ); | 842 | if ( qd.isValid() ) selected.append( qd ); |
843 | } | 843 | } |
844 | 844 | ||
845 | return selected; | 845 | return selected; |
846 | } | 846 | } |
847 | 847 | ||
848 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 848 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
849 | const QDate &td) | 849 | const QDate &td) |
850 | { | 850 | { |
851 | #ifndef KORG_NOPRINTER | 851 | #ifndef KORG_NOPRINTER |
852 | calPrinter->preview(CalPrinter::Month, fd, td); | 852 | calPrinter->preview(CalPrinter::Month, fd, td); |
853 | #endif | 853 | #endif |
854 | } | 854 | } |
855 | 855 | ||
856 | void KOMonthView::updateConfig() | 856 | void KOMonthView::updateConfig() |
857 | { | 857 | { |
858 | 858 | ||
859 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 859 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
860 | 860 | ||
861 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 861 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
862 | mWidthLongDayLabel = 0; | 862 | mWidthLongDayLabel = 0; |
863 | 863 | ||
864 | for (int i = 0; i < 7; i++) { | 864 | for (int i = 0; i < 7; i++) { |
865 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 865 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
866 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 866 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
867 | } | 867 | } |
868 | bool temp = mShowSatSunComp ; | 868 | bool temp = mShowSatSunComp ; |
869 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 869 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
870 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 870 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
871 | computeLayout(); | 871 | computeLayout(); |
872 | updateDayLabels(); | 872 | updateDayLabels(); |
873 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 873 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
874 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 874 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
875 | //resizeEvent( 0 ); | 875 | //resizeEvent( 0 ); |
876 | for (uint i = 0; i < mCells.count(); ++i) { | 876 | for (uint i = 0; i < mCells.count(); ++i) { |
877 | mCells[i]->updateConfig(); | 877 | mCells[i]->updateConfig(); |
878 | } | 878 | } |
879 | #ifdef DESKTOP_VERSION | 879 | #ifdef DESKTOP_VERSION |
880 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 880 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
881 | #endif | 881 | #endif |
882 | } | 882 | } |
883 | 883 | ||
884 | void KOMonthView::updateDayLabels() | 884 | void KOMonthView::updateDayLabels() |
885 | { | 885 | { |
886 | 886 | ||
887 | for (int i = 0; i < 7; i++) { | 887 | for (int i = 0; i < 7; i++) { |
888 | if (mWeekStartsMonday) { | 888 | if (mWeekStartsMonday) { |
889 | bool show = mShortDayLabels; | 889 | bool show = mShortDayLabels; |
890 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 890 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
891 | show = true; | 891 | show = true; |
892 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 892 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
893 | } else { | 893 | } else { |
894 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 894 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
895 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 895 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
896 | 896 | ||
897 | } | 897 | } |
898 | } | 898 | } |
899 | } | 899 | } |
900 | 900 | ||
901 | void KOMonthView::showDates(const QDate &start, const QDate &) | 901 | void KOMonthView::showDates(const QDate &start, const QDate &) |
902 | { | 902 | { |
903 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 903 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
904 | 904 | ||
905 | 905 | ||
906 | mStartDate = start; | 906 | mStartDate = start; |
907 | 907 | ||
908 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 908 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
909 | 909 | ||
910 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 910 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
911 | mStartDate = mStartDate.addDays( -1 ); | 911 | mStartDate = mStartDate.addDays( -1 ); |
912 | } | 912 | } |
913 | 913 | ||
914 | bool primary = false; | 914 | bool primary = false; |
915 | uint i; | 915 | uint i; |
916 | for( i = 0; i < mCells.size(); ++i ) { | 916 | for( i = 0; i < mCells.size(); ++i ) { |
917 | QDate date = mStartDate.addDays( i ); | 917 | QDate date = mStartDate.addDays( i ); |
918 | mCells[i]->setDate( date ); | 918 | mCells[i]->setDate( date ); |
919 | 919 | ||
920 | #ifndef KORG_NOPLUGINS | 920 | #ifndef KORG_NOPLUGINS |
921 | // add holiday, if present | 921 | // add holiday, if present |
922 | QString hstring(KOCore::self()->holiday(date)); | 922 | QString hstring(KOCore::self()->holiday(date)); |
923 | mCells[i]->setHoliday( hstring ); | 923 | mCells[i]->setHoliday( hstring ); |
924 | #endif | 924 | #endif |
925 | 925 | ||
926 | } | 926 | } |
927 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 927 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
928 | for( i = 0; i < 6; ++i ) { | 928 | for( i = 0; i < 6; ++i ) { |
929 | int wno; | 929 | int wno; |
930 | // remember, according to ISO 8601, the first week of the year is the | 930 | // remember, according to ISO 8601, the first week of the year is the |
931 | // first week that contains a thursday. Thus we must subtract off 4, | 931 | // first week that contains a thursday. Thus we must subtract off 4, |
932 | // not just 1. | 932 | // not just 1. |
933 | int dayOfYear = date.dayOfYear(); | 933 | int dayOfYear = date.dayOfYear(); |
934 | if (dayOfYear % 7 != 0) | 934 | if (dayOfYear % 7 != 0) |
935 | wno = dayOfYear / 7 + 1; | 935 | wno = dayOfYear / 7 + 1; |
936 | else | 936 | else |
937 | wno =dayOfYear / 7; | 937 | wno =dayOfYear / 7; |
938 | mWeekLabels[i]->setWeekNum( wno ); | 938 | mWeekLabels[i]->setWeekNum( wno ); |
939 | date = date.addDays( 7 ); | 939 | date = date.addDays( 7 ); |
940 | } | 940 | } |
941 | updateView(); | 941 | updateView(); |
942 | } | 942 | } |
943 | 943 | ||
944 | void KOMonthView::showEvents(QPtrList<Event>) | 944 | void KOMonthView::showEvents(QPtrList<Event>) |
945 | { | 945 | { |
946 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 946 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
947 | } | 947 | } |
948 | 948 | ||
949 | void KOMonthView::changeEventDisplay(Event *, int) | 949 | void KOMonthView::changeEventDisplay(Event *, int) |
950 | { | 950 | { |
951 | // this should be re-written to be much more efficient, but this | 951 | // this should be re-written to be much more efficient, but this |
952 | // quick-and-dirty-hack gets the job done for right now. | 952 | // quick-and-dirty-hack gets the job done for right now. |
953 | updateView(); | 953 | updateView(); |
954 | } | 954 | } |
955 | 955 | ||
956 | void KOMonthView::updateView() | 956 | void KOMonthView::updateView() |
957 | { | 957 | { |
958 | 958 | ||
959 | if ( !updatePossible ) | 959 | if ( !updatePossible ) |
960 | return; | 960 | return; |
961 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 961 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
962 | int i; | 962 | int i; |
963 | for( i = 0; i < mCells.count(); ++i ) { | 963 | for( i = 0; i < mCells.count(); ++i ) { |
964 | mCells[i]->updateCell(); | 964 | mCells[i]->updateCell(); |
965 | } | 965 | } |
966 | 966 | ||
967 | //qDebug("KOMonthView::updateView() "); | 967 | //qDebug("KOMonthView::updateView() "); |
968 | processSelectionChange(); | 968 | processSelectionChange(); |
969 | // qDebug("---------------------------------------------------------------------+ "); | 969 | // qDebug("---------------------------------------------------------------------+ "); |
970 | mCells[0]->setFocus(); | 970 | mCells[0]->setFocus(); |
971 | } | 971 | } |
972 | 972 | ||
973 | void KOMonthView::resizeEvent(QResizeEvent * e) | 973 | void KOMonthView::resizeEvent(QResizeEvent * e) |
974 | { | 974 | { |
975 | computeLayout(); | 975 | computeLayout(); |
976 | mCells[0]->setFocus(); | ||
976 | } | 977 | } |
977 | void KOMonthView::computeLayout() | 978 | void KOMonthView::computeLayout() |
978 | { | 979 | { |
979 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 980 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
980 | // note this only changes the text if the requested size crosses the | 981 | // note this only changes the text if the requested size crosses the |
981 | // threshold between big enough to support the full name and not big | 982 | // threshold between big enough to support the full name and not big |
982 | // enough. | 983 | // enough. |
983 | 984 | ||
984 | int daysToShow = 7; | 985 | int daysToShow = 7; |
985 | bool combinedSatSun = false; | 986 | bool combinedSatSun = false; |
986 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 987 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
987 | daysToShow = 6; | 988 | daysToShow = 6; |
988 | combinedSatSun = true; | 989 | combinedSatSun = true; |
989 | } | 990 | } |
990 | int tWid = topLevelWidget()->size().width(); | 991 | int tWid = topLevelWidget()->size().width(); |
991 | int tHei = topLevelWidget()->size().height(); | 992 | int tHei = topLevelWidget()->size().height(); |
992 | 993 | ||
993 | int wid = size().width();//e | 994 | int wid = size().width();//e |
994 | int hei = size().height()-1; | 995 | int hei = size().height()-1; |
995 | 996 | ||
996 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 997 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
997 | return; | 998 | return; |
998 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 999 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
999 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1000 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1000 | int weeklabelwid = fm.width( "888" ); | 1001 | int weeklabelwid = fm.width( "888" ); |
1001 | wid -= weeklabelwid; | 1002 | wid -= weeklabelwid; |
1002 | 1003 | ||
1003 | int colWid = wid / daysToShow; | 1004 | int colWid = wid / daysToShow; |
1004 | int lastCol = wid - ( colWid*6 ); | 1005 | int lastCol = wid - ( colWid*6 ); |
1005 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1006 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1006 | int cellHei = (hei - dayLabelHei) /6; | 1007 | int cellHei = (hei - dayLabelHei) /6; |
1007 | int colModulo = wid % daysToShow; | 1008 | int colModulo = wid % daysToShow; |
1008 | int rowModulo = (hei- dayLabelHei) % 6; | 1009 | int rowModulo = (hei- dayLabelHei) % 6; |
1009 | //qDebug("rowmod %d ", rowModulo); | 1010 | //qDebug("rowmod %d ", rowModulo); |
1010 | int i; | 1011 | int i; |
1011 | int x,y,w,h; | 1012 | int x,y,w,h; |
1012 | x= 0; | 1013 | x= 0; |
1013 | y= 0; | 1014 | y= 0; |
1014 | w = colWid; | 1015 | w = colWid; |
1015 | h = dayLabelHei ; | 1016 | h = dayLabelHei ; |
1016 | for ( i = 0; i < 7; i++) { | 1017 | for ( i = 0; i < 7; i++) { |
1017 | if ( i == daysToShow-colModulo ) | 1018 | if ( i == daysToShow-colModulo ) |
1018 | ++w; | 1019 | ++w; |
1019 | if ( combinedSatSun ) { | 1020 | if ( combinedSatSun ) { |
1020 | if ( i >= daysToShow-1 ) { | 1021 | if ( i >= daysToShow-1 ) { |
1021 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1022 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1022 | x -= w/2 ; | 1023 | x -= w/2 ; |
1023 | } | 1024 | } |
1024 | else | 1025 | else |
1025 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1026 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1026 | } else | 1027 | } else |
1027 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1028 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1028 | x += w; | 1029 | x += w; |
1029 | } | 1030 | } |
1030 | x= 0; | 1031 | x= 0; |
1031 | y= dayLabelHei; | 1032 | y= dayLabelHei; |
1032 | w = colWid; | 1033 | w = colWid; |
1033 | h = cellHei ; | 1034 | h = cellHei ; |
1034 | for ( i = 0; i < mCells.count(); ++i) { | 1035 | for ( i = 0; i < mCells.count(); ++i) { |
1035 | 1036 | ||
1036 | w = colWid; | 1037 | w = colWid; |
1037 | if ( ((i) % 7) >= 7-colModulo ) { | 1038 | if ( ((i) % 7) >= 7-colModulo ) { |
1038 | ++w; | 1039 | ++w; |
1039 | } | 1040 | } |
1040 | if ( i == (6-rowModulo)*7) | 1041 | if ( i == (6-rowModulo)*7) |
1041 | ++h; | 1042 | ++h; |
1042 | if ( combinedSatSun ) { | 1043 | if ( combinedSatSun ) { |
1043 | if ( (i)%7 >= daysToShow-1 ) { | 1044 | if ( (i)%7 >= daysToShow-1 ) { |
1044 | if ( (i)%7 == daysToShow-1 ) { | 1045 | if ( (i)%7 == daysToShow-1 ) { |
1045 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1046 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1046 | x -= w ;y += h/2; | 1047 | x -= w ;y += h/2; |
1047 | } else { | 1048 | } else { |
1048 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1049 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1049 | y -= h/2; | 1050 | y -= h/2; |
1050 | } | 1051 | } |
1051 | } else | 1052 | } else |
1052 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1053 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1053 | 1054 | ||
1054 | } | 1055 | } |
1055 | else | 1056 | else |
1056 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1057 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1057 | x += w; | 1058 | x += w; |
1058 | if ( x + w/2 > wid ) { | 1059 | if ( x + w/2 > wid ) { |
1059 | x = 0; | 1060 | x = 0; |
1060 | y += h; | 1061 | y += h; |
1061 | } | 1062 | } |
1062 | } | 1063 | } |
1063 | y= dayLabelHei; | 1064 | y= dayLabelHei; |
1064 | h = cellHei ; | 1065 | h = cellHei ; |
1065 | for ( i = 0; i < 6; i++) { | 1066 | for ( i = 0; i < 6; i++) { |
1066 | if ( i == (6-rowModulo)) | 1067 | if ( i == (6-rowModulo)) |
1067 | ++h; | 1068 | ++h; |
1068 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1069 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1069 | y += h; | 1070 | y += h; |
1070 | } | 1071 | } |
1071 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1072 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1072 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1073 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1073 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1074 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1074 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1075 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1075 | updateDayLabels(); | 1076 | updateDayLabels(); |
1076 | bool forceUpdate = !updatePossible; | 1077 | bool forceUpdate = !updatePossible; |
1077 | updatePossible = true; | 1078 | updatePossible = true; |
1078 | if ( forceUpdate ) | 1079 | if ( forceUpdate ) |
1079 | updateView(); | 1080 | updateView(); |
1080 | } | 1081 | } |
1081 | 1082 | ||
1082 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1083 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1083 | { | 1084 | { |
1084 | mContextMenu->showIncidencePopup(incidence); | 1085 | mContextMenu->showIncidencePopup(incidence); |
1085 | /* | 1086 | /* |
1086 | if( incidence && incidence->type() == "Event" ) { | 1087 | if( incidence && incidence->type() == "Event" ) { |
1087 | Event *event = static_cast<Event *>(incidence); | 1088 | Event *event = static_cast<Event *>(incidence); |
1088 | mContextMenu->showEventPopup(event); | 1089 | mContextMenu->showEventPopup(event); |
1089 | } else { | 1090 | } else { |
1090 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1091 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1091 | } | 1092 | } |
1092 | */ | 1093 | */ |
1093 | } | 1094 | } |
1094 | MonthViewCell * KOMonthView::selectedCell( ) | 1095 | MonthViewCell * KOMonthView::selectedCell( ) |
1095 | { | 1096 | { |
1096 | return mSelectedCell; | 1097 | return mSelectedCell; |
1097 | } | 1098 | } |
1098 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1099 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1099 | { | 1100 | { |
1100 | // qDebug("KOMonthView::setSelectedCell "); | 1101 | // qDebug("KOMonthView::setSelectedCell "); |
1101 | if ( mSelectedCell && mSelectedCell != cell ) { | 1102 | if ( mSelectedCell && mSelectedCell != cell ) { |
1102 | MonthViewCell * mvc = mSelectedCell; | 1103 | MonthViewCell * mvc = mSelectedCell; |
1103 | mSelectedCell = cell; | 1104 | mSelectedCell = cell; |
1104 | mvc->deselect(); | 1105 | mvc->deselect(); |
1105 | } else | 1106 | } else |
1106 | mSelectedCell = cell; | 1107 | mSelectedCell = cell; |
1107 | // if ( mSelectedCell ) | 1108 | // if ( mSelectedCell ) |
1108 | // mSelectedCell->select(); | 1109 | // mSelectedCell->select(); |
1109 | if ( !mSelectedCell ) | 1110 | if ( !mSelectedCell ) |
1110 | emit incidenceSelected( 0 ); | 1111 | emit incidenceSelected( 0 ); |
1111 | else | 1112 | else |
1112 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1113 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | void KOMonthView::processSelectionChange() | 1116 | void KOMonthView::processSelectionChange() |
1116 | { | 1117 | { |
1117 | QPtrList<Incidence> incidences = selectedIncidences(); | 1118 | QPtrList<Incidence> incidences = selectedIncidences(); |
1118 | if (incidences.count() > 0) { | 1119 | if (incidences.count() > 0) { |
1119 | emit incidenceSelected( incidences.first() ); | 1120 | emit incidenceSelected( incidences.first() ); |
1120 | } else { | 1121 | } else { |
1121 | emit incidenceSelected( 0 ); | 1122 | emit incidenceSelected( 0 ); |
1122 | } | 1123 | } |
1123 | } | 1124 | } |
1124 | 1125 | ||
1125 | void KOMonthView::clearSelection() | 1126 | void KOMonthView::clearSelection() |
1126 | { | 1127 | { |
1127 | if ( mSelectedCell ) { | 1128 | if ( mSelectedCell ) { |
1128 | mSelectedCell->deselect(); | 1129 | mSelectedCell->deselect(); |
1129 | mSelectedCell = 0; | 1130 | mSelectedCell = 0; |
1130 | } | 1131 | } |
1131 | } | 1132 | } |
1132 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1133 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1133 | { | 1134 | { |
1134 | //qDebug("KOMonthView::keyPressEvent "); | 1135 | //qDebug("KOMonthView::keyPressEvent "); |
1135 | switch(e->key()) { | 1136 | switch(e->key()) { |
1136 | case Key_Up: | 1137 | case Key_Up: |
1137 | { | 1138 | { |
1138 | emit prevMonth(); | 1139 | emit prevMonth(); |
1139 | mCells[0]->setFocus(); | 1140 | mCells[0]->setFocus(); |
1140 | } | 1141 | } |
1141 | e->accept(); | 1142 | e->accept(); |
1142 | break; | 1143 | break; |
1143 | case Key_Down: | 1144 | case Key_Down: |
1144 | { | 1145 | { |
1145 | emit nextMonth(); | 1146 | emit nextMonth(); |
1146 | mCells[0]->setFocus(); | 1147 | mCells[0]->setFocus(); |
1147 | 1148 | ||
1148 | } | 1149 | } |
1149 | e->accept(); | 1150 | e->accept(); |
1150 | break; | 1151 | break; |
1151 | default: | 1152 | default: |
1152 | e->ignore(); | 1153 | e->ignore(); |
1153 | break; | 1154 | break; |
1154 | } | 1155 | } |
1155 | } | 1156 | } |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 8d8fc2a..82437d8 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -145,591 +145,604 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) | |||
145 | KMessageBox::sorry(this, | 145 | KMessageBox::sorry(this, |
146 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 146 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
147 | i18n("Drop To-Do")); | 147 | i18n("Drop To-Do")); |
148 | delete todo; | 148 | delete todo; |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | to = to->relatedTo(); | 151 | to = to->relatedTo(); |
152 | } | 152 | } |
153 | internalDrop = true; | 153 | internalDrop = true; |
154 | if ( destinationEvent ) | 154 | if ( destinationEvent ) |
155 | reparentTodoSignal( destinationEvent, existingTodo ); | 155 | reparentTodoSignal( destinationEvent, existingTodo ); |
156 | else | 156 | else |
157 | unparentTodoSignal(existingTodo); | 157 | unparentTodoSignal(existingTodo); |
158 | delete todo; | 158 | delete todo; |
159 | } else { | 159 | } else { |
160 | mCalendar->addTodo(todo); | 160 | mCalendar->addTodo(todo); |
161 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 161 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
162 | if ( destinationEvent ) | 162 | if ( destinationEvent ) |
163 | reparentTodoSignal( destinationEvent, todo ); | 163 | reparentTodoSignal( destinationEvent, todo ); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | else { | 166 | else { |
167 | QString text; | 167 | QString text; |
168 | if (QTextDrag::decode(e,text)) { | 168 | if (QTextDrag::decode(e,text)) { |
169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
171 | qDebug("Dropped : " + text); | 171 | qDebug("Dropped : " + text); |
172 | QStringList emails = QStringList::split(",",text); | 172 | QStringList emails = QStringList::split(",",text); |
173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
174 | int pos = (*it).find("<"); | 174 | int pos = (*it).find("<"); |
175 | QString name = (*it).left(pos); | 175 | QString name = (*it).left(pos); |
176 | QString email = (*it).mid(pos); | 176 | QString email = (*it).mid(pos); |
177 | if (!email.isEmpty() && todoi) { | 177 | if (!email.isEmpty() && todoi) { |
178 | todoi->todo()->addAttendee(new Attendee(name,email)); | 178 | todoi->todo()->addAttendee(new Attendee(name,email)); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | } | 181 | } |
182 | else { | 182 | else { |
183 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 183 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
184 | e->ignore(); | 184 | e->ignore(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | } | 188 | } |
189 | 189 | ||
190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
191 | { | 191 | { |
192 | #ifndef KORG_NODND | 192 | #ifndef KORG_NODND |
193 | QPoint p(contentsToViewport(e->pos())); | 193 | QPoint p(contentsToViewport(e->pos())); |
194 | QListViewItem *i = itemAt(p); | 194 | QListViewItem *i = itemAt(p); |
195 | mMousePressed = false; | 195 | mMousePressed = false; |
196 | if (i) { | 196 | if (i) { |
197 | // if the user clicked into the root decoration of the item, don't | 197 | // if the user clicked into the root decoration of the item, don't |
198 | // try to start a drag! | 198 | // try to start a drag! |
199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | 199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + |
200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
201 | itemMargin() || | 201 | itemMargin() || |
202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | 202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { |
203 | if (e->button()==Qt::LeftButton) { | 203 | if (e->button()==Qt::LeftButton) { |
204 | mPressPos = e->pos(); | 204 | mPressPos = e->pos(); |
205 | mMousePressed = true; | 205 | mMousePressed = true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | #endif | 209 | #endif |
210 | QListView::contentsMousePressEvent(e); | 210 | QListView::contentsMousePressEvent(e); |
211 | } | 211 | } |
212 | 212 | ||
213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
214 | { | 214 | { |
215 | 215 | ||
216 | #ifndef KORG_NODND | 216 | #ifndef KORG_NODND |
217 | QListView::contentsMouseMoveEvent(e); | 217 | QListView::contentsMouseMoveEvent(e); |
218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
219 | QApplication::startDragDistance()) { | 219 | QApplication::startDragDistance()) { |
220 | mMousePressed = false; | 220 | mMousePressed = false; |
221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
222 | if (item) { | 222 | if (item) { |
223 | DndFactory factory( mCalendar ); | 223 | DndFactory factory( mCalendar ); |
224 | ICalDrag *vd = factory.createDrag( | 224 | ICalDrag *vd = factory.createDrag( |
225 | ((KOTodoViewItem *)item)->todo(),viewport()); | 225 | ((KOTodoViewItem *)item)->todo(),viewport()); |
226 | internalDrop = false; | 226 | internalDrop = false; |
227 | // we cannot do any senseful here, because the DnD is still broken in Qt | 227 | // we cannot do any senseful here, because the DnD is still broken in Qt |
228 | if (vd->drag()) { | 228 | if (vd->drag()) { |
229 | if ( !internalDrop ) { | 229 | if ( !internalDrop ) { |
230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
231 | qDebug("Dnd: External move: Delete drag source "); | 231 | qDebug("Dnd: External move: Delete drag source "); |
232 | } else | 232 | } else |
233 | qDebug("Dnd: Internal move "); | 233 | qDebug("Dnd: Internal move "); |
234 | 234 | ||
235 | } else { | 235 | } else { |
236 | if ( !internalDrop ) { | 236 | if ( !internalDrop ) { |
237 | qDebug("Dnd: External Copy"); | 237 | qDebug("Dnd: External Copy"); |
238 | } else | 238 | } else |
239 | qDebug("DnD: Internal copy: Copy pending"); | 239 | qDebug("DnD: Internal copy: Copy pending"); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | #endif | 243 | #endif |
244 | } | 244 | } |
245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
246 | { | 246 | { |
247 | 247 | ||
248 | QListViewItem* cn; | 248 | QListViewItem* cn; |
249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
250 | cn = currentItem(); | 250 | cn = currentItem(); |
251 | if ( cn ) { | 251 | if ( cn ) { |
252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
253 | if ( ci ){ | 253 | if ( ci ){ |
254 | if ( e->state() == ShiftButton ) | 254 | if ( e->state() == ShiftButton ) |
255 | ci->setOn( false ); | 255 | ci->setOn( false ); |
256 | else | 256 | else |
257 | ci->setOn( true ); | 257 | ci->setOn( true ); |
258 | cn = cn->itemBelow(); | 258 | cn = cn->itemBelow(); |
259 | if ( cn ) { | 259 | if ( cn ) { |
260 | setCurrentItem ( cn ); | 260 | setCurrentItem ( cn ); |
261 | ensureItemVisible ( cn ); | 261 | ensureItemVisible ( cn ); |
262 | } | 262 | } |
263 | 263 | ||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | 269 | ||
270 | // qDebug("KOTodoListView::keyPressEvent "); | 270 | // qDebug("KOTodoListView::keyPressEvent "); |
271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
272 | switch ( e->key() ) { | 272 | switch ( e->key() ) { |
273 | case Qt::Key_Down: | 273 | case Qt::Key_Down: |
274 | case Qt::Key_Up: | 274 | case Qt::Key_Up: |
275 | QListView::keyPressEvent ( e ); | 275 | QListView::keyPressEvent ( e ); |
276 | break; | 276 | break; |
277 | case Qt::Key_Left: | 277 | case Qt::Key_Left: |
278 | case Qt::Key_Right: | 278 | case Qt::Key_Right: |
279 | QListView::keyPressEvent ( e ); | 279 | QListView::keyPressEvent ( e ); |
280 | e->accept(); | 280 | e->accept(); |
281 | return; | 281 | return; |
282 | break; | 282 | break; |
283 | default: | 283 | default: |
284 | e->ignore(); | 284 | e->ignore(); |
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | e->ignore(); | 289 | e->ignore(); |
290 | } | 290 | } |
291 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 291 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
292 | { | 292 | { |
293 | QListView::contentsMouseReleaseEvent(e); | 293 | QListView::contentsMouseReleaseEvent(e); |
294 | mMousePressed = false; | 294 | mMousePressed = false; |
295 | } | 295 | } |
296 | 296 | ||
297 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 297 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
298 | { | 298 | { |
299 | if (!e) return; | 299 | if (!e) return; |
300 | 300 | ||
301 | QPoint vp = contentsToViewport(e->pos()); | 301 | QPoint vp = contentsToViewport(e->pos()); |
302 | 302 | ||
303 | QListViewItem *item = itemAt(vp); | 303 | QListViewItem *item = itemAt(vp); |
304 | 304 | ||
305 | emit double_Clicked(item); | 305 | emit double_Clicked(item); |
306 | if (!item) return; | 306 | if (!item) return; |
307 | 307 | ||
308 | emit doubleClicked(item,vp,0); | 308 | emit doubleClicked(item,vp,0); |
309 | } | 309 | } |
310 | 310 | ||
311 | ///////////////////////////////////////////////////////////////////////////// | 311 | ///////////////////////////////////////////////////////////////////////////// |
312 | 312 | ||
313 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 313 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
314 | QLineEdit(parent) | 314 | QLineEdit(parent) |
315 | { | 315 | { |
316 | setText(i18n("Click to add a new Todo")); | 316 | setText(i18n("Click to add a new Todo")); |
317 | } | 317 | } |
318 | 318 | ||
319 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 319 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
320 | { | 320 | { |
321 | if ( text()==i18n("Click to add a new Todo") ) | 321 | if ( text()==i18n("Click to add a new Todo") ) |
322 | setText(""); | 322 | setText(""); |
323 | QLineEdit::focusInEvent(ev); | 323 | QLineEdit::focusInEvent(ev); |
324 | } | 324 | } |
325 | 325 | ||
326 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 326 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
327 | { | 327 | { |
328 | setText(i18n("Click to add a new Todo")); | 328 | setText(i18n("Click to add a new Todo")); |
329 | QLineEdit::focusOutEvent(ev); | 329 | QLineEdit::focusOutEvent(ev); |
330 | } | 330 | } |
331 | 331 | ||
332 | ///////////////////////////////////////////////////////////////////////////// | 332 | ///////////////////////////////////////////////////////////////////////////// |
333 | 333 | ||
334 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 334 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
335 | KOrg::BaseView(calendar,parent,name) | 335 | KOrg::BaseView(calendar,parent,name) |
336 | { | 336 | { |
337 | mPendingUpdateBeforeRepaint = false; | ||
337 | isFlatDisplay = false; | 338 | isFlatDisplay = false; |
338 | mNavigator = 0; | 339 | mNavigator = 0; |
339 | QBoxLayout *topLayout = new QVBoxLayout(this); | 340 | QBoxLayout *topLayout = new QVBoxLayout(this); |
340 | mName = QString ( name ); | 341 | mName = QString ( name ); |
341 | mBlockUpdate = false; | 342 | mBlockUpdate = false; |
342 | mQuickAdd = new KOQuickTodo(this); | 343 | mQuickAdd = new KOQuickTodo(this); |
343 | topLayout->addWidget(mQuickAdd); | 344 | topLayout->addWidget(mQuickAdd); |
344 | 345 | ||
345 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 346 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
346 | 347 | ||
347 | mTodoListView = new KOTodoListView(calendar,this, name ); | 348 | mTodoListView = new KOTodoListView(calendar,this, name ); |
348 | topLayout->addWidget(mTodoListView); | 349 | topLayout->addWidget(mTodoListView); |
349 | //mTodoListView->header()->setMaximumHeight(30); | 350 | //mTodoListView->header()->setMaximumHeight(30); |
350 | mTodoListView->setRootIsDecorated(true); | 351 | mTodoListView->setRootIsDecorated(true); |
351 | mTodoListView->setAllColumnsShowFocus(true); | 352 | mTodoListView->setAllColumnsShowFocus(true); |
352 | 353 | ||
353 | mTodoListView->setShowSortIndicator(true); | 354 | mTodoListView->setShowSortIndicator(true); |
354 | 355 | ||
355 | mTodoListView->addColumn(i18n("Todo")); | 356 | mTodoListView->addColumn(i18n("Todo")); |
356 | mTodoListView->addColumn(i18n("Prio")); | 357 | mTodoListView->addColumn(i18n("Prio")); |
357 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 358 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
358 | mTodoListView->addColumn(i18n("Complete")); | 359 | mTodoListView->addColumn(i18n("Complete")); |
359 | mTodoListView->setColumnAlignment(2,AlignCenter); | 360 | mTodoListView->setColumnAlignment(2,AlignCenter); |
360 | 361 | ||
361 | mTodoListView->addColumn(i18n("Due Date")); | 362 | mTodoListView->addColumn(i18n("Due Date")); |
362 | mTodoListView->setColumnAlignment(3,AlignLeft); | 363 | mTodoListView->setColumnAlignment(3,AlignLeft); |
363 | mTodoListView->addColumn(i18n("Due Time")); | 364 | mTodoListView->addColumn(i18n("Due Time")); |
364 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 365 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
365 | 366 | ||
366 | mTodoListView->addColumn(i18n("Start Date")); | 367 | mTodoListView->addColumn(i18n("Start Date")); |
367 | mTodoListView->setColumnAlignment(5,AlignLeft); | 368 | mTodoListView->setColumnAlignment(5,AlignLeft); |
368 | mTodoListView->addColumn(i18n("Start Time")); | 369 | mTodoListView->addColumn(i18n("Start Time")); |
369 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 370 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
370 | 371 | ||
371 | mTodoListView->addColumn(i18n("Cancelled")); | 372 | mTodoListView->addColumn(i18n("Cancelled")); |
372 | mTodoListView->addColumn(i18n("Categories")); | 373 | mTodoListView->addColumn(i18n("Categories")); |
373 | #if 0 | 374 | #if 0 |
374 | mTodoListView->addColumn(i18n("Sort Id")); | 375 | mTodoListView->addColumn(i18n("Sort Id")); |
375 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 376 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
376 | #endif | 377 | #endif |
377 | 378 | ||
378 | mTodoListView->setMinimumHeight( 60 ); | 379 | mTodoListView->setMinimumHeight( 60 ); |
379 | mTodoListView->setItemsRenameable( true ); | 380 | mTodoListView->setItemsRenameable( true ); |
380 | mTodoListView->setRenameable( 0 ); | 381 | mTodoListView->setRenameable( 0 ); |
381 | mTodoListView->setColumnWidth( 0, 120 ); | 382 | mTodoListView->setColumnWidth( 0, 120 ); |
382 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 383 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
383 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 384 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
384 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 385 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
385 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 386 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
386 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 387 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
387 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 388 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
388 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 389 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
389 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 390 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
390 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 391 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
391 | 392 | ||
392 | 393 | ||
393 | mPriorityPopupMenu = new QPopupMenu(this); | 394 | mPriorityPopupMenu = new QPopupMenu(this); |
394 | for (int i = 1; i <= 5; i++) { | 395 | for (int i = 1; i <= 5; i++) { |
395 | QString label = QString ("%1").arg (i); | 396 | QString label = QString ("%1").arg (i); |
396 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 397 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
397 | } | 398 | } |
398 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 399 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
399 | 400 | ||
400 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 401 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
401 | for (int i = 0; i <= 100; i+=20) { | 402 | for (int i = 0; i <= 100; i+=20) { |
402 | QString label = QString ("%1 %").arg (i); | 403 | QString label = QString ("%1 %").arg (i); |
403 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 404 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
404 | } | 405 | } |
405 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 406 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
406 | 407 | ||
407 | 408 | ||
408 | 409 | ||
409 | mItemPopupMenu = new QPopupMenu(this); | 410 | mItemPopupMenu = new QPopupMenu(this); |
410 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 411 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
411 | SLOT (showTodo())); | 412 | SLOT (showTodo())); |
412 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 413 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
413 | SLOT (editTodo())); | 414 | SLOT (editTodo())); |
414 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 415 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
415 | SLOT (deleteTodo())); | 416 | SLOT (deleteTodo())); |
416 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 417 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
417 | SLOT (cloneTodo())); | 418 | SLOT (cloneTodo())); |
418 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 419 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
419 | SLOT (moveTodo())); | 420 | SLOT (moveTodo())); |
420 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 421 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
421 | SLOT (beamTodo())); | 422 | SLOT (beamTodo())); |
422 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 423 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
423 | SLOT (cancelTodo())); | 424 | SLOT (cancelTodo())); |
424 | mItemPopupMenu->insertSeparator(); | 425 | mItemPopupMenu->insertSeparator(); |
425 | 426 | ||
426 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 427 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
427 | SLOT (newTodo())); | 428 | SLOT (newTodo())); |
428 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 429 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
429 | SLOT (newSubTodo())); | 430 | SLOT (newSubTodo())); |
430 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 431 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
431 | SLOT (unparentTodo()),0,21); | 432 | SLOT (unparentTodo()),0,21); |
432 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 433 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
433 | SLOT (reparentTodo()),0,22); | 434 | SLOT (reparentTodo()),0,22); |
434 | mItemPopupMenu->insertSeparator(); | 435 | mItemPopupMenu->insertSeparator(); |
435 | #if 0 | 436 | #if 0 |
436 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 437 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
437 | this, SLOT( purgeCompleted() ) ); | 438 | this, SLOT( purgeCompleted() ) ); |
438 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 439 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
439 | this, SLOT( toggleCompleted() ),0, 33 ); | 440 | this, SLOT( toggleCompleted() ),0, 33 ); |
440 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 441 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
441 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 442 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
442 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 443 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
443 | this, SLOT( toggleRunning() ),0, 35 ); | 444 | this, SLOT( toggleRunning() ),0, 35 ); |
444 | 445 | ||
445 | #endif | 446 | #endif |
446 | mPopupMenu = new QPopupMenu(this); | 447 | mPopupMenu = new QPopupMenu(this); |
447 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 448 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
448 | SLOT (newTodo()),0,1); | 449 | SLOT (newTodo()),0,1); |
449 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 450 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
450 | this, SLOT(purgeCompleted()),0,2); | 451 | this, SLOT(purgeCompleted()),0,2); |
451 | mPopupMenu->insertItem(i18n("Show Completed"), | 452 | mPopupMenu->insertItem(i18n("Show Completed"), |
452 | this, SLOT( toggleCompleted() ),0,3 ); | 453 | this, SLOT( toggleCompleted() ),0,3 ); |
453 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 454 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
454 | this, SLOT( toggleQuickTodo() ),0,4 ); | 455 | this, SLOT( toggleQuickTodo() ),0,4 ); |
455 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 456 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
456 | this, SLOT( toggleRunning() ),0,5 ); | 457 | this, SLOT( toggleRunning() ),0,5 ); |
457 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 458 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
458 | this, SLOT( setAllOpen() ),0,6 ); | 459 | this, SLOT( setAllOpen() ),0,6 ); |
459 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 460 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
460 | this, SLOT( setAllClose() ),0,7 ); | 461 | this, SLOT( setAllClose() ),0,7 ); |
461 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 462 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
462 | this, SLOT( setAllFlat() ),0,8 ); | 463 | this, SLOT( setAllFlat() ),0,8 ); |
463 | mDocPrefs = new DocPrefs( name ); | 464 | mDocPrefs = new DocPrefs( name ); |
464 | 465 | ||
465 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 466 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
466 | mPopupMenu->setCheckable( true ); | 467 | mPopupMenu->setCheckable( true ); |
467 | mItemPopupMenu->setCheckable( true ); | 468 | mItemPopupMenu->setCheckable( true ); |
468 | 469 | ||
469 | 470 | ||
470 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 471 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
471 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 472 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
472 | 473 | ||
473 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 474 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
474 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 475 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
475 | 476 | ||
476 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 477 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
477 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 478 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
478 | 479 | ||
479 | 480 | ||
480 | // Double clicking conflicts with opening/closing the subtree | 481 | // Double clicking conflicts with opening/closing the subtree |
481 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 482 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
482 | SLOT( editItem( QListViewItem *) ) ); | 483 | SLOT( editItem( QListViewItem *) ) ); |
483 | /* | 484 | /* |
484 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 485 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
485 | const QPoint &,int ) ), | 486 | const QPoint &,int ) ), |
486 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 487 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
487 | */ | 488 | */ |
488 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 489 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
489 | const QPoint &,int ) ), | 490 | const QPoint &,int ) ), |
490 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 491 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
491 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 492 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
492 | SLOT( itemClicked( QListViewItem * ) ) ); | 493 | SLOT( itemClicked( QListViewItem * ) ) ); |
493 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 494 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
494 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 495 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
495 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 496 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
496 | SLOT( updateView() ) ); | 497 | SLOT( updateView() ) ); |
497 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 498 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
498 | SLOT( todoModified(Todo *, int) ) ); | 499 | SLOT( todoModified(Todo *, int) ) ); |
499 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 500 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
500 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 501 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
501 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 502 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
502 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 503 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
503 | 504 | ||
504 | #if 0 | 505 | #if 0 |
505 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 506 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
506 | SLOT(selectionChanged(QListViewItem *))); | 507 | SLOT(selectionChanged(QListViewItem *))); |
507 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 508 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
508 | SLOT(selectionChanged(QListViewItem *))); | 509 | SLOT(selectionChanged(QListViewItem *))); |
509 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 510 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
510 | SLOT(selectionChanged(QListViewItem *))); | 511 | SLOT(selectionChanged(QListViewItem *))); |
511 | #endif | 512 | #endif |
512 | 513 | ||
513 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 514 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
514 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 515 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
515 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 516 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
516 | 517 | ||
517 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 518 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
518 | SLOT( processSelectionChange() ) ); | 519 | SLOT( processSelectionChange() ) ); |
519 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 520 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
520 | SLOT( addQuickTodo() ) ); | 521 | SLOT( addQuickTodo() ) ); |
521 | 522 | ||
522 | } | 523 | } |
523 | 524 | ||
524 | KOTodoView::~KOTodoView() | 525 | KOTodoView::~KOTodoView() |
525 | { | 526 | { |
526 | delete mDocPrefs; | 527 | delete mDocPrefs; |
527 | } | 528 | } |
528 | 529 | ||
529 | void KOTodoView::jumpToDate () | 530 | void KOTodoView::jumpToDate () |
530 | { | 531 | { |
531 | // if (mActiveItem) { | 532 | // if (mActiveItem) { |
532 | // mActiveItem->todo()); | 533 | // mActiveItem->todo()); |
533 | // if ( mActiveItem->todo()->hasDueDate() ) | 534 | // if ( mActiveItem->todo()->hasDueDate() ) |
534 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 535 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
535 | } | 536 | } |
536 | 537 | void KOTodoView::paintEvent(QPaintEvent * pevent) | |
538 | { | ||
539 | if ( mPendingUpdateBeforeRepaint ) { | ||
540 | updateView(); | ||
541 | mPendingUpdateBeforeRepaint = false; | ||
542 | } | ||
543 | KOrg::BaseView::paintEvent( pevent); | ||
544 | } | ||
545 | bool mPendingUpdateBeforeRepaint; | ||
537 | void KOTodoView::updateView() | 546 | void KOTodoView::updateView() |
538 | { | 547 | { |
539 | pendingSubtodo = 0; | 548 | pendingSubtodo = 0; |
540 | if ( mBlockUpdate ) { | 549 | if ( mBlockUpdate ) { |
541 | //qDebug("blocked "); | ||
542 | return; | 550 | return; |
543 | } | 551 | } |
552 | if ( !isVisible() ) { | ||
553 | mPendingUpdateBeforeRepaint = true; | ||
554 | return; | ||
555 | } | ||
556 | //qDebug("KOTodoView::updateView() %x", this); | ||
544 | if ( isFlatDisplay ) { | 557 | if ( isFlatDisplay ) { |
545 | setAllFlat(); | 558 | setAllFlat(); |
546 | return; | 559 | return; |
547 | } | 560 | } |
548 | //qDebug("update "); | 561 | //qDebug("update "); |
549 | // kdDebug() << "KOTodoView::updateView()" << endl; | 562 | // kdDebug() << "KOTodoView::updateView()" << endl; |
550 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 563 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
551 | mTodoListView->clear(); | 564 | mTodoListView->clear(); |
552 | if ( mName == "todolistsmall" ) { | 565 | if ( mName == "todolistsmall" ) { |
553 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 566 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
554 | int ps = fo.pointSize() -2; | 567 | int ps = fo.pointSize() -2; |
555 | if ( ps > 12 ) | 568 | if ( ps > 12 ) |
556 | ps -= 2; | 569 | ps -= 2; |
557 | fo.setPointSize( ps ); | 570 | fo.setPointSize( ps ); |
558 | } | 571 | } |
559 | } | 572 | } |
560 | 573 | ||
561 | mTodoListView->setFont( fo ); | 574 | mTodoListView->setFont( fo ); |
562 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 575 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
563 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 576 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
564 | QPtrList<Todo> todoList = calendar()->todos(); | 577 | QPtrList<Todo> todoList = calendar()->todos(); |
565 | 578 | ||
566 | /* | 579 | /* |
567 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 580 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
568 | Event *t; | 581 | Event *t; |
569 | for(t = todoList.first(); t; t = todoList.next()) { | 582 | for(t = todoList.first(); t; t = todoList.next()) { |
570 | kdDebug() << " " << t->getSummary() << endl; | 583 | kdDebug() << " " << t->getSummary() << endl; |
571 | 584 | ||
572 | if (t->getRelatedTo()) { | 585 | if (t->getRelatedTo()) { |
573 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 586 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
574 | } | 587 | } |
575 | 588 | ||
576 | QPtrList<Event> l = t->getRelations(); | 589 | QPtrList<Event> l = t->getRelations(); |
577 | Event *c; | 590 | Event *c; |
578 | for(c=l.first();c;c=l.next()) { | 591 | for(c=l.first();c;c=l.next()) { |
579 | kdDebug() << " - relation: " << c->getSummary() << endl; | 592 | kdDebug() << " - relation: " << c->getSummary() << endl; |
580 | } | 593 | } |
581 | } | 594 | } |
582 | */ | 595 | */ |
583 | 596 | ||
584 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 597 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
585 | // specific order of events. That means that we have to generate parent items | 598 | // specific order of events. That means that we have to generate parent items |
586 | // recursively for proper hierarchical display of Todos. | 599 | // recursively for proper hierarchical display of Todos. |
587 | mTodoMap.clear(); | 600 | mTodoMap.clear(); |
588 | Todo *todo; | 601 | Todo *todo; |
589 | todo = todoList.first();// todo; todo = todoList.next()) { | 602 | todo = todoList.first();// todo; todo = todoList.next()) { |
590 | while ( todo ) { | 603 | while ( todo ) { |
591 | bool next = true; | 604 | bool next = true; |
592 | // qDebug("todo %s ", todo->summary().latin1()); | 605 | // qDebug("todo %s ", todo->summary().latin1()); |
593 | Incidence *incidence = todo->relatedTo(); | 606 | Incidence *incidence = todo->relatedTo(); |
594 | while ( incidence ) { | 607 | while ( incidence ) { |
595 | if ( incidence->type() == "Todo") { | 608 | if ( incidence->type() == "Todo") { |
596 | //qDebug("related %s ",incidence->summary().latin1() ); | 609 | //qDebug("related %s ",incidence->summary().latin1() ); |
597 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 610 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
598 | //qDebug("related not found "); | 611 | //qDebug("related not found "); |
599 | todoList.remove( ); | 612 | todoList.remove( ); |
600 | todo = todoList.current(); | 613 | todo = todoList.current(); |
601 | next = false; | 614 | next = false; |
602 | incidence = 0; | 615 | incidence = 0; |
603 | 616 | ||
604 | } else { | 617 | } else { |
605 | //qDebug("related found "); | 618 | //qDebug("related found "); |
606 | incidence = incidence->relatedTo(); | 619 | incidence = incidence->relatedTo(); |
607 | } | 620 | } |
608 | } else | 621 | } else |
609 | incidence = 0; | 622 | incidence = 0; |
610 | } | 623 | } |
611 | if ( next ) | 624 | if ( next ) |
612 | todo = todoList.next(); | 625 | todo = todoList.next(); |
613 | } | 626 | } |
614 | // qDebug("again .... "); | 627 | // qDebug("again .... "); |
615 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 628 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
616 | 629 | ||
617 | // qDebug("yytodo %s ", todo->summary().latin1()); | 630 | // qDebug("yytodo %s ", todo->summary().latin1()); |
618 | // } | 631 | // } |
619 | //qDebug("for "); | 632 | //qDebug("for "); |
620 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 633 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
621 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 634 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
622 | { | 635 | { |
623 | insertTodoItem(todo); | 636 | insertTodoItem(todo); |
624 | } | 637 | } |
625 | } | 638 | } |
626 | //qDebug("for end "); | 639 | //qDebug("for end "); |
627 | // Restore opened/closed state | 640 | // Restore opened/closed state |
628 | mTodoListView->blockSignals( true ); | 641 | mTodoListView->blockSignals( true ); |
629 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 642 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
630 | mTodoListView->blockSignals( false ); | 643 | mTodoListView->blockSignals( false ); |
631 | mTodoListView->setFocus(); | 644 | mTodoListView->setFocus(); |
632 | processSelectionChange(); | 645 | processSelectionChange(); |
633 | } | 646 | } |
634 | 647 | ||
635 | bool KOTodoView::checkTodo( Todo * todo ) | 648 | bool KOTodoView::checkTodo( Todo * todo ) |
636 | { | 649 | { |
637 | 650 | ||
638 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 651 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
639 | return false; | 652 | return false; |
640 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 653 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
641 | if ( todo->hasStartDate() ) | 654 | if ( todo->hasStartDate() ) |
642 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 655 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
643 | return false; | 656 | return false; |
644 | if ( todo->hasDueDate() ) | 657 | if ( todo->hasDueDate() ) |
645 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 658 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
646 | return false; | 659 | return false; |
647 | } | 660 | } |
648 | return true; | 661 | return true; |
649 | } | 662 | } |
650 | 663 | ||
651 | void KOTodoView::restoreItemState( QListViewItem *item ) | 664 | void KOTodoView::restoreItemState( QListViewItem *item ) |
652 | { | 665 | { |
653 | pendingSubtodo = 0; | 666 | pendingSubtodo = 0; |
654 | while( item ) { | 667 | while( item ) { |
655 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 668 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
656 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 669 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
657 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 670 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
658 | item = item->nextSibling(); | 671 | item = item->nextSibling(); |
659 | } | 672 | } |
660 | } | 673 | } |
661 | 674 | ||
662 | 675 | ||
663 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 676 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
664 | KOTodoView::insertTodoItem(Todo *todo) | 677 | KOTodoView::insertTodoItem(Todo *todo) |
665 | { | 678 | { |
666 | 679 | ||
667 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 680 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
668 | // TODO: Check, if dynmaic cast is necessary | 681 | // TODO: Check, if dynmaic cast is necessary |
669 | 682 | ||
670 | pendingSubtodo = 0; | 683 | pendingSubtodo = 0; |
671 | Incidence *incidence = todo->relatedTo(); | 684 | Incidence *incidence = todo->relatedTo(); |
672 | if (incidence && incidence->type() == "Todo") { | 685 | if (incidence && incidence->type() == "Todo") { |
673 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 686 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
674 | 687 | ||
675 | // kdDebug() << " has Related" << endl; | 688 | // kdDebug() << " has Related" << endl; |
676 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 689 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
677 | itemIterator = mTodoMap.find(relatedTodo); | 690 | itemIterator = mTodoMap.find(relatedTodo); |
678 | if (itemIterator == mTodoMap.end()) { | 691 | if (itemIterator == mTodoMap.end()) { |
679 | // kdDebug() << " related not yet in list" << endl; | 692 | // kdDebug() << " related not yet in list" << endl; |
680 | itemIterator = insertTodoItem (relatedTodo); | 693 | itemIterator = insertTodoItem (relatedTodo); |
681 | } | 694 | } |
682 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 695 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
683 | // and one into the map. Sure finding is more easy but why? -zecke | 696 | // and one into the map. Sure finding is more easy but why? -zecke |
684 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 697 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
685 | return mTodoMap.insert(todo,todoItem); | 698 | return mTodoMap.insert(todo,todoItem); |
686 | } else { | 699 | } else { |
687 | // kdDebug() << " no Related" << endl; | 700 | // kdDebug() << " no Related" << endl; |
688 | // see above -zecke | 701 | // see above -zecke |
689 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 702 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
690 | return mTodoMap.insert(todo,todoItem); | 703 | return mTodoMap.insert(todo,todoItem); |
691 | } | 704 | } |
692 | } | 705 | } |
693 | 706 | ||
694 | 707 | ||
695 | void KOTodoView::updateConfig() | 708 | void KOTodoView::updateConfig() |
696 | { | 709 | { |
697 | updateView(); | 710 | updateView(); |
698 | mTodoListView->repaintContents(); | 711 | mTodoListView->repaintContents(); |
699 | } | 712 | } |
700 | 713 | ||
701 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 714 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
702 | { | 715 | { |
703 | QPtrList<Incidence> selected; | 716 | QPtrList<Incidence> selected; |
704 | 717 | ||
705 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 718 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
706 | // if (!item) item = mActiveItem; | 719 | // if (!item) item = mActiveItem; |
707 | if (item) selected.append(item->todo()); | 720 | if (item) selected.append(item->todo()); |
708 | 721 | ||
709 | return selected; | 722 | return selected; |
710 | } | 723 | } |
711 | 724 | ||
712 | QPtrList<Todo> KOTodoView::selectedTodos() | 725 | QPtrList<Todo> KOTodoView::selectedTodos() |
713 | { | 726 | { |
714 | QPtrList<Todo> selected; | 727 | QPtrList<Todo> selected; |
715 | 728 | ||
716 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 729 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
717 | // if (!item) item = mActiveItem; | 730 | // if (!item) item = mActiveItem; |
718 | if (item) selected.append(item->todo()); | 731 | if (item) selected.append(item->todo()); |
719 | 732 | ||
720 | return selected; | 733 | return selected; |
721 | } | 734 | } |
722 | 735 | ||
723 | void KOTodoView::changeEventDisplay(Event *, int) | 736 | void KOTodoView::changeEventDisplay(Event *, int) |
724 | { | 737 | { |
725 | updateView(); | 738 | updateView(); |
726 | } | 739 | } |
727 | 740 | ||
728 | void KOTodoView::showDates(const QDate &, const QDate &) | 741 | void KOTodoView::showDates(const QDate &, const QDate &) |
729 | { | 742 | { |
730 | } | 743 | } |
731 | 744 | ||
732 | void KOTodoView::showEvents(QPtrList<Event>) | 745 | void KOTodoView::showEvents(QPtrList<Event>) |
733 | { | 746 | { |
734 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 747 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
735 | } | 748 | } |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 68e29bb..16bc133 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -24,224 +24,226 @@ | |||
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | 52 | ||
53 | class DocPrefs; | 53 | class DocPrefs; |
54 | 54 | ||
55 | class KOTodoListView : public KListView | 55 | class KOTodoListView : public KListView |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
60 | virtual ~KOTodoListView() {} | 60 | virtual ~KOTodoListView() {} |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | void todoDropped(Todo *, int); | 63 | void todoDropped(Todo *, int); |
64 | void double_Clicked(QListViewItem *item); | 64 | void double_Clicked(QListViewItem *item); |
65 | void reparentTodoSignal( Todo *,Todo * ); | 65 | void reparentTodoSignal( Todo *,Todo * ); |
66 | void unparentTodoSignal(Todo *); | 66 | void unparentTodoSignal(Todo *); |
67 | void deleteTodo( Todo * ); | 67 | void deleteTodo( Todo * ); |
68 | protected: | 68 | protected: |
69 | void contentsDragEnterEvent(QDragEnterEvent *); | 69 | void contentsDragEnterEvent(QDragEnterEvent *); |
70 | void contentsDragMoveEvent(QDragMoveEvent *); | 70 | void contentsDragMoveEvent(QDragMoveEvent *); |
71 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 71 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
72 | void contentsDropEvent(QDropEvent *); | 72 | void contentsDropEvent(QDropEvent *); |
73 | 73 | ||
74 | void contentsMousePressEvent(QMouseEvent *); | 74 | void contentsMousePressEvent(QMouseEvent *); |
75 | void contentsMouseMoveEvent(QMouseEvent *); | 75 | void contentsMouseMoveEvent(QMouseEvent *); |
76 | void contentsMouseReleaseEvent(QMouseEvent *); | 76 | void contentsMouseReleaseEvent(QMouseEvent *); |
77 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 77 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
78 | 78 | ||
79 | private: | 79 | private: |
80 | bool internalDrop; | 80 | bool internalDrop; |
81 | QString mName; | 81 | QString mName; |
82 | Calendar *mCalendar; | 82 | Calendar *mCalendar; |
83 | QPoint mPressPos; | 83 | QPoint mPressPos; |
84 | bool mMousePressed; | 84 | bool mMousePressed; |
85 | QListViewItem *mOldCurrent; | 85 | QListViewItem *mOldCurrent; |
86 | void keyPressEvent ( QKeyEvent * ) ; | 86 | void keyPressEvent ( QKeyEvent * ) ; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | /** | 90 | /** |
91 | This is the line-edit on top of the todoview for fast addition of new todos | 91 | This is the line-edit on top of the todoview for fast addition of new todos |
92 | */ | 92 | */ |
93 | class KOQuickTodo : public QLineEdit | 93 | class KOQuickTodo : public QLineEdit |
94 | { | 94 | { |
95 | public: | 95 | public: |
96 | KOQuickTodo(QWidget *parent=0); | 96 | KOQuickTodo(QWidget *parent=0); |
97 | protected: | 97 | protected: |
98 | void focusInEvent(QFocusEvent *ev); | 98 | void focusInEvent(QFocusEvent *ev); |
99 | void focusOutEvent(QFocusEvent *ev); | 99 | void focusOutEvent(QFocusEvent *ev); |
100 | }; | 100 | }; |
101 | 101 | ||
102 | 102 | ||
103 | /** | 103 | /** |
104 | This class provides a multi-column list view of todo events. | 104 | This class provides a multi-column list view of todo events. |
105 | 105 | ||
106 | @short multi-column list view of todo events. | 106 | @short multi-column list view of todo events. |
107 | @author Cornelius Schumacher <schumacher@kde.org> | 107 | @author Cornelius Schumacher <schumacher@kde.org> |
108 | */ | 108 | */ |
109 | class KOTodoView : public KOrg::BaseView | 109 | class KOTodoView : public KOrg::BaseView |
110 | { | 110 | { |
111 | Q_OBJECT | 111 | Q_OBJECT |
112 | public: | 112 | public: |
113 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 113 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
114 | ~KOTodoView(); | 114 | ~KOTodoView(); |
115 | 115 | ||
116 | QPtrList<Incidence> selectedIncidences(); | 116 | QPtrList<Incidence> selectedIncidences(); |
117 | QPtrList<Todo> selectedTodos(); | 117 | QPtrList<Todo> selectedTodos(); |
118 | 118 | ||
119 | DateList selectedDates() | 119 | DateList selectedDates() |
120 | {DateList q; | 120 | {DateList q; |
121 | return q;} | 121 | return q;} |
122 | 122 | ||
123 | /** Return number of shown dates. TodoView does not show dates, */ | 123 | /** Return number of shown dates. TodoView does not show dates, */ |
124 | int currentDateCount() { return 0; } | 124 | int currentDateCount() { return 0; } |
125 | 125 | ||
126 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 126 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
127 | 127 | ||
128 | void setDocumentId( const QString & ); | 128 | void setDocumentId( const QString & ); |
129 | 129 | ||
130 | void saveLayout(KConfig *config, const QString &group) const; | 130 | void saveLayout(KConfig *config, const QString &group) const; |
131 | void restoreLayout(KConfig *config, const QString &group); | 131 | void restoreLayout(KConfig *config, const QString &group); |
132 | /** Create a popup menu to set categories */ | 132 | /** Create a popup menu to set categories */ |
133 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 133 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
134 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 134 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
135 | 135 | ||
136 | public slots: | 136 | public slots: |
137 | void updateView(); | 137 | void updateView(); |
138 | void updateConfig(); | 138 | void updateConfig(); |
139 | 139 | ||
140 | void changeEventDisplay(Event *, int); | 140 | void changeEventDisplay(Event *, int); |
141 | 141 | ||
142 | void showDates(const QDate &start, const QDate &end); | 142 | void showDates(const QDate &start, const QDate &end); |
143 | void showEvents(QPtrList<Event> eventList); | 143 | void showEvents(QPtrList<Event> eventList); |
144 | 144 | ||
145 | void clearSelection(); | 145 | void clearSelection(); |
146 | void jumpToDate (); | 146 | void jumpToDate (); |
147 | 147 | ||
148 | void editItem(QListViewItem *item); | 148 | void editItem(QListViewItem *item); |
149 | void showItem(QListViewItem *item,const QPoint &,int); | 149 | void showItem(QListViewItem *item,const QPoint &,int); |
150 | void popupMenu(QListViewItem *item,const QPoint &,int); | 150 | void popupMenu(QListViewItem *item,const QPoint &,int); |
151 | void newTodo(); | 151 | void newTodo(); |
152 | void newSubTodo(); | 152 | void newSubTodo(); |
153 | void unparentTodo(); | 153 | void unparentTodo(); |
154 | void reparentTodo(); | 154 | void reparentTodo(); |
155 | void showTodo(); | 155 | void showTodo(); |
156 | void editTodo(); | 156 | void editTodo(); |
157 | void cloneTodo(); | 157 | void cloneTodo(); |
158 | void cancelTodo(); | 158 | void cancelTodo(); |
159 | void moveTodo(); | 159 | void moveTodo(); |
160 | void beamTodo(); | 160 | void beamTodo(); |
161 | void deleteTodo(); | 161 | void deleteTodo(); |
162 | 162 | ||
163 | void setNewPriority(int); | 163 | void setNewPriority(int); |
164 | void setNewPercentage(int); | 164 | void setNewPercentage(int); |
165 | void changedCategories(int); | 165 | void changedCategories(int); |
166 | 166 | ||
167 | void setAllOpen(); | 167 | void setAllOpen(); |
168 | void setAllClose(); | 168 | void setAllClose(); |
169 | void setAllFlat(); | 169 | void setAllFlat(); |
170 | 170 | ||
171 | void purgeCompleted(); | 171 | void purgeCompleted(); |
172 | void toggleCompleted(); | 172 | void toggleCompleted(); |
173 | void toggleRunning(); | 173 | void toggleRunning(); |
174 | void toggleQuickTodo(); | 174 | void toggleQuickTodo(); |
175 | void updateTodo( Todo *, int ); | 175 | void updateTodo( Todo *, int ); |
176 | 176 | ||
177 | void itemClicked(QListViewItem *); | 177 | void itemClicked(QListViewItem *); |
178 | void itemStateChanged(QListViewItem *); | 178 | void itemStateChanged(QListViewItem *); |
179 | void modified(bool); | 179 | void modified(bool); |
180 | void itemDoubleClicked(QListViewItem *item); | 180 | void itemDoubleClicked(QListViewItem *item); |
181 | 181 | ||
182 | signals: | 182 | signals: |
183 | void newTodoSignal(); | 183 | void newTodoSignal(); |
184 | void newSubTodoSignal(Todo *); | 184 | void newSubTodoSignal(Todo *); |
185 | void unparentTodoSignal(Todo *); | 185 | void unparentTodoSignal(Todo *); |
186 | void reparentTodoSignal( Todo *,Todo * ); | 186 | void reparentTodoSignal( Todo *,Todo * ); |
187 | void showTodoSignal(Todo *); | 187 | void showTodoSignal(Todo *); |
188 | 188 | ||
189 | void editTodoSignal(Todo *); | 189 | void editTodoSignal(Todo *); |
190 | void deleteTodoSignal(Todo *); | 190 | void deleteTodoSignal(Todo *); |
191 | void todoModifiedSignal (Todo *, int); | 191 | void todoModifiedSignal (Todo *, int); |
192 | 192 | ||
193 | void isModified(bool); | 193 | void isModified(bool); |
194 | void cloneTodoSignal( Incidence * ); | 194 | void cloneTodoSignal( Incidence * ); |
195 | void cancelTodoSignal( Incidence * ); | 195 | void cancelTodoSignal( Incidence * ); |
196 | void moveTodoSignal( Incidence * ); | 196 | void moveTodoSignal( Incidence * ); |
197 | void beamTodoSignal( Incidence * ); | 197 | void beamTodoSignal( Incidence * ); |
198 | void purgeCompletedSignal(); | 198 | void purgeCompletedSignal(); |
199 | 199 | ||
200 | protected slots: | 200 | protected slots: |
201 | void processSelectionChange(); | 201 | void processSelectionChange(); |
202 | void addQuickTodo(); | 202 | void addQuickTodo(); |
203 | void setTodoModified( Todo* ); | 203 | void setTodoModified( Todo* ); |
204 | void todoModified(Todo *, int ); | 204 | void todoModified(Todo *, int ); |
205 | 205 | ||
206 | private: | 206 | private: |
207 | /* | 207 | /* |
208 | * the TodoEditor approach is rather unscaling in the long | 208 | * the TodoEditor approach is rather unscaling in the long |
209 | * run. | 209 | * run. |
210 | * Korganizer keeps it in memory and we need to update | 210 | * Korganizer keeps it in memory and we need to update |
211 | * 1. make KOTodoViewItem a QObject again? | 211 | * 1. make KOTodoViewItem a QObject again? |
212 | * 2. add a public method for setting one todo modified? | 212 | * 2. add a public method for setting one todo modified? |
213 | * 3. add a private method for setting a todo modified + friend here? | 213 | * 3. add a private method for setting a todo modified + friend here? |
214 | * -- zecke 2002-07-08 | 214 | * -- zecke 2002-07-08 |
215 | */ | 215 | */ |
216 | void paintEvent(QPaintEvent * pevent); | ||
217 | bool mPendingUpdateBeforeRepaint; | ||
216 | friend class KOTodoViewItem; | 218 | friend class KOTodoViewItem; |
217 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 219 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
218 | void restoreItemState( QListViewItem * ); | 220 | void restoreItemState( QListViewItem * ); |
219 | 221 | ||
220 | bool checkTodo( Todo * ); | 222 | bool checkTodo( Todo * ); |
221 | bool isFlatDisplay; | 223 | bool isFlatDisplay; |
222 | void setOpen( QListViewItem*, bool setOpen); | 224 | void setOpen( QListViewItem*, bool setOpen); |
223 | KOTodoListView *mTodoListView; | 225 | KOTodoListView *mTodoListView; |
224 | QPopupMenu *mItemPopupMenu; | 226 | QPopupMenu *mItemPopupMenu; |
225 | QPopupMenu *mPopupMenu; | 227 | QPopupMenu *mPopupMenu; |
226 | QPopupMenu *mPriorityPopupMenu; | 228 | QPopupMenu *mPriorityPopupMenu; |
227 | QPopupMenu *mPercentageCompletedPopupMenu; | 229 | QPopupMenu *mPercentageCompletedPopupMenu; |
228 | QPopupMenu *mCategoryPopupMenu; | 230 | QPopupMenu *mCategoryPopupMenu; |
229 | 231 | ||
230 | QMap<int, int> mPercentage; | 232 | QMap<int, int> mPercentage; |
231 | QMap<int, int> mPriority; | 233 | QMap<int, int> mPriority; |
232 | QMap<int, QString> mCategory; | 234 | QMap<int, QString> mCategory; |
233 | KOTodoViewItem *mActiveItem; | 235 | KOTodoViewItem *mActiveItem; |
234 | 236 | ||
235 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 237 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
236 | QString mName; | 238 | QString mName; |
237 | 239 | ||
238 | DocPrefs *mDocPrefs; | 240 | DocPrefs *mDocPrefs; |
239 | QString mCurrentDoc; | 241 | QString mCurrentDoc; |
240 | KOQuickTodo *mQuickAdd; | 242 | KOQuickTodo *mQuickAdd; |
241 | bool mBlockUpdate; | 243 | bool mBlockUpdate; |
242 | void keyPressEvent ( QKeyEvent * ) ; | 244 | void keyPressEvent ( QKeyEvent * ) ; |
243 | KOTodoViewItem * pendingSubtodo; | 245 | KOTodoViewItem * pendingSubtodo; |
244 | DateNavigator* mNavigator; | 246 | DateNavigator* mNavigator; |
245 | }; | 247 | }; |
246 | 248 | ||
247 | #endif | 249 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 35774d6..2cd8792 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -15,633 +15,638 @@ | |||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void KOViewManager::showDateView( int view, QDate date) | 102 | void KOViewManager::showDateView( int view, QDate date) |
103 | { | 103 | { |
104 | 104 | ||
105 | //qDebug("date %d %s", view, date.toString().latin1()); | 105 | //qDebug("date %d %s", view, date.toString().latin1()); |
106 | #if 0 | 106 | #if 0 |
107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); | 108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); |
109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); | 109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); |
110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); | 110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); |
111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
112 | #endif | 112 | #endif |
113 | if ( view == 3 ) { | 113 | if ( view == 3 ) { |
114 | mMainView->showDay( date ); | 114 | mMainView->showDay( date ); |
115 | } else if (view == 4 ) { | 115 | } else if (view == 4 ) { |
116 | mMainView->dateNavigator()->selectDates( date, 7 ); | 116 | mMainView->dateNavigator()->selectDates( date, 7 ); |
117 | } else if (view == 5 ) { | 117 | } else if (view == 5 ) { |
118 | mMainView->dateNavigator()->selectDates( date, 14); | 118 | mMainView->dateNavigator()->selectDates( date, 14); |
119 | } else if (view == 6 ) { | 119 | } else if (view == 6 ) { |
120 | mMainView->dateNavigator()->blockSignals( true ); | 120 | mMainView->dateNavigator()->blockSignals( true ); |
121 | mMainView->dateNavigator()->selectMonthByDate( date ); | 121 | mMainView->dateNavigator()->selectMonthByDate( date ); |
122 | mMainView->dateNavigator()->selectDate( date ); | 122 | mMainView->dateNavigator()->selectDate( date ); |
123 | mMainView->dateNavigator()->blockSignals( false ); | 123 | mMainView->dateNavigator()->blockSignals( false ); |
124 | showMonthView(); | 124 | showMonthView(); |
125 | } else if (view == 7 ) { | 125 | } else if (view == 7 ) { |
126 | mMainView->dateNavigator()->selectDate( date ); | 126 | mMainView->dateNavigator()->selectDate( date ); |
127 | showJournalView(); | 127 | showJournalView(); |
128 | } else if (view == 8 ) { | 128 | } else if (view == 8 ) { |
129 | globalFlagBlockAgenda = 1; | 129 | globalFlagBlockAgenda = 1; |
130 | if ( mCurrentAgendaView != 3 ) | 130 | if ( mCurrentAgendaView != 3 ) |
131 | mCurrentAgendaView = -1; | 131 | mCurrentAgendaView = -1; |
132 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 132 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
133 | globalFlagBlockAgenda = 2; | 133 | globalFlagBlockAgenda = 2; |
134 | mMainView->dateNavigator()->selectDates( date , | 134 | mMainView->dateNavigator()->selectDates( date , |
135 | KOPrefs::instance()->mNextXDays ); | 135 | KOPrefs::instance()->mNextXDays ); |
136 | mFlagShowNextxDays = true; | 136 | mFlagShowNextxDays = true; |
137 | mCurrentAgendaView = 3 ; | 137 | mCurrentAgendaView = 3 ; |
138 | } | 138 | } |
139 | 139 | ||
140 | #if 0 | 140 | #if 0 |
141 | dateNavigator()->blockSignals( true ); | 141 | dateNavigator()->blockSignals( true ); |
142 | dateNavigator()->selectDate( d ); | 142 | dateNavigator()->selectDate( d ); |
143 | dateNavigator()->blockSignals( false ); | 143 | dateNavigator()->blockSignals( false ); |
144 | mViewManager->showDayView(); | 144 | mViewManager->showDayView(); |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | 150 | ||
151 | void KOViewManager::writeSettings(KConfig *config) | 151 | void KOViewManager::writeSettings(KConfig *config) |
152 | { | 152 | { |
153 | config->setGroup("General"); | 153 | config->setGroup("General"); |
154 | 154 | ||
155 | QString view; | 155 | QString view; |
156 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 156 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
157 | else if (mCurrentView == mMonthView) view = "Month"; | 157 | else if (mCurrentView == mMonthView) view = "Month"; |
158 | else if (mCurrentView == mListView) view = "List"; | 158 | else if (mCurrentView == mListView) view = "List"; |
159 | else if (mCurrentView == mJournalView) view = "Journal"; | 159 | else if (mCurrentView == mJournalView) view = "Journal"; |
160 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 160 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
161 | else if (mCurrentView == mTodoView) view = "Todo"; | 161 | else if (mCurrentView == mTodoView) view = "Todo"; |
162 | else view = "Agenda"; | 162 | else view = "Agenda"; |
163 | 163 | ||
164 | config->writeEntry("Current View",view); | 164 | config->writeEntry("Current View",view); |
165 | 165 | ||
166 | if (mAgendaView) { | 166 | if (mAgendaView) { |
167 | mAgendaView->writeSettings(config); | 167 | mAgendaView->writeSettings(config); |
168 | } | 168 | } |
169 | if (mTimeSpanView) { | 169 | if (mTimeSpanView) { |
170 | mTimeSpanView->writeSettings(config); | 170 | mTimeSpanView->writeSettings(config); |
171 | } | 171 | } |
172 | if (mListView) { | 172 | if (mListView) { |
173 | mListView->writeSettings(config); | 173 | mListView->writeSettings(config); |
174 | } | 174 | } |
175 | if (mTodoView) { | 175 | if (mTodoView) { |
176 | mTodoView->saveLayout(config,"Todo View"); | 176 | mTodoView->saveLayout(config,"Todo View"); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 180 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
181 | { | 181 | { |
182 | 182 | ||
183 | //mFlagShowNextxDays = false; | 183 | //mFlagShowNextxDays = false; |
184 | //if(view == mCurrentView) return; | 184 | //if(view == mCurrentView) return; |
185 | if ( view == 0 ) { | 185 | if ( view == 0 ) { |
186 | view = mCurrentView; | 186 | view = mCurrentView; |
187 | if ( view == 0 ) | 187 | if ( view == 0 ) |
188 | return; | 188 | return; |
189 | } | 189 | } |
190 | bool full = fullScreen; | 190 | bool full = fullScreen; |
191 | if(view == mCurrentView && view != mWhatsNextView ) { | 191 | if(view == mCurrentView && view != mWhatsNextView ) { |
192 | if ( mCurrentAgendaView < 0 ) | 192 | if ( mCurrentAgendaView < 0 ) |
193 | return; | 193 | return; |
194 | full = mMainView->leftFrame()->isVisible(); | 194 | full = mMainView->leftFrame()->isVisible(); |
195 | } else { | 195 | } else { |
196 | mCurrentView = view; | 196 | mCurrentView = view; |
197 | // bool full = fullScreen; | 197 | // bool full = fullScreen; |
198 | bool isFull = !mMainView->leftFrame()->isVisible(); | 198 | bool isFull = !mMainView->leftFrame()->isVisible(); |
199 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 199 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
200 | full = true; | 200 | full = true; |
201 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 201 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
202 | full = false; | 202 | full = false; |
203 | } | 203 | } |
204 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 204 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
205 | //raiseCurrentView( full ); | 205 | //raiseCurrentView( full ); |
206 | mMainView->processIncidenceSelection( 0 ); | 206 | mMainView->processIncidenceSelection( 0 ); |
207 | mMainView->updateView(); | 207 | //mMainView->updateView(); |
208 | raiseCurrentView( full ); | 208 | raiseCurrentView( full, true ); |
209 | mMainView->adaptNavigationUnits(); | 209 | mMainView->adaptNavigationUnits(); |
210 | } | 210 | } |
211 | 211 | ||
212 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 212 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
213 | { | 213 | { |
214 | mCurrentAgendaView = 0; | 214 | mCurrentAgendaView = 0; |
215 | int wid = mMainView->width() ; | 215 | int wid = mMainView->width() ; |
216 | int hei = mMainView->height(); | 216 | int hei = mMainView->height(); |
217 | if ( mCurrentView == mMonthView ) { | 217 | if ( mCurrentView == mMonthView ) { |
218 | mMainView->navigatorBar()->show(); | 218 | mMainView->navigatorBar()->show(); |
219 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 219 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
220 | //mMainView->navigatorBar()->hide(); | 220 | //mMainView->navigatorBar()->hide(); |
221 | } else { | 221 | } else { |
222 | mMainView->navigatorBar()->hide(); | 222 | mMainView->navigatorBar()->hide(); |
223 | } | 223 | } |
224 | if ( fullScreen ) { | 224 | if ( fullScreen ) { |
225 | mMainView->leftFrame()->hide(); | 225 | mMainView->leftFrame()->hide(); |
226 | } else { | 226 | } else { |
227 | mMainView->leftFrame()->show(); | 227 | mMainView->leftFrame()->show(); |
228 | if ( KOPrefs::instance()->mVerticalScreen ) | 228 | if ( KOPrefs::instance()->mVerticalScreen ) |
229 | hei -= mMainView->leftFrame()->height(); | 229 | hei -= mMainView->leftFrame()->height(); |
230 | else | 230 | else |
231 | wid -= mMainView->leftFrame()->width(); | 231 | wid -= mMainView->leftFrame()->width(); |
232 | } | 232 | } |
233 | emit signalFullScreen( !fullScreen ); | 233 | emit signalFullScreen( !fullScreen ); |
234 | if ( callUpdateView ) | ||
235 | mMainView->updateView(); | ||
236 | |||
234 | if ( globalFlagBlockAgenda == 5 ) { | 237 | if ( globalFlagBlockAgenda == 5 ) { |
235 | globalFlagBlockAgenda = 4; | 238 | globalFlagBlockAgenda = 4; |
236 | globalFlagBlockAgendaItemPaint = 1; | 239 | globalFlagBlockAgendaItemPaint = 1; |
237 | } | 240 | } |
238 | mMainView->viewStack()->raiseWidget(mCurrentView); | 241 | mMainView->viewStack()->raiseWidget(mCurrentView); |
239 | if ( globalFlagBlockAgenda == 4 ) { | 242 | if ( globalFlagBlockAgenda == 4 ) { |
240 | if ( mCurrentView == mAgendaView ) { | 243 | if ( mCurrentView == mAgendaView ) { |
241 | //globalFlagBlockAgenda =1 ; | 244 | //globalFlagBlockAgenda =1 ; |
242 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 245 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
243 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 246 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
244 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 247 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
245 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 248 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
246 | qApp->processEvents(); | 249 | qApp->processEvents(); |
247 | //qDebug("qApp->processEvents() "); | 250 | //qDebug("qApp->processEvents() "); |
248 | globalFlagBlockAgenda = 0; | 251 | globalFlagBlockAgenda = 0; |
249 | mAgendaView->repaintAgenda(); | 252 | mAgendaView->repaintAgenda(); |
250 | 253 | ||
251 | } | 254 | } |
252 | globalFlagBlockAgenda = 0; | 255 | globalFlagBlockAgenda = 0; |
253 | } | 256 | } |
254 | emit signalAgendaView( mCurrentView == mAgendaView ); | 257 | emit signalAgendaView( mCurrentView == mAgendaView ); |
255 | //qDebug("raiseCurrentView ende "); | 258 | //qDebug("raiseCurrentView ende "); |
256 | 259 | ||
257 | } | 260 | } |
258 | 261 | ||
259 | void KOViewManager::updateView() | 262 | void KOViewManager::updateView() |
260 | { | 263 | { |
261 | // qDebug("KOViewManager::updateView() "); | 264 | // qDebug("KOViewManager::updateView() "); |
262 | // if we are updating mTodoView, we get endless recursion | 265 | // if we are updating mTodoView, we get endless recursion |
263 | if ( mTodoView == mCurrentView ) | 266 | if ( mTodoView == mCurrentView ) |
264 | return; | 267 | return; |
265 | if ( mCurrentView ) mCurrentView->updateView(); | 268 | if ( mCurrentView ) mCurrentView->updateView(); |
266 | 269 | ||
267 | } | 270 | } |
268 | 271 | ||
269 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 272 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
270 | { | 273 | { |
271 | // kdDebug() << "KOViewManager::updateView()" << endl; | 274 | // kdDebug() << "KOViewManager::updateView()" << endl; |
272 | 275 | ||
273 | if (mCurrentView) mCurrentView->showDates(start, end); | 276 | if (mCurrentView) mCurrentView->showDates(start, end); |
274 | 277 | ||
275 | if (mTodoView) mTodoView->updateView(); | 278 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
276 | } | 279 | } |
277 | 280 | ||
278 | 281 | ||
279 | void KOViewManager::updateWNview() | 282 | void KOViewManager::updateWNview() |
280 | { | 283 | { |
281 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 284 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
282 | mWhatsNextView->updateView(); | 285 | mWhatsNextView->updateView(); |
283 | 286 | ||
284 | } | 287 | } |
285 | void KOViewManager::showWhatsNextView() | 288 | void KOViewManager::showWhatsNextView() |
286 | { | 289 | { |
287 | if (!mWhatsNextView) { | 290 | if (!mWhatsNextView) { |
288 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 291 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
289 | "KOViewManager::WhatsNextView"); | 292 | "KOViewManager::WhatsNextView"); |
290 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 293 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
291 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 294 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
292 | addView(mWhatsNextView); | 295 | addView(mWhatsNextView); |
293 | connect(this, SIGNAL( printWNV() ), | 296 | connect(this, SIGNAL( printWNV() ), |
294 | mWhatsNextView, SLOT( printMe() ) ); | 297 | mWhatsNextView, SLOT( printMe() ) ); |
295 | } | 298 | } |
296 | globalFlagBlockAgenda = 1; | 299 | globalFlagBlockAgenda = 1; |
297 | showView(mWhatsNextView, true ); | 300 | showView(mWhatsNextView, true ); |
298 | //mWhatsNextView->updateView(); | 301 | //mWhatsNextView->updateView(); |
299 | 302 | ||
300 | } | 303 | } |
301 | 304 | ||
302 | void KOViewManager::showListView() | 305 | void KOViewManager::showListView() |
303 | { | 306 | { |
304 | if (!mListView) { | 307 | if (!mListView) { |
305 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 308 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
306 | addView(mListView); | 309 | addView(mListView); |
307 | 310 | ||
308 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 311 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
309 | mMainView, SLOT(showIncidence(Incidence *))); | 312 | mMainView, SLOT(showIncidence(Incidence *))); |
310 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 313 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
311 | mMainView, SLOT(editIncidence(Incidence *))); | 314 | mMainView, SLOT(editIncidence(Incidence *))); |
312 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 315 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
313 | mMainView, SLOT(deleteIncidence(Incidence *))); | 316 | mMainView, SLOT(deleteIncidence(Incidence *))); |
314 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 317 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 318 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
316 | connect( mListView, SIGNAL( signalNewEvent() ), | 319 | connect( mListView, SIGNAL( signalNewEvent() ), |
317 | mMainView, SLOT( newEvent() ) ); | 320 | mMainView, SLOT( newEvent() ) ); |
318 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 321 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
319 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 322 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
320 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 323 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
321 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 324 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
322 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 325 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
323 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 326 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
324 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 327 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
325 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 328 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
326 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 329 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
327 | } | 330 | } |
328 | // bool temp = mFlagShowNextxDays; | 331 | // bool temp = mFlagShowNextxDays; |
329 | //globalFlagBlockPainting = true; | 332 | //globalFlagBlockPainting = true; |
330 | globalFlagBlockAgenda = 1; | 333 | globalFlagBlockAgenda = 1; |
331 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 334 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
332 | mMainView->setBlockShowDates( true ); | 335 | mMainView->setBlockShowDates( true ); |
333 | mMainView->dateNavigator()->selectMonth(); | 336 | mMainView->dateNavigator()->selectMonth(); |
334 | mMainView->setBlockShowDates( false ); | 337 | mMainView->setBlockShowDates( false ); |
335 | } | 338 | } |
336 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 339 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
337 | //mFlagShowNextxDays = temp; | 340 | //mFlagShowNextxDays = temp; |
338 | } | 341 | } |
339 | 342 | ||
340 | void KOViewManager::showAgendaView( bool fullScreen ) | 343 | void KOViewManager::showAgendaView( bool fullScreen ) |
341 | { | 344 | { |
342 | 345 | ||
343 | mMainView->dialogManager()->hideSearchDialog(); | 346 | mMainView->dialogManager()->hideSearchDialog(); |
344 | // qDebug("KOViewManager::showAgendaView "); | 347 | // qDebug("KOViewManager::showAgendaView "); |
345 | bool full; | 348 | bool full; |
346 | full = fullScreen; | 349 | full = fullScreen; |
347 | if (!mAgendaView) { | 350 | if (!mAgendaView) { |
348 | full = false; | 351 | full = false; |
349 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 352 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
350 | addView(mAgendaView); | 353 | addView(mAgendaView); |
351 | #ifndef DESKTOP_VERSION | 354 | #ifndef DESKTOP_VERSION |
352 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 355 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
353 | #endif | 356 | #endif |
354 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 357 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
355 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 358 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
356 | 359 | ||
357 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 360 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
358 | 361 | ||
359 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 362 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
360 | 363 | ||
361 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 364 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
362 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 365 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
363 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 366 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
364 | mMainView, SLOT(newEvent(QDateTime))); | 367 | mMainView, SLOT(newEvent(QDateTime))); |
365 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 368 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
366 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 369 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
367 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 370 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
368 | mMainView, SLOT(newEvent(QDate))); | 371 | mMainView, SLOT(newEvent(QDate))); |
369 | 372 | ||
370 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 373 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
371 | mMainView, SLOT(editIncidence(Incidence *))); | 374 | mMainView, SLOT(editIncidence(Incidence *))); |
372 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 375 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
373 | mMainView, SLOT(showIncidence(Incidence *))); | 376 | mMainView, SLOT(showIncidence(Incidence *))); |
374 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 377 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
375 | mMainView, SLOT(deleteIncidence(Incidence *))); | 378 | mMainView, SLOT(deleteIncidence(Incidence *))); |
376 | 379 | ||
377 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 380 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
378 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 381 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
379 | 382 | ||
380 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 383 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
381 | mMainView, SLOT( toggleExpand() ) ); | 384 | mMainView, SLOT( toggleExpand() ) ); |
382 | 385 | ||
383 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 386 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
384 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 387 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
385 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 388 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
386 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 389 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
387 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 390 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
388 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 391 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
389 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 392 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
390 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 393 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
391 | SLOT( updateTodo( Todo *, int ) ) ); | 394 | SLOT( updateTodo( Todo *, int ) ) ); |
392 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 395 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
393 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 396 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
394 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 397 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
395 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 398 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
396 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 399 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
397 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 400 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
398 | mAgendaView->readSettings(); | 401 | mAgendaView->readSettings(); |
399 | mAgendaView->updateConfig(); | 402 | mAgendaView->updateConfig(); |
400 | } | 403 | } |
401 | 404 | ||
402 | showView( mAgendaView, full); | 405 | showView( mAgendaView, full); |
403 | 406 | ||
404 | } | 407 | } |
405 | 408 | ||
406 | void KOViewManager::showDayView() | 409 | void KOViewManager::showDayView() |
407 | { | 410 | { |
408 | mFlagShowNextxDays = false; | 411 | mFlagShowNextxDays = false; |
409 | globalFlagBlockLabel = 1; | 412 | globalFlagBlockLabel = 1; |
410 | globalFlagBlockAgenda = 1; | 413 | globalFlagBlockAgenda = 1; |
411 | if ( mCurrentAgendaView != 1 ) | 414 | if ( mCurrentAgendaView != 1 ) |
412 | mCurrentAgendaView = -1; | 415 | mCurrentAgendaView = -1; |
413 | showAgendaView(); | 416 | showAgendaView(); |
414 | qApp->processEvents(); | 417 | qApp->processEvents(); |
415 | globalFlagBlockAgenda = 2; | 418 | globalFlagBlockAgenda = 2; |
416 | globalFlagBlockLabel = 0; | 419 | globalFlagBlockLabel = 0; |
417 | mMainView->dateNavigator()->selectDates( 1 ); | 420 | mMainView->dateNavigator()->selectDates( 1 ); |
418 | mCurrentAgendaView = 1 ; | 421 | mCurrentAgendaView = 1 ; |
419 | 422 | ||
420 | } | 423 | } |
421 | 424 | ||
422 | void KOViewManager::showWorkWeekView() | 425 | void KOViewManager::showWorkWeekView() |
423 | { | 426 | { |
424 | mFlagShowNextxDays = false; | 427 | mFlagShowNextxDays = false; |
425 | globalFlagBlockAgenda = 1; | 428 | globalFlagBlockAgenda = 1; |
426 | globalFlagBlockLabel = 1; | 429 | globalFlagBlockLabel = 1; |
427 | if ( mCurrentAgendaView != 5 ) | 430 | if ( mCurrentAgendaView != 5 ) |
428 | mCurrentAgendaView = -1; | 431 | mCurrentAgendaView = -1; |
429 | showAgendaView(); | 432 | showAgendaView(); |
430 | qApp->processEvents(); | 433 | qApp->processEvents(); |
431 | globalFlagBlockAgenda = 2; | 434 | globalFlagBlockAgenda = 2; |
432 | globalFlagBlockLabel = 0; | 435 | globalFlagBlockLabel = 0; |
433 | mMainView->dateNavigator()->selectWorkWeek(); | 436 | mMainView->dateNavigator()->selectWorkWeek(); |
434 | mCurrentAgendaView = 5 ; | 437 | mCurrentAgendaView = 5 ; |
435 | 438 | ||
436 | } | 439 | } |
437 | 440 | ||
438 | void KOViewManager::showWeekView() | 441 | void KOViewManager::showWeekView() |
439 | { | 442 | { |
440 | /* | 443 | /* |
441 | globalFlagBlockAgenda = 2; | 444 | globalFlagBlockAgenda = 2; |
442 | qDebug("4globalFlagBlockAgenda = 2; "); | 445 | qDebug("4globalFlagBlockAgenda = 2; "); |
443 | //globalFlagBlockPainting = true; | 446 | //globalFlagBlockPainting = true; |
444 | mMainView->dateNavigator()->selectWeek(); | 447 | mMainView->dateNavigator()->selectWeek(); |
445 | showAgendaView(); | 448 | showAgendaView(); |
446 | */ | 449 | */ |
447 | 450 | ||
448 | 451 | ||
449 | mFlagShowNextxDays = false; | 452 | mFlagShowNextxDays = false; |
450 | globalFlagBlockAgenda = 1; | 453 | globalFlagBlockAgenda = 1; |
451 | globalFlagBlockLabel = 1; | 454 | globalFlagBlockLabel = 1; |
452 | if ( mCurrentAgendaView != 7 ) | 455 | if ( mCurrentAgendaView != 7 ) |
453 | mCurrentAgendaView = -1; | 456 | mCurrentAgendaView = -1; |
454 | showAgendaView(); | 457 | showAgendaView(); |
455 | qApp->processEvents(); | 458 | qApp->processEvents(); |
456 | globalFlagBlockAgenda = 2; | 459 | globalFlagBlockAgenda = 2; |
457 | globalFlagBlockLabel = 0; | 460 | globalFlagBlockLabel = 0; |
458 | mMainView->dateNavigator()->selectWeek(); | 461 | mMainView->dateNavigator()->selectWeek(); |
459 | mCurrentAgendaView = 7 ; | 462 | mCurrentAgendaView = 7 ; |
460 | } | 463 | } |
461 | 464 | ||
462 | void KOViewManager::showNextXView() | 465 | void KOViewManager::showNextXView() |
463 | { | 466 | { |
464 | 467 | ||
465 | globalFlagBlockAgenda = 1; | 468 | globalFlagBlockAgenda = 1; |
466 | if ( mCurrentAgendaView != 3 ) | 469 | if ( mCurrentAgendaView != 3 ) |
467 | mCurrentAgendaView = -1; | 470 | mCurrentAgendaView = -1; |
468 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 471 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
469 | globalFlagBlockAgenda = 2; | 472 | globalFlagBlockAgenda = 2; |
470 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 473 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
471 | KOPrefs::instance()->mNextXDays ); | 474 | KOPrefs::instance()->mNextXDays ); |
472 | mFlagShowNextxDays = true; | 475 | mFlagShowNextxDays = true; |
473 | mCurrentAgendaView = 3 ; | 476 | mCurrentAgendaView = 3 ; |
474 | } | 477 | } |
475 | bool KOViewManager::showsNextDays() | 478 | bool KOViewManager::showsNextDays() |
476 | { | 479 | { |
477 | return mFlagShowNextxDays; | 480 | return mFlagShowNextxDays; |
478 | } | 481 | } |
479 | void KOViewManager::showMonthView() | 482 | void KOViewManager::showMonthView() |
480 | { | 483 | { |
481 | if (!mMonthView) { | 484 | if (!mMonthView) { |
482 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 485 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
483 | 486 | ||
484 | addView(mMonthView); | 487 | addView(mMonthView); |
485 | // mMonthView->show(); | 488 | // mMonthView->show(); |
486 | // SIGNALS/SLOTS FOR MONTH VIEW | 489 | // SIGNALS/SLOTS FOR MONTH VIEW |
487 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 490 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
488 | mMainView, SLOT(newEvent(QDateTime))); | 491 | mMainView, SLOT(newEvent(QDateTime))); |
489 | 492 | ||
490 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 493 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
491 | mMainView, SLOT(showIncidence(Incidence *))); | 494 | mMainView, SLOT(showIncidence(Incidence *))); |
492 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 495 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
493 | mMainView, SLOT(editIncidence(Incidence *))); | 496 | mMainView, SLOT(editIncidence(Incidence *))); |
494 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 497 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
495 | mMainView, SLOT(deleteIncidence(Incidence *))); | 498 | mMainView, SLOT(deleteIncidence(Incidence *))); |
496 | 499 | ||
497 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 500 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
498 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 501 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
499 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 502 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
500 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 503 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
501 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 504 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
502 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 505 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
503 | 506 | ||
504 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 507 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
505 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 508 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
506 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 509 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
507 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 510 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
508 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 511 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
509 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 512 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
510 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 513 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
511 | mMainView, SLOT ( showDay( QDate ) ) ); | 514 | mMainView, SLOT ( showDay( QDate ) ) ); |
512 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 515 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
513 | connect( mMonthView, SIGNAL(nextMonth() ), | 516 | connect( mMonthView, SIGNAL(nextMonth() ), |
514 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 517 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
515 | connect( mMonthView, SIGNAL(prevMonth() ), | 518 | connect( mMonthView, SIGNAL(prevMonth() ), |
516 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 519 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
517 | mMonthView->updateConfig(); | 520 | mMonthView->updateConfig(); |
518 | } | 521 | } |
519 | 522 | ||
520 | globalFlagBlockAgenda = 1; | 523 | globalFlagBlockAgenda = 1; |
521 | //mFlagShowNextxDays = false; | 524 | //mFlagShowNextxDays = false; |
522 | // if(mMonthView == mCurrentView) return; | 525 | // if(mMonthView == mCurrentView) return; |
526 | mMainView->dateNavigator()->blockSignals( true ); | ||
523 | mMainView->dateNavigator()->selectMonth(); | 527 | mMainView->dateNavigator()->selectMonth(); |
528 | mMainView->dateNavigator()->blockSignals( false); | ||
524 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 529 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
525 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 530 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
526 | 531 | ||
527 | showView(mMonthView, true ); | 532 | showView(mMonthView, true ); |
528 | 533 | ||
529 | } | 534 | } |
530 | 535 | ||
531 | void KOViewManager::showTodoView() | 536 | void KOViewManager::showTodoView() |
532 | { | 537 | { |
533 | //mFlagShowNextxDays = false; | 538 | //mFlagShowNextxDays = false; |
534 | if ( !mTodoView ) { | 539 | if ( !mTodoView ) { |
535 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 540 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
536 | "KOViewManager::TodoView" ); | 541 | "KOViewManager::TodoView" ); |
537 | 542 | ||
538 | addView( mTodoView ); | 543 | addView( mTodoView ); |
539 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 544 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
540 | 545 | ||
541 | // SIGNALS/SLOTS FOR TODO VIEW | 546 | // SIGNALS/SLOTS FOR TODO VIEW |
542 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 547 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
543 | mMainView, SLOT( newTodo() ) ); | 548 | mMainView, SLOT( newTodo() ) ); |
544 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 549 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
545 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 550 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
546 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 551 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
547 | mMainView, SLOT( showTodo( Todo * ) ) ); | 552 | mMainView, SLOT( showTodo( Todo * ) ) ); |
548 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 553 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
549 | mMainView, SLOT( editTodo( Todo * ) ) ); | 554 | mMainView, SLOT( editTodo( Todo * ) ) ); |
550 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 555 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
551 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 556 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
552 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 557 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
553 | mMainView, SLOT( purgeCompleted() ) ); | 558 | mMainView, SLOT( purgeCompleted() ) ); |
554 | 559 | ||
555 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 560 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
556 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 561 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
557 | 562 | ||
558 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 563 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
559 | SLOT( updateConfig() ) ); | 564 | SLOT( updateConfig() ) ); |
560 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 565 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
561 | SLOT( updateTodo( Todo *, int ) ) ); | 566 | SLOT( updateTodo( Todo *, int ) ) ); |
562 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 567 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
563 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 568 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
564 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 569 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
565 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 570 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
566 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 571 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
567 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 572 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
568 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 573 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
569 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 574 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
570 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 575 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
571 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 576 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
572 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 577 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
573 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 578 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
574 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 579 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
575 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 580 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
576 | KConfig *config = KOGlobals::config(); | 581 | KConfig *config = KOGlobals::config(); |
577 | mTodoView->restoreLayout(config,"Todo View"); | 582 | mTodoView->restoreLayout(config,"Todo View"); |
578 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 583 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
579 | } | 584 | } |
580 | 585 | ||
581 | globalFlagBlockAgenda = 1; | 586 | globalFlagBlockAgenda = 1; |
582 | showView( mTodoView, true ); | 587 | showView( mTodoView, true ); |
583 | 588 | ||
584 | } | 589 | } |
585 | 590 | ||
586 | void KOViewManager::showJournalView() | 591 | void KOViewManager::showJournalView() |
587 | { | 592 | { |
588 | //mFlagShowNextxDays = false; | 593 | //mFlagShowNextxDays = false; |
589 | if (!mJournalView) { | 594 | if (!mJournalView) { |
590 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 595 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
591 | "KOViewManager::JournalView"); | 596 | "KOViewManager::JournalView"); |
592 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 597 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
593 | SLOT( updateConfig() ) ); | 598 | SLOT( updateConfig() ) ); |
594 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 599 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
595 | addView(mJournalView); | 600 | addView(mJournalView); |
596 | } | 601 | } |
597 | 602 | ||
598 | showView(mJournalView); | 603 | showView(mJournalView); |
599 | } | 604 | } |
600 | 605 | ||
601 | void KOViewManager::showTimeSpanView() | 606 | void KOViewManager::showTimeSpanView() |
602 | { | 607 | { |
603 | //mFlagShowNextxDays = false; | 608 | //mFlagShowNextxDays = false; |
604 | if (!mTimeSpanView) { | 609 | if (!mTimeSpanView) { |
605 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 610 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
606 | "KOViewManager::TimeSpanView"); | 611 | "KOViewManager::TimeSpanView"); |
607 | addView(mTimeSpanView); | 612 | addView(mTimeSpanView); |
608 | 613 | ||
609 | mTimeSpanView->readSettings(); | 614 | mTimeSpanView->readSettings(); |
610 | } | 615 | } |
611 | 616 | ||
612 | showView(mTimeSpanView); | 617 | showView(mTimeSpanView); |
613 | } | 618 | } |
614 | 619 | ||
615 | Incidence *KOViewManager::currentSelection() | 620 | Incidence *KOViewManager::currentSelection() |
616 | { | 621 | { |
617 | if (!mCurrentView) return 0; | 622 | if (!mCurrentView) return 0; |
618 | if ( mCurrentView == mListView ) { | 623 | if ( mCurrentView == mListView ) { |
619 | if ( mListView->currentItem() ) | 624 | if ( mListView->currentItem() ) |
620 | return mListView->currentItem(); | 625 | return mListView->currentItem(); |
621 | } | 626 | } |
622 | return mCurrentView->selectedIncidences().first(); | 627 | return mCurrentView->selectedIncidences().first(); |
623 | } | 628 | } |
624 | 629 | ||
625 | QDate KOViewManager::currentSelectionDate() | 630 | QDate KOViewManager::currentSelectionDate() |
626 | { | 631 | { |
627 | QDate qd; | 632 | QDate qd; |
628 | if (mCurrentView) { | 633 | if (mCurrentView) { |
629 | DateList qvl = mCurrentView->selectedDates(); | 634 | DateList qvl = mCurrentView->selectedDates(); |
630 | if (!qvl.isEmpty()) qd = qvl.first(); | 635 | if (!qvl.isEmpty()) qd = qvl.first(); |
631 | } | 636 | } |
632 | return qd; | 637 | return qd; |
633 | } | 638 | } |
634 | 639 | ||
635 | void KOViewManager::addView(KOrg::BaseView *view) | 640 | void KOViewManager::addView(KOrg::BaseView *view) |
636 | { | 641 | { |
637 | #if QT_VERSION >= 0x030000 | 642 | #if QT_VERSION >= 0x030000 |
638 | mMainView->viewStack()->addWidget( view ); | 643 | mMainView->viewStack()->addWidget( view ); |
639 | #else | 644 | #else |
640 | mMainView->viewStack()->addWidget( view, 1 ); | 645 | mMainView->viewStack()->addWidget( view, 1 ); |
641 | #endif | 646 | #endif |
642 | } | 647 | } |
643 | 648 | ||
644 | void KOViewManager::setDocumentId( const QString &id ) | 649 | void KOViewManager::setDocumentId( const QString &id ) |
645 | { | 650 | { |
646 | if (mTodoView) mTodoView->setDocumentId( id ); | 651 | if (mTodoView) mTodoView->setDocumentId( id ); |
647 | } | 652 | } |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 137eb2d..66ab138 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,118 +1,118 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | 70 | ||
71 | void raiseCurrentView( bool fullScreen = false ); | 71 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); |
72 | 72 | ||
73 | void addView(KOrg::BaseView *); | 73 | void addView(KOrg::BaseView *); |
74 | 74 | ||
75 | Incidence *currentSelection(); | 75 | Incidence *currentSelection(); |
76 | QDate currentSelectionDate(); | 76 | QDate currentSelectionDate(); |
77 | 77 | ||
78 | KOAgendaView *agendaView() const { return mAgendaView; } | 78 | KOAgendaView *agendaView() const { return mAgendaView; } |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void printWNV(); | 81 | void printWNV(); |
82 | void signalFullScreen( bool ); | 82 | void signalFullScreen( bool ); |
83 | void signalAgendaView( bool ); | 83 | void signalAgendaView( bool ); |
84 | public slots: | 84 | public slots: |
85 | void showDateView( int, QDate ); | 85 | void showDateView( int, QDate ); |
86 | void updateView(); | 86 | void updateView(); |
87 | void showWhatsNextView(); | 87 | void showWhatsNextView(); |
88 | void showListView(); | 88 | void showListView(); |
89 | void showAgendaView( bool fullScreen = false ); | 89 | void showAgendaView( bool fullScreen = false ); |
90 | void showDayView(); | 90 | void showDayView(); |
91 | void showWorkWeekView(); | 91 | void showWorkWeekView(); |
92 | void showWeekView(); | 92 | void showWeekView(); |
93 | void showNextXView(); | 93 | void showNextXView(); |
94 | void showMonthView(); | 94 | void showMonthView(); |
95 | void showTodoView(); | 95 | void showTodoView(); |
96 | void showJournalView(); | 96 | void showJournalView(); |
97 | void showTimeSpanView(); | 97 | void showTimeSpanView(); |
98 | 98 | ||
99 | private: | 99 | private: |
100 | CalendarView *mMainView; | 100 | CalendarView *mMainView; |
101 | 101 | ||
102 | int mCurrentAgendaView; | 102 | int mCurrentAgendaView; |
103 | KOAgendaView *mAgendaView; | 103 | KOAgendaView *mAgendaView; |
104 | KOListView *mListView; | 104 | KOListView *mListView; |
105 | KOMonthView *mMonthView; | 105 | KOMonthView *mMonthView; |
106 | KOTodoView *mTodoView; | 106 | KOTodoView *mTodoView; |
107 | KOWhatsNextView *mWhatsNextView; | 107 | KOWhatsNextView *mWhatsNextView; |
108 | KOJournalView *mJournalView; | 108 | KOJournalView *mJournalView; |
109 | KOTimeSpanView *mTimeSpanView; | 109 | KOTimeSpanView *mTimeSpanView; |
110 | 110 | ||
111 | KOrg::BaseView *mCurrentView; // currently active event view | 111 | KOrg::BaseView *mCurrentView; // currently active event view |
112 | 112 | ||
113 | int mAgendaViewMode; | 113 | int mAgendaViewMode; |
114 | bool mFlagShowNextxDays; | 114 | bool mFlagShowNextxDays; |
115 | 115 | ||
116 | }; | 116 | }; |
117 | 117 | ||
118 | #endif | 118 | #endif |