summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-26 23:05:26 (UTC)
committer zautrix <zautrix>2005-01-26 23:05:26 (UTC)
commit15351333eff09beadb6e691e9f0aab2aaf0a95a0 (patch) (unidiff)
tree443fba1e36ef3a2549b531fe600567d9e1232d7c
parent96fc3903cf690957d0242d7aa2894bd64800edcc (diff)
downloadkdepimpi-15351333eff09beadb6e691e9f0aab2aaf0a95a0.zip
kdepimpi-15351333eff09beadb6e691e9f0aab2aaf0a95a0.tar.gz
kdepimpi-15351333eff09beadb6e691e9f0aab2aaf0a95a0.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/koagendaview.cpp37
-rw-r--r--korganizer/koagendaview.h7
-rw-r--r--korganizer/kodialogmanager.cpp7
4 files changed, 51 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 06454c2..1d5a57e 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2004,1042 +2004,1042 @@ void CalendarView::readFilterSettings(KConfig *config)
2004 // We do it manually to avoid it being done twice by the above calls 2004 // We do it manually to avoid it being done twice by the above calls
2005 updateFilter(); 2005 updateFilter();
2006} 2006}
2007 2007
2008void CalendarView::writeFilterSettings(KConfig *config) 2008void CalendarView::writeFilterSettings(KConfig *config)
2009{ 2009{
2010 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2010 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2011 2011
2012 QStringList filterList; 2012 QStringList filterList;
2013 2013
2014 CalFilter *filter = mFilters.first(); 2014 CalFilter *filter = mFilters.first();
2015 while(filter) { 2015 while(filter) {
2016 // kdDebug() << " fn: " << filter->name() << endl; 2016 // kdDebug() << " fn: " << filter->name() << endl;
2017 filterList << filter->name(); 2017 filterList << filter->name();
2018 config->setGroup("Filter_" + filter->name()); 2018 config->setGroup("Filter_" + filter->name());
2019 config->writeEntry("Criteria",filter->criteria()); 2019 config->writeEntry("Criteria",filter->criteria());
2020 config->writeEntry("CategoryList",filter->categoryList()); 2020 config->writeEntry("CategoryList",filter->categoryList());
2021 filter = mFilters.next(); 2021 filter = mFilters.next();
2022 } 2022 }
2023 config->setGroup("General"); 2023 config->setGroup("General");
2024 config->writeEntry("CalendarFilters",filterList); 2024 config->writeEntry("CalendarFilters",filterList);
2025 2025
2026 config->setGroup("FilterView"); 2026 config->setGroup("FilterView");
2027 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2027 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2028 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2028 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2029} 2029}
2030 2030
2031 2031
2032void CalendarView::goToday() 2032void CalendarView::goToday()
2033{ 2033{
2034 if ( mViewManager->currentView()->isMonthView() ) 2034 if ( mViewManager->currentView()->isMonthView() )
2035 mNavigator->selectTodayMonth(); 2035 mNavigator->selectTodayMonth();
2036 else 2036 else
2037 mNavigator->selectToday(); 2037 mNavigator->selectToday();
2038} 2038}
2039 2039
2040void CalendarView::goNext() 2040void CalendarView::goNext()
2041{ 2041{
2042 mNavigator->selectNext(); 2042 mNavigator->selectNext();
2043} 2043}
2044 2044
2045void CalendarView::goPrevious() 2045void CalendarView::goPrevious()
2046{ 2046{
2047 mNavigator->selectPrevious(); 2047 mNavigator->selectPrevious();
2048} 2048}
2049void CalendarView::goNextMonth() 2049void CalendarView::goNextMonth()
2050{ 2050{
2051 mNavigator->selectNextMonth(); 2051 mNavigator->selectNextMonth();
2052} 2052}
2053 2053
2054void CalendarView::goPreviousMonth() 2054void CalendarView::goPreviousMonth()
2055{ 2055{
2056 mNavigator->selectPreviousMonth(); 2056 mNavigator->selectPreviousMonth();
2057} 2057}
2058void CalendarView::writeLocale() 2058void CalendarView::writeLocale()
2059{ 2059{
2060 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2060 //KPimGlobalPrefs::instance()->setGlobalConfig();
2061#if 0 2061#if 0
2062 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2062 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2063 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2063 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2064 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2064 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2065 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2065 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2066 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2066 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2067 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2067 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2068 dummy = KOPrefs::instance()->mUserDateFormatShort; 2068 dummy = KOPrefs::instance()->mUserDateFormatShort;
2069 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2069 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2070 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2070 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2071 KOPrefs::instance()->mDaylightsavingStart, 2071 KOPrefs::instance()->mDaylightsavingStart,
2072 KOPrefs::instance()->mDaylightsavingEnd ); 2072 KOPrefs::instance()->mDaylightsavingEnd );
2073 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2073 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2074#endif 2074#endif
2075} 2075}
2076void CalendarView::updateConfig() 2076void CalendarView::updateConfig()
2077{ 2077{
2078 writeLocale(); 2078 writeLocale();
2079 if ( KOPrefs::instance()->mUseAppColors ) 2079 if ( KOPrefs::instance()->mUseAppColors )
2080 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2080 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2081 emit configChanged(); 2081 emit configChanged();
2082 mTodoList->updateConfig(); 2082 mTodoList->updateConfig();
2083 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2083 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2084 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2084 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2085 // To make the "fill window" configurations work 2085 // To make the "fill window" configurations work
2086 //mViewManager->raiseCurrentView(); 2086 //mViewManager->raiseCurrentView();
2087} 2087}
2088 2088
2089 2089
2090void CalendarView::eventChanged(Event *event) 2090void CalendarView::eventChanged(Event *event)
2091{ 2091{
2092 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2092 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2093 //updateUnmanagedViews(); 2093 //updateUnmanagedViews();
2094} 2094}
2095 2095
2096void CalendarView::eventAdded(Event *event) 2096void CalendarView::eventAdded(Event *event)
2097{ 2097{
2098 changeEventDisplay(event,KOGlobals::EVENTADDED); 2098 changeEventDisplay(event,KOGlobals::EVENTADDED);
2099} 2099}
2100 2100
2101void CalendarView::eventToBeDeleted(Event *) 2101void CalendarView::eventToBeDeleted(Event *)
2102{ 2102{
2103 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2103 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2104} 2104}
2105 2105
2106void CalendarView::eventDeleted() 2106void CalendarView::eventDeleted()
2107{ 2107{
2108 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2108 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2109} 2109}
2110void CalendarView::changeTodoDisplay(Todo *which, int action) 2110void CalendarView::changeTodoDisplay(Todo *which, int action)
2111{ 2111{
2112 changeIncidenceDisplay((Incidence *)which, action); 2112 changeIncidenceDisplay((Incidence *)which, action);
2113 mDateNavigator->updateView(); //LR 2113 mDateNavigator->updateView(); //LR
2114 //mDialogManager->updateSearchDialog(); 2114 //mDialogManager->updateSearchDialog();
2115 2115
2116 if (which) { 2116 if (which) {
2117 mViewManager->updateWNview(); 2117 mViewManager->updateWNview();
2118 //mTodoList->updateView(); 2118 //mTodoList->updateView();
2119 } 2119 }
2120 2120
2121} 2121}
2122 2122
2123void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2123void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2124{ 2124{
2125 updateUnmanagedViews(); 2125 updateUnmanagedViews();
2126 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2126 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2127 if ( action == KOGlobals::EVENTDELETED ) { //delete 2127 if ( action == KOGlobals::EVENTDELETED ) { //delete
2128 mCalendar->checkAlarmForIncidence( 0, true ); 2128 mCalendar->checkAlarmForIncidence( 0, true );
2129 if ( mEventViewerDialog ) 2129 if ( mEventViewerDialog )
2130 mEventViewerDialog->hide(); 2130 mEventViewerDialog->hide();
2131 } 2131 }
2132 else 2132 else
2133 mCalendar->checkAlarmForIncidence( which , false ); 2133 mCalendar->checkAlarmForIncidence( which , false );
2134} 2134}
2135 2135
2136// most of the changeEventDisplays() right now just call the view's 2136// most of the changeEventDisplays() right now just call the view's
2137// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2137// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2138void CalendarView::changeEventDisplay(Event *which, int action) 2138void CalendarView::changeEventDisplay(Event *which, int action)
2139{ 2139{
2140 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2140 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2141 changeIncidenceDisplay((Incidence *)which, action); 2141 changeIncidenceDisplay((Incidence *)which, action);
2142 mDateNavigator->updateView(); 2142 mDateNavigator->updateView();
2143 //mDialogManager->updateSearchDialog(); 2143 //mDialogManager->updateSearchDialog();
2144 2144
2145 if (which) { 2145 if (which) {
2146 // If there is an event view visible update the display 2146 // If there is an event view visible update the display
2147 mViewManager->currentView()->changeEventDisplay(which,action); 2147 mViewManager->currentView()->changeEventDisplay(which,action);
2148 // TODO: check, if update needed 2148 // TODO: check, if update needed
2149 // if (which->getTodoStatus()) { 2149 // if (which->getTodoStatus()) {
2150 mTodoList->updateView(); 2150 mTodoList->updateView();
2151 // } 2151 // }
2152 } else { 2152 } else {
2153 mViewManager->currentView()->updateView(); 2153 mViewManager->currentView()->updateView();
2154 } 2154 }
2155} 2155}
2156 2156
2157 2157
2158void CalendarView::updateTodoViews() 2158void CalendarView::updateTodoViews()
2159{ 2159{
2160 2160
2161 mTodoList->updateView(); 2161 mTodoList->updateView();
2162 mViewManager->currentView()->updateView(); 2162 mViewManager->currentView()->updateView();
2163 2163
2164} 2164}
2165 2165
2166 2166
2167void CalendarView::updateView(const QDate &start, const QDate &end) 2167void CalendarView::updateView(const QDate &start, const QDate &end)
2168{ 2168{
2169 mTodoList->updateView(); 2169 mTodoList->updateView();
2170 mViewManager->updateView(start, end); 2170 mViewManager->updateView(start, end);
2171 //mDateNavigator->updateView(); 2171 //mDateNavigator->updateView();
2172} 2172}
2173 2173
2174void CalendarView::updateView() 2174void CalendarView::updateView()
2175{ 2175{
2176 DateList tmpList = mNavigator->selectedDates(); 2176 DateList tmpList = mNavigator->selectedDates();
2177 2177
2178 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2178 if ( KOPrefs::instance()->mHideNonStartedTodos )
2179 mTodoList->updateView(); 2179 mTodoList->updateView();
2180 // We assume that the navigator only selects consecutive days. 2180 // We assume that the navigator only selects consecutive days.
2181 updateView( tmpList.first(), tmpList.last() ); 2181 updateView( tmpList.first(), tmpList.last() );
2182} 2182}
2183 2183
2184void CalendarView::updateUnmanagedViews() 2184void CalendarView::updateUnmanagedViews()
2185{ 2185{
2186 mDateNavigator->updateDayMatrix(); 2186 mDateNavigator->updateDayMatrix();
2187} 2187}
2188 2188
2189int CalendarView::msgItemDelete(const QString name) 2189int CalendarView::msgItemDelete(const QString name)
2190{ 2190{
2191 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2191 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2192 i18n("This item will be\npermanently deleted."), 2192 i18n("This item will be\npermanently deleted."),
2193 i18n("KO/Pi Confirmation"),i18n("Delete")); 2193 i18n("KO/Pi Confirmation"),i18n("Delete"));
2194} 2194}
2195 2195
2196 2196
2197void CalendarView::edit_cut() 2197void CalendarView::edit_cut()
2198{ 2198{
2199 Event *anEvent=0; 2199 Event *anEvent=0;
2200 2200
2201 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2201 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2202 2202
2203 if (mViewManager->currentView()->isEventView()) { 2203 if (mViewManager->currentView()->isEventView()) {
2204 if ( incidence && incidence->type() == "Event" ) { 2204 if ( incidence && incidence->type() == "Event" ) {
2205 anEvent = static_cast<Event *>(incidence); 2205 anEvent = static_cast<Event *>(incidence);
2206 } 2206 }
2207 } 2207 }
2208 2208
2209 if (!anEvent) { 2209 if (!anEvent) {
2210 KNotifyClient::beep(); 2210 KNotifyClient::beep();
2211 return; 2211 return;
2212 } 2212 }
2213 DndFactory factory( mCalendar ); 2213 DndFactory factory( mCalendar );
2214 factory.cutEvent(anEvent); 2214 factory.cutEvent(anEvent);
2215 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2215 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2216} 2216}
2217 2217
2218void CalendarView::edit_copy() 2218void CalendarView::edit_copy()
2219{ 2219{
2220 Event *anEvent=0; 2220 Event *anEvent=0;
2221 2221
2222 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2222 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2223 2223
2224 if (mViewManager->currentView()->isEventView()) { 2224 if (mViewManager->currentView()->isEventView()) {
2225 if ( incidence && incidence->type() == "Event" ) { 2225 if ( incidence && incidence->type() == "Event" ) {
2226 anEvent = static_cast<Event *>(incidence); 2226 anEvent = static_cast<Event *>(incidence);
2227 } 2227 }
2228 } 2228 }
2229 2229
2230 if (!anEvent) { 2230 if (!anEvent) {
2231 KNotifyClient::beep(); 2231 KNotifyClient::beep();
2232 return; 2232 return;
2233 } 2233 }
2234 DndFactory factory( mCalendar ); 2234 DndFactory factory( mCalendar );
2235 factory.copyEvent(anEvent); 2235 factory.copyEvent(anEvent);
2236} 2236}
2237 2237
2238void CalendarView::edit_paste() 2238void CalendarView::edit_paste()
2239{ 2239{
2240 QDate date = mNavigator->selectedDates().first(); 2240 QDate date = mNavigator->selectedDates().first();
2241 2241
2242 DndFactory factory( mCalendar ); 2242 DndFactory factory( mCalendar );
2243 Event *pastedEvent = factory.pasteEvent( date ); 2243 Event *pastedEvent = factory.pasteEvent( date );
2244 2244
2245 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2245 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2246} 2246}
2247 2247
2248void CalendarView::edit_options() 2248void CalendarView::edit_options()
2249{ 2249{
2250 mDialogManager->showOptionsDialog(); 2250 mDialogManager->showOptionsDialog();
2251 //writeSettings(); 2251 //writeSettings();
2252} 2252}
2253 2253
2254 2254
2255void CalendarView::slotSelectPickerDate( QDate d) 2255void CalendarView::slotSelectPickerDate( QDate d)
2256{ 2256{
2257 mDateFrame->hide(); 2257 mDateFrame->hide();
2258 if ( mDatePickerMode == 1 ) { 2258 if ( mDatePickerMode == 1 ) {
2259 mNavigator->slotDaySelect( d ); 2259 mNavigator->slotDaySelect( d );
2260 } else if ( mDatePickerMode == 2 ) { 2260 } else if ( mDatePickerMode == 2 ) {
2261 if ( mMoveIncidence->type() == "Todo" ) { 2261 if ( mMoveIncidence->type() == "Todo" ) {
2262 Todo * to = (Todo *) mMoveIncidence; 2262 Todo * to = (Todo *) mMoveIncidence;
2263 QTime tim; 2263 QTime tim;
2264 if ( to->hasDueDate() ) 2264 if ( to->hasDueDate() )
2265 tim = to->dtDue().time(); 2265 tim = to->dtDue().time();
2266 else { 2266 else {
2267 tim = QTime ( 0,0,0 ); 2267 tim = QTime ( 0,0,0 );
2268 to->setFloats( true ); 2268 to->setFloats( true );
2269 to->setHasDueDate( true ); 2269 to->setHasDueDate( true );
2270 } 2270 }
2271 QDateTime dt ( d,tim ); 2271 QDateTime dt ( d,tim );
2272 to->setDtDue( dt ); 2272 to->setDtDue( dt );
2273 todoChanged( to ); 2273 todoChanged( to );
2274 } else { 2274 } else {
2275 if ( mMoveIncidence->doesRecur() ) { 2275 if ( mMoveIncidence->doesRecur() ) {
2276#if 0 2276#if 0
2277 // PENDING implement this 2277 // PENDING implement this
2278 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2278 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2279 mCalendar()->addIncidence( newInc ); 2279 mCalendar()->addIncidence( newInc );
2280 if ( mMoveIncidence->type() == "Todo" ) 2280 if ( mMoveIncidence->type() == "Todo" )
2281 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2281 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2282 else 2282 else
2283 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2283 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2284 mMoveIncidence = newInc; 2284 mMoveIncidence = newInc;
2285 2285
2286#endif 2286#endif
2287 } 2287 }
2288 QTime tim = mMoveIncidence->dtStart().time(); 2288 QTime tim = mMoveIncidence->dtStart().time();
2289 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2289 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2290 QDateTime dt ( d,tim ); 2290 QDateTime dt ( d,tim );
2291 mMoveIncidence->setDtStart( dt ); 2291 mMoveIncidence->setDtStart( dt );
2292 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2292 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2293 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2293 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2294 } 2294 }
2295 2295
2296 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2296 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2297 } 2297 }
2298} 2298}
2299 2299
2300void CalendarView::removeCategories() 2300void CalendarView::removeCategories()
2301{ 2301{
2302 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2302 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2303 QStringList catList = KOPrefs::instance()->mCustomCategories; 2303 QStringList catList = KOPrefs::instance()->mCustomCategories;
2304 QStringList catIncList; 2304 QStringList catIncList;
2305 QStringList newCatList; 2305 QStringList newCatList;
2306 Incidence* inc = incList.first(); 2306 Incidence* inc = incList.first();
2307 int i; 2307 int i;
2308 int count = 0; 2308 int count = 0;
2309 while ( inc ) { 2309 while ( inc ) {
2310 newCatList.clear(); 2310 newCatList.clear();
2311 catIncList = inc->categories() ; 2311 catIncList = inc->categories() ;
2312 for( i = 0; i< catIncList.count(); ++i ) { 2312 for( i = 0; i< catIncList.count(); ++i ) {
2313 if ( catList.contains (catIncList[i])) 2313 if ( catList.contains (catIncList[i]))
2314 newCatList.append( catIncList[i] ); 2314 newCatList.append( catIncList[i] );
2315 } 2315 }
2316 newCatList.sort(); 2316 newCatList.sort();
2317 inc->setCategories( newCatList.join(",") ); 2317 inc->setCategories( newCatList.join(",") );
2318 inc = incList.next(); 2318 inc = incList.next();
2319 } 2319 }
2320} 2320}
2321 2321
2322int CalendarView::addCategories() 2322int CalendarView::addCategories()
2323{ 2323{
2324 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2324 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2325 QStringList catList = KOPrefs::instance()->mCustomCategories; 2325 QStringList catList = KOPrefs::instance()->mCustomCategories;
2326 QStringList catIncList; 2326 QStringList catIncList;
2327 Incidence* inc = incList.first(); 2327 Incidence* inc = incList.first();
2328 int i; 2328 int i;
2329 int count = 0; 2329 int count = 0;
2330 while ( inc ) { 2330 while ( inc ) {
2331 catIncList = inc->categories() ; 2331 catIncList = inc->categories() ;
2332 for( i = 0; i< catIncList.count(); ++i ) { 2332 for( i = 0; i< catIncList.count(); ++i ) {
2333 if ( !catList.contains (catIncList[i])) { 2333 if ( !catList.contains (catIncList[i])) {
2334 catList.append( catIncList[i] ); 2334 catList.append( catIncList[i] );
2335 //qDebug("add cat %s ", catIncList[i].latin1()); 2335 //qDebug("add cat %s ", catIncList[i].latin1());
2336 ++count; 2336 ++count;
2337 } 2337 }
2338 } 2338 }
2339 inc = incList.next(); 2339 inc = incList.next();
2340 } 2340 }
2341 catList.sort(); 2341 catList.sort();
2342 KOPrefs::instance()->mCustomCategories = catList; 2342 KOPrefs::instance()->mCustomCategories = catList;
2343 return count; 2343 return count;
2344} 2344}
2345 2345
2346void CalendarView::manageCategories() 2346void CalendarView::manageCategories()
2347{ 2347{
2348 KOCatPrefs* cp = new KOCatPrefs(); 2348 KOCatPrefs* cp = new KOCatPrefs();
2349 cp->show(); 2349 cp->show();
2350 int w =cp->sizeHint().width() ; 2350 int w =cp->sizeHint().width() ;
2351 int h = cp->sizeHint().height() ; 2351 int h = cp->sizeHint().height() ;
2352 int dw = QApplication::desktop()->width(); 2352 int dw = QApplication::desktop()->width();
2353 int dh = QApplication::desktop()->height(); 2353 int dh = QApplication::desktop()->height();
2354 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2354 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2355 if ( !cp->exec() ) { 2355 if ( !cp->exec() ) {
2356 delete cp; 2356 delete cp;
2357 return; 2357 return;
2358 } 2358 }
2359 int count = 0; 2359 int count = 0;
2360 if ( cp->addCat() ) { 2360 if ( cp->addCat() ) {
2361 count = addCategories(); 2361 count = addCategories();
2362 if ( count ) { 2362 if ( count ) {
2363 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2363 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2364 writeSettings(); 2364 writeSettings();
2365 } else 2365 } else
2366 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2366 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2367 } else { 2367 } else {
2368 removeCategories(); 2368 removeCategories();
2369 updateView(); 2369 updateView();
2370 } 2370 }
2371 delete cp; 2371 delete cp;
2372} 2372}
2373 2373
2374void CalendarView::beamIncidence(Incidence * Inc) 2374void CalendarView::beamIncidence(Incidence * Inc)
2375{ 2375{
2376 QPtrList<Incidence> delSel ; 2376 QPtrList<Incidence> delSel ;
2377 delSel.append(Inc); 2377 delSel.append(Inc);
2378 beamIncidenceList( delSel ); 2378 beamIncidenceList( delSel );
2379} 2379}
2380void CalendarView::beamCalendar() 2380void CalendarView::beamCalendar()
2381{ 2381{
2382 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2382 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2383 //qDebug("beamCalendar() "); 2383 //qDebug("beamCalendar() ");
2384 beamIncidenceList( delSel ); 2384 beamIncidenceList( delSel );
2385} 2385}
2386void CalendarView::beamFilteredCalendar() 2386void CalendarView::beamFilteredCalendar()
2387{ 2387{
2388 QPtrList<Incidence> delSel = mCalendar->incidences(); 2388 QPtrList<Incidence> delSel = mCalendar->incidences();
2389 //qDebug("beamFilteredCalendar() "); 2389 //qDebug("beamFilteredCalendar() ");
2390 beamIncidenceList( delSel ); 2390 beamIncidenceList( delSel );
2391} 2391}
2392void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2392void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2393{ 2393{
2394 if ( beamDialog->exec () == QDialog::Rejected ) 2394 if ( beamDialog->exec () == QDialog::Rejected )
2395 return; 2395 return;
2396#ifdef DESKTOP_VERSION 2396#ifdef DESKTOP_VERSION
2397 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2397 QString fn = locateLocal( "tmp", "kopibeamfile" );
2398#else 2398#else
2399 QString fn = "/tmp/kopibeamfile"; 2399 QString fn = "/tmp/kopibeamfile";
2400#endif 2400#endif
2401 QString mes; 2401 QString mes;
2402 bool createbup = true; 2402 bool createbup = true;
2403 if ( createbup ) { 2403 if ( createbup ) {
2404 QString description = "\n"; 2404 QString description = "\n";
2405 CalendarLocal* cal = new CalendarLocal(); 2405 CalendarLocal* cal = new CalendarLocal();
2406 if ( beamDialog->beamLocal() ) 2406 if ( beamDialog->beamLocal() )
2407 cal->setLocalTime(); 2407 cal->setLocalTime();
2408 else 2408 else
2409 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2409 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2410 Incidence *incidence = delSel.first(); 2410 Incidence *incidence = delSel.first();
2411 bool addText = false; 2411 bool addText = false;
2412 if ( delSel.count() < 10 ) 2412 if ( delSel.count() < 10 )
2413 addText = true; 2413 addText = true;
2414 else { 2414 else {
2415 description.sprintf(i18n(" %d items?"),delSel.count() ); 2415 description.sprintf(i18n(" %d items?"),delSel.count() );
2416 } 2416 }
2417 while ( incidence ) { 2417 while ( incidence ) {
2418 Incidence *in = incidence->clone(); 2418 Incidence *in = incidence->clone();
2419 if ( ! in->summary().isEmpty() ) { 2419 if ( ! in->summary().isEmpty() ) {
2420 in->setDescription(""); 2420 in->setDescription("");
2421 } else { 2421 } else {
2422 in->setSummary( in->description().left(20)); 2422 in->setSummary( in->description().left(20));
2423 in->setDescription(""); 2423 in->setDescription("");
2424 } 2424 }
2425 if ( addText ) 2425 if ( addText )
2426 description += in->summary() + "\n"; 2426 description += in->summary() + "\n";
2427 cal->addIncidence( in ); 2427 cal->addIncidence( in );
2428 incidence = delSel.next(); 2428 incidence = delSel.next();
2429 } 2429 }
2430 if ( beamDialog->beamVcal() ) { 2430 if ( beamDialog->beamVcal() ) {
2431 fn += ".vcs"; 2431 fn += ".vcs";
2432 FileStorage storage( cal, fn, new VCalFormat ); 2432 FileStorage storage( cal, fn, new VCalFormat );
2433 storage.save(); 2433 storage.save();
2434 } else { 2434 } else {
2435 fn += ".ics"; 2435 fn += ".ics";
2436 FileStorage storage( cal, fn, new ICalFormat( ) ); 2436 FileStorage storage( cal, fn, new ICalFormat( ) );
2437 storage.save(); 2437 storage.save();
2438 } 2438 }
2439 delete cal; 2439 delete cal;
2440 mes = i18n("KO/Pi: Ready for beaming"); 2440 mes = i18n("KO/Pi: Ready for beaming");
2441 topLevelWidget()->setCaption(mes); 2441 topLevelWidget()->setCaption(mes);
2442 KApplication::convert2latin1( fn ); 2442 KApplication::convert2latin1( fn );
2443#ifndef DESKTOP_VERSION 2443#ifndef DESKTOP_VERSION
2444 Ir *ir = new Ir( this ); 2444 Ir *ir = new Ir( this );
2445 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2445 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2446 ir->send( fn, description, "text/x-vCalendar" ); 2446 ir->send( fn, description, "text/x-vCalendar" );
2447#endif 2447#endif
2448 } 2448 }
2449} 2449}
2450void CalendarView::beamDone( Ir *ir ) 2450void CalendarView::beamDone( Ir *ir )
2451{ 2451{
2452#ifndef DESKTOP_VERSION 2452#ifndef DESKTOP_VERSION
2453 delete ir; 2453 delete ir;
2454#endif 2454#endif
2455 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2455 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2456 topLevelWidget()->raise(); 2456 topLevelWidget()->raise();
2457} 2457}
2458 2458
2459void CalendarView::moveIncidence(Incidence * inc ) 2459void CalendarView::moveIncidence(Incidence * inc )
2460{ 2460{
2461 if ( !inc ) return; 2461 if ( !inc ) return;
2462 // qDebug("showDatePickerForIncidence( ) "); 2462 // qDebug("showDatePickerForIncidence( ) ");
2463 if ( mDateFrame->isVisible() ) 2463 if ( mDateFrame->isVisible() )
2464 mDateFrame->hide(); 2464 mDateFrame->hide();
2465 else { 2465 else {
2466 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2466 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2467 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2467 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2468 int dw = QApplication::desktop()->width(); 2468 int dw = QApplication::desktop()->width();
2469 int dh = QApplication::desktop()->height(); 2469 int dh = QApplication::desktop()->height();
2470 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2470 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2471 mDateFrame->show(); 2471 mDateFrame->show();
2472 } 2472 }
2473 mDatePickerMode = 2; 2473 mDatePickerMode = 2;
2474 mMoveIncidence = inc ; 2474 mMoveIncidence = inc ;
2475 QDate da; 2475 QDate da;
2476 if ( mMoveIncidence->type() == "Todo" ) { 2476 if ( mMoveIncidence->type() == "Todo" ) {
2477 Todo * to = (Todo *) mMoveIncidence; 2477 Todo * to = (Todo *) mMoveIncidence;
2478 if ( to->hasDueDate() ) 2478 if ( to->hasDueDate() )
2479 da = to->dtDue().date(); 2479 da = to->dtDue().date();
2480 else 2480 else
2481 da = QDate::currentDate(); 2481 da = QDate::currentDate();
2482 } else { 2482 } else {
2483 da = mMoveIncidence->dtStart().date(); 2483 da = mMoveIncidence->dtStart().date();
2484 } 2484 }
2485 //PENDING set date for recurring incidence to date of recurrence 2485 //PENDING set date for recurring incidence to date of recurrence
2486 //mMoveIncidenceOldDate; 2486 //mMoveIncidenceOldDate;
2487 mDatePicker->setDate( da ); 2487 mDatePicker->setDate( da );
2488} 2488}
2489void CalendarView::showDatePicker( ) 2489void CalendarView::showDatePicker( )
2490{ 2490{
2491 //qDebug("CalendarView::showDatePicker( ) "); 2491 //qDebug("CalendarView::showDatePicker( ) ");
2492 if ( mDateFrame->isVisible() ) 2492 if ( mDateFrame->isVisible() )
2493 mDateFrame->hide(); 2493 mDateFrame->hide();
2494 else { 2494 else {
2495 int w =mDatePicker->sizeHint().width() ; 2495 int w =mDatePicker->sizeHint().width() ;
2496 int h = mDatePicker->sizeHint().height() ; 2496 int h = mDatePicker->sizeHint().height() ;
2497 int dw = QApplication::desktop()->width(); 2497 int dw = QApplication::desktop()->width();
2498 int dh = QApplication::desktop()->height(); 2498 int dh = QApplication::desktop()->height();
2499 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2499 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2500 mDateFrame->show(); 2500 mDateFrame->show();
2501 } 2501 }
2502 mDatePickerMode = 1; 2502 mDatePickerMode = 1;
2503 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2503 mDatePicker->setDate( mNavigator->selectedDates().first() );
2504} 2504}
2505 2505
2506void CalendarView::showEventEditor() 2506void CalendarView::showEventEditor()
2507{ 2507{
2508#ifdef DESKTOP_VERSION 2508#ifdef DESKTOP_VERSION
2509 mEventEditor->show(); 2509 mEventEditor->show();
2510#else 2510#else
2511 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2511 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2512 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2512 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2513 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2513 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2514 delete mEventEditor; 2514 delete mEventEditor;
2515 mEventEditor = mDialogManager->getEventEditor(); 2515 mEventEditor = mDialogManager->getEventEditor();
2516 topLevelWidget()->setCaption( i18n("") );
2516 } 2517 }
2517 mEventEditor->showMaximized(); 2518 mEventEditor->showMaximized();
2518 topLevelWidget()->setCaption( i18n("") );
2519#endif 2519#endif
2520} 2520}
2521void CalendarView::showTodoEditor() 2521void CalendarView::showTodoEditor()
2522{ 2522{
2523#ifdef DESKTOP_VERSION 2523#ifdef DESKTOP_VERSION
2524 mTodoEditor->show(); 2524 mTodoEditor->show();
2525#else 2525#else
2526 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2526 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2527 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2527 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2528 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2528 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2529 delete mTodoEditor; 2529 delete mTodoEditor;
2530 mTodoEditor = mDialogManager->getTodoEditor(); 2530 mTodoEditor = mDialogManager->getTodoEditor();
2531 topLevelWidget()->setCaption( i18n("") );
2531 } 2532 }
2532 mTodoEditor->showMaximized(); 2533 mTodoEditor->showMaximized();
2533 topLevelWidget()->setCaption( i18n("") );
2534#endif 2534#endif
2535} 2535}
2536 2536
2537void CalendarView::cloneIncidence() 2537void CalendarView::cloneIncidence()
2538{ 2538{
2539 Incidence *incidence = currentSelection(); 2539 Incidence *incidence = currentSelection();
2540 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2540 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2541 if ( incidence ) { 2541 if ( incidence ) {
2542 cloneIncidence(incidence); 2542 cloneIncidence(incidence);
2543 } 2543 }
2544} 2544}
2545void CalendarView::moveIncidence() 2545void CalendarView::moveIncidence()
2546{ 2546{
2547 Incidence *incidence = currentSelection(); 2547 Incidence *incidence = currentSelection();
2548 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2548 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2549 if ( incidence ) { 2549 if ( incidence ) {
2550 moveIncidence(incidence); 2550 moveIncidence(incidence);
2551 } 2551 }
2552} 2552}
2553void CalendarView::beamIncidence() 2553void CalendarView::beamIncidence()
2554{ 2554{
2555 Incidence *incidence = currentSelection(); 2555 Incidence *incidence = currentSelection();
2556 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2556 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2557 if ( incidence ) { 2557 if ( incidence ) {
2558 beamIncidence(incidence); 2558 beamIncidence(incidence);
2559 } 2559 }
2560} 2560}
2561void CalendarView::toggleCancelIncidence() 2561void CalendarView::toggleCancelIncidence()
2562{ 2562{
2563 Incidence *incidence = currentSelection(); 2563 Incidence *incidence = currentSelection();
2564 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2564 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2565 if ( incidence ) { 2565 if ( incidence ) {
2566 cancelIncidence(incidence); 2566 cancelIncidence(incidence);
2567 } 2567 }
2568} 2568}
2569 2569
2570 2570
2571void CalendarView::cancelIncidence(Incidence * inc ) 2571void CalendarView::cancelIncidence(Incidence * inc )
2572{ 2572{
2573 inc->setCancelled( ! inc->cancelled() ); 2573 inc->setCancelled( ! inc->cancelled() );
2574 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2574 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2575 updateView(); 2575 updateView();
2576} 2576}
2577void CalendarView::cloneIncidence(Incidence * orgInc ) 2577void CalendarView::cloneIncidence(Incidence * orgInc )
2578{ 2578{
2579 Incidence * newInc = orgInc->clone(); 2579 Incidence * newInc = orgInc->clone();
2580 newInc->recreate(); 2580 newInc->recreate();
2581 2581
2582 if ( newInc->type() == "Todo" ) { 2582 if ( newInc->type() == "Todo" ) {
2583 Todo* t = (Todo*) newInc; 2583 Todo* t = (Todo*) newInc;
2584 showTodoEditor(); 2584 showTodoEditor();
2585 mTodoEditor->editTodo( t ); 2585 mTodoEditor->editTodo( t );
2586 if ( mTodoEditor->exec() ) { 2586 if ( mTodoEditor->exec() ) {
2587 mCalendar->addTodo( t ); 2587 mCalendar->addTodo( t );
2588 updateView(); 2588 updateView();
2589 } else { 2589 } else {
2590 delete t; 2590 delete t;
2591 } 2591 }
2592 } 2592 }
2593 else { 2593 else {
2594 Event* e = (Event*) newInc; 2594 Event* e = (Event*) newInc;
2595 showEventEditor(); 2595 showEventEditor();
2596 mEventEditor->editEvent( e ); 2596 mEventEditor->editEvent( e );
2597 if ( mEventEditor->exec() ) { 2597 if ( mEventEditor->exec() ) {
2598 mCalendar->addEvent( e ); 2598 mCalendar->addEvent( e );
2599 updateView(); 2599 updateView();
2600 } else { 2600 } else {
2601 delete e; 2601 delete e;
2602 } 2602 }
2603 } 2603 }
2604} 2604}
2605 2605
2606void CalendarView::newEvent() 2606void CalendarView::newEvent()
2607{ 2607{
2608 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2608 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2609 KOAgendaView *aView = mViewManager->agendaView(); 2609 KOAgendaView *aView = mViewManager->agendaView();
2610 if (aView) { 2610 if (aView) {
2611 if (aView->selectionStart().isValid()) { 2611 if (aView->selectionStart().isValid()) {
2612 if (aView->selectedIsAllDay()) { 2612 if (aView->selectedIsAllDay()) {
2613 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2613 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2614 } else { 2614 } else {
2615 newEvent(aView->selectionStart(),aView->selectionEnd()); 2615 newEvent(aView->selectionStart(),aView->selectionEnd());
2616 } 2616 }
2617 return; 2617 return;
2618 } 2618 }
2619 } 2619 }
2620 2620
2621 QDate date = mNavigator->selectedDates().first(); 2621 QDate date = mNavigator->selectedDates().first();
2622 QDateTime current = QDateTime::currentDateTime(); 2622 QDateTime current = QDateTime::currentDateTime();
2623 if ( date <= current.date() ) { 2623 if ( date <= current.date() ) {
2624 int hour = current.time().hour() +1; 2624 int hour = current.time().hour() +1;
2625 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2625 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2626 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2626 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2627 } else 2627 } else
2628 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2628 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2629 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2629 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2630 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2630 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2631} 2631}
2632 2632
2633void CalendarView::newEvent(QDateTime fh) 2633void CalendarView::newEvent(QDateTime fh)
2634{ 2634{
2635 newEvent(fh, 2635 newEvent(fh,
2636 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2636 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2637} 2637}
2638 2638
2639void CalendarView::newEvent(QDate dt) 2639void CalendarView::newEvent(QDate dt)
2640{ 2640{
2641 newEvent(QDateTime(dt, QTime(0,0,0)), 2641 newEvent(QDateTime(dt, QTime(0,0,0)),
2642 QDateTime(dt, QTime(0,0,0)), true); 2642 QDateTime(dt, QTime(0,0,0)), true);
2643} 2643}
2644 2644
2645void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2645void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2646{ 2646{
2647 2647
2648 showEventEditor(); 2648 showEventEditor();
2649 mEventEditor->newEvent(fromHint,toHint,allDay); 2649 mEventEditor->newEvent(fromHint,toHint,allDay);
2650 if ( mFilterView->filtersEnabled() ) { 2650 if ( mFilterView->filtersEnabled() ) {
2651 CalFilter *filter = mFilterView->selectedFilter(); 2651 CalFilter *filter = mFilterView->selectedFilter();
2652 if (filter && filter->showCategories()) { 2652 if (filter && filter->showCategories()) {
2653 mEventEditor->setCategories(filter->categoryList().join(",") ); 2653 mEventEditor->setCategories(filter->categoryList().join(",") );
2654 } 2654 }
2655 if ( filter ) 2655 if ( filter )
2656 mEventEditor->setSecrecy( filter->getSecrecy() ); 2656 mEventEditor->setSecrecy( filter->getSecrecy() );
2657 } 2657 }
2658} 2658}
2659void CalendarView::todoAdded(Todo * t) 2659void CalendarView::todoAdded(Todo * t)
2660{ 2660{
2661 2661
2662 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2662 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2663 updateTodoViews(); 2663 updateTodoViews();
2664} 2664}
2665void CalendarView::todoChanged(Todo * t) 2665void CalendarView::todoChanged(Todo * t)
2666{ 2666{
2667 emit todoModified( t, 4 ); 2667 emit todoModified( t, 4 );
2668 // updateTodoViews(); 2668 // updateTodoViews();
2669} 2669}
2670void CalendarView::todoToBeDeleted(Todo *) 2670void CalendarView::todoToBeDeleted(Todo *)
2671{ 2671{
2672 //qDebug("todoToBeDeleted(Todo *) "); 2672 //qDebug("todoToBeDeleted(Todo *) ");
2673 updateTodoViews(); 2673 updateTodoViews();
2674} 2674}
2675void CalendarView::todoDeleted() 2675void CalendarView::todoDeleted()
2676{ 2676{
2677 //qDebug(" todoDeleted()"); 2677 //qDebug(" todoDeleted()");
2678 updateTodoViews(); 2678 updateTodoViews();
2679} 2679}
2680 2680
2681 2681
2682 2682
2683void CalendarView::newTodo() 2683void CalendarView::newTodo()
2684{ 2684{
2685 2685
2686 showTodoEditor(); 2686 showTodoEditor();
2687 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2687 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2688 if ( mFilterView->filtersEnabled() ) { 2688 if ( mFilterView->filtersEnabled() ) {
2689 CalFilter *filter = mFilterView->selectedFilter(); 2689 CalFilter *filter = mFilterView->selectedFilter();
2690 if (filter && filter->showCategories()) { 2690 if (filter && filter->showCategories()) {
2691 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2691 mTodoEditor->setCategories(filter->categoryList().join(",") );
2692 } 2692 }
2693 if ( filter ) 2693 if ( filter )
2694 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2694 mTodoEditor->setSecrecy( filter->getSecrecy() );
2695 } 2695 }
2696} 2696}
2697 2697
2698void CalendarView::newSubTodo() 2698void CalendarView::newSubTodo()
2699{ 2699{
2700 Todo *todo = selectedTodo(); 2700 Todo *todo = selectedTodo();
2701 if ( todo ) newSubTodo( todo ); 2701 if ( todo ) newSubTodo( todo );
2702} 2702}
2703 2703
2704void CalendarView::newSubTodo(Todo *parentEvent) 2704void CalendarView::newSubTodo(Todo *parentEvent)
2705{ 2705{
2706 2706
2707 showTodoEditor(); 2707 showTodoEditor();
2708 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2708 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2709} 2709}
2710 2710
2711void CalendarView::newFloatingEvent() 2711void CalendarView::newFloatingEvent()
2712{ 2712{
2713 DateList tmpList = mNavigator->selectedDates(); 2713 DateList tmpList = mNavigator->selectedDates();
2714 QDate date = tmpList.first(); 2714 QDate date = tmpList.first();
2715 2715
2716 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2716 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2717 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2717 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2718} 2718}
2719 2719
2720 2720
2721void CalendarView::editEvent( Event *event ) 2721void CalendarView::editEvent( Event *event )
2722{ 2722{
2723 2723
2724 if ( !event ) return; 2724 if ( !event ) return;
2725 if ( event->isReadOnly() ) { 2725 if ( event->isReadOnly() ) {
2726 showEvent( event ); 2726 showEvent( event );
2727 return; 2727 return;
2728 } 2728 }
2729 showEventEditor(); 2729 showEventEditor();
2730 mEventEditor->editEvent( event , mFlagEditDescription); 2730 mEventEditor->editEvent( event , mFlagEditDescription);
2731} 2731}
2732void CalendarView::editJournal( Journal *jour ) 2732void CalendarView::editJournal( Journal *jour )
2733{ 2733{
2734 if ( !jour ) return; 2734 if ( !jour ) return;
2735 mDialogManager->hideSearchDialog(); 2735 mDialogManager->hideSearchDialog();
2736 mViewManager->showJournalView(); 2736 mViewManager->showJournalView();
2737 mNavigator->slotDaySelect( jour->dtStart().date() ); 2737 mNavigator->slotDaySelect( jour->dtStart().date() );
2738} 2738}
2739void CalendarView::editTodo( Todo *todo ) 2739void CalendarView::editTodo( Todo *todo )
2740{ 2740{
2741 if ( !todo ) return; 2741 if ( !todo ) return;
2742 2742
2743 if ( todo->isReadOnly() ) { 2743 if ( todo->isReadOnly() ) {
2744 showTodo( todo ); 2744 showTodo( todo );
2745 return; 2745 return;
2746 } 2746 }
2747 showTodoEditor(); 2747 showTodoEditor();
2748 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2748 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2749 2749
2750} 2750}
2751 2751
2752KOEventViewerDialog* CalendarView::getEventViewerDialog() 2752KOEventViewerDialog* CalendarView::getEventViewerDialog()
2753{ 2753{
2754 if ( !mEventViewerDialog ) { 2754 if ( !mEventViewerDialog ) {
2755 mEventViewerDialog = new KOEventViewerDialog(this); 2755 mEventViewerDialog = new KOEventViewerDialog(this);
2756 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2756 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2757 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2757 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2758 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2758 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2759 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2759 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2760 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2760 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2761 viewManager(), SLOT( showAgendaView( bool ) ) ); 2761 viewManager(), SLOT( showAgendaView( bool ) ) );
2762 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 2762 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
2763 this, SLOT( todoChanged(Todo *) ) ); 2763 this, SLOT( todoChanged(Todo *) ) );
2764 mEventViewerDialog->resize( 640, 480 ); 2764 mEventViewerDialog->resize( 640, 480 );
2765 2765
2766 } 2766 }
2767 return mEventViewerDialog; 2767 return mEventViewerDialog;
2768} 2768}
2769void CalendarView::showEvent(Event *event) 2769void CalendarView::showEvent(Event *event)
2770{ 2770{
2771 getEventViewerDialog()->setEvent(event); 2771 getEventViewerDialog()->setEvent(event);
2772 getEventViewerDialog()->showMe(); 2772 getEventViewerDialog()->showMe();
2773} 2773}
2774 2774
2775void CalendarView::showTodo(Todo *event) 2775void CalendarView::showTodo(Todo *event)
2776{ 2776{
2777 getEventViewerDialog()->setTodo(event); 2777 getEventViewerDialog()->setTodo(event);
2778 getEventViewerDialog()->showMe(); 2778 getEventViewerDialog()->showMe();
2779} 2779}
2780void CalendarView::showJournal( Journal *jour ) 2780void CalendarView::showJournal( Journal *jour )
2781{ 2781{
2782 getEventViewerDialog()->setJournal(jour); 2782 getEventViewerDialog()->setJournal(jour);
2783 getEventViewerDialog()->showMe(); 2783 getEventViewerDialog()->showMe();
2784 2784
2785} 2785}
2786// void CalendarView::todoModified (Todo *event, int changed) 2786// void CalendarView::todoModified (Todo *event, int changed)
2787// { 2787// {
2788// // if (mDialogList.find (event) != mDialogList.end ()) { 2788// // if (mDialogList.find (event) != mDialogList.end ()) {
2789// // kdDebug() << "Todo modified and open" << endl; 2789// // kdDebug() << "Todo modified and open" << endl;
2790// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2790// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2791// // temp->modified (changed); 2791// // temp->modified (changed);
2792 2792
2793// // } 2793// // }
2794 2794
2795// mViewManager->updateView(); 2795// mViewManager->updateView();
2796// } 2796// }
2797 2797
2798void CalendarView::appointment_show() 2798void CalendarView::appointment_show()
2799{ 2799{
2800 Event *anEvent = 0; 2800 Event *anEvent = 0;
2801 2801
2802 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2802 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2803 2803
2804 if (mViewManager->currentView()->isEventView()) { 2804 if (mViewManager->currentView()->isEventView()) {
2805 if ( incidence && incidence->type() == "Event" ) { 2805 if ( incidence && incidence->type() == "Event" ) {
2806 anEvent = static_cast<Event *>(incidence); 2806 anEvent = static_cast<Event *>(incidence);
2807 } 2807 }
2808 } 2808 }
2809 2809
2810 if (!anEvent) { 2810 if (!anEvent) {
2811 KNotifyClient::beep(); 2811 KNotifyClient::beep();
2812 return; 2812 return;
2813 } 2813 }
2814 2814
2815 showEvent(anEvent); 2815 showEvent(anEvent);
2816} 2816}
2817 2817
2818void CalendarView::appointment_edit() 2818void CalendarView::appointment_edit()
2819{ 2819{
2820 Event *anEvent = 0; 2820 Event *anEvent = 0;
2821 2821
2822 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2822 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2823 2823
2824 if (mViewManager->currentView()->isEventView()) { 2824 if (mViewManager->currentView()->isEventView()) {
2825 if ( incidence && incidence->type() == "Event" ) { 2825 if ( incidence && incidence->type() == "Event" ) {
2826 anEvent = static_cast<Event *>(incidence); 2826 anEvent = static_cast<Event *>(incidence);
2827 } 2827 }
2828 } 2828 }
2829 2829
2830 if (!anEvent) { 2830 if (!anEvent) {
2831 KNotifyClient::beep(); 2831 KNotifyClient::beep();
2832 return; 2832 return;
2833 } 2833 }
2834 2834
2835 editEvent(anEvent); 2835 editEvent(anEvent);
2836} 2836}
2837 2837
2838void CalendarView::appointment_delete() 2838void CalendarView::appointment_delete()
2839{ 2839{
2840 Event *anEvent = 0; 2840 Event *anEvent = 0;
2841 2841
2842 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2842 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2843 2843
2844 if (mViewManager->currentView()->isEventView()) { 2844 if (mViewManager->currentView()->isEventView()) {
2845 if ( incidence && incidence->type() == "Event" ) { 2845 if ( incidence && incidence->type() == "Event" ) {
2846 anEvent = static_cast<Event *>(incidence); 2846 anEvent = static_cast<Event *>(incidence);
2847 } 2847 }
2848 } 2848 }
2849 2849
2850 if (!anEvent) { 2850 if (!anEvent) {
2851 KNotifyClient::beep(); 2851 KNotifyClient::beep();
2852 return; 2852 return;
2853 } 2853 }
2854 2854
2855 deleteEvent(anEvent); 2855 deleteEvent(anEvent);
2856} 2856}
2857 2857
2858void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2858void CalendarView::todo_resub( Todo * parent, Todo * sub )
2859{ 2859{
2860 if (!sub) return; 2860 if (!sub) return;
2861 if (!parent) return; 2861 if (!parent) return;
2862 if ( sub->relatedTo() ) 2862 if ( sub->relatedTo() )
2863 sub->relatedTo()->removeRelation(sub); 2863 sub->relatedTo()->removeRelation(sub);
2864 sub->setRelatedTo(parent); 2864 sub->setRelatedTo(parent);
2865 sub->setRelatedToUid(parent->uid()); 2865 sub->setRelatedToUid(parent->uid());
2866 parent->addRelation(sub); 2866 parent->addRelation(sub);
2867 sub->updated(); 2867 sub->updated();
2868 parent->updated(); 2868 parent->updated();
2869 setModified(true); 2869 setModified(true);
2870 updateView(); 2870 updateView();
2871} 2871}
2872void CalendarView::todo_unsub(Todo *anTodo ) 2872void CalendarView::todo_unsub(Todo *anTodo )
2873{ 2873{
2874 // Todo *anTodo = selectedTodo(); 2874 // Todo *anTodo = selectedTodo();
2875 if (!anTodo) return; 2875 if (!anTodo) return;
2876 if (!anTodo->relatedTo()) return; 2876 if (!anTodo->relatedTo()) return;
2877 anTodo->relatedTo()->removeRelation(anTodo); 2877 anTodo->relatedTo()->removeRelation(anTodo);
2878 anTodo->setRelatedTo(0); 2878 anTodo->setRelatedTo(0);
2879 anTodo->updated(); 2879 anTodo->updated();
2880 anTodo->setRelatedToUid(""); 2880 anTodo->setRelatedToUid("");
2881 setModified(true); 2881 setModified(true);
2882 updateView(); 2882 updateView();
2883} 2883}
2884 2884
2885void CalendarView::deleteTodo(Todo *todo) 2885void CalendarView::deleteTodo(Todo *todo)
2886{ 2886{
2887 if (!todo) { 2887 if (!todo) {
2888 KNotifyClient::beep(); 2888 KNotifyClient::beep();
2889 return; 2889 return;
2890 } 2890 }
2891 if (KOPrefs::instance()->mConfirm) { 2891 if (KOPrefs::instance()->mConfirm) {
2892 QString text = todo->summary().left(20); 2892 QString text = todo->summary().left(20);
2893 if (!todo->relations().isEmpty()) { 2893 if (!todo->relations().isEmpty()) {
2894 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 2894 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
2895 2895
2896 } 2896 }
2897 switch (msgItemDelete(text)) { 2897 switch (msgItemDelete(text)) {
2898 case KMessageBox::Continue: // OK 2898 case KMessageBox::Continue: // OK
2899 bool deleteT = false; 2899 bool deleteT = false;
2900 if (!todo->relations().isEmpty()) { 2900 if (!todo->relations().isEmpty()) {
2901 deleteT = removeCompletedSubTodos( todo ); 2901 deleteT = removeCompletedSubTodos( todo );
2902 } 2902 }
2903 // deleteT == true: todo already deleted in removeCompletedSubTodos 2903 // deleteT == true: todo already deleted in removeCompletedSubTodos
2904 if ( !deleteT ) { 2904 if ( !deleteT ) {
2905 checkExternalId( todo ); 2905 checkExternalId( todo );
2906 calendar()->deleteTodo(todo); 2906 calendar()->deleteTodo(todo);
2907 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2907 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2908 updateView(); 2908 updateView();
2909 } 2909 }
2910 break; 2910 break;
2911 } // switch 2911 } // switch
2912 } else { 2912 } else {
2913 checkExternalId( todo ); 2913 checkExternalId( todo );
2914 mCalendar->deleteTodo(todo); 2914 mCalendar->deleteTodo(todo);
2915 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2915 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2916 updateView(); 2916 updateView();
2917 } 2917 }
2918 2918
2919 emit updateSearchDialog(); 2919 emit updateSearchDialog();
2920} 2920}
2921void CalendarView::deleteJournal(Journal *jour) 2921void CalendarView::deleteJournal(Journal *jour)
2922{ 2922{
2923 if (!jour) { 2923 if (!jour) {
2924 KNotifyClient::beep(); 2924 KNotifyClient::beep();
2925 return; 2925 return;
2926 } 2926 }
2927 if (KOPrefs::instance()->mConfirm) { 2927 if (KOPrefs::instance()->mConfirm) {
2928 switch (msgItemDelete( jour->description().left(20))) { 2928 switch (msgItemDelete( jour->description().left(20))) {
2929 case KMessageBox::Continue: // OK 2929 case KMessageBox::Continue: // OK
2930 calendar()->deleteJournal(jour); 2930 calendar()->deleteJournal(jour);
2931 updateView(); 2931 updateView();
2932 break; 2932 break;
2933 } // switch 2933 } // switch
2934 } else { 2934 } else {
2935 calendar()->deleteJournal(jour);; 2935 calendar()->deleteJournal(jour);;
2936 updateView(); 2936 updateView();
2937 } 2937 }
2938 emit updateSearchDialog(); 2938 emit updateSearchDialog();
2939} 2939}
2940 2940
2941void CalendarView::deleteEvent(Event *anEvent) 2941void CalendarView::deleteEvent(Event *anEvent)
2942{ 2942{
2943 if (!anEvent) { 2943 if (!anEvent) {
2944 KNotifyClient::beep(); 2944 KNotifyClient::beep();
2945 return; 2945 return;
2946 } 2946 }
2947 2947
2948 if (anEvent->recurrence()->doesRecur()) { 2948 if (anEvent->recurrence()->doesRecur()) {
2949 QDate itemDate = mViewManager->currentSelectionDate(); 2949 QDate itemDate = mViewManager->currentSelectionDate();
2950 int km; 2950 int km;
2951 if (!itemDate.isValid()) { 2951 if (!itemDate.isValid()) {
2952 //kdDebug() << "Date Not Valid" << endl; 2952 //kdDebug() << "Date Not Valid" << endl;
2953 if (KOPrefs::instance()->mConfirm) { 2953 if (KOPrefs::instance()->mConfirm) {
2954 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 2954 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
2955 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2955 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2956 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2956 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2957 if ( km == KMessageBox::Continue ) 2957 if ( km == KMessageBox::Continue )
2958 km = KMessageBox::No; // No = all below 2958 km = KMessageBox::No; // No = all below
2959 } else 2959 } else
2960 km = KMessageBox::No; 2960 km = KMessageBox::No;
2961 } else { 2961 } else {
2962 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 2962 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
2963 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2963 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2964 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2964 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2965 i18n("KO/Pi Confirmation"),i18n("Current"), 2965 i18n("KO/Pi Confirmation"),i18n("Current"),
2966 i18n("All")); 2966 i18n("All"));
2967 } 2967 }
2968 switch(km) { 2968 switch(km) {
2969 2969
2970 case KMessageBox::No: // Continue // all 2970 case KMessageBox::No: // Continue // all
2971 //qDebug("KMessageBox::No "); 2971 //qDebug("KMessageBox::No ");
2972 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2972 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2973 schedule(Scheduler::Cancel,anEvent); 2973 schedule(Scheduler::Cancel,anEvent);
2974 2974
2975 checkExternalId( anEvent); 2975 checkExternalId( anEvent);
2976 mCalendar->deleteEvent(anEvent); 2976 mCalendar->deleteEvent(anEvent);
2977 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 2977 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2978 break; 2978 break;
2979 2979
2980 // Disabled because it does not work 2980 // Disabled because it does not work
2981 //#if 0 2981 //#if 0
2982 case KMessageBox::Yes: // just this one 2982 case KMessageBox::Yes: // just this one
2983 //QDate qd = mNavigator->selectedDates().first(); 2983 //QDate qd = mNavigator->selectedDates().first();
2984 //if (!qd.isValid()) { 2984 //if (!qd.isValid()) {
2985 // kdDebug() << "no date selected, or invalid date" << endl; 2985 // kdDebug() << "no date selected, or invalid date" << endl;
2986 // KNotifyClient::beep(); 2986 // KNotifyClient::beep();
2987 // return; 2987 // return;
2988 //} 2988 //}
2989 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 2989 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
2990 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 2990 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
2991 anEvent->addExDate(itemDate); 2991 anEvent->addExDate(itemDate);
2992 int duration = anEvent->recurrence()->duration(); 2992 int duration = anEvent->recurrence()->duration();
2993 if ( duration > 0 ) { 2993 if ( duration > 0 ) {
2994 anEvent->recurrence()->setDuration( duration - 1 ); 2994 anEvent->recurrence()->setDuration( duration - 1 );
2995 } 2995 }
2996 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 2996 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
2997 } 2997 }
2998 break; 2998 break;
2999 //#endif 2999 //#endif
3000 } // switch 3000 } // switch
3001 } else { 3001 } else {
3002 if (KOPrefs::instance()->mConfirm) { 3002 if (KOPrefs::instance()->mConfirm) {
3003 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3003 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3004 i18n("\nAre you sure you want\nto delete this event?"), 3004 i18n("\nAre you sure you want\nto delete this event?"),
3005 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3005 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3006 case KMessageBox::Continue: // OK 3006 case KMessageBox::Continue: // OK
3007 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3007 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3008 schedule(Scheduler::Cancel,anEvent); 3008 schedule(Scheduler::Cancel,anEvent);
3009 checkExternalId( anEvent); 3009 checkExternalId( anEvent);
3010 mCalendar->deleteEvent(anEvent); 3010 mCalendar->deleteEvent(anEvent);
3011 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3011 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3012 break; 3012 break;
3013 } // switch 3013 } // switch
3014 } else { 3014 } else {
3015 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3015 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3016 schedule(Scheduler::Cancel,anEvent); 3016 schedule(Scheduler::Cancel,anEvent);
3017 checkExternalId( anEvent); 3017 checkExternalId( anEvent);
3018 mCalendar->deleteEvent(anEvent); 3018 mCalendar->deleteEvent(anEvent);
3019 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3019 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3020 } 3020 }
3021 } // if-else 3021 } // if-else
3022 emit updateSearchDialog(); 3022 emit updateSearchDialog();
3023} 3023}
3024 3024
3025bool CalendarView::deleteEvent(const QString &uid) 3025bool CalendarView::deleteEvent(const QString &uid)
3026{ 3026{
3027 Event *ev = mCalendar->event(uid); 3027 Event *ev = mCalendar->event(uid);
3028 if (ev) { 3028 if (ev) {
3029 deleteEvent(ev); 3029 deleteEvent(ev);
3030 return true; 3030 return true;
3031 } else { 3031 } else {
3032 return false; 3032 return false;
3033 } 3033 }
3034} 3034}
3035 3035
3036/*****************************************************************************/ 3036/*****************************************************************************/
3037 3037
3038void CalendarView::action_mail() 3038void CalendarView::action_mail()
3039{ 3039{
3040#ifndef KORG_NOMAIL 3040#ifndef KORG_NOMAIL
3041 KOMailClient mailClient; 3041 KOMailClient mailClient;
3042 3042
3043 Incidence *incidence = currentSelection(); 3043 Incidence *incidence = currentSelection();
3044 3044
3045 if (!incidence) { 3045 if (!incidence) {
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 6428757..b5596d9 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,924 +1,961 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef KORG_NOSPLITTER 29#ifndef KORG_NOSPLITTER
30#include <qsplitter.h> 30#include <qsplitter.h>
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 79TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
80 QScrollView(parent,name,f) 80 QScrollView(parent,name,f)
81{ 81{
82 mRows = rows; 82 mRows = rows;
83 83
84 setMinimumHeight( 20 ); 84 setMinimumHeight( 20 );
85 mCellHeight = KOPrefs::instance()->mHourSize*4; 85 mCellHeight = KOPrefs::instance()->mHourSize*4;
86 86
87 enableClipper(true); 87 enableClipper(true);
88 88
89 setHScrollBarMode(AlwaysOff); 89 setHScrollBarMode(AlwaysOff);
90 setVScrollBarMode(AlwaysOff); 90 setVScrollBarMode(AlwaysOff);
91 91
92 resizeContents(50,mRows * mCellHeight); 92 resizeContents(50,mRows * mCellHeight);
93 93
94 viewport()->setBackgroundMode( PaletteBackground ); 94 viewport()->setBackgroundMode( PaletteBackground );
95} 95}
96 96
97void TimeLabels::setCellHeight(int height) 97void TimeLabels::setCellHeight(int height)
98{ 98{
99 mCellHeight = height; 99 mCellHeight = height;
100} 100}
101 101
102/* 102/*
103 Optimization so that only the "dirty" portion of the scroll view 103 Optimization so that only the "dirty" portion of the scroll view
104 is redrawn. Unfortunately, this is not called by default paintEvent() method. 104 is redrawn. Unfortunately, this is not called by default paintEvent() method.
105*/ 105*/
106void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 106void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
107{ 107{
108 108
109 // if ( globalFlagBlockAgenda ) 109 // if ( globalFlagBlockAgenda )
110 // return; 110 // return;
111 // bug: the parameters cx, cy, cw, ch are the areas that need to be 111 // bug: the parameters cx, cy, cw, ch are the areas that need to be
112 // redrawn, not the area of the widget. unfortunately, this 112 // redrawn, not the area of the widget. unfortunately, this
113 // code assumes the latter... 113 // code assumes the latter...
114 114
115 // now, for a workaround... 115 // now, for a workaround...
116 // these two assignments fix the weird redraw bug 116 // these two assignments fix the weird redraw bug
117 cx = contentsX() + 2; 117 cx = contentsX() + 2;
118 cw = contentsWidth() - 2; 118 cw = contentsWidth() - 2;
119 // end of workaround 119 // end of workaround
120 120
121 int cell = ((int)(cy/mCellHeight)); 121 int cell = ((int)(cy/mCellHeight));
122 int y = cell * mCellHeight; 122 int y = cell * mCellHeight;
123 QFontMetrics fm = fontMetrics(); 123 QFontMetrics fm = fontMetrics();
124 QString hour; 124 QString hour;
125 QString suffix; 125 QString suffix;
126 QString fullTime; 126 QString fullTime;
127 int tW = fm.width("24:00i"); 127 int tW = fm.width("24:00i");
128 128
129 while (y < cy + ch) { 129 while (y < cy + ch) {
130 p->drawLine(cx,y,cx+tW,y); 130 p->drawLine(cx,y,cx+tW,y);
131 hour.setNum(cell); 131 hour.setNum(cell);
132 suffix = "am"; 132 suffix = "am";
133 133
134 // handle 24h and am/pm time formats 134 // handle 24h and am/pm time formats
135 if (KGlobal::locale()->use12Clock()) { 135 if (KGlobal::locale()->use12Clock()) {
136 if (cell > 11) suffix = "pm"; 136 if (cell > 11) suffix = "pm";
137 if (cell == 0) hour.setNum(12); 137 if (cell == 0) hour.setNum(12);
138 if (cell > 12) hour.setNum(cell - 12); 138 if (cell > 12) hour.setNum(cell - 12);
139 } else { 139 } else {
140 suffix = ":00"; 140 suffix = ":00";
141 } 141 }
142 142
143 // create string in format of "XX:XX" or "XXpm/am" 143 // create string in format of "XX:XX" or "XXpm/am"
144 fullTime = hour + suffix; 144 fullTime = hour + suffix;
145 145
146 // center and draw the time label 146 // center and draw the time label
147 int timeWidth = fm.width(fullTime+"i"); 147 int timeWidth = fm.width(fullTime+"i");
148 int offset = this->width() - timeWidth; 148 int offset = this->width() - timeWidth;
149 int borderWidth = 5; 149 int borderWidth = 5;
150 int timeHeight = fm.height(); 150 int timeHeight = fm.height();
151 timeHeight = timeHeight + 2 - ( timeHeight / 4 ); 151 timeHeight = timeHeight + 2 - ( timeHeight / 4 );
152 p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); 152 p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime);
153 153
154 // increment indices 154 // increment indices
155 y += mCellHeight; 155 y += mCellHeight;
156 cell++; 156 cell++;
157 } 157 }
158} 158}
159 159
160/** 160/**
161 Calculates the minimum width. 161 Calculates the minimum width.
162*/ 162*/
163int TimeLabels::minimumWidth() const 163int TimeLabels::minimumWidth() const
164{ 164{
165 QFontMetrics fm = fontMetrics(); 165 QFontMetrics fm = fontMetrics();
166 166
167 //TODO: calculate this value 167 //TODO: calculate this value
168 int borderWidth = 4; 168 int borderWidth = 4;
169 169
170 // the maximum width possible 170 // the maximum width possible
171 int width = fm.width("88:88x") + borderWidth; 171 int width = fm.width("88:88x") + borderWidth;
172 172
173 return width; 173 return width;
174} 174}
175 175
176/** updates widget's internal state */ 176/** updates widget's internal state */
177void TimeLabels::updateConfig() 177void TimeLabels::updateConfig()
178{ 178{
179 // set the font 179 // set the font
180 // config->setGroup("Fonts"); 180 // config->setGroup("Fonts");
181 // QFont font = config->readFontEntry("TimeBar Font"); 181 // QFont font = config->readFontEntry("TimeBar Font");
182 setFont(KOPrefs::instance()->mTimeBarFont); 182 setFont(KOPrefs::instance()->mTimeBarFont);
183 183
184 // update geometry restrictions based on new settings 184 // update geometry restrictions based on new settings
185 setFixedWidth(minimumWidth()); 185 setFixedWidth(minimumWidth());
186 186
187 // update HourSize 187 // update HourSize
188 mCellHeight = KOPrefs::instance()->mHourSize*4; 188 mCellHeight = KOPrefs::instance()->mHourSize*4;
189 resizeContents(50,mRows * mCellHeight); 189 resizeContents(50,mRows * mCellHeight);
190} 190}
191 191
192/** update time label positions */ 192/** update time label positions */
193void TimeLabels::positionChanged() 193void TimeLabels::positionChanged()
194{ 194{
195 int adjustment = mAgenda->contentsY(); 195 int adjustment = mAgenda->contentsY();
196 setContentsPos(0, adjustment); 196 setContentsPos(0, adjustment);
197} 197}
198 198
199/** */ 199/** */
200void TimeLabels::setAgenda(KOAgenda* agenda) 200void TimeLabels::setAgenda(KOAgenda* agenda)
201{ 201{
202 mAgenda = agenda; 202 mAgenda = agenda;
203} 203}
204
205void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
206{
207 mMouseDownY = e->pos().y();
208}
209
210void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
211{
212 int diff = mMouseDownY - e->pos().y();
213 if ( diff < 10 && diff > -10 )
214 return;
215 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
216 if ( tSize < 4 )
217 tSize = 4;
218 if ( tSize > 18 )
219 tSize = 18;
220 tSize = (tSize-2)/2;
221 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
204 222
223}
224void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
225{
226 int diff = mMouseDownY - e->pos().y();
227 if ( diff < 10 && diff > -10 )
228 return;
229 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
230 if ( tSize < 4 )
231 tSize = 4;
232 if ( tSize > 18 )
233 tSize = 18;
234 tSize = (tSize/2)*2;
235 if ( tSize == KOPrefs::instance()->mHourSize )
236 return;
237 KOPrefs::instance()->mHourSize = tSize;
238 emit scaleChanged();
239}
205 240
206/** This is called in response to repaint() */ 241/** This is called in response to repaint() */
207void TimeLabels::paintEvent(QPaintEvent*) 242void TimeLabels::paintEvent(QPaintEvent*)
208{ 243{
209 244
210 // kdDebug() << "paintevent..." << endl; 245 // kdDebug() << "paintevent..." << endl;
211 // this is another hack! 246 // this is another hack!
212 // QPainter painter(this); 247 // QPainter painter(this);
213 //QString c 248 //QString c
214 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 249 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
215} 250}
216 251
217//////////////////////////////////////////////////////////////////////////// 252////////////////////////////////////////////////////////////////////////////
218 253
219EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 254EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
220 : QFrame(parent,name) 255 : QFrame(parent,name)
221{ 256{
222 mColumns = 1; 257 mColumns = 1;
223 mTopBox = 0; 258 mTopBox = 0;
224 mLocation = loc; 259 mLocation = loc;
225 mTopLayout = 0; 260 mTopLayout = 0;
226 mPaintWidget = 0; 261 mPaintWidget = 0;
227 mXOffset = 0; 262 mXOffset = 0;
228 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 263 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
229 else mPixmap = SmallIcon("1downarrow"); 264 else mPixmap = SmallIcon("1downarrow");
230 mEnabled.resize(mColumns); 265 mEnabled.resize(mColumns);
231 if (mLocation == Top) 266 if (mLocation == Top)
232 setMaximumHeight(0); 267 setMaximumHeight(0);
233 else 268 else
234 setMinimumHeight(mPixmap.height()); 269 setMinimumHeight(mPixmap.height());
235} 270}
236 271
237EventIndicator::~EventIndicator() 272EventIndicator::~EventIndicator()
238{ 273{
239} 274}
240 275
241void EventIndicator::drawContents(QPainter *p) 276void EventIndicator::drawContents(QPainter *p)
242{ 277{
243 278
244 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 279 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
245 KDGanttSplitterHandle* han = 0; 280 KDGanttSplitterHandle* han = 0;
246 if ( mPaintWidget ) 281 if ( mPaintWidget )
247 han = mPaintWidget->firstHandle(); 282 han = mPaintWidget->firstHandle();
248 if ( ! han ) { 283 if ( ! han ) {
249 int i; 284 int i;
250 for(i=0;i<mColumns;++i) { 285 for(i=0;i<mColumns;++i) {
251 if (mEnabled[i]) { 286 if (mEnabled[i]) {
252 int cellWidth = contentsRect().right()/mColumns; 287 int cellWidth = contentsRect().right()/mColumns;
253 int xOffset = KOGlobals::self()->reverseLayout() ? 288 int xOffset = KOGlobals::self()->reverseLayout() ?
254 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 289 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
255 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 290 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
256 p->drawPixmap(QPoint(xOffset,0),mPixmap); 291 p->drawPixmap(QPoint(xOffset,0),mPixmap);
257 } 292 }
258 } 293 }
259 } else { 294 } else {
260 han->repaint(); 295 han->repaint();
261 //mPaintWidget->setBackgroundColor( red ); 296 //mPaintWidget->setBackgroundColor( red );
262 297
263 QPainter pa( han ); 298 QPainter pa( han );
264 int i; 299 int i;
265 bool setColor = false; 300 bool setColor = false;
266 for(i=0;i<mColumns;++i) { 301 for(i=0;i<mColumns;++i) {
267 if (mEnabled[i]) { 302 if (mEnabled[i]) {
268 setColor = true; 303 setColor = true;
269 304
270 int cellWidth = contentsRect().right()/mColumns; 305 int cellWidth = contentsRect().right()/mColumns;
271 int xOffset = KOGlobals::self()->reverseLayout() ? 306 int xOffset = KOGlobals::self()->reverseLayout() ?
272 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 307 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
273 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 308 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
274 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 309 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
275 //qDebug("222draw pix %d ",xOffset ); 310 //qDebug("222draw pix %d ",xOffset );
276 311
277 } 312 }
278 313
279 } 314 }
280 pa.end(); 315 pa.end();
281 316
282 } 317 }
283} 318}
284 319
285void EventIndicator::setXOffset( int x ) 320void EventIndicator::setXOffset( int x )
286{ 321{
287 mXOffset = x; 322 mXOffset = x;
288} 323}
289void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 324void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
290{ 325{
291 mPaintWidget = w; 326 mPaintWidget = w;
292} 327}
293void EventIndicator::changeColumns(int columns) 328void EventIndicator::changeColumns(int columns)
294{ 329{
295 mColumns = columns; 330 mColumns = columns;
296 mEnabled.resize(mColumns); 331 mEnabled.resize(mColumns);
297 332
298 update(); 333 update();
299} 334}
300 335
301void EventIndicator::enableColumn(int column, bool enable) 336void EventIndicator::enableColumn(int column, bool enable)
302{ 337{
303 mEnabled[column] = enable; 338 mEnabled[column] = enable;
304} 339}
305 340
306 341
307//////////////////////////////////////////////////////////////////////////// 342////////////////////////////////////////////////////////////////////////////
308//////////////////////////////////////////////////////////////////////////// 343////////////////////////////////////////////////////////////////////////////
309//////////////////////////////////////////////////////////////////////////// 344////////////////////////////////////////////////////////////////////////////
310 345
311KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 346KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
312 KOEventView (cal,parent,name) 347 KOEventView (cal,parent,name)
313{ 348{
314 mBlockUpdating = true; 349 mBlockUpdating = true;
315 mStartHour = 8; 350 mStartHour = 8;
316 mSelectedDates.append(QDate::currentDate()); 351 mSelectedDates.append(QDate::currentDate());
317 352
318 mLayoutDayLabels = 0; 353 mLayoutDayLabels = 0;
319 mDayLabelsFrame = 0; 354 mDayLabelsFrame = 0;
320 mDayLabels = 0; 355 mDayLabels = 0;
321 bool isRTL = KOGlobals::self()->reverseLayout(); 356 bool isRTL = KOGlobals::self()->reverseLayout();
322 357
323 if ( KOPrefs::instance()->mVerticalScreen ) { 358 if ( KOPrefs::instance()->mVerticalScreen ) {
324 mExpandedPixmap = SmallIcon( "1downarrow" ); 359 mExpandedPixmap = SmallIcon( "1downarrow" );
325 mNotExpandedPixmap = SmallIcon( "1uparrow" ); 360 mNotExpandedPixmap = SmallIcon( "1uparrow" );
326 } else { 361 } else {
327 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); 362 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
328 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); 363 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
329 } 364 }
330 365
331 QBoxLayout *topLayout = new QVBoxLayout(this); 366 QBoxLayout *topLayout = new QVBoxLayout(this);
332 367
333 // Create day name labels for agenda columns 368 // Create day name labels for agenda columns
334 mDayLabelsFrame = new QHBox(this); 369 mDayLabelsFrame = new QHBox(this);
335 topLayout->addWidget(mDayLabelsFrame); 370 topLayout->addWidget(mDayLabelsFrame);
336 mDayLabels = new QFrame (mDayLabelsFrame); 371 mDayLabels = new QFrame (mDayLabelsFrame);
337 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 372 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
338 // Create agenda splitter 373 // Create agenda splitter
339#ifndef KORG_NOSPLITTER 374#ifndef KORG_NOSPLITTER
340 mSplitterAgenda = new QSplitter(Vertical,this); 375 mSplitterAgenda = new QSplitter(Vertical,this);
341 topLayout->addWidget(mSplitterAgenda); 376 topLayout->addWidget(mSplitterAgenda);
342 mSplitterAgenda->setOpaqueResize(); 377 mSplitterAgenda->setOpaqueResize();
343 378
344 mAllDayFrame = new QHBox(mSplitterAgenda); 379 mAllDayFrame = new QHBox(mSplitterAgenda);
345 380
346 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 381 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
347#else 382#else
348#if 0 383#if 0
349 QWidget *mainBox = new QWidget( this ); 384 QWidget *mainBox = new QWidget( this );
350 topLayout->addWidget( mainBox ); 385 topLayout->addWidget( mainBox );
351 QBoxLayout *mainLayout = new QVBoxLayout(mainBox); 386 QBoxLayout *mainLayout = new QVBoxLayout(mainBox);
352 mAllDayFrame = new QHBox(mainBox); 387 mAllDayFrame = new QHBox(mainBox);
353 mainLayout->addWidget(mAllDayFrame); 388 mainLayout->addWidget(mAllDayFrame);
354 mainLayout->setStretchFactor( mAllDayFrame, 0 ); 389 mainLayout->setStretchFactor( mAllDayFrame, 0 );
355 mAllDayFrame->setFocusPolicy(NoFocus); 390 mAllDayFrame->setFocusPolicy(NoFocus);
356 QWidget *agendaFrame = new QWidget(mainBox); 391 QWidget *agendaFrame = new QWidget(mainBox);
357 mainLayout->addWidget(agendaFrame); 392 mainLayout->addWidget(agendaFrame);
358 mainLayout->setStretchFactor( agendaFrame, 10 ); 393 mainLayout->setStretchFactor( agendaFrame, 10 );
359 394
360 agendaFrame->setFocusPolicy(NoFocus); 395 agendaFrame->setFocusPolicy(NoFocus);
361#endif 396#endif
362 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 397 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
363 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 398 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
364 topLayout->addWidget( mSplitterAgenda ); 399 topLayout->addWidget( mSplitterAgenda );
365 mAllDayFrame = new QHBox(mSplitterAgenda); 400 mAllDayFrame = new QHBox(mSplitterAgenda);
366 mAllDayFrame->setFocusPolicy(NoFocus); 401 mAllDayFrame->setFocusPolicy(NoFocus);
367 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 402 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
368 agendaFrame->setFocusPolicy(NoFocus); 403 agendaFrame->setFocusPolicy(NoFocus);
369 404
370#endif 405#endif
371 406
372 // Create all-day agenda widget 407 // Create all-day agenda widget
373 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 408 mDummyAllDayLeft = new QVBox( mAllDayFrame );
374 409
375 mExpandButton = new QPushButton(mDummyAllDayLeft); 410 mExpandButton = new QPushButton(mDummyAllDayLeft);
376 mExpandButton->setPixmap( mNotExpandedPixmap ); 411 mExpandButton->setPixmap( mNotExpandedPixmap );
377 int widebut = mExpandButton->sizeHint().width(); 412 int widebut = mExpandButton->sizeHint().width();
378 if ( QApplication::desktop()->width() < 480 ) 413 if ( QApplication::desktop()->width() < 480 )
379 widebut = widebut*2; 414 widebut = widebut*2;
380 else 415 else
381 widebut = (widebut*3) / 2; 416 widebut = (widebut*3) / 2;
382 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 417 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
383 // QSizePolicy::Fixed ) ); 418 // QSizePolicy::Fixed ) );
384 mExpandButton->setFixedSize( widebut, widebut); 419 mExpandButton->setFixedSize( widebut, widebut);
385 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 420 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
386 mExpandButton->setFocusPolicy(NoFocus); 421 mExpandButton->setFocusPolicy(NoFocus);
387 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 422 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
388 mAllDayAgenda->setFocusPolicy(NoFocus); 423 mAllDayAgenda->setFocusPolicy(NoFocus);
389 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); 424 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame);
390 425
391 // Create event context menu for all day agenda 426 // Create event context menu for all day agenda
392 mAllDayAgendaPopup = eventPopup(); 427 mAllDayAgendaPopup = eventPopup();
393 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 428 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
394 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 429 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
395 430
396 // Create agenda frame 431 // Create agenda frame
397 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 432 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
398 // QHBox *agendaFrame = new QHBox(splitterAgenda); 433 // QHBox *agendaFrame = new QHBox(splitterAgenda);
399 434
400 // create event indicator bars 435 // create event indicator bars
401 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 436 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
402 agendaLayout->addWidget(mEventIndicatorTop,0,1); 437 agendaLayout->addWidget(mEventIndicatorTop,0,1);
403 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 438 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
404 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 439 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
405 agendaFrame); 440 agendaFrame);
406 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 441 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
407 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 442 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
408 agendaLayout->addWidget(dummyAgendaRight,0,2); 443 agendaLayout->addWidget(dummyAgendaRight,0,2);
409 444
410 // Create time labels 445 // Create time labels
411 mTimeLabels = new TimeLabels(24,agendaFrame); 446 mTimeLabels = new TimeLabels(24,agendaFrame);
412 agendaLayout->addWidget(mTimeLabels,1,0); 447 agendaLayout->addWidget(mTimeLabels,1,0);
448 connect(mTimeLabels,SIGNAL( scaleChanged()),
449 this,SLOT(updateConfig()));
413 450
414 // Create agenda 451 // Create agenda
415 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 452 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
416 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); 453 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2);
417 agendaLayout->setColStretch(1,1); 454 agendaLayout->setColStretch(1,1);
418 mAgenda->setFocusPolicy(NoFocus); 455 mAgenda->setFocusPolicy(NoFocus);
419 // Create event context menu for agenda 456 // Create event context menu for agenda
420 mAgendaPopup = eventPopup(); 457 mAgendaPopup = eventPopup();
421 458
422 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 459 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
423 i18n("Toggle Alarm"),mAgenda, 460 i18n("Toggle Alarm"),mAgenda,
424 SLOT(popupAlarm()),true); 461 SLOT(popupAlarm()),true);
425 462
426 463
427 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 464 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
428 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 465 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
429 466
430 // make connections between dependent widgets 467 // make connections between dependent widgets
431 mTimeLabels->setAgenda(mAgenda); 468 mTimeLabels->setAgenda(mAgenda);
432 469
433 // Update widgets to reflect user preferences 470 // Update widgets to reflect user preferences
434 // updateConfig(); 471 // updateConfig();
435 472
436 // createDayLabels(); 473 // createDayLabels();
437 474
438 // these blank widgets make the All Day Event box line up with the agenda 475 // these blank widgets make the All Day Event box line up with the agenda
439 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 476 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
440 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 477 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
441 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 478 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
442 479
443 // Scrolling 480 // Scrolling
444 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 481 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
445 mTimeLabels, SLOT(positionChanged())); 482 mTimeLabels, SLOT(positionChanged()));
446 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 483 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
447 SLOT(setContentsPos(int))); 484 SLOT(setContentsPos(int)));
448 485
449 // Create/Show/Edit/Delete Event 486 // Create/Show/Edit/Delete Event
450 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 487 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
451 SLOT(newEvent(int,int))); 488 SLOT(newEvent(int,int)));
452 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 489 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
453 SLOT(newEvent(int,int,int,int))); 490 SLOT(newEvent(int,int,int,int)));
454 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 491 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
455 SLOT(newEventAllDay(int,int))); 492 SLOT(newEventAllDay(int,int)));
456 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 493 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
457 SLOT(newEventAllDay(int,int))); 494 SLOT(newEventAllDay(int,int)));
458 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 495 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
459 SLOT(newTimeSpanSelected(int,int,int,int))); 496 SLOT(newTimeSpanSelected(int,int,int,int)));
460 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 497 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
461 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 498 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
462 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 499 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
463 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 500 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
464 501
465 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 502 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
466 SIGNAL(editIncidenceSignal(Incidence *))); 503 SIGNAL(editIncidenceSignal(Incidence *)));
467 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 504 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
468 SIGNAL(editIncidenceSignal(Incidence *))); 505 SIGNAL(editIncidenceSignal(Incidence *)));
469 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 506 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
470 SIGNAL(showIncidenceSignal(Incidence *))); 507 SIGNAL(showIncidenceSignal(Incidence *)));
471 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 508 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
472 SIGNAL(showIncidenceSignal(Incidence *))); 509 SIGNAL(showIncidenceSignal(Incidence *)));
473 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 510 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
474 SIGNAL(deleteIncidenceSignal(Incidence *))); 511 SIGNAL(deleteIncidenceSignal(Incidence *)));
475 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 512 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
476 SIGNAL(deleteIncidenceSignal(Incidence *))); 513 SIGNAL(deleteIncidenceSignal(Incidence *)));
477 514
478 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 515 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
479 SLOT(updateEventDates(KOAgendaItem *, int ))); 516 SLOT(updateEventDates(KOAgendaItem *, int )));
480 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 517 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
481 SLOT(updateEventDates(KOAgendaItem *, int))); 518 SLOT(updateEventDates(KOAgendaItem *, int)));
482 519
483 // event indicator update 520 // event indicator update
484 connect(mAgenda,SIGNAL(lowerYChanged(int)), 521 connect(mAgenda,SIGNAL(lowerYChanged(int)),
485 SLOT(updateEventIndicatorTop(int))); 522 SLOT(updateEventIndicatorTop(int)));
486 connect(mAgenda,SIGNAL(upperYChanged(int)), 523 connect(mAgenda,SIGNAL(upperYChanged(int)),
487 SLOT(updateEventIndicatorBottom(int))); 524 SLOT(updateEventIndicatorBottom(int)));
488 // drag signals 525 // drag signals
489 /* 526 /*
490 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 527 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
491 SLOT(startDrag(Event *))); 528 SLOT(startDrag(Event *)));
492 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 529 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
493 SLOT(startDrag(Event *))); 530 SLOT(startDrag(Event *)));
494 */ 531 */
495 // synchronize selections 532 // synchronize selections
496 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 533 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
497 mAllDayAgenda, SLOT( deselectItem() ) ); 534 mAllDayAgenda, SLOT( deselectItem() ) );
498 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 535 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
499 mAgenda, SLOT( deselectItem() ) ); 536 mAgenda, SLOT( deselectItem() ) );
500 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 537 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
501 SIGNAL( incidenceSelected( Incidence * ) ) ); 538 SIGNAL( incidenceSelected( Incidence * ) ) );
502 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 539 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
503 SIGNAL( incidenceSelected( Incidence * ) ) ); 540 SIGNAL( incidenceSelected( Incidence * ) ) );
504 connect( mAgenda, SIGNAL( resizedSignal() ), 541 connect( mAgenda, SIGNAL( resizedSignal() ),
505 SLOT( updateConfig( ) ) ); 542 SLOT( updateConfig( ) ) );
506 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 543 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
507 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 544 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
508 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 545 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
509 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 546 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
510 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 547 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
511 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 548 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
512 549
513 550
514} 551}
515 552
516void KOAgendaView::toggleAllDay() 553void KOAgendaView::toggleAllDay()
517{ 554{
518 if ( mSplitterAgenda->firstHandle() ) 555 if ( mSplitterAgenda->firstHandle() )
519 mSplitterAgenda->firstHandle()->toggle(); 556 mSplitterAgenda->firstHandle()->toggle();
520} 557}
521void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 558void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
522{ 559{
523 calendar()->addIncidence( inc ); 560 calendar()->addIncidence( inc );
524 561
525 if ( incOld ) { 562 if ( incOld ) {
526 if ( incOld->type() == "Todo" ) 563 if ( incOld->type() == "Todo" )
527 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 564 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
528 else 565 else
529 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 566 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
530 } 567 }
531 568
532} 569}
533 570
534KOAgendaView::~KOAgendaView() 571KOAgendaView::~KOAgendaView()
535{ 572{
536 delete mAgendaPopup; 573 delete mAgendaPopup;
537 delete mAllDayAgendaPopup; 574 delete mAllDayAgendaPopup;
538 delete KOAgendaItem::paintPix(); 575 delete KOAgendaItem::paintPix();
539 delete KOAgendaItem::paintPixSel(); 576 delete KOAgendaItem::paintPixSel();
540} 577}
541void KOAgendaView::resizeEvent( QResizeEvent* e ) 578void KOAgendaView::resizeEvent( QResizeEvent* e )
542{ 579{
543 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 580 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
544 bool uc = false; 581 bool uc = false;
545 int ow = e->oldSize().width(); 582 int ow = e->oldSize().width();
546 int oh = e->oldSize().height(); 583 int oh = e->oldSize().height();
547 int w = e->size().width(); 584 int w = e->size().width();
548 int h = e->size().height(); 585 int h = e->size().height();
549 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 586 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
550 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 587 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
551 uc = true; 588 uc = true;
552 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 589 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
553 } 590 }
554 mUpcomingWidth = e->size().width() ; 591 mUpcomingWidth = e->size().width() ;
555 if ( mBlockUpdating || uc ) { 592 if ( mBlockUpdating || uc ) {
556 mBlockUpdating = false; 593 mBlockUpdating = false;
557 //mAgenda->setMinimumSize(800 , 600 ); 594 //mAgenda->setMinimumSize(800 , 600 );
558 //qDebug("mAgenda->resize+++++++++++++++ "); 595 //qDebug("mAgenda->resize+++++++++++++++ ");
559 updateConfig(); 596 updateConfig();
560 //qDebug("KOAgendaView::Updating now possible "); 597 //qDebug("KOAgendaView::Updating now possible ");
561 } else 598 } else
562 createDayLabels(); 599 createDayLabels();
563 //qDebug("resizeEvent end "); 600 //qDebug("resizeEvent end ");
564 601
565} 602}
566void KOAgendaView::createDayLabels() 603void KOAgendaView::createDayLabels()
567{ 604{
568 605
569 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 606 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
570 // qDebug(" KOAgendaView::createDayLabels() blocked "); 607 // qDebug(" KOAgendaView::createDayLabels() blocked ");
571 return; 608 return;
572 609
573 } 610 }
574 int newHight; 611 int newHight;
575 612
576 // ### Before deleting and recreating we could check if mSelectedDates changed... 613 // ### Before deleting and recreating we could check if mSelectedDates changed...
577 // It would remove some flickering and gain speed (since this is called by 614 // It would remove some flickering and gain speed (since this is called by
578 // each updateView() call) 615 // each updateView() call)
579 616
580 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; 617 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2;
581 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 618 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
582 if ( maxWid < 0 ) 619 if ( maxWid < 0 )
583 maxWid = 20; 620 maxWid = 20;
584 621
585 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 622 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
586 QFontMetrics fm ( dlf ); 623 QFontMetrics fm ( dlf );
587 int selCount = mSelectedDates.count(); 624 int selCount = mSelectedDates.count();
588 QString dayTest = "Mon 20"; 625 QString dayTest = "Mon 20";
589 int wid = fm.width( dayTest ); 626 int wid = fm.width( dayTest );
590 maxWid -= ( selCount * 3 ); 627 maxWid -= ( selCount * 3 );
591 if ( maxWid < 0 ) 628 if ( maxWid < 0 )
592 maxWid = 20; 629 maxWid = 20;
593 int needWid = wid * selCount; 630 int needWid = wid * selCount;
594 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 631 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
595 //if ( needWid > maxWid ) 632 //if ( needWid > maxWid )
596 // qDebug("DAYLABELS TOOOOOOO BIG "); 633 // qDebug("DAYLABELS TOOOOOOO BIG ");
597 while ( needWid > maxWid ) { 634 while ( needWid > maxWid ) {
598 dayTest = dayTest.left( dayTest.length() - 1 ); 635 dayTest = dayTest.left( dayTest.length() - 1 );
599 wid = fm.width( dayTest ); 636 wid = fm.width( dayTest );
600 needWid = wid * selCount; 637 needWid = wid * selCount;
601 } 638 }
602 int maxLen = dayTest.length(); 639 int maxLen = dayTest.length();
603 int fontPoint = dlf.pointSize(); 640 int fontPoint = dlf.pointSize();
604 if ( maxLen < 2 ) { 641 if ( maxLen < 2 ) {
605 int fontPoint = dlf.pointSize(); 642 int fontPoint = dlf.pointSize();
606 while ( fontPoint > 4 ) { 643 while ( fontPoint > 4 ) {
607 --fontPoint; 644 --fontPoint;
608 dlf.setPointSize( fontPoint ); 645 dlf.setPointSize( fontPoint );
609 QFontMetrics f( dlf ); 646 QFontMetrics f( dlf );
610 wid = f.width( "20" ); 647 wid = f.width( "20" );
611 needWid = wid * selCount; 648 needWid = wid * selCount;
612 if ( needWid < maxWid ) 649 if ( needWid < maxWid )
613 break; 650 break;
614 } 651 }
615 maxLen = 2; 652 maxLen = 2;
616 } 653 }
617 //qDebug("Max len %d ", dayTest.length() ); 654 //qDebug("Max len %d ", dayTest.length() );
618 655
619 QFontMetrics tempF( dlf ); 656 QFontMetrics tempF( dlf );
620 newHight = tempF.height(); 657 newHight = tempF.height();
621 mDayLabels->setFont( dlf ); 658 mDayLabels->setFont( dlf );
622 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; 659 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
623 // mLayoutDayLabels->addSpacing(mTimeLabels->width()); 660 // mLayoutDayLabels->addSpacing(mTimeLabels->width());
624 //mLayoutDayLabels->addSpacing( 2 ); 661 //mLayoutDayLabels->addSpacing( 2 );
625 // QFont lFont = dlf; 662 // QFont lFont = dlf;
626 bool appendLabels = false; 663 bool appendLabels = false;
627 QLabel *dayLabel; 664 QLabel *dayLabel;
628 dayLabel = mDayLabelsList.first(); 665 dayLabel = mDayLabelsList.first();
629 if ( !dayLabel ) { 666 if ( !dayLabel ) {
630 appendLabels = true; 667 appendLabels = true;
631 dayLabel = new QLabel(mDayLabels); 668 dayLabel = new QLabel(mDayLabels);
632 mDayLabelsList.append( dayLabel ); 669 mDayLabelsList.append( dayLabel );
633 mLayoutDayLabels->addWidget(dayLabel); 670 mLayoutDayLabels->addWidget(dayLabel);
634 } 671 }
635 dayLabel->setFixedWidth( mTimeLabels->width()+2 ); 672 dayLabel->setFixedWidth( mTimeLabels->width()+2 );
636 dayLabel->setFont( dlf ); 673 dayLabel->setFont( dlf );
637 dayLabel->setAlignment(QLabel::AlignHCenter); 674 dayLabel->setAlignment(QLabel::AlignHCenter);
638 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 675 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
639 dayLabel->show(); 676 dayLabel->show();
640 DateList::ConstIterator dit; 677 DateList::ConstIterator dit;
641 bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); 678 bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
642 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 679 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
643 QDate date = *dit; 680 QDate date = *dit;
644 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); 681 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
645 if ( ! appendLabels ) { 682 if ( ! appendLabels ) {
646 dayLabel = mDayLabelsList.next(); 683 dayLabel = mDayLabelsList.next();
647 if ( !dayLabel ) 684 if ( !dayLabel )
648 appendLabels = true; 685 appendLabels = true;
649 } 686 }
650 if ( appendLabels ) { 687 if ( appendLabels ) {
651 dayLabel = new QLabel(mDayLabels); 688 dayLabel = new QLabel(mDayLabels);
652 mDayLabelsList.append( dayLabel ); 689 mDayLabelsList.append( dayLabel );
653 mLayoutDayLabels->addWidget(dayLabel); 690 mLayoutDayLabels->addWidget(dayLabel);
654 } 691 }
655 dayLabel->setMinimumWidth( 1 ); 692 dayLabel->setMinimumWidth( 1 );
656 dayLabel->setMaximumWidth( 2048 ); 693 dayLabel->setMaximumWidth( 2048 );
657 dayLabel->setFont( dlf ); 694 dayLabel->setFont( dlf );
658 dayLabel->show(); 695 dayLabel->show();
659 QString str; 696 QString str;
660 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); 697 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
661 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); 698 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
662 switch ( maxLen ) { 699 switch ( maxLen ) {
663 case 2: 700 case 2:
664 str = QString::number( date.day() ); 701 str = QString::number( date.day() );
665 break; 702 break;
666 703
667 case 3: 704 case 3:
668 str = dayName.left( 1 ) +QString::number( date.day()); 705 str = dayName.left( 1 ) +QString::number( date.day());
669 706
670 break; 707 break;
671 case 4: 708 case 4:
672 str = dayName.left( 1 ) + " " +QString::number( date.day()); 709 str = dayName.left( 1 ) + " " +QString::number( date.day());
673 710
674 break; 711 break;
675 case 5: 712 case 5:
676 str = dayName.left( 2 ) + " " +QString::number( date.day()); 713 str = dayName.left( 2 ) + " " +QString::number( date.day());
677 714
678 break; 715 break;
679 case 6: 716 case 6:
680 str = dayName.left( 3 ) + " " +QString::number( date.day()); 717 str = dayName.left( 3 ) + " " +QString::number( date.day());
681 break; 718 break;
682 719
683 default: 720 default:
684 break; 721 break;
685 } 722 }
686 if ( oneday ) { 723 if ( oneday ) {
687 QString addString; 724 QString addString;
688 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 725 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
689 addString = i18n("Today"); 726 addString = i18n("Today");
690 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 727 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
691 addString = i18n("Tomorrow"); 728 addString = i18n("Tomorrow");
692 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 729 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
693 addString = i18n("Yesterday"); 730 addString = i18n("Yesterday");
694 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 731 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
695 addString = i18n("Day before yesterday"); 732 addString = i18n("Day before yesterday");
696 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 733 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
697 addString = i18n("Day after tomorrow"); 734 addString = i18n("Day after tomorrow");
698 if ( !addString.isEmpty() ) { 735 if ( !addString.isEmpty() ) {
699 str = addString+", " + str; 736 str = addString+", " + str;
700 } 737 }
701 } 738 }
702 dayLabel->setText(str); 739 dayLabel->setText(str);
703 dayLabel->setAlignment(QLabel::AlignHCenter); 740 dayLabel->setAlignment(QLabel::AlignHCenter);
704 if (date == QDate::currentDate()) { 741 if (date == QDate::currentDate()) {
705 QFont bFont = dlf; 742 QFont bFont = dlf;
706 bFont.setBold( true ); 743 bFont.setBold( true );
707 dayLabel->setFont(bFont); 744 dayLabel->setFont(bFont);
708 } 745 }
709 //dayLayout->addWidget(dayLabel); 746 //dayLayout->addWidget(dayLabel);
710 747
711#ifndef KORG_NOPLUGINS 748#ifndef KORG_NOPLUGINS
712 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 749 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
713 CalendarDecoration *it; 750 CalendarDecoration *it;
714 for(it = cds.first(); it; it = cds.next()) { 751 for(it = cds.first(); it; it = cds.next()) {
715 QString text = it->shortText( date ); 752 QString text = it->shortText( date );
716 if ( !text.isEmpty() ) { 753 if ( !text.isEmpty() ) {
717 QLabel *label = new QLabel(text,mDayLabels); 754 QLabel *label = new QLabel(text,mDayLabels);
718 label->setAlignment(AlignCenter); 755 label->setAlignment(AlignCenter);
719 dayLayout->addWidget(label); 756 dayLayout->addWidget(label);
720 } 757 }
721 } 758 }
722 759
723 for(it = cds.first(); it; it = cds.next()) { 760 for(it = cds.first(); it; it = cds.next()) {
724 QWidget *wid = it->smallWidget(mDayLabels,date); 761 QWidget *wid = it->smallWidget(mDayLabels,date);
725 if ( wid ) { 762 if ( wid ) {
726 // wid->setHeight(20); 763 // wid->setHeight(20);
727 dayLayout->addWidget(wid); 764 dayLayout->addWidget(wid);
728 } 765 }
729 } 766 }
730#endif 767#endif
731 } 768 }
732 if ( ! appendLabels ) { 769 if ( ! appendLabels ) {
733 dayLabel = mDayLabelsList.next(); 770 dayLabel = mDayLabelsList.next();
734 if ( !dayLabel ) 771 if ( !dayLabel )
735 appendLabels = true; 772 appendLabels = true;
736 } 773 }
737 if ( appendLabels ) { 774 if ( appendLabels ) {
738 dayLabel = new QLabel(mDayLabels); 775 dayLabel = new QLabel(mDayLabels);
739 mDayLabelsList.append( dayLabel ); 776 mDayLabelsList.append( dayLabel );
740 mLayoutDayLabels->addWidget(dayLabel); 777 mLayoutDayLabels->addWidget(dayLabel);
741 } 778 }
742 //dayLabel->hide();//test only 779 //dayLabel->hide();//test only
743 780
744 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 781 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
745 if ( offset < 0 ) offset = 0; 782 if ( offset < 0 ) offset = 0;
746 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 783 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
747 dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) ); 784 dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) );
748 dayLabel->show(); 785 dayLabel->show();
749 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); 786 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
750 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); 787 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
751 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 788 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
752 if ( !appendLabels ) { 789 if ( !appendLabels ) {
753 dayLabel = mDayLabelsList.next(); 790 dayLabel = mDayLabelsList.next();
754 while ( dayLabel ) { 791 while ( dayLabel ) {
755 //qDebug("!dayLabel %d",dayLabel ); 792 //qDebug("!dayLabel %d",dayLabel );
756 dayLabel->hide(); 793 dayLabel->hide();
757 dayLabel = mDayLabelsList.next(); 794 dayLabel = mDayLabelsList.next();
758 } 795 }
759 } 796 }
760 //mDayLabelsFrame->show(); 797 //mDayLabelsFrame->show();
761 //mDayLabels->show(); 798 //mDayLabels->show();
762 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); 799 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
763 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); 800 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
764 mDayLabelsFrame->setFixedHeight( newHight ); 801 mDayLabelsFrame->setFixedHeight( newHight );
765} 802}
766 803
767int KOAgendaView::maxDatesHint() 804int KOAgendaView::maxDatesHint()
768{ 805{
769 // Not sure about the max number of events, so return 0 for now. 806 // Not sure about the max number of events, so return 0 for now.
770 return 0; 807 return 0;
771} 808}
772 809
773int KOAgendaView::currentDateCount() 810int KOAgendaView::currentDateCount()
774{ 811{
775 return mSelectedDates.count(); 812 return mSelectedDates.count();
776} 813}
777 814
778QPtrList<Incidence> KOAgendaView::selectedIncidences() 815QPtrList<Incidence> KOAgendaView::selectedIncidences()
779{ 816{
780 QPtrList<Incidence> selected; 817 QPtrList<Incidence> selected;
781 Incidence *incidence; 818 Incidence *incidence;
782 819
783 incidence = mAgenda->selectedIncidence(); 820 incidence = mAgenda->selectedIncidence();
784 if (incidence) selected.append(incidence); 821 if (incidence) selected.append(incidence);
785 822
786 incidence = mAllDayAgenda->selectedIncidence(); 823 incidence = mAllDayAgenda->selectedIncidence();
787 if (incidence) selected.append(incidence); 824 if (incidence) selected.append(incidence);
788 825
789 return selected; 826 return selected;
790} 827}
791 828
792DateList KOAgendaView::selectedDates() 829DateList KOAgendaView::selectedDates()
793{ 830{
794 DateList selected; 831 DateList selected;
795 QDate qd; 832 QDate qd;
796 833
797 qd = mAgenda->selectedIncidenceDate(); 834 qd = mAgenda->selectedIncidenceDate();
798 if (qd.isValid()) selected.append(qd); 835 if (qd.isValid()) selected.append(qd);
799 836
800 qd = mAllDayAgenda->selectedIncidenceDate(); 837 qd = mAllDayAgenda->selectedIncidenceDate();
801 if (qd.isValid()) selected.append(qd); 838 if (qd.isValid()) selected.append(qd);
802 839
803 return selected; 840 return selected;
804} 841}
805 842
806 843
807void KOAgendaView::updateView() 844void KOAgendaView::updateView()
808{ 845{
809 if ( mBlockUpdating ) 846 if ( mBlockUpdating )
810 return; 847 return;
811 // kdDebug() << "KOAgendaView::updateView()" << endl; 848 // kdDebug() << "KOAgendaView::updateView()" << endl;
812 fillAgenda(); 849 fillAgenda();
813 850
814} 851}
815 852
816 853
817/* 854/*
818 Update configuration settings for the agenda view. This method is not 855 Update configuration settings for the agenda view. This method is not
819 complete. 856 complete.
820*/ 857*/
821void KOAgendaView::updateConfig() 858void KOAgendaView::updateConfig()
822{ 859{
823 if ( mBlockUpdating ) 860 if ( mBlockUpdating )
824 return; 861 return;
825 // kdDebug() << "KOAgendaView::updateConfig()" << endl; 862 // kdDebug() << "KOAgendaView::updateConfig()" << endl;
826 863
827 // update config for children 864 // update config for children
828 mTimeLabels->updateConfig(); 865 mTimeLabels->updateConfig();
829 mAgenda->storePosition(); 866 mAgenda->storePosition();
830 mAgenda->updateConfig(); 867 mAgenda->updateConfig();
831 mAllDayAgenda->updateConfig(); 868 mAllDayAgenda->updateConfig();
832 // widget synchronization 869 // widget synchronization
833 //TODO: find a better way, maybe signal/slot 870 //TODO: find a better way, maybe signal/slot
834 mTimeLabels->positionChanged(); 871 mTimeLabels->positionChanged();
835 872
836 // for some reason, this needs to be called explicitly 873 // for some reason, this needs to be called explicitly
837 mTimeLabels->repaint(); 874 mTimeLabels->repaint();
838 875
839 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 876 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
840 877
841 // ToolTips displaying summary of events 878 // ToolTips displaying summary of events
842 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 879 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
843 ->mEnableToolTips); 880 ->mEnableToolTips);
844 881
845 //setHolidayMasks(); 882 //setHolidayMasks();
846 883
847 //createDayLabels(); called by via updateView(); 884 //createDayLabels(); called by via updateView();
848 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 885 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
849 updateView(); 886 updateView();
850 mAgenda->restorePosition(); 887 mAgenda->restorePosition();
851} 888}
852 889
853 890
854void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 891void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
855{ 892{
856 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; 893 // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl;
857 //qDebug("KOAgendaView::updateEventDates "); 894 //qDebug("KOAgendaView::updateEventDates ");
858 QDateTime startDt,endDt; 895 QDateTime startDt,endDt;
859 QDate startDate; 896 QDate startDate;
860 int lenInSecs; 897 int lenInSecs;
861 // if ( type == KOAgenda::RESIZETOP ) 898 // if ( type == KOAgenda::RESIZETOP )
862 // qDebug("RESIZETOP "); 899 // qDebug("RESIZETOP ");
863 // if ( type == KOAgenda::RESIZEBOTTOM ) 900 // if ( type == KOAgenda::RESIZEBOTTOM )
864 // qDebug("RESIZEBOTTOM "); 901 // qDebug("RESIZEBOTTOM ");
865 // if ( type == KOAgenda::MOVE ) 902 // if ( type == KOAgenda::MOVE )
866 // qDebug("MOVE "); 903 // qDebug("MOVE ");
867 if ( item->incidence()->type() == "Event" ) { 904 if ( item->incidence()->type() == "Event" ) {
868 startDt =item->incidence()->dtStart(); 905 startDt =item->incidence()->dtStart();
869 endDt = item->incidence()->dtEnd(); 906 endDt = item->incidence()->dtEnd();
870 lenInSecs = startDt.secsTo( endDt ); 907 lenInSecs = startDt.secsTo( endDt );
871 } 908 }
872 909
873 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 910 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
874 911
875 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 912 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) {
876 startDate = mSelectedDates[item->mLastMoveXPos]; 913 startDate = mSelectedDates[item->mLastMoveXPos];
877 } else { 914 } else {
878 if (item->cellX() < 0) { 915 if (item->cellX() < 0) {
879 startDate = (mSelectedDates.first()).addDays(item->cellX()); 916 startDate = (mSelectedDates.first()).addDays(item->cellX());
880 } else { 917 } else {
881 startDate = mSelectedDates[item->cellX()]; 918 startDate = mSelectedDates[item->cellX()];
882 } 919 }
883 } 920 }
884 startDt.setDate(startDate); 921 startDt.setDate(startDate);
885 922
886 if (item->incidence()->doesFloat()) { 923 if (item->incidence()->doesFloat()) {
887 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 924 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
888 } else { 925 } else {
889 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 926 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
890 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 927 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
891 if ( item->incidence()->type() == "Event" ) { 928 if ( item->incidence()->type() == "Event" ) {
892 if ( type == KOAgenda::MOVE ) { 929 if ( type == KOAgenda::MOVE ) {
893 endDt = startDt.addSecs(lenInSecs); 930 endDt = startDt.addSecs(lenInSecs);
894 931
895 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 932 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
896 if (item->lastMultiItem()) { 933 if (item->lastMultiItem()) {
897 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 934 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
898 endDt.setDate(startDate. 935 endDt.setDate(startDate.
899 addDays(item->lastMultiItem()->cellX() - item->cellX())); 936 addDays(item->lastMultiItem()->cellX() - item->cellX()));
900 } else { 937 } else {
901 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 938 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
902 endDt.setDate(startDate); 939 endDt.setDate(startDate);
903 } 940 }
904 } 941 }
905 } else { 942 } else {
906 // todo 943 // todo
907 if (item->lastMultiItem()) { 944 if (item->lastMultiItem()) {
908 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 945 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
909 endDt.setDate(startDate. 946 endDt.setDate(startDate.
910 addDays(item->lastMultiItem()->cellX() - item->cellX())); 947 addDays(item->lastMultiItem()->cellX() - item->cellX()));
911 } else { 948 } else {
912 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 949 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
913 if ( item->cellYBottom() > 0 ) 950 if ( item->cellYBottom() > 0 )
914 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 951 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
915 else 952 else
916 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 953 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
917 endDt.setDate(startDate); 954 endDt.setDate(startDate);
918 } 955 }
919 } 956 }
920 } 957 }
921 958
922 959
923 if ( item->incidence()->type() == "Event" ) { 960 if ( item->incidence()->type() == "Event" ) {
924 item->incidence()->setDtStart(startDt); 961 item->incidence()->setDtStart(startDt);
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 0079253..221b0ea 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -1,252 +1,257 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOAGENDAVIEW_H 23#ifndef KOAGENDAVIEW_H
24#define KOAGENDAVIEW_H 24#define KOAGENDAVIEW_H
25 25
26#include <qscrollview.h> 26#include <qscrollview.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef DESKTOP_VERSION 29#ifndef DESKTOP_VERSION
30#include <qksplitter.h> 30#include <qksplitter.h>
31#else 31#else
32#include <qsplitter.h> 32#include <qsplitter.h>
33#endif 33#endif
34#include <qmemarray.h> 34#include <qmemarray.h>
35 35
36#include "koeventview.h" 36#include "koeventview.h"
37 37
38 38
39class QHBox; 39class QHBox;
40class QFrame; 40class QFrame;
41class QLabel; 41class QLabel;
42class QPushButton; 42class QPushButton;
43class CalendarView; 43class CalendarView;
44class KOAgenda; 44class KOAgenda;
45class KOAgendaItem; 45class KOAgendaItem;
46class KConfig; 46class KConfig;
47class KDGanttMinimizeSplitter; 47class KDGanttMinimizeSplitter;
48class TimeLabels : public QScrollView { 48class TimeLabels : public QScrollView {
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); 51 TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0);
52 52
53 void setCellHeight(int height); 53 void setCellHeight(int height);
54 54
55 /** Calculates the minimum width */ 55 /** Calculates the minimum width */
56 virtual int minimumWidth() const; 56 virtual int minimumWidth() const;
57 57
58 /** updates widget's internal state */ 58 /** updates widget's internal state */
59 void updateConfig(); 59 void updateConfig();
60 60
61 /** */ 61 /** */
62 void setAgenda(KOAgenda* agenda); 62 void setAgenda(KOAgenda* agenda);
63 63
64 /** */ 64 /** */
65 virtual void paintEvent(QPaintEvent* e); 65 virtual void paintEvent(QPaintEvent* e);
66 void contentsMousePressEvent ( QMouseEvent * ) ;
67 void contentsMouseReleaseEvent ( QMouseEvent * );
68 void contentsMouseMoveEvent ( QMouseEvent * );
66 69
67 public slots: 70 public slots:
68 /** update time label positions */ 71 /** update time label positions */
69 void positionChanged(); 72 void positionChanged();
70 73 signals:
74 void scaleChanged();
71 protected: 75 protected:
72 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 76 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
73 77
74 private: 78 private:
79 int mMouseDownY;
75 int mRows; 80 int mRows;
76 int mCellHeight; 81 int mCellHeight;
77 82
78 /** */ 83 /** */
79 KOAgenda* mAgenda; 84 KOAgenda* mAgenda;
80}; 85};
81 86
82class EventIndicator : public QFrame { 87class EventIndicator : public QFrame {
83 Q_OBJECT 88 Q_OBJECT
84 public: 89 public:
85 enum Location { Top, Bottom }; 90 enum Location { Top, Bottom };
86 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); 91 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
87 virtual ~EventIndicator(); 92 virtual ~EventIndicator();
88 93
89 void changeColumns(int columns); 94 void changeColumns(int columns);
90 void setPaintWidget( KDGanttMinimizeSplitter* ); 95 void setPaintWidget( KDGanttMinimizeSplitter* );
91 void setXOffset( int ); 96 void setXOffset( int );
92 void enableColumn(int column, bool enable); 97 void enableColumn(int column, bool enable);
93 98
94 protected: 99 protected:
95 void drawContents(QPainter *); 100 void drawContents(QPainter *);
96 101
97 private: 102 private:
98 int mXOffset; 103 int mXOffset;
99 KDGanttMinimizeSplitter* mPaintWidget; 104 KDGanttMinimizeSplitter* mPaintWidget;
100 int mColumns; 105 int mColumns;
101 QHBox *mTopBox; 106 QHBox *mTopBox;
102 QBoxLayout *mTopLayout; 107 QBoxLayout *mTopLayout;
103 Location mLocation; 108 Location mLocation;
104 QPixmap mPixmap; 109 QPixmap mPixmap;
105 QMemArray<bool> mEnabled; 110 QMemArray<bool> mEnabled;
106}; 111};
107 112
108/** 113/**
109 KOAgendaView is the agenda-like view used to display events in an one or 114 KOAgendaView is the agenda-like view used to display events in an one or
110 multi-day view. 115 multi-day view.
111*/ 116*/
112class KOAgendaView : public KOEventView { 117class KOAgendaView : public KOEventView {
113 Q_OBJECT 118 Q_OBJECT
114 public: 119 public:
115 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); 120 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
116 virtual ~KOAgendaView(); 121 virtual ~KOAgendaView();
117 void setStartHour( int ); 122 void setStartHour( int );
118 void toggleAllDay(); 123 void toggleAllDay();
119 124
120 125
121 /** Returns maximum number of days supported by the koagendaview */ 126 /** Returns maximum number of days supported by the koagendaview */
122 virtual int maxDatesHint(); 127 virtual int maxDatesHint();
123 128
124 /** Returns number of currently shown dates. */ 129 /** Returns number of currently shown dates. */
125 virtual int currentDateCount(); 130 virtual int currentDateCount();
126 131
127 /** returns the currently selected events */ 132 /** returns the currently selected events */
128 virtual QPtrList<Incidence> selectedIncidences(); 133 virtual QPtrList<Incidence> selectedIncidences();
129 134
130 /** returns the currently selected events */ 135 /** returns the currently selected events */
131 virtual DateList selectedDates(); 136 virtual DateList selectedDates();
132 137
133 /** Remove all events from view */ 138 /** Remove all events from view */
134 void clearView(); 139 void clearView();
135 KOAgenda *agenda() { return mAgenda;} 140 KOAgenda *agenda() { return mAgenda;}
136 virtual void printPreview(CalPrinter *calPrinter, 141 virtual void printPreview(CalPrinter *calPrinter,
137 const QDate &, const QDate &); 142 const QDate &, const QDate &);
138 143
139 /** start-datetime of selection */ 144 /** start-datetime of selection */
140 QDateTime selectionStart() {return mTimeSpanBegin;} 145 QDateTime selectionStart() {return mTimeSpanBegin;}
141 /** end-datetime of selection */ 146 /** end-datetime of selection */
142 QDateTime selectionEnd() {return mTimeSpanEnd;} 147 QDateTime selectionEnd() {return mTimeSpanEnd;}
143 /** returns true if selection is for whole day */ 148 /** returns true if selection is for whole day */
144 bool selectedIsAllDay() {return mTimeSpanInAllDay;} 149 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
145 /** make selected start/end invalid */ 150 /** make selected start/end invalid */
146 void deleteSelectedDateTime(); 151 void deleteSelectedDateTime();
147 void repaintAgenda(); 152 void repaintAgenda();
148 public slots: 153 public slots:
149 virtual void updateView(); 154 virtual void updateView();
150 virtual void updateConfig(); 155 virtual void updateConfig();
151 virtual void showDates(const QDate &start, const QDate &end); 156 virtual void showDates(const QDate &start, const QDate &end);
152 virtual void showEvents(QPtrList<Event> eventList); 157 virtual void showEvents(QPtrList<Event> eventList);
153 158
154 void updateTodo( Todo *, int ); 159 void updateTodo( Todo *, int );
155 void changeEventDisplay(Event *, int); 160 void changeEventDisplay(Event *, int);
156 161
157 void clearSelection(); 162 void clearSelection();
158 163
159 void newEvent(int gx,int gy); 164 void newEvent(int gx,int gy);
160 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 165 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
161 void newEventAllDay(int gx, int gy); 166 void newEventAllDay(int gx, int gy);
162 167
163 void startDrag(Event *); 168 void startDrag(Event *);
164 169
165 void readSettings(); 170 void readSettings();
166 void readSettings(KConfig *); 171 void readSettings(KConfig *);
167 void writeSettings(KConfig *); 172 void writeSettings(KConfig *);
168 173
169 void setContentsPos(int y); 174 void setContentsPos(int y);
170 175
171 void setExpandedButton( bool expanded ); 176 void setExpandedButton( bool expanded );
172 void scrollOneHourUp(); 177 void scrollOneHourUp();
173 void scrollOneHourDown(); 178 void scrollOneHourDown();
174 void addToCalSlot(Incidence *, Incidence *); 179 void addToCalSlot(Incidence *, Incidence *);
175 180
176 signals: 181 signals:
177 void toggleExpand(); 182 void toggleExpand();
178 void todoMoved( Todo *, int ); 183 void todoMoved( Todo *, int );
179 void incidenceChanged(Incidence * , int ); 184 void incidenceChanged(Incidence * , int );
180 // void cloneIncidenceSignal(Incidence *); 185 // void cloneIncidenceSignal(Incidence *);
181 186
182 protected: 187 protected:
183 bool mBlockUpdating; 188 bool mBlockUpdating;
184 int mUpcomingWidth; 189 int mUpcomingWidth;
185 /** Fill agenda beginning with date startDate */ 190 /** Fill agenda beginning with date startDate */
186 void fillAgenda(const QDate &startDate); 191 void fillAgenda(const QDate &startDate);
187 void resizeEvent( QResizeEvent* e ); 192 void resizeEvent( QResizeEvent* e );
188 /** Fill agenda using the current set value for the start date */ 193 /** Fill agenda using the current set value for the start date */
189 void fillAgenda(); 194 void fillAgenda();
190 195
191 /** Create labels for the selected dates. */ 196 /** Create labels for the selected dates. */
192 void createDayLabels(); 197 void createDayLabels();
193 198
194 /** 199 /**
195 Set the masks on the agenda widgets indicating, which days are holidays. 200 Set the masks on the agenda widgets indicating, which days are holidays.
196 */ 201 */
197 void setHolidayMasks(); 202 void setHolidayMasks();
198 203
199 protected slots: 204 protected slots:
200 /** Update event belonging to agenda item */ 205 /** Update event belonging to agenda item */
201 void updateEventDates(KOAgendaItem *item, int mode = -1); 206 void updateEventDates(KOAgendaItem *item, int mode = -1);
202 //void updateMovedTodo(); 207 //void updateMovedTodo();
203 208
204 void updateEventIndicatorTop(int newY); 209 void updateEventIndicatorTop(int newY);
205 void updateEventIndicatorBottom(int newY); 210 void updateEventIndicatorBottom(int newY);
206 211
207 /** Updates data for selected timespan */ 212 /** Updates data for selected timespan */
208 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); 213 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
209 /** Updates data for selected timespan for all day event*/ 214 /** Updates data for selected timespan for all day event*/
210 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); 215 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
211 216
212 private: 217 private:
213 // view widgets 218 // view widgets
214 QFrame *mDayLabels; 219 QFrame *mDayLabels;
215 QHBox *mDayLabelsFrame; 220 QHBox *mDayLabelsFrame;
216 QBoxLayout *mLayoutDayLabels; 221 QBoxLayout *mLayoutDayLabels;
217 QFrame *mAllDayFrame; 222 QFrame *mAllDayFrame;
218 KOAgenda *mAllDayAgenda; 223 KOAgenda *mAllDayAgenda;
219 KOAgenda *mAgenda; 224 KOAgenda *mAgenda;
220 TimeLabels *mTimeLabels; 225 TimeLabels *mTimeLabels;
221 QWidget *mDummyAllDayLeft; 226 QWidget *mDummyAllDayLeft;
222 227
223 KDGanttMinimizeSplitter* mSplitterAgenda; 228 KDGanttMinimizeSplitter* mSplitterAgenda;
224 QPushButton *mExpandButton; 229 QPushButton *mExpandButton;
225 230
226 DateList mSelectedDates; // List of dates to be displayed 231 DateList mSelectedDates; // List of dates to be displayed
227 int mViewType; 232 int mViewType;
228 233
229 bool mWeekStartsMonday; 234 bool mWeekStartsMonday;
230 int mStartHour; 235 int mStartHour;
231 236
232 KOEventPopupMenu *mAgendaPopup; 237 KOEventPopupMenu *mAgendaPopup;
233 KOEventPopupMenu *mAllDayAgendaPopup; 238 KOEventPopupMenu *mAllDayAgendaPopup;
234 239
235 EventIndicator *mEventIndicatorTop; 240 EventIndicator *mEventIndicatorTop;
236 EventIndicator *mEventIndicatorBottom; 241 EventIndicator *mEventIndicatorBottom;
237 242
238 QMemArray<int> mMinY; 243 QMemArray<int> mMinY;
239 QMemArray<int> mMaxY; 244 QMemArray<int> mMaxY;
240 245
241 QMemArray<bool> mHolidayMask; 246 QMemArray<bool> mHolidayMask;
242 247
243 QPixmap mExpandedPixmap; 248 QPixmap mExpandedPixmap;
244 QPixmap mNotExpandedPixmap; 249 QPixmap mNotExpandedPixmap;
245 QPtrList<QLabel> mDayLabelsList; 250 QPtrList<QLabel> mDayLabelsList;
246 QDateTime mTimeSpanBegin; 251 QDateTime mTimeSpanBegin;
247 QDateTime mTimeSpanEnd; 252 QDateTime mTimeSpanEnd;
248 bool mTimeSpanInAllDay; 253 bool mTimeSpanInAllDay;
249 void keyPressEvent ( QKeyEvent * e ); 254 void keyPressEvent ( QKeyEvent * e );
250}; 255};
251 256
252#endif // KOAGENDAVIEW_H 257#endif // KOAGENDAVIEW_H
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index c99c0cb..41a4dc1 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -1,341 +1,346 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
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 21
22#include <libkdepim/categoryeditdialog.h> 22#include <libkdepim/categoryeditdialog.h>
23 23
24#include "calendarview.h" 24#include "calendarview.h"
25#include "incomingdialog.h" 25#include "incomingdialog.h"
26#include "outgoingdialog.h" 26#include "outgoingdialog.h"
27#include "koprefsdialog.h" 27#include "koprefsdialog.h"
28#include "koeventeditor.h" 28#include "koeventeditor.h"
29#include "koprefs.h" 29#include "koprefs.h"
30#include "datenavigator.h" 30#include "datenavigator.h"
31#include "kotodoeditor.h" 31#include "kotodoeditor.h"
32#include "searchdialog.h" 32#include "searchdialog.h"
33#include "filtereditdialog.h" 33#include "filtereditdialog.h"
34#ifndef KORG_NOPLUGINS 34#ifndef KORG_NOPLUGINS
35#include "plugindialog.h" 35#include "plugindialog.h"
36#endif 36#endif
37#ifndef KORG_NOARCHIVE 37#ifndef KORG_NOARCHIVE
38#include "archivedialog.h" 38#include "archivedialog.h"
39#endif 39#endif
40 40
41#include "kconfig.h" 41#include "kconfig.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43 43
44KODialogManager::KODialogManager( CalendarView *mainView ) : 44KODialogManager::KODialogManager( CalendarView *mainView ) :
45 QObject(), mMainView( mainView ) 45 QObject(), mMainView( mainView )
46{ 46{
47 mOutgoingDialog = 0; 47 mOutgoingDialog = 0;
48 mIncomingDialog = 0; 48 mIncomingDialog = 0;
49 mOptionsDialog = 0; 49 mOptionsDialog = 0;
50 mSearchDialog = 0; 50 mSearchDialog = 0;
51 mArchiveDialog = 0; 51 mArchiveDialog = 0;
52 mFilterEditDialog = 0; 52 mFilterEditDialog = 0;
53 mPluginDialog = 0; 53 mPluginDialog = 0;
54 54
55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); 55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); 56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog );
57} 57}
58 58
59KODialogManager::~KODialogManager() 59KODialogManager::~KODialogManager()
60{ 60{
61 delete mOutgoingDialog; 61 delete mOutgoingDialog;
62 delete mIncomingDialog; 62 delete mIncomingDialog;
63 delete mOptionsDialog; 63 delete mOptionsDialog;
64 delete mSearchDialog; 64 delete mSearchDialog;
65#ifndef KORG_NOARCHIVE 65#ifndef KORG_NOARCHIVE
66 delete mArchiveDialog; 66 delete mArchiveDialog;
67#endif 67#endif
68 delete mFilterEditDialog; 68 delete mFilterEditDialog;
69#ifndef KORG_NOPLUGINS 69#ifndef KORG_NOPLUGINS
70 delete mPluginDialog; 70 delete mPluginDialog;
71#endif 71#endif
72} 72}
73 73
74OutgoingDialog *KODialogManager::outgoingDialog() 74OutgoingDialog *KODialogManager::outgoingDialog()
75{ 75{
76 createOutgoingDialog(); 76 createOutgoingDialog();
77 return mOutgoingDialog; 77 return mOutgoingDialog;
78} 78}
79 79
80void KODialogManager::createOutgoingDialog() 80void KODialogManager::createOutgoingDialog()
81{ 81{
82 if (!mOutgoingDialog) { 82 if (!mOutgoingDialog) {
83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); 83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); 84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), 85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
86 mMainView,SIGNAL(numOutgoingChanged(int))); 86 mMainView,SIGNAL(numOutgoingChanged(int)));
87 } 87 }
88} 88}
89 89
90void KODialogManager::showOptionsDialog( bool showSync ) 90void KODialogManager::showOptionsDialog( bool showSync )
91{ 91{
92 92
93 if (!mOptionsDialog) { 93 if (!mOptionsDialog) {
94 mOptionsDialog = new KOPrefsDialog(mMainView); 94 mOptionsDialog = new KOPrefsDialog(mMainView);
95 //mOptionsDialog->readConfig(); 95 //mOptionsDialog->readConfig();
96 connect(mOptionsDialog,SIGNAL(configChanged()), 96 connect(mOptionsDialog,SIGNAL(configChanged()),
97 mMainView,SLOT(updateConfig())); 97 mMainView,SLOT(updateConfig()));
98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
99 // mOptionsDialog,SLOT(updateCategories())); 99 // mOptionsDialog,SLOT(updateCategories()));
100 100
101 } 101 }
102 mOptionsDialog->readConfig(); 102 mOptionsDialog->readConfig();
103#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
104 mOptionsDialog->showMaximized(); 104 mOptionsDialog->showMaximized();
105#else 105#else
106 mOptionsDialog->show(); 106 mOptionsDialog->show();
107#endif 107#endif
108 if ( showSync ) 108 if ( showSync )
109 mOptionsDialog->showSyncPage(); 109 mOptionsDialog->showSyncPage();
110 mOptionsDialog->exec(); 110 mOptionsDialog->exec();
111 111
112} 112}
113void KODialogManager::showSyncOptions() 113void KODialogManager::showSyncOptions()
114{ 114{
115 showOptionsDialog( true ); 115 showOptionsDialog( true );
116 116
117} 117}
118void KODialogManager::showOutgoingDialog() 118void KODialogManager::showOutgoingDialog()
119{ 119{
120 createOutgoingDialog(); 120 createOutgoingDialog();
121 mOutgoingDialog->show(); 121 mOutgoingDialog->show();
122 mOutgoingDialog->raise(); 122 mOutgoingDialog->raise();
123} 123}
124 124
125IncomingDialog *KODialogManager::incomingDialog() 125IncomingDialog *KODialogManager::incomingDialog()
126{ 126{
127 createOutgoingDialog(); 127 createOutgoingDialog();
128 if (!mIncomingDialog) { 128 if (!mIncomingDialog) {
129 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 129 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
130 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 130 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
131 mMainView,SIGNAL(numIncomingChanged(int))); 131 mMainView,SIGNAL(numIncomingChanged(int)));
132 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 132 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
133 mMainView,SLOT(updateView())); 133 mMainView,SLOT(updateView()));
134 } 134 }
135 return mIncomingDialog; 135 return mIncomingDialog;
136} 136}
137 137
138void KODialogManager::createIncomingDialog() 138void KODialogManager::createIncomingDialog()
139{ 139{
140 createOutgoingDialog(); 140 createOutgoingDialog();
141 if (!mIncomingDialog) { 141 if (!mIncomingDialog) {
142 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 142 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
143 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 143 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
144 mMainView,SIGNAL(numIncomingChanged(int))); 144 mMainView,SIGNAL(numIncomingChanged(int)));
145 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 145 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
146 mMainView,SLOT(updateView())); 146 mMainView,SLOT(updateView()));
147 } 147 }
148} 148}
149 149
150void KODialogManager::showIncomingDialog() 150void KODialogManager::showIncomingDialog()
151{ 151{
152 createIncomingDialog(); 152 createIncomingDialog();
153 mIncomingDialog->show(); 153 mIncomingDialog->show();
154 mIncomingDialog->raise(); 154 mIncomingDialog->raise();
155} 155}
156/* 156/*
157void KODialogManager::showCategoryEditDialog() 157void KODialogManager::showCategoryEditDialog()
158{ 158{
159 mCategoryEditDialog->show(); 159 mCategoryEditDialog->show();
160} 160}
161*/ 161*/
162void KODialogManager::hideSearchDialog() 162void KODialogManager::hideSearchDialog()
163{ 163{
164 if (mSearchDialog) 164 if (mSearchDialog)
165 mSearchDialog->hide(); 165 mSearchDialog->hide();
166} 166}
167 167
168void KODialogManager::showSearchDialog() 168void KODialogManager::showSearchDialog()
169{ 169{
170 if (!mSearchDialog) { 170 if (!mSearchDialog) {
171 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); 171 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
172 KOListView * lview = mSearchDialog->listview(); 172 KOListView * lview = mSearchDialog->listview();
173 173
174 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), 174 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
175 mMainView, SLOT(showIncidence(Incidence *))); 175 mMainView, SLOT(showIncidence(Incidence *)));
176 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), 176 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
177 mMainView, SLOT(editIncidence(Incidence *))); 177 mMainView, SLOT(editIncidence(Incidence *)));
178 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), 178 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
179 mMainView, SLOT(deleteIncidence(Incidence *))); 179 mMainView, SLOT(deleteIncidence(Incidence *)));
180 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), 180 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
181 mMainView, SLOT(cloneIncidence(Incidence *))); 181 mMainView, SLOT(cloneIncidence(Incidence *)));
182 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), 182 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
183 mMainView, SLOT(beamIncidence(Incidence *))); 183 mMainView, SLOT(beamIncidence(Incidence *)));
184 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), 184 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
185 mMainView, SLOT(moveIncidence(Incidence *))); 185 mMainView, SLOT(moveIncidence(Incidence *)));
186 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), 186 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
187 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); 187 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
188 188
189 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); 189 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
190 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); 190 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
191 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), 191 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
192 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 192 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
193#ifndef DESKTOP_VERSION 193#ifndef DESKTOP_VERSION
194 mSearchDialog->setMaximumSize( QApplication::desktop()->size()); 194 mSearchDialog->setMaximumSize( QApplication::desktop()->size());
195 //mSearchDialog->setGeometry( 40,40, 400, 300); 195 //mSearchDialog->setGeometry( 40,40, 400, 300);
196 mSearchDialog->showMaximized(); 196 mSearchDialog->showMaximized();
197#else 197#else
198 KConfig *config = KOGlobals::config(); 198 KConfig *config = KOGlobals::config();
199 config->setGroup("WidgetLayout"); 199 config->setGroup("WidgetLayout");
200 QStringList list; 200 QStringList list;
201 list = config->readListEntry("SearchLayout"); 201 list = config->readListEntry("SearchLayout");
202 int x,y,w,h; 202 int x,y,w,h;
203 if ( ! list.isEmpty() ) { 203 if ( ! list.isEmpty() ) {
204 x = list[0].toInt(); 204 x = list[0].toInt();
205 y = list[1].toInt(); 205 y = list[1].toInt();
206 w = list[2].toInt(); 206 w = list[2].toInt();
207 h = list[3].toInt(); 207 h = list[3].toInt();
208 mSearchDialog->setGeometry(x,y,w,h); 208 mSearchDialog->setGeometry(x,y,w,h);
209 209
210 } 210 }
211 211
212#endif 212#endif
213 } 213 }
214 // make sure the widget is on top again 214 // make sure the widget is on top again
215 mSearchDialog->show(); 215 mSearchDialog->show();
216 mSearchDialog->raise(); 216 mSearchDialog->raise();
217} 217}
218 218
219SearchDialog * KODialogManager::getSearchDialog() 219SearchDialog * KODialogManager::getSearchDialog()
220{ 220{
221 return mSearchDialog; 221 return mSearchDialog;
222} 222}
223void KODialogManager::showArchiveDialog() 223void KODialogManager::showArchiveDialog()
224{ 224{
225#ifndef KORG_NOARCHIVE 225#ifndef KORG_NOARCHIVE
226 if (!mArchiveDialog) { 226 if (!mArchiveDialog) {
227 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 227 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
228 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 228 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
229 mMainView,SLOT(updateView())); 229 mMainView,SLOT(updateView()));
230 } 230 }
231 mArchiveDialog->show(); 231 mArchiveDialog->show();
232 mArchiveDialog->raise(); 232 mArchiveDialog->raise();
233 233
234 // Workaround. 234 // Workaround.
235 QApplication::restoreOverrideCursor(); 235 QApplication::restoreOverrideCursor();
236#endif 236#endif
237} 237}
238 238
239void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) 239void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters)
240{ 240{
241 if (!mFilterEditDialog) { 241 if (!mFilterEditDialog) {
242 mFilterEditDialog = new FilterEditDialog(filters,mMainView); 242 mFilterEditDialog = new FilterEditDialog(filters,mMainView);
243 connect(mFilterEditDialog,SIGNAL(filterChanged()), 243 connect(mFilterEditDialog,SIGNAL(filterChanged()),
244 mMainView,SLOT(filterEdited())); 244 mMainView,SLOT(filterEdited()));
245 245
246 } 246 }
247 247
248#ifndef DESKTOP_VERSION 248#ifndef DESKTOP_VERSION
249 mFilterEditDialog->showMaximized(); 249 mFilterEditDialog->showMaximized();
250#else 250#else
251 mFilterEditDialog->show(); 251 mFilterEditDialog->show();
252#endif 252#endif
253 mFilterEditDialog->raise(); 253 mFilterEditDialog->raise();
254} 254}
255 255
256void KODialogManager::showPluginDialog() 256void KODialogManager::showPluginDialog()
257{ 257{
258#ifndef KORG_NOPLUGINS 258#ifndef KORG_NOPLUGINS
259 if (!mPluginDialog) { 259 if (!mPluginDialog) {
260 mPluginDialog = new PluginDialog(mMainView); 260 mPluginDialog = new PluginDialog(mMainView);
261 connect(mPluginDialog,SIGNAL(configChanged()), 261 connect(mPluginDialog,SIGNAL(configChanged()),
262 mMainView,SLOT(updateConfig())); 262 mMainView,SLOT(updateConfig()));
263 } 263 }
264 mPluginDialog->show(); 264 mPluginDialog->show();
265 mPluginDialog->raise(); 265 mPluginDialog->raise();
266#endif 266#endif
267} 267}
268 268
269KOEventEditor *KODialogManager::getEventEditor() 269KOEventEditor *KODialogManager::getEventEditor()
270{ 270{
271 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), 271 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(),
272 mMainView ); 272 mMainView );
273 273
274 connect(eventEditor,SIGNAL(eventAdded(Event *)), 274 connect(eventEditor,SIGNAL(eventAdded(Event *)),
275 mMainView,SLOT(eventAdded(Event *))); 275 mMainView,SLOT(eventAdded(Event *)));
276 connect(eventEditor,SIGNAL(eventChanged(Event *)), 276 connect(eventEditor,SIGNAL(eventChanged(Event *)),
277 mMainView,SLOT(eventChanged(Event *))); 277 mMainView,SLOT(eventChanged(Event *)));
278 connect(eventEditor,SIGNAL(eventDeleted()), 278 connect(eventEditor,SIGNAL(eventDeleted()),
279 mMainView,SLOT(eventDeleted())); 279 mMainView,SLOT(eventDeleted()));
280 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), 280 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)),
281 mMainView,SLOT(schedule_cancel(Incidence *))); 281 mMainView,SLOT(schedule_cancel(Incidence *)));
282 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), 282 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)),
283 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 283 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
284 connect( eventEditor, SIGNAL( showAgendaView( bool)), 284 connect( eventEditor, SIGNAL( showAgendaView( bool)),
285 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 285 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
286 286
287 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 287 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
288 // eventEditor,SLOT(updateCategoryConfig())); 288 // eventEditor,SLOT(updateCategoryConfig()));
289 // connect(eventEditor,SIGNAL(editCategories()), 289 // connect(eventEditor,SIGNAL(editCategories()),
290 // mCategoryEditDialog,SLOT(show())); 290 // mCategoryEditDialog,SLOT(show()));
291 connect(eventEditor,SIGNAL(dialogClose(Incidence*)), 291 connect(eventEditor,SIGNAL(dialogClose(Incidence*)),
292 mMainView,SLOT(dialogClosing(Incidence*))); 292 mMainView,SLOT(dialogClosing(Incidence*)));
293 293
294 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); 294 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject()));
295 295
296#ifndef DESKTOP_VERSION
297 eventEditor->resize( QApplication::desktop()->width() -20, 100 );
298#endif
296 return eventEditor; 299 return eventEditor;
297} 300}
298 301
299KOTodoEditor *KODialogManager::getTodoEditor() 302KOTodoEditor *KODialogManager::getTodoEditor()
300{ 303{
301 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), 304 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(),
302 mMainView ); 305 mMainView );
303 306
304 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 307 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
305 // todoEditor,SLOT(updateCategoryConfig())); 308 // todoEditor,SLOT(updateCategoryConfig()));
306 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); 309 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show()));
307 310
308 connect(todoEditor,SIGNAL(todoAdded(Todo *)), 311 connect(todoEditor,SIGNAL(todoAdded(Todo *)),
309 mMainView,SLOT(todoAdded(Todo *))); 312 mMainView,SLOT(todoAdded(Todo *)));
310 connect(todoEditor,SIGNAL(todoChanged(Todo *)), 313 connect(todoEditor,SIGNAL(todoChanged(Todo *)),
311 mMainView,SLOT(todoChanged(Todo *))); 314 mMainView,SLOT(todoChanged(Todo *)));
312 connect(todoEditor,SIGNAL(todoDeleted()), 315 connect(todoEditor,SIGNAL(todoDeleted()),
313 mMainView,SLOT(todoDeleted())); 316 mMainView,SLOT(todoDeleted()));
314 connect(todoEditor,SIGNAL(dialogClose(Incidence*)), 317 connect(todoEditor,SIGNAL(dialogClose(Incidence*)),
315 mMainView,SLOT(dialogClosing(Incidence*))); 318 mMainView,SLOT(dialogClosing(Incidence*)));
316 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), 319 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)),
317 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 320 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
318 connect( todoEditor, SIGNAL( showAgendaView( bool)), 321 connect( todoEditor, SIGNAL( showAgendaView( bool)),
319 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 322 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
320 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), 323 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)),
321 // mMainView,SLOT(schedule_cancel(Incidence *))); 324 // mMainView,SLOT(schedule_cancel(Incidence *)));
322 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); 325 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject()));
323 326#ifndef DESKTOP_VERSION
327 todoEditor->resize( QApplication::desktop()->width() -20, 100 );
328#endif
324 return todoEditor; 329 return todoEditor;
325} 330}
326 331
327void KODialogManager::updateSearchDialog() 332void KODialogManager::updateSearchDialog()
328{ 333{
329 if (mSearchDialog) mSearchDialog->updateView(); 334 if (mSearchDialog) mSearchDialog->updateView();
330} 335}
331 336
332void KODialogManager::setDocumentId( const QString &id ) 337void KODialogManager::setDocumentId( const QString &id )
333{ 338{
334 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); 339 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id );
335} 340}
336 341
337void KODialogManager::writeSettings( KConfig *config ) 342void KODialogManager::writeSettings( KConfig *config )
338{ 343{
339 if (mSearchDialog) 344 if (mSearchDialog)
340 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); 345 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout");
341} 346}