author | zautrix <zautrix> | 2005-04-15 11:25:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-15 11:25:00 (UTC) |
commit | d2f51718bdfa5b05e6f7e609ec75f616e3f0a7c1 (patch) (unidiff) | |
tree | 2fd31b41a449604610a38464a02a4d4fc5de0e1a /korganizer | |
parent | 068b5535de440c93415bae4e13c8efeaadffc5f2 (diff) | |
download | kdepimpi-d2f51718bdfa5b05e6f7e609ec75f616e3f0a7c1.zip kdepimpi-d2f51718bdfa5b05e6f7e609ec75f616e3f0a7c1.tar.gz kdepimpi-d2f51718bdfa5b05e6f7e609ec75f616e3f0a7c1.tar.bz2 |
fixxx
-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 bd7376a..904bbe2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3226,926 +3226,926 @@ void CalendarView::action_mail() | |||
3226 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3226 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3227 | } | 3227 | } |
3228 | 3228 | ||
3229 | if (!anEvent) { | 3229 | if (!anEvent) { |
3230 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3230 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3231 | return; | 3231 | return; |
3232 | } | 3232 | } |
3233 | if(anEvent->attendeeCount() == 0 ) { | 3233 | if(anEvent->attendeeCount() == 0 ) { |
3234 | KMessageBox::sorry(this, | 3234 | KMessageBox::sorry(this, |
3235 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3235 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3236 | return; | 3236 | return; |
3237 | } | 3237 | } |
3238 | 3238 | ||
3239 | mailobject.emailEvent(anEvent); | 3239 | mailobject.emailEvent(anEvent); |
3240 | #endif | 3240 | #endif |
3241 | } | 3241 | } |
3242 | 3242 | ||
3243 | 3243 | ||
3244 | void CalendarView::schedule_publish(Incidence *incidence) | 3244 | void CalendarView::schedule_publish(Incidence *incidence) |
3245 | { | 3245 | { |
3246 | Event *event = 0; | 3246 | Event *event = 0; |
3247 | Todo *todo = 0; | 3247 | Todo *todo = 0; |
3248 | 3248 | ||
3249 | if (incidence == 0) { | 3249 | if (incidence == 0) { |
3250 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3250 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3251 | if (incidence == 0) { | 3251 | if (incidence == 0) { |
3252 | incidence = mTodoList->selectedIncidences().first(); | 3252 | incidence = mTodoList->selectedIncidences().first(); |
3253 | } | 3253 | } |
3254 | } | 3254 | } |
3255 | if ( incidence && incidence->type() == "Event" ) { | 3255 | if ( incidence && incidence->type() == "Event" ) { |
3256 | event = static_cast<Event *>(incidence); | 3256 | event = static_cast<Event *>(incidence); |
3257 | } else { | 3257 | } else { |
3258 | if ( incidence && incidence->type() == "Todo" ) { | 3258 | if ( incidence && incidence->type() == "Todo" ) { |
3259 | todo = static_cast<Todo *>(incidence); | 3259 | todo = static_cast<Todo *>(incidence); |
3260 | } | 3260 | } |
3261 | } | 3261 | } |
3262 | 3262 | ||
3263 | if (!event && !todo) { | 3263 | if (!event && !todo) { |
3264 | KMessageBox::sorry(this,i18n("No event selected.")); | 3264 | KMessageBox::sorry(this,i18n("No event selected.")); |
3265 | return; | 3265 | return; |
3266 | } | 3266 | } |
3267 | 3267 | ||
3268 | PublishDialog *publishdlg = new PublishDialog(); | 3268 | PublishDialog *publishdlg = new PublishDialog(); |
3269 | if (incidence->attendeeCount()>0) { | 3269 | if (incidence->attendeeCount()>0) { |
3270 | QPtrList<Attendee> attendees = incidence->attendees(); | 3270 | QPtrList<Attendee> attendees = incidence->attendees(); |
3271 | attendees.first(); | 3271 | attendees.first(); |
3272 | while ( attendees.current()!=0 ) { | 3272 | while ( attendees.current()!=0 ) { |
3273 | publishdlg->addAttendee(attendees.current()); | 3273 | publishdlg->addAttendee(attendees.current()); |
3274 | attendees.next(); | 3274 | attendees.next(); |
3275 | } | 3275 | } |
3276 | } | 3276 | } |
3277 | bool send = true; | 3277 | bool send = true; |
3278 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3278 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3279 | if ( publishdlg->exec() != QDialog::Accepted ) | 3279 | if ( publishdlg->exec() != QDialog::Accepted ) |
3280 | send = false; | 3280 | send = false; |
3281 | } | 3281 | } |
3282 | if ( send ) { | 3282 | if ( send ) { |
3283 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3283 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3284 | if ( event ) { | 3284 | if ( event ) { |
3285 | Event *ev = new Event(*event); | 3285 | Event *ev = new Event(*event); |
3286 | ev->registerObserver(0); | 3286 | ev->registerObserver(0); |
3287 | ev->clearAttendees(); | 3287 | ev->clearAttendees(); |
3288 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3288 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3289 | delete(ev); | 3289 | delete(ev); |
3290 | } | 3290 | } |
3291 | } else { | 3291 | } else { |
3292 | if ( todo ) { | 3292 | if ( todo ) { |
3293 | Todo *ev = new Todo(*todo); | 3293 | Todo *ev = new Todo(*todo); |
3294 | ev->registerObserver(0); | 3294 | ev->registerObserver(0); |
3295 | ev->clearAttendees(); | 3295 | ev->clearAttendees(); |
3296 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3296 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3297 | delete(ev); | 3297 | delete(ev); |
3298 | } | 3298 | } |
3299 | } | 3299 | } |
3300 | } | 3300 | } |
3301 | } | 3301 | } |
3302 | delete publishdlg; | 3302 | delete publishdlg; |
3303 | } | 3303 | } |
3304 | 3304 | ||
3305 | void CalendarView::schedule_request(Incidence *incidence) | 3305 | void CalendarView::schedule_request(Incidence *incidence) |
3306 | { | 3306 | { |
3307 | schedule(Scheduler::Request,incidence); | 3307 | schedule(Scheduler::Request,incidence); |
3308 | } | 3308 | } |
3309 | 3309 | ||
3310 | void CalendarView::schedule_refresh(Incidence *incidence) | 3310 | void CalendarView::schedule_refresh(Incidence *incidence) |
3311 | { | 3311 | { |
3312 | schedule(Scheduler::Refresh,incidence); | 3312 | schedule(Scheduler::Refresh,incidence); |
3313 | } | 3313 | } |
3314 | 3314 | ||
3315 | void CalendarView::schedule_cancel(Incidence *incidence) | 3315 | void CalendarView::schedule_cancel(Incidence *incidence) |
3316 | { | 3316 | { |
3317 | schedule(Scheduler::Cancel,incidence); | 3317 | schedule(Scheduler::Cancel,incidence); |
3318 | } | 3318 | } |
3319 | 3319 | ||
3320 | void CalendarView::schedule_add(Incidence *incidence) | 3320 | void CalendarView::schedule_add(Incidence *incidence) |
3321 | { | 3321 | { |
3322 | schedule(Scheduler::Add,incidence); | 3322 | schedule(Scheduler::Add,incidence); |
3323 | } | 3323 | } |
3324 | 3324 | ||
3325 | void CalendarView::schedule_reply(Incidence *incidence) | 3325 | void CalendarView::schedule_reply(Incidence *incidence) |
3326 | { | 3326 | { |
3327 | schedule(Scheduler::Reply,incidence); | 3327 | schedule(Scheduler::Reply,incidence); |
3328 | } | 3328 | } |
3329 | 3329 | ||
3330 | void CalendarView::schedule_counter(Incidence *incidence) | 3330 | void CalendarView::schedule_counter(Incidence *incidence) |
3331 | { | 3331 | { |
3332 | schedule(Scheduler::Counter,incidence); | 3332 | schedule(Scheduler::Counter,incidence); |
3333 | } | 3333 | } |
3334 | 3334 | ||
3335 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3335 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3336 | { | 3336 | { |
3337 | schedule(Scheduler::Declinecounter,incidence); | 3337 | schedule(Scheduler::Declinecounter,incidence); |
3338 | } | 3338 | } |
3339 | 3339 | ||
3340 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3340 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3341 | { | 3341 | { |
3342 | QDateTime start = QDateTime::currentDateTime(); | 3342 | QDateTime start = QDateTime::currentDateTime(); |
3343 | QDateTime end = start.addDays(daysToPublish); | 3343 | QDateTime end = start.addDays(daysToPublish); |
3344 | 3344 | ||
3345 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3345 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3346 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3346 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3347 | 3347 | ||
3348 | 3348 | ||
3349 | PublishDialog *publishdlg = new PublishDialog(); | 3349 | PublishDialog *publishdlg = new PublishDialog(); |
3350 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3350 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3351 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3351 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3352 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3352 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3353 | delete(freebusy); | 3353 | delete(freebusy); |
3354 | } | 3354 | } |
3355 | } | 3355 | } |
3356 | delete publishdlg; | 3356 | delete publishdlg; |
3357 | } | 3357 | } |
3358 | 3358 | ||
3359 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3359 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3360 | { | 3360 | { |
3361 | Event *event = 0; | 3361 | Event *event = 0; |
3362 | Todo *todo = 0; | 3362 | Todo *todo = 0; |
3363 | 3363 | ||
3364 | if (incidence == 0) { | 3364 | if (incidence == 0) { |
3365 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3365 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3366 | if (incidence == 0) { | 3366 | if (incidence == 0) { |
3367 | incidence = mTodoList->selectedIncidences().first(); | 3367 | incidence = mTodoList->selectedIncidences().first(); |
3368 | } | 3368 | } |
3369 | } | 3369 | } |
3370 | if ( incidence && incidence->type() == "Event" ) { | 3370 | if ( incidence && incidence->type() == "Event" ) { |
3371 | event = static_cast<Event *>(incidence); | 3371 | event = static_cast<Event *>(incidence); |
3372 | } | 3372 | } |
3373 | if ( incidence && incidence->type() == "Todo" ) { | 3373 | if ( incidence && incidence->type() == "Todo" ) { |
3374 | todo = static_cast<Todo *>(incidence); | 3374 | todo = static_cast<Todo *>(incidence); |
3375 | } | 3375 | } |
3376 | 3376 | ||
3377 | if (!event && !todo) { | 3377 | if (!event && !todo) { |
3378 | KMessageBox::sorry(this,i18n("No event selected.")); | 3378 | KMessageBox::sorry(this,i18n("No event selected.")); |
3379 | return; | 3379 | return; |
3380 | } | 3380 | } |
3381 | 3381 | ||
3382 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3382 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3383 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3383 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3384 | return; | 3384 | return; |
3385 | } | 3385 | } |
3386 | 3386 | ||
3387 | Event *ev = 0; | 3387 | Event *ev = 0; |
3388 | if (event) ev = new Event(*event); | 3388 | if (event) ev = new Event(*event); |
3389 | Todo *to = 0; | 3389 | Todo *to = 0; |
3390 | if (todo) to = new Todo(*todo); | 3390 | if (todo) to = new Todo(*todo); |
3391 | 3391 | ||
3392 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3392 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3393 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3393 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3394 | if (!me) { | 3394 | if (!me) { |
3395 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3395 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3396 | return; | 3396 | return; |
3397 | } | 3397 | } |
3398 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3398 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3399 | StatusDialog *statdlg = new StatusDialog(this); | 3399 | StatusDialog *statdlg = new StatusDialog(this); |
3400 | if (!statdlg->exec()==QDialog::Accepted) return; | 3400 | if (!statdlg->exec()==QDialog::Accepted) return; |
3401 | me->setStatus( statdlg->status() ); | 3401 | me->setStatus( statdlg->status() ); |
3402 | delete(statdlg); | 3402 | delete(statdlg); |
3403 | } | 3403 | } |
3404 | Attendee *menew = new Attendee(*me); | 3404 | Attendee *menew = new Attendee(*me); |
3405 | if (ev) { | 3405 | if (ev) { |
3406 | ev->clearAttendees(); | 3406 | ev->clearAttendees(); |
3407 | ev->addAttendee(menew,false); | 3407 | ev->addAttendee(menew,false); |
3408 | } else { | 3408 | } else { |
3409 | if (to) { | 3409 | if (to) { |
3410 | todo->clearAttendees(); | 3410 | todo->clearAttendees(); |
3411 | todo->addAttendee(menew,false); | 3411 | todo->addAttendee(menew,false); |
3412 | } | 3412 | } |
3413 | } | 3413 | } |
3414 | } | 3414 | } |
3415 | 3415 | ||
3416 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3416 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3417 | if (ev) { | 3417 | if (ev) { |
3418 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3418 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3419 | } else { | 3419 | } else { |
3420 | if (to) { | 3420 | if (to) { |
3421 | if ( !dlg->addMessage(to,method) ) delete(to); | 3421 | if ( !dlg->addMessage(to,method) ) delete(to); |
3422 | } | 3422 | } |
3423 | } | 3423 | } |
3424 | } | 3424 | } |
3425 | 3425 | ||
3426 | void CalendarView::openAddressbook() | 3426 | void CalendarView::openAddressbook() |
3427 | { | 3427 | { |
3428 | KRun::runCommand("kaddressbook"); | 3428 | KRun::runCommand("kaddressbook"); |
3429 | } | 3429 | } |
3430 | 3430 | ||
3431 | void CalendarView::setModified(bool modified) | 3431 | void CalendarView::setModified(bool modified) |
3432 | { | 3432 | { |
3433 | if ( modified ) | 3433 | if ( modified ) |
3434 | emit signalmodified(); | 3434 | emit signalmodified(); |
3435 | if (mModified != modified) { | 3435 | if (mModified != modified) { |
3436 | mModified = modified; | 3436 | mModified = modified; |
3437 | emit modifiedChanged(mModified); | 3437 | emit modifiedChanged(mModified); |
3438 | } | 3438 | } |
3439 | } | 3439 | } |
3440 | 3440 | ||
3441 | bool CalendarView::isReadOnly() | 3441 | bool CalendarView::isReadOnly() |
3442 | { | 3442 | { |
3443 | return mReadOnly; | 3443 | return mReadOnly; |
3444 | } | 3444 | } |
3445 | 3445 | ||
3446 | void CalendarView::setReadOnly(bool readOnly) | 3446 | void CalendarView::setReadOnly(bool readOnly) |
3447 | { | 3447 | { |
3448 | if (mReadOnly != readOnly) { | 3448 | if (mReadOnly != readOnly) { |
3449 | mReadOnly = readOnly; | 3449 | mReadOnly = readOnly; |
3450 | emit readOnlyChanged(mReadOnly); | 3450 | emit readOnlyChanged(mReadOnly); |
3451 | } | 3451 | } |
3452 | } | 3452 | } |
3453 | 3453 | ||
3454 | bool CalendarView::isModified() | 3454 | bool CalendarView::isModified() |
3455 | { | 3455 | { |
3456 | return mModified; | 3456 | return mModified; |
3457 | } | 3457 | } |
3458 | void CalendarView::slotprintSelInc() | 3458 | void CalendarView::slotprintSelInc() |
3459 | { | 3459 | { |
3460 | if ( currentSelection() == 0 ) { | 3460 | if ( currentSelection() == 0 ) { |
3461 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 3461 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
3462 | return; | 3462 | return; |
3463 | } | 3463 | } |
3464 | showIncidence(); | 3464 | showIncidence(); |
3465 | getEventViewerDialog()->print(); | 3465 | getEventViewerDialog()->print(); |
3466 | 3466 | ||
3467 | } | 3467 | } |
3468 | void CalendarView::printSetup() | 3468 | void CalendarView::printSetup() |
3469 | { | 3469 | { |
3470 | #ifndef KORG_NOPRINTER | 3470 | #ifndef KORG_NOPRINTER |
3471 | createPrinter(); | 3471 | createPrinter(); |
3472 | 3472 | ||
3473 | mCalPrinter->setupPrinter(); | 3473 | mCalPrinter->setupPrinter(); |
3474 | #endif | 3474 | #endif |
3475 | } | 3475 | } |
3476 | 3476 | ||
3477 | void CalendarView::print() | 3477 | void CalendarView::print() |
3478 | { | 3478 | { |
3479 | #ifndef KORG_NOPRINTER | 3479 | #ifndef KORG_NOPRINTER |
3480 | createPrinter(); | 3480 | createPrinter(); |
3481 | 3481 | ||
3482 | DateList tmpDateList = mNavigator->selectedDates(); | 3482 | DateList tmpDateList = mNavigator->selectedDates(); |
3483 | mCalPrinter->print(CalPrinter::Month, | 3483 | mCalPrinter->print(CalPrinter::Month, |
3484 | tmpDateList.first(), tmpDateList.last()); | 3484 | tmpDateList.first(), tmpDateList.last()); |
3485 | #endif | 3485 | #endif |
3486 | } | 3486 | } |
3487 | 3487 | ||
3488 | void CalendarView::printPreview() | 3488 | void CalendarView::printPreview() |
3489 | { | 3489 | { |
3490 | #ifndef KORG_NOPRINTER | 3490 | #ifndef KORG_NOPRINTER |
3491 | kdDebug() << "CalendarView::printPreview()" << endl; | 3491 | kdDebug() << "CalendarView::printPreview()" << endl; |
3492 | 3492 | ||
3493 | createPrinter(); | 3493 | createPrinter(); |
3494 | 3494 | ||
3495 | DateList tmpDateList = mNavigator->selectedDates(); | 3495 | DateList tmpDateList = mNavigator->selectedDates(); |
3496 | 3496 | ||
3497 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3497 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3498 | tmpDateList.last()); | 3498 | tmpDateList.last()); |
3499 | #endif | 3499 | #endif |
3500 | } | 3500 | } |
3501 | 3501 | ||
3502 | void CalendarView::exportICalendar() | 3502 | void CalendarView::exportICalendar() |
3503 | { | 3503 | { |
3504 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3504 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3505 | 3505 | ||
3506 | // Force correct extension | 3506 | // Force correct extension |
3507 | if (filename.right(4) != ".ics") filename += ".ics"; | 3507 | if (filename.right(4) != ".ics") filename += ".ics"; |
3508 | 3508 | ||
3509 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3509 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3510 | storage.save(); | 3510 | storage.save(); |
3511 | } | 3511 | } |
3512 | 3512 | ||
3513 | bool CalendarView::exportVCalendar( QString filename ) | 3513 | bool CalendarView::exportVCalendar( QString filename ) |
3514 | { | 3514 | { |
3515 | if (mCalendar->journals().count() > 0) { | 3515 | if (mCalendar->journals().count() > 0) { |
3516 | int result = KMessageBox::warningContinueCancel(this, | 3516 | int result = KMessageBox::warningContinueCancel(this, |
3517 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3517 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3518 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3518 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3519 | true); | 3519 | true); |
3520 | if (result != KMessageBox::Continue) return false; | 3520 | if (result != KMessageBox::Continue) return false; |
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3523 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3524 | 3524 | ||
3525 | // Force correct extension | 3525 | // Force correct extension |
3526 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3526 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3527 | 3527 | ||
3528 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3528 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3529 | return storage.save(); | 3529 | return storage.save(); |
3530 | 3530 | ||
3531 | } | 3531 | } |
3532 | 3532 | ||
3533 | void CalendarView::eventUpdated(Incidence *) | 3533 | void CalendarView::eventUpdated(Incidence *) |
3534 | { | 3534 | { |
3535 | setModified(); | 3535 | setModified(); |
3536 | // Don't call updateView here. The code, which has caused the update of the | 3536 | // Don't call updateView here. The code, which has caused the update of the |
3537 | // event is responsible for updating the view. | 3537 | // event is responsible for updating the view. |
3538 | // updateView(); | 3538 | // updateView(); |
3539 | } | 3539 | } |
3540 | 3540 | ||
3541 | void CalendarView::adaptNavigationUnits() | 3541 | void CalendarView::adaptNavigationUnits() |
3542 | { | 3542 | { |
3543 | if (mViewManager->currentView()->isEventView()) { | 3543 | if (mViewManager->currentView()->isEventView()) { |
3544 | int days = mViewManager->currentView()->currentDateCount(); | 3544 | int days = mViewManager->currentView()->currentDateCount(); |
3545 | if (days == 1) { | 3545 | if (days == 1) { |
3546 | emit changeNavStringPrev(i18n("&Previous Day")); | 3546 | emit changeNavStringPrev(i18n("&Previous Day")); |
3547 | emit changeNavStringNext(i18n("&Next Day")); | 3547 | emit changeNavStringNext(i18n("&Next Day")); |
3548 | } else { | 3548 | } else { |
3549 | emit changeNavStringPrev(i18n("&Previous Week")); | 3549 | emit changeNavStringPrev(i18n("&Previous Week")); |
3550 | emit changeNavStringNext(i18n("&Next Week")); | 3550 | emit changeNavStringNext(i18n("&Next Week")); |
3551 | } | 3551 | } |
3552 | } | 3552 | } |
3553 | } | 3553 | } |
3554 | 3554 | ||
3555 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3555 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3556 | { | 3556 | { |
3557 | if ( incidence ) mTodoList->clearSelection(); | 3557 | if ( incidence ) mTodoList->clearSelection(); |
3558 | processIncidenceSelection( incidence ); | 3558 | processIncidenceSelection( incidence ); |
3559 | } | 3559 | } |
3560 | 3560 | ||
3561 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3561 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3562 | { | 3562 | { |
3563 | if ( incidence && mViewManager->currentView() ) { | 3563 | if ( incidence && mViewManager->currentView() ) { |
3564 | mViewManager->currentView()->clearSelection(); | 3564 | mViewManager->currentView()->clearSelection(); |
3565 | } | 3565 | } |
3566 | processIncidenceSelection( incidence ); | 3566 | processIncidenceSelection( incidence ); |
3567 | } | 3567 | } |
3568 | 3568 | ||
3569 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3569 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3570 | { | 3570 | { |
3571 | if ( incidence == mSelectedIncidence ) return; | 3571 | if ( incidence == mSelectedIncidence ) return; |
3572 | 3572 | ||
3573 | mSelectedIncidence = incidence; | 3573 | mSelectedIncidence = incidence; |
3574 | 3574 | ||
3575 | emit incidenceSelected( mSelectedIncidence ); | 3575 | emit incidenceSelected( mSelectedIncidence ); |
3576 | 3576 | ||
3577 | if ( incidence && incidence->type() == "Event" ) { | 3577 | if ( incidence && incidence->type() == "Event" ) { |
3578 | Event *event = static_cast<Event *>( incidence ); | 3578 | Event *event = static_cast<Event *>( incidence ); |
3579 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3579 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3580 | emit organizerEventsSelected( true ); | 3580 | emit organizerEventsSelected( true ); |
3581 | } else { | 3581 | } else { |
3582 | emit organizerEventsSelected(false); | 3582 | emit organizerEventsSelected(false); |
3583 | } | 3583 | } |
3584 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3584 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3585 | KOPrefs::instance()->email() ) ) { | 3585 | KOPrefs::instance()->email() ) ) { |
3586 | emit groupEventsSelected( true ); | 3586 | emit groupEventsSelected( true ); |
3587 | } else { | 3587 | } else { |
3588 | emit groupEventsSelected(false); | 3588 | emit groupEventsSelected(false); |
3589 | } | 3589 | } |
3590 | return; | 3590 | return; |
3591 | } else { | 3591 | } else { |
3592 | if ( incidence && incidence->type() == "Todo" ) { | 3592 | if ( incidence && incidence->type() == "Todo" ) { |
3593 | emit todoSelected( true ); | 3593 | emit todoSelected( true ); |
3594 | Todo *event = static_cast<Todo *>( incidence ); | 3594 | Todo *event = static_cast<Todo *>( incidence ); |
3595 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3595 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3596 | emit organizerEventsSelected( true ); | 3596 | emit organizerEventsSelected( true ); |
3597 | } else { | 3597 | } else { |
3598 | emit organizerEventsSelected(false); | 3598 | emit organizerEventsSelected(false); |
3599 | } | 3599 | } |
3600 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3600 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3601 | KOPrefs::instance()->email() ) ) { | 3601 | KOPrefs::instance()->email() ) ) { |
3602 | emit groupEventsSelected( true ); | 3602 | emit groupEventsSelected( true ); |
3603 | } else { | 3603 | } else { |
3604 | emit groupEventsSelected(false); | 3604 | emit groupEventsSelected(false); |
3605 | } | 3605 | } |
3606 | return; | 3606 | return; |
3607 | } else { | 3607 | } else { |
3608 | emit todoSelected( false ); | 3608 | emit todoSelected( false ); |
3609 | emit organizerEventsSelected(false); | 3609 | emit organizerEventsSelected(false); |
3610 | emit groupEventsSelected(false); | 3610 | emit groupEventsSelected(false); |
3611 | } | 3611 | } |
3612 | return; | 3612 | return; |
3613 | } | 3613 | } |
3614 | 3614 | ||
3615 | /* if ( incidence && incidence->type() == "Todo" ) { | 3615 | /* if ( incidence && incidence->type() == "Todo" ) { |
3616 | emit todoSelected( true ); | 3616 | emit todoSelected( true ); |
3617 | } else { | 3617 | } else { |
3618 | emit todoSelected( false ); | 3618 | emit todoSelected( false ); |
3619 | }*/ | 3619 | }*/ |
3620 | } | 3620 | } |
3621 | 3621 | ||
3622 | 3622 | ||
3623 | void CalendarView::checkClipboard() | 3623 | void CalendarView::checkClipboard() |
3624 | { | 3624 | { |
3625 | #ifndef KORG_NODND | 3625 | #ifndef KORG_NODND |
3626 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3626 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3627 | emit pasteEnabled(true); | 3627 | emit pasteEnabled(true); |
3628 | } else { | 3628 | } else { |
3629 | emit pasteEnabled(false); | 3629 | emit pasteEnabled(false); |
3630 | } | 3630 | } |
3631 | #endif | 3631 | #endif |
3632 | } | 3632 | } |
3633 | 3633 | ||
3634 | void CalendarView::showDates(const DateList &selectedDates) | 3634 | void CalendarView::showDates(const DateList &selectedDates) |
3635 | { | 3635 | { |
3636 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3636 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3637 | 3637 | ||
3638 | 3638 | ||
3639 | if ( !mBlockShowDates ) { | 3639 | if ( !mBlockShowDates ) { |
3640 | if ( mViewManager->currentView() ) { | 3640 | if ( mViewManager->currentView() ) { |
3641 | updateView( selectedDates.first(), selectedDates.last() ); | 3641 | updateView( selectedDates.first(), selectedDates.last() ); |
3642 | } else { | 3642 | } else { |
3643 | mViewManager->showAgendaView(); | 3643 | mViewManager->showAgendaView(); |
3644 | } | 3644 | } |
3645 | } | 3645 | } |
3646 | 3646 | ||
3647 | QDate date = selectedDates.first(); | 3647 | QDate date = selectedDates.first(); |
3648 | if ( ! date.isValid() ) { | 3648 | if ( ! date.isValid() ) { |
3649 | topLevelWidget()->setCaption(""); | 3649 | topLevelWidget()->setCaption(""); |
3650 | return; | 3650 | return; |
3651 | } | 3651 | } |
3652 | 3652 | ||
3653 | QString selDates; | 3653 | QString selDates; |
3654 | selDates = KGlobal::locale()->formatDate( date, true); | 3654 | selDates = KGlobal::locale()->formatDate( date, true); |
3655 | if (selectedDates.first() < selectedDates.last() ) | 3655 | if (selectedDates.first() < selectedDates.last() ) |
3656 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3656 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3657 | else { | 3657 | else { |
3658 | QString addString; | 3658 | QString addString; |
3659 | if ( date == QDateTime::currentDateTime().date() ) | 3659 | if ( date == QDateTime::currentDateTime().date() ) |
3660 | addString = i18n("Today"); | 3660 | addString = i18n("Today"); |
3661 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 3661 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3662 | addString = i18n("Tomorrow"); | 3662 | addString = i18n("Tomorrow"); |
3663 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 3663 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3664 | addString = i18n("Yesterday"); | 3664 | addString = i18n("Yesterday"); |
3665 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 3665 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3666 | addString = i18n("Day before yesterday"); | 3666 | addString = i18n("Day before yesterday"); |
3667 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 3667 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3668 | addString = i18n("Day after tomorrow"); | 3668 | addString = i18n("Day after tomorrow"); |
3669 | if ( !addString.isEmpty() ) { | 3669 | if ( !addString.isEmpty() ) { |
3670 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3670 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3671 | return; | 3671 | return; |
3672 | } | 3672 | } |
3673 | } | 3673 | } |
3674 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3674 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3675 | 3675 | ||
3676 | } | 3676 | } |
3677 | 3677 | ||
3678 | QPtrList<CalFilter> CalendarView::filters() | 3678 | QPtrList<CalFilter> CalendarView::filters() |
3679 | { | 3679 | { |
3680 | return mFilters; | 3680 | return mFilters; |
3681 | 3681 | ||
3682 | } | 3682 | } |
3683 | void CalendarView::editFilters() | 3683 | void CalendarView::editFilters() |
3684 | { | 3684 | { |
3685 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3685 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3686 | 3686 | ||
3687 | CalFilter *filter = mFilters.first(); | 3687 | CalFilter *filter = mFilters.first(); |
3688 | while(filter) { | 3688 | while(filter) { |
3689 | kdDebug() << " Filter: " << filter->name() << endl; | 3689 | kdDebug() << " Filter: " << filter->name() << endl; |
3690 | filter = mFilters.next(); | 3690 | filter = mFilters.next(); |
3691 | } | 3691 | } |
3692 | 3692 | ||
3693 | mDialogManager->showFilterEditDialog(&mFilters); | 3693 | mDialogManager->showFilterEditDialog(&mFilters); |
3694 | } | 3694 | } |
3695 | void CalendarView::toggleFilter() | 3695 | void CalendarView::toggleFilter() |
3696 | { | 3696 | { |
3697 | showFilter(! mFilterView->isVisible()); | 3697 | showFilter(! mFilterView->isVisible()); |
3698 | } | 3698 | } |
3699 | 3699 | ||
3700 | KOFilterView *CalendarView::filterView() | 3700 | KOFilterView *CalendarView::filterView() |
3701 | { | 3701 | { |
3702 | return mFilterView; | 3702 | return mFilterView; |
3703 | } | 3703 | } |
3704 | void CalendarView::selectFilter( int fil ) | 3704 | void CalendarView::selectFilter( int fil ) |
3705 | { | 3705 | { |
3706 | mFilterView->setSelectedFilter( fil ); | 3706 | mFilterView->setSelectedFilter( fil ); |
3707 | } | 3707 | } |
3708 | void CalendarView::showFilter(bool visible) | 3708 | void CalendarView::showFilter(bool visible) |
3709 | { | 3709 | { |
3710 | if (visible) mFilterView->show(); | 3710 | if (visible) mFilterView->show(); |
3711 | else mFilterView->hide(); | 3711 | else mFilterView->hide(); |
3712 | } | 3712 | } |
3713 | void CalendarView::toggleFilerEnabled( ) | 3713 | void CalendarView::toggleFilerEnabled( ) |
3714 | { | 3714 | { |
3715 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3715 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3716 | if ( !mFilterView->filtersEnabled() ) | 3716 | if ( !mFilterView->filtersEnabled() ) |
3717 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3717 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3718 | 3718 | ||
3719 | } | 3719 | } |
3720 | void CalendarView::updateFilter() | 3720 | void CalendarView::updateFilter() |
3721 | { | 3721 | { |
3722 | CalFilter *filter = mFilterView->selectedFilter(); | 3722 | CalFilter *filter = mFilterView->selectedFilter(); |
3723 | if (filter) { | 3723 | if (filter) { |
3724 | QString mess; | 3724 | QString mess; |
3725 | if (mFilterView->filtersEnabled()) { | 3725 | if (mFilterView->filtersEnabled()) { |
3726 | mess = i18n("Filter selected: ")+filter->name(); | 3726 | mess = i18n("Filter selected: ")+filter->name(); |
3727 | filter->setEnabled(true); | 3727 | filter->setEnabled(true); |
3728 | } | 3728 | } |
3729 | else filter->setEnabled(false); | 3729 | else filter->setEnabled(false); |
3730 | mCalendar->setFilter(filter); | 3730 | mCalendar->setFilter(filter); |
3731 | updateView(); | 3731 | updateView(); |
3732 | if ( !mess.isEmpty() ) | 3732 | if ( !mess.isEmpty() ) |
3733 | topLevelWidget()->setCaption( mess ); | 3733 | topLevelWidget()->setCaption( mess ); |
3734 | 3734 | ||
3735 | } | 3735 | } |
3736 | } | 3736 | } |
3737 | 3737 | ||
3738 | void CalendarView::filterEdited() | 3738 | void CalendarView::filterEdited() |
3739 | { | 3739 | { |
3740 | mFilterView->updateFilters(); | 3740 | mFilterView->updateFilters(); |
3741 | updateFilter(); | 3741 | updateFilter(); |
3742 | writeSettings(); | 3742 | writeSettings(); |
3743 | } | 3743 | } |
3744 | 3744 | ||
3745 | 3745 | ||
3746 | void CalendarView::takeOverEvent() | 3746 | void CalendarView::takeOverEvent() |
3747 | { | 3747 | { |
3748 | Incidence *incidence = currentSelection(); | 3748 | Incidence *incidence = currentSelection(); |
3749 | 3749 | ||
3750 | if (!incidence) return; | 3750 | if (!incidence) return; |
3751 | 3751 | ||
3752 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3752 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3753 | incidence->recreate(); | 3753 | incidence->recreate(); |
3754 | incidence->setReadOnly(false); | 3754 | incidence->setReadOnly(false); |
3755 | 3755 | ||
3756 | updateView(); | 3756 | updateView(); |
3757 | } | 3757 | } |
3758 | 3758 | ||
3759 | void CalendarView::takeOverCalendar() | 3759 | void CalendarView::takeOverCalendar() |
3760 | { | 3760 | { |
3761 | // TODO: Create Calendar::allIncidences() function and use it here | 3761 | // TODO: Create Calendar::allIncidences() function and use it here |
3762 | 3762 | ||
3763 | QPtrList<Event> events = mCalendar->events(); | 3763 | QPtrList<Event> events = mCalendar->events(); |
3764 | for(uint i=0; i<events.count(); ++i) { | 3764 | for(uint i=0; i<events.count(); ++i) { |
3765 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3765 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3766 | events.at(i)->recreate(); | 3766 | events.at(i)->recreate(); |
3767 | events.at(i)->setReadOnly(false); | 3767 | events.at(i)->setReadOnly(false); |
3768 | } | 3768 | } |
3769 | 3769 | ||
3770 | QPtrList<Todo> todos = mCalendar->todos(); | 3770 | QPtrList<Todo> todos = mCalendar->todos(); |
3771 | for(uint i=0; i<todos.count(); ++i) { | 3771 | for(uint i=0; i<todos.count(); ++i) { |
3772 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3772 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3773 | todos.at(i)->recreate(); | 3773 | todos.at(i)->recreate(); |
3774 | todos.at(i)->setReadOnly(false); | 3774 | todos.at(i)->setReadOnly(false); |
3775 | } | 3775 | } |
3776 | 3776 | ||
3777 | QPtrList<Journal> journals = mCalendar->journals(); | 3777 | QPtrList<Journal> journals = mCalendar->journals(); |
3778 | for(uint i=0; i<journals.count(); ++i) { | 3778 | for(uint i=0; i<journals.count(); ++i) { |
3779 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3779 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3780 | journals.at(i)->recreate(); | 3780 | journals.at(i)->recreate(); |
3781 | journals.at(i)->setReadOnly(false); | 3781 | journals.at(i)->setReadOnly(false); |
3782 | } | 3782 | } |
3783 | 3783 | ||
3784 | updateView(); | 3784 | updateView(); |
3785 | } | 3785 | } |
3786 | 3786 | ||
3787 | void CalendarView::showIntro() | 3787 | void CalendarView::showIntro() |
3788 | { | 3788 | { |
3789 | kdDebug() << "To be implemented." << endl; | 3789 | kdDebug() << "To be implemented." << endl; |
3790 | } | 3790 | } |
3791 | 3791 | ||
3792 | QWidgetStack *CalendarView::viewStack() | 3792 | QWidgetStack *CalendarView::viewStack() |
3793 | { | 3793 | { |
3794 | return mRightFrame; | 3794 | return mRightFrame; |
3795 | } | 3795 | } |
3796 | 3796 | ||
3797 | QWidget *CalendarView::leftFrame() | 3797 | QWidget *CalendarView::leftFrame() |
3798 | { | 3798 | { |
3799 | return ( QWidget *)mLeftFrame; | 3799 | return ( QWidget *)mLeftFrame; |
3800 | } | 3800 | } |
3801 | 3801 | ||
3802 | DateNavigator *CalendarView::dateNavigator() | 3802 | DateNavigator *CalendarView::dateNavigator() |
3803 | { | 3803 | { |
3804 | return mNavigator; | 3804 | return mNavigator; |
3805 | } | 3805 | } |
3806 | 3806 | ||
3807 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3807 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3808 | { | 3808 | { |
3809 | return mDateNavigator->navigatorView(); | 3809 | return mDateNavigator->navigatorView(); |
3810 | } | 3810 | } |
3811 | void CalendarView::toggleDateNavigatorWidget() | 3811 | void CalendarView::toggleDateNavigatorWidget() |
3812 | { | 3812 | { |
3813 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3813 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3814 | 3814 | ||
3815 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3815 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3816 | mDateNavigator->hide(); | 3816 | mDateNavigator->hide(); |
3817 | else | 3817 | else |
3818 | mDateNavigator->show(); | 3818 | mDateNavigator->show(); |
3819 | } | 3819 | } |
3820 | void CalendarView::addView(KOrg::BaseView *view) | 3820 | void CalendarView::addView(KOrg::BaseView *view) |
3821 | { | 3821 | { |
3822 | mViewManager->addView(view); | 3822 | mViewManager->addView(view); |
3823 | } | 3823 | } |
3824 | 3824 | ||
3825 | void CalendarView::showView(KOrg::BaseView *view) | 3825 | void CalendarView::showView(KOrg::BaseView *view) |
3826 | { | 3826 | { |
3827 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3827 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3828 | } | 3828 | } |
3829 | 3829 | ||
3830 | Incidence *CalendarView::currentSelection() | 3830 | Incidence *CalendarView::currentSelection() |
3831 | { | 3831 | { |
3832 | return mViewManager->currentSelection(); | 3832 | return mViewManager->currentSelection(); |
3833 | } | 3833 | } |
3834 | void CalendarView::toggleAllDaySize() | 3834 | void CalendarView::toggleAllDaySize() |
3835 | { | 3835 | { |
3836 | /* | 3836 | /* |
3837 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3837 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3838 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3838 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3839 | else | 3839 | else |
3840 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3840 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3841 | */ | 3841 | */ |
3842 | viewManager()->agendaView()->toggleAllDay(); | 3842 | viewManager()->agendaView()->toggleAllDay(); |
3843 | } | 3843 | } |
3844 | void CalendarView::toggleExpand() | 3844 | void CalendarView::toggleExpand() |
3845 | { | 3845 | { |
3846 | // if ( mLeftFrame->isHidden() ) { | 3846 | // if ( mLeftFrame->isHidden() ) { |
3847 | // mLeftFrame->show(); | 3847 | // mLeftFrame->show(); |
3848 | // emit calendarViewExpanded( false ); | 3848 | // emit calendarViewExpanded( false ); |
3849 | // } else { | 3849 | // } else { |
3850 | // mLeftFrame->hide(); | 3850 | // mLeftFrame->hide(); |
3851 | // emit calendarViewExpanded( true ); | 3851 | // emit calendarViewExpanded( true ); |
3852 | // } | 3852 | // } |
3853 | //qDebug(" CalendarView::toggleExpand()"); | 3853 | //qDebug(" CalendarView::toggleExpand()"); |
3854 | globalFlagBlockAgenda = 1; | 3854 | globalFlagBlockAgenda = 1; |
3855 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3855 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3856 | globalFlagBlockAgenda = 5; | 3856 | globalFlagBlockAgenda = 5; |
3857 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3857 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3858 | //mViewManager->showView( 0, true ); | 3858 | //mViewManager->showView( 0, true ); |
3859 | } | 3859 | } |
3860 | 3860 | ||
3861 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3861 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3862 | { | 3862 | { |
3863 | setModified( modified ); | 3863 | setModified( modified ); |
3864 | } | 3864 | } |
3865 | 3865 | ||
3866 | Todo *CalendarView::selectedTodo() | 3866 | Todo *CalendarView::selectedTodo() |
3867 | { | 3867 | { |
3868 | Incidence *incidence = currentSelection(); | 3868 | Incidence *incidence = currentSelection(); |
3869 | if ( incidence && incidence->type() == "Todo" ) { | 3869 | if ( incidence && incidence->type() == "Todo" ) { |
3870 | return static_cast<Todo *>( incidence ); | 3870 | return static_cast<Todo *>( incidence ); |
3871 | } | 3871 | } |
3872 | 3872 | ||
3873 | incidence = mTodoList->selectedIncidences().first(); | 3873 | incidence = mTodoList->selectedIncidences().first(); |
3874 | if ( incidence && incidence->type() == "Todo" ) { | 3874 | if ( incidence && incidence->type() == "Todo" ) { |
3875 | return static_cast<Todo *>( incidence ); | 3875 | return static_cast<Todo *>( incidence ); |
3876 | } | 3876 | } |
3877 | 3877 | ||
3878 | return 0; | 3878 | return 0; |
3879 | } | 3879 | } |
3880 | 3880 | ||
3881 | void CalendarView::dialogClosing(Incidence *in) | 3881 | void CalendarView::dialogClosing(Incidence *in) |
3882 | { | 3882 | { |
3883 | // mDialogList.remove(in); | 3883 | // mDialogList.remove(in); |
3884 | } | 3884 | } |
3885 | 3885 | ||
3886 | void CalendarView::showIncidence() | 3886 | void CalendarView::showIncidence() |
3887 | { | 3887 | { |
3888 | mViewerCallerIsSearchDialog = false; | 3888 | mViewerCallerIsSearchDialog = false; |
3889 | Incidence *incidence = currentSelection(); | 3889 | Incidence *incidence = currentSelection(); |
3890 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3890 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3891 | if ( incidence ) { | 3891 | if ( incidence ) { |
3892 | ShowIncidenceVisitor v; | 3892 | ShowIncidenceVisitor v; |
3893 | v.act( incidence, this ); | 3893 | v.act( incidence, this ); |
3894 | } | 3894 | } |
3895 | } | 3895 | } |
3896 | void CalendarView::editIncidenceDescription() | 3896 | void CalendarView::editIncidenceDescription() |
3897 | { | 3897 | { |
3898 | mFlagEditDescription = true; | 3898 | mFlagEditDescription = true; |
3899 | editIncidence(); | 3899 | editIncidence(); |
3900 | mFlagEditDescription = false; | 3900 | mFlagEditDescription = false; |
3901 | } | 3901 | } |
3902 | void CalendarView::editIncidence() | 3902 | void CalendarView::editIncidence() |
3903 | { | 3903 | { |
3904 | // qDebug("editIncidence() "); | 3904 | // qDebug("editIncidence() "); |
3905 | Incidence *incidence = currentSelection(); | 3905 | Incidence *incidence = currentSelection(); |
3906 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3906 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3907 | if ( incidence ) { | 3907 | if ( incidence ) { |
3908 | EditIncidenceVisitor v; | 3908 | EditIncidenceVisitor v; |
3909 | v.act( incidence, this ); | 3909 | v.act( incidence, this ); |
3910 | } | 3910 | } |
3911 | } | 3911 | } |
3912 | 3912 | ||
3913 | void CalendarView::deleteIncidence() | 3913 | void CalendarView::deleteIncidence() |
3914 | { | 3914 | { |
3915 | Incidence *incidence = currentSelection(); | 3915 | Incidence *incidence = currentSelection(); |
3916 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3916 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3917 | if ( incidence ) { | 3917 | if ( incidence ) { |
3918 | deleteIncidence(incidence); | 3918 | deleteIncidence(incidence); |
3919 | } | 3919 | } |
3920 | } | 3920 | } |
3921 | 3921 | ||
3922 | void CalendarView::showIncidence(Incidence *incidence) | 3922 | void CalendarView::showIncidence(Incidence *incidence) |
3923 | { | 3923 | { |
3924 | mViewerCallerIsSearchDialog = false; | 3924 | mViewerCallerIsSearchDialog = false; |
3925 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 3925 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
3926 | if ( sender() && mDialogManager->getSearchDialog() ) { | 3926 | if ( sender() && mDialogManager->getSearchDialog() ) { |
3927 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 3927 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
3928 | mViewerCallerIsSearchDialog = true; | 3928 | mViewerCallerIsSearchDialog = true; |
3929 | } | 3929 | } |
3930 | } | 3930 | } |
3931 | if ( incidence ) { | 3931 | if ( incidence ) { |
3932 | ShowIncidenceVisitor v; | 3932 | ShowIncidenceVisitor v; |
3933 | v.act( incidence, this ); | 3933 | v.act( incidence, this ); |
3934 | } | 3934 | } |
3935 | } | 3935 | } |
3936 | 3936 | ||
3937 | void CalendarView::editIncidence(Incidence *incidence) | 3937 | void CalendarView::editIncidence(Incidence *incidence) |
3938 | { | 3938 | { |
3939 | if ( incidence ) { | 3939 | if ( incidence ) { |
3940 | 3940 | ||
3941 | EditIncidenceVisitor v; | 3941 | EditIncidenceVisitor v; |
3942 | v.act( incidence, this ); | 3942 | v.act( incidence, this ); |
3943 | 3943 | ||
3944 | } | 3944 | } |
3945 | } | 3945 | } |
3946 | 3946 | ||
3947 | void CalendarView::deleteIncidence(Incidence *incidence) | 3947 | void CalendarView::deleteIncidence(Incidence *incidence) |
3948 | { | 3948 | { |
3949 | //qDebug(" CalendarView::deleteIncidence "); | 3949 | //qDebug(" CalendarView::deleteIncidence "); |
3950 | if ( incidence ) { | 3950 | if ( incidence ) { |
3951 | DeleteIncidenceVisitor v; | 3951 | DeleteIncidenceVisitor v; |
3952 | v.act( incidence, this ); | 3952 | v.act( incidence, this ); |
3953 | } | 3953 | } |
3954 | } | 3954 | } |
3955 | 3955 | ||
3956 | 3956 | ||
3957 | void CalendarView::lookForOutgoingMessages() | 3957 | void CalendarView::lookForOutgoingMessages() |
3958 | { | 3958 | { |
3959 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3959 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3960 | ogd->loadMessages(); | 3960 | ogd->loadMessages(); |
3961 | } | 3961 | } |
3962 | 3962 | ||
3963 | void CalendarView::lookForIncomingMessages() | 3963 | void CalendarView::lookForIncomingMessages() |
3964 | { | 3964 | { |
3965 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3965 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3966 | icd->retrieve(); | 3966 | icd->retrieve(); |
3967 | } | 3967 | } |
3968 | 3968 | ||
3969 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3969 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3970 | { | 3970 | { |
3971 | bool deleteTodo = true; | 3971 | bool deleteTodo = true; |
3972 | QPtrList<Incidence> subTodos; | 3972 | QPtrList<Incidence> subTodos; |
3973 | Incidence *aTodo; | 3973 | Incidence *aTodo; |
3974 | subTodos = t->relations(); | 3974 | subTodos = t->relations(); |
3975 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3975 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3976 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3976 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3977 | deleteTodo = false; | 3977 | deleteTodo = false; |
3978 | } | 3978 | } |
3979 | if ( deleteTodo ) { | 3979 | if ( deleteTodo ) { |
3980 | if ( t->isCompleted() && !t->doesRecur()) { | 3980 | if ( t->isCompleted() && !t->doesRecur()) { |
3981 | checkExternalId( t ); | 3981 | checkExternalId( t ); |
3982 | mCalendar->deleteTodo( t ); | 3982 | mCalendar->deleteTodo( t ); |
3983 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3983 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3984 | } | 3984 | } |
3985 | else | 3985 | else |
3986 | deleteTodo = false; | 3986 | deleteTodo = false; |
3987 | } | 3987 | } |
3988 | return deleteTodo; | 3988 | return deleteTodo; |
3989 | 3989 | ||
3990 | } | 3990 | } |
3991 | void CalendarView::purgeCompleted() | 3991 | void CalendarView::purgeCompleted() |
3992 | { | 3992 | { |
3993 | int result = KMessageBox::warningContinueCancel(this, | 3993 | int result = KMessageBox::warningContinueCancel(this, |
3994 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3994 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
3995 | 3995 | ||
3996 | if (result == KMessageBox::Continue) { | 3996 | if (result == KMessageBox::Continue) { |
3997 | 3997 | ||
3998 | QPtrList<Todo> todoCal; | 3998 | QPtrList<Todo> todoCal; |
3999 | QPtrList<Todo> rootTodos; | 3999 | QPtrList<Todo> rootTodos; |
4000 | //QPtrList<Incidence> rel; | 4000 | //QPtrList<Incidence> rel; |
4001 | Todo *aTodo;//, *rTodo; | 4001 | Todo *aTodo;//, *rTodo; |
4002 | Incidence *rIncidence; | 4002 | Incidence *rIncidence; |
4003 | bool childDelete = false; | 4003 | bool childDelete = false; |
4004 | bool deletedOne = true; | 4004 | bool deletedOne = true; |
4005 | todoCal = calendar()->todos(); | 4005 | todoCal = calendar()->todos(); |
4006 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 4006 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
4007 | if ( !aTodo->relatedTo() ) | 4007 | if ( !aTodo->relatedTo() ) |
4008 | rootTodos.append( aTodo ); | 4008 | rootTodos.append( aTodo ); |
4009 | } | 4009 | } |
4010 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 4010 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
4011 | removeCompletedSubTodos( aTodo ); | 4011 | removeCompletedSubTodos( aTodo ); |
4012 | } | 4012 | } |
4013 | 4013 | ||
4014 | updateView(); | 4014 | updateView(); |
4015 | } | 4015 | } |
4016 | } | 4016 | } |
4017 | 4017 | ||
4018 | void CalendarView::slotCalendarChanged() | 4018 | void CalendarView::slotCalendarChanged() |
4019 | { | 4019 | { |
4020 | ; | 4020 | ; |
4021 | } | 4021 | } |
4022 | 4022 | ||
4023 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 4023 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
4024 | { | 4024 | { |
4025 | //qDebug(" alendarView::keyPressEvent "); | 4025 | //qDebug(" alendarView::keyPressEvent "); |
4026 | e->ignore(); | 4026 | e->ignore(); |
4027 | } | 4027 | } |
4028 | 4028 | ||
4029 | 4029 | ||
4030 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 4030 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
4031 | { | 4031 | { |
4032 | // mSyncManager = manager; | 4032 | // mSyncManager = manager; |
4033 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 4033 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
4034 | qDebug("KO: SyncKDE request detected!"); | 4034 | qDebug("KO: SyncKDE request detected!"); |
4035 | } | 4035 | } |
4036 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4036 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4037 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4037 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4038 | return syncCalendar( filename, mode ); | 4038 | return syncCalendar( filename, mode ); |
4039 | } | 4039 | } |
4040 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4040 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
4041 | { | 4041 | { |
4042 | //mSyncManager = manager; | 4042 | //mSyncManager = manager; |
4043 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4043 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4044 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4044 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4045 | if ( resource == "sharp" ) | 4045 | if ( resource == "sharp" ) |
4046 | syncExternal( 0 ); | 4046 | syncExternal( 0 ); |
4047 | if ( resource == "phone" ) | 4047 | if ( resource == "phone" ) |
4048 | syncExternal( 1 ); | 4048 | syncExternal( 1 ); |
4049 | // pending setmodified | 4049 | // pending setmodified |
4050 | return true; | 4050 | return true; |
4051 | } | 4051 | } |
4052 | void CalendarView::setSyncManager(KSyncManager* manager) | 4052 | void CalendarView::setSyncManager(KSyncManager* manager) |
4053 | { | 4053 | { |
4054 | mSyncManager = manager; | 4054 | mSyncManager = manager; |
4055 | } | 4055 | } |
4056 | 4056 | ||
4057 | void CalendarView::removeSyncInfo( QString syncProfile) | 4057 | void CalendarView::removeSyncInfo( QString syncProfile) |
4058 | { | 4058 | { |
4059 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4059 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4060 | mCalendar->removeSyncInfo( syncProfile ); | 4060 | mCalendar->removeSyncInfo( syncProfile ); |
4061 | 4061 | ||
4062 | } | 4062 | } |
4063 | 4063 | ||
4064 | void CalendarView::undo_delete() | 4064 | void CalendarView::undo_delete() |
4065 | { | 4065 | { |
4066 | //qDebug("undo_delete() "); | 4066 | //qDebug("undo_delete() "); |
4067 | Incidence* undo = mCalendar->undoIncidence(); | 4067 | Incidence* undo = mCalendar->undoIncidence(); |
4068 | if ( !undo ) { | 4068 | if ( !undo ) { |
4069 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4069 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4070 | i18n("KO/Pi")); | 4070 | i18n("KO/Pi")); |
4071 | return; | 4071 | return; |
4072 | } | 4072 | } |
4073 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 4073 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
4074 | i18n("\nAre you sure you want\nto restore this?"), | 4074 | i18n("\nAre you sure you want\nto restore this?"), |
4075 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4075 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4076 | mCalendar->undoDeleteIncidence(); | 4076 | mCalendar->undoDeleteIncidence(); |
4077 | updateView(); | 4077 | updateView(); |
4078 | } | 4078 | } |
4079 | } | 4079 | } |
4080 | 4080 | ||
4081 | void CalendarView::slotViewerClosed() | 4081 | void CalendarView::slotViewerClosed() |
4082 | { | 4082 | { |
4083 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4083 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4084 | } | 4084 | } |
4085 | 4085 | ||
4086 | void CalendarView::resetFocus() | 4086 | void CalendarView::resetFocus() |
4087 | { | 4087 | { |
4088 | if ( mViewerCallerIsSearchDialog ) { | 4088 | if ( mViewerCallerIsSearchDialog ) { |
4089 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 4089 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
4090 | mDialogManager->getSearchDialog()->raise(); | 4090 | mDialogManager->getSearchDialog()->raise(); |
4091 | mDialogManager->getSearchDialog()->setActiveWindow(); | 4091 | mDialogManager->getSearchDialog()->setActiveWindow(); |
4092 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 4092 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
4093 | } else | 4093 | } else |
4094 | mViewerCallerIsSearchDialog = false; | 4094 | mViewerCallerIsSearchDialog = false; |
4095 | } | 4095 | } |
4096 | if ( !mViewerCallerIsSearchDialog ) { | 4096 | if ( !mViewerCallerIsSearchDialog ) { |
4097 | //mViewManager->currentView()->setFocus(); | 4097 | //mViewManager->currentView()->setFocus(); |
4098 | //qDebug("sssssssssssssssset focus "); | 4098 | //qDebug("sssssssssssssssset focus "); |
4099 | topLevelWidget()->raise(); | 4099 | topLevelWidget()->raise(); |
4100 | setActiveWindow(); | 4100 | setActiveWindow(); |
4101 | //setFocus(); | 4101 | //setFocus(); |
4102 | } | 4102 | } |
4103 | mViewerCallerIsSearchDialog = false; | 4103 | mViewerCallerIsSearchDialog = false; |
4104 | } | 4104 | } |
4105 | 4105 | ||
4106 | void CalendarView::showNextAlarms() | 4106 | void CalendarView::showNextAlarms() |
4107 | { | 4107 | { |
4108 | QString message; | 4108 | QString message; |
4109 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); | 4109 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); |
4110 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { | 4110 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { |
4111 | QString sum = mCalendar->nextSummary(); | 4111 | QString sum = mCalendar->nextSummary(); |
4112 | QDateTime nextA = mNextAlarmDateTime; | 4112 | QDateTime nextA = mNextAlarmDateTime; |
4113 | QDateTime cur = QDateTime::currentDateTime(); | 4113 | QDateTime cur = QDateTime::currentDateTime(); |
4114 | int secs = cur.secsTo( nextA ); | 4114 | int secs = cur.secsTo( nextA ); |
4115 | int min = secs /60; | 4115 | int min = secs /60; |
4116 | int hours = min /60; | 4116 | int hours = min /60; |
4117 | min = min % 60; | 4117 | min = min % 60; |
4118 | int days = hours /24; | 4118 | int days = hours /24; |
4119 | hours = hours % 24; | 4119 | hours = hours % 24; |
4120 | 4120 | ||
4121 | //message = i18n("The next alarm is in:\n"); | 4121 | //message = i18n("The next alarm is in:\n"); |
4122 | if ( days > 1 ) | 4122 | if ( days > 1 ) |
4123 | message += i18n("%1 days\n").arg( days ); | 4123 | message += i18n("%1 days\n").arg( days ); |
4124 | else if ( days == 1 ) | 4124 | else if ( days == 1 ) |
4125 | message += i18n("1 day\n"); | 4125 | message += i18n("1 day\n"); |
4126 | if ( hours > 1 ) | 4126 | if ( hours > 1 ) |
4127 | message += i18n("%1 hours\n").arg( hours ); | 4127 | message += i18n("%1 hours\n").arg( hours ); |
4128 | else if ( hours == 1 ) | 4128 | else if ( hours == 1 ) |
4129 | message += i18n("1 hour\n"); | 4129 | message += i18n("1 hour\n"); |
4130 | if ( min > 1 ) | 4130 | if ( min > 1 ) |
4131 | message += i18n("%1 minutes\n").arg( min ); | 4131 | message += i18n("%1 minutes\n").arg( min ); |
4132 | else if ( min == 1 ) | 4132 | else if ( min == 1 ) |
4133 | message += i18n("1 minute\n"); | 4133 | message += i18n("1 minute\n"); |
4134 | if ( message.isEmpty() ) | 4134 | if ( message.isEmpty() ) |
4135 | message = i18n("The next alarm is in\nless than one minute!"); | 4135 | message = i18n("The next alarm is in\nless than one minute!"); |
4136 | else | 4136 | else |
4137 | message = i18n("The next alarm is in:\n") + message; | 4137 | message = i18n("The next alarm is in:\n") + message; |
4138 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; | 4138 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; |
4139 | } else { | 4139 | } else { |
4140 | message = i18n("There is no next alarm."); | 4140 | message = i18n("There is no next alarm."); |
4141 | 4141 | ||
4142 | } | 4142 | } |
4143 | #ifdef DESKTOP_VERSION | 4143 | #ifdef DESKTOP_VERSION |
4144 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 4144 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
4145 | message += i18n("\nThe internal alarm notification is disabled!\n"); | 4145 | message += i18n("\nThe internal alarm notification is disabled!\n"); |
4146 | message += i18n("Enable it in the settings menu, TAB alarm."); | 4146 | message += i18n("Enable it in the settings menu, TAB alarm."); |
4147 | } | 4147 | } |
4148 | 4148 | ||
4149 | #endif | 4149 | #endif |
4150 | KMessageBox::information( this, message); | 4150 | KMessageBox::information( this, message); |
4151 | } | 4151 | } |