summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-11-06 14:30:14 (UTC)
committer zautrix <zautrix>2004-11-06 14:30:14 (UTC)
commitf8841c92d5251f713eb7a025af8fdee52de45b3d (patch) (unidiff)
tree29c3c48e5da5b5ce05126da46475de1a0a845428 /korganizer
parent71eeea80d9c449bd1983c1a9207c7123e919b55f (diff)
downloadkdepimpi-f8841c92d5251f713eb7a025af8fdee52de45b3d.zip
kdepimpi-f8841c92d5251f713eb7a025af8fdee52de45b3d.tar.gz
kdepimpi-f8841c92d5251f713eb7a025af8fdee52de45b3d.tar.bz2
category utf8 fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index f8d752a..2321087 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2178,257 +2178,258 @@ void CalendarView::edit_copy()
2178 2178
2179 if (mViewManager->currentView()->isEventView()) { 2179 if (mViewManager->currentView()->isEventView()) {
2180 if ( incidence && incidence->type() == "Event" ) { 2180 if ( incidence && incidence->type() == "Event" ) {
2181 anEvent = static_cast<Event *>(incidence); 2181 anEvent = static_cast<Event *>(incidence);
2182 } 2182 }
2183 } 2183 }
2184 2184
2185 if (!anEvent) { 2185 if (!anEvent) {
2186 KNotifyClient::beep(); 2186 KNotifyClient::beep();
2187 return; 2187 return;
2188 } 2188 }
2189 DndFactory factory( mCalendar ); 2189 DndFactory factory( mCalendar );
2190 factory.copyEvent(anEvent); 2190 factory.copyEvent(anEvent);
2191} 2191}
2192 2192
2193void CalendarView::edit_paste() 2193void CalendarView::edit_paste()
2194{ 2194{
2195 QDate date = mNavigator->selectedDates().first(); 2195 QDate date = mNavigator->selectedDates().first();
2196 2196
2197 DndFactory factory( mCalendar ); 2197 DndFactory factory( mCalendar );
2198 Event *pastedEvent = factory.pasteEvent( date ); 2198 Event *pastedEvent = factory.pasteEvent( date );
2199 2199
2200 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2200 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2201} 2201}
2202 2202
2203void CalendarView::edit_options() 2203void CalendarView::edit_options()
2204{ 2204{
2205 mDialogManager->showOptionsDialog(); 2205 mDialogManager->showOptionsDialog();
2206 //writeSettings(); 2206 //writeSettings();
2207} 2207}
2208 2208
2209void CalendarView::slotSelectPickerDate( QDate d) 2209void CalendarView::slotSelectPickerDate( QDate d)
2210{ 2210{
2211 mDateFrame->hide(); 2211 mDateFrame->hide();
2212 if ( mDatePickerMode == 1 ) { 2212 if ( mDatePickerMode == 1 ) {
2213 mNavigator->slotDaySelect( d ); 2213 mNavigator->slotDaySelect( d );
2214 } else if ( mDatePickerMode == 2 ) { 2214 } else if ( mDatePickerMode == 2 ) {
2215 if ( mMoveIncidence->type() == "Todo" ) { 2215 if ( mMoveIncidence->type() == "Todo" ) {
2216 Todo * to = (Todo *) mMoveIncidence; 2216 Todo * to = (Todo *) mMoveIncidence;
2217 QTime tim; 2217 QTime tim;
2218 if ( to->hasDueDate() ) 2218 if ( to->hasDueDate() )
2219 tim = to->dtDue().time(); 2219 tim = to->dtDue().time();
2220 else { 2220 else {
2221 tim = QTime ( 0,0,0 ); 2221 tim = QTime ( 0,0,0 );
2222 to->setFloats( true ); 2222 to->setFloats( true );
2223 to->setHasDueDate( true ); 2223 to->setHasDueDate( true );
2224 } 2224 }
2225 QDateTime dt ( d,tim ); 2225 QDateTime dt ( d,tim );
2226 to->setDtDue( dt ); 2226 to->setDtDue( dt );
2227 todoChanged( to ); 2227 todoChanged( to );
2228 } else { 2228 } else {
2229 QTime tim = mMoveIncidence->dtStart().time(); 2229 QTime tim = mMoveIncidence->dtStart().time();
2230 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2230 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2231 QDateTime dt ( d,tim ); 2231 QDateTime dt ( d,tim );
2232 mMoveIncidence->setDtStart( dt ); 2232 mMoveIncidence->setDtStart( dt );
2233 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2233 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2234 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2234 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2235 } 2235 }
2236 2236
2237 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2237 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2238 } 2238 }
2239} 2239}
2240 2240
2241void CalendarView::removeCategories() 2241void CalendarView::removeCategories()
2242{ 2242{
2243 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2243 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2244 QStringList catList = KOPrefs::instance()->mCustomCategories; 2244 QStringList catList = KOPrefs::instance()->mCustomCategories;
2245 QStringList catIncList; 2245 QStringList catIncList;
2246 QStringList newCatList; 2246 QStringList newCatList;
2247 Incidence* inc = incList.first(); 2247 Incidence* inc = incList.first();
2248 int i; 2248 int i;
2249 int count = 0; 2249 int count = 0;
2250 while ( inc ) { 2250 while ( inc ) {
2251 newCatList.clear(); 2251 newCatList.clear();
2252 catIncList = inc->categories() ; 2252 catIncList = inc->categories() ;
2253 for( i = 0; i< catIncList.count(); ++i ) { 2253 for( i = 0; i< catIncList.count(); ++i ) {
2254 if ( catList.contains (catIncList[i])) 2254 if ( catList.contains (catIncList[i]))
2255 newCatList.append( catIncList[i] ); 2255 newCatList.append( catIncList[i] );
2256 } 2256 }
2257 newCatList.sort(); 2257 newCatList.sort();
2258 inc->setCategories( newCatList.join(",") ); 2258 inc->setCategories( newCatList.join(",") );
2259 inc = incList.next(); 2259 inc = incList.next();
2260 } 2260 }
2261} 2261}
2262 2262
2263int CalendarView::addCategories() 2263int CalendarView::addCategories()
2264{ 2264{
2265 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2265 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2266 QStringList catList = KOPrefs::instance()->mCustomCategories; 2266 QStringList catList = KOPrefs::instance()->mCustomCategories;
2267 QStringList catIncList; 2267 QStringList catIncList;
2268 Incidence* inc = incList.first(); 2268 Incidence* inc = incList.first();
2269 int i; 2269 int i;
2270 int count = 0; 2270 int count = 0;
2271 while ( inc ) { 2271 while ( inc ) {
2272 catIncList = inc->categories() ; 2272 catIncList = inc->categories() ;
2273 for( i = 0; i< catIncList.count(); ++i ) { 2273 for( i = 0; i< catIncList.count(); ++i ) {
2274 if ( !catList.contains (catIncList[i])) { 2274 if ( !catList.contains (catIncList[i])) {
2275 catList.append( catIncList[i] ); 2275 catList.append( catIncList[i] );
2276 //qDebug("add cat %s ", catIncList[i].latin1()); 2276 //qDebug("add cat %s ", catIncList[i].latin1());
2277 ++count; 2277 ++count;
2278 } 2278 }
2279 } 2279 }
2280 inc = incList.next(); 2280 inc = incList.next();
2281 } 2281 }
2282 catList.sort(); 2282 catList.sort();
2283 KOPrefs::instance()->mCustomCategories = catList; 2283 KOPrefs::instance()->mCustomCategories = catList;
2284 return count; 2284 return count;
2285} 2285}
2286 2286
2287void CalendarView::manageCategories() 2287void CalendarView::manageCategories()
2288{ 2288{
2289 KOCatPrefs* cp = new KOCatPrefs(); 2289 KOCatPrefs* cp = new KOCatPrefs();
2290 cp->show(); 2290 cp->show();
2291 int w =cp->sizeHint().width() ; 2291 int w =cp->sizeHint().width() ;
2292 int h = cp->sizeHint().height() ; 2292 int h = cp->sizeHint().height() ;
2293 int dw = QApplication::desktop()->width(); 2293 int dw = QApplication::desktop()->width();
2294 int dh = QApplication::desktop()->height(); 2294 int dh = QApplication::desktop()->height();
2295 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2295 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2296 if ( !cp->exec() ) { 2296 if ( !cp->exec() ) {
2297 delete cp; 2297 delete cp;
2298 return; 2298 return;
2299 } 2299 }
2300 int count = 0; 2300 int count = 0;
2301 if ( cp->addCat() ) { 2301 if ( cp->addCat() ) {
2302 count = addCategories(); 2302 count = addCategories();
2303 if ( count ) { 2303 if ( count ) {
2304 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2304 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2305 writeSettings(); 2305 writeSettings();
2306 } 2306 } else
2307 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2307 } else { 2308 } else {
2308 removeCategories(); 2309 removeCategories();
2309 updateView(); 2310 updateView();
2310 } 2311 }
2311 delete cp; 2312 delete cp;
2312} 2313}
2313 2314
2314void CalendarView::beamIncidence(Incidence * Inc) 2315void CalendarView::beamIncidence(Incidence * Inc)
2315{ 2316{
2316 QPtrList<Incidence> delSel ; 2317 QPtrList<Incidence> delSel ;
2317 delSel.append(Inc); 2318 delSel.append(Inc);
2318 beamIncidenceList( delSel ); 2319 beamIncidenceList( delSel );
2319} 2320}
2320void CalendarView::beamCalendar() 2321void CalendarView::beamCalendar()
2321{ 2322{
2322 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2323 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2323 //qDebug("beamCalendar() "); 2324 //qDebug("beamCalendar() ");
2324 beamIncidenceList( delSel ); 2325 beamIncidenceList( delSel );
2325} 2326}
2326void CalendarView::beamFilteredCalendar() 2327void CalendarView::beamFilteredCalendar()
2327{ 2328{
2328 QPtrList<Incidence> delSel = mCalendar->incidences(); 2329 QPtrList<Incidence> delSel = mCalendar->incidences();
2329 //qDebug("beamFilteredCalendar() "); 2330 //qDebug("beamFilteredCalendar() ");
2330 beamIncidenceList( delSel ); 2331 beamIncidenceList( delSel );
2331} 2332}
2332void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2333void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2333{ 2334{
2334 if ( beamDialog->exec () == QDialog::Rejected ) 2335 if ( beamDialog->exec () == QDialog::Rejected )
2335 return; 2336 return;
2336#ifdef DESKTOP_VERSION 2337#ifdef DESKTOP_VERSION
2337 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2338 QString fn = locateLocal( "tmp", "kopibeamfile" );
2338#else 2339#else
2339 QString fn = "/tmp/kopibeamfile"; 2340 QString fn = "/tmp/kopibeamfile";
2340#endif 2341#endif
2341 QString mes; 2342 QString mes;
2342 bool createbup = true; 2343 bool createbup = true;
2343 if ( createbup ) { 2344 if ( createbup ) {
2344 QString description = "\n"; 2345 QString description = "\n";
2345 CalendarLocal* cal = new CalendarLocal(); 2346 CalendarLocal* cal = new CalendarLocal();
2346 if ( beamDialog->beamLocal() ) 2347 if ( beamDialog->beamLocal() )
2347 cal->setLocalTime(); 2348 cal->setLocalTime();
2348 else 2349 else
2349 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2350 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2350 Incidence *incidence = delSel.first(); 2351 Incidence *incidence = delSel.first();
2351 bool addText = false; 2352 bool addText = false;
2352 if ( delSel.count() < 10 ) 2353 if ( delSel.count() < 10 )
2353 addText = true; 2354 addText = true;
2354 else { 2355 else {
2355 description.sprintf(i18n(" %d items?"),delSel.count() ); 2356 description.sprintf(i18n(" %d items?"),delSel.count() );
2356 } 2357 }
2357 while ( incidence ) { 2358 while ( incidence ) {
2358 Incidence *in = incidence->clone(); 2359 Incidence *in = incidence->clone();
2359 if ( ! in->summary().isEmpty() ) { 2360 if ( ! in->summary().isEmpty() ) {
2360 in->setDescription(""); 2361 in->setDescription("");
2361 } else { 2362 } else {
2362 in->setSummary( in->description().left(20)); 2363 in->setSummary( in->description().left(20));
2363 in->setDescription(""); 2364 in->setDescription("");
2364 } 2365 }
2365 if ( addText ) 2366 if ( addText )
2366 description += in->summary() + "\n"; 2367 description += in->summary() + "\n";
2367 cal->addIncidence( in ); 2368 cal->addIncidence( in );
2368 incidence = delSel.next(); 2369 incidence = delSel.next();
2369 } 2370 }
2370 if ( beamDialog->beamVcal() ) { 2371 if ( beamDialog->beamVcal() ) {
2371 fn += ".vcs"; 2372 fn += ".vcs";
2372 FileStorage storage( cal, fn, new VCalFormat ); 2373 FileStorage storage( cal, fn, new VCalFormat );
2373 storage.save(); 2374 storage.save();
2374 } else { 2375 } else {
2375 fn += ".ics"; 2376 fn += ".ics";
2376 FileStorage storage( cal, fn, new ICalFormat( ) ); 2377 FileStorage storage( cal, fn, new ICalFormat( ) );
2377 storage.save(); 2378 storage.save();
2378 } 2379 }
2379 delete cal; 2380 delete cal;
2380 mes = i18n("KO/Pi: Ready for beaming"); 2381 mes = i18n("KO/Pi: Ready for beaming");
2381 topLevelWidget()->setCaption(mes); 2382 topLevelWidget()->setCaption(mes);
2382 KApplication::convert2latin1( fn ); 2383 KApplication::convert2latin1( fn );
2383#ifndef DESKTOP_VERSION 2384#ifndef DESKTOP_VERSION
2384 Ir *ir = new Ir( this ); 2385 Ir *ir = new Ir( this );
2385 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2386 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2386 ir->send( fn, description, "text/x-vCalendar" ); 2387 ir->send( fn, description, "text/x-vCalendar" );
2387#endif 2388#endif
2388 } 2389 }
2389} 2390}
2390void CalendarView::beamDone( Ir *ir ) 2391void CalendarView::beamDone( Ir *ir )
2391{ 2392{
2392#ifndef DESKTOP_VERSION 2393#ifndef DESKTOP_VERSION
2393 delete ir; 2394 delete ir;
2394#endif 2395#endif
2395 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2396 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2396 topLevelWidget()->raise(); 2397 topLevelWidget()->raise();
2397} 2398}
2398 2399
2399void CalendarView::moveIncidence(Incidence * inc ) 2400void CalendarView::moveIncidence(Incidence * inc )
2400{ 2401{
2401 if ( !inc ) return; 2402 if ( !inc ) return;
2402 // qDebug("showDatePickerForIncidence( ) "); 2403 // qDebug("showDatePickerForIncidence( ) ");
2403 if ( mDateFrame->isVisible() ) 2404 if ( mDateFrame->isVisible() )
2404 mDateFrame->hide(); 2405 mDateFrame->hide();
2405 else { 2406 else {
2406 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2407 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2407 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2408 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2408 int dw = QApplication::desktop()->width(); 2409 int dw = QApplication::desktop()->width();
2409 int dh = QApplication::desktop()->height(); 2410 int dh = QApplication::desktop()->height();
2410 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2411 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2411 mDateFrame->show(); 2412 mDateFrame->show();
2412 } 2413 }
2413 mDatePickerMode = 2; 2414 mDatePickerMode = 2;
2414 mMoveIncidence = inc ; 2415 mMoveIncidence = inc ;
2415 QDate da; 2416 QDate da;
2416 if ( mMoveIncidence->type() == "Todo" ) { 2417 if ( mMoveIncidence->type() == "Todo" ) {
2417 Todo * to = (Todo *) mMoveIncidence; 2418 Todo * to = (Todo *) mMoveIncidence;
2418 if ( to->hasDueDate() ) 2419 if ( to->hasDueDate() )
2419 da = to->dtDue().date(); 2420 da = to->dtDue().date();
2420 else 2421 else
2421 da = QDate::currentDate(); 2422 da = QDate::currentDate();
2422 } else { 2423 } else {
2423 da = mMoveIncidence->dtStart().date(); 2424 da = mMoveIncidence->dtStart().date();
2424 } 2425 }
2425 mDatePicker->setDate( da ); 2426 mDatePicker->setDate( da );
2426} 2427}
2427void CalendarView::showDatePicker( ) 2428void CalendarView::showDatePicker( )
2428{ 2429{
2429 //qDebug("CalendarView::showDatePicker( ) "); 2430 //qDebug("CalendarView::showDatePicker( ) ");
2430 if ( mDateFrame->isVisible() ) 2431 if ( mDateFrame->isVisible() )
2431 mDateFrame->hide(); 2432 mDateFrame->hide();
2432 else { 2433 else {
2433 int w =mDatePicker->sizeHint().width() ; 2434 int w =mDatePicker->sizeHint().width() ;
2434 int h = mDatePicker->sizeHint().height() ; 2435 int h = mDatePicker->sizeHint().height() ;