summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp35
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/mainwindow.cpp25
-rw-r--r--korganizer/mainwindow.h6
4 files changed, 69 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index b1da144..38b55f7 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2210,384 +2210,419 @@ void CalendarView::removeCategories()
2210 newCatList.sort(); 2210 newCatList.sort();
2211 inc->setCategories( newCatList.join(",") ); 2211 inc->setCategories( newCatList.join(",") );
2212 inc = incList.next(); 2212 inc = incList.next();
2213 } 2213 }
2214} 2214}
2215 2215
2216int CalendarView::addCategories() 2216int CalendarView::addCategories()
2217{ 2217{
2218 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2218 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2219 QStringList catList = KOPrefs::instance()->mCustomCategories; 2219 QStringList catList = KOPrefs::instance()->mCustomCategories;
2220 QStringList catIncList; 2220 QStringList catIncList;
2221 Incidence* inc = incList.first(); 2221 Incidence* inc = incList.first();
2222 int i; 2222 int i;
2223 int count = 0; 2223 int count = 0;
2224 while ( inc ) { 2224 while ( inc ) {
2225 catIncList = inc->categories() ; 2225 catIncList = inc->categories() ;
2226 for( i = 0; i< catIncList.count(); ++i ) { 2226 for( i = 0; i< catIncList.count(); ++i ) {
2227 if ( !catList.contains (catIncList[i])) { 2227 if ( !catList.contains (catIncList[i])) {
2228 catList.append( catIncList[i] ); 2228 catList.append( catIncList[i] );
2229 //qDebug("add cat %s ", catIncList[i].latin1()); 2229 //qDebug("add cat %s ", catIncList[i].latin1());
2230 ++count; 2230 ++count;
2231 } 2231 }
2232 } 2232 }
2233 inc = incList.next(); 2233 inc = incList.next();
2234 } 2234 }
2235 catList.sort(); 2235 catList.sort();
2236 KOPrefs::instance()->mCustomCategories = catList; 2236 KOPrefs::instance()->mCustomCategories = catList;
2237 return count; 2237 return count;
2238} 2238}
2239 2239
2240void CalendarView::manageCategories() 2240void CalendarView::manageCategories()
2241{ 2241{
2242 KOCatPrefs* cp = new KOCatPrefs(); 2242 KOCatPrefs* cp = new KOCatPrefs();
2243 cp->show(); 2243 cp->show();
2244 int w =cp->sizeHint().width() ; 2244 int w =cp->sizeHint().width() ;
2245 int h = cp->sizeHint().height() ; 2245 int h = cp->sizeHint().height() ;
2246 int dw = QApplication::desktop()->width(); 2246 int dw = QApplication::desktop()->width();
2247 int dh = QApplication::desktop()->height(); 2247 int dh = QApplication::desktop()->height();
2248 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2248 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2249 if ( !cp->exec() ) { 2249 if ( !cp->exec() ) {
2250 delete cp; 2250 delete cp;
2251 return; 2251 return;
2252 } 2252 }
2253 int count = 0; 2253 int count = 0;
2254 if ( cp->addCat() ) { 2254 if ( cp->addCat() ) {
2255 count = addCategories(); 2255 count = addCategories();
2256 if ( count ) { 2256 if ( count ) {
2257 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2257 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2258 writeSettings(); 2258 writeSettings();
2259 } 2259 }
2260 } else { 2260 } else {
2261 removeCategories(); 2261 removeCategories();
2262 updateView(); 2262 updateView();
2263 } 2263 }
2264 delete cp; 2264 delete cp;
2265} 2265}
2266 2266
2267void CalendarView::beamIncidence(Incidence * Inc) 2267void CalendarView::beamIncidence(Incidence * Inc)
2268{ 2268{
2269 QPtrList<Incidence> delSel ; 2269 QPtrList<Incidence> delSel ;
2270 delSel.append(Inc); 2270 delSel.append(Inc);
2271 beamIncidenceList( delSel ); 2271 beamIncidenceList( delSel );
2272} 2272}
2273void CalendarView::beamCalendar() 2273void CalendarView::beamCalendar()
2274{ 2274{
2275 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2275 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2276 //qDebug("beamCalendar() "); 2276 //qDebug("beamCalendar() ");
2277 beamIncidenceList( delSel ); 2277 beamIncidenceList( delSel );
2278} 2278}
2279void CalendarView::beamFilteredCalendar() 2279void CalendarView::beamFilteredCalendar()
2280{ 2280{
2281 QPtrList<Incidence> delSel = mCalendar->incidences(); 2281 QPtrList<Incidence> delSel = mCalendar->incidences();
2282 //qDebug("beamFilteredCalendar() "); 2282 //qDebug("beamFilteredCalendar() ");
2283 beamIncidenceList( delSel ); 2283 beamIncidenceList( delSel );
2284} 2284}
2285void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2285void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2286{ 2286{
2287 if ( beamDialog->exec () == QDialog::Rejected ) 2287 if ( beamDialog->exec () == QDialog::Rejected )
2288 return; 2288 return;
2289 2289
2290 QString fn = "/tmp/kopibeamfile"; 2290 QString fn = "/tmp/kopibeamfile";
2291 QString mes; 2291 QString mes;
2292 bool createbup = true; 2292 bool createbup = true;
2293 if ( createbup ) { 2293 if ( createbup ) {
2294 QString description = "\n"; 2294 QString description = "\n";
2295 CalendarLocal* cal = new CalendarLocal(); 2295 CalendarLocal* cal = new CalendarLocal();
2296 if ( beamDialog->beamLocal() ) 2296 if ( beamDialog->beamLocal() )
2297 cal->setLocalTime(); 2297 cal->setLocalTime();
2298 else 2298 else
2299 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2299 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2300 Incidence *incidence = delSel.first(); 2300 Incidence *incidence = delSel.first();
2301 bool addText = false; 2301 bool addText = false;
2302 if ( delSel.count() < 10 ) 2302 if ( delSel.count() < 10 )
2303 addText = true; 2303 addText = true;
2304 else { 2304 else {
2305 description.sprintf(i18n(" %d items?"),delSel.count() ); 2305 description.sprintf(i18n(" %d items?"),delSel.count() );
2306 } 2306 }
2307 while ( incidence ) { 2307 while ( incidence ) {
2308 Incidence *in = incidence->clone(); 2308 Incidence *in = incidence->clone();
2309 if ( addText ) 2309 if ( addText )
2310 description += in->summary() + "\n"; 2310 description += in->summary() + "\n";
2311 cal->addIncidence( in ); 2311 cal->addIncidence( in );
2312 incidence = delSel.next(); 2312 incidence = delSel.next();
2313 } 2313 }
2314 if ( beamDialog->beamVcal() ) { 2314 if ( beamDialog->beamVcal() ) {
2315 fn += ".vcs"; 2315 fn += ".vcs";
2316 FileStorage storage( cal, fn, new VCalFormat ); 2316 FileStorage storage( cal, fn, new VCalFormat );
2317 storage.save(); 2317 storage.save();
2318 } else { 2318 } else {
2319 fn += ".ics"; 2319 fn += ".ics";
2320 FileStorage storage( cal, fn, new ICalFormat( ) ); 2320 FileStorage storage( cal, fn, new ICalFormat( ) );
2321 storage.save(); 2321 storage.save();
2322 } 2322 }
2323 delete cal; 2323 delete cal;
2324 mes = i18n("KO/Pi: Ready for beaming"); 2324 mes = i18n("KO/Pi: Ready for beaming");
2325 setCaption(mes); 2325 setCaption(mes);
2326 2326
2327#ifndef DESKTOP_VERSION 2327#ifndef DESKTOP_VERSION
2328 Ir *ir = new Ir( this ); 2328 Ir *ir = new Ir( this );
2329 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2329 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2330 ir->send( fn, description, "text/x-vCalendar" ); 2330 ir->send( fn, description, "text/x-vCalendar" );
2331#endif 2331#endif
2332 } 2332 }
2333} 2333}
2334void CalendarView::beamDone( Ir *ir ) 2334void CalendarView::beamDone( Ir *ir )
2335{ 2335{
2336#ifndef DESKTOP_VERSION 2336#ifndef DESKTOP_VERSION
2337 delete ir; 2337 delete ir;
2338#endif 2338#endif
2339} 2339}
2340 2340
2341void CalendarView::moveIncidence(Incidence * inc ) 2341void CalendarView::moveIncidence(Incidence * inc )
2342{ 2342{
2343 if ( !inc ) return; 2343 if ( !inc ) return;
2344 // qDebug("showDatePickerForIncidence( ) "); 2344 // qDebug("showDatePickerForIncidence( ) ");
2345 if ( mDateFrame->isVisible() ) 2345 if ( mDateFrame->isVisible() )
2346 mDateFrame->hide(); 2346 mDateFrame->hide();
2347 else { 2347 else {
2348 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2348 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2349 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2349 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2350 int dw = QApplication::desktop()->width(); 2350 int dw = QApplication::desktop()->width();
2351 int dh = QApplication::desktop()->height(); 2351 int dh = QApplication::desktop()->height();
2352 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2352 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2353 mDateFrame->show(); 2353 mDateFrame->show();
2354 } 2354 }
2355 mDatePickerMode = 2; 2355 mDatePickerMode = 2;
2356 mMoveIncidence = inc ; 2356 mMoveIncidence = inc ;
2357 QDate da; 2357 QDate da;
2358 if ( mMoveIncidence->type() == "Todo" ) { 2358 if ( mMoveIncidence->type() == "Todo" ) {
2359 Todo * to = (Todo *) mMoveIncidence; 2359 Todo * to = (Todo *) mMoveIncidence;
2360 if ( to->hasDueDate() ) 2360 if ( to->hasDueDate() )
2361 da = to->dtDue().date(); 2361 da = to->dtDue().date();
2362 else 2362 else
2363 da = QDate::currentDate(); 2363 da = QDate::currentDate();
2364 } else { 2364 } else {
2365 da = mMoveIncidence->dtStart().date(); 2365 da = mMoveIncidence->dtStart().date();
2366 } 2366 }
2367 mDatePicker->setDate( da ); 2367 mDatePicker->setDate( da );
2368} 2368}
2369void CalendarView::showDatePicker( ) 2369void CalendarView::showDatePicker( )
2370{ 2370{
2371 //qDebug("CalendarView::showDatePicker( ) "); 2371 //qDebug("CalendarView::showDatePicker( ) ");
2372 if ( mDateFrame->isVisible() ) 2372 if ( mDateFrame->isVisible() )
2373 mDateFrame->hide(); 2373 mDateFrame->hide();
2374 else { 2374 else {
2375 int w =mDatePicker->sizeHint().width() ; 2375 int w =mDatePicker->sizeHint().width() ;
2376 int h = mDatePicker->sizeHint().height() ; 2376 int h = mDatePicker->sizeHint().height() ;
2377 int dw = QApplication::desktop()->width(); 2377 int dw = QApplication::desktop()->width();
2378 int dh = QApplication::desktop()->height(); 2378 int dh = QApplication::desktop()->height();
2379 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2379 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2380 mDateFrame->show(); 2380 mDateFrame->show();
2381 } 2381 }
2382 mDatePickerMode = 1; 2382 mDatePickerMode = 1;
2383 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2383 mDatePicker->setDate( mNavigator->selectedDates().first() );
2384} 2384}
2385 2385
2386void CalendarView::showEventEditor() 2386void CalendarView::showEventEditor()
2387{ 2387{
2388#ifdef DESKTOP_VERSION 2388#ifdef DESKTOP_VERSION
2389 mEventEditor->show(); 2389 mEventEditor->show();
2390#else 2390#else
2391 mEventEditor->showMaximized(); 2391 mEventEditor->showMaximized();
2392#endif 2392#endif
2393} 2393}
2394void CalendarView::showTodoEditor() 2394void CalendarView::showTodoEditor()
2395{ 2395{
2396#ifdef DESKTOP_VERSION 2396#ifdef DESKTOP_VERSION
2397 mTodoEditor->show(); 2397 mTodoEditor->show();
2398#else 2398#else
2399 mTodoEditor->showMaximized(); 2399 mTodoEditor->showMaximized();
2400#endif 2400#endif
2401} 2401}
2402
2403void CalendarView::cloneIncidence()
2404{
2405 Incidence *incidence = currentSelection();
2406 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2407 if ( incidence ) {
2408 cloneIncidence(incidence);
2409 }
2410}
2411void CalendarView::moveIncidence()
2412{
2413 Incidence *incidence = currentSelection();
2414 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2415 if ( incidence ) {
2416 moveIncidence(incidence);
2417 }
2418}
2419void CalendarView::beamIncidence()
2420{
2421 Incidence *incidence = currentSelection();
2422 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2423 if ( incidence ) {
2424 beamIncidence(incidence);
2425 }
2426}
2427void CalendarView::toggleCancelIncidence()
2428{
2429 Incidence *incidence = currentSelection();
2430 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2431 if ( incidence ) {
2432 cancelIncidence(incidence);
2433 }
2434}
2435
2436
2402void CalendarView::cancelIncidence(Incidence * inc ) 2437void CalendarView::cancelIncidence(Incidence * inc )
2403{ 2438{
2404 inc->setCancelled( ! inc->cancelled() ); 2439 inc->setCancelled( ! inc->cancelled() );
2405 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2440 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2406 updateView(); 2441 updateView();
2407} 2442}
2408void CalendarView::cloneIncidence(Incidence * orgInc ) 2443void CalendarView::cloneIncidence(Incidence * orgInc )
2409{ 2444{
2410 Incidence * newInc = orgInc->clone(); 2445 Incidence * newInc = orgInc->clone();
2411 newInc->recreate(); 2446 newInc->recreate();
2412 2447
2413 if ( newInc->type() == "Todo" ) { 2448 if ( newInc->type() == "Todo" ) {
2414 Todo* t = (Todo*) newInc; 2449 Todo* t = (Todo*) newInc;
2415 mTodoEditor->editTodo( t ); 2450 mTodoEditor->editTodo( t );
2416 showTodoEditor(); 2451 showTodoEditor();
2417 if ( mTodoEditor->exec() ) { 2452 if ( mTodoEditor->exec() ) {
2418 mCalendar->addTodo( t ); 2453 mCalendar->addTodo( t );
2419 updateView(); 2454 updateView();
2420 } else { 2455 } else {
2421 delete t; 2456 delete t;
2422 } 2457 }
2423 } 2458 }
2424 else { 2459 else {
2425 Event* e = (Event*) newInc; 2460 Event* e = (Event*) newInc;
2426 mEventEditor->editEvent( e ); 2461 mEventEditor->editEvent( e );
2427 showEventEditor(); 2462 showEventEditor();
2428 if ( mEventEditor->exec() ) { 2463 if ( mEventEditor->exec() ) {
2429 mCalendar->addEvent( e ); 2464 mCalendar->addEvent( e );
2430 updateView(); 2465 updateView();
2431 } else { 2466 } else {
2432 delete e; 2467 delete e;
2433 } 2468 }
2434 } 2469 }
2435} 2470}
2436 2471
2437void CalendarView::newEvent() 2472void CalendarView::newEvent()
2438{ 2473{
2439 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2474 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2440 KOAgendaView *aView = mViewManager->agendaView(); 2475 KOAgendaView *aView = mViewManager->agendaView();
2441 if (aView) { 2476 if (aView) {
2442 if (aView->selectionStart().isValid()) { 2477 if (aView->selectionStart().isValid()) {
2443 if (aView->selectedIsAllDay()) { 2478 if (aView->selectedIsAllDay()) {
2444 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2479 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2445 } else { 2480 } else {
2446 newEvent(aView->selectionStart(),aView->selectionEnd()); 2481 newEvent(aView->selectionStart(),aView->selectionEnd());
2447 } 2482 }
2448 return; 2483 return;
2449 } 2484 }
2450 } 2485 }
2451 2486
2452 QDate date = mNavigator->selectedDates().first(); 2487 QDate date = mNavigator->selectedDates().first();
2453 QDateTime current = QDateTime::currentDateTime(); 2488 QDateTime current = QDateTime::currentDateTime();
2454 if ( date <= current.date() ) { 2489 if ( date <= current.date() ) {
2455 int hour = current.time().hour() +1; 2490 int hour = current.time().hour() +1;
2456 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2491 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2457 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2492 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2458 } else 2493 } else
2459 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2494 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2460 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2495 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2461 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2496 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2462} 2497}
2463 2498
2464void CalendarView::newEvent(QDateTime fh) 2499void CalendarView::newEvent(QDateTime fh)
2465{ 2500{
2466 newEvent(fh, 2501 newEvent(fh,
2467 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2502 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2468} 2503}
2469 2504
2470void CalendarView::newEvent(QDate dt) 2505void CalendarView::newEvent(QDate dt)
2471{ 2506{
2472 newEvent(QDateTime(dt, QTime(0,0,0)), 2507 newEvent(QDateTime(dt, QTime(0,0,0)),
2473 QDateTime(dt, QTime(0,0,0)), true); 2508 QDateTime(dt, QTime(0,0,0)), true);
2474} 2509}
2475 2510
2476void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2511void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2477{ 2512{
2478 2513
2479 mEventEditor->newEvent(fromHint,toHint,allDay); 2514 mEventEditor->newEvent(fromHint,toHint,allDay);
2480 if ( mFilterView->filtersEnabled() ) { 2515 if ( mFilterView->filtersEnabled() ) {
2481 CalFilter *filter = mFilterView->selectedFilter(); 2516 CalFilter *filter = mFilterView->selectedFilter();
2482 if (filter && filter->showCategories()) { 2517 if (filter && filter->showCategories()) {
2483 mEventEditor->setCategories(filter->categoryList().join(",") ); 2518 mEventEditor->setCategories(filter->categoryList().join(",") );
2484 } 2519 }
2485 if ( filter ) 2520 if ( filter )
2486 mEventEditor->setSecrecy( filter->getSecrecy() ); 2521 mEventEditor->setSecrecy( filter->getSecrecy() );
2487 } 2522 }
2488 showEventEditor(); 2523 showEventEditor();
2489} 2524}
2490void CalendarView::todoAdded(Todo * t) 2525void CalendarView::todoAdded(Todo * t)
2491{ 2526{
2492 2527
2493 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2528 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2494 updateTodoViews(); 2529 updateTodoViews();
2495} 2530}
2496void CalendarView::todoChanged(Todo * t) 2531void CalendarView::todoChanged(Todo * t)
2497{ 2532{
2498 emit todoModified( t, 4 ); 2533 emit todoModified( t, 4 );
2499 // updateTodoViews(); 2534 // updateTodoViews();
2500} 2535}
2501void CalendarView::todoToBeDeleted(Todo *) 2536void CalendarView::todoToBeDeleted(Todo *)
2502{ 2537{
2503 //qDebug("todoToBeDeleted(Todo *) "); 2538 //qDebug("todoToBeDeleted(Todo *) ");
2504 updateTodoViews(); 2539 updateTodoViews();
2505} 2540}
2506void CalendarView::todoDeleted() 2541void CalendarView::todoDeleted()
2507{ 2542{
2508 //qDebug(" todoDeleted()"); 2543 //qDebug(" todoDeleted()");
2509 updateTodoViews(); 2544 updateTodoViews();
2510} 2545}
2511 2546
2512 2547
2513 2548
2514void CalendarView::newTodo() 2549void CalendarView::newTodo()
2515{ 2550{
2516 2551
2517 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2552 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2518 if ( mFilterView->filtersEnabled() ) { 2553 if ( mFilterView->filtersEnabled() ) {
2519 CalFilter *filter = mFilterView->selectedFilter(); 2554 CalFilter *filter = mFilterView->selectedFilter();
2520 if (filter && filter->showCategories()) { 2555 if (filter && filter->showCategories()) {
2521 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2556 mTodoEditor->setCategories(filter->categoryList().join(",") );
2522 } 2557 }
2523 if ( filter ) 2558 if ( filter )
2524 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2559 mTodoEditor->setSecrecy( filter->getSecrecy() );
2525 } 2560 }
2526 showTodoEditor(); 2561 showTodoEditor();
2527} 2562}
2528 2563
2529void CalendarView::newSubTodo() 2564void CalendarView::newSubTodo()
2530{ 2565{
2531 Todo *todo = selectedTodo(); 2566 Todo *todo = selectedTodo();
2532 if ( todo ) newSubTodo( todo ); 2567 if ( todo ) newSubTodo( todo );
2533} 2568}
2534 2569
2535void CalendarView::newSubTodo(Todo *parentEvent) 2570void CalendarView::newSubTodo(Todo *parentEvent)
2536{ 2571{
2537 2572
2538 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2573 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2539 showTodoEditor(); 2574 showTodoEditor();
2540} 2575}
2541 2576
2542void CalendarView::newFloatingEvent() 2577void CalendarView::newFloatingEvent()
2543{ 2578{
2544 DateList tmpList = mNavigator->selectedDates(); 2579 DateList tmpList = mNavigator->selectedDates();
2545 QDate date = tmpList.first(); 2580 QDate date = tmpList.first();
2546 2581
2547 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2582 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2548 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2583 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2549} 2584}
2550 2585
2551 2586
2552void CalendarView::editEvent( Event *event ) 2587void CalendarView::editEvent( Event *event )
2553{ 2588{
2554 2589
2555 if ( !event ) return; 2590 if ( !event ) return;
2556 if ( event->isReadOnly() ) { 2591 if ( event->isReadOnly() ) {
2557 showEvent( event ); 2592 showEvent( event );
2558 return; 2593 return;
2559 } 2594 }
2560 mEventEditor->editEvent( event , mFlagEditDescription); 2595 mEventEditor->editEvent( event , mFlagEditDescription);
2561 showEventEditor(); 2596 showEventEditor();
2562} 2597}
2563void CalendarView::editJournal( Journal *jour ) 2598void CalendarView::editJournal( Journal *jour )
2564{ 2599{
2565 if ( !jour ) return; 2600 if ( !jour ) return;
2566 mDialogManager->hideSearchDialog(); 2601 mDialogManager->hideSearchDialog();
2567 mViewManager->showJournalView(); 2602 mViewManager->showJournalView();
2568 mNavigator->slotDaySelect( jour->dtStart().date() ); 2603 mNavigator->slotDaySelect( jour->dtStart().date() );
2569} 2604}
2570void CalendarView::editTodo( Todo *todo ) 2605void CalendarView::editTodo( Todo *todo )
2571{ 2606{
2572 if ( !todo ) return; 2607 if ( !todo ) return;
2573 2608
2574 if ( todo->isReadOnly() ) { 2609 if ( todo->isReadOnly() ) {
2575 showTodo( todo ); 2610 showTodo( todo );
2576 return; 2611 return;
2577 } 2612 }
2578 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2613 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2579 showTodoEditor(); 2614 showTodoEditor();
2580 2615
2581} 2616}
2582 2617
2583KOEventViewerDialog* CalendarView::getEventViewerDialog() 2618KOEventViewerDialog* CalendarView::getEventViewerDialog()
2584{ 2619{
2585 if ( !mEventViewerDialog ) { 2620 if ( !mEventViewerDialog ) {
2586 mEventViewerDialog = new KOEventViewerDialog(this); 2621 mEventViewerDialog = new KOEventViewerDialog(this);
2587 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2622 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2588 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2623 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2589 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2624 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2590 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2625 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2591 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2626 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2592 viewManager(), SLOT( showAgendaView( bool ) ) ); 2627 viewManager(), SLOT( showAgendaView( bool ) ) );
2593 mEventViewerDialog->resize( 640, 480 ); 2628 mEventViewerDialog->resize( 640, 480 );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index cd54685..a713c91 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -22,384 +22,388 @@
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45class QWidgetStack; 45class QWidgetStack;
46class QSplitter; 46class QSplitter;
47 47
48class CalPrinter; 48class CalPrinter;
49class KOFilterView; 49class KOFilterView;
50class KOViewManager; 50class KOViewManager;
51class KODialogManager; 51class KODialogManager;
52class KOTodoView; 52class KOTodoView;
53class KDateNavigator; 53class KDateNavigator;
54class DateNavigator; 54class DateNavigator;
55class KOIncidenceEditor; 55class KOIncidenceEditor;
56class KDatePicker; 56class KDatePicker;
57class ResourceView; 57class ResourceView;
58class NavigatorBar; 58class NavigatorBar;
59class KOEventEditor; 59class KOEventEditor;
60class KOTodoEditor ; 60class KOTodoEditor ;
61class KOEventViewerDialog; 61class KOEventViewerDialog;
62class KOBeamPrefs; 62class KOBeamPrefs;
63class KSyncProfile; 63class KSyncProfile;
64class AlarmDialog; 64class AlarmDialog;
65class KCal::Attendee; 65class KCal::Attendee;
66 66
67namespace KCal { class FileStorage; } 67namespace KCal { class FileStorage; }
68 68
69using namespace KCal; 69using namespace KCal;
70 70
71/** 71/**
72 This is the main calendar widget. It provides the different vies on t he 72 This is the main calendar widget. It provides the different vies on t he
73 calendar data as well as the date navigator. It also handles synchronisation 73 calendar data as well as the date navigator. It also handles synchronisation
74 of the different views and controls the different dialogs like preferences, 74 of the different views and controls the different dialogs like preferences,
75 event editor, search dialog etc. 75 event editor, search dialog etc.
76 76
77 @short main calendar view widget 77 @short main calendar view widget
78 @author Cornelius Schumacher 78 @author Cornelius Schumacher
79*/ 79*/
80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer 80class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer
81{ 81{
82 Q_OBJECT 82 Q_OBJECT
83 public: 83 public:
84 /** 84 /**
85 Constructs a new calendar view widget. 85 Constructs a new calendar view widget.
86 86
87 @param calendar calendar document 87 @param calendar calendar document
88 @param parent parent window 88 @param parent parent window
89 @param name Qt internal widget object name 89 @param name Qt internal widget object name
90 */ 90 */
91 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 91 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
92 const char *name = 0 ); 92 const char *name = 0 );
93 CalendarView( Calendar *calendar, QWidget *parent = 0, 93 CalendarView( Calendar *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 virtual ~CalendarView(); 95 virtual ~CalendarView();
96 96
97 Calendar *calendar() { return mCalendar; } 97 Calendar *calendar() { return mCalendar; }
98 98
99 KOViewManager *viewManager(); 99 KOViewManager *viewManager();
100 KODialogManager *dialogManager(); 100 KODialogManager *dialogManager();
101 101
102 QDate startDate(); 102 QDate startDate();
103 QDate endDate(); 103 QDate endDate();
104 104
105 QWidgetStack *viewStack(); 105 QWidgetStack *viewStack();
106 QWidget *leftFrame(); 106 QWidget *leftFrame();
107 NavigatorBar *navigatorBar(); 107 NavigatorBar *navigatorBar();
108 108
109 DateNavigator *dateNavigator(); 109 DateNavigator *dateNavigator();
110 KDateNavigator *dateNavigatorWidget(); 110 KDateNavigator *dateNavigatorWidget();
111 111
112 void addView(KOrg::BaseView *); 112 void addView(KOrg::BaseView *);
113 void showView(KOrg::BaseView *); 113 void showView(KOrg::BaseView *);
114 KOEventViewerDialog* getEventViewerDialog(); 114 KOEventViewerDialog* getEventViewerDialog();
115 Incidence *currentSelection(); 115 Incidence *currentSelection();
116 void setupExternSyncProfiles(); 116 void setupExternSyncProfiles();
117 117
118 signals: 118 signals:
119 /** This todo has been modified */ 119 /** This todo has been modified */
120 void todoModified(Todo *, int); 120 void todoModified(Todo *, int);
121 121
122 /** when change is made to options dialog, the topwidget will catch this 122 /** when change is made to options dialog, the topwidget will catch this
123 * and emit this signal which notifies all widgets which have registered 123 * and emit this signal which notifies all widgets which have registered
124 * for notification to update their settings. */ 124 * for notification to update their settings. */
125 void configChanged(); 125 void configChanged();
126 /** emitted when the topwidget is closing down, so that any attached 126 /** emitted when the topwidget is closing down, so that any attached
127 child windows can also close. */ 127 child windows can also close. */
128 void closingDown(); 128 void closingDown();
129 /** emitted right before we die */ 129 /** emitted right before we die */
130 void closed(QWidget *); 130 void closed(QWidget *);
131 131
132 /** Emitted when state of modified flag changes */ 132 /** Emitted when state of modified flag changes */
133 void modifiedChanged(bool); 133 void modifiedChanged(bool);
134 void signalmodified(); 134 void signalmodified();
135 135
136 /** Emitted when state of read-only flag changes */ 136 /** Emitted when state of read-only flag changes */
137 void readOnlyChanged(bool); 137 void readOnlyChanged(bool);
138 138
139 /** Emitted when the unit of navigation changes */ 139 /** Emitted when the unit of navigation changes */
140 void changeNavStringPrev(const QString &); 140 void changeNavStringPrev(const QString &);
141 void changeNavStringNext(const QString &); 141 void changeNavStringNext(const QString &);
142 142
143 /** Emitted when state of events selection has changed and user is organizer*/ 143 /** Emitted when state of events selection has changed and user is organizer*/
144 void organizerEventsSelected(bool); 144 void organizerEventsSelected(bool);
145 /** Emitted when state of events selection has changed and user is attendee*/ 145 /** Emitted when state of events selection has changed and user is attendee*/
146 void groupEventsSelected(bool); 146 void groupEventsSelected(bool);
147 /** 147 /**
148 Emitted when an incidence gets selected. If the selection is cleared the 148 Emitted when an incidence gets selected. If the selection is cleared the
149 signal is emitted with 0 as argument. 149 signal is emitted with 0 as argument.
150 */ 150 */
151 void incidenceSelected( Incidence * ); 151 void incidenceSelected( Incidence * );
152 /** Emitted, when a todoitem is selected or deselected. */ 152 /** Emitted, when a todoitem is selected or deselected. */
153 void todoSelected( bool ); 153 void todoSelected( bool );
154 154
155 /** 155 /**
156 Emitted, when clipboard content changes. Parameter indicates if paste 156 Emitted, when clipboard content changes. Parameter indicates if paste
157 is possible or not. 157 is possible or not.
158 */ 158 */
159 void pasteEnabled(bool); 159 void pasteEnabled(bool);
160 160
161 /** Emitted, when the number of incoming messages has changed. */ 161 /** Emitted, when the number of incoming messages has changed. */
162 void numIncomingChanged(int); 162 void numIncomingChanged(int);
163 163
164 /** Emitted, when the number of outgoing messages has changed. */ 164 /** Emitted, when the number of outgoing messages has changed. */
165 void numOutgoingChanged(int); 165 void numOutgoingChanged(int);
166 166
167 /** Send status message, which can e.g. be displayed in the status bar. */ 167 /** Send status message, which can e.g. be displayed in the status bar. */
168 void statusMessage(const QString &); 168 void statusMessage(const QString &);
169 169
170 void calendarViewExpanded( bool ); 170 void calendarViewExpanded( bool );
171 void updateSearchDialog(); 171 void updateSearchDialog();
172 172
173 173
174 public slots: 174 public slots:
175 void showOpenError(); 175 void showOpenError();
176 void watchSavedFile(); 176 void watchSavedFile();
177 void recheckTimerAlarm(); 177 void recheckTimerAlarm();
178 void checkNextTimerAlarm(); 178 void checkNextTimerAlarm();
179 void addAlarm(const QDateTime &qdt, const QString &noti ); 179 void addAlarm(const QDateTime &qdt, const QString &noti );
180 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 180 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
181 void removeAlarm(const QDateTime &qdt, const QString &noti ); 181 void removeAlarm(const QDateTime &qdt, const QString &noti );
182 182
183 /** options dialog made a changed to the configuration. we catch this 183 /** options dialog made a changed to the configuration. we catch this
184 * and notify all widgets which need to update their configuration. */ 184 * and notify all widgets which need to update their configuration. */
185 void updateConfig(); 185 void updateConfig();
186 186
187 /** 187 /**
188 Load calendar from file \a filename. If \a merge is true, load 188 Load calendar from file \a filename. If \a merge is true, load
189 calendar into existing one, if it is false, clear calendar, before 189 calendar into existing one, if it is false, clear calendar, before
190 loading. Return true, if calendar could be successfully loaded. 190 loading. Return true, if calendar could be successfully loaded.
191 */ 191 */
192 bool openCalendar(QString filename, bool merge=false); 192 bool openCalendar(QString filename, bool merge=false);
193 bool syncCalendar(QString filename,int mode = 0 ); 193 bool syncCalendar(QString filename,int mode = 0 );
194 194
195 /** 195 /**
196 Save calendar data to file. Return true if calendar could be 196 Save calendar data to file. Return true if calendar could be
197 successfully saved. 197 successfully saved.
198 */ 198 */
199 bool saveCalendar(QString filename); 199 bool saveCalendar(QString filename);
200 200
201 /** 201 /**
202 Close calendar. Clear calendar data and reset views to display an empty 202 Close calendar. Clear calendar data and reset views to display an empty
203 calendar. 203 calendar.
204 */ 204 */
205 void closeCalendar(); 205 void closeCalendar();
206 206
207 /** Archive old events of calendar */ 207 /** Archive old events of calendar */
208 void archiveCalendar(); 208 void archiveCalendar();
209 209
210 void showIncidence(); 210 void showIncidence();
211 void editIncidence(); 211 void editIncidence();
212 void editIncidenceDescription(); 212 void editIncidenceDescription();
213 void deleteIncidence(); 213 void deleteIncidence();
214 void cloneIncidence();
215 void moveIncidence();
216 void beamIncidence();
217 void toggleCancelIncidence();
214 218
215 /** create an editeventwin with supplied date/time, and if bool is true, 219 /** create an editeventwin with supplied date/time, and if bool is true,
216 * make the event take all day. */ 220 * make the event take all day. */
217 void newEvent(QDateTime, QDateTime, bool allDay = false); 221 void newEvent(QDateTime, QDateTime, bool allDay = false);
218 void newEvent(QDateTime fh); 222 void newEvent(QDateTime fh);
219 void newEvent(QDate dt); 223 void newEvent(QDate dt);
220 /** create new event without having a date hint. Takes current date as 224 /** create new event without having a date hint. Takes current date as
221 default hint. */ 225 default hint. */
222 void newEvent(); 226 void newEvent();
223 void newFloatingEvent(); 227 void newFloatingEvent();
224 228
225 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 229 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
226 void showIncidence(Incidence *); 230 void showIncidence(Incidence *);
227 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 231 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
228 void editIncidence(Incidence *); 232 void editIncidence(Incidence *);
229 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 233 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
230 void deleteIncidence(Incidence *); 234 void deleteIncidence(Incidence *);
231 void cloneIncidence(Incidence *); 235 void cloneIncidence(Incidence *);
232 void cancelIncidence(Incidence *); 236 void cancelIncidence(Incidence *);
233 /** Create an editor for the supplied event. */ 237 /** Create an editor for the supplied event. */
234 void editEvent(Event *); 238 void editEvent(Event *);
235 /** Delete the supplied event. */ 239 /** Delete the supplied event. */
236 void deleteEvent(Event *); 240 void deleteEvent(Event *);
237 /** Delete the event with the given unique ID. Returns false, if event wasn't 241 /** Delete the event with the given unique ID. Returns false, if event wasn't
238 found. */ 242 found. */
239 bool deleteEvent(const QString &uid); 243 bool deleteEvent(const QString &uid);
240 /** Create a read-only viewer dialog for the supplied event. */ 244 /** Create a read-only viewer dialog for the supplied event. */
241 void showEvent(Event *); 245 void showEvent(Event *);
242 246
243 void editJournal(Journal *); 247 void editJournal(Journal *);
244 void showJournal(Journal *); 248 void showJournal(Journal *);
245 void deleteJournal(Journal *); 249 void deleteJournal(Journal *);
246 /** Create an editor dialog for a todo */ 250 /** Create an editor dialog for a todo */
247 void editTodo(Todo *); 251 void editTodo(Todo *);
248 /** Create a read-only viewer dialog for the supplied todo */ 252 /** Create a read-only viewer dialog for the supplied todo */
249 void showTodo(Todo *); 253 void showTodo(Todo *);
250 /** create new todo */ 254 /** create new todo */
251 void newTodo(); 255 void newTodo();
252 /** create new todo with a parent todo */ 256 /** create new todo with a parent todo */
253 void newSubTodo(); 257 void newSubTodo();
254 /** create new todo with a parent todo */ 258 /** create new todo with a parent todo */
255 void newSubTodo(Todo *); 259 void newSubTodo(Todo *);
256 /** Delete todo */ 260 /** Delete todo */
257 void deleteTodo(Todo *); 261 void deleteTodo(Todo *);
258 262
259 263
260 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 264 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
261 * emitted as result. */ 265 * emitted as result. */
262 void checkClipboard(); 266 void checkClipboard();
263 267
264 /** using the KConfig associated with the kapp variable, read in the 268 /** using the KConfig associated with the kapp variable, read in the
265 * settings from the config file. 269 * settings from the config file.
266 */ 270 */
267 void readSettings(); 271 void readSettings();
268 272
269 /** write current state to config file. */ 273 /** write current state to config file. */
270 void writeSettings(); 274 void writeSettings();
271 275
272 /** read settings for calendar filters */ 276 /** read settings for calendar filters */
273 void readFilterSettings(KConfig *config); 277 void readFilterSettings(KConfig *config);
274 278
275 /** write settings for calendar filters */ 279 /** write settings for calendar filters */
276 void writeFilterSettings(KConfig *config); 280 void writeFilterSettings(KConfig *config);
277 281
278 /** passes on the message that an event has changed to the currently 282 /** passes on the message that an event has changed to the currently
279 * activated view so that it can make appropriate display changes. */ 283 * activated view so that it can make appropriate display changes. */
280 void changeEventDisplay(Event *, int); 284 void changeEventDisplay(Event *, int);
281 void changeIncidenceDisplay(Incidence *, int); 285 void changeIncidenceDisplay(Incidence *, int);
282 void changeTodoDisplay(Todo *, int); 286 void changeTodoDisplay(Todo *, int);
283 287
284 void eventAdded(Event *); 288 void eventAdded(Event *);
285 void eventChanged(Event *); 289 void eventChanged(Event *);
286 void eventToBeDeleted(Event *); 290 void eventToBeDeleted(Event *);
287 void eventDeleted(); 291 void eventDeleted();
288 292
289 void todoAdded(Todo *); 293 void todoAdded(Todo *);
290 void todoChanged(Todo *); 294 void todoChanged(Todo *);
291 void todoToBeDeleted(Todo *); 295 void todoToBeDeleted(Todo *);
292 void todoDeleted(); 296 void todoDeleted();
293 297
294 void updateView(const QDate &start, const QDate &end); 298 void updateView(const QDate &start, const QDate &end);
295 void updateView(); 299 void updateView();
296 300
297 /** Full update of visible todo views */ 301 /** Full update of visible todo views */
298 void updateTodoViews(); 302 void updateTodoViews();
299 303
300 void updateUnmanagedViews(); 304 void updateUnmanagedViews();
301 305
302 /** cut the current appointment to the clipboard */ 306 /** cut the current appointment to the clipboard */
303 void edit_cut(); 307 void edit_cut();
304 308
305 /** copy the current appointment(s) to the clipboard */ 309 /** copy the current appointment(s) to the clipboard */
306 void edit_copy(); 310 void edit_copy();
307 311
308 /** paste the current vobject(s) in the clipboard buffer into calendar */ 312 /** paste the current vobject(s) in the clipboard buffer into calendar */
309 void edit_paste(); 313 void edit_paste();
310 314
311 /** edit viewing and configuration options. */ 315 /** edit viewing and configuration options. */
312 void edit_options(); 316 void edit_options();
313 void edit_sync_options(); 317 void edit_sync_options();
314 /** 318 /**
315 Functions for printing, previewing a print, and setting up printing 319 Functions for printing, previewing a print, and setting up printing
316 parameters. 320 parameters.
317 */ 321 */
318 void print(); 322 void print();
319 void printSetup(); 323 void printSetup();
320 void printPreview(); 324 void printPreview();
321 325
322 /** Export as iCalendar file */ 326 /** Export as iCalendar file */
323 void exportICalendar(); 327 void exportICalendar();
324 328
325 /** Export as vCalendar file */ 329 /** Export as vCalendar file */
326 bool exportVCalendar( QString fn); 330 bool exportVCalendar( QString fn);
327 331
328 /** pop up a dialog to show an existing appointment. */ 332 /** pop up a dialog to show an existing appointment. */
329 void appointment_show(); 333 void appointment_show();
330 /** 334 /**
331 * pop up an Appointment Dialog to edit an existing appointment.Get 335 * pop up an Appointment Dialog to edit an existing appointment.Get
332 * information on the appointment from the list of unique IDs that is 336 * information on the appointment from the list of unique IDs that is
333 * currently in the View, called currIds. 337 * currently in the View, called currIds.
334 */ 338 */
335 void appointment_edit(); 339 void appointment_edit();
336 /** 340 /**
337 * pop up dialog confirming deletion of currently selected event in the 341 * pop up dialog confirming deletion of currently selected event in the
338 * View. 342 * View.
339 */ 343 */
340 void appointment_delete(); 344 void appointment_delete();
341 345
342 /** mails the currently selected event to a particular user as a vCalendar 346 /** mails the currently selected event to a particular user as a vCalendar
343 attachment. */ 347 attachment. */
344 void action_mail(); 348 void action_mail();
345 349
346 /* frees a subtodo from it's relation */ 350 /* frees a subtodo from it's relation */
347 void todo_unsub( Todo * ); 351 void todo_unsub( Todo * );
348 352
349 /** Take ownership of selected event. */ 353 /** Take ownership of selected event. */
350 void takeOverEvent(); 354 void takeOverEvent();
351 355
352 /** Take ownership of all events in calendar. */ 356 /** Take ownership of all events in calendar. */
353 void takeOverCalendar(); 357 void takeOverCalendar();
354 358
355 /** query whether or not the calendar is "dirty". */ 359 /** query whether or not the calendar is "dirty". */
356 bool isModified(); 360 bool isModified();
357 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 361 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
358 void setModified(bool modified=true); 362 void setModified(bool modified=true);
359 363
360 /** query if the calendar is read-only. */ 364 /** query if the calendar is read-only. */
361 bool isReadOnly(); 365 bool isReadOnly();
362 /** set state of calendar to read-only */ 366 /** set state of calendar to read-only */
363 void setReadOnly(bool readOnly=true); 367 void setReadOnly(bool readOnly=true);
364 368
365 void eventUpdated(Incidence *); 369 void eventUpdated(Incidence *);
366 370
367 /* iTIP scheduling actions */ 371 /* iTIP scheduling actions */
368 void schedule_publish(Incidence *incidence = 0); 372 void schedule_publish(Incidence *incidence = 0);
369 void schedule_request(Incidence *incidence = 0); 373 void schedule_request(Incidence *incidence = 0);
370 void schedule_refresh(Incidence *incidence = 0); 374 void schedule_refresh(Incidence *incidence = 0);
371 void schedule_cancel(Incidence *incidence = 0); 375 void schedule_cancel(Incidence *incidence = 0);
372 void schedule_add(Incidence *incidence = 0); 376 void schedule_add(Incidence *incidence = 0);
373 void schedule_reply(Incidence *incidence = 0); 377 void schedule_reply(Incidence *incidence = 0);
374 void schedule_counter(Incidence *incidence = 0); 378 void schedule_counter(Incidence *incidence = 0);
375 void schedule_declinecounter(Incidence *incidence = 0); 379 void schedule_declinecounter(Incidence *incidence = 0);
376 void schedule_publish_freebusy(int daysToPublish = 30); 380 void schedule_publish_freebusy(int daysToPublish = 30);
377 381
378 void openAddressbook(); 382 void openAddressbook();
379 383
380 void editFilters(); 384 void editFilters();
381 void toggleFilerEnabled(); 385 void toggleFilerEnabled();
382 QPtrList<CalFilter> filters(); 386 QPtrList<CalFilter> filters();
383 void toggleFilter(); 387 void toggleFilter();
384 void showFilter(bool visible); 388 void showFilter(bool visible);
385 void updateFilter(); 389 void updateFilter();
386 void filterEdited(); 390 void filterEdited();
387 void selectFilter( int ); 391 void selectFilter( int );
388 KOFilterView *filterView(); 392 KOFilterView *filterView();
389 393
390 void showIntro(); 394 void showIntro();
391 395
392 /** Move the curdatepient view date to today */ 396 /** Move the curdatepient view date to today */
393 void goToday(); 397 void goToday();
394 398
395 /** Move to the next date(s) in the current view */ 399 /** Move to the next date(s) in the current view */
396 void goNext(); 400 void goNext();
397 401
398 /** Move to the previous date(s) in the current view */ 402 /** Move to the previous date(s) in the current view */
399 void goPrevious(); 403 void goPrevious();
400 /** Move to the next date(s) in the current view */ 404 /** Move to the next date(s) in the current view */
401 void goNextMonth(); 405 void goNextMonth();
402 406
403 /** Move to the previous date(s) in the current view */ 407 /** Move to the previous date(s) in the current view */
404 void goPreviousMonth(); 408 void goPreviousMonth();
405 409
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 6a9a2f1..bd14fbf 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -448,384 +448,402 @@ void MainWindow::initActions()
448 QPopupMenu *helpMenu = new QPopupMenu( this ); 448 QPopupMenu *helpMenu = new QPopupMenu( this );
449 if ( KOPrefs::instance()->mShowFullMenu ) { 449 if ( KOPrefs::instance()->mShowFullMenu ) {
450 QMenuBar *menuBar1; 450 QMenuBar *menuBar1;
451 menuBar1 = menuBar(); 451 menuBar1 = menuBar();
452 menuBar1->insertItem( i18n("File"), importMenu ); 452 menuBar1->insertItem( i18n("File"), importMenu );
453 menuBar1->insertItem( i18n("View"), viewMenu ); 453 menuBar1->insertItem( i18n("View"), viewMenu );
454 menuBar1->insertItem( i18n("Actions"), actionMenu ); 454 menuBar1->insertItem( i18n("Actions"), actionMenu );
455 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 455 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
456 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 456 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
457 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 457 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
458 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 458 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
459 menuBar1->insertItem( i18n("Help"), helpMenu ); 459 menuBar1->insertItem( i18n("Help"), helpMenu );
460 } else { 460 } else {
461 QPEMenuBar *menuBar1; 461 QPEMenuBar *menuBar1;
462 menuBar1 = new QPEMenuBar( iconToolBar ); 462 menuBar1 = new QPEMenuBar( iconToolBar );
463 QPopupMenu *menuBar = new QPopupMenu( this ); 463 QPopupMenu *menuBar = new QPopupMenu( this );
464 menuBar1->insertItem( i18n("ME"), menuBar); 464 menuBar1->insertItem( i18n("ME"), menuBar);
465 menuBar->insertItem( i18n("File"), importMenu ); 465 menuBar->insertItem( i18n("File"), importMenu );
466 menuBar->insertItem( i18n("View"), viewMenu ); 466 menuBar->insertItem( i18n("View"), viewMenu );
467 menuBar->insertItem( i18n("Actions"), actionMenu ); 467 menuBar->insertItem( i18n("Actions"), actionMenu );
468 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 468 menuBar->insertItem( i18n("Synchronize"), syncMenu );
469 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 469 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
470 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 470 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
471 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 471 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
472 menuBar->insertItem( i18n("Help"), helpMenu ); 472 menuBar->insertItem( i18n("Help"), helpMenu );
473 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 473 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
474 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 474 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
475 } 475 }
476 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 476 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
477 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 477 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
478 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 478 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
479 479
480 // ****************** 480 // ******************
481 QAction *action; 481 QAction *action;
482 QIconSet icon; 482 QIconSet icon;
483 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 483 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
484 configureToolBarMenu->setCheckable( true ); 484 configureToolBarMenu->setCheckable( true );
485 485
486 QString pathString = ""; 486 QString pathString = "";
487 if ( !p->mToolBarMiniIcons ) { 487 if ( !p->mToolBarMiniIcons ) {
488 if ( QApplication::desktop()->width() < 480 ) 488 if ( QApplication::desktop()->width() < 480 )
489 pathString += "icons16/"; 489 pathString += "icons16/";
490 } else 490 } else
491 pathString += "iconsmini/"; 491 pathString += "iconsmini/";
492 configureAgendaMenu->setCheckable( true ); 492 configureAgendaMenu->setCheckable( true );
493 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 493 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
494 configureAgendaMenu->insertSeparator(); 494 configureAgendaMenu->insertSeparator();
495 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 495 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
496 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 496 configureAgendaMenu->insertItem(i18n("Small"), 6 );
497 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 497 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
498 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 498 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
499 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 499 configureAgendaMenu->insertItem(i18n("Large"), 12 );
500 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 500 configureAgendaMenu->insertItem(i18n("Big"), 14 );
501 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 501 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
502 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 502 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
503 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 503 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
504 504
505 icon = loadPixmap( pathString + "configure" ); 505 icon = loadPixmap( pathString + "configure" );
506 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 506 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
507 action->addTo( actionMenu ); 507 action->addTo( actionMenu );
508 connect( action, SIGNAL( activated() ), 508 connect( action, SIGNAL( activated() ),
509 mView, SLOT( edit_options() ) ); 509 mView, SLOT( edit_options() ) );
510 actionMenu->insertSeparator(); 510 actionMenu->insertSeparator();
511 icon = loadPixmap( pathString + "newevent" ); 511 icon = loadPixmap( pathString + "newevent" );
512 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 512 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
513 configureToolBarMenu->insertSeparator(); 513 configureToolBarMenu->insertSeparator();
514 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 514 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
515 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 515 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
516 ne_action->addTo( actionMenu ); 516 ne_action->addTo( actionMenu );
517 connect( ne_action, SIGNAL( activated() ), 517 connect( ne_action, SIGNAL( activated() ),
518 mView, SLOT( newEvent() ) ); 518 mView, SLOT( newEvent() ) );
519 icon = loadPixmap( pathString + "newtodo" ); 519 icon = loadPixmap( pathString + "newtodo" );
520 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 520 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
521 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 521 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
522 nt_action->addTo( actionMenu ); 522 nt_action->addTo( actionMenu );
523 connect( nt_action, SIGNAL( activated() ), 523 connect( nt_action, SIGNAL( activated() ),
524 mView, SLOT( newTodo() ) ); 524 mView, SLOT( newTodo() ) );
525 icon = loadPixmap( pathString + "navi" ); 525 icon = loadPixmap( pathString + "navi" );
526 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 526 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
527 action->addTo( viewMenu ); 527 action->addTo( viewMenu );
528 connect( action, SIGNAL( activated() ), 528 connect( action, SIGNAL( activated() ),
529 mView, SLOT( toggleDateNavigatorWidget() ) ); 529 mView, SLOT( toggleDateNavigatorWidget() ) );
530 icon = loadPixmap( pathString + "filter" ); 530 icon = loadPixmap( pathString + "filter" );
531 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 531 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
532 action->addTo( viewMenu ); 532 action->addTo( viewMenu );
533 connect( action, SIGNAL( activated() ), 533 connect( action, SIGNAL( activated() ),
534 mView, SLOT( toggleFilter() ) ); 534 mView, SLOT( toggleFilter() ) );
535 535
536 536
537 viewMenu->insertSeparator(); 537 viewMenu->insertSeparator();
538 icon = loadPixmap( pathString + "picker" ); 538 icon = loadPixmap( pathString + "picker" );
539 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 539 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
540 action->addTo( viewMenu ); 540 action->addTo( viewMenu );
541 connect( action, SIGNAL( activated() ), 541 connect( action, SIGNAL( activated() ),
542 mView, SLOT( showDatePicker() ) ); 542 mView, SLOT( showDatePicker() ) );
543 action->addTo( iconToolBar ); 543 action->addTo( iconToolBar );
544 viewMenu->insertSeparator(); 544 viewMenu->insertSeparator();
545 icon = loadPixmap( pathString + "list" ); 545 icon = loadPixmap( pathString + "list" );
546 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 546 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
547 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 547 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
548 showlist_action->addTo( viewMenu ); 548 showlist_action->addTo( viewMenu );
549 connect( showlist_action, SIGNAL( activated() ), 549 connect( showlist_action, SIGNAL( activated() ),
550 mView->viewManager(), SLOT( showListView() ) ); 550 mView->viewManager(), SLOT( showListView() ) );
551 551
552 552
553 icon = loadPixmap( pathString + "day" ); 553 icon = loadPixmap( pathString + "day" );
554 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 554 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
555 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 555 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
556 day1_action->addTo( viewMenu ); 556 day1_action->addTo( viewMenu );
557 // action->addTo( toolBar ); 557 // action->addTo( toolBar );
558 connect( day1_action, SIGNAL( activated() ), 558 connect( day1_action, SIGNAL( activated() ),
559 mView->viewManager(), SLOT( showDayView() ) ); 559 mView->viewManager(), SLOT( showDayView() ) );
560 560
561 icon = loadPixmap( pathString + "workweek" ); 561 icon = loadPixmap( pathString + "workweek" );
562 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 562 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
563 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 563 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
564 day5_action->addTo( viewMenu ); 564 day5_action->addTo( viewMenu );
565 connect( day5_action, SIGNAL( activated() ), 565 connect( day5_action, SIGNAL( activated() ),
566 mView->viewManager(), SLOT( showWorkWeekView() ) ); 566 mView->viewManager(), SLOT( showWorkWeekView() ) );
567 567
568 icon = loadPixmap( pathString + "week" ); 568 icon = loadPixmap( pathString + "week" );
569 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 569 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
570 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 570 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
571 day7_action->addTo( viewMenu ); 571 day7_action->addTo( viewMenu );
572 connect( day7_action, SIGNAL( activated() ), 572 connect( day7_action, SIGNAL( activated() ),
573 mView->viewManager(), SLOT( showWeekView() ) ); 573 mView->viewManager(), SLOT( showWeekView() ) );
574 574
575 icon = loadPixmap( pathString + "month" ); 575 icon = loadPixmap( pathString + "month" );
576 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 576 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
577 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 577 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
578 month_action->addTo( viewMenu ); 578 month_action->addTo( viewMenu );
579 connect( month_action, SIGNAL( activated() ), 579 connect( month_action, SIGNAL( activated() ),
580 mView->viewManager(), SLOT( showMonthView() ) ); 580 mView->viewManager(), SLOT( showMonthView() ) );
581 581
582 icon = loadPixmap( pathString + "todo" ); 582 icon = loadPixmap( pathString + "todo" );
583 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 583 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
584 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 584 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
585 todoview_action->addTo( viewMenu ); 585 todoview_action->addTo( viewMenu );
586 connect( todoview_action, SIGNAL( activated() ), 586 connect( todoview_action, SIGNAL( activated() ),
587 mView->viewManager(), SLOT( showTodoView() ) ); 587 mView->viewManager(), SLOT( showTodoView() ) );
588 588
589 icon = loadPixmap( pathString + "journal" ); 589 icon = loadPixmap( pathString + "journal" );
590 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 590 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
591 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 591 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
592 viewjournal_action->addTo( viewMenu ); 592 viewjournal_action->addTo( viewMenu );
593 connect( viewjournal_action, SIGNAL( activated() ), 593 connect( viewjournal_action, SIGNAL( activated() ),
594 mView->viewManager(), SLOT( showJournalView() ) ); 594 mView->viewManager(), SLOT( showJournalView() ) );
595 595
596 icon = loadPixmap( pathString + "xdays" ); 596 icon = loadPixmap( pathString + "xdays" );
597 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 597 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
598 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 598 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
599 xdays_action->addTo( viewMenu ); 599 xdays_action->addTo( viewMenu );
600 connect( xdays_action, SIGNAL( activated() ), 600 connect( xdays_action, SIGNAL( activated() ),
601 mView->viewManager(), SLOT( showNextXView() ) ); 601 mView->viewManager(), SLOT( showNextXView() ) );
602 602
603 icon = loadPixmap( pathString + "whatsnext" ); 603 icon = loadPixmap( pathString + "whatsnext" );
604 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 604 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
605 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 605 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
606 whatsnext_action->addTo( viewMenu ); 606 whatsnext_action->addTo( viewMenu );
607 connect( whatsnext_action, SIGNAL( activated() ), 607 connect( whatsnext_action, SIGNAL( activated() ),
608 mView->viewManager(), SLOT( showWhatsNextView() ) ); 608 mView->viewManager(), SLOT( showWhatsNextView() ) );
609 609
610#if 0 610#if 0
611 action = new QAction( "view_timespan", "Time Span", 0, this ); 611 action = new QAction( "view_timespan", "Time Span", 0, this );
612 action->addTo( viewMenu ); 612 action->addTo( viewMenu );
613 connect( action, SIGNAL( activated() ), 613 connect( action, SIGNAL( activated() ),
614 mView->viewManager(), SLOT( showTimeSpanView() ) ); 614 mView->viewManager(), SLOT( showTimeSpanView() ) );
615#endif 615#endif
616 616
617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
618 this ); 618 this );
619 mNewSubTodoAction->addTo( actionMenu ); 619 mNewSubTodoAction->addTo( actionMenu );
620 connect( mNewSubTodoAction, SIGNAL( activated() ), 620 connect( mNewSubTodoAction, SIGNAL( activated() ),
621 mView, SLOT( newSubTodo() ) ); 621 mView, SLOT( newSubTodo() ) );
622 622
623 actionMenu->insertSeparator(); 623 actionMenu->insertSeparator();
624 624
625 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 625 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
626 mShowAction->addTo( actionMenu ); 626 mShowAction->addTo( actionMenu );
627 connect( mShowAction, SIGNAL( activated() ), 627 connect( mShowAction, SIGNAL( activated() ),
628 mView, SLOT( showIncidence() ) ); 628 mView, SLOT( showIncidence() ) );
629 629
630 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 630 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
631 mEditAction->addTo( actionMenu ); 631 mEditAction->addTo( actionMenu );
632 connect( mEditAction, SIGNAL( activated() ), 632 connect( mEditAction, SIGNAL( activated() ),
633 mView, SLOT( editIncidence() ) ); 633 mView, SLOT( editIncidence() ) );
634 634
635 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 635 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
636 mDeleteAction->addTo( actionMenu ); 636 mDeleteAction->addTo( actionMenu );
637 connect( mDeleteAction, SIGNAL( activated() ), 637 connect( mDeleteAction, SIGNAL( activated() ),
638 mView, SLOT( deleteIncidence() ) ); 638 mView, SLOT( deleteIncidence() ) );
639 639
640
641 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
642 mCloneAction->addTo( actionMenu );
643 connect( mCloneAction, SIGNAL( activated() ),
644 mView, SLOT( cloneIncidence() ) );
645 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
646 mMoveAction->addTo( actionMenu );
647 connect( mMoveAction, SIGNAL( activated() ),
648 mView, SLOT( moveIncidence() ) );
649 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
650 mBeamAction->addTo( actionMenu );
651 connect( mBeamAction, SIGNAL( activated() ),
652 mView, SLOT( beamIncidence() ) );
653 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
654 mCancelAction->addTo( actionMenu );
655 connect( mCancelAction, SIGNAL( activated() ),
656 mView, SLOT( toggleCancelIncidence() ) );
657
640 actionMenu->insertSeparator(); 658 actionMenu->insertSeparator();
641 659
642 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 660 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
643 this ); 661 this );
644 action->addTo( actionMenu ); 662 action->addTo( actionMenu );
645 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 663 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
646 664
647 icon = loadPixmap( pathString + "search" ); 665 icon = loadPixmap( pathString + "search" );
648 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 666 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
649 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 667 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
650 search_action->addTo( actionMenu ); 668 search_action->addTo( actionMenu );
651 connect( search_action, SIGNAL( activated() ), 669 connect( search_action, SIGNAL( activated() ),
652 mView->dialogManager(), SLOT( showSearchDialog() ) ); 670 mView->dialogManager(), SLOT( showSearchDialog() ) );
653 671
654 icon = loadPixmap( pathString + "today" ); 672 icon = loadPixmap( pathString + "today" );
655 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 673 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
656 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 674 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
657 today_action->addTo( actionMenu ); 675 today_action->addTo( actionMenu );
658 connect( today_action, SIGNAL( activated() ), 676 connect( today_action, SIGNAL( activated() ),
659 mView, SLOT( goToday() ) ); 677 mView, SLOT( goToday() ) );
660 678
661 if ( KOPrefs::instance()->mShowFullMenu ) { 679 if ( KOPrefs::instance()->mShowFullMenu ) {
662 actionMenu->insertSeparator(); 680 actionMenu->insertSeparator();
663 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 681 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
664 682
665 } 683 }
666 // actionMenu->insertSeparator(); 684 // actionMenu->insertSeparator();
667 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 685 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
668 this ); 686 this );
669 action->addTo( importMenu ); 687 action->addTo( importMenu );
670 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 688 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
671 action = new QAction( "import_quick", i18n("Import last file"), 0, 689 action = new QAction( "import_quick", i18n("Import last file"), 0,
672 this ); 690 this );
673 action->addTo( importMenu ); 691 action->addTo( importMenu );
674 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 692 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
675 importMenu->insertSeparator(); 693 importMenu->insertSeparator();
676 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 694 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
677 this ); 695 this );
678 action->addTo( importMenu ); 696 action->addTo( importMenu );
679 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 697 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
680#ifndef DESKTOP_VERSION 698#ifndef DESKTOP_VERSION
681 importMenu->insertSeparator(); 699 importMenu->insertSeparator();
682 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 700 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
683 this ); 701 this );
684 action->addTo( importMenu ); 702 action->addTo( importMenu );
685 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 703 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
686#else 704#else
687#ifdef _WIN32_ 705#ifdef _WIN32_
688 importMenu->insertSeparator(); 706 importMenu->insertSeparator();
689 action = new QAction( "import_ol", i18n("Import from OL"), 0, 707 action = new QAction( "import_ol", i18n("Import from OL"), 0,
690 this ); 708 this );
691 action->addTo( importMenu ); 709 action->addTo( importMenu );
692 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 710 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
693#endif 711#endif
694#endif 712#endif
695 713
696 importMenu->insertSeparator(); 714 importMenu->insertSeparator();
697 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 715 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
698 this ); 716 this );
699 action->addTo( importMenu ); 717 action->addTo( importMenu );
700 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 718 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
701 719
702 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 720 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
703 this ); 721 this );
704 action->addTo( importMenu ); 722 action->addTo( importMenu );
705 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 723 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
706 724
707 importMenu->insertSeparator(); 725 importMenu->insertSeparator();
708 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 726 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
709 this ); 727 this );
710 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 728 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
711 729
712 730
713 //LR 731 //LR
714 QPopupMenu *ex2phone = new QPopupMenu( this ); 732 QPopupMenu *ex2phone = new QPopupMenu( this );
715 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 733 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
716 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 734 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
717 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 735 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
718 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 736 importMenu->insertItem( i18n("Export to phone"), ex2phone );
719 737
720 importMenu->insertSeparator(); 738 importMenu->insertSeparator();
721 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 739 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
722 this ); 740 this );
723 action->addTo( importMenu ); 741 action->addTo( importMenu );
724 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 742 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
725#ifndef DESKTOP_VERSION 743#ifndef DESKTOP_VERSION
726 importMenu->insertSeparator(); 744 importMenu->insertSeparator();
727 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 745 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
728 this ); 746 this );
729 action->addTo( importMenu ); 747 action->addTo( importMenu );
730 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 748 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
731 749
732 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 750 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
733 this ); 751 this );
734 action->addTo( importMenu ); 752 action->addTo( importMenu );
735 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 753 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
736#else 754#else
737 importMenu->insertSeparator(); 755 importMenu->insertSeparator();
738 icon = loadPixmap( pathString + "print" ); 756 icon = loadPixmap( pathString + "print" );
739 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 757 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
740 action->addTo( importMenu ); 758 action->addTo( importMenu );
741 connect( action, SIGNAL( activated() ), 759 connect( action, SIGNAL( activated() ),
742 this, SLOT( printCal() ) ); 760 this, SLOT( printCal() ) );
743 761
744 icon = loadPixmap( pathString + "print" ); 762 icon = loadPixmap( pathString + "print" );
745 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 763 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
746 action->addTo( importMenu ); 764 action->addTo( importMenu );
747 connect( action, SIGNAL( activated() ), 765 connect( action, SIGNAL( activated() ),
748 this, SLOT( printSel() ) ); 766 this, SLOT( printSel() ) );
749#endif 767#endif
750 importMenu->insertSeparator(); 768 importMenu->insertSeparator();
751 action = new QAction( "beam all", i18n("Save"), 0, 769 action = new QAction( "beam all", i18n("Save"), 0,
752 this ); 770 this );
753 action->addTo( importMenu ); 771 action->addTo( importMenu );
754 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 772 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
755 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 773 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
756 this ); 774 this );
757 action->addTo( importMenu ); 775 action->addTo( importMenu );
758 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 776 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
759 777
760 //menuBar->insertItem( "Configure",configureMenu ); 778 //menuBar->insertItem( "Configure",configureMenu );
761 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 779 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
762 icon = loadPixmap( "korganizer/korganizer" ); 780 icon = loadPixmap( "korganizer/korganizer" );
763 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 781 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
764 action->addTo( helpMenu ); 782 action->addTo( helpMenu );
765 connect( action, SIGNAL( activated() ), 783 connect( action, SIGNAL( activated() ),
766 SLOT( keyBindings() ) ); 784 SLOT( keyBindings() ) );
767 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 785 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
768 action->addTo( helpMenu ); 786 action->addTo( helpMenu );
769 connect( action, SIGNAL( activated() ), 787 connect( action, SIGNAL( activated() ),
770 SLOT( features() ) ); 788 SLOT( features() ) );
771 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 789 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
772 action->addTo( helpMenu ); 790 action->addTo( helpMenu );
773 connect( action, SIGNAL( activated() ), 791 connect( action, SIGNAL( activated() ),
774 SLOT( aboutAutoSaving() ) ); 792 SLOT( aboutAutoSaving() ) );
775 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 793 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
776 action->addTo( helpMenu ); 794 action->addTo( helpMenu );
777 connect( action, SIGNAL( activated() ), 795 connect( action, SIGNAL( activated() ),
778 SLOT( aboutKnownBugs() ) ); 796 SLOT( aboutKnownBugs() ) );
779 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 797 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
780 action->addTo( helpMenu ); 798 action->addTo( helpMenu );
781 connect( action, SIGNAL( activated() ), 799 connect( action, SIGNAL( activated() ),
782 SLOT( usertrans() ) ); 800 SLOT( usertrans() ) );
783 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 801 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
784 action->addTo( helpMenu ); 802 action->addTo( helpMenu );
785 connect( action, SIGNAL( activated() ), 803 connect( action, SIGNAL( activated() ),
786 SLOT( synchowto() ) ); 804 SLOT( synchowto() ) );
787 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 805 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
788 action->addTo( helpMenu ); 806 action->addTo( helpMenu );
789 connect( action, SIGNAL( activated() ), 807 connect( action, SIGNAL( activated() ),
790 SLOT( whatsNew() ) ); 808 SLOT( whatsNew() ) );
791 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 809 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
792 action->addTo( helpMenu ); 810 action->addTo( helpMenu );
793 connect( action, SIGNAL( activated() ), 811 connect( action, SIGNAL( activated() ),
794 SLOT( faq() ) ); 812 SLOT( faq() ) );
795 813
796 814
797 action = new QAction( "about", i18n("About..."), 0, this ); 815 action = new QAction( "about", i18n("About..."), 0, this );
798 action->addTo( helpMenu ); 816 action->addTo( helpMenu );
799 connect( action, SIGNAL( activated() ), 817 connect( action, SIGNAL( activated() ),
800 SLOT( about() ) ); 818 SLOT( about() ) );
801 action = new QAction( "licence", i18n("Licence..."), 0, this ); 819 action = new QAction( "licence", i18n("Licence..."), 0, this );
802 action->addTo( helpMenu ); 820 action->addTo( helpMenu );
803 connect( action, SIGNAL( activated() ), 821 connect( action, SIGNAL( activated() ),
804 SLOT( licence() ) ); 822 SLOT( licence() ) );
805 //menuBar->insertSeparator(); 823 //menuBar->insertSeparator();
806 824
807 // ****************************************************** 825 // ******************************************************
808 // menubar icons 826 // menubar icons
809 827
810 828
811 iconToolBar->setHorizontalStretchable (true ); 829 iconToolBar->setHorizontalStretchable (true );
812 //menuBar->insertItem( iconToolBar ); 830 //menuBar->insertItem( iconToolBar );
813 //xdays_action 831 //xdays_action
814 if (p-> mShowIconNewEvent) 832 if (p-> mShowIconNewEvent)
815 ne_action->addTo( iconToolBar ); 833 ne_action->addTo( iconToolBar );
816 if (p->mShowIconNewTodo ) 834 if (p->mShowIconNewTodo )
817 nt_action->addTo( iconToolBar ); 835 nt_action->addTo( iconToolBar );
818 if (p-> mShowIconSearch) 836 if (p-> mShowIconSearch)
819 search_action->addTo( iconToolBar ); 837 search_action->addTo( iconToolBar );
820 if (p-> mShowIconNext) 838 if (p-> mShowIconNext)
821 whatsnext_action->addTo( iconToolBar ); 839 whatsnext_action->addTo( iconToolBar );
822 if (p-> mShowIconNextDays) 840 if (p-> mShowIconNextDays)
823 xdays_action->addTo( iconToolBar ); 841 xdays_action->addTo( iconToolBar );
824 if (p-> mShowIconList) 842 if (p-> mShowIconList)
825 showlist_action->addTo( iconToolBar ); 843 showlist_action->addTo( iconToolBar );
826 if (p-> mShowIconDay1) 844 if (p-> mShowIconDay1)
827 day1_action->addTo( iconToolBar ); 845 day1_action->addTo( iconToolBar );
828 if (p-> mShowIconDay5) 846 if (p-> mShowIconDay5)
829 day5_action->addTo( iconToolBar ); 847 day5_action->addTo( iconToolBar );
830 if (p-> mShowIconDay7) 848 if (p-> mShowIconDay7)
831 day7_action->addTo( iconToolBar ); 849 day7_action->addTo( iconToolBar );
@@ -997,696 +1015,701 @@ int MainWindow::ringSync()
997 if ( temp->getWriteBackFuture() ) 1015 if ( temp->getWriteBackFuture() )
998 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 1016 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
999 KOPrefs::instance()->mShowSyncSummary = false; 1017 KOPrefs::instance()->mShowSyncSummary = false;
1000 mView->setSyncDevice(syncProfileNames[i] ); 1018 mView->setSyncDevice(syncProfileNames[i] );
1001 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1019 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1002 if ( i == 0 ) { 1020 if ( i == 0 ) {
1003 syncSharp(); 1021 syncSharp();
1004 } else { 1022 } else {
1005 if ( temp->getIsLocalFileSync() ) { 1023 if ( temp->getIsLocalFileSync() ) {
1006 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 1024 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
1007 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1025 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1008 } else { 1026 } else {
1009 if ( temp->getIsPhoneSync() ) { 1027 if ( temp->getIsPhoneSync() ) {
1010 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 1028 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1011 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 1029 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1012 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 1030 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1013 syncPhone(); 1031 syncPhone();
1014 } else if ( temp->getIsPiSync() ) { 1032 } else if ( temp->getIsPiSync() ) {
1015 mPassWordPiSync = temp->getRemotePw(); 1033 mPassWordPiSync = temp->getRemotePw();
1016 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); 1034 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
1017 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); 1035 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
1018 syncPi(); 1036 syncPi();
1019 } else 1037 } else
1020 syncRemote( temp, false ); 1038 syncRemote( temp, false );
1021 1039
1022 } 1040 }
1023 } 1041 }
1024 timer.start(); 1042 timer.start();
1025 setCaption(i18n("Multiple sync in progress ... please wait!") ); 1043 setCaption(i18n("Multiple sync in progress ... please wait!") );
1026 while ( timer.elapsed () < 2000 ) { 1044 while ( timer.elapsed () < 2000 ) {
1027 qApp->processEvents(); 1045 qApp->processEvents();
1028#ifndef _WIN32_ 1046#ifndef _WIN32_
1029 sleep (1); 1047 sleep (1);
1030#endif 1048#endif
1031 } 1049 }
1032 1050
1033 } 1051 }
1034 1052
1035 } 1053 }
1036 delete temp; 1054 delete temp;
1037 return syncedProfiles; 1055 return syncedProfiles;
1038} 1056}
1039 1057
1040void MainWindow::multiSync( bool askforPrefs ) 1058void MainWindow::multiSync( bool askforPrefs )
1041{ 1059{
1042 if (mBlockSaveFlag) 1060 if (mBlockSaveFlag)
1043 return; 1061 return;
1044 mBlockSaveFlag = true; 1062 mBlockSaveFlag = true;
1045 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 1063 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
1046 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1064 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1047 question, 1065 question,
1048 i18n("Yes"), i18n("No"), 1066 i18n("Yes"), i18n("No"),
1049 0, 0 ) != 0 ) { 1067 0, 0 ) != 0 ) {
1050 mBlockSaveFlag = false; 1068 mBlockSaveFlag = false;
1051 setCaption(i18n("Aborted! Nothing synced!")); 1069 setCaption(i18n("Aborted! Nothing synced!"));
1052 return; 1070 return;
1053 } 1071 }
1054 mView->setSyncDevice(i18n("Multiple profiles") ); 1072 mView->setSyncDevice(i18n("Multiple profiles") );
1055 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 1073 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
1056 if ( askforPrefs ) { 1074 if ( askforPrefs ) {
1057 mView->edit_sync_options(); 1075 mView->edit_sync_options();
1058 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 1076 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
1059 } 1077 }
1060 setCaption(i18n("Multiple sync started.") ); 1078 setCaption(i18n("Multiple sync started.") );
1061 qApp->processEvents(); 1079 qApp->processEvents();
1062 int num = ringSync() ; 1080 int num = ringSync() ;
1063 if ( num > 1 ) 1081 if ( num > 1 )
1064 ringSync(); 1082 ringSync();
1065 mBlockSaveFlag = false; 1083 mBlockSaveFlag = false;
1066 if ( num ) 1084 if ( num )
1067 save(); 1085 save();
1068 if ( num ) 1086 if ( num )
1069 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 1087 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
1070 else 1088 else
1071 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 1089 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
1072 return; 1090 return;
1073} 1091}
1074void MainWindow::slotSyncMenu( int action ) 1092void MainWindow::slotSyncMenu( int action )
1075{ 1093{
1076 qDebug("syncaction %d ", action); 1094 qDebug("syncaction %d ", action);
1077 if ( action == 0 ) { 1095 if ( action == 0 ) {
1078 1096
1079 // seems to be a Qt2 event handling bug 1097 // seems to be a Qt2 event handling bug
1080 // syncmenu.clear causes a segfault at first time 1098 // syncmenu.clear causes a segfault at first time
1081 // when we call it after the main event loop, it is ok 1099 // when we call it after the main event loop, it is ok
1082 // same behaviour when calling OM/Pi via QCOP for the first time 1100 // same behaviour when calling OM/Pi via QCOP for the first time
1083 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 1101 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
1084 //confSync(); 1102 //confSync();
1085 1103
1086 return; 1104 return;
1087 } 1105 }
1088 if ( action == 1 ) { 1106 if ( action == 1 ) {
1089 multiSync( true ); 1107 multiSync( true );
1090 return; 1108 return;
1091 } 1109 }
1092 if ( action == 2 ) { 1110 if ( action == 2 ) {
1093 enableQuick(); 1111 enableQuick();
1094 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 1112 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
1095 return; 1113 return;
1096 } 1114 }
1097 if ( action == 3 ) { 1115 if ( action == 3 ) {
1098 delete mServerSocket; 1116 delete mServerSocket;
1099 mServerSocket = 0; 1117 mServerSocket = 0;
1100 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 1118 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
1101 return; 1119 return;
1102 } 1120 }
1103 1121
1104 if (mBlockSaveFlag) 1122 if (mBlockSaveFlag)
1105 return; 1123 return;
1106 mBlockSaveFlag = true; 1124 mBlockSaveFlag = true;
1107 mCurrentSyncProfile = action - 1000 ; 1125 mCurrentSyncProfile = action - 1000 ;
1108 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 1126 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
1109 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1127 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1110 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 1128 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
1111 KSyncProfile* temp = new KSyncProfile (); 1129 KSyncProfile* temp = new KSyncProfile ();
1112 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1130 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1113 temp->readConfig(&config); 1131 temp->readConfig(&config);
1114 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 1132 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
1115 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 1133 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
1116 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 1134 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
1117 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 1135 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
1118 KOPrefs::instance()->mWriteBackInFuture = 0; 1136 KOPrefs::instance()->mWriteBackInFuture = 0;
1119 if ( temp->getWriteBackFuture() ) 1137 if ( temp->getWriteBackFuture() )
1120 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 1138 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
1121 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 1139 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
1122 if ( action == 1000 ) { 1140 if ( action == 1000 ) {
1123 syncSharp(); 1141 syncSharp();
1124 1142
1125 } else if ( action == 1001 ) { 1143 } else if ( action == 1001 ) {
1126 syncLocalFile(); 1144 syncLocalFile();
1127 1145
1128 } else if ( action == 1002 ) { 1146 } else if ( action == 1002 ) {
1129 quickSyncLocalFile(); 1147 quickSyncLocalFile();
1130 1148
1131 } else if ( action >= 1003 ) { 1149 } else if ( action >= 1003 ) {
1132 if ( temp->getIsLocalFileSync() ) { 1150 if ( temp->getIsLocalFileSync() ) {
1133 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 1151 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
1134 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1152 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1135 } else { 1153 } else {
1136 if ( temp->getIsPhoneSync() ) { 1154 if ( temp->getIsPhoneSync() ) {
1137 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 1155 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1138 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 1156 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1139 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 1157 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1140 syncPhone(); 1158 syncPhone();
1141 } else if ( temp->getIsPiSync() ) { 1159 } else if ( temp->getIsPiSync() ) {
1142 mPassWordPiSync = temp->getRemotePw(); 1160 mPassWordPiSync = temp->getRemotePw();
1143 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); 1161 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
1144 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); 1162 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
1145 syncPi(); 1163 syncPi();
1146 } else 1164 } else
1147 syncRemote( temp ); 1165 syncRemote( temp );
1148 1166
1149 } 1167 }
1150 } 1168 }
1151 delete temp; 1169 delete temp;
1152 mBlockSaveFlag = false; 1170 mBlockSaveFlag = false;
1153} 1171}
1154void MainWindow::exportToPhone( int mode ) 1172void MainWindow::exportToPhone( int mode )
1155{ 1173{
1156 1174
1157 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1175 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1158 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1176 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1159 KOex2phonePrefs ex2phone; 1177 KOex2phonePrefs ex2phone;
1160 ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); 1178 ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection );
1161 ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); 1179 ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice );
1162 ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); 1180 ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel );
1163 if ( mode == 1 ) 1181 if ( mode == 1 )
1164 ex2phone.setCaption(i18n("Export complete calendar")); 1182 ex2phone.setCaption(i18n("Export complete calendar"));
1165 if ( mode == 2 ) 1183 if ( mode == 2 )
1166 ex2phone.setCaption(i18n("Export filtered calendar")); 1184 ex2phone.setCaption(i18n("Export filtered calendar"));
1167 1185
1168 if ( !ex2phone.exec() ) { 1186 if ( !ex2phone.exec() ) {
1169 return; 1187 return;
1170 } 1188 }
1171 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1189 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1172 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1190 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1173 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1191 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1174 1192
1175 int inFuture = 0; 1193 int inFuture = 0;
1176 if ( ex2phone.mWriteBackFuture->isChecked() ) 1194 if ( ex2phone.mWriteBackFuture->isChecked() )
1177 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1195 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1178 QPtrList<Incidence> delSel; 1196 QPtrList<Incidence> delSel;
1179 if ( mode == 1 ) 1197 if ( mode == 1 )
1180 delSel = mCalendar->rawIncidences(); 1198 delSel = mCalendar->rawIncidences();
1181 if ( mode == 2 ) 1199 if ( mode == 2 )
1182 delSel = mCalendar->incidences(); 1200 delSel = mCalendar->incidences();
1183 CalendarLocal* cal = new CalendarLocal(); 1201 CalendarLocal* cal = new CalendarLocal();
1184 cal->setLocalTime(); 1202 cal->setLocalTime();
1185 Incidence *incidence = delSel.first(); 1203 Incidence *incidence = delSel.first();
1186 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1204 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1187 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1205 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1188 while ( incidence ) { 1206 while ( incidence ) {
1189 if ( incidence->type() != "journal" ) { 1207 if ( incidence->type() != "Journal" ) {
1190 bool add = true; 1208 bool add = true;
1191 if ( inFuture ) { 1209 if ( inFuture ) {
1192 QDateTime dt; 1210 QDateTime dt;
1193 if ( incidence->type() == "Todo" ) { 1211 if ( incidence->type() == "Todo" ) {
1194 Todo * t = (Todo*)incidence; 1212 Todo * t = (Todo*)incidence;
1195 if ( t->hasDueDate() ) 1213 if ( t->hasDueDate() )
1196 dt = t->dtDue(); 1214 dt = t->dtDue();
1197 else 1215 else
1198 dt = cur.addSecs( 62 ); 1216 dt = cur.addSecs( 62 );
1199 } 1217 }
1200 else { 1218 else {
1201 bool ok; 1219 bool ok;
1202 dt = incidence->getNextOccurence( cur, &ok ); 1220 dt = incidence->getNextOccurence( cur, &ok );
1203 if ( !ok ) 1221 if ( !ok )
1204 dt = cur.addSecs( -62 ); 1222 dt = cur.addSecs( -62 );
1205 } 1223 }
1206 if ( dt < cur || dt > end ) { 1224 if ( dt < cur || dt > end ) {
1207 add = false; 1225 add = false;
1208 } 1226 }
1209 } 1227 }
1210 if ( add ) { 1228 if ( add ) {
1211 Incidence *in = incidence->clone(); 1229 Incidence *in = incidence->clone();
1212 cal->addIncidence( in ); 1230 cal->addIncidence( in );
1213 } 1231 }
1214 } 1232 }
1215 incidence = delSel.next(); 1233 incidence = delSel.next();
1216 } 1234 }
1217 PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice, 1235 PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice,
1218 KOPrefs::instance()->mEx2PhoneConnection, 1236 KOPrefs::instance()->mEx2PhoneConnection,
1219 KOPrefs::instance()->mEx2PhoneModel ); 1237 KOPrefs::instance()->mEx2PhoneModel );
1220 1238
1221 setCaption( i18n("Writing to phone...")); 1239 setCaption( i18n("Writing to phone..."));
1222 if ( PhoneFormat::writeToPhone( cal ) ) 1240 if ( PhoneFormat::writeToPhone( cal ) )
1223 setCaption( i18n("Export to phone successful!")); 1241 setCaption( i18n("Export to phone successful!"));
1224 else 1242 else
1225 setCaption( i18n("Error exporting to phone!")); 1243 setCaption( i18n("Error exporting to phone!"));
1226 delete cal; 1244 delete cal;
1227} 1245}
1228 1246
1229 1247
1230void MainWindow::setDefaultPreferences() 1248void MainWindow::setDefaultPreferences()
1231{ 1249{
1232 KOPrefs *p = KOPrefs::instance(); 1250 KOPrefs *p = KOPrefs::instance();
1233 1251
1234 p->mCompactDialogs = true; 1252 p->mCompactDialogs = true;
1235 p->mConfirm = true; 1253 p->mConfirm = true;
1236 // p->mEnableQuickTodo = false; 1254 // p->mEnableQuickTodo = false;
1237 1255
1238} 1256}
1239 1257
1240QString MainWindow::resourcePath() 1258QString MainWindow::resourcePath()
1241{ 1259{
1242 return KGlobal::iconLoader()->iconPath(); 1260 return KGlobal::iconLoader()->iconPath();
1243} 1261}
1244 1262
1245void MainWindow::displayText( QString text ,QString cap ) 1263void MainWindow::displayText( QString text ,QString cap )
1246{ 1264{
1247 QDialog dia( this, "name", true ); ; 1265 QDialog dia( this, "name", true ); ;
1248 dia.setCaption( cap ); 1266 dia.setCaption( cap );
1249 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1267 QVBoxLayout* lay = new QVBoxLayout( &dia );
1250 lay->setSpacing( 3 ); 1268 lay->setSpacing( 3 );
1251 lay->setMargin( 3 ); 1269 lay->setMargin( 3 );
1252 QTextBrowser tb ( &dia ); 1270 QTextBrowser tb ( &dia );
1253 lay->addWidget( &tb ); 1271 lay->addWidget( &tb );
1254 tb.setText( text ); 1272 tb.setText( text );
1255#ifdef DESKTOP_VERSION 1273#ifdef DESKTOP_VERSION
1256 dia.resize( 640, 480); 1274 dia.resize( 640, 480);
1257#else 1275#else
1258 dia.showMaximized(); 1276 dia.showMaximized();
1259#endif 1277#endif
1260 dia.exec(); 1278 dia.exec();
1261} 1279}
1262void MainWindow::displayFile( QString fn, QString cap ) 1280void MainWindow::displayFile( QString fn, QString cap )
1263{ 1281{
1264 QString fileName = resourcePath() + fn; 1282 QString fileName = resourcePath() + fn;
1265 QString text; 1283 QString text;
1266 QFile file( fileName ); 1284 QFile file( fileName );
1267 if (!file.open( IO_ReadOnly ) ) { 1285 if (!file.open( IO_ReadOnly ) ) {
1268 return ; 1286 return ;
1269 1287
1270 } 1288 }
1271 QTextStream ts( &file ); 1289 QTextStream ts( &file );
1272 text = ts.read(); 1290 text = ts.read();
1273 file.close(); 1291 file.close();
1274 displayText( text, cap); 1292 displayText( text, cap);
1275} 1293}
1276void MainWindow::features() 1294void MainWindow::features()
1277{ 1295{
1278 1296
1279 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1297 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1280} 1298}
1281 1299
1282void MainWindow::usertrans() 1300void MainWindow::usertrans()
1283{ 1301{
1284 1302
1285 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1303 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1286} 1304}
1287 1305
1288void MainWindow::synchowto() 1306void MainWindow::synchowto()
1289{ 1307{
1290#if 0 1308#if 0
1291 QPtrList<Incidence> er = mCalendar->rawIncidences(); 1309 QPtrList<Incidence> er = mCalendar->rawIncidences();
1292 Incidence* inR = er.first(); 1310 Incidence* inR = er.first();
1293 VCalFormat vf; 1311 VCalFormat vf;
1294 QString strout; 1312 QString strout;
1295 while ( inR ) { 1313 while ( inR ) {
1296 if ( inR->type() == "Todo" ) 1314 if ( inR->type() == "Todo" )
1297 strout = vf.todoToString( (Todo *) inR ); 1315 strout = vf.todoToString( (Todo *) inR );
1298 if ( inR->type() == "Event" ) 1316 if ( inR->type() == "Event" )
1299 strout = vf.eventToString( (Event *) inR ); 1317 strout = vf.eventToString( (Event *) inR );
1300 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); 1318 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() );
1301 inR = er.next(); 1319 inR = er.next();
1302 } 1320 }
1303#endif 1321#endif
1304 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1322 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1305} 1323}
1306void MainWindow::faq() 1324void MainWindow::faq()
1307{ 1325{
1308 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1326 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1309 1327
1310} 1328}
1311void MainWindow::whatsNew() 1329void MainWindow::whatsNew()
1312{ 1330{
1313 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1331 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1314 1332
1315} 1333}
1316void MainWindow::licence() 1334void MainWindow::licence()
1317{ 1335{
1318 KApplication::showLicence(); 1336 KApplication::showLicence();
1319 1337
1320} 1338}
1321void MainWindow::about() 1339void MainWindow::about()
1322{ 1340{
1323 QString version; 1341 QString version;
1324#include <../version> 1342#include <../version>
1325 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1343 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1326 i18n("KOrganizer/Platform-independent\n") + 1344 i18n("KOrganizer/Platform-independent\n") +
1327 "(KO/Pi) " + version + " - " + 1345 "(KO/Pi) " + version + " - " +
1328 1346
1329#ifdef DESKTOP_VERSION 1347#ifdef DESKTOP_VERSION
1330 i18n("Desktop Edition\n") + 1348 i18n("Desktop Edition\n") +
1331#else 1349#else
1332 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1350 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1333#endif 1351#endif
1334 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1352 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1335} 1353}
1336void MainWindow::keyBindings() 1354void MainWindow::keyBindings()
1337{ 1355{
1338 QString cap = i18n("Key bindings KOrganizer/Pi"); 1356 QString cap = i18n("Key bindings KOrganizer/Pi");
1339 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1357 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1340 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1358 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1341 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1359 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1342 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1360 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1343 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1361 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1344 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1362 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1345 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1363 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1346 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1364 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1347 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1365 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1348 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1366 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1349 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1367 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1350 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1368 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1351 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1369 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1352 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1370 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1353 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1371 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1354 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1372 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1355 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1373 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1356 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1374 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1357 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1375 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1358 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1376 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1359 i18n("<p><h3>In agenda view:</h3></p>\n") + 1377 i18n("<p><h3>In agenda view:</h3></p>\n") +
1360 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1378 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1361 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1379 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1362 i18n("<p><h3>In todo view:</h3></p>\n") + 1380 i18n("<p><h3>In todo view:</h3></p>\n") +
1363 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1381 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1364 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1382 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1365 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1383 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1366 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1384 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1367 i18n("<p><h3>In list view:</h3></p>\n") + 1385 i18n("<p><h3>In list view:</h3></p>\n") +
1368 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1386 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1369 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1387 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1370 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1388 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1371 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1389 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1372 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1390 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1373 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1391 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1374 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1392 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1375 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1393 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1376 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1394 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1377 i18n("<p><b>E</b>: Edit item</p>\n") + 1395 i18n("<p><b>E</b>: Edit item</p>\n") +
1378 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1396 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1379 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1397 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1380 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1398 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1381 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1399 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1382 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1400 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1383 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1401 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1384 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1402 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1385 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1403 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1386 i18n("<p><b>White</b>: Item readonly</p>\n"); 1404 i18n("<p><b>White</b>: Item readonly</p>\n");
1387 displayText( text, cap); 1405 displayText( text, cap);
1388 1406
1389} 1407}
1390void MainWindow::aboutAutoSaving() 1408void MainWindow::aboutAutoSaving()
1391{ 1409{
1392 QMessageBox* msg; 1410 QMessageBox* msg;
1393 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1411 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1394 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1412 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1395 QMessageBox::Ok, 1413 QMessageBox::Ok,
1396 QMessageBox::NoButton, 1414 QMessageBox::NoButton,
1397 QMessageBox::NoButton); 1415 QMessageBox::NoButton);
1398 msg->exec(); 1416 msg->exec();
1399 delete msg; 1417 delete msg;
1400 1418
1401 1419
1402} 1420}
1403void MainWindow::aboutKnownBugs() 1421void MainWindow::aboutKnownBugs()
1404{ 1422{
1405 QMessageBox* msg; 1423 QMessageBox* msg;
1406 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1424 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1407 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1425 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1408 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1426 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1409 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1427 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1410 i18n("\nor report them in the bugtracker on\n") + 1428 i18n("\nor report them in the bugtracker on\n") +
1411 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1429 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1412 QMessageBox::NoIcon, 1430 QMessageBox::NoIcon,
1413 QMessageBox::Ok, 1431 QMessageBox::Ok,
1414 QMessageBox::NoButton, 1432 QMessageBox::NoButton,
1415 QMessageBox::NoButton); 1433 QMessageBox::NoButton);
1416 msg->exec(); 1434 msg->exec();
1417 delete msg; 1435 delete msg;
1418 1436
1419} 1437}
1420 1438
1421QString MainWindow::defaultFileName() 1439QString MainWindow::defaultFileName()
1422{ 1440{
1423 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1441 return locateLocal( "data", "korganizer/mycalendar.ics" );
1424} 1442}
1425QString MainWindow::syncFileName() 1443QString MainWindow::syncFileName()
1426{ 1444{
1427#ifdef _WIN32_ 1445#ifdef _WIN32_
1428 return locateLocal( "tmp", "synccalendar.ics" ); 1446 return locateLocal( "tmp", "synccalendar.ics" );
1429#else 1447#else
1430 return QString( "/tmp/kopitempfile.ics" ); 1448 return QString( "/tmp/kopitempfile.ics" );
1431#endif 1449#endif
1432} 1450}
1433 1451
1434void MainWindow::processIncidenceSelection( Incidence *incidence ) 1452void MainWindow::processIncidenceSelection( Incidence *incidence )
1435{ 1453{
1436 if ( !incidence ) { 1454 if ( !incidence ) {
1437 enableIncidenceActions( false ); 1455 enableIncidenceActions( false );
1438 1456
1439 mNewSubTodoAction->setEnabled( false ); 1457 mNewSubTodoAction->setEnabled( false );
1440 setCaptionToDates(); 1458 setCaptionToDates();
1441 return; 1459 return;
1442 1460
1443 } 1461 }
1444 1462
1445 //KGlobal::locale()->formatDateTime(nextA, true); 1463 //KGlobal::locale()->formatDateTime(nextA, true);
1446 QString startString = ""; 1464 QString startString = "";
1447 if ( incidence->type() != "Todo" ) { 1465 if ( incidence->type() != "Todo" ) {
1448 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1466 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1449 if ( incidence->doesFloat() ) { 1467 if ( incidence->doesFloat() ) {
1450 startString += ": "+incidence->dtStartDateStr( true ); 1468 startString += ": "+incidence->dtStartDateStr( true );
1451 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1469 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1452 1470
1453 } else { 1471 } else {
1454 startString = ": "+incidence->dtStartStr(true); 1472 startString = ": "+incidence->dtStartStr(true);
1455 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1473 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1456 1474
1457 } 1475 }
1458 1476
1459 } else { 1477 } else {
1460 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1478 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1461 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1479 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1462 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1480 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1463 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1481 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1464 } 1482 }
1465 1483
1466 } 1484 }
1467 else 1485 else
1468 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1486 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1469 if ( !incidence->location().isEmpty() ) 1487 if ( !incidence->location().isEmpty() )
1470 startString += " (" +incidence->location()+")"; 1488 startString += " (" +incidence->location()+")";
1471 setCaption( incidence->summary()+startString); 1489 setCaption( incidence->summary()+startString);
1472 1490
1473 enableIncidenceActions( true ); 1491 enableIncidenceActions( true );
1474 1492
1475 if ( incidence->type() == "Event" ) { 1493 if ( incidence->type() == "Event" ) {
1476 mShowAction->setText( i18n("Show Event...") ); 1494 mShowAction->setText( i18n("Show Event...") );
1477 mEditAction->setText( i18n("Edit Event...") ); 1495 mEditAction->setText( i18n("Edit Event...") );
1478 mDeleteAction->setText( i18n("Delete Event...") ); 1496 mDeleteAction->setText( i18n("Delete Event...") );
1479 1497
1480 mNewSubTodoAction->setEnabled( false ); 1498 mNewSubTodoAction->setEnabled( false );
1481 } else if ( incidence->type() == "Todo" ) { 1499 } else if ( incidence->type() == "Todo" ) {
1482 mShowAction->setText( i18n("Show Todo...") ); 1500 mShowAction->setText( i18n("Show Todo...") );
1483 mEditAction->setText( i18n("Edit Todo...") ); 1501 mEditAction->setText( i18n("Edit Todo...") );
1484 mDeleteAction->setText( i18n("Delete Todo...") ); 1502 mDeleteAction->setText( i18n("Delete Todo...") );
1485 1503
1486 mNewSubTodoAction->setEnabled( true ); 1504 mNewSubTodoAction->setEnabled( true );
1487 } else { 1505 } else {
1488 mShowAction->setText( i18n("Show...") ); 1506 mShowAction->setText( i18n("Show...") );
1489 mShowAction->setText( i18n("Edit...") ); 1507 mShowAction->setText( i18n("Edit...") );
1490 mShowAction->setText( i18n("Delete...") ); 1508 mShowAction->setText( i18n("Delete...") );
1491 1509
1492 mNewSubTodoAction->setEnabled( false ); 1510 mNewSubTodoAction->setEnabled( false );
1493 } 1511 }
1494} 1512}
1495 1513
1496void MainWindow::enableIncidenceActions( bool enabled ) 1514void MainWindow::enableIncidenceActions( bool enabled )
1497{ 1515{
1498 mShowAction->setEnabled( enabled ); 1516 mShowAction->setEnabled( enabled );
1499 mEditAction->setEnabled( enabled ); 1517 mEditAction->setEnabled( enabled );
1500 mDeleteAction->setEnabled( enabled ); 1518 mDeleteAction->setEnabled( enabled );
1519
1520 mCloneAction->setEnabled( enabled );
1521 mMoveAction->setEnabled( enabled );
1522 mBeamAction->setEnabled( enabled );
1523 mCancelAction->setEnabled( enabled );
1501} 1524}
1502 1525
1503void MainWindow::importOL() 1526void MainWindow::importOL()
1504{ 1527{
1505#ifdef _WIN32_ 1528#ifdef _WIN32_
1506 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1529 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1507 id->exec(); 1530 id->exec();
1508 delete id; 1531 delete id;
1509 mView->updateView(); 1532 mView->updateView();
1510#endif 1533#endif
1511} 1534}
1512void MainWindow::importBday() 1535void MainWindow::importBday()
1513{ 1536{
1514 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1537 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1515 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1538 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1516 i18n("Import!"), i18n("Cancel"), 0, 1539 i18n("Import!"), i18n("Cancel"), 0,
1517 0, 1 ); 1540 0, 1 );
1518 if ( result == 0 ) { 1541 if ( result == 0 ) {
1519 mView->importBday(); 1542 mView->importBday();
1520 1543
1521 } 1544 }
1522 1545
1523 1546
1524} 1547}
1525void MainWindow::importQtopia() 1548void MainWindow::importQtopia()
1526{ 1549{
1527#ifndef DESKTOP_VERSION 1550#ifndef DESKTOP_VERSION
1528 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1551 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1529 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1552 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1530 i18n("Import!"), i18n("Cancel"), 0, 1553 i18n("Import!"), i18n("Cancel"), 0,
1531 0, 1 ); 1554 0, 1 );
1532 if ( result == 0 ) { 1555 if ( result == 0 ) {
1533 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1556 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1534 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1557 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1535 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1558 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1536 mView->importQtopia( categories, datebook, todolist ); 1559 mView->importQtopia( categories, datebook, todolist );
1537 } 1560 }
1538#else 1561#else
1539 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1562 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1540 i18n("Not supported \non desktop!\n"), 1563 i18n("Not supported \non desktop!\n"),
1541 i18n("Ok"), i18n("Cancel"), 0, 1564 i18n("Ok"), i18n("Cancel"), 0,
1542 0, 1 ); 1565 0, 1 );
1543 1566
1544#endif 1567#endif
1545} 1568}
1546 1569
1547void MainWindow::saveOnClose() 1570void MainWindow::saveOnClose()
1548{ 1571{
1549 KOPrefs *p = KOPrefs::instance(); 1572 KOPrefs *p = KOPrefs::instance();
1550 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1573 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1551 p->mToolBarUp = iconToolBar->x() > width()/2 || 1574 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1552 iconToolBar->y() > height()/2; 1575 iconToolBar->y() > height()/2;
1553 mView->writeSettings(); 1576 mView->writeSettings();
1554 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1577 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1555 save(); 1578 save();
1556} 1579}
1557void MainWindow::slotModifiedChanged( bool changed ) 1580void MainWindow::slotModifiedChanged( bool changed )
1558{ 1581{
1559 if ( mBlockAtStartup ) 1582 if ( mBlockAtStartup )
1560 return; 1583 return;
1561 int msec; 1584 int msec;
1562 // we store the changes after 1 minute, 1585 // we store the changes after 1 minute,
1563 // and for safety reasons after 10 minutes again 1586 // and for safety reasons after 10 minutes again
1564 if ( !mBlockSaveFlag ) 1587 if ( !mBlockSaveFlag )
1565 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1588 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1566 else 1589 else
1567 msec = 1000 * 600; 1590 msec = 1000 * 600;
1568 mSaveTimer.start( msec, true ); // 1 minute 1591 mSaveTimer.start( msec, true ); // 1 minute
1569 qDebug("KO: Saving File in %d secs!", msec/1000); 1592 qDebug("KO: Saving File in %d secs!", msec/1000);
1570 mCalendarModifiedFlag = true; 1593 mCalendarModifiedFlag = true;
1571} 1594}
1572void MainWindow::save() 1595void MainWindow::save()
1573{ 1596{
1574 if ( mBlockSaveFlag ) 1597 if ( mBlockSaveFlag )
1575 return; 1598 return;
1576 bool store = mBlockSaveFlag; 1599 bool store = mBlockSaveFlag;
1577 mBlockSaveFlag = true; 1600 mBlockSaveFlag = true;
1578 if ( mView->checkFileVersion( defaultFileName()) ) { 1601 if ( mView->checkFileVersion( defaultFileName()) ) {
1579 1602
1580 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1603 QTime neededSaveTime = QDateTime::currentDateTime().time();
1581 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1604 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1582 qDebug("KO: Start saving data to file!"); 1605 qDebug("KO: Start saving data to file!");
1583 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1606 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1584 mView->saveCalendar( defaultFileName() ); 1607 mView->saveCalendar( defaultFileName() );
1585 1608
1586 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1609 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1587 mView->watchSavedFile(); 1610 mView->watchSavedFile();
1588 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1611 qDebug("KO: Needed %d ms for saving.",msNeeded );
1589 QString savemes; 1612 QString savemes;
1590 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1613 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1591 setCaption(savemes); 1614 setCaption(savemes);
1592 } else 1615 } else
1593 setCaption(i18n("Saving cancelled!")); 1616 setCaption(i18n("Saving cancelled!"));
1594 mCalendarModifiedFlag = false; 1617 mCalendarModifiedFlag = false;
1595 mBlockSaveFlag = store; 1618 mBlockSaveFlag = store;
1596} 1619}
1597 1620
1598void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1621void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1599{ 1622{
1600 if ( !e->isAutoRepeat() ) { 1623 if ( !e->isAutoRepeat() ) {
1601 mFlagKeyPressed = false; 1624 mFlagKeyPressed = false;
1602 } 1625 }
1603} 1626}
1604void MainWindow::keyPressEvent ( QKeyEvent * e ) 1627void MainWindow::keyPressEvent ( QKeyEvent * e )
1605{ 1628{
1606 qApp->processEvents(); 1629 qApp->processEvents();
1607 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1630 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1608 e->ignore(); 1631 e->ignore();
1609 // qDebug(" ignore %d",e->isAutoRepeat() ); 1632 // qDebug(" ignore %d",e->isAutoRepeat() );
1610 return; 1633 return;
1611 } 1634 }
1612 if (! e->isAutoRepeat() ) 1635 if (! e->isAutoRepeat() )
1613 mFlagKeyPressed = true; 1636 mFlagKeyPressed = true;
1614 KOPrefs *p = KOPrefs::instance(); 1637 KOPrefs *p = KOPrefs::instance();
1615 bool showSelectedDates = false; 1638 bool showSelectedDates = false;
1616 int size; 1639 int size;
1617 int pro = 0; 1640 int pro = 0;
1618 //qDebug("MainWindow::keyPressEvent "); 1641 //qDebug("MainWindow::keyPressEvent ");
1619 switch ( e->key() ) { 1642 switch ( e->key() ) {
1620 case Qt::Key_Right: 1643 case Qt::Key_Right:
1621 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1644 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1622 mView->goNextMonth(); 1645 mView->goNextMonth();
1623 else 1646 else
1624 mView->goNext(); 1647 mView->goNext();
1625 showSelectedDates = true; 1648 showSelectedDates = true;
1626 break; 1649 break;
1627 case Qt::Key_Left: 1650 case Qt::Key_Left:
1628 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1651 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1629 mView->goPreviousMonth(); 1652 mView->goPreviousMonth();
1630 else 1653 else
1631 mView->goPrevious(); 1654 mView->goPrevious();
1632 showSelectedDates = true; 1655 showSelectedDates = true;
1633 break; 1656 break;
1634 case Qt::Key_Down: 1657 case Qt::Key_Down:
1635 mView->viewManager()->agendaView()->scrollOneHourDown(); 1658 mView->viewManager()->agendaView()->scrollOneHourDown();
1636 break; 1659 break;
1637 case Qt::Key_Up: 1660 case Qt::Key_Up:
1638 mView->viewManager()->agendaView()->scrollOneHourUp(); 1661 mView->viewManager()->agendaView()->scrollOneHourUp();
1639 break; 1662 break;
1640 case Qt::Key_I: 1663 case Qt::Key_I:
1641 mView->showIncidence(); 1664 mView->showIncidence();
1642 break; 1665 break;
1643 case Qt::Key_Delete: 1666 case Qt::Key_Delete:
1644 case Qt::Key_Backspace: 1667 case Qt::Key_Backspace:
1645 mView->deleteIncidence(); 1668 mView->deleteIncidence();
1646 break; 1669 break;
1647 case Qt::Key_D: 1670 case Qt::Key_D:
1648 mView->viewManager()->showDayView(); 1671 mView->viewManager()->showDayView();
1649 showSelectedDates = true; 1672 showSelectedDates = true;
1650 break; 1673 break;
1651 case Qt::Key_O: 1674 case Qt::Key_O:
1652 mView->toggleFilerEnabled( ); 1675 mView->toggleFilerEnabled( );
1653 break; 1676 break;
1654 case Qt::Key_0: 1677 case Qt::Key_0:
1655 case Qt::Key_1: 1678 case Qt::Key_1:
1656 case Qt::Key_2: 1679 case Qt::Key_2:
1657 case Qt::Key_3: 1680 case Qt::Key_3:
1658 case Qt::Key_4: 1681 case Qt::Key_4:
1659 case Qt::Key_5: 1682 case Qt::Key_5:
1660 case Qt::Key_6: 1683 case Qt::Key_6:
1661 case Qt::Key_7: 1684 case Qt::Key_7:
1662 case Qt::Key_8: 1685 case Qt::Key_8:
1663 case Qt::Key_9: 1686 case Qt::Key_9:
1664 pro = e->key()-48; 1687 pro = e->key()-48;
1665 if ( pro == 0 ) 1688 if ( pro == 0 )
1666 pro = 10; 1689 pro = 10;
1667 if ( e->state() == Qt::ControlButton) 1690 if ( e->state() == Qt::ControlButton)
1668 pro += 10; 1691 pro += 10;
1669 break; 1692 break;
1670 case Qt::Key_M: 1693 case Qt::Key_M:
1671 mView->viewManager()->showMonthView(); 1694 mView->viewManager()->showMonthView();
1672 showSelectedDates = true; 1695 showSelectedDates = true;
1673 break; 1696 break;
1674 case Qt::Key_Insert: 1697 case Qt::Key_Insert:
1675 mView->newEvent(); 1698 mView->newEvent();
1676 break; 1699 break;
1677 case Qt::Key_S : 1700 case Qt::Key_S :
1678 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1701 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1679 mView->newSubTodo(); 1702 mView->newSubTodo();
1680 else 1703 else
1681 mView->dialogManager()->showSearchDialog(); 1704 mView->dialogManager()->showSearchDialog();
1682 break; 1705 break;
1683 case Qt::Key_Y : 1706 case Qt::Key_Y :
1684 case Qt::Key_Z : 1707 case Qt::Key_Z :
1685 mView->viewManager()->showWorkWeekView(); 1708 mView->viewManager()->showWorkWeekView();
1686 showSelectedDates = true; 1709 showSelectedDates = true;
1687 break; 1710 break;
1688 case Qt::Key_U : 1711 case Qt::Key_U :
1689 mView->viewManager()->showWeekView(); 1712 mView->viewManager()->showWeekView();
1690 showSelectedDates = true; 1713 showSelectedDates = true;
1691 break; 1714 break;
1692 case Qt::Key_H : 1715 case Qt::Key_H :
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 74c7f45..4f89e03 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -8,203 +8,209 @@
8#include <qsocket.h> 8#include <qsocket.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14 14
15class QAction; 15class QAction;
16class CalendarView; 16class CalendarView;
17class KSyncProfile; 17class KSyncProfile;
18#ifdef DESKTOP_VERSION 18#ifdef DESKTOP_VERSION
19 19
20#define QPEToolBar QToolBar 20#define QPEToolBar QToolBar
21#define QPEMenuBar QMenuBar 21#define QPEMenuBar QMenuBar
22#endif 22#endif
23class QPEToolBar; 23class QPEToolBar;
24#include <qserversocket.h> 24#include <qserversocket.h>
25#include <qsocket.h> 25#include <qsocket.h>
26#include <qnetworkprotocol.h> 26#include <qnetworkprotocol.h>
27 27
28class KServerSocket : public QServerSocket 28class KServerSocket : public QServerSocket
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31 31
32public: 32public:
33 KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); 33 KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 );
34 34
35 void newConnection ( int socket ) ; 35 void newConnection ( int socket ) ;
36 void setFileName( QString fn ) {mFileName = fn;}; 36 void setFileName( QString fn ) {mFileName = fn;};
37 37
38signals: 38signals:
39 //void sendFile(QSocket*); 39 //void sendFile(QSocket*);
40 //void getFile(QSocket*); 40 //void getFile(QSocket*);
41 void file_received( bool ); 41 void file_received( bool );
42 //void file_sent(); 42 //void file_sent();
43 void saveFile(); 43 void saveFile();
44 void endConnect(); 44 void endConnect();
45private slots: 45private slots:
46 void discardClient(); 46 void discardClient();
47 void readClient(); 47 void readClient();
48 void readBackFileFromSocket(); 48 void readBackFileFromSocket();
49 private : 49 private :
50 bool blockRC; 50 bool blockRC;
51 void send_file(); 51 void send_file();
52 void get_file(); 52 void get_file();
53 void end_connect(); 53 void end_connect();
54 QDialog* mSyncActionDialog; 54 QDialog* mSyncActionDialog;
55 QSocket* mSocket; 55 QSocket* mSocket;
56 QString mPassWord; 56 QString mPassWord;
57 QString mFileName; 57 QString mFileName;
58 QTime piTime; 58 QTime piTime;
59 QString piFileString; 59 QString piFileString;
60}; 60};
61 61
62class KCommandSocket : public QObject 62class KCommandSocket : public QObject
63{ 63{
64 Q_OBJECT 64 Q_OBJECT
65public: 65public:
66 enum state { successR, errorR, successW, errorW, quiet }; 66 enum state { successR, errorR, successW, errorW, quiet };
67 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); 67 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 );
68 void readFile( QString ); 68 void readFile( QString );
69 void writeFile( QString ); 69 void writeFile( QString );
70 void sendStop(); 70 void sendStop();
71 71
72 72
73signals: 73signals:
74 void commandFinished( KCommandSocket*, int ); 74 void commandFinished( KCommandSocket*, int );
75private slots: 75private slots:
76 void startReadFileFromSocket(); 76 void startReadFileFromSocket();
77 void readFileFromSocket(); 77 void readFileFromSocket();
78 void deleteSocket(); 78 void deleteSocket();
79 void writeFileToSocket(); 79 void writeFileToSocket();
80 private : 80 private :
81 QSocket* mSocket; 81 QSocket* mSocket;
82 QString mPassWord; 82 QString mPassWord;
83 Q_UINT16 mPort; 83 Q_UINT16 mPort;
84 QString mHost; 84 QString mHost;
85 QString mFileName; 85 QString mFileName;
86 QTimer* mTimerSocket; 86 QTimer* mTimerSocket;
87 int mRetVal; 87 int mRetVal;
88 QTime mTime; 88 QTime mTime;
89 QString mFileString; 89 QString mFileString;
90 bool mFirst; 90 bool mFirst;
91}; 91};
92 92
93namespace KCal { 93namespace KCal {
94class CalendarLocal; 94class CalendarLocal;
95} 95}
96 96
97using namespace KCal; 97using namespace KCal;
98 98
99class MainWindow : public QMainWindow 99class MainWindow : public QMainWindow
100{ 100{
101 Q_OBJECT 101 Q_OBJECT
102 public: 102 public:
103 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 103 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
104 ~MainWindow(); 104 ~MainWindow();
105 public slots: 105 public slots:
106 virtual void showMaximized (); 106 virtual void showMaximized ();
107 void configureAgenda( int ); 107 void configureAgenda( int );
108 void recieve( const QCString& msg, const QByteArray& data ); 108 void recieve( const QCString& msg, const QByteArray& data );
109 static QString defaultFileName(); 109 static QString defaultFileName();
110 static QString syncFileName(); 110 static QString syncFileName();
111 static QString resourcePath(); 111 static QString resourcePath();
112 protected slots: 112 protected slots:
113 void setCaptionToDates(); 113 void setCaptionToDates();
114 int ringSync(); 114 int ringSync();
115 void multiSync( bool askforPrefs = false ); 115 void multiSync( bool askforPrefs = false );
116 void about(); 116 void about();
117 void licence(); 117 void licence();
118 void faq(); 118 void faq();
119 void usertrans(); 119 void usertrans();
120 void features(); 120 void features();
121 void synchowto(); 121 void synchowto();
122 void whatsNew(); 122 void whatsNew();
123 void keyBindings(); 123 void keyBindings();
124 void aboutAutoSaving();; 124 void aboutAutoSaving();;
125 void aboutKnownBugs(); 125 void aboutKnownBugs();
126 126
127 void processIncidenceSelection( Incidence * ); 127 void processIncidenceSelection( Incidence * );
128 128
129 void importQtopia(); 129 void importQtopia();
130 void importBday(); 130 void importBday();
131 void importOL(); 131 void importOL();
132 void importIcal(); 132 void importIcal();
133 void importFile( QString, bool ); 133 void importFile( QString, bool );
134 void quickImportIcal(); 134 void quickImportIcal();
135 135
136 void slotModifiedChanged( bool ); 136 void slotModifiedChanged( bool );
137 137
138 void save(); 138 void save();
139 void configureToolBar( int ); 139 void configureToolBar( int );
140 void printSel(); 140 void printSel();
141 void printCal(); 141 void printCal();
142 void saveCalendar(); 142 void saveCalendar();
143 void loadCalendar(); 143 void loadCalendar();
144 void exportVCalendar(); 144 void exportVCalendar();
145 void fillFilterMenu(); 145 void fillFilterMenu();
146 void selectFilter( int ); 146 void selectFilter( int );
147 void exportToPhone( int ); 147 void exportToPhone( int );
148 148
149 void slotSyncMenu( int ); 149 void slotSyncMenu( int );
150 void confSync(); 150 void confSync();
151 void syncSharp(); 151 void syncSharp();
152 void syncPhone(); 152 void syncPhone();
153 void syncPi(); 153 void syncPi();
154 void syncLocalFile(); 154 void syncLocalFile();
155 bool syncWithFile( QString, bool ); 155 bool syncWithFile( QString, bool );
156 void quickSyncLocalFile(); 156 void quickSyncLocalFile();
157 157
158 158
159 protected: 159 protected:
160 void displayText( QString, QString); 160 void displayText( QString, QString);
161 void displayFile( QString, QString); 161 void displayFile( QString, QString);
162 162
163 void enableIncidenceActions( bool ); 163 void enableIncidenceActions( bool );
164 164
165 private slots: 165 private slots:
166 QSocket* piSocket; 166 QSocket* piSocket;
167 QString piFileString; 167 QString piFileString;
168 QTime piTime; 168 QTime piTime;
169 void deleteCommandSocket(KCommandSocket* s, int state ); 169 void deleteCommandSocket(KCommandSocket* s, int state );
170 void fillSyncMenu(); 170 void fillSyncMenu();
171 void getFile( bool ); 171 void getFile( bool );
172 void readFileFromSocket(); 172 void readFileFromSocket();
173 private: 173 private:
174 //QTimer* mTimerCommandSocket; 174 //QTimer* mTimerCommandSocket;
175 QString mPassWordPiSync; 175 QString mPassWordPiSync;
176 KServerSocket * mServerSocket; 176 KServerSocket * mServerSocket;
177 bool mClosed; 177 bool mClosed;
178 void saveOnClose(); 178 void saveOnClose();
179 int mCurrentSyncProfile; 179 int mCurrentSyncProfile;
180 void enableQuick(); 180 void enableQuick();
181 void syncRemote( KSyncProfile* , bool ask = true); 181 void syncRemote( KSyncProfile* , bool ask = true);
182 bool mFlagKeyPressed; 182 bool mFlagKeyPressed;
183 bool mBlockAtStartup; 183 bool mBlockAtStartup;
184 QPEToolBar *iconToolBar; 184 QPEToolBar *iconToolBar;
185 void initActions(); 185 void initActions();
186 void setDefaultPreferences(); 186 void setDefaultPreferences();
187 void keyPressEvent ( QKeyEvent * ) ; 187 void keyPressEvent ( QKeyEvent * ) ;
188 void keyReleaseEvent ( QKeyEvent * ) ; 188 void keyReleaseEvent ( QKeyEvent * ) ;
189 QPopupMenu *configureToolBarMenu; 189 QPopupMenu *configureToolBarMenu;
190 QPopupMenu *selectFilterMenu; 190 QPopupMenu *selectFilterMenu;
191 QPopupMenu *configureAgendaMenu, *syncMenu; 191 QPopupMenu *configureAgendaMenu, *syncMenu;
192 CalendarLocal *mCalendar; 192 CalendarLocal *mCalendar;
193 CalendarView *mView; 193 CalendarView *mView;
194 QString getPassword(); 194 QString getPassword();
195 QAction *mNewSubTodoAction; 195 QAction *mNewSubTodoAction;
196 196
197 QAction *mShowAction; 197 QAction *mShowAction;
198 QAction *mEditAction; 198 QAction *mEditAction;
199 QAction *mDeleteAction; 199 QAction *mDeleteAction;
200 QAction *mCloneAction;
201 QAction *mMoveAction;
202 QAction *mBeamAction;
203 QAction *mCancelAction;
204
205
200 void closeEvent( QCloseEvent* ce ); 206 void closeEvent( QCloseEvent* ce );
201 SimpleAlarmClient mAlarmClient; 207 SimpleAlarmClient mAlarmClient;
202 QTimer mSaveTimer; 208 QTimer mSaveTimer;
203 bool mBlockSaveFlag; 209 bool mBlockSaveFlag;
204 bool mCalendarModifiedFlag; 210 bool mCalendarModifiedFlag;
205 QPixmap loadPixmap( QString ); 211 QPixmap loadPixmap( QString );
206 QDialog * mSyncActionDialog; 212 QDialog * mSyncActionDialog;
207}; 213};
208 214
209 215
210#endif 216#endif