-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 28649d9..a1b1d71 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3269,257 +3269,257 @@ void CalendarView::showEventEditor() | |||
3269 | x = mEventEditor->geometry().x(); | 3269 | x = mEventEditor->geometry().x(); |
3270 | y = mEventEditor->geometry().y(); | 3270 | y = mEventEditor->geometry().y(); |
3271 | w = mEventEditor->width(); | 3271 | w = mEventEditor->width(); |
3272 | h = mEventEditor->height(); | 3272 | h = mEventEditor->height(); |
3273 | mEventEditor->show(); | 3273 | mEventEditor->show(); |
3274 | mEventEditor->setGeometry(x,y,w,h); | 3274 | mEventEditor->setGeometry(x,y,w,h); |
3275 | #else | 3275 | #else |
3276 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 3276 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
3277 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 3277 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
3278 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 3278 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
3279 | qApp->processEvents(); | 3279 | qApp->processEvents(); |
3280 | delete mEventEditor; | 3280 | delete mEventEditor; |
3281 | mEventEditor = mDialogManager->getEventEditor(); | 3281 | mEventEditor = mDialogManager->getEventEditor(); |
3282 | topLevelWidget()->setCaption( i18n("") ); | 3282 | topLevelWidget()->setCaption( i18n("") ); |
3283 | } | 3283 | } |
3284 | mEventEditor->showMaximized(); | 3284 | mEventEditor->showMaximized(); |
3285 | #endif | 3285 | #endif |
3286 | } | 3286 | } |
3287 | void CalendarView::showTodoEditor() | 3287 | void CalendarView::showTodoEditor() |
3288 | { | 3288 | { |
3289 | #ifdef DESKTOP_VERSION | 3289 | #ifdef DESKTOP_VERSION |
3290 | int x,y,w,h; | 3290 | int x,y,w,h; |
3291 | x = mTodoEditor->geometry().x(); | 3291 | x = mTodoEditor->geometry().x(); |
3292 | y = mTodoEditor->geometry().y(); | 3292 | y = mTodoEditor->geometry().y(); |
3293 | w = mTodoEditor->width(); | 3293 | w = mTodoEditor->width(); |
3294 | h = mTodoEditor->height(); | 3294 | h = mTodoEditor->height(); |
3295 | mTodoEditor->show(); | 3295 | mTodoEditor->show(); |
3296 | mTodoEditor->setGeometry(x,y,w,h); | 3296 | mTodoEditor->setGeometry(x,y,w,h); |
3297 | #else | 3297 | #else |
3298 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 3298 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
3299 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 3299 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
3300 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 3300 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
3301 | qApp->processEvents(); | 3301 | qApp->processEvents(); |
3302 | delete mTodoEditor; | 3302 | delete mTodoEditor; |
3303 | mTodoEditor = mDialogManager->getTodoEditor(); | 3303 | mTodoEditor = mDialogManager->getTodoEditor(); |
3304 | topLevelWidget()->setCaption( i18n("") ); | 3304 | topLevelWidget()->setCaption( i18n("") ); |
3305 | } | 3305 | } |
3306 | mTodoEditor->showMaximized(); | 3306 | mTodoEditor->showMaximized(); |
3307 | #endif | 3307 | #endif |
3308 | } | 3308 | } |
3309 | 3309 | ||
3310 | void CalendarView::cloneIncidence() | 3310 | void CalendarView::cloneIncidence() |
3311 | { | 3311 | { |
3312 | Incidence *incidence = currentSelection(); | 3312 | Incidence *incidence = currentSelection(); |
3313 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3313 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3314 | if ( incidence ) { | 3314 | if ( incidence ) { |
3315 | cloneIncidence(incidence); | 3315 | cloneIncidence(incidence); |
3316 | } | 3316 | } |
3317 | } | 3317 | } |
3318 | void CalendarView::moveIncidence() | 3318 | void CalendarView::moveIncidence() |
3319 | { | 3319 | { |
3320 | Incidence *incidence = currentSelection(); | 3320 | Incidence *incidence = currentSelection(); |
3321 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3321 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3322 | if ( incidence ) { | 3322 | if ( incidence ) { |
3323 | moveIncidence(incidence); | 3323 | moveIncidence(incidence); |
3324 | } | 3324 | } |
3325 | } | 3325 | } |
3326 | void CalendarView::beamIncidence() | 3326 | void CalendarView::beamIncidence() |
3327 | { | 3327 | { |
3328 | Incidence *incidence = currentSelection(); | 3328 | Incidence *incidence = currentSelection(); |
3329 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3329 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3330 | if ( incidence ) { | 3330 | if ( incidence ) { |
3331 | beamIncidence(incidence); | 3331 | beamIncidence(incidence); |
3332 | } | 3332 | } |
3333 | } | 3333 | } |
3334 | void CalendarView::toggleCancelIncidence() | 3334 | void CalendarView::toggleCancelIncidence() |
3335 | { | 3335 | { |
3336 | Incidence *incidence = currentSelection(); | 3336 | Incidence *incidence = currentSelection(); |
3337 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3337 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3338 | if ( incidence ) { | 3338 | if ( incidence ) { |
3339 | cancelIncidence(incidence); | 3339 | cancelIncidence(incidence); |
3340 | } | 3340 | } |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | 3343 | ||
3344 | void CalendarView::cancelIncidence(Incidence * inc ) | 3344 | void CalendarView::cancelIncidence(Incidence * inc ) |
3345 | { | 3345 | { |
3346 | inc->setCancelled( ! inc->cancelled() ); | 3346 | inc->setCancelled( ! inc->cancelled() ); |
3347 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 3347 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
3348 | updateView(); | 3348 | updateView(); |
3349 | } | 3349 | } |
3350 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 3350 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
3351 | { | 3351 | { |
3352 | Incidence * newInc = orgInc->clone(); | 3352 | Incidence * newInc = orgInc->clone(); |
3353 | newInc->recreate(); | 3353 | newInc->recreate(); |
3354 | 3354 | ||
3355 | if ( newInc->typeID() == todoID ) { | 3355 | if ( newInc->typeID() == todoID ) { |
3356 | Todo* t = (Todo*) newInc; | 3356 | Todo* t = (Todo*) newInc; |
3357 | bool cloneSub = false; | 3357 | bool cloneSub = false; |
3358 | if ( orgInc->relations().count() ) { | 3358 | if ( orgInc->relations().count() ) { |
3359 | int result = KMessageBox::warningYesNoCancel(this, | 3359 | int result = KMessageBox::warningYesNoCancel(this, |
3360 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), | 3360 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), |
3361 | i18n("Todo has subtodos"), | 3361 | i18n("Todo has subtodos"), |
3362 | i18n("Yes"), | 3362 | i18n("Yes"), |
3363 | i18n("No")); | 3363 | i18n("No")); |
3364 | 3364 | ||
3365 | if ( result == KMessageBox::Cancel ) { | 3365 | if ( result == KMessageBox::Cancel ) { |
3366 | delete t; | 3366 | delete t; |
3367 | return; | 3367 | return; |
3368 | } | 3368 | } |
3369 | if (result == KMessageBox::Yes) cloneSub = true; | 3369 | if (result == KMessageBox::Yes) cloneSub = true; |
3370 | } | 3370 | } |
3371 | showTodoEditor(); | 3371 | showTodoEditor(); |
3372 | mTodoEditor->editTodo( t ); | 3372 | mTodoEditor->editTodo( t ); |
3373 | if ( mTodoEditor->exec() ) { | 3373 | if ( mTodoEditor->exec() ) { |
3374 | if ( cloneSub ) { | 3374 | if ( cloneSub ) { |
3375 | orgInc->cloneRelations( t ); | 3375 | orgInc->cloneRelations( t ); |
3376 | mCalendar->addIncidenceBranch( t ); | 3376 | mCalendar->addIncidenceBranch( t ); |
3377 | updateView(); | 3377 | updateView(); |
3378 | 3378 | ||
3379 | } else { | 3379 | } else { |
3380 | mCalendar->addTodo( t ); | 3380 | mCalendar->addTodo( t ); |
3381 | updateView(); | 3381 | updateView(); |
3382 | } | 3382 | } |
3383 | } else { | 3383 | } else { |
3384 | delete t; | 3384 | delete t; |
3385 | } | 3385 | } |
3386 | } | 3386 | } |
3387 | else if ( newInc->typeID() == eventID ) { | 3387 | else if ( newInc->typeID() == eventID ) { |
3388 | Event* e = (Event*) newInc; | 3388 | Event* e = (Event*) newInc; |
3389 | showEventEditor(); | 3389 | showEventEditor(); |
3390 | mEventEditor->editEvent( e ); | 3390 | mEventEditor->editEvent( e ); |
3391 | if ( mEventEditor->exec() ) { | 3391 | if ( mEventEditor->exec() ) { |
3392 | mCalendar->addEvent( e ); | 3392 | mCalendar->addEvent( e ); |
3393 | updateView(); | 3393 | updateView(); |
3394 | } else { | 3394 | } else { |
3395 | delete e; | 3395 | delete e; |
3396 | } | 3396 | } |
3397 | } if ( newInc->typeID() == journalID ) { | 3397 | } else if ( newInc->typeID() == journalID ) { |
3398 | mCalendar->addJournal( (Journal*) newInc ); | 3398 | mCalendar->addJournal( (Journal*) newInc ); |
3399 | editJournal( (Journal*) newInc ); | 3399 | editJournal( (Journal*) newInc ); |
3400 | } | 3400 | } |
3401 | setActiveWindow(); | 3401 | setActiveWindow(); |
3402 | } | 3402 | } |
3403 | 3403 | ||
3404 | void CalendarView::newEvent() | 3404 | void CalendarView::newEvent() |
3405 | { | 3405 | { |
3406 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 3406 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
3407 | KOAgendaView *aView = mViewManager->agendaView(); | 3407 | KOAgendaView *aView = mViewManager->agendaView(); |
3408 | if (aView) { | 3408 | if (aView) { |
3409 | if (aView->selectionStart().isValid()) { | 3409 | if (aView->selectionStart().isValid()) { |
3410 | if (aView->selectedIsAllDay()) { | 3410 | if (aView->selectedIsAllDay()) { |
3411 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 3411 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
3412 | } else { | 3412 | } else { |
3413 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3413 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3414 | } | 3414 | } |
3415 | return; | 3415 | return; |
3416 | } | 3416 | } |
3417 | } | 3417 | } |
3418 | 3418 | ||
3419 | QDate date = mNavigator->selectedDates().first(); | 3419 | QDate date = mNavigator->selectedDates().first(); |
3420 | #if 0 | 3420 | #if 0 |
3421 | QDateTime current = QDateTime::currentDateTime(); | 3421 | QDateTime current = QDateTime::currentDateTime(); |
3422 | if ( date <= current.date() ) { | 3422 | if ( date <= current.date() ) { |
3423 | int hour = current.time().hour() +1; | 3423 | int hour = current.time().hour() +1; |
3424 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3424 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3425 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3425 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3426 | } else | 3426 | } else |
3427 | #endif | 3427 | #endif |
3428 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3428 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3429 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3429 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3430 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3430 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3431 | } | 3431 | } |
3432 | 3432 | ||
3433 | void CalendarView::newEvent(QDateTime fh) | 3433 | void CalendarView::newEvent(QDateTime fh) |
3434 | { | 3434 | { |
3435 | newEvent(fh, | 3435 | newEvent(fh, |
3436 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 3436 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
3437 | } | 3437 | } |
3438 | 3438 | ||
3439 | void CalendarView::newEvent(QDate dt) | 3439 | void CalendarView::newEvent(QDate dt) |
3440 | { | 3440 | { |
3441 | newEvent(QDateTime(dt, QTime(0,0,0)), | 3441 | newEvent(QDateTime(dt, QTime(0,0,0)), |
3442 | QDateTime(dt, QTime(0,0,0)), true); | 3442 | QDateTime(dt, QTime(0,0,0)), true); |
3443 | } | 3443 | } |
3444 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 3444 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
3445 | { | 3445 | { |
3446 | newEvent(fromHint, toHint, false); | 3446 | newEvent(fromHint, toHint, false); |
3447 | } | 3447 | } |
3448 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 3448 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
3449 | { | 3449 | { |
3450 | 3450 | ||
3451 | showEventEditor(); | 3451 | showEventEditor(); |
3452 | mEventEditor->newEvent(fromHint,toHint,allDay); | 3452 | mEventEditor->newEvent(fromHint,toHint,allDay); |
3453 | if ( mFilterView->filtersEnabled() ) { | 3453 | if ( mFilterView->filtersEnabled() ) { |
3454 | CalFilter *filter = mFilterView->selectedFilter(); | 3454 | CalFilter *filter = mFilterView->selectedFilter(); |
3455 | if (filter && filter->showCategories()) { | 3455 | if (filter && filter->showCategories()) { |
3456 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 3456 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
3457 | } | 3457 | } |
3458 | if ( filter ) | 3458 | if ( filter ) |
3459 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 3459 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
3460 | } | 3460 | } |
3461 | mEventEditor->exec(); | 3461 | mEventEditor->exec(); |
3462 | setActiveWindow(); | 3462 | setActiveWindow(); |
3463 | } | 3463 | } |
3464 | void CalendarView::todoAdded(Todo * t) | 3464 | void CalendarView::todoAdded(Todo * t) |
3465 | { | 3465 | { |
3466 | 3466 | ||
3467 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 3467 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
3468 | updateTodoViews(); | 3468 | updateTodoViews(); |
3469 | } | 3469 | } |
3470 | void CalendarView::todoChanged(Todo * t) | 3470 | void CalendarView::todoChanged(Todo * t) |
3471 | { | 3471 | { |
3472 | emit todoModified( t, 4 ); | 3472 | emit todoModified( t, 4 ); |
3473 | // updateTodoViews(); | 3473 | // updateTodoViews(); |
3474 | } | 3474 | } |
3475 | void CalendarView::todoToBeDeleted(Todo *) | 3475 | void CalendarView::todoToBeDeleted(Todo *) |
3476 | { | 3476 | { |
3477 | //qDebug("todoToBeDeleted(Todo *) "); | 3477 | //qDebug("todoToBeDeleted(Todo *) "); |
3478 | updateTodoViews(); | 3478 | updateTodoViews(); |
3479 | } | 3479 | } |
3480 | void CalendarView::todoDeleted() | 3480 | void CalendarView::todoDeleted() |
3481 | { | 3481 | { |
3482 | //qDebug(" todoDeleted()"); | 3482 | //qDebug(" todoDeleted()"); |
3483 | updateTodoViews(); | 3483 | updateTodoViews(); |
3484 | } | 3484 | } |
3485 | 3485 | ||
3486 | 3486 | ||
3487 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 3487 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
3488 | { | 3488 | { |
3489 | showTodoEditor(); | 3489 | showTodoEditor(); |
3490 | mTodoEditor->newTodo(dt,0,allday); | 3490 | mTodoEditor->newTodo(dt,0,allday); |
3491 | if ( mFilterView->filtersEnabled() ) { | 3491 | if ( mFilterView->filtersEnabled() ) { |
3492 | CalFilter *filter = mFilterView->selectedFilter(); | 3492 | CalFilter *filter = mFilterView->selectedFilter(); |
3493 | if (filter && filter->showCategories()) { | 3493 | if (filter && filter->showCategories()) { |
3494 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 3494 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
3495 | } | 3495 | } |
3496 | if ( filter ) | 3496 | if ( filter ) |
3497 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 3497 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
3498 | } | 3498 | } |
3499 | mTodoEditor->exec(); | 3499 | mTodoEditor->exec(); |
3500 | setActiveWindow(); | 3500 | setActiveWindow(); |
3501 | } | 3501 | } |
3502 | 3502 | ||
3503 | void CalendarView::newTodo() | 3503 | void CalendarView::newTodo() |
3504 | { | 3504 | { |
3505 | newTodoDateTime( QDateTime(),true ); | 3505 | newTodoDateTime( QDateTime(),true ); |
3506 | } | 3506 | } |
3507 | 3507 | ||
3508 | void CalendarView::newSubTodo() | 3508 | void CalendarView::newSubTodo() |
3509 | { | 3509 | { |
3510 | Todo *todo = selectedTodo(); | 3510 | Todo *todo = selectedTodo(); |
3511 | if ( todo ) newSubTodo( todo ); | 3511 | if ( todo ) newSubTodo( todo ); |
3512 | } | 3512 | } |
3513 | 3513 | ||
3514 | void CalendarView::newSubTodo(Todo *parentEvent) | 3514 | void CalendarView::newSubTodo(Todo *parentEvent) |
3515 | { | 3515 | { |
3516 | 3516 | ||
3517 | showTodoEditor(); | 3517 | showTodoEditor(); |
3518 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 3518 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
3519 | mTodoEditor->exec(); | 3519 | mTodoEditor->exec(); |
3520 | setActiveWindow(); | 3520 | setActiveWindow(); |
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | void CalendarView::newFloatingEvent() | 3523 | void CalendarView::newFloatingEvent() |
3524 | { | 3524 | { |
3525 | DateList tmpList = mNavigator->selectedDates(); | 3525 | DateList tmpList = mNavigator->selectedDates(); |