-rw-r--r-- | korganizer/calendarview.cpp | 14 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 17 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 7 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 6 |
6 files changed, 45 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7c8316f..3dac20b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2138,265 +2138,277 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
2138 | // } | 2138 | // } |
2139 | } else { | 2139 | } else { |
2140 | mViewManager->currentView()->updateView(); | 2140 | mViewManager->currentView()->updateView(); |
2141 | } | 2141 | } |
2142 | } | 2142 | } |
2143 | 2143 | ||
2144 | 2144 | ||
2145 | void CalendarView::updateTodoViews() | 2145 | void CalendarView::updateTodoViews() |
2146 | { | 2146 | { |
2147 | mTodoList->updateView(); | 2147 | mTodoList->updateView(); |
2148 | mViewManager->currentView()->updateView(); | 2148 | mViewManager->currentView()->updateView(); |
2149 | 2149 | ||
2150 | } | 2150 | } |
2151 | 2151 | ||
2152 | 2152 | ||
2153 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2153 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2154 | { | 2154 | { |
2155 | mTodoList->updateView(); | 2155 | mTodoList->updateView(); |
2156 | mViewManager->updateView(start, end); | 2156 | mViewManager->updateView(start, end); |
2157 | //mDateNavigator->updateView(); | 2157 | //mDateNavigator->updateView(); |
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | void CalendarView::updateView() | 2160 | void CalendarView::updateView() |
2161 | { | 2161 | { |
2162 | DateList tmpList = mNavigator->selectedDates(); | 2162 | DateList tmpList = mNavigator->selectedDates(); |
2163 | 2163 | ||
2164 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2164 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2165 | mTodoList->updateView(); | 2165 | mTodoList->updateView(); |
2166 | // We assume that the navigator only selects consecutive days. | 2166 | // We assume that the navigator only selects consecutive days. |
2167 | updateView( tmpList.first(), tmpList.last() ); | 2167 | updateView( tmpList.first(), tmpList.last() ); |
2168 | } | 2168 | } |
2169 | 2169 | ||
2170 | void CalendarView::updateUnmanagedViews() | 2170 | void CalendarView::updateUnmanagedViews() |
2171 | { | 2171 | { |
2172 | mDateNavigator->updateDayMatrix(); | 2172 | mDateNavigator->updateDayMatrix(); |
2173 | } | 2173 | } |
2174 | 2174 | ||
2175 | int CalendarView::msgItemDelete(const QString name) | 2175 | int CalendarView::msgItemDelete(const QString name) |
2176 | { | 2176 | { |
2177 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2177 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2178 | i18n("This item will be\npermanently deleted."), | 2178 | i18n("This item will be\npermanently deleted."), |
2179 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2179 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2180 | } | 2180 | } |
2181 | 2181 | ||
2182 | 2182 | ||
2183 | void CalendarView::edit_cut() | 2183 | void CalendarView::edit_cut() |
2184 | { | 2184 | { |
2185 | Event *anEvent=0; | 2185 | Event *anEvent=0; |
2186 | 2186 | ||
2187 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2187 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2188 | 2188 | ||
2189 | if (mViewManager->currentView()->isEventView()) { | 2189 | if (mViewManager->currentView()->isEventView()) { |
2190 | if ( incidence && incidence->type() == "Event" ) { | 2190 | if ( incidence && incidence->type() == "Event" ) { |
2191 | anEvent = static_cast<Event *>(incidence); | 2191 | anEvent = static_cast<Event *>(incidence); |
2192 | } | 2192 | } |
2193 | } | 2193 | } |
2194 | 2194 | ||
2195 | if (!anEvent) { | 2195 | if (!anEvent) { |
2196 | KNotifyClient::beep(); | 2196 | KNotifyClient::beep(); |
2197 | return; | 2197 | return; |
2198 | } | 2198 | } |
2199 | DndFactory factory( mCalendar ); | 2199 | DndFactory factory( mCalendar ); |
2200 | factory.cutIncidence(anEvent); | 2200 | factory.cutIncidence(anEvent); |
2201 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2201 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2202 | } | 2202 | } |
2203 | 2203 | ||
2204 | void CalendarView::edit_copy() | 2204 | void CalendarView::edit_copy() |
2205 | { | 2205 | { |
2206 | Event *anEvent=0; | 2206 | Event *anEvent=0; |
2207 | 2207 | ||
2208 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2208 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2209 | 2209 | ||
2210 | if (mViewManager->currentView()->isEventView()) { | 2210 | if (mViewManager->currentView()->isEventView()) { |
2211 | if ( incidence && incidence->type() == "Event" ) { | 2211 | if ( incidence && incidence->type() == "Event" ) { |
2212 | anEvent = static_cast<Event *>(incidence); | 2212 | anEvent = static_cast<Event *>(incidence); |
2213 | } | 2213 | } |
2214 | } | 2214 | } |
2215 | 2215 | ||
2216 | if (!anEvent) { | 2216 | if (!anEvent) { |
2217 | KNotifyClient::beep(); | 2217 | KNotifyClient::beep(); |
2218 | return; | 2218 | return; |
2219 | } | 2219 | } |
2220 | DndFactory factory( mCalendar ); | 2220 | DndFactory factory( mCalendar ); |
2221 | factory.copyIncidence(anEvent); | 2221 | factory.copyIncidence(anEvent); |
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | void CalendarView::edit_paste() | 2224 | void CalendarView::edit_paste() |
2225 | { | 2225 | { |
2226 | QDate date = mNavigator->selectedDates().first(); | 2226 | QDate date = mNavigator->selectedDates().first(); |
2227 | 2227 | ||
2228 | DndFactory factory( mCalendar ); | 2228 | DndFactory factory( mCalendar ); |
2229 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2229 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2230 | 2230 | ||
2231 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2231 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | void CalendarView::edit_options() | 2234 | void CalendarView::edit_options() |
2235 | { | 2235 | { |
2236 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2236 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2237 | emit save(); | 2237 | emit save(); |
2238 | emit saveStopTimer(); | 2238 | emit saveStopTimer(); |
2239 | mDialogManager->showOptionsDialog(); | 2239 | mDialogManager->showOptionsDialog(); |
2240 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2240 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2241 | emit saveStopTimer(); | 2241 | emit saveStopTimer(); |
2242 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2242 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2243 | i18n("Timezone settings"),i18n("Reload"))) { | 2243 | i18n("Timezone settings"),i18n("Reload"))) { |
2244 | qDebug("KO: TZ reload cancelled "); | 2244 | qDebug("KO: TZ reload cancelled "); |
2245 | return; | 2245 | return; |
2246 | } | 2246 | } |
2247 | qDebug("KO: Timezone change "); | 2247 | qDebug("KO: Timezone change "); |
2248 | openCalendar( MainWindow::defaultFileName() ); | 2248 | openCalendar( MainWindow::defaultFileName() ); |
2249 | setModified(true); | 2249 | setModified(true); |
2250 | } | 2250 | } |
2251 | else | 2251 | else |
2252 | qDebug("KO: No tz change "); | 2252 | qDebug("KO: No tz change "); |
2253 | 2253 | ||
2254 | } | 2254 | } |
2255 | 2255 | ||
2256 | 2256 | ||
2257 | void CalendarView::slotSelectPickerDate( QDate d) | 2257 | void CalendarView::slotSelectPickerDate( QDate d) |
2258 | { | 2258 | { |
2259 | mDateFrame->hide(); | 2259 | mDateFrame->hide(); |
2260 | if ( mDatePickerMode == 1 ) { | 2260 | if ( mDatePickerMode == 1 ) { |
2261 | mNavigator->slotDaySelect( d ); | 2261 | mNavigator->slotDaySelect( d ); |
2262 | } else if ( mDatePickerMode == 2 ) { | 2262 | } else if ( mDatePickerMode == 2 ) { |
2263 | if ( mMoveIncidence->type() == "Todo" ) { | 2263 | if ( mMoveIncidence->type() == "Todo" ) { |
2264 | Todo * to = (Todo *) mMoveIncidence; | 2264 | Todo * to = (Todo *) mMoveIncidence; |
2265 | QTime tim; | 2265 | QTime tim; |
2266 | int len = 0; | ||
2267 | if ( to->hasStartDate() && to->hasDueDate() ) | ||
2268 | len = to->dtStart().secsTo( to->dtDue()); | ||
2266 | if ( to->hasDueDate() ) | 2269 | if ( to->hasDueDate() ) |
2267 | tim = to->dtDue().time(); | 2270 | tim = to->dtDue().time(); |
2268 | else { | 2271 | else { |
2269 | tim = QTime ( 0,0,0 ); | 2272 | tim = QTime ( 0,0,0 ); |
2270 | to->setFloats( true ); | 2273 | to->setFloats( true ); |
2271 | to->setHasDueDate( true ); | 2274 | to->setHasDueDate( true ); |
2272 | } | 2275 | } |
2273 | QDateTime dt ( d,tim ); | 2276 | QDateTime dt ( d,tim ); |
2274 | to->setDtDue( dt ); | 2277 | to->setDtDue( dt ); |
2278 | |||
2279 | if ( to->hasStartDate() ) { | ||
2280 | if ( len>0 ) | ||
2281 | to->setDtStart(to->dtDue().addSecs( -len )); | ||
2282 | else | ||
2283 | if (to->dtStart() > to->dtDue() ) | ||
2284 | to->setDtStart(to->dtDue().addDays( -3 )); | ||
2285 | } | ||
2286 | |||
2275 | todoChanged( to ); | 2287 | todoChanged( to ); |
2276 | } else { | 2288 | } else { |
2277 | if ( mMoveIncidence->doesRecur() ) { | 2289 | if ( mMoveIncidence->doesRecur() ) { |
2278 | #if 0 | 2290 | #if 0 |
2279 | // PENDING implement this | 2291 | // PENDING implement this |
2280 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2292 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2281 | mCalendar()->addIncidence( newInc ); | 2293 | mCalendar()->addIncidence( newInc ); |
2282 | if ( mMoveIncidence->type() == "Todo" ) | 2294 | if ( mMoveIncidence->type() == "Todo" ) |
2283 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2295 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2284 | else | 2296 | else |
2285 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2297 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2286 | mMoveIncidence = newInc; | 2298 | mMoveIncidence = newInc; |
2287 | 2299 | ||
2288 | #endif | 2300 | #endif |
2289 | } | 2301 | } |
2290 | QTime tim = mMoveIncidence->dtStart().time(); | 2302 | QTime tim = mMoveIncidence->dtStart().time(); |
2291 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2303 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2292 | QDateTime dt ( d,tim ); | 2304 | QDateTime dt ( d,tim ); |
2293 | mMoveIncidence->setDtStart( dt ); | 2305 | mMoveIncidence->setDtStart( dt ); |
2294 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2306 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2295 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2307 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2296 | } | 2308 | } |
2297 | 2309 | ||
2298 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2310 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2299 | } | 2311 | } |
2300 | } | 2312 | } |
2301 | 2313 | ||
2302 | void CalendarView::removeCategories() | 2314 | void CalendarView::removeCategories() |
2303 | { | 2315 | { |
2304 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2316 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2305 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2317 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2306 | QStringList catIncList; | 2318 | QStringList catIncList; |
2307 | QStringList newCatList; | 2319 | QStringList newCatList; |
2308 | Incidence* inc = incList.first(); | 2320 | Incidence* inc = incList.first(); |
2309 | int i; | 2321 | int i; |
2310 | int count = 0; | 2322 | int count = 0; |
2311 | while ( inc ) { | 2323 | while ( inc ) { |
2312 | newCatList.clear(); | 2324 | newCatList.clear(); |
2313 | catIncList = inc->categories() ; | 2325 | catIncList = inc->categories() ; |
2314 | for( i = 0; i< catIncList.count(); ++i ) { | 2326 | for( i = 0; i< catIncList.count(); ++i ) { |
2315 | if ( catList.contains (catIncList[i])) | 2327 | if ( catList.contains (catIncList[i])) |
2316 | newCatList.append( catIncList[i] ); | 2328 | newCatList.append( catIncList[i] ); |
2317 | } | 2329 | } |
2318 | newCatList.sort(); | 2330 | newCatList.sort(); |
2319 | inc->setCategories( newCatList.join(",") ); | 2331 | inc->setCategories( newCatList.join(",") ); |
2320 | inc = incList.next(); | 2332 | inc = incList.next(); |
2321 | } | 2333 | } |
2322 | } | 2334 | } |
2323 | 2335 | ||
2324 | int CalendarView::addCategories() | 2336 | int CalendarView::addCategories() |
2325 | { | 2337 | { |
2326 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2338 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2327 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2339 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2328 | QStringList catIncList; | 2340 | QStringList catIncList; |
2329 | Incidence* inc = incList.first(); | 2341 | Incidence* inc = incList.first(); |
2330 | int i; | 2342 | int i; |
2331 | int count = 0; | 2343 | int count = 0; |
2332 | while ( inc ) { | 2344 | while ( inc ) { |
2333 | catIncList = inc->categories() ; | 2345 | catIncList = inc->categories() ; |
2334 | for( i = 0; i< catIncList.count(); ++i ) { | 2346 | for( i = 0; i< catIncList.count(); ++i ) { |
2335 | if ( !catList.contains (catIncList[i])) { | 2347 | if ( !catList.contains (catIncList[i])) { |
2336 | catList.append( catIncList[i] ); | 2348 | catList.append( catIncList[i] ); |
2337 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2349 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2338 | ++count; | 2350 | ++count; |
2339 | } | 2351 | } |
2340 | } | 2352 | } |
2341 | inc = incList.next(); | 2353 | inc = incList.next(); |
2342 | } | 2354 | } |
2343 | catList.sort(); | 2355 | catList.sort(); |
2344 | KOPrefs::instance()->mCustomCategories = catList; | 2356 | KOPrefs::instance()->mCustomCategories = catList; |
2345 | return count; | 2357 | return count; |
2346 | } | 2358 | } |
2347 | 2359 | ||
2348 | void CalendarView::manageCategories() | 2360 | void CalendarView::manageCategories() |
2349 | { | 2361 | { |
2350 | KOCatPrefs* cp = new KOCatPrefs(); | 2362 | KOCatPrefs* cp = new KOCatPrefs(); |
2351 | cp->show(); | 2363 | cp->show(); |
2352 | int w =cp->sizeHint().width() ; | 2364 | int w =cp->sizeHint().width() ; |
2353 | int h = cp->sizeHint().height() ; | 2365 | int h = cp->sizeHint().height() ; |
2354 | int dw = QApplication::desktop()->width(); | 2366 | int dw = QApplication::desktop()->width(); |
2355 | int dh = QApplication::desktop()->height(); | 2367 | int dh = QApplication::desktop()->height(); |
2356 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2368 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2357 | if ( !cp->exec() ) { | 2369 | if ( !cp->exec() ) { |
2358 | delete cp; | 2370 | delete cp; |
2359 | return; | 2371 | return; |
2360 | } | 2372 | } |
2361 | int count = 0; | 2373 | int count = 0; |
2362 | if ( cp->addCat() ) { | 2374 | if ( cp->addCat() ) { |
2363 | count = addCategories(); | 2375 | count = addCategories(); |
2364 | if ( count ) { | 2376 | if ( count ) { |
2365 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2377 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2366 | writeSettings(); | 2378 | writeSettings(); |
2367 | } else | 2379 | } else |
2368 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2380 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2369 | } else { | 2381 | } else { |
2370 | removeCategories(); | 2382 | removeCategories(); |
2371 | updateView(); | 2383 | updateView(); |
2372 | } | 2384 | } |
2373 | delete cp; | 2385 | delete cp; |
2374 | } | 2386 | } |
2375 | 2387 | ||
2376 | void CalendarView::beamIncidence(Incidence * Inc) | 2388 | void CalendarView::beamIncidence(Incidence * Inc) |
2377 | { | 2389 | { |
2378 | QPtrList<Incidence> delSel ; | 2390 | QPtrList<Incidence> delSel ; |
2379 | delSel.append(Inc); | 2391 | delSel.append(Inc); |
2380 | beamIncidenceList( delSel ); | 2392 | beamIncidenceList( delSel ); |
2381 | } | 2393 | } |
2382 | void CalendarView::beamCalendar() | 2394 | void CalendarView::beamCalendar() |
2383 | { | 2395 | { |
2384 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2396 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2385 | //qDebug("beamCalendar() "); | 2397 | //qDebug("beamCalendar() "); |
2386 | beamIncidenceList( delSel ); | 2398 | beamIncidenceList( delSel ); |
2387 | } | 2399 | } |
2388 | void CalendarView::beamFilteredCalendar() | 2400 | void CalendarView::beamFilteredCalendar() |
2389 | { | 2401 | { |
2390 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2402 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2391 | //qDebug("beamFilteredCalendar() "); | 2403 | //qDebug("beamFilteredCalendar() "); |
2392 | beamIncidenceList( delSel ); | 2404 | beamIncidenceList( delSel ); |
2393 | } | 2405 | } |
2394 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2406 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2395 | { | 2407 | { |
2396 | if ( beamDialog->exec () == QDialog::Rejected ) | 2408 | if ( beamDialog->exec () == QDialog::Rejected ) |
2397 | return; | 2409 | return; |
2398 | #ifdef DESKTOP_VERSION | 2410 | #ifdef DESKTOP_VERSION |
2399 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2411 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2400 | #else | 2412 | #else |
2401 | QString fn = "/tmp/kopibeamfile"; | 2413 | QString fn = "/tmp/kopibeamfile"; |
2402 | #endif | 2414 | #endif |
@@ -3685,228 +3697,228 @@ void CalendarView::toggleAllDaySize() | |||
3685 | void CalendarView::toggleExpand() | 3697 | void CalendarView::toggleExpand() |
3686 | { | 3698 | { |
3687 | // if ( mLeftFrame->isHidden() ) { | 3699 | // if ( mLeftFrame->isHidden() ) { |
3688 | // mLeftFrame->show(); | 3700 | // mLeftFrame->show(); |
3689 | // emit calendarViewExpanded( false ); | 3701 | // emit calendarViewExpanded( false ); |
3690 | // } else { | 3702 | // } else { |
3691 | // mLeftFrame->hide(); | 3703 | // mLeftFrame->hide(); |
3692 | // emit calendarViewExpanded( true ); | 3704 | // emit calendarViewExpanded( true ); |
3693 | // } | 3705 | // } |
3694 | //qDebug(" CalendarView::toggleExpand()"); | 3706 | //qDebug(" CalendarView::toggleExpand()"); |
3695 | globalFlagBlockAgenda = 1; | 3707 | globalFlagBlockAgenda = 1; |
3696 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3708 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3697 | globalFlagBlockAgenda = 5; | 3709 | globalFlagBlockAgenda = 5; |
3698 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3710 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3699 | //mViewManager->showView( 0, true ); | 3711 | //mViewManager->showView( 0, true ); |
3700 | } | 3712 | } |
3701 | 3713 | ||
3702 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3714 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3703 | { | 3715 | { |
3704 | setModified( modified ); | 3716 | setModified( modified ); |
3705 | } | 3717 | } |
3706 | 3718 | ||
3707 | Todo *CalendarView::selectedTodo() | 3719 | Todo *CalendarView::selectedTodo() |
3708 | { | 3720 | { |
3709 | Incidence *incidence = currentSelection(); | 3721 | Incidence *incidence = currentSelection(); |
3710 | if ( incidence && incidence->type() == "Todo" ) { | 3722 | if ( incidence && incidence->type() == "Todo" ) { |
3711 | return static_cast<Todo *>( incidence ); | 3723 | return static_cast<Todo *>( incidence ); |
3712 | } | 3724 | } |
3713 | 3725 | ||
3714 | incidence = mTodoList->selectedIncidences().first(); | 3726 | incidence = mTodoList->selectedIncidences().first(); |
3715 | if ( incidence && incidence->type() == "Todo" ) { | 3727 | if ( incidence && incidence->type() == "Todo" ) { |
3716 | return static_cast<Todo *>( incidence ); | 3728 | return static_cast<Todo *>( incidence ); |
3717 | } | 3729 | } |
3718 | 3730 | ||
3719 | return 0; | 3731 | return 0; |
3720 | } | 3732 | } |
3721 | 3733 | ||
3722 | void CalendarView::dialogClosing(Incidence *in) | 3734 | void CalendarView::dialogClosing(Incidence *in) |
3723 | { | 3735 | { |
3724 | // mDialogList.remove(in); | 3736 | // mDialogList.remove(in); |
3725 | } | 3737 | } |
3726 | 3738 | ||
3727 | void CalendarView::showIncidence() | 3739 | void CalendarView::showIncidence() |
3728 | { | 3740 | { |
3729 | Incidence *incidence = currentSelection(); | 3741 | Incidence *incidence = currentSelection(); |
3730 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3742 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3731 | if ( incidence ) { | 3743 | if ( incidence ) { |
3732 | ShowIncidenceVisitor v; | 3744 | ShowIncidenceVisitor v; |
3733 | v.act( incidence, this ); | 3745 | v.act( incidence, this ); |
3734 | } | 3746 | } |
3735 | } | 3747 | } |
3736 | void CalendarView::editIncidenceDescription() | 3748 | void CalendarView::editIncidenceDescription() |
3737 | { | 3749 | { |
3738 | mFlagEditDescription = true; | 3750 | mFlagEditDescription = true; |
3739 | editIncidence(); | 3751 | editIncidence(); |
3740 | mFlagEditDescription = false; | 3752 | mFlagEditDescription = false; |
3741 | } | 3753 | } |
3742 | void CalendarView::editIncidence() | 3754 | void CalendarView::editIncidence() |
3743 | { | 3755 | { |
3744 | // qDebug("editIncidence() "); | 3756 | // qDebug("editIncidence() "); |
3745 | Incidence *incidence = currentSelection(); | 3757 | Incidence *incidence = currentSelection(); |
3746 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3758 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3747 | if ( incidence ) { | 3759 | if ( incidence ) { |
3748 | EditIncidenceVisitor v; | 3760 | EditIncidenceVisitor v; |
3749 | v.act( incidence, this ); | 3761 | v.act( incidence, this ); |
3750 | } | 3762 | } |
3751 | } | 3763 | } |
3752 | 3764 | ||
3753 | void CalendarView::deleteIncidence() | 3765 | void CalendarView::deleteIncidence() |
3754 | { | 3766 | { |
3755 | Incidence *incidence = currentSelection(); | 3767 | Incidence *incidence = currentSelection(); |
3756 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3768 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3757 | if ( incidence ) { | 3769 | if ( incidence ) { |
3758 | deleteIncidence(incidence); | 3770 | deleteIncidence(incidence); |
3759 | } | 3771 | } |
3760 | } | 3772 | } |
3761 | 3773 | ||
3762 | void CalendarView::showIncidence(Incidence *incidence) | 3774 | void CalendarView::showIncidence(Incidence *incidence) |
3763 | { | 3775 | { |
3764 | if ( incidence ) { | 3776 | if ( incidence ) { |
3765 | ShowIncidenceVisitor v; | 3777 | ShowIncidenceVisitor v; |
3766 | v.act( incidence, this ); | 3778 | v.act( incidence, this ); |
3767 | } | 3779 | } |
3768 | } | 3780 | } |
3769 | 3781 | ||
3770 | void CalendarView::editIncidence(Incidence *incidence) | 3782 | void CalendarView::editIncidence(Incidence *incidence) |
3771 | { | 3783 | { |
3772 | if ( incidence ) { | 3784 | if ( incidence ) { |
3773 | 3785 | ||
3774 | EditIncidenceVisitor v; | 3786 | EditIncidenceVisitor v; |
3775 | v.act( incidence, this ); | 3787 | v.act( incidence, this ); |
3776 | 3788 | ||
3777 | } | 3789 | } |
3778 | } | 3790 | } |
3779 | 3791 | ||
3780 | void CalendarView::deleteIncidence(Incidence *incidence) | 3792 | void CalendarView::deleteIncidence(Incidence *incidence) |
3781 | { | 3793 | { |
3782 | //qDebug(" CalendarView::deleteIncidence "); | 3794 | //qDebug(" CalendarView::deleteIncidence "); |
3783 | if ( incidence ) { | 3795 | if ( incidence ) { |
3784 | DeleteIncidenceVisitor v; | 3796 | DeleteIncidenceVisitor v; |
3785 | v.act( incidence, this ); | 3797 | v.act( incidence, this ); |
3786 | } | 3798 | } |
3787 | } | 3799 | } |
3788 | 3800 | ||
3789 | 3801 | ||
3790 | void CalendarView::lookForOutgoingMessages() | 3802 | void CalendarView::lookForOutgoingMessages() |
3791 | { | 3803 | { |
3792 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3804 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3793 | ogd->loadMessages(); | 3805 | ogd->loadMessages(); |
3794 | } | 3806 | } |
3795 | 3807 | ||
3796 | void CalendarView::lookForIncomingMessages() | 3808 | void CalendarView::lookForIncomingMessages() |
3797 | { | 3809 | { |
3798 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3810 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3799 | icd->retrieve(); | 3811 | icd->retrieve(); |
3800 | } | 3812 | } |
3801 | 3813 | ||
3802 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3814 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3803 | { | 3815 | { |
3804 | bool deleteTodo = true; | 3816 | bool deleteTodo = true; |
3805 | QPtrList<Incidence> subTodos; | 3817 | QPtrList<Incidence> subTodos; |
3806 | Incidence *aTodo; | 3818 | Incidence *aTodo; |
3807 | subTodos = t->relations(); | 3819 | subTodos = t->relations(); |
3808 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3820 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3809 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3821 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3810 | deleteTodo = false; | 3822 | deleteTodo = false; |
3811 | } | 3823 | } |
3812 | if ( deleteTodo ) { | 3824 | if ( deleteTodo ) { |
3813 | if ( t->isCompleted() ) { | 3825 | if ( t->isCompleted() && !t->doesRecur()) { |
3814 | checkExternalId( t ); | 3826 | checkExternalId( t ); |
3815 | mCalendar->deleteTodo( t ); | 3827 | mCalendar->deleteTodo( t ); |
3816 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3828 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3817 | } | 3829 | } |
3818 | else | 3830 | else |
3819 | deleteTodo = false; | 3831 | deleteTodo = false; |
3820 | } | 3832 | } |
3821 | return deleteTodo; | 3833 | return deleteTodo; |
3822 | 3834 | ||
3823 | } | 3835 | } |
3824 | void CalendarView::purgeCompleted() | 3836 | void CalendarView::purgeCompleted() |
3825 | { | 3837 | { |
3826 | int result = KMessageBox::warningContinueCancel(this, | 3838 | int result = KMessageBox::warningContinueCancel(this, |
3827 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3839 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3828 | 3840 | ||
3829 | if (result == KMessageBox::Continue) { | 3841 | if (result == KMessageBox::Continue) { |
3830 | 3842 | ||
3831 | QPtrList<Todo> todoCal; | 3843 | QPtrList<Todo> todoCal; |
3832 | QPtrList<Todo> rootTodos; | 3844 | QPtrList<Todo> rootTodos; |
3833 | //QPtrList<Incidence> rel; | 3845 | //QPtrList<Incidence> rel; |
3834 | Todo *aTodo;//, *rTodo; | 3846 | Todo *aTodo;//, *rTodo; |
3835 | Incidence *rIncidence; | 3847 | Incidence *rIncidence; |
3836 | bool childDelete = false; | 3848 | bool childDelete = false; |
3837 | bool deletedOne = true; | 3849 | bool deletedOne = true; |
3838 | todoCal = calendar()->todos(); | 3850 | todoCal = calendar()->todos(); |
3839 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3851 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3840 | if ( !aTodo->relatedTo() ) | 3852 | if ( !aTodo->relatedTo() ) |
3841 | rootTodos.append( aTodo ); | 3853 | rootTodos.append( aTodo ); |
3842 | } | 3854 | } |
3843 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3855 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3844 | removeCompletedSubTodos( aTodo ); | 3856 | removeCompletedSubTodos( aTodo ); |
3845 | } | 3857 | } |
3846 | 3858 | ||
3847 | updateView(); | 3859 | updateView(); |
3848 | } | 3860 | } |
3849 | } | 3861 | } |
3850 | 3862 | ||
3851 | void CalendarView::slotCalendarChanged() | 3863 | void CalendarView::slotCalendarChanged() |
3852 | { | 3864 | { |
3853 | ; | 3865 | ; |
3854 | } | 3866 | } |
3855 | 3867 | ||
3856 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3868 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3857 | { | 3869 | { |
3858 | //qDebug(" alendarView::keyPressEvent "); | 3870 | //qDebug(" alendarView::keyPressEvent "); |
3859 | e->ignore(); | 3871 | e->ignore(); |
3860 | } | 3872 | } |
3861 | 3873 | ||
3862 | 3874 | ||
3863 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3875 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3864 | { | 3876 | { |
3865 | // mSyncManager = manager; | 3877 | // mSyncManager = manager; |
3866 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3878 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3867 | qDebug("KO: SyncKDE request detected!"); | 3879 | qDebug("KO: SyncKDE request detected!"); |
3868 | } | 3880 | } |
3869 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3881 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3870 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3882 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3871 | return syncCalendar( filename, mode ); | 3883 | return syncCalendar( filename, mode ); |
3872 | } | 3884 | } |
3873 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3885 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3874 | { | 3886 | { |
3875 | //mSyncManager = manager; | 3887 | //mSyncManager = manager; |
3876 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3888 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3877 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3889 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3878 | if ( resource == "sharp" ) | 3890 | if ( resource == "sharp" ) |
3879 | syncExternal( 0 ); | 3891 | syncExternal( 0 ); |
3880 | if ( resource == "phone" ) | 3892 | if ( resource == "phone" ) |
3881 | syncExternal( 1 ); | 3893 | syncExternal( 1 ); |
3882 | // pending setmodified | 3894 | // pending setmodified |
3883 | return true; | 3895 | return true; |
3884 | } | 3896 | } |
3885 | void CalendarView::setSyncManager(KSyncManager* manager) | 3897 | void CalendarView::setSyncManager(KSyncManager* manager) |
3886 | { | 3898 | { |
3887 | mSyncManager = manager; | 3899 | mSyncManager = manager; |
3888 | } | 3900 | } |
3889 | 3901 | ||
3890 | void CalendarView::removeSyncInfo( QString syncProfile) | 3902 | void CalendarView::removeSyncInfo( QString syncProfile) |
3891 | { | 3903 | { |
3892 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 3904 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
3893 | mCalendar->removeSyncInfo( syncProfile ); | 3905 | mCalendar->removeSyncInfo( syncProfile ); |
3894 | 3906 | ||
3895 | } | 3907 | } |
3896 | 3908 | ||
3897 | void CalendarView::undo_delete() | 3909 | void CalendarView::undo_delete() |
3898 | { | 3910 | { |
3899 | //qDebug("undo_delete() "); | 3911 | //qDebug("undo_delete() "); |
3900 | Incidence* undo = mCalendar->undoIncidence(); | 3912 | Incidence* undo = mCalendar->undoIncidence(); |
3901 | if ( !undo ) { | 3913 | if ( !undo ) { |
3902 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 3914 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
3903 | i18n("KO/Pi")); | 3915 | i18n("KO/Pi")); |
3904 | return; | 3916 | return; |
3905 | } | 3917 | } |
3906 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 3918 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
3907 | i18n("\nAre you sure you want\nto restore this?"), | 3919 | i18n("\nAre you sure you want\nto restore this?"), |
3908 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 3920 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
3909 | mCalendar->undoDeleteIncidence(); | 3921 | mCalendar->undoDeleteIncidence(); |
3910 | updateView(); | 3922 | updateView(); |
3911 | } | 3923 | } |
3912 | } | 3924 | } |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 13d8398..4ff6899 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -874,438 +874,451 @@ DateList KOAgendaView::selectedDates() | |||
874 | if (qd.isValid()) selected.append(qd); | 874 | if (qd.isValid()) selected.append(qd); |
875 | 875 | ||
876 | qd = mAllDayAgenda->selectedIncidenceDate(); | 876 | qd = mAllDayAgenda->selectedIncidenceDate(); |
877 | if (qd.isValid()) selected.append(qd); | 877 | if (qd.isValid()) selected.append(qd); |
878 | 878 | ||
879 | return selected; | 879 | return selected; |
880 | } | 880 | } |
881 | 881 | ||
882 | 882 | ||
883 | void KOAgendaView::updateView() | 883 | void KOAgendaView::updateView() |
884 | { | 884 | { |
885 | if ( mBlockUpdating ) | 885 | if ( mBlockUpdating ) |
886 | return; | 886 | return; |
887 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 887 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
888 | fillAgenda(); | 888 | fillAgenda(); |
889 | 889 | ||
890 | } | 890 | } |
891 | 891 | ||
892 | 892 | ||
893 | /* | 893 | /* |
894 | Update configuration settings for the agenda view. This method is not | 894 | Update configuration settings for the agenda view. This method is not |
895 | complete. | 895 | complete. |
896 | */ | 896 | */ |
897 | void KOAgendaView::updateConfig() | 897 | void KOAgendaView::updateConfig() |
898 | { | 898 | { |
899 | if ( mBlockUpdating ) | 899 | if ( mBlockUpdating ) |
900 | return; | 900 | return; |
901 | 901 | ||
902 | 902 | ||
903 | 903 | ||
904 | // update config for children | 904 | // update config for children |
905 | mTimeLabels->updateConfig(); | 905 | mTimeLabels->updateConfig(); |
906 | mAgenda->storePosition(); | 906 | mAgenda->storePosition(); |
907 | mAgenda->updateConfig(); | 907 | mAgenda->updateConfig(); |
908 | mAllDayAgenda->updateConfig(); | 908 | mAllDayAgenda->updateConfig(); |
909 | // widget synchronization | 909 | // widget synchronization |
910 | //TODO: find a better way, maybe signal/slot | 910 | //TODO: find a better way, maybe signal/slot |
911 | mTimeLabels->positionChanged(); | 911 | mTimeLabels->positionChanged(); |
912 | 912 | ||
913 | // for some reason, this needs to be called explicitly | 913 | // for some reason, this needs to be called explicitly |
914 | mTimeLabels->repaint(); | 914 | mTimeLabels->repaint(); |
915 | 915 | ||
916 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 916 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
917 | 917 | ||
918 | // ToolTips displaying summary of events | 918 | // ToolTips displaying summary of events |
919 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 919 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
920 | ->mEnableToolTips); | 920 | ->mEnableToolTips); |
921 | 921 | ||
922 | //setHolidayMasks(); | 922 | //setHolidayMasks(); |
923 | 923 | ||
924 | //createDayLabels(); called by via updateView(); | 924 | //createDayLabels(); called by via updateView(); |
925 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 925 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
926 | updateView(); | 926 | updateView(); |
927 | mAgenda->restorePosition(); | 927 | mAgenda->restorePosition(); |
928 | } | 928 | } |
929 | 929 | ||
930 | 930 | ||
931 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 931 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
932 | { | 932 | { |
933 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 933 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
934 | //qDebug("KOAgendaView::updateEventDates "); | 934 | //qDebug("KOAgendaView::updateEventDates "); |
935 | QDateTime startDt,endDt; | 935 | QDateTime startDt,endDt; |
936 | QDate startDate; | 936 | QDate startDate; |
937 | int lenInSecs; | 937 | int lenInSecs; |
938 | // if ( type == KOAgenda::RESIZETOP ) | 938 | // if ( type == KOAgenda::RESIZETOP ) |
939 | // qDebug("RESIZETOP "); | 939 | // qDebug("RESIZETOP "); |
940 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 940 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
941 | // qDebug("RESIZEBOTTOM "); | 941 | // qDebug("RESIZEBOTTOM "); |
942 | // if ( type == KOAgenda::MOVE ) | 942 | // if ( type == KOAgenda::MOVE ) |
943 | // qDebug("MOVE "); | 943 | // qDebug("MOVE "); |
944 | if ( item->incidence()->type() == "Event" ) { | 944 | if ( item->incidence()->type() == "Event" ) { |
945 | startDt =item->incidence()->dtStart(); | 945 | startDt =item->incidence()->dtStart(); |
946 | endDt = item->incidence()->dtEnd(); | 946 | endDt = item->incidence()->dtEnd(); |
947 | lenInSecs = startDt.secsTo( endDt ); | 947 | lenInSecs = startDt.secsTo( endDt ); |
948 | } | 948 | } |
949 | 949 | ||
950 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 950 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
951 | 951 | ||
952 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 952 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
953 | startDate = mSelectedDates[item->mLastMoveXPos]; | 953 | startDate = mSelectedDates[item->mLastMoveXPos]; |
954 | } else { | 954 | } else { |
955 | if (item->cellX() < 0) { | 955 | if (item->cellX() < 0) { |
956 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 956 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
957 | } else { | 957 | } else { |
958 | startDate = mSelectedDates[item->cellX()]; | 958 | startDate = mSelectedDates[item->cellX()]; |
959 | } | 959 | } |
960 | } | 960 | } |
961 | startDt.setDate(startDate); | 961 | startDt.setDate(startDate); |
962 | 962 | ||
963 | if (item->incidence()->doesFloat()) { | 963 | if (item->incidence()->doesFloat()) { |
964 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 964 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
965 | } else { | 965 | } else { |
966 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 966 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
967 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 967 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
968 | if ( item->incidence()->type() == "Event" ) { | 968 | if ( item->incidence()->type() == "Event" ) { |
969 | if ( type == KOAgenda::MOVE ) { | 969 | if ( type == KOAgenda::MOVE ) { |
970 | endDt = startDt.addSecs(lenInSecs); | 970 | endDt = startDt.addSecs(lenInSecs); |
971 | 971 | ||
972 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 972 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
973 | if (item->lastMultiItem()) { | 973 | if (item->lastMultiItem()) { |
974 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 974 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
975 | endDt.setDate(startDate. | 975 | endDt.setDate(startDate. |
976 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 976 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
977 | } else { | 977 | } else { |
978 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 978 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
979 | endDt.setDate(startDate); | 979 | endDt.setDate(startDate); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | } else { | 982 | } else { |
983 | // todo | 983 | // todo |
984 | if (item->lastMultiItem()) { | 984 | if (item->lastMultiItem()) { |
985 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 985 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
986 | endDt.setDate(startDate. | 986 | endDt.setDate(startDate. |
987 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 987 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
988 | } else { | 988 | } else { |
989 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 989 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
990 | if ( item->cellYBottom() > 0 ) | 990 | if ( item->cellYBottom() > 0 ) |
991 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 991 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
992 | else | 992 | else |
993 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 993 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
994 | endDt.setDate(startDate); | 994 | endDt.setDate(startDate); |
995 | } | 995 | } |
996 | } | 996 | } |
997 | } | 997 | } |
998 | if ( item->incidence()->type() == "Event" ) { | 998 | if ( item->incidence()->type() == "Event" ) { |
999 | item->incidence()->setDtStart(startDt); | 999 | item->incidence()->setDtStart(startDt); |
1000 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1000 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1001 | } else if ( item->incidence()->type() == "Todo" ) { | 1001 | } else if ( item->incidence()->type() == "Todo" ) { |
1002 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); | 1002 | Todo* to = static_cast<Todo*>(item->incidence()); |
1003 | |||
1004 | int len = 0; | ||
1005 | if ( to->hasStartDate() && to->hasDueDate() ) | ||
1006 | len = to->dtStart().secsTo( to->dtDue()); | ||
1007 | to->setDtDue(endDt); | ||
1008 | if ( to->hasStartDate() ) { | ||
1009 | if ( len>0 ) | ||
1010 | to->setDtStart(to->dtDue().addSecs( -len )); | ||
1011 | else | ||
1012 | if (to->dtStart() > to->dtDue() ) | ||
1013 | to->setDtStart(to->dtDue().addDays( -3 )); | ||
1014 | } | ||
1015 | |||
1003 | } | 1016 | } |
1004 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1017 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1005 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1018 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1006 | item->setItemDate(startDt.date()); | 1019 | item->setItemDate(startDt.date()); |
1007 | //item->updateItem(); | 1020 | //item->updateItem(); |
1008 | if ( item->incidence()->type() == "Todo" ) { | 1021 | if ( item->incidence()->type() == "Todo" ) { |
1009 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1022 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1010 | 1023 | ||
1011 | } | 1024 | } |
1012 | else | 1025 | else |
1013 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1026 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1014 | item->updateItem(); | 1027 | item->updateItem(); |
1015 | } | 1028 | } |
1016 | 1029 | ||
1017 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1030 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1018 | { | 1031 | { |
1019 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1032 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1020 | 1033 | ||
1021 | mSelectedDates.clear(); | 1034 | mSelectedDates.clear(); |
1022 | // qDebug("KOAgendaView::showDates "); | 1035 | // qDebug("KOAgendaView::showDates "); |
1023 | QDate d = start; | 1036 | QDate d = start; |
1024 | while (d <= end) { | 1037 | while (d <= end) { |
1025 | mSelectedDates.append(d); | 1038 | mSelectedDates.append(d); |
1026 | d = d.addDays( 1 ); | 1039 | d = d.addDays( 1 ); |
1027 | } | 1040 | } |
1028 | 1041 | ||
1029 | // and update the view | 1042 | // and update the view |
1030 | fillAgenda(); | 1043 | fillAgenda(); |
1031 | } | 1044 | } |
1032 | 1045 | ||
1033 | 1046 | ||
1034 | void KOAgendaView::showEvents(QPtrList<Event>) | 1047 | void KOAgendaView::showEvents(QPtrList<Event>) |
1035 | { | 1048 | { |
1036 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1049 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1037 | } | 1050 | } |
1038 | 1051 | ||
1039 | void KOAgendaView::changeEventDisplay(Event *, int) | 1052 | void KOAgendaView::changeEventDisplay(Event *, int) |
1040 | { | 1053 | { |
1041 | // qDebug("KOAgendaView::changeEventDisplay "); | 1054 | // qDebug("KOAgendaView::changeEventDisplay "); |
1042 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1055 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1043 | // this should be re-written to be MUCH smarter. Right now we | 1056 | // this should be re-written to be MUCH smarter. Right now we |
1044 | // are just playing dumb. | 1057 | // are just playing dumb. |
1045 | fillAgenda(); | 1058 | fillAgenda(); |
1046 | } | 1059 | } |
1047 | 1060 | ||
1048 | void KOAgendaView::fillAgenda(const QDate &) | 1061 | void KOAgendaView::fillAgenda(const QDate &) |
1049 | { | 1062 | { |
1050 | // qDebug("KOAgendaView::fillAgenda "); | 1063 | // qDebug("KOAgendaView::fillAgenda "); |
1051 | fillAgenda(); | 1064 | fillAgenda(); |
1052 | } | 1065 | } |
1053 | 1066 | ||
1054 | void KOAgendaView::fillAgenda() | 1067 | void KOAgendaView::fillAgenda() |
1055 | { | 1068 | { |
1056 | if ( globalFlagBlockStartup ) | 1069 | if ( globalFlagBlockStartup ) |
1057 | return; | 1070 | return; |
1058 | if ( globalFlagBlockAgenda == 1 ) | 1071 | if ( globalFlagBlockAgenda == 1 ) |
1059 | return; | 1072 | return; |
1060 | //if ( globalFlagBlockAgenda == 2 ) | 1073 | //if ( globalFlagBlockAgenda == 2 ) |
1061 | //globalFlagBlockAgenda = 0; | 1074 | //globalFlagBlockAgenda = 0; |
1062 | // globalFlagBlockPainting = false; | 1075 | // globalFlagBlockPainting = false; |
1063 | if ( globalFlagBlockAgenda == 0 ) | 1076 | if ( globalFlagBlockAgenda == 0 ) |
1064 | globalFlagBlockAgenda = 1; | 1077 | globalFlagBlockAgenda = 1; |
1065 | // clearView(); | 1078 | // clearView(); |
1066 | //qDebug("fillAgenda()++++ "); | 1079 | //qDebug("fillAgenda()++++ "); |
1067 | globalFlagBlockAgendaItemPaint = 1; | 1080 | globalFlagBlockAgendaItemPaint = 1; |
1068 | 1081 | ||
1069 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1082 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1070 | mAgenda->changeColumns(mSelectedDates.count()); | 1083 | mAgenda->changeColumns(mSelectedDates.count()); |
1071 | qApp->processEvents(); | 1084 | qApp->processEvents(); |
1072 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1085 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1073 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1086 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1074 | setHolidayMasks(); | 1087 | setHolidayMasks(); |
1075 | 1088 | ||
1076 | //mAgenda->hideUnused(); | 1089 | //mAgenda->hideUnused(); |
1077 | //mAllDayAgenda->hideUnused(); | 1090 | //mAllDayAgenda->hideUnused(); |
1078 | 1091 | ||
1079 | // mAgenda->blockNextRepaint( false ); | 1092 | // mAgenda->blockNextRepaint( false ); |
1080 | // mAgenda->viewport()->repaint(); | 1093 | // mAgenda->viewport()->repaint(); |
1081 | // mAgenda->blockNextRepaint( true ); | 1094 | // mAgenda->blockNextRepaint( true ); |
1082 | mMinY.resize(mSelectedDates.count()); | 1095 | mMinY.resize(mSelectedDates.count()); |
1083 | mMaxY.resize(mSelectedDates.count()); | 1096 | mMaxY.resize(mSelectedDates.count()); |
1084 | 1097 | ||
1085 | QPtrList<Event> dayEvents; | 1098 | QPtrList<Event> dayEvents; |
1086 | 1099 | ||
1087 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1100 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1088 | // Therefore, gtodoset all of them. | 1101 | // Therefore, gtodoset all of them. |
1089 | QPtrList<Todo> todos = calendar()->todos(); | 1102 | QPtrList<Todo> todos = calendar()->todos(); |
1090 | 1103 | ||
1091 | mAgenda->setDateList(mSelectedDates); | 1104 | mAgenda->setDateList(mSelectedDates); |
1092 | 1105 | ||
1093 | QDate today = QDate::currentDate(); | 1106 | QDate today = QDate::currentDate(); |
1094 | 1107 | ||
1095 | DateList::ConstIterator dit; | 1108 | DateList::ConstIterator dit; |
1096 | int curCol = 0; | 1109 | int curCol = 0; |
1097 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1110 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1098 | QDate currentDate = *dit; | 1111 | QDate currentDate = *dit; |
1099 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1112 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1100 | // << endl; | 1113 | // << endl; |
1101 | 1114 | ||
1102 | dayEvents = calendar()->events(currentDate,true); | 1115 | dayEvents = calendar()->events(currentDate,true); |
1103 | 1116 | ||
1104 | // Default values, which can never be reached | 1117 | // Default values, which can never be reached |
1105 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1118 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1106 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1119 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1107 | 1120 | ||
1108 | unsigned int numEvent; | 1121 | unsigned int numEvent; |
1109 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1122 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1110 | Event *event = dayEvents.at(numEvent); | 1123 | Event *event = dayEvents.at(numEvent); |
1111 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1124 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1112 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1125 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1113 | continue; | 1126 | continue; |
1114 | // kdDebug() << " Event: " << event->summary() << endl; | 1127 | // kdDebug() << " Event: " << event->summary() << endl; |
1115 | 1128 | ||
1116 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1129 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1117 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1130 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1118 | 1131 | ||
1119 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1132 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1120 | 1133 | ||
1121 | if (event->doesFloat()) { | 1134 | if (event->doesFloat()) { |
1122 | if (event->recurrence()->doesRecur()) { | 1135 | if (event->recurrence()->doesRecur()) { |
1123 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1136 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1124 | } else { | 1137 | } else { |
1125 | if (beginX <= 0 && curCol == 0) { | 1138 | if (beginX <= 0 && curCol == 0) { |
1126 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1139 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1127 | } else if (beginX == curCol) { | 1140 | } else if (beginX == curCol) { |
1128 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1141 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1129 | } | 1142 | } |
1130 | } | 1143 | } |
1131 | } else if (event->isMultiDay()) { | 1144 | } else if (event->isMultiDay()) { |
1132 | if ( event->doesRecur () ) { | 1145 | if ( event->doesRecur () ) { |
1133 | QDate dateit = currentDate; | 1146 | QDate dateit = currentDate; |
1134 | int count = 0; | 1147 | int count = 0; |
1135 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1148 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1136 | while (! event->recursOn( dateit ) && count <= max ) { | 1149 | while (! event->recursOn( dateit ) && count <= max ) { |
1137 | ++count; | 1150 | ++count; |
1138 | dateit = dateit.addDays( -1 ); | 1151 | dateit = dateit.addDays( -1 ); |
1139 | } | 1152 | } |
1140 | bool ok; | 1153 | bool ok; |
1141 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1154 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1142 | if ( ok ) | 1155 | if ( ok ) |
1143 | { | 1156 | { |
1144 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1157 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1145 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1158 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1146 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1159 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1147 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1160 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1148 | 1161 | ||
1149 | } | 1162 | } |
1150 | } | 1163 | } |
1151 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1164 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1152 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1165 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1153 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1166 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1154 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1167 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1155 | //qDebug("insert!!! "); | 1168 | //qDebug("insert!!! "); |
1156 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1169 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1157 | } | 1170 | } |
1158 | if (beginX == curCol) { | 1171 | if (beginX == curCol) { |
1159 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1172 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1160 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1173 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1161 | } else if (endX == curCol) { | 1174 | } else if (endX == curCol) { |
1162 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1175 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1163 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1176 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1164 | } else { | 1177 | } else { |
1165 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1178 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1166 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1179 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1167 | } | 1180 | } |
1168 | } else { | 1181 | } else { |
1169 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1182 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1170 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1183 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1171 | if (endY < startY) endY = startY; | 1184 | if (endY < startY) endY = startY; |
1172 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1185 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1173 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1186 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1174 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1187 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1175 | } | 1188 | } |
1176 | } | 1189 | } |
1177 | // ---------- [display Todos -------------- | 1190 | // ---------- [display Todos -------------- |
1178 | unsigned int numTodo; | 1191 | unsigned int numTodo; |
1179 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1192 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1180 | Todo *todo = todos.at(numTodo); | 1193 | Todo *todo = todos.at(numTodo); |
1181 | 1194 | ||
1182 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1195 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1183 | 1196 | ||
1184 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1197 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1185 | // Already completed items can be displayed on their original due date | 1198 | // Already completed items can be displayed on their original due date |
1186 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1199 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1187 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1200 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1188 | bool fillIn = false; | 1201 | bool fillIn = false; |
1189 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1202 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1190 | fillIn = true; | 1203 | fillIn = true; |
1191 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1204 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1192 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1205 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1193 | if ( fillIn ) { | 1206 | if ( fillIn ) { |
1194 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1207 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1195 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1208 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1196 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1209 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1197 | } | 1210 | } |
1198 | else { | 1211 | else { |
1199 | QDateTime dt; | 1212 | QDateTime dt; |
1200 | if ( todo->hasCompletedDate() ) | 1213 | if ( todo->hasCompletedDate() ) |
1201 | dt = todo->completed(); | 1214 | dt = todo->completed(); |
1202 | else | 1215 | else |
1203 | dt = todo->dtDue();; | 1216 | dt = todo->dtDue();; |
1204 | 1217 | ||
1205 | 1218 | ||
1206 | int endY = mAgenda->timeToY(dt.time()) - 1; | 1219 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1207 | int hi = (18/KOPrefs::instance()->mHourSize); | 1220 | int hi = (18/KOPrefs::instance()->mHourSize); |
1208 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1221 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1209 | int startY = endY -hi; | 1222 | int startY = endY -hi; |
1210 | 1223 | ||
1211 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1224 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1212 | 1225 | ||
1213 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1226 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1214 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1227 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1215 | } | 1228 | } |
1216 | } | 1229 | } |
1217 | } | 1230 | } |
1218 | // ---------- display Todos] -------------- | 1231 | // ---------- display Todos] -------------- |
1219 | 1232 | ||
1220 | ++curCol; | 1233 | ++curCol; |
1221 | } | 1234 | } |
1222 | mAgenda->hideUnused(); | 1235 | mAgenda->hideUnused(); |
1223 | mAllDayAgenda->hideUnused(); | 1236 | mAllDayAgenda->hideUnused(); |
1224 | mAgenda->checkScrollBoundaries(); | 1237 | mAgenda->checkScrollBoundaries(); |
1225 | 1238 | ||
1226 | deleteSelectedDateTime(); | 1239 | deleteSelectedDateTime(); |
1227 | 1240 | ||
1228 | createDayLabels(); | 1241 | createDayLabels(); |
1229 | emit incidenceSelected( 0 ); | 1242 | emit incidenceSelected( 0 ); |
1230 | 1243 | ||
1231 | if ( globalFlagBlockAgenda == 2 ) { | 1244 | if ( globalFlagBlockAgenda == 2 ) { |
1232 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1245 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1233 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1246 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1234 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1247 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1235 | setStartHour( QTime::currentTime ().hour() ); | 1248 | setStartHour( QTime::currentTime ().hour() ); |
1236 | // qApp->processEvents(); | 1249 | // qApp->processEvents(); |
1237 | } | 1250 | } |
1238 | qApp->processEvents(); | 1251 | qApp->processEvents(); |
1239 | //qDebug("qApp->processEvents(); END "); | 1252 | //qDebug("qApp->processEvents(); END "); |
1240 | globalFlagBlockAgenda = 0; | 1253 | globalFlagBlockAgenda = 0; |
1241 | 1254 | ||
1242 | // mAgenda->hideUnused(); | 1255 | // mAgenda->hideUnused(); |
1243 | //mAllDayAgenda->hideUnused(); | 1256 | //mAllDayAgenda->hideUnused(); |
1244 | mAllDayAgenda->drawContentsToPainter(); | 1257 | mAllDayAgenda->drawContentsToPainter(); |
1245 | mAgenda->drawContentsToPainter(); | 1258 | mAgenda->drawContentsToPainter(); |
1246 | repaintAgenda(); | 1259 | repaintAgenda(); |
1247 | // mAgenda->finishUpdate(); | 1260 | // mAgenda->finishUpdate(); |
1248 | //mAllDayAgenda->finishUpdate(); | 1261 | //mAllDayAgenda->finishUpdate(); |
1249 | 1262 | ||
1250 | // repaintAgenda(); | 1263 | // repaintAgenda(); |
1251 | //qApp->processEvents(); | 1264 | //qApp->processEvents(); |
1252 | // globalFlagBlockAgenda = 0; | 1265 | // globalFlagBlockAgenda = 0; |
1253 | } | 1266 | } |
1254 | void KOAgendaView::repaintAgenda() | 1267 | void KOAgendaView::repaintAgenda() |
1255 | { | 1268 | { |
1256 | // mAllDayAgenda->drawContentsToPainter(); | 1269 | // mAllDayAgenda->drawContentsToPainter(); |
1257 | // mAllDayAgenda->viewport()->repaint( false ); | 1270 | // mAllDayAgenda->viewport()->repaint( false ); |
1258 | // mAgenda->drawContentsToPainter(); | 1271 | // mAgenda->drawContentsToPainter(); |
1259 | // mAgenda->viewport()->repaint( false ); | 1272 | // mAgenda->viewport()->repaint( false ); |
1260 | // qApp->processEvents(); | 1273 | // qApp->processEvents(); |
1261 | 1274 | ||
1262 | //qDebug("KOAgendaView::repaintAgenda() "); | 1275 | //qDebug("KOAgendaView::repaintAgenda() "); |
1263 | //qApp->processEvents(); | 1276 | //qApp->processEvents(); |
1264 | mAgenda->viewport()->repaint( false ); | 1277 | mAgenda->viewport()->repaint( false ); |
1265 | mAllDayAgenda->viewport()->repaint( false ); | 1278 | mAllDayAgenda->viewport()->repaint( false ); |
1266 | mAgenda->finishUpdate(); | 1279 | mAgenda->finishUpdate(); |
1267 | mAllDayAgenda->finishUpdate(); | 1280 | mAllDayAgenda->finishUpdate(); |
1268 | } | 1281 | } |
1269 | 1282 | ||
1270 | 1283 | ||
1271 | void KOAgendaView::clearView() | 1284 | void KOAgendaView::clearView() |
1272 | { | 1285 | { |
1273 | // kdDebug() << "ClearView" << endl; | 1286 | // kdDebug() << "ClearView" << endl; |
1274 | mAllDayAgenda->clear(); | 1287 | mAllDayAgenda->clear(); |
1275 | mAgenda->clear(); | 1288 | mAgenda->clear(); |
1276 | } | 1289 | } |
1277 | 1290 | ||
1278 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1291 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1279 | const QDate &td) | 1292 | const QDate &td) |
1280 | { | 1293 | { |
1281 | #ifndef KORG_NOPRINTER | 1294 | #ifndef KORG_NOPRINTER |
1282 | if (fd == td) | 1295 | if (fd == td) |
1283 | calPrinter->preview(CalPrinter::Day, fd, td); | 1296 | calPrinter->preview(CalPrinter::Day, fd, td); |
1284 | else | 1297 | else |
1285 | calPrinter->preview(CalPrinter::Week, fd, td); | 1298 | calPrinter->preview(CalPrinter::Week, fd, td); |
1286 | #endif | 1299 | #endif |
1287 | } | 1300 | } |
1288 | 1301 | ||
1289 | // void KOAgendaView::updateMovedTodo() | 1302 | // void KOAgendaView::updateMovedTodo() |
1290 | // { | 1303 | // { |
1291 | // // updateConfig(); | 1304 | // // updateConfig(); |
1292 | // // emit updateTodoViews(); | 1305 | // // emit updateTodoViews(); |
1293 | // } | 1306 | // } |
1294 | 1307 | ||
1295 | void KOAgendaView::newEvent(int gx, int gy) | 1308 | void KOAgendaView::newEvent(int gx, int gy) |
1296 | { | 1309 | { |
1297 | if (!mSelectedDates.count()) return; | 1310 | if (!mSelectedDates.count()) return; |
1298 | 1311 | ||
1299 | QDate day = mSelectedDates[gx]; | 1312 | QDate day = mSelectedDates[gx]; |
1300 | 1313 | ||
1301 | QTime time = mAgenda->gyToTime(gy); | 1314 | QTime time = mAgenda->gyToTime(gy); |
1302 | QDateTime dt(day,time); | 1315 | QDateTime dt(day,time); |
1303 | // if ( dt < QDateTime::currentDateTime () ) | 1316 | // if ( dt < QDateTime::currentDateTime () ) |
1304 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1317 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1305 | emit newEventSignal(dt); | 1318 | emit newEventSignal(dt); |
1306 | } | 1319 | } |
1307 | 1320 | ||
1308 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1321 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1309 | { | 1322 | { |
1310 | if (!mSelectedDates.count()) return; | 1323 | if (!mSelectedDates.count()) return; |
1311 | 1324 | ||
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 39921a0..f6c9624 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -277,256 +277,263 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
277 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
278 | } | 278 | } |
279 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
286 | } | 286 | } |
287 | } else { | 287 | } else { |
288 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
289 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
290 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
291 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
292 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
293 | } else { | 293 | } else { |
294 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
295 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
297 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
298 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool ok; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDateTime next; | 308 | QDateTime next; |
309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( ok ) { | 310 | if ( ok ) { |
311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
314 | 314 | ||
315 | } else { | 315 | } else { |
316 | bool last; | 316 | bool last; |
317 | QDate nextd; | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
319 | if ( last ) { | 319 | if ( last ) { |
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } else { | 324 | } else { |
325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
326 | 326 | ||
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | if (event->isAlarmEnabled()) { | 330 | if (event->isAlarmEnabled()) { |
331 | Alarm *alarm =event->alarms().first() ; | 331 | Alarm *alarm =event->alarms().first() ; |
332 | QDateTime t = alarm->time(); | 332 | QDateTime t = alarm->time(); |
333 | int min = t.secsTo( event->dtStart() )/60; | 333 | int min = t.secsTo( event->dtStart() )/60; |
334 | QString s =i18n("( %1 min before )").arg( min ); | 334 | QString s =i18n("( %1 min before )").arg( min ); |
335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
337 | //addTag("p",s); | 337 | //addTag("p",s); |
338 | } | 338 | } |
339 | 339 | ||
340 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
341 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
342 | if (!event->description().isEmpty()) { | 342 | if (!event->description().isEmpty()) { |
343 | addTag("p",i18n("<b>Details: </b>")); | 343 | addTag("p",i18n("<b>Details: </b>")); |
344 | addTag("p",event->description()); | 344 | addTag("p",event->description()); |
345 | } | 345 | } |
346 | 346 | ||
347 | formatCategories(event); | 347 | formatCategories(event); |
348 | 348 | ||
349 | formatReadOnly(event); | 349 | formatReadOnly(event); |
350 | formatAttendees(event); | 350 | formatAttendees(event); |
351 | 351 | ||
352 | setText(mText); | 352 | setText(mText); |
353 | //QWhatsThis::add(this,mText); | 353 | //QWhatsThis::add(this,mText); |
354 | 354 | ||
355 | } | 355 | } |
356 | 356 | ||
357 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 357 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
358 | { | 358 | { |
359 | mMailSubject = ""; | 359 | mMailSubject = ""; |
360 | mCurrentIncidence = event; | 360 | mCurrentIncidence = event; |
361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
363 | if (mode == 0 ) | 363 | if (mode == 0 ) |
364 | addTag("h2",event->summary()); | 364 | addTag("h2",event->summary()); |
365 | else { | 365 | else { |
366 | if ( mColorMode == 1 ) { | 366 | if ( mColorMode == 1 ) { |
367 | mText +="<font color=\"#00A000\">"; | 367 | mText +="<font color=\"#00A000\">"; |
368 | } | 368 | } |
369 | if ( mColorMode == 2 ) { | 369 | if ( mColorMode == 2 ) { |
370 | mText +="<font color=\"#B00000\">"; | 370 | mText +="<font color=\"#B00000\">"; |
371 | } | 371 | } |
372 | if ( mode == 1 ) { | 372 | if ( mode == 1 ) { |
373 | addTag("h2",i18n( "Local: " ) +event->summary()); | 373 | addTag("h2",i18n( "Local: " ) +event->summary()); |
374 | } else { | 374 | } else { |
375 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 375 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
376 | } | 376 | } |
377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
378 | if ( mColorMode ) | 378 | if ( mColorMode ) |
379 | mText += "</font>"; | 379 | mText += "</font>"; |
380 | } | 380 | } |
381 | mMailSubject += i18n( "Todo " )+ event->summary(); | 381 | mMailSubject += i18n( "Todo " )+ event->summary(); |
382 | 382 | ||
383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
384 | mText +="<font color=\"#B00000\">"; | 384 | mText +="<font color=\"#B00000\">"; |
385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
386 | mText += "</font>"; | 386 | mText += "</font>"; |
387 | } else { | 387 | } else { |
388 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 388 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
389 | .arg(event->percentComplete())); | 389 | .arg(event->percentComplete())); |
390 | } | 390 | } |
391 | 391 | ||
392 | if (event->cancelled ()) { | 392 | if (event->cancelled ()) { |
393 | mText +="<font color=\"#B00000\">"; | 393 | mText +="<font color=\"#B00000\">"; |
394 | addTag("i",i18n("This todo has been cancelled!")); | 394 | addTag("i",i18n("This todo has been cancelled!")); |
395 | mText.append("<br>"); | 395 | mText.append("<br>"); |
396 | mText += "</font>"; | 396 | mText += "</font>"; |
397 | mMailSubject += i18n("(cancelled)"); | 397 | mMailSubject += i18n("(cancelled)"); |
398 | } | 398 | } |
399 | 399 | ||
400 | if (!event->location().isEmpty()) { | 400 | if (!event->location().isEmpty()) { |
401 | addTag("b",i18n("Location: ")); | 401 | addTag("b",i18n("Location: ")); |
402 | mText.append(event->location()+"<br>"); | 402 | mText.append(event->location()+"<br>"); |
403 | mMailSubject += i18n(" at ") + event->location(); | 403 | mMailSubject += i18n(" at ") + event->location(); |
404 | } | 404 | } |
405 | |||
406 | if (event->recurrence()->doesRecur()) { | ||
407 | |||
408 | QString recurText = event->recurrence()->recurrenceText(); | ||
409 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | ||
410 | |||
411 | } | ||
405 | if (event->hasStartDate()) { | 412 | if (event->hasStartDate()) { |
406 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 413 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
407 | } | 414 | } |
408 | if (event->hasDueDate()) { | 415 | if (event->hasDueDate()) { |
409 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 416 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
410 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 417 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
411 | } | 418 | } |
412 | addTag("b",i18n("Access: ")); | 419 | addTag("b",i18n("Access: ")); |
413 | mText.append(event->secrecyStr()+"<br>"); | 420 | mText.append(event->secrecyStr()+"<br>"); |
414 | if (!event->description().isEmpty()) { | 421 | if (!event->description().isEmpty()) { |
415 | addTag("p",i18n("<b>Details: </b>")); | 422 | addTag("p",i18n("<b>Details: </b>")); |
416 | addTag("p",event->description()); | 423 | addTag("p",event->description()); |
417 | } | 424 | } |
418 | 425 | ||
419 | formatCategories(event); | 426 | formatCategories(event); |
420 | 427 | ||
421 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 428 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
422 | .arg(QString::number(event->priority()))); | 429 | .arg(QString::number(event->priority()))); |
423 | 430 | ||
424 | formatReadOnly(event); | 431 | formatReadOnly(event); |
425 | formatAttendees(event); | 432 | formatAttendees(event); |
426 | if ( event->relatedTo() ) { | 433 | if ( event->relatedTo() ) { |
427 | addTag("b",i18n("Parent todo:<br>")); | 434 | addTag("b",i18n("Parent todo:<br>")); |
428 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 435 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
429 | } | 436 | } |
430 | QPtrList<Incidence> Relations = event->relations(); | 437 | QPtrList<Incidence> Relations = event->relations(); |
431 | Incidence *to; | 438 | Incidence *to; |
432 | if ( Relations.first() ) | 439 | if ( Relations.first() ) |
433 | addTag("b",i18n("Sub todos:<br>")); | 440 | addTag("b",i18n("Sub todos:<br>")); |
434 | for (to=Relations.first();to;to=Relations.next()) { | 441 | for (to=Relations.first();to;to=Relations.next()) { |
435 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 442 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
436 | 443 | ||
437 | } | 444 | } |
438 | setText(mText); | 445 | setText(mText); |
439 | } | 446 | } |
440 | 447 | ||
441 | void KOEventViewer::formatCategories(Incidence *event) | 448 | void KOEventViewer::formatCategories(Incidence *event) |
442 | { | 449 | { |
443 | if (!event->categoriesStr().isEmpty()) { | 450 | if (!event->categoriesStr().isEmpty()) { |
444 | if (event->categories().count() == 1) { | 451 | if (event->categories().count() == 1) { |
445 | addTag("h3",i18n("Category")); | 452 | addTag("h3",i18n("Category")); |
446 | } else { | 453 | } else { |
447 | addTag("h3",i18n("Categories")); | 454 | addTag("h3",i18n("Categories")); |
448 | } | 455 | } |
449 | addTag("p",event->categoriesStr()); | 456 | addTag("p",event->categoriesStr()); |
450 | } | 457 | } |
451 | } | 458 | } |
452 | void KOEventViewer::formatAttendees(Incidence *event) | 459 | void KOEventViewer::formatAttendees(Incidence *event) |
453 | { | 460 | { |
454 | QPtrList<Attendee> attendees = event->attendees(); | 461 | QPtrList<Attendee> attendees = event->attendees(); |
455 | if (attendees.count()) { | 462 | if (attendees.count()) { |
456 | 463 | ||
457 | 464 | ||
458 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 465 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
459 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 466 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
460 | addTag("h3",i18n("Organizer")); | 467 | addTag("h3",i18n("Organizer")); |
461 | mText.append("<ul><li>"); | 468 | mText.append("<ul><li>"); |
462 | #ifndef KORG_NOKABC | 469 | #ifndef KORG_NOKABC |
463 | 470 | ||
464 | #ifdef DESKTOP_VERSION | 471 | #ifdef DESKTOP_VERSION |
465 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 472 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
466 | KABC::Addressee::List addressList; | 473 | KABC::Addressee::List addressList; |
467 | addressList = add_book->findByEmail(event->organizer()); | 474 | addressList = add_book->findByEmail(event->organizer()); |
468 | KABC::Addressee o = addressList.first(); | 475 | KABC::Addressee o = addressList.first(); |
469 | if (!o.isEmpty() && addressList.size()<2) { | 476 | if (!o.isEmpty() && addressList.size()<2) { |
470 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 477 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
471 | mText += o.formattedName(); | 478 | mText += o.formattedName(); |
472 | mText += "</a>\n"; | 479 | mText += "</a>\n"; |
473 | } else { | 480 | } else { |
474 | mText.append(event->organizer()); | 481 | mText.append(event->organizer()); |
475 | } | 482 | } |
476 | #else //DESKTOP_VERSION | 483 | #else //DESKTOP_VERSION |
477 | mText += "<a href=\"uid:organizer\">"; | 484 | mText += "<a href=\"uid:organizer\">"; |
478 | mText += event->organizer(); | 485 | mText += event->organizer(); |
479 | mText += "</a>\n"; | 486 | mText += "</a>\n"; |
480 | #endif //DESKTOP_VERSION | 487 | #endif //DESKTOP_VERSION |
481 | 488 | ||
482 | 489 | ||
483 | #else | 490 | #else |
484 | mText.append(event->organizer()); | 491 | mText.append(event->organizer()); |
485 | #endif | 492 | #endif |
486 | 493 | ||
487 | if (iconPath) { | 494 | if (iconPath) { |
488 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 495 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
489 | mText += "<IMG src=\"" + iconPath + "\">"; | 496 | mText += "<IMG src=\"" + iconPath + "\">"; |
490 | mText += "</a>\n"; | 497 | mText += "</a>\n"; |
491 | } | 498 | } |
492 | mText.append("</li></ul>"); | 499 | mText.append("</li></ul>"); |
493 | 500 | ||
494 | addTag("h3",i18n("Attendees")); | 501 | addTag("h3",i18n("Attendees")); |
495 | Attendee *a; | 502 | Attendee *a; |
496 | mText.append("<ul>"); | 503 | mText.append("<ul>"); |
497 | int a_count = 0; | 504 | int a_count = 0; |
498 | int a_count_nr = 0; | 505 | int a_count_nr = 0; |
499 | 506 | ||
500 | for(a=attendees.first();a;a=attendees.next()) { | 507 | for(a=attendees.first();a;a=attendees.next()) { |
501 | #ifndef KORG_NOKABC | 508 | #ifndef KORG_NOKABC |
502 | #ifdef DESKTOP_VERSION | 509 | #ifdef DESKTOP_VERSION |
503 | if (a->name().isEmpty()) { | 510 | if (a->name().isEmpty()) { |
504 | addressList = add_book->findByEmail(a->email()); | 511 | addressList = add_book->findByEmail(a->email()); |
505 | KABC::Addressee o = addressList.first(); | 512 | KABC::Addressee o = addressList.first(); |
506 | if (!o.isEmpty() && addressList.size()<2) { | 513 | if (!o.isEmpty() && addressList.size()<2) { |
507 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 514 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
508 | mText += o.formattedName(); | 515 | mText += o.formattedName(); |
509 | mText += "</a>\n"; | 516 | mText += "</a>\n"; |
510 | } else { | 517 | } else { |
511 | mText += "<li>"; | 518 | mText += "<li>"; |
512 | mText.append(a->email()); | 519 | mText.append(a->email()); |
513 | mText += "\n"; | 520 | mText += "\n"; |
514 | } | 521 | } |
515 | } else { | 522 | } else { |
516 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 523 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
517 | if (!a->name().isEmpty()) mText += a->name(); | 524 | if (!a->name().isEmpty()) mText += a->name(); |
518 | else mText += a->email(); | 525 | else mText += a->email(); |
519 | mText += "</a>\n"; | 526 | mText += "</a>\n"; |
520 | } | 527 | } |
521 | #else //DESKTOP_VERSION | 528 | #else //DESKTOP_VERSION |
522 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 529 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
523 | if (!a->name().isEmpty()) mText += a->name(); | 530 | if (!a->name().isEmpty()) mText += a->name(); |
524 | else mText += a->email(); | 531 | else mText += a->email(); |
525 | mText += "</a>\n"; | 532 | mText += "</a>\n"; |
526 | #endif //DESKTOP_VERSION | 533 | #endif //DESKTOP_VERSION |
527 | #else | 534 | #else |
528 | //qDebug("nokabc "); | 535 | //qDebug("nokabc "); |
529 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 536 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
530 | if (!a->name().isEmpty()) mText += a->name(); | 537 | if (!a->name().isEmpty()) mText += a->name(); |
531 | else mText += a->email(); | 538 | else mText += a->email(); |
532 | mText += "</a>\n"; | 539 | mText += "</a>\n"; |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index acd9265..d8e940b 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -31,257 +31,257 @@ | |||
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | 37 | ||
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | 42 | ||
43 | #include <libkdepim/kpimglobalprefs.h> | 43 | #include <libkdepim/kpimglobalprefs.h> |
44 | #include <libkcal/calendar.h> | 44 | #include <libkcal/calendar.h> |
45 | #include <libkcal/calendarlocal.h> | 45 | #include <libkcal/calendarlocal.h> |
46 | #include <libkcal/icalformat.h> | 46 | #include <libkcal/icalformat.h> |
47 | #include <libkcal/vcalformat.h> | 47 | #include <libkcal/vcalformat.h> |
48 | #include <libkcal/recurrence.h> | 48 | #include <libkcal/recurrence.h> |
49 | #include <libkcal/filestorage.h> | 49 | #include <libkcal/filestorage.h> |
50 | #include <libkdepim/categoryselectdialog.h> | 50 | #include <libkdepim/categoryselectdialog.h> |
51 | #include <libkcal/kincidenceformatter.h> | 51 | #include <libkcal/kincidenceformatter.h> |
52 | #ifndef DESKTOP_VERSION | 52 | #ifndef DESKTOP_VERSION |
53 | #include <qpe/qpeapplication.h> | 53 | #include <qpe/qpeapplication.h> |
54 | #else | 54 | #else |
55 | #include <qapplication.h> | 55 | #include <qapplication.h> |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #ifndef KORG_NOPRINTER | 58 | #ifndef KORG_NOPRINTER |
59 | #include "calprinter.h" | 59 | #include "calprinter.h" |
60 | #endif | 60 | #endif |
61 | #include "koglobals.h" | 61 | #include "koglobals.h" |
62 | #include "koprefs.h" | 62 | #include "koprefs.h" |
63 | #include "kfiledialog.h" | 63 | #include "kfiledialog.h" |
64 | 64 | ||
65 | #include "kolistview.h" | 65 | #include "kolistview.h" |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | virtual QString text( const QPoint& p) | 76 | virtual QString text( const QPoint& p) |
77 | { | 77 | { |
78 | return _view->getWhatsThisText(p) ; | 78 | return _view->getWhatsThisText(p) ; |
79 | } | 79 | } |
80 | private: | 80 | private: |
81 | QWidget* _wid; | 81 | QWidget* _wid; |
82 | KOListView * _view; | 82 | KOListView * _view; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 87 | { |
88 | mItem = item; | 88 | mItem = item; |
89 | mDate = date; | 89 | mDate = date; |
90 | } | 90 | } |
91 | 91 | ||
92 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
93 | { | 93 | { |
94 | } | 94 | } |
95 | 95 | ||
96 | bool ListItemVisitor::visit(Event *e) | 96 | bool ListItemVisitor::visit(Event *e) |
97 | { | 97 | { |
98 | 98 | ||
99 | bool ok = false; | 99 | bool ok = false; |
100 | QString start, end; | 100 | QString start, end; |
101 | QDate ds, de; | 101 | QDate ds, de; |
102 | if ( e->doesRecur() ) { | 102 | if ( e->doesRecur() ) { |
103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
104 | if ( ok ) { | 104 | if ( ok ) { |
105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
106 | start = KGlobal::locale()->formatDate(ds,true); | 106 | start = KGlobal::locale()->formatDate(ds,true); |
107 | de = ds.addDays( days); | 107 | de = ds.addDays( days); |
108 | end = KGlobal::locale()->formatDate(de,true); | 108 | end = KGlobal::locale()->formatDate(de,true); |
109 | } | 109 | } |
110 | 110 | ||
111 | } | 111 | } |
112 | if ( ! ok ) { | 112 | if ( ! ok ) { |
113 | start =e->dtStartDateStr(); | 113 | start =e->dtStartDateStr(); |
114 | end = e->dtEndDateStr(); | 114 | end = e->dtEndDateStr(); |
115 | ds = e->dtStart().date(); | 115 | ds = e->dtStart().date(); |
116 | de = e->dtEnd().date(); | 116 | de = e->dtEnd().date(); |
117 | } | 117 | } |
118 | mItem->setText(0,e->summary()); | 118 | mItem->setText(0,e->summary()); |
119 | mItem->setText(1,start); | 119 | mItem->setText(1,start); |
120 | mItem->setText(2,e->dtStartTimeStr()); | 120 | mItem->setText(2,e->dtStartTimeStr()); |
121 | mItem->setText(3,end); | 121 | mItem->setText(3,end); |
122 | mItem->setText(4,e->dtEndTimeStr()); | 122 | mItem->setText(4,e->dtEndTimeStr()); |
123 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 123 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
124 | mItem->setText(6, e->recurrence()->recurrenceText()); | 124 | mItem->setText(6, e->recurrence()->recurrenceText()); |
125 | mItem->setText(7,"---"); | 125 | mItem->setText(7,"---"); |
126 | mItem->setText(8,"---"); | 126 | mItem->setText(8,"---"); |
127 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 127 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
128 | mItem->setText(10,e->categoriesStr()); | 128 | mItem->setText(10,e->categoriesStr()); |
129 | 129 | ||
130 | QString key; | 130 | QString key; |
131 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 131 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
132 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 132 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
133 | mItem->setSortKey(1,key); | 133 | mItem->setSortKey(1,key); |
134 | 134 | ||
135 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 135 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
137 | mItem->setSortKey(3,key); | 137 | mItem->setSortKey(3,key); |
138 | 138 | ||
139 | return true; | 139 | return true; |
140 | } | 140 | } |
141 | 141 | ||
142 | bool ListItemVisitor::visit(Todo *t) | 142 | bool ListItemVisitor::visit(Todo *t) |
143 | { | 143 | { |
144 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); | 144 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); |
145 | if (t->hasStartDate()) { | 145 | if (t->hasStartDate()) { |
146 | mItem->setText(1,t->dtStartDateStr()); | 146 | mItem->setText(1,t->dtStartDateStr()); |
147 | if (t->doesFloat()) { | 147 | if (t->doesFloat()) { |
148 | mItem->setText(2,"---"); | 148 | mItem->setText(2,"---"); |
149 | } else { | 149 | } else { |
150 | mItem->setText(2,t->dtStartTimeStr()); | 150 | mItem->setText(2,t->dtStartTimeStr()); |
151 | } | 151 | } |
152 | } else { | 152 | } else { |
153 | mItem->setText(1,"---"); | 153 | mItem->setText(1,"---"); |
154 | mItem->setText(2,"---"); | 154 | mItem->setText(2,"---"); |
155 | } | 155 | } |
156 | mItem->setText(3,"---"); | 156 | mItem->setText(3,"---"); |
157 | mItem->setText(4,"---"); | 157 | mItem->setText(4,"---"); |
158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
159 | mItem->setText(6,"---"); | 159 | mItem->setText(6, t->recurrence()->recurrenceText()); |
160 | if (t->hasDueDate()) { | 160 | if (t->hasDueDate()) { |
161 | mItem->setText(7,t->dtDueDateStr()); | 161 | mItem->setText(7,t->dtDueDateStr()); |
162 | if (t->doesFloat()) { | 162 | if (t->doesFloat()) { |
163 | mItem->setText(8,"---"); | 163 | mItem->setText(8,"---"); |
164 | } else { | 164 | } else { |
165 | mItem->setText(8,t->dtDueTimeStr()); | 165 | mItem->setText(8,t->dtDueTimeStr()); |
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | mItem->setText(7,"---"); | 168 | mItem->setText(7,"---"); |
169 | mItem->setText(8,"---"); | 169 | mItem->setText(8,"---"); |
170 | } | 170 | } |
171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
172 | mItem->setText(10,t->categoriesStr()); | 172 | mItem->setText(10,t->categoriesStr()); |
173 | 173 | ||
174 | QString key; | 174 | QString key; |
175 | QDate d; | 175 | QDate d; |
176 | if (t->hasDueDate()) { | 176 | if (t->hasDueDate()) { |
177 | d = t->dtDue().date(); | 177 | d = t->dtDue().date(); |
178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
180 | mItem->setSortKey(7,key); | 180 | mItem->setSortKey(7,key); |
181 | } | 181 | } |
182 | if ( t->hasStartDate() ) { | 182 | if ( t->hasStartDate() ) { |
183 | d = t->dtStart().date(); | 183 | d = t->dtStart().date(); |
184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
185 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 185 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
186 | mItem->setSortKey(1,key); | 186 | mItem->setSortKey(1,key); |
187 | } | 187 | } |
188 | return true; | 188 | return true; |
189 | } | 189 | } |
190 | 190 | ||
191 | bool ListItemVisitor::visit(Journal * j) | 191 | bool ListItemVisitor::visit(Journal * j) |
192 | { | 192 | { |
193 | QString des = j->description().left(50); | 193 | QString des = j->description().left(50); |
194 | des = des.simplifyWhiteSpace (); | 194 | des = des.simplifyWhiteSpace (); |
195 | des.replace (QRegExp ("\\n"),"" ); | 195 | des.replace (QRegExp ("\\n"),"" ); |
196 | des.replace (QRegExp ("\\r"),"" ); | 196 | des.replace (QRegExp ("\\r"),"" ); |
197 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); | 197 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); |
198 | mItem->setText(1,j->dtStartDateStr()); | 198 | mItem->setText(1,j->dtStartDateStr()); |
199 | mItem->setText(2,"---"); | 199 | mItem->setText(2,"---"); |
200 | mItem->setText(3,"---"); | 200 | mItem->setText(3,"---"); |
201 | mItem->setText(4,"---"); | 201 | mItem->setText(4,"---"); |
202 | mItem->setText(5,"---"); | 202 | mItem->setText(5,"---"); |
203 | mItem->setText(6,"---"); | 203 | mItem->setText(6,"---"); |
204 | mItem->setText(7,j->dtStartDateStr()); | 204 | mItem->setText(7,j->dtStartDateStr()); |
205 | mItem->setText(8,"---"); | 205 | mItem->setText(8,"---"); |
206 | mItem->setText(9,"---"); | 206 | mItem->setText(9,"---"); |
207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
208 | 208 | ||
209 | QString key; | 209 | QString key; |
210 | QDate d = j->dtStart().date(); | 210 | QDate d = j->dtStart().date(); |
211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
212 | mItem->setSortKey(1,key); | 212 | mItem->setSortKey(1,key); |
213 | mItem->setSortKey(7,key); | 213 | mItem->setSortKey(7,key); |
214 | 214 | ||
215 | return true; | 215 | return true; |
216 | } | 216 | } |
217 | 217 | ||
218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
219 | const char *name) | 219 | const char *name) |
220 | : KOEventView(calendar, parent, name) | 220 | : KOEventView(calendar, parent, name) |
221 | { | 221 | { |
222 | mActiveItem = 0; | 222 | mActiveItem = 0; |
223 | mListView = new KOListViewListView(this); | 223 | mListView = new KOListViewListView(this); |
224 | mListView->addColumn(i18n("Summary")); | 224 | mListView->addColumn(i18n("Summary")); |
225 | mListView->addColumn(i18n("Start Date")); | 225 | mListView->addColumn(i18n("Start Date")); |
226 | mListView->addColumn(i18n("Start Time")); | 226 | mListView->addColumn(i18n("Start Time")); |
227 | mListView->addColumn(i18n("End Date")); | 227 | mListView->addColumn(i18n("End Date")); |
228 | mListView->addColumn(i18n("End Time")); | 228 | mListView->addColumn(i18n("End Time")); |
229 | mListView->addColumn(i18n("Alarm")); // alarm set? | 229 | mListView->addColumn(i18n("Alarm")); // alarm set? |
230 | mListView->addColumn(i18n("Recurs")); // recurs? | 230 | mListView->addColumn(i18n("Recurs")); // recurs? |
231 | mListView->addColumn(i18n("Due Date")); | 231 | mListView->addColumn(i18n("Due Date")); |
232 | mListView->addColumn(i18n("Due Time")); | 232 | mListView->addColumn(i18n("Due Time")); |
233 | mListView->addColumn(i18n("Cancelled")); | 233 | mListView->addColumn(i18n("Cancelled")); |
234 | mListView->addColumn(i18n("Categories")); | 234 | mListView->addColumn(i18n("Categories")); |
235 | 235 | ||
236 | mListView->setColumnAlignment(0,AlignLeft); | 236 | mListView->setColumnAlignment(0,AlignLeft); |
237 | mListView->setColumnAlignment(1,AlignLeft); | 237 | mListView->setColumnAlignment(1,AlignLeft); |
238 | mListView->setColumnAlignment(2,AlignHCenter); | 238 | mListView->setColumnAlignment(2,AlignHCenter); |
239 | mListView->setColumnAlignment(3,AlignLeft); | 239 | mListView->setColumnAlignment(3,AlignLeft); |
240 | mListView->setColumnAlignment(4,AlignHCenter); | 240 | mListView->setColumnAlignment(4,AlignHCenter); |
241 | mListView->setColumnAlignment(5,AlignLeft); | 241 | mListView->setColumnAlignment(5,AlignLeft); |
242 | mListView->setColumnAlignment(6,AlignLeft); | 242 | mListView->setColumnAlignment(6,AlignLeft); |
243 | mListView->setColumnAlignment(7,AlignLeft); | 243 | mListView->setColumnAlignment(7,AlignLeft); |
244 | mListView->setColumnAlignment(8,AlignLeft); | 244 | mListView->setColumnAlignment(8,AlignLeft); |
245 | mListView->setColumnAlignment(9,AlignLeft); | 245 | mListView->setColumnAlignment(9,AlignLeft); |
246 | mListView->setColumnAlignment(10,AlignLeft); | 246 | mListView->setColumnAlignment(10,AlignLeft); |
247 | mListView->setColumnWidthMode(10, QListView::Manual); | 247 | mListView->setColumnWidthMode(10, QListView::Manual); |
248 | new KOListViewWhatsThis(mListView->viewport(),this); | 248 | new KOListViewWhatsThis(mListView->viewport(),this); |
249 | 249 | ||
250 | int iii = 0; | 250 | int iii = 0; |
251 | for ( iii = 0; iii< 10 ; ++iii ) | 251 | for ( iii = 0; iii< 10 ; ++iii ) |
252 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 252 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
253 | 253 | ||
254 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 254 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
255 | layoutTop->addWidget(mListView); | 255 | layoutTop->addWidget(mListView); |
256 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 256 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
257 | mPopupMenu = eventPopup(); | 257 | mPopupMenu = eventPopup(); |
258 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 258 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
259 | i18n("Select all"),this, | 259 | i18n("Select all"),this, |
260 | SLOT(allSelection()),true); | 260 | SLOT(allSelection()),true); |
261 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 261 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
262 | i18n("Deselect all"),this, | 262 | i18n("Deselect all"),this, |
263 | SLOT(clearSelection()),true); | 263 | SLOT(clearSelection()),true); |
264 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 264 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
265 | i18n("Delete all selected"),this, | 265 | i18n("Delete all selected"),this, |
266 | SLOT(deleteAll()),true); | 266 | SLOT(deleteAll()),true); |
267 | mPopupMenu->insertSeparator(); | 267 | mPopupMenu->insertSeparator(); |
268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
269 | i18n("Save selected to file..."),this, | 269 | i18n("Save selected to file..."),this, |
270 | SLOT(saveToFile()),true); | 270 | SLOT(saveToFile()),true); |
271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
272 | i18n("Save Journal/Description..."),this, | 272 | i18n("Save Journal/Description..."),this, |
273 | SLOT(saveDescriptionToFile()),true); | 273 | SLOT(saveDescriptionToFile()),true); |
274 | // mPopupMenu->insertSeparator(); | 274 | // mPopupMenu->insertSeparator(); |
275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
276 | i18n("Add Categ. to selected..."),this, | 276 | i18n("Add Categ. to selected..."),this, |
277 | SLOT(addCat()),true); | 277 | SLOT(addCat()),true); |
278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
279 | i18n("Set Categ. for selected..."),this, | 279 | i18n("Set Categ. for selected..."),this, |
280 | SLOT(setCat()),true); | 280 | SLOT(setCat()),true); |
281 | //mPopupMenu->insertSeparator(); | 281 | //mPopupMenu->insertSeparator(); |
282 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 282 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
283 | i18n("Set alarm for selected..."),this, | 283 | i18n("Set alarm for selected..."),this, |
284 | SLOT(setAlarm()),true); | 284 | SLOT(setAlarm()),true); |
285 | 285 | ||
286 | 286 | ||
287 | #ifndef DESKTOP_VERSION | 287 | #ifndef DESKTOP_VERSION |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f595d35..d0380e3 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -456,256 +456,259 @@ void MonthViewCell::insertEvent(Event *event) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | if ( event->categories().contains("Holiday") || | 458 | if ( event->categories().contains("Holiday") || |
459 | event->categories().contains(i18n("Holiday"))) { | 459 | event->categories().contains(i18n("Holiday"))) { |
460 | setHoliday( true ); | 460 | setHoliday( true ); |
461 | if ( mDate.dayOfWeek() == 7 ) | 461 | if ( mDate.dayOfWeek() == 7 ) |
462 | mItemList->setLineWidth( 3 ); | 462 | mItemList->setLineWidth( 3 ); |
463 | } | 463 | } |
464 | QString text; | 464 | QString text; |
465 | if (event->isMultiDay()) { | 465 | if (event->isMultiDay()) { |
466 | QString prefix = "<->"; | 466 | QString prefix = "<->"; |
467 | if ( event->doesRecur() ) { | 467 | if ( event->doesRecur() ) { |
468 | if ( event->recursOn( mDate) ) | 468 | if ( event->recursOn( mDate) ) |
469 | prefix ="->" ; | 469 | prefix ="->" ; |
470 | else { | 470 | else { |
471 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 471 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
472 | if ( event->recursOn( mDate.addDays( -days)) ) | 472 | if ( event->recursOn( mDate.addDays( -days)) ) |
473 | prefix ="<-" ; | 473 | prefix ="<-" ; |
474 | } | 474 | } |
475 | 475 | ||
476 | } else { | 476 | } else { |
477 | if (mDate == event->dtStart().date()) { | 477 | if (mDate == event->dtStart().date()) { |
478 | prefix ="->" ; | 478 | prefix ="->" ; |
479 | } else if (mDate == event->dtEnd().date()) { | 479 | } else if (mDate == event->dtEnd().date()) { |
480 | prefix ="<-" ; | 480 | prefix ="<-" ; |
481 | } | 481 | } |
482 | } | 482 | } |
483 | if ( !event->doesFloat() ) { | 483 | if ( !event->doesFloat() ) { |
484 | if ( mDate == event->dtStart().date () ) | 484 | if ( mDate == event->dtStart().date () ) |
485 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 485 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
486 | else if ( mDate == event->dtEnd().date () ) | 486 | else if ( mDate == event->dtEnd().date () ) |
487 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 487 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
488 | 488 | ||
489 | } | 489 | } |
490 | text = prefix + event->summary(); | 490 | text = prefix + event->summary(); |
491 | mToolTip += text; | 491 | mToolTip += text; |
492 | } else { | 492 | } else { |
493 | if (event->doesFloat()) { | 493 | if (event->doesFloat()) { |
494 | text = event->summary(); | 494 | text = event->summary(); |
495 | mToolTip += text; | 495 | mToolTip += text; |
496 | } | 496 | } |
497 | else { | 497 | else { |
498 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 498 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
499 | text += " " + event->summary(); | 499 | text += " " + event->summary(); |
500 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 500 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
501 | } | 501 | } |
502 | } | 502 | } |
503 | 503 | ||
504 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 504 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
505 | QPalette pal; | 505 | QPalette pal; |
506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 506 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
507 | QStringList categories = event->categories(); | 507 | QStringList categories = event->categories(); |
508 | QString cat = categories.first(); | 508 | QString cat = categories.first(); |
509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
510 | pal = getPalette(); | 510 | pal = getPalette(); |
511 | if (cat.isEmpty()) { | 511 | if (cat.isEmpty()) { |
512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
513 | } else { | 513 | } else { |
514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
515 | } | 515 | } |
516 | 516 | ||
517 | } else { | 517 | } else { |
518 | if (cat.isEmpty()) { | 518 | if (cat.isEmpty()) { |
519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
520 | } else { | 520 | } else { |
521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | } else { | 525 | } else { |
526 | pal = mStandardPalette ; | 526 | pal = mStandardPalette ; |
527 | } | 527 | } |
528 | item->setPalette( pal ); | 528 | item->setPalette( pal ); |
529 | item->setRecur( event->recurrence()->doesRecur() ); | 529 | item->setRecur( event->recurrence()->doesRecur() ); |
530 | item->setAlarm( event->isAlarmEnabled() ); | 530 | item->setAlarm( event->isAlarmEnabled() ); |
531 | item->setMoreInfo( event->description().length() > 0 ); | 531 | item->setMoreInfo( event->description().length() > 0 ); |
532 | #ifdef DESKTOP_VERSION | 532 | #ifdef DESKTOP_VERSION |
533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
534 | KOPrefs::instance()->email()); | 534 | KOPrefs::instance()->email()); |
535 | if ( me != 0 ) { | 535 | if ( me != 0 ) { |
536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
537 | item->setReply(true); | 537 | item->setReply(true); |
538 | else | 538 | else |
539 | item->setReply(false); | 539 | item->setReply(false); |
540 | } else | 540 | } else |
541 | item->setReply(false); | 541 | item->setReply(false); |
542 | #endif | 542 | #endif |
543 | mItemList->insertItem( item ); | 543 | mItemList->insertItem( item ); |
544 | mToolTip += "\n"; | 544 | mToolTip += "\n"; |
545 | } | 545 | } |
546 | void MonthViewCell::insertTodo(Todo *todo) | 546 | void MonthViewCell::insertTodo(Todo *todo) |
547 | { | 547 | { |
548 | mItemList->setFocusPolicy(WheelFocus); | 548 | mItemList->setFocusPolicy(WheelFocus); |
549 | QString text; | 549 | QString text; |
550 | if (todo->hasDueDate()) { | 550 | if (todo->hasDueDate()) { |
551 | if (!todo->doesFloat()) { | 551 | if (!todo->doesFloat()) { |
552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
553 | text += " "; | 553 | text += " "; |
554 | } | 554 | } |
555 | } | 555 | } |
556 | text += i18n("T: %1").arg(todo->summary()); | 556 | text += i18n("T: %1").arg(todo->summary()); |
557 | 557 | ||
558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
559 | //item->setPalette( mStandardPalette ); | 559 | //item->setPalette( mStandardPalette ); |
560 | QPalette pal; | 560 | QPalette pal; |
561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
562 | QStringList categories = todo->categories(); | 562 | QStringList categories = todo->categories(); |
563 | QString cat = categories.first(); | 563 | QString cat = categories.first(); |
564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
565 | pal = getPalette(); | 565 | pal = getPalette(); |
566 | if (cat.isEmpty()) { | 566 | if (cat.isEmpty()) { |
567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
568 | } else { | 568 | } else { |
569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
570 | } | 570 | } |
571 | 571 | ||
572 | } else { | 572 | } else { |
573 | if (cat.isEmpty()) { | 573 | if (cat.isEmpty()) { |
574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
575 | } else { | 575 | } else { |
576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | } else { | 580 | } else { |
581 | pal = mStandardPalette ; | 581 | pal = mStandardPalette ; |
582 | } | 582 | } |
583 | item->setPalette( pal ); | 583 | item->setPalette( pal ); |
584 | item->setRecur( todo->recurrence()->doesRecur() ); | ||
585 | item->setAlarm( todo->isAlarmEnabled() ); | ||
586 | item->setMoreInfo( todo->description().length() > 0 ); | ||
584 | mItemList->insertItem( item ); | 587 | mItemList->insertItem( item ); |
585 | mToolTip += text+"\n"; | 588 | mToolTip += text+"\n"; |
586 | } | 589 | } |
587 | void MonthViewCell::finishUpdateCell() | 590 | void MonthViewCell::finishUpdateCell() |
588 | { | 591 | { |
589 | #ifdef DESKTOP_VERSION | 592 | #ifdef DESKTOP_VERSION |
590 | if (mToolTip != "") | 593 | if (mToolTip != "") |
591 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 594 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
592 | #endif | 595 | #endif |
593 | mItemList->sort(); | 596 | mItemList->sort(); |
594 | //setMyPalette(); | 597 | //setMyPalette(); |
595 | setMyPalette(); | 598 | setMyPalette(); |
596 | QString text; | 599 | QString text; |
597 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 600 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
598 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 601 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
599 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 602 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
600 | mLabel->resize( mLabelBigSize ); | 603 | mLabel->resize( mLabelBigSize ); |
601 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
602 | } else { | 605 | } else { |
603 | mLabel->resize( mLabelSize ); | 606 | mLabel->resize( mLabelSize ); |
604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 607 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
605 | } | 608 | } |
606 | 609 | ||
607 | mLabel->setText( text ); | 610 | mLabel->setText( text ); |
608 | resizeEvent( 0 ); | 611 | resizeEvent( 0 ); |
609 | } | 612 | } |
610 | void MonthViewCell::updateCell() | 613 | void MonthViewCell::updateCell() |
611 | { | 614 | { |
612 | qDebug("MonthViewCell::updateCell() "); | 615 | qDebug("MonthViewCell::updateCell() "); |
613 | if ( !mMonthView->isUpdatePossible() ) | 616 | if ( !mMonthView->isUpdatePossible() ) |
614 | return; | 617 | return; |
615 | startUpdateCell(); | 618 | startUpdateCell(); |
616 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 619 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
617 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 620 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
618 | Event *event; | 621 | Event *event; |
619 | for( event = events.first(); event; event = events.next() ) { // for event | 622 | for( event = events.first(); event; event = events.next() ) { // for event |
620 | insertEvent(event); | 623 | insertEvent(event); |
621 | } | 624 | } |
622 | // insert due todos | 625 | // insert due todos |
623 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 626 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
624 | Todo *todo; | 627 | Todo *todo; |
625 | for(todo = todos.first(); todo; todo = todos.next()) { | 628 | for(todo = todos.first(); todo; todo = todos.next()) { |
626 | insertTodo( todo ); | 629 | insertTodo( todo ); |
627 | } | 630 | } |
628 | finishUpdateCell(); | 631 | finishUpdateCell(); |
629 | // if ( isVisible()) | 632 | // if ( isVisible()) |
630 | //qApp->processEvents(); | 633 | //qApp->processEvents(); |
631 | } | 634 | } |
632 | 635 | ||
633 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 636 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
634 | { | 637 | { |
635 | 638 | ||
636 | if ( bigFont ) { | 639 | if ( bigFont ) { |
637 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 640 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
638 | int ps = fo.pointSize() + 2; | 641 | int ps = fo.pointSize() + 2; |
639 | if ( ps < 18 ) | 642 | if ( ps < 18 ) |
640 | ps += 2; | 643 | ps += 2; |
641 | fo.setPointSize( ps ); | 644 | fo.setPointSize( ps ); |
642 | setFont( fo ); | 645 | setFont( fo ); |
643 | } else | 646 | } else |
644 | setFont( KOPrefs::instance()->mMonthViewFont ); | 647 | setFont( KOPrefs::instance()->mMonthViewFont ); |
645 | 648 | ||
646 | QFontMetrics fm( font() ); | 649 | QFontMetrics fm( font() ); |
647 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 650 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
648 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 651 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
649 | mHolidayPalette = mStandardPalette; | 652 | mHolidayPalette = mStandardPalette; |
650 | mPrimaryPalette = mStandardPalette; | 653 | mPrimaryPalette = mStandardPalette; |
651 | mNonPrimaryPalette = mStandardPalette; | 654 | mNonPrimaryPalette = mStandardPalette; |
652 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 655 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
653 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 656 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
654 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 657 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
655 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 658 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
656 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 659 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
657 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 660 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
658 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 661 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
659 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 662 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
660 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 663 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
661 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 664 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
662 | } | 665 | } |
663 | //updateCell(); | 666 | //updateCell(); |
664 | } | 667 | } |
665 | 668 | ||
666 | void MonthViewCell::enableScrollBars( bool enabled ) | 669 | void MonthViewCell::enableScrollBars( bool enabled ) |
667 | { | 670 | { |
668 | if ( enabled ) { | 671 | if ( enabled ) { |
669 | mItemList->setVScrollBarMode(QScrollView::Auto); | 672 | mItemList->setVScrollBarMode(QScrollView::Auto); |
670 | mItemList->setHScrollBarMode(QScrollView::Auto); | 673 | mItemList->setHScrollBarMode(QScrollView::Auto); |
671 | } else { | 674 | } else { |
672 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 675 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
673 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 676 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
674 | } | 677 | } |
675 | } | 678 | } |
676 | 679 | ||
677 | Incidence *MonthViewCell::selectedIncidence() | 680 | Incidence *MonthViewCell::selectedIncidence() |
678 | { | 681 | { |
679 | int index = mItemList->currentItem(); | 682 | int index = mItemList->currentItem(); |
680 | if ( index < 0 ) return 0; | 683 | if ( index < 0 ) return 0; |
681 | 684 | ||
682 | MonthViewItem *item = | 685 | MonthViewItem *item = |
683 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 686 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
684 | 687 | ||
685 | if ( !item ) return 0; | 688 | if ( !item ) return 0; |
686 | 689 | ||
687 | return item->incidence(); | 690 | return item->incidence(); |
688 | } | 691 | } |
689 | 692 | ||
690 | QDate MonthViewCell::selectedIncidenceDate() | 693 | QDate MonthViewCell::selectedIncidenceDate() |
691 | { | 694 | { |
692 | QDate qd; | 695 | QDate qd; |
693 | int index = mItemList->currentItem(); | 696 | int index = mItemList->currentItem(); |
694 | if ( index < 0 ) return qd; | 697 | if ( index < 0 ) return qd; |
695 | 698 | ||
696 | MonthViewItem *item = | 699 | MonthViewItem *item = |
697 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 700 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
698 | 701 | ||
699 | if ( !item ) return qd; | 702 | if ( !item ) return qd; |
700 | 703 | ||
701 | return item->incidenceDate(); | 704 | return item->incidenceDate(); |
702 | } | 705 | } |
703 | 706 | ||
704 | void MonthViewCell::deselect() | 707 | void MonthViewCell::deselect() |
705 | { | 708 | { |
706 | mItemList->clearSelection(); | 709 | mItemList->clearSelection(); |
707 | enableScrollBars( false ); | 710 | enableScrollBars( false ); |
708 | // updateCell(); | 711 | // updateCell(); |
709 | } | 712 | } |
710 | void MonthViewCell::select() | 713 | void MonthViewCell::select() |
711 | { | 714 | { |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 391b3bb..18dc656 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -542,227 +542,233 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
542 | tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; | 542 | tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; |
543 | } else { | 543 | } else { |
544 | tempText += i18n("Allday:"); | 544 | tempText += i18n("Allday:"); |
545 | } | 545 | } |
546 | 546 | ||
547 | } | 547 | } |
548 | } | 548 | } |
549 | } else { | 549 | } else { |
550 | mTodos.append( ev ); | 550 | mTodos.append( ev ); |
551 | tempText += i18n("ToDo:"); | 551 | tempText += i18n("ToDo:"); |
552 | if (reply) { | 552 | if (reply) { |
553 | tempText += " "; | 553 | tempText += " "; |
554 | if ( noc != cdt ) { | 554 | if ( noc != cdt ) { |
555 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 555 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
556 | } | 556 | } |
557 | } else { | 557 | } else { |
558 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 558 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
559 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 559 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
560 | QString dfs = KGlobal::locale()->dateFormatShort(); | 560 | QString dfs = KGlobal::locale()->dateFormatShort(); |
561 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 561 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
562 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 562 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
563 | KGlobal::locale()->setDateFormatShort(dfs); | 563 | KGlobal::locale()->setDateFormatShort(dfs); |
564 | } else { | 564 | } else { |
565 | if (!ev->doesFloat() ) | 565 | if (!ev->doesFloat() ) |
566 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 566 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
567 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 567 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
568 | 568 | ||
569 | 569 | ||
570 | } else | 570 | } else |
571 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 571 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
572 | mTodos.append( ev ); | 572 | mTodos.append( ev ); |
573 | } | 573 | } |
574 | } | 574 | } |
575 | } | 575 | } |
576 | tempText += "</b></td><td>"; | 576 | tempText += "</b></td><td>"; |
577 | bool needClose = false; | 577 | bool needClose = false; |
578 | if ( ev->cancelled() ) { | 578 | if ( ev->cancelled() ) { |
579 | tempText += "<font color=\"#F00000\">[c"; | 579 | tempText += "<font color=\"#F00000\">[c"; |
580 | needClose =true; | 580 | needClose =true; |
581 | 581 | ||
582 | } | 582 | } |
583 | if ( ev->isAlarmEnabled() ) { | 583 | if ( ev->isAlarmEnabled() ) { |
584 | if ( !needClose) | 584 | if ( !needClose) |
585 | tempText +="["; | 585 | tempText +="["; |
586 | tempText += "a"; | 586 | tempText += "a"; |
587 | needClose =true; | 587 | needClose =true; |
588 | 588 | ||
589 | } | 589 | } |
590 | if ( ev->description().length() > 0 ) { | 590 | if ( ev->description().length() > 0 ) { |
591 | if ( !needClose) | 591 | if ( !needClose) |
592 | tempText +="["; | 592 | tempText +="["; |
593 | tempText += "i"; | 593 | tempText += "i"; |
594 | needClose =true; | 594 | needClose =true; |
595 | } | 595 | } |
596 | if ( ev->recurrence()->doesRecur() ) { | 596 | if ( ev->recurrence()->doesRecur() ) { |
597 | if ( !needClose) | 597 | if ( !needClose) |
598 | tempText +="["; | 598 | tempText +="["; |
599 | tempText += "r"; | 599 | tempText += "r"; |
600 | needClose =true; | 600 | needClose =true; |
601 | } | 601 | } |
602 | if ( needClose ) { | 602 | if ( needClose ) { |
603 | tempText += "] "; | 603 | tempText += "] "; |
604 | } | 604 | } |
605 | if ( ev->cancelled() ) | 605 | if ( ev->cancelled() ) |
606 | tempText += "</font>"; | 606 | tempText += "</font>"; |
607 | tempText += "<a "; | 607 | tempText += "<a "; |
608 | if (ev->type()=="Event") tempText += "href=\"event:"; | 608 | if (ev->type()=="Event") tempText += "href=\"event:"; |
609 | if (ev->type()=="Todo") tempText += "href=\"todo:"; | 609 | if (ev->type()=="Todo") tempText += "href=\"todo:"; |
610 | tempText += ev->uid() + "\">"; | 610 | tempText += ev->uid() + "\">"; |
611 | if ( ev->summary().length() > 0 ) | 611 | if ( ev->summary().length() > 0 ) |
612 | tempText += ev->summary(); | 612 | tempText += ev->summary(); |
613 | else | 613 | else |
614 | tempText += i18n("-no summary-"); | 614 | tempText += i18n("-no summary-"); |
615 | if ( bDay ) { | 615 | if ( bDay ) { |
616 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); | 616 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); |
617 | if ( ok ) { | 617 | if ( ok ) { |
618 | int years = 0; | 618 | int years = 0; |
619 | if ( ev->type() =="Todo" ) { | 619 | if ( ev->type() =="Todo" ) { |
620 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); | 620 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); |
621 | } else | 621 | } else |
622 | years = noc.date().year() - ev->dtStart().date().year(); | 622 | years = noc.date().year() - ev->dtStart().date().year(); |
623 | tempText += i18n(" (%1 y.)"). arg( years ); | 623 | tempText += i18n(" (%1 y.)"). arg( years ); |
624 | } | 624 | } |
625 | } | 625 | } |
626 | 626 | ||
627 | tempText += "</a>"; | 627 | tempText += "</a>"; |
628 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 628 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
629 | if ( !ev->location().isEmpty() ) | 629 | if ( !ev->location().isEmpty() ) |
630 | tempText += " ("+ev->location() +")"; | 630 | tempText += " ("+ev->location() +")"; |
631 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 631 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
632 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 632 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
633 | tempText += "</td></tr>\n"; | 633 | tempText += "</td></tr>\n"; |
634 | mText += tempText; | 634 | mText += tempText; |
635 | return true; | 635 | return true; |
636 | } | 636 | } |
637 | 637 | ||
638 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 638 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
639 | { | 639 | { |
640 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 640 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
641 | 641 | ||
642 | mTodos.append( ev ); | 642 | mTodos.append( ev ); |
643 | if ( !isSub ) | 643 | if ( !isSub ) |
644 | mText += "<p>"; | 644 | mText += "<p>"; |
645 | else | 645 | else |
646 | mText += "<li>"; | 646 | mText += "<li>"; |
647 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 647 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
648 | 648 | ||
649 | 649 | ||
650 | mText += ind; | 650 | mText += ind; |
651 | bool needClose = false; | 651 | bool needClose = false; |
652 | if ( ev->cancelled() ) { | 652 | if ( ev->cancelled() ) { |
653 | mText += "<font color=\"#F00000\">[c"; | 653 | mText += "<font color=\"#F00000\">[c"; |
654 | needClose =true; | 654 | needClose =true; |
655 | 655 | ||
656 | } | 656 | } |
657 | if ( ev->isAlarmEnabled() ) { | 657 | if ( ev->isAlarmEnabled() ) { |
658 | if ( !needClose) | 658 | if ( !needClose) |
659 | mText +="["; | 659 | mText +="["; |
660 | mText += "a"; | 660 | mText += "a"; |
661 | needClose =true; | 661 | needClose =true; |
662 | 662 | ||
663 | } | 663 | } |
664 | 664 | ||
665 | if ( ev->description().length() > 0 ) { | 665 | if ( ev->description().length() > 0 ) { |
666 | if ( !needClose) | 666 | if ( !needClose) |
667 | mText +="["; | 667 | mText +="["; |
668 | mText += "i"; | 668 | mText += "i"; |
669 | needClose =true; | 669 | needClose =true; |
670 | } | ||
671 | if ( ev->doesRecur() ) { | ||
672 | if ( !needClose) | ||
673 | mText +="["; | ||
674 | mText += "r"; | ||
675 | needClose =true; | ||
670 | } | 676 | } |
671 | // if ( ev->recurrence()->doesRecur() ) { | 677 | // if ( ev->recurrence()->doesRecur() ) { |
672 | // if ( !needClose) | 678 | // if ( !needClose) |
673 | // mText +="("; | 679 | // mText +="("; |
674 | // mText += "r"; | 680 | // mText += "r"; |
675 | // needClose =true; | 681 | // needClose =true; |
676 | // } | 682 | // } |
677 | if ( needClose ) | 683 | if ( needClose ) |
678 | mText += "] "; | 684 | mText += "] "; |
679 | if ( ev->cancelled() ) | 685 | if ( ev->cancelled() ) |
680 | mText += "</font>"; | 686 | mText += "</font>"; |
681 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 687 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
682 | if ( ev->summary().length() > 0 ) | 688 | if ( ev->summary().length() > 0 ) |
683 | mText += ev->summary(); | 689 | mText += ev->summary(); |
684 | else | 690 | else |
685 | mText += i18n("-no summary-"); | 691 | mText += i18n("-no summary-"); |
686 | mText += "</a>"; | 692 | mText += "</a>"; |
687 | if ( ((Todo*)ev)->hasDueDate () ) { | 693 | if ( ((Todo*)ev)->hasDueDate () ) { |
688 | QString year = ""; | 694 | QString year = ""; |
689 | int ye = ((Todo*)ev)->dtDue().date().year(); | 695 | int ye = ((Todo*)ev)->dtDue().date().year(); |
690 | if ( QDateTime::currentDateTime().date().year() != ye ) | 696 | if ( QDateTime::currentDateTime().date().year() != ye ) |
691 | year = QString::number( ye ); | 697 | year = QString::number( ye ); |
692 | QString dfs = KGlobal::locale()->dateFormatShort(); | 698 | QString dfs = KGlobal::locale()->dateFormatShort(); |
693 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 699 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
694 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 700 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
695 | KGlobal::locale()->setDateFormatShort(dfs); | 701 | KGlobal::locale()->setDateFormatShort(dfs); |
696 | } | 702 | } |
697 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 703 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
698 | if ( !ev->location().isEmpty() ) | 704 | if ( !ev->location().isEmpty() ) |
699 | mText += " ("+ev->location() +")"; | 705 | mText += " ("+ev->location() +")"; |
700 | if ( !isSub ) { | 706 | if ( !isSub ) { |
701 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 707 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
702 | mText += " ["+ev->relatedTo()->summary() +"]"; | 708 | mText += " ["+ev->relatedTo()->summary() +"]"; |
703 | mText += "</p>\n"; | 709 | mText += "</p>\n"; |
704 | } | 710 | } |
705 | else { | 711 | else { |
706 | ind += "-"; | 712 | ind += "-"; |
707 | mText += "</li>\n"; | 713 | mText += "</li>\n"; |
708 | } | 714 | } |
709 | QPtrList<Incidence> Relations = ev->relations(); | 715 | QPtrList<Incidence> Relations = ev->relations(); |
710 | Incidence *to; | 716 | Incidence *to; |
711 | for (to=Relations.first();to;to=Relations.next()) { | 717 | for (to=Relations.first();to;to=Relations.next()) { |
712 | if (!((Todo*)to)->isCompleted()) | 718 | if (!((Todo*)to)->isCompleted()) |
713 | appendTodo( to, ind , true ); | 719 | appendTodo( to, ind , true ); |
714 | } | 720 | } |
715 | 721 | ||
716 | return true; | 722 | return true; |
717 | } | 723 | } |
718 | 724 | ||
719 | /* | 725 | /* |
720 | void KOWhatsNextView::createEventViewer() | 726 | void KOWhatsNextView::createEventViewer() |
721 | { | 727 | { |
722 | if (!mEventViewer) { | 728 | if (!mEventViewer) { |
723 | 729 | ||
724 | mEventViewer = new KOEventViewerDialog(this); | 730 | mEventViewer = new KOEventViewerDialog(this); |
725 | } | 731 | } |
726 | } | 732 | } |
727 | */ | 733 | */ |
728 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 734 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
729 | { | 735 | { |
730 | mEventViewer = v; | 736 | mEventViewer = v; |
731 | } | 737 | } |
732 | 738 | ||
733 | // TODO: Create this function in CalendarView and remove it from here | 739 | // TODO: Create this function in CalendarView and remove it from here |
734 | void KOWhatsNextView::showIncidence(const QString &uid) | 740 | void KOWhatsNextView::showIncidence(const QString &uid) |
735 | { | 741 | { |
736 | 742 | ||
737 | if ( !mEventViewer ) { | 743 | if ( !mEventViewer ) { |
738 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 744 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
739 | return; | 745 | return; |
740 | } | 746 | } |
741 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 747 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
742 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 748 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
743 | if (uid.startsWith("event:")) { | 749 | if (uid.startsWith("event:")) { |
744 | #ifdef DESKTOP_VERSION | 750 | #ifdef DESKTOP_VERSION |
745 | Event *event = calendar()->event(uid.mid(8)); | 751 | Event *event = calendar()->event(uid.mid(8)); |
746 | #else | 752 | #else |
747 | Event *event = calendar()->event(uid.mid(6)); | 753 | Event *event = calendar()->event(uid.mid(6)); |
748 | #endif | 754 | #endif |
749 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 755 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
750 | if (!event) return; | 756 | if (!event) return; |
751 | //createEventViewer(); | 757 | //createEventViewer(); |
752 | mEventViewer->setEvent(event); | 758 | mEventViewer->setEvent(event); |
753 | } else if (uid.startsWith("todo:")) { | 759 | } else if (uid.startsWith("todo:")) { |
754 | #ifdef DESKTOP_VERSION | 760 | #ifdef DESKTOP_VERSION |
755 | Todo *todo = calendar()->todo(uid.mid(7)); | 761 | Todo *todo = calendar()->todo(uid.mid(7)); |
756 | #else | 762 | #else |
757 | Todo *todo = calendar()->todo(uid.mid(5)); | 763 | Todo *todo = calendar()->todo(uid.mid(5)); |
758 | #endif | 764 | #endif |
759 | if (!todo) return; | 765 | if (!todo) return; |
760 | //createEventViewer(); | 766 | //createEventViewer(); |
761 | mEventViewer->setTodo(todo); | 767 | mEventViewer->setTodo(todo); |
762 | } else { | 768 | } else { |
763 | return; | 769 | return; |
764 | 770 | ||
765 | } | 771 | } |
766 | mEventViewer->showMe(); | 772 | mEventViewer->showMe(); |
767 | mEventViewer->raise(); | 773 | mEventViewer->raise(); |
768 | } | 774 | } |