-rw-r--r-- | korganizer/calendarview.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b1da144..38b55f7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2354,96 +2354,131 @@ void CalendarView::moveIncidence(Incidence * inc ) | |||
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 | } |
2369 | void CalendarView::showDatePicker( ) | 2369 | void 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 | ||
2386 | void CalendarView::showEventEditor() | 2386 | void 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 | } |
2394 | void CalendarView::showTodoEditor() | 2394 | void 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 | |||
2403 | void CalendarView::cloneIncidence() | ||
2404 | { | ||
2405 | Incidence *incidence = currentSelection(); | ||
2406 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | ||
2407 | if ( incidence ) { | ||
2408 | cloneIncidence(incidence); | ||
2409 | } | ||
2410 | } | ||
2411 | void CalendarView::moveIncidence() | ||
2412 | { | ||
2413 | Incidence *incidence = currentSelection(); | ||
2414 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | ||
2415 | if ( incidence ) { | ||
2416 | moveIncidence(incidence); | ||
2417 | } | ||
2418 | } | ||
2419 | void CalendarView::beamIncidence() | ||
2420 | { | ||
2421 | Incidence *incidence = currentSelection(); | ||
2422 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | ||
2423 | if ( incidence ) { | ||
2424 | beamIncidence(incidence); | ||
2425 | } | ||
2426 | } | ||
2427 | void CalendarView::toggleCancelIncidence() | ||
2428 | { | ||
2429 | Incidence *incidence = currentSelection(); | ||
2430 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | ||
2431 | if ( incidence ) { | ||
2432 | cancelIncidence(incidence); | ||
2433 | } | ||
2434 | } | ||
2435 | |||
2436 | |||
2402 | void CalendarView::cancelIncidence(Incidence * inc ) | 2437 | void 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 | } |
2408 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2443 | void 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 | ||
2437 | void CalendarView::newEvent() | 2472 | void 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 | } |