-rw-r--r-- | korganizer/calendarview.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 0fbaa9a..a9de65a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2415,136 +2415,139 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | |||
2415 | else { | 2415 | else { |
2416 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2416 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2417 | } | 2417 | } |
2418 | while ( incidence ) { | 2418 | while ( incidence ) { |
2419 | Incidence *in = incidence->clone(); | 2419 | Incidence *in = incidence->clone(); |
2420 | if ( ! in->summary().isEmpty() ) { | 2420 | if ( ! in->summary().isEmpty() ) { |
2421 | in->setDescription(""); | 2421 | in->setDescription(""); |
2422 | } else { | 2422 | } else { |
2423 | in->setSummary( in->description().left(20)); | 2423 | in->setSummary( in->description().left(20)); |
2424 | in->setDescription(""); | 2424 | in->setDescription(""); |
2425 | } | 2425 | } |
2426 | if ( addText ) | 2426 | if ( addText ) |
2427 | description += in->summary() + "\n"; | 2427 | description += in->summary() + "\n"; |
2428 | cal->addIncidence( in ); | 2428 | cal->addIncidence( in ); |
2429 | incidence = delSel.next(); | 2429 | incidence = delSel.next(); |
2430 | } | 2430 | } |
2431 | if ( beamDialog->beamVcal() ) { | 2431 | if ( beamDialog->beamVcal() ) { |
2432 | fn += ".vcs"; | 2432 | fn += ".vcs"; |
2433 | FileStorage storage( cal, fn, new VCalFormat ); | 2433 | FileStorage storage( cal, fn, new VCalFormat ); |
2434 | storage.save(); | 2434 | storage.save(); |
2435 | } else { | 2435 | } else { |
2436 | fn += ".ics"; | 2436 | fn += ".ics"; |
2437 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2437 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2438 | storage.save(); | 2438 | storage.save(); |
2439 | } | 2439 | } |
2440 | delete cal; | 2440 | delete cal; |
2441 | mes = i18n("KO/Pi: Ready for beaming"); | 2441 | mes = i18n("KO/Pi: Ready for beaming"); |
2442 | topLevelWidget()->setCaption(mes); | 2442 | topLevelWidget()->setCaption(mes); |
2443 | KApplication::convert2latin1( fn ); | 2443 | KApplication::convert2latin1( fn ); |
2444 | #ifndef DESKTOP_VERSION | 2444 | #ifndef DESKTOP_VERSION |
2445 | Ir *ir = new Ir( this ); | 2445 | Ir *ir = new Ir( this ); |
2446 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2446 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2447 | ir->send( fn, description, "text/x-vCalendar" ); | 2447 | ir->send( fn, description, "text/x-vCalendar" ); |
2448 | #endif | 2448 | #endif |
2449 | } | 2449 | } |
2450 | } | 2450 | } |
2451 | void CalendarView::beamDone( Ir *ir ) | 2451 | void CalendarView::beamDone( Ir *ir ) |
2452 | { | 2452 | { |
2453 | #ifndef DESKTOP_VERSION | 2453 | #ifndef DESKTOP_VERSION |
2454 | delete ir; | 2454 | delete ir; |
2455 | #endif | 2455 | #endif |
2456 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2456 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2457 | topLevelWidget()->raise(); | 2457 | topLevelWidget()->raise(); |
2458 | } | 2458 | } |
2459 | 2459 | ||
2460 | void CalendarView::moveIncidence(Incidence * inc ) | 2460 | void CalendarView::moveIncidence(Incidence * inc ) |
2461 | { | 2461 | { |
2462 | if ( !inc ) return; | 2462 | if ( !inc ) return; |
2463 | // qDebug("showDatePickerForIncidence( ) "); | 2463 | showDatePickerPopup(); |
2464 | if ( mDateFrame->isVisible() ) | ||
2465 | mDateFrame->hide(); | ||
2466 | else { | ||
2467 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | ||
2468 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | ||
2469 | int dw = QApplication::desktop()->width(); | ||
2470 | int dh = QApplication::desktop()->height(); | ||
2471 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
2472 | mDateFrame->show(); | ||
2473 | } | ||
2474 | mDatePickerMode = 2; | 2464 | mDatePickerMode = 2; |
2475 | mMoveIncidence = inc ; | 2465 | mMoveIncidence = inc ; |
2476 | QDate da; | 2466 | QDate da; |
2477 | if ( mMoveIncidence->type() == "Todo" ) { | 2467 | if ( mMoveIncidence->type() == "Todo" ) { |
2478 | Todo * to = (Todo *) mMoveIncidence; | 2468 | Todo * to = (Todo *) mMoveIncidence; |
2479 | if ( to->hasDueDate() ) | 2469 | if ( to->hasDueDate() ) |
2480 | da = to->dtDue().date(); | 2470 | da = to->dtDue().date(); |
2481 | else | 2471 | else |
2482 | da = QDate::currentDate(); | 2472 | da = QDate::currentDate(); |
2483 | } else { | 2473 | } else { |
2484 | da = mMoveIncidence->dtStart().date(); | 2474 | da = mMoveIncidence->dtStart().date(); |
2485 | } | 2475 | } |
2486 | //PENDING set date for recurring incidence to date of recurrence | 2476 | //PENDING set date for recurring incidence to date of recurrence |
2487 | //mMoveIncidenceOldDate; | 2477 | //mMoveIncidenceOldDate; |
2488 | mDatePicker->setDate( da ); | 2478 | mDatePicker->setDate( da ); |
2489 | } | 2479 | } |
2490 | void CalendarView::showDatePicker( ) | 2480 | void CalendarView::showDatePickerPopup() |
2491 | { | 2481 | { |
2492 | //qDebug("CalendarView::showDatePicker( ) "); | 2482 | if ( mDateFrame->isVisible() ) |
2493 | if ( mDateFrame->isVisible() ) | ||
2494 | mDateFrame->hide(); | 2483 | mDateFrame->hide(); |
2495 | else { | 2484 | else { |
2485 | int offX = 0, offY = 0; | ||
2486 | #ifdef DESKTOP_VERSION | ||
2487 | int w =mDatePicker->sizeHint().width() ; | ||
2488 | int h = mDatePicker->sizeHint().height() ; | ||
2489 | int dw = topLevelWidget()->width(); | ||
2490 | int dh = topLevelWidget()->height(); | ||
2491 | offX = topLevelWidget()->x(); | ||
2492 | offY = topLevelWidget()->y(); | ||
2493 | #else | ||
2496 | int w =mDatePicker->sizeHint().width() ; | 2494 | int w =mDatePicker->sizeHint().width() ; |
2497 | int h = mDatePicker->sizeHint().height() ; | 2495 | int h = mDatePicker->sizeHint().height() ; |
2498 | int dw = QApplication::desktop()->width(); | 2496 | int dw = QApplication::desktop()->width(); |
2499 | int dh = QApplication::desktop()->height(); | 2497 | int dh = QApplication::desktop()->height(); |
2500 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2498 | #endif |
2499 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | ||
2501 | mDateFrame->show(); | 2500 | mDateFrame->show(); |
2502 | } | 2501 | } |
2502 | } | ||
2503 | void CalendarView::showDatePicker( ) | ||
2504 | { | ||
2505 | showDatePickerPopup(); | ||
2503 | mDatePickerMode = 1; | 2506 | mDatePickerMode = 1; |
2504 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2507 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2505 | } | 2508 | } |
2506 | 2509 | ||
2507 | void CalendarView::showEventEditor() | 2510 | void CalendarView::showEventEditor() |
2508 | { | 2511 | { |
2509 | #ifdef DESKTOP_VERSION | 2512 | #ifdef DESKTOP_VERSION |
2510 | mEventEditor->show(); | 2513 | mEventEditor->show(); |
2511 | #else | 2514 | #else |
2512 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2515 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2513 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2516 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2514 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2517 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2515 | qApp->processEvents(); | 2518 | qApp->processEvents(); |
2516 | delete mEventEditor; | 2519 | delete mEventEditor; |
2517 | mEventEditor = mDialogManager->getEventEditor(); | 2520 | mEventEditor = mDialogManager->getEventEditor(); |
2518 | topLevelWidget()->setCaption( i18n("") ); | 2521 | topLevelWidget()->setCaption( i18n("") ); |
2519 | } | 2522 | } |
2520 | mEventEditor->showMaximized(); | 2523 | mEventEditor->showMaximized(); |
2521 | #endif | 2524 | #endif |
2522 | } | 2525 | } |
2523 | void CalendarView::showTodoEditor() | 2526 | void CalendarView::showTodoEditor() |
2524 | { | 2527 | { |
2525 | #ifdef DESKTOP_VERSION | 2528 | #ifdef DESKTOP_VERSION |
2526 | mTodoEditor->show(); | 2529 | mTodoEditor->show(); |
2527 | #else | 2530 | #else |
2528 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2531 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2529 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2532 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2530 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2533 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2531 | qApp->processEvents(); | 2534 | qApp->processEvents(); |
2532 | delete mTodoEditor; | 2535 | delete mTodoEditor; |
2533 | mTodoEditor = mDialogManager->getTodoEditor(); | 2536 | mTodoEditor = mDialogManager->getTodoEditor(); |
2534 | topLevelWidget()->setCaption( i18n("") ); | 2537 | topLevelWidget()->setCaption( i18n("") ); |
2535 | } | 2538 | } |
2536 | mTodoEditor->showMaximized(); | 2539 | mTodoEditor->showMaximized(); |
2537 | #endif | 2540 | #endif |
2538 | } | 2541 | } |
2539 | 2542 | ||
2540 | void CalendarView::cloneIncidence() | 2543 | void CalendarView::cloneIncidence() |
2541 | { | 2544 | { |
2542 | Incidence *incidence = currentSelection(); | 2545 | Incidence *incidence = currentSelection(); |
2543 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2546 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2544 | if ( incidence ) { | 2547 | if ( incidence ) { |
2545 | cloneIncidence(incidence); | 2548 | cloneIncidence(incidence); |
2546 | } | 2549 | } |
2547 | } | 2550 | } |
2548 | void CalendarView::moveIncidence() | 2551 | void CalendarView::moveIncidence() |
2549 | { | 2552 | { |
2550 | Incidence *incidence = currentSelection(); | 2553 | Incidence *incidence = currentSelection(); |