summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-16 11:32:35 (UTC)
committer zautrix <zautrix>2005-06-16 11:32:35 (UTC)
commitc0384f1ed99f108d7b2120900ff7d7f090ad6250 (patch) (unidiff)
tree9a02c76a023c6dd94273b21dc9d3621549790d55
parent9f60da2b6768e94d2aeb2f94a4479b6678f2aa76 (diff)
downloadkdepimpi-c0384f1ed99f108d7b2120900ff7d7f090ad6250.zip
kdepimpi-c0384f1ed99f108d7b2120900ff7d7f090ad6250.tar.gz
kdepimpi-c0384f1ed99f108d7b2120900ff7d7f090ad6250.tar.bz2
fixxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp2
3 files changed, 4 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 2012e92..eac2f29 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3257,1261 +3257,1263 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog()
3257 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 3257 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
3258 this, SLOT( todoChanged(Todo *) ) ); 3258 this, SLOT( todoChanged(Todo *) ) );
3259 mEventViewerDialog->resize( 640, 480 ); 3259 mEventViewerDialog->resize( 640, 480 );
3260 3260
3261 } 3261 }
3262 return mEventViewerDialog; 3262 return mEventViewerDialog;
3263} 3263}
3264void CalendarView::showEvent(Event *event) 3264void CalendarView::showEvent(Event *event)
3265{ 3265{
3266 getEventViewerDialog()->setEvent(event); 3266 getEventViewerDialog()->setEvent(event);
3267 getEventViewerDialog()->showMe(); 3267 getEventViewerDialog()->showMe();
3268} 3268}
3269 3269
3270void CalendarView::showTodo(Todo *event) 3270void CalendarView::showTodo(Todo *event)
3271{ 3271{
3272 getEventViewerDialog()->setTodo(event); 3272 getEventViewerDialog()->setTodo(event);
3273 getEventViewerDialog()->showMe(); 3273 getEventViewerDialog()->showMe();
3274} 3274}
3275void CalendarView::showJournal( Journal *jour ) 3275void CalendarView::showJournal( Journal *jour )
3276{ 3276{
3277 getEventViewerDialog()->setJournal(jour); 3277 getEventViewerDialog()->setJournal(jour);
3278 getEventViewerDialog()->showMe(); 3278 getEventViewerDialog()->showMe();
3279 3279
3280} 3280}
3281// void CalendarView::todoModified (Todo *event, int changed) 3281// void CalendarView::todoModified (Todo *event, int changed)
3282// { 3282// {
3283// // if (mDialogList.find (event) != mDialogList.end ()) { 3283// // if (mDialogList.find (event) != mDialogList.end ()) {
3284// // kdDebug() << "Todo modified and open" << endl; 3284// // kdDebug() << "Todo modified and open" << endl;
3285// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 3285// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
3286// // temp->modified (changed); 3286// // temp->modified (changed);
3287 3287
3288// // } 3288// // }
3289 3289
3290// mViewManager->updateView(); 3290// mViewManager->updateView();
3291// } 3291// }
3292 3292
3293void CalendarView::appointment_show() 3293void CalendarView::appointment_show()
3294{ 3294{
3295 Event *anEvent = 0; 3295 Event *anEvent = 0;
3296 3296
3297 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3297 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3298 3298
3299 if (mViewManager->currentView()->isEventView()) { 3299 if (mViewManager->currentView()->isEventView()) {
3300 if ( incidence && incidence->typeID() == eventID ) { 3300 if ( incidence && incidence->typeID() == eventID ) {
3301 anEvent = static_cast<Event *>(incidence); 3301 anEvent = static_cast<Event *>(incidence);
3302 } 3302 }
3303 } 3303 }
3304 3304
3305 if (!anEvent) { 3305 if (!anEvent) {
3306 KNotifyClient::beep(); 3306 KNotifyClient::beep();
3307 return; 3307 return;
3308 } 3308 }
3309 3309
3310 showEvent(anEvent); 3310 showEvent(anEvent);
3311} 3311}
3312 3312
3313void CalendarView::appointment_edit() 3313void CalendarView::appointment_edit()
3314{ 3314{
3315 Event *anEvent = 0; 3315 Event *anEvent = 0;
3316 3316
3317 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3317 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3318 3318
3319 if (mViewManager->currentView()->isEventView()) { 3319 if (mViewManager->currentView()->isEventView()) {
3320 if ( incidence && incidence->typeID() == eventID ) { 3320 if ( incidence && incidence->typeID() == eventID ) {
3321 anEvent = static_cast<Event *>(incidence); 3321 anEvent = static_cast<Event *>(incidence);
3322 } 3322 }
3323 } 3323 }
3324 3324
3325 if (!anEvent) { 3325 if (!anEvent) {
3326 KNotifyClient::beep(); 3326 KNotifyClient::beep();
3327 return; 3327 return;
3328 } 3328 }
3329 3329
3330 editEvent(anEvent); 3330 editEvent(anEvent);
3331} 3331}
3332 3332
3333void CalendarView::appointment_delete() 3333void CalendarView::appointment_delete()
3334{ 3334{
3335 Event *anEvent = 0; 3335 Event *anEvent = 0;
3336 3336
3337 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3337 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3338 3338
3339 if (mViewManager->currentView()->isEventView()) { 3339 if (mViewManager->currentView()->isEventView()) {
3340 if ( incidence && incidence->typeID() == eventID ) { 3340 if ( incidence && incidence->typeID() == eventID ) {
3341 anEvent = static_cast<Event *>(incidence); 3341 anEvent = static_cast<Event *>(incidence);
3342 } 3342 }
3343 } 3343 }
3344 3344
3345 if (!anEvent) { 3345 if (!anEvent) {
3346 KNotifyClient::beep(); 3346 KNotifyClient::beep();
3347 return; 3347 return;
3348 } 3348 }
3349 3349
3350 deleteEvent(anEvent); 3350 deleteEvent(anEvent);
3351} 3351}
3352 3352
3353void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3353void CalendarView::todo_resub( Todo * parent, Todo * sub )
3354{ 3354{
3355 if (!sub) return; 3355 if (!sub) return;
3356 if ( sub->relatedTo() == parent ) 3356 if ( sub->relatedTo() == parent )
3357 return; 3357 return;
3358 sub->setRelatedTo(parent); 3358 sub->setRelatedTo(parent);
3359 sub->updated(); 3359 sub->updated();
3360 setModified(true); 3360 setModified(true);
3361 updateView(); 3361 updateView();
3362} 3362}
3363void CalendarView::todo_unsub(Todo *anTodo ) 3363void CalendarView::todo_unsub(Todo *anTodo )
3364{ 3364{
3365 todo_resub( 0, anTodo ); 3365 todo_resub( 0, anTodo );
3366} 3366}
3367 3367
3368void CalendarView::deleteTodo(Todo *todo) 3368void CalendarView::deleteTodo(Todo *todo)
3369{ 3369{
3370 if (!todo) { 3370 if (!todo) {
3371 KNotifyClient::beep(); 3371 KNotifyClient::beep();
3372 return; 3372 return;
3373 } 3373 }
3374 if (KOPrefs::instance()->mConfirm) { 3374 if (KOPrefs::instance()->mConfirm) {
3375 QString text = todo->summary().left(20); 3375 QString text = todo->summary().left(20);
3376 if (!todo->relations().isEmpty()) { 3376 if (!todo->relations().isEmpty()) {
3377 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 3377 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
3378 3378
3379 } 3379 }
3380 switch (msgItemDelete(text)) { 3380 switch (msgItemDelete(text)) {
3381 case KMessageBox::Continue: // OK 3381 case KMessageBox::Continue: // OK
3382 bool deleteT = false; 3382 bool deleteT = false;
3383 if (!todo->relations().isEmpty()) { 3383 if (!todo->relations().isEmpty()) {
3384 deleteT = removeCompletedSubTodos( todo ); 3384 deleteT = removeCompletedSubTodos( todo );
3385 } 3385 }
3386 // deleteT == true: todo already deleted in removeCompletedSubTodos 3386 // deleteT == true: todo already deleted in removeCompletedSubTodos
3387 if ( !deleteT ) { 3387 if ( !deleteT ) {
3388 checkExternalId( todo ); 3388 checkExternalId( todo );
3389 calendar()->deleteTodo(todo); 3389 calendar()->deleteTodo(todo);
3390 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3390 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3391 updateView(); 3391 updateView();
3392 } 3392 }
3393 break; 3393 break;
3394 } // switch 3394 } // switch
3395 } else { 3395 } else {
3396 checkExternalId( todo ); 3396 checkExternalId( todo );
3397 mCalendar->deleteTodo(todo); 3397 mCalendar->deleteTodo(todo);
3398 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3398 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3399 updateView(); 3399 updateView();
3400 } 3400 }
3401 3401
3402 emit updateSearchDialog(); 3402 emit updateSearchDialog();
3403} 3403}
3404void CalendarView::deleteJournal(Journal *jour) 3404void CalendarView::deleteJournal(Journal *jour)
3405{ 3405{
3406 if (!jour) { 3406 if (!jour) {
3407 KNotifyClient::beep(); 3407 KNotifyClient::beep();
3408 return; 3408 return;
3409 } 3409 }
3410 if (KOPrefs::instance()->mConfirm) { 3410 if (KOPrefs::instance()->mConfirm) {
3411 switch (msgItemDelete( jour->description().left(20))) { 3411 switch (msgItemDelete( jour->description().left(20))) {
3412 case KMessageBox::Continue: // OK 3412 case KMessageBox::Continue: // OK
3413 calendar()->deleteJournal(jour); 3413 calendar()->deleteJournal(jour);
3414 updateView(); 3414 updateView();
3415 break; 3415 break;
3416 } // switch 3416 } // switch
3417 } else { 3417 } else {
3418 calendar()->deleteJournal(jour);; 3418 calendar()->deleteJournal(jour);;
3419 updateView(); 3419 updateView();
3420 } 3420 }
3421 emit updateSearchDialog(); 3421 emit updateSearchDialog();
3422} 3422}
3423 3423
3424void CalendarView::deleteEvent(Event *anEvent) 3424void CalendarView::deleteEvent(Event *anEvent)
3425{ 3425{
3426 if (!anEvent) { 3426 if (!anEvent) {
3427 KNotifyClient::beep(); 3427 KNotifyClient::beep();
3428 return; 3428 return;
3429 } 3429 }
3430 3430
3431 if (anEvent->recurrence()->doesRecur()) { 3431 if (anEvent->recurrence()->doesRecur()) {
3432 QDate itemDate = mViewManager->currentSelectionDate(); 3432 QDate itemDate = mViewManager->currentSelectionDate();
3433 int km; 3433 int km;
3434 if (!itemDate.isValid()) { 3434 if (!itemDate.isValid()) {
3435 //kdDebug() << "Date Not Valid" << endl; 3435 //kdDebug() << "Date Not Valid" << endl;
3436 if (KOPrefs::instance()->mConfirm) { 3436 if (KOPrefs::instance()->mConfirm) {
3437 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3437 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3438 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 3438 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
3439 i18n("KO/Pi Confirmation"),i18n("Delete All")); 3439 i18n("KO/Pi Confirmation"),i18n("Delete All"));
3440 if ( km == KMessageBox::Continue ) 3440 if ( km == KMessageBox::Continue )
3441 km = KMessageBox::No; // No = all below 3441 km = KMessageBox::No; // No = all below
3442 } else 3442 } else
3443 km = KMessageBox::No; 3443 km = KMessageBox::No;
3444 } else { 3444 } else {
3445 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 3445 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
3446 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 3446 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
3447 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 3447 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
3448 i18n("KO/Pi Confirmation"),i18n("Current"), 3448 i18n("KO/Pi Confirmation"),i18n("Current"),
3449 i18n("All")); 3449 i18n("All"));
3450 } 3450 }
3451 switch(km) { 3451 switch(km) {
3452 3452
3453 case KMessageBox::No: // Continue // all 3453 case KMessageBox::No: // Continue // all
3454 //qDebug("KMessageBox::No "); 3454 //qDebug("KMessageBox::No ");
3455 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3455 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3456 schedule(Scheduler::Cancel,anEvent); 3456 schedule(Scheduler::Cancel,anEvent);
3457 3457
3458 checkExternalId( anEvent); 3458 checkExternalId( anEvent);
3459 mCalendar->deleteEvent(anEvent); 3459 mCalendar->deleteEvent(anEvent);
3460 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 3460 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
3461 break; 3461 break;
3462 3462
3463 // Disabled because it does not work 3463 // Disabled because it does not work
3464 //#if 0 3464 //#if 0
3465 case KMessageBox::Yes: // just this one 3465 case KMessageBox::Yes: // just this one
3466 //QDate qd = mNavigator->selectedDates().first(); 3466 //QDate qd = mNavigator->selectedDates().first();
3467 //if (!qd.isValid()) { 3467 //if (!qd.isValid()) {
3468 // kdDebug() << "no date selected, or invalid date" << endl; 3468 // kdDebug() << "no date selected, or invalid date" << endl;
3469 // KNotifyClient::beep(); 3469 // KNotifyClient::beep();
3470 // return; 3470 // return;
3471 //} 3471 //}
3472 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 3472 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
3473 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 3473 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
3474 anEvent->addExDate(itemDate); 3474 anEvent->addExDate(itemDate);
3475 int duration = anEvent->recurrence()->duration(); 3475 int duration = anEvent->recurrence()->duration();
3476 if ( duration > 0 ) { 3476 if ( duration > 0 ) {
3477 anEvent->recurrence()->setDuration( duration - 1 ); 3477 anEvent->recurrence()->setDuration( duration - 1 );
3478 } 3478 }
3479 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 3479 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
3480 } 3480 }
3481 break; 3481 break;
3482 //#endif 3482 //#endif
3483 } // switch 3483 } // switch
3484 } else { 3484 } else {
3485 if (KOPrefs::instance()->mConfirm) { 3485 if (KOPrefs::instance()->mConfirm) {
3486 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3486 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3487 i18n("\nAre you sure you want\nto delete this event?"), 3487 i18n("\nAre you sure you want\nto delete this event?"),
3488 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3488 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3489 case KMessageBox::Continue: // OK 3489 case KMessageBox::Continue: // OK
3490 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3490 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3491 schedule(Scheduler::Cancel,anEvent); 3491 schedule(Scheduler::Cancel,anEvent);
3492 checkExternalId( anEvent); 3492 checkExternalId( anEvent);
3493 mCalendar->deleteEvent(anEvent); 3493 mCalendar->deleteEvent(anEvent);
3494 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3494 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3495 break; 3495 break;
3496 } // switch 3496 } // switch
3497 } else { 3497 } else {
3498 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3498 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3499 schedule(Scheduler::Cancel,anEvent); 3499 schedule(Scheduler::Cancel,anEvent);
3500 checkExternalId( anEvent); 3500 checkExternalId( anEvent);
3501 mCalendar->deleteEvent(anEvent); 3501 mCalendar->deleteEvent(anEvent);
3502 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3502 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3503 } 3503 }
3504 } // if-else 3504 } // if-else
3505 emit updateSearchDialog(); 3505 emit updateSearchDialog();
3506} 3506}
3507 3507
3508bool CalendarView::deleteEvent(const QString &uid) 3508bool CalendarView::deleteEvent(const QString &uid)
3509{ 3509{
3510 Event *ev = mCalendar->event(uid); 3510 Event *ev = mCalendar->event(uid);
3511 if (ev) { 3511 if (ev) {
3512 deleteEvent(ev); 3512 deleteEvent(ev);
3513 return true; 3513 return true;
3514 } else { 3514 } else {
3515 return false; 3515 return false;
3516 } 3516 }
3517} 3517}
3518 3518
3519/*****************************************************************************/ 3519/*****************************************************************************/
3520 3520
3521void CalendarView::action_mail() 3521void CalendarView::action_mail()
3522{ 3522{
3523#ifndef KORG_NOMAIL 3523#ifndef KORG_NOMAIL
3524 KOMailClient mailClient; 3524 KOMailClient mailClient;
3525 3525
3526 Incidence *incidence = currentSelection(); 3526 Incidence *incidence = currentSelection();
3527 3527
3528 if (!incidence) { 3528 if (!incidence) {
3529 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3529 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3530 return; 3530 return;
3531 } 3531 }
3532 if(incidence->attendeeCount() == 0 ) { 3532 if(incidence->attendeeCount() == 0 ) {
3533 KMessageBox::sorry(this, 3533 KMessageBox::sorry(this,
3534 i18n("Can't generate mail:\nNo attendees defined.\n")); 3534 i18n("Can't generate mail:\nNo attendees defined.\n"));
3535 return; 3535 return;
3536 } 3536 }
3537 3537
3538 CalendarLocal cal_tmp; 3538 CalendarLocal cal_tmp;
3539 Event *event = 0; 3539 Event *event = 0;
3540 Event *ev = 0; 3540 Event *ev = 0;
3541 if ( incidence && incidence->typeID() == eventID ) { 3541 if ( incidence && incidence->typeID() == eventID ) {
3542 event = static_cast<Event *>(incidence); 3542 event = static_cast<Event *>(incidence);
3543 ev = new Event(*event); 3543 ev = new Event(*event);
3544 cal_tmp.addEvent(ev); 3544 cal_tmp.addEvent(ev);
3545 } 3545 }
3546 ICalFormat mForm(); 3546 ICalFormat mForm();
3547 QString attachment = mForm.toString( &cal_tmp ); 3547 QString attachment = mForm.toString( &cal_tmp );
3548 if (ev) delete(ev); 3548 if (ev) delete(ev);
3549 3549
3550 mailClient.mailAttendees(currentSelection(), attachment); 3550 mailClient.mailAttendees(currentSelection(), attachment);
3551 3551
3552#endif 3552#endif
3553 3553
3554#if 0 3554#if 0
3555 Event *anEvent = 0; 3555 Event *anEvent = 0;
3556 if (mViewManager->currentView()->isEventView()) { 3556 if (mViewManager->currentView()->isEventView()) {
3557 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3557 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3558 } 3558 }
3559 3559
3560 if (!anEvent) { 3560 if (!anEvent) {
3561 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3561 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3562 return; 3562 return;
3563 } 3563 }
3564 if(anEvent->attendeeCount() == 0 ) { 3564 if(anEvent->attendeeCount() == 0 ) {
3565 KMessageBox::sorry(this, 3565 KMessageBox::sorry(this,
3566 i18n("Can't generate mail:\nNo attendees defined.\n")); 3566 i18n("Can't generate mail:\nNo attendees defined.\n"));
3567 return; 3567 return;
3568 } 3568 }
3569 3569
3570 mailobject.emailEvent(anEvent); 3570 mailobject.emailEvent(anEvent);
3571#endif 3571#endif
3572} 3572}
3573 3573
3574 3574
3575void CalendarView::schedule_publish(Incidence *incidence) 3575void CalendarView::schedule_publish(Incidence *incidence)
3576{ 3576{
3577 Event *event = 0; 3577 Event *event = 0;
3578 Todo *todo = 0; 3578 Todo *todo = 0;
3579 3579
3580 if (incidence == 0) { 3580 if (incidence == 0) {
3581 incidence = mViewManager->currentView()->selectedIncidences().first(); 3581 incidence = mViewManager->currentView()->selectedIncidences().first();
3582 if (incidence == 0) { 3582 if (incidence == 0) {
3583 incidence = mTodoList->selectedIncidences().first(); 3583 incidence = mTodoList->selectedIncidences().first();
3584 } 3584 }
3585 } 3585 }
3586 if ( incidence && incidence->typeID() == eventID ) { 3586 if ( incidence && incidence->typeID() == eventID ) {
3587 event = static_cast<Event *>(incidence); 3587 event = static_cast<Event *>(incidence);
3588 } else { 3588 } else {
3589 if ( incidence && incidence->typeID() == todoID ) { 3589 if ( incidence && incidence->typeID() == todoID ) {
3590 todo = static_cast<Todo *>(incidence); 3590 todo = static_cast<Todo *>(incidence);
3591 } 3591 }
3592 } 3592 }
3593 3593
3594 if (!event && !todo) { 3594 if (!event && !todo) {
3595 KMessageBox::sorry(this,i18n("No event selected.")); 3595 KMessageBox::sorry(this,i18n("No event selected."));
3596 return; 3596 return;
3597 } 3597 }
3598 3598
3599 PublishDialog *publishdlg = new PublishDialog(); 3599 PublishDialog *publishdlg = new PublishDialog();
3600 if (incidence->attendeeCount()>0) { 3600 if (incidence->attendeeCount()>0) {
3601 QPtrList<Attendee> attendees = incidence->attendees(); 3601 QPtrList<Attendee> attendees = incidence->attendees();
3602 attendees.first(); 3602 attendees.first();
3603 while ( attendees.current()!=0 ) { 3603 while ( attendees.current()!=0 ) {
3604 publishdlg->addAttendee(attendees.current()); 3604 publishdlg->addAttendee(attendees.current());
3605 attendees.next(); 3605 attendees.next();
3606 } 3606 }
3607 } 3607 }
3608 bool send = true; 3608 bool send = true;
3609 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3609 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3610 if ( publishdlg->exec() != QDialog::Accepted ) 3610 if ( publishdlg->exec() != QDialog::Accepted )
3611 send = false; 3611 send = false;
3612 } 3612 }
3613 if ( send ) { 3613 if ( send ) {
3614 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3614 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3615 if ( event ) { 3615 if ( event ) {
3616 Event *ev = new Event(*event); 3616 Event *ev = new Event(*event);
3617 ev->registerObserver(0); 3617 ev->registerObserver(0);
3618 ev->clearAttendees(); 3618 ev->clearAttendees();
3619 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3619 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3620 delete(ev); 3620 delete(ev);
3621 } 3621 }
3622 } else { 3622 } else {
3623 if ( todo ) { 3623 if ( todo ) {
3624 Todo *ev = new Todo(*todo); 3624 Todo *ev = new Todo(*todo);
3625 ev->registerObserver(0); 3625 ev->registerObserver(0);
3626 ev->clearAttendees(); 3626 ev->clearAttendees();
3627 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3627 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3628 delete(ev); 3628 delete(ev);
3629 } 3629 }
3630 } 3630 }
3631 } 3631 }
3632 } 3632 }
3633 delete publishdlg; 3633 delete publishdlg;
3634} 3634}
3635 3635
3636void CalendarView::schedule_request(Incidence *incidence) 3636void CalendarView::schedule_request(Incidence *incidence)
3637{ 3637{
3638 schedule(Scheduler::Request,incidence); 3638 schedule(Scheduler::Request,incidence);
3639} 3639}
3640 3640
3641void CalendarView::schedule_refresh(Incidence *incidence) 3641void CalendarView::schedule_refresh(Incidence *incidence)
3642{ 3642{
3643 schedule(Scheduler::Refresh,incidence); 3643 schedule(Scheduler::Refresh,incidence);
3644} 3644}
3645 3645
3646void CalendarView::schedule_cancel(Incidence *incidence) 3646void CalendarView::schedule_cancel(Incidence *incidence)
3647{ 3647{
3648 schedule(Scheduler::Cancel,incidence); 3648 schedule(Scheduler::Cancel,incidence);
3649} 3649}
3650 3650
3651void CalendarView::schedule_add(Incidence *incidence) 3651void CalendarView::schedule_add(Incidence *incidence)
3652{ 3652{
3653 schedule(Scheduler::Add,incidence); 3653 schedule(Scheduler::Add,incidence);
3654} 3654}
3655 3655
3656void CalendarView::schedule_reply(Incidence *incidence) 3656void CalendarView::schedule_reply(Incidence *incidence)
3657{ 3657{
3658 schedule(Scheduler::Reply,incidence); 3658 schedule(Scheduler::Reply,incidence);
3659} 3659}
3660 3660
3661void CalendarView::schedule_counter(Incidence *incidence) 3661void CalendarView::schedule_counter(Incidence *incidence)
3662{ 3662{
3663 schedule(Scheduler::Counter,incidence); 3663 schedule(Scheduler::Counter,incidence);
3664} 3664}
3665 3665
3666void CalendarView::schedule_declinecounter(Incidence *incidence) 3666void CalendarView::schedule_declinecounter(Incidence *incidence)
3667{ 3667{
3668 schedule(Scheduler::Declinecounter,incidence); 3668 schedule(Scheduler::Declinecounter,incidence);
3669} 3669}
3670 3670
3671void CalendarView::schedule_publish_freebusy(int daysToPublish) 3671void CalendarView::schedule_publish_freebusy(int daysToPublish)
3672{ 3672{
3673 QDateTime start = QDateTime::currentDateTime(); 3673 QDateTime start = QDateTime::currentDateTime();
3674 QDateTime end = start.addDays(daysToPublish); 3674 QDateTime end = start.addDays(daysToPublish);
3675 3675
3676 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3676 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3677 freebusy->setOrganizer(KOPrefs::instance()->email()); 3677 freebusy->setOrganizer(KOPrefs::instance()->email());
3678 3678
3679 3679
3680 PublishDialog *publishdlg = new PublishDialog(); 3680 PublishDialog *publishdlg = new PublishDialog();
3681 if ( publishdlg->exec() == QDialog::Accepted ) { 3681 if ( publishdlg->exec() == QDialog::Accepted ) {
3682 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3682 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3683 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3683 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3684 delete(freebusy); 3684 delete(freebusy);
3685 } 3685 }
3686 } 3686 }
3687 delete publishdlg; 3687 delete publishdlg;
3688} 3688}
3689 3689
3690void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3690void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3691{ 3691{
3692 Event *event = 0; 3692 Event *event = 0;
3693 Todo *todo = 0; 3693 Todo *todo = 0;
3694 3694
3695 if (incidence == 0) { 3695 if (incidence == 0) {
3696 incidence = mViewManager->currentView()->selectedIncidences().first(); 3696 incidence = mViewManager->currentView()->selectedIncidences().first();
3697 if (incidence == 0) { 3697 if (incidence == 0) {
3698 incidence = mTodoList->selectedIncidences().first(); 3698 incidence = mTodoList->selectedIncidences().first();
3699 } 3699 }
3700 } 3700 }
3701 if ( incidence && incidence->typeID() == eventID ) { 3701 if ( incidence && incidence->typeID() == eventID ) {
3702 event = static_cast<Event *>(incidence); 3702 event = static_cast<Event *>(incidence);
3703 } 3703 }
3704 if ( incidence && incidence->typeID() == todoID ) { 3704 if ( incidence && incidence->typeID() == todoID ) {
3705 todo = static_cast<Todo *>(incidence); 3705 todo = static_cast<Todo *>(incidence);
3706 } 3706 }
3707 3707
3708 if (!event && !todo) { 3708 if (!event && !todo) {
3709 KMessageBox::sorry(this,i18n("No event selected.")); 3709 KMessageBox::sorry(this,i18n("No event selected."));
3710 return; 3710 return;
3711 } 3711 }
3712 3712
3713 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3713 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3714 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3714 KMessageBox::sorry(this,i18n("The event has no attendees."));
3715 return; 3715 return;
3716 } 3716 }
3717 3717
3718 Event *ev = 0; 3718 Event *ev = 0;
3719 if (event) ev = new Event(*event); 3719 if (event) ev = new Event(*event);
3720 Todo *to = 0; 3720 Todo *to = 0;
3721 if (todo) to = new Todo(*todo); 3721 if (todo) to = new Todo(*todo);
3722 3722
3723 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3723 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3724 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3724 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3725 if (!me) { 3725 if (!me) {
3726 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3726 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3727 return; 3727 return;
3728 } 3728 }
3729 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3729 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3730 StatusDialog *statdlg = new StatusDialog(this); 3730 StatusDialog *statdlg = new StatusDialog(this);
3731 if (!statdlg->exec()==QDialog::Accepted) return; 3731 if (!statdlg->exec()==QDialog::Accepted) return;
3732 me->setStatus( statdlg->status() ); 3732 me->setStatus( statdlg->status() );
3733 delete(statdlg); 3733 delete(statdlg);
3734 } 3734 }
3735 Attendee *menew = new Attendee(*me); 3735 Attendee *menew = new Attendee(*me);
3736 if (ev) { 3736 if (ev) {
3737 ev->clearAttendees(); 3737 ev->clearAttendees();
3738 ev->addAttendee(menew,false); 3738 ev->addAttendee(menew,false);
3739 } else { 3739 } else {
3740 if (to) { 3740 if (to) {
3741 todo->clearAttendees(); 3741 todo->clearAttendees();
3742 todo->addAttendee(menew,false); 3742 todo->addAttendee(menew,false);
3743 } 3743 }
3744 } 3744 }
3745 } 3745 }
3746 3746
3747 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3747 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3748 if (ev) { 3748 if (ev) {
3749 if ( !dlg->addMessage(ev,method) ) delete(ev); 3749 if ( !dlg->addMessage(ev,method) ) delete(ev);
3750 } else { 3750 } else {
3751 if (to) { 3751 if (to) {
3752 if ( !dlg->addMessage(to,method) ) delete(to); 3752 if ( !dlg->addMessage(to,method) ) delete(to);
3753 } 3753 }
3754 } 3754 }
3755} 3755}
3756 3756
3757void CalendarView::openAddressbook() 3757void CalendarView::openAddressbook()
3758{ 3758{
3759 KRun::runCommand("kaddressbook"); 3759 KRun::runCommand("kaddressbook");
3760} 3760}
3761 3761
3762void CalendarView::setModified(bool modified) 3762void CalendarView::setModified(bool modified)
3763{ 3763{
3764 if ( modified ) 3764 if ( modified )
3765 emit signalmodified(); 3765 emit signalmodified();
3766 if (mModified != modified) { 3766 if (mModified != modified) {
3767 mModified = modified; 3767 mModified = modified;
3768 emit modifiedChanged(mModified); 3768 emit modifiedChanged(mModified);
3769 } 3769 }
3770} 3770}
3771 3771
3772bool CalendarView::isReadOnly() 3772bool CalendarView::isReadOnly()
3773{ 3773{
3774 return mReadOnly; 3774 return mReadOnly;
3775} 3775}
3776 3776
3777void CalendarView::setReadOnly(bool readOnly) 3777void CalendarView::setReadOnly(bool readOnly)
3778{ 3778{
3779 if (mReadOnly != readOnly) { 3779 if (mReadOnly != readOnly) {
3780 mReadOnly = readOnly; 3780 mReadOnly = readOnly;
3781 emit readOnlyChanged(mReadOnly); 3781 emit readOnlyChanged(mReadOnly);
3782 } 3782 }
3783} 3783}
3784 3784
3785bool CalendarView::isModified() 3785bool CalendarView::isModified()
3786{ 3786{
3787 return mModified; 3787 return mModified;
3788} 3788}
3789void CalendarView::slotprintSelInc() 3789void CalendarView::slotprintSelInc()
3790{ 3790{
3791 if ( currentSelection() == 0 ) { 3791 if ( currentSelection() == 0 ) {
3792 KMessageBox::sorry(this,i18n("There is nothing selected!")); 3792 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3793 return; 3793 return;
3794 } 3794 }
3795 showIncidence(); 3795 showIncidence();
3796 getEventViewerDialog()->print(); 3796 getEventViewerDialog()->print();
3797 3797
3798} 3798}
3799void CalendarView::printSetup() 3799void CalendarView::printSetup()
3800{ 3800{
3801#ifndef KORG_NOPRINTER 3801#ifndef KORG_NOPRINTER
3802 createPrinter(); 3802 createPrinter();
3803 3803
3804 mCalPrinter->setupPrinter(); 3804 mCalPrinter->setupPrinter();
3805#endif 3805#endif
3806} 3806}
3807 3807
3808void CalendarView::print() 3808void CalendarView::print()
3809{ 3809{
3810#ifndef KORG_NOPRINTER 3810#ifndef KORG_NOPRINTER
3811 createPrinter(); 3811 createPrinter();
3812 3812
3813 DateList tmpDateList = mNavigator->selectedDates(); 3813 DateList tmpDateList = mNavigator->selectedDates();
3814 mCalPrinter->print(CalPrinter::Month, 3814 mCalPrinter->print(CalPrinter::Month,
3815 tmpDateList.first(), tmpDateList.last()); 3815 tmpDateList.first(), tmpDateList.last());
3816#endif 3816#endif
3817} 3817}
3818 3818
3819void CalendarView::printPreview() 3819void CalendarView::printPreview()
3820{ 3820{
3821#ifndef KORG_NOPRINTER 3821#ifndef KORG_NOPRINTER
3822 kdDebug() << "CalendarView::printPreview()" << endl; 3822 kdDebug() << "CalendarView::printPreview()" << endl;
3823 3823
3824 createPrinter(); 3824 createPrinter();
3825 3825
3826 DateList tmpDateList = mNavigator->selectedDates(); 3826 DateList tmpDateList = mNavigator->selectedDates();
3827 3827
3828 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3828 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3829 tmpDateList.last()); 3829 tmpDateList.last());
3830#endif 3830#endif
3831} 3831}
3832 3832
3833void CalendarView::exportICalendar() 3833void CalendarView::exportICalendar()
3834{ 3834{
3835 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3835 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3836 3836
3837 // Force correct extension 3837 // Force correct extension
3838 if (filename.right(4) != ".ics") filename += ".ics"; 3838 if (filename.right(4) != ".ics") filename += ".ics";
3839 3839
3840 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3840 FileStorage storage( mCalendar, filename, new ICalFormat() );
3841 storage.save(); 3841 storage.save();
3842} 3842}
3843 3843
3844bool CalendarView::exportVCalendar( QString filename ) 3844bool CalendarView::exportVCalendar( QString filename )
3845{ 3845{
3846 if (mCalendar->journals().count() > 0) { 3846 if (mCalendar->journals().count() > 0) {
3847 int result = KMessageBox::warningContinueCancel(this, 3847 int result = KMessageBox::warningContinueCancel(this,
3848 i18n("The journal entries can not be\nexported to a vCalendar file."), 3848 i18n("The journal entries can not be\nexported to a vCalendar file."),
3849 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3849 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3850 true); 3850 true);
3851 if (result != KMessageBox::Continue) return false; 3851 if (result != KMessageBox::Continue) return false;
3852 } 3852 }
3853 3853
3854 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3854 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3855 3855
3856 // Force correct extension 3856 // Force correct extension
3857 if (filename.right(4) != ".vcs") filename += ".vcs"; 3857 if (filename.right(4) != ".vcs") filename += ".vcs";
3858 3858
3859 FileStorage storage( mCalendar, filename, new VCalFormat ); 3859 FileStorage storage( mCalendar, filename, new VCalFormat );
3860 return storage.save(); 3860 return storage.save();
3861 3861
3862} 3862}
3863 3863
3864void CalendarView::eventUpdated(Incidence *) 3864void CalendarView::eventUpdated(Incidence *)
3865{ 3865{
3866 setModified(); 3866 setModified();
3867 // Don't call updateView here. The code, which has caused the update of the 3867 // Don't call updateView here. The code, which has caused the update of the
3868 // event is responsible for updating the view. 3868 // event is responsible for updating the view.
3869 // updateView(); 3869 // updateView();
3870} 3870}
3871 3871
3872void CalendarView::adaptNavigationUnits() 3872void CalendarView::adaptNavigationUnits()
3873{ 3873{
3874 if (mViewManager->currentView()->isEventView()) { 3874 if (mViewManager->currentView()->isEventView()) {
3875 int days = mViewManager->currentView()->currentDateCount(); 3875 int days = mViewManager->currentView()->currentDateCount();
3876 if (days == 1) { 3876 if (days == 1) {
3877 emit changeNavStringPrev(i18n("&Previous Day")); 3877 emit changeNavStringPrev(i18n("&Previous Day"));
3878 emit changeNavStringNext(i18n("&Next Day")); 3878 emit changeNavStringNext(i18n("&Next Day"));
3879 } else { 3879 } else {
3880 emit changeNavStringPrev(i18n("&Previous Week")); 3880 emit changeNavStringPrev(i18n("&Previous Week"));
3881 emit changeNavStringNext(i18n("&Next Week")); 3881 emit changeNavStringNext(i18n("&Next Week"));
3882 } 3882 }
3883 } 3883 }
3884} 3884}
3885 3885
3886void CalendarView::processMainViewSelection( Incidence *incidence ) 3886void CalendarView::processMainViewSelection( Incidence *incidence )
3887{ 3887{
3888 if ( incidence ) mTodoList->clearSelection(); 3888 if ( incidence ) mTodoList->clearSelection();
3889 processIncidenceSelection( incidence ); 3889 processIncidenceSelection( incidence );
3890} 3890}
3891 3891
3892void CalendarView::processTodoListSelection( Incidence *incidence ) 3892void CalendarView::processTodoListSelection( Incidence *incidence )
3893{ 3893{
3894 if ( incidence && mViewManager->currentView() ) { 3894 if ( incidence && mViewManager->currentView() ) {
3895 mViewManager->currentView()->clearSelection(); 3895 mViewManager->currentView()->clearSelection();
3896 } 3896 }
3897 processIncidenceSelection( incidence ); 3897 processIncidenceSelection( incidence );
3898} 3898}
3899 3899
3900void CalendarView::processIncidenceSelection( Incidence *incidence ) 3900void CalendarView::processIncidenceSelection( Incidence *incidence )
3901{ 3901{
3902 if ( incidence == mSelectedIncidence ) return; 3902 if ( incidence == mSelectedIncidence ) return;
3903 3903
3904 mSelectedIncidence = incidence; 3904 mSelectedIncidence = incidence;
3905 3905
3906 emit incidenceSelected( mSelectedIncidence ); 3906 emit incidenceSelected( mSelectedIncidence );
3907 3907
3908 if ( incidence && incidence->typeID() == eventID ) { 3908 if ( incidence && incidence->typeID() == eventID ) {
3909 Event *event = static_cast<Event *>( incidence ); 3909 Event *event = static_cast<Event *>( incidence );
3910 if ( event->organizer() == KOPrefs::instance()->email() ) { 3910 if ( event->organizer() == KOPrefs::instance()->email() ) {
3911 emit organizerEventsSelected( true ); 3911 emit organizerEventsSelected( true );
3912 } else { 3912 } else {
3913 emit organizerEventsSelected(false); 3913 emit organizerEventsSelected(false);
3914 } 3914 }
3915 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3915 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3916 KOPrefs::instance()->email() ) ) { 3916 KOPrefs::instance()->email() ) ) {
3917 emit groupEventsSelected( true ); 3917 emit groupEventsSelected( true );
3918 } else { 3918 } else {
3919 emit groupEventsSelected(false); 3919 emit groupEventsSelected(false);
3920 } 3920 }
3921 return; 3921 return;
3922 } else { 3922 } else {
3923 if ( incidence && incidence->typeID() == todoID ) { 3923 if ( incidence && incidence->typeID() == todoID ) {
3924 emit todoSelected( true ); 3924 emit todoSelected( true );
3925 Todo *event = static_cast<Todo *>( incidence ); 3925 Todo *event = static_cast<Todo *>( incidence );
3926 if ( event->organizer() == KOPrefs::instance()->email() ) { 3926 if ( event->organizer() == KOPrefs::instance()->email() ) {
3927 emit organizerEventsSelected( true ); 3927 emit organizerEventsSelected( true );
3928 } else { 3928 } else {
3929 emit organizerEventsSelected(false); 3929 emit organizerEventsSelected(false);
3930 } 3930 }
3931 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3931 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3932 KOPrefs::instance()->email() ) ) { 3932 KOPrefs::instance()->email() ) ) {
3933 emit groupEventsSelected( true ); 3933 emit groupEventsSelected( true );
3934 } else { 3934 } else {
3935 emit groupEventsSelected(false); 3935 emit groupEventsSelected(false);
3936 } 3936 }
3937 return; 3937 return;
3938 } else { 3938 } else {
3939 emit todoSelected( false ); 3939 emit todoSelected( false );
3940 emit organizerEventsSelected(false); 3940 emit organizerEventsSelected(false);
3941 emit groupEventsSelected(false); 3941 emit groupEventsSelected(false);
3942 } 3942 }
3943 return; 3943 return;
3944 } 3944 }
3945 3945
3946 /* if ( incidence && incidence->typeID() == todoID ) { 3946 /* if ( incidence && incidence->typeID() == todoID ) {
3947 emit todoSelected( true ); 3947 emit todoSelected( true );
3948 } else { 3948 } else {
3949 emit todoSelected( false ); 3949 emit todoSelected( false );
3950 }*/ 3950 }*/
3951} 3951}
3952 3952
3953 3953
3954void CalendarView::checkClipboard() 3954void CalendarView::checkClipboard()
3955{ 3955{
3956#ifndef KORG_NODND 3956#ifndef KORG_NODND
3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3958 emit pasteEnabled(true); 3958 emit pasteEnabled(true);
3959 } else { 3959 } else {
3960 emit pasteEnabled(false); 3960 emit pasteEnabled(false);
3961 } 3961 }
3962#endif 3962#endif
3963} 3963}
3964 3964
3965void CalendarView::showDates(const DateList &selectedDates) 3965void CalendarView::showDates(const DateList &selectedDates)
3966{ 3966{
3967 // kdDebug() << "CalendarView::selectDates()" << endl; 3967 // kdDebug() << "CalendarView::selectDates()" << endl;
3968 3968
3969 3969
3970 if ( !mBlockShowDates ) { 3970 if ( !mBlockShowDates ) {
3971 if ( mViewManager->currentView() ) { 3971 if ( mViewManager->currentView() ) {
3972 updateView( selectedDates.first(), selectedDates.last() ); 3972 updateView( selectedDates.first(), selectedDates.last() );
3973 } else { 3973 } else {
3974 mViewManager->showAgendaView(); 3974 mViewManager->showAgendaView();
3975 } 3975 }
3976 } 3976 }
3977 3977
3978 QDate date = selectedDates.first(); 3978 QDate date = selectedDates.first();
3979 if ( ! date.isValid() ) { 3979 if ( ! date.isValid() ) {
3980 topLevelWidget()->setCaption(""); 3980 topLevelWidget()->setCaption("");
3981 return; 3981 return;
3982 } 3982 }
3983 3983
3984 QString selDates; 3984 QString selDates;
3985 selDates = KGlobal::locale()->formatDate( date, true); 3985 selDates = KGlobal::locale()->formatDate( date, true);
3986 if (selectedDates.first() < selectedDates.last() ) 3986 if (selectedDates.first() < selectedDates.last() )
3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3988 else { 3988 else {
3989 QString addString; 3989 QString addString;
3990 if ( date == QDateTime::currentDateTime().date() ) 3990 if ( date == QDateTime::currentDateTime().date() )
3991 addString = i18n("Today"); 3991 addString = i18n("Today");
3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3993 addString = i18n("Tomorrow"); 3993 addString = i18n("Tomorrow");
3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3995 addString = i18n("Yesterday"); 3995 addString = i18n("Yesterday");
3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3997 addString = i18n("Day before yesterday"); 3997 addString = i18n("Day before yesterday");
3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3999 addString = i18n("Day after tomorrow"); 3999 addString = i18n("Day after tomorrow");
4000 if ( !addString.isEmpty() ) { 4000 if ( !addString.isEmpty() ) {
4001 topLevelWidget()->setCaption( addString+", " + selDates ); 4001 topLevelWidget()->setCaption( addString+", " + selDates );
4002 return; 4002 return;
4003 } 4003 }
4004 } 4004 }
4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
4006 4006
4007} 4007}
4008 4008
4009QPtrList<CalFilter> CalendarView::filters() 4009QPtrList<CalFilter> CalendarView::filters()
4010{ 4010{
4011 return mFilters; 4011 return mFilters;
4012 4012
4013} 4013}
4014void CalendarView::editFilters() 4014void CalendarView::editFilters()
4015{ 4015{
4016 // kdDebug() << "CalendarView::editFilters()" << endl; 4016 // kdDebug() << "CalendarView::editFilters()" << endl;
4017 4017
4018 CalFilter *filter = mFilters.first(); 4018 CalFilter *filter = mFilters.first();
4019 while(filter) { 4019 while(filter) {
4020 kdDebug() << " Filter: " << filter->name() << endl; 4020 kdDebug() << " Filter: " << filter->name() << endl;
4021 filter = mFilters.next(); 4021 filter = mFilters.next();
4022 } 4022 }
4023 4023
4024 mDialogManager->showFilterEditDialog(&mFilters); 4024 mDialogManager->showFilterEditDialog(&mFilters);
4025 updateFilter();
4025} 4026}
4026void CalendarView::toggleFilter() 4027void CalendarView::toggleFilter()
4027{ 4028{
4028 showFilter(! mCalEditView->isVisible()); 4029 showFilter(! mCalEditView->isVisible());
4029} 4030}
4030 4031
4031KOFilterView *CalendarView::filterView() 4032KOFilterView *CalendarView::filterView()
4032{ 4033{
4033 return mFilterView; 4034 return mFilterView;
4034} 4035}
4035void CalendarView::selectFilter( int fil ) 4036void CalendarView::selectFilter( int fil )
4036{ 4037{
4037 mFilterView->setSelectedFilter( fil ); 4038 mFilterView->setSelectedFilter( fil );
4038} 4039}
4039void CalendarView::showFilter(bool visible) 4040void CalendarView::showFilter(bool visible)
4040{ 4041{
4041#if 1 4042#if 1
4042 if (visible) { 4043 if (visible) {
4043 mCalEditView->readConfig(); 4044 mCalEditView->readConfig();
4044 mCalEditView->show(); 4045 mCalEditView->show();
4045 QValueList<int> sizes; 4046 QValueList<int> sizes;
4046 sizes = mLeftFrame->sizes(); 4047 sizes = mLeftFrame->sizes();
4047 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4048 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4048 sizes.clear(); 4049 sizes.clear();
4049 sizes << 100; 4050 sizes << 100;
4050 sizes << 0; 4051 sizes << 0;
4051 sizes << 0; 4052 sizes << 0;
4052 sizes << 100; 4053 sizes << 100;
4053 mLeftFrame->setSizes(sizes); 4054 mLeftFrame->setSizes(sizes);
4054 } 4055 }
4055#if 0 4056#if 0
4056 sizes = mLeftFrame->sizes(); 4057 sizes = mLeftFrame->sizes();
4057 int ccc = 0; 4058 int ccc = 0;
4058 while ( ccc < sizes.count()) { 4059 while ( ccc < sizes.count()) {
4059 qDebug("size %d %d ", ccc, sizes[ccc]); 4060 qDebug("size %d %d ", ccc, sizes[ccc]);
4060 ++ccc; 4061 ++ccc;
4061 } 4062 }
4062#endif 4063#endif
4063 4064
4064 } 4065 }
4065 else { 4066 else {
4066 mCalEditView->hide(); 4067 mCalEditView->hide();
4067 } 4068 }
4068#else 4069#else
4069 if (visible) mFilterView->show(); 4070 if (visible) mFilterView->show();
4070 else mFilterView->hide(); 4071 else mFilterView->hide();
4071#endif 4072#endif
4072} 4073}
4073void CalendarView::toggleFilerEnabled( ) 4074void CalendarView::toggleFilerEnabled( )
4074{ 4075{
4075 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 4076 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
4076 if ( !mFilterView->filtersEnabled() ) 4077 if ( !mFilterView->filtersEnabled() )
4077 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 4078 topLevelWidget()->setCaption( i18n("Filter disabled ") );
4078 4079
4079} 4080}
4080void CalendarView::updateFilter() 4081void CalendarView::updateFilter()
4081{ 4082{
4082 CalFilter *filter = mFilterView->selectedFilter(); 4083 CalFilter *filter = mFilterView->selectedFilter();
4083 if (filter) { 4084 if (filter) {
4084 QString mess; 4085 QString mess;
4085 if (mFilterView->filtersEnabled()) { 4086 if (mFilterView->filtersEnabled()) {
4086 mess = i18n("Filter selected: ")+filter->name(); 4087 mess = i18n("Filter selected: ")+filter->name();
4087 filter->setEnabled(true); 4088 filter->setEnabled(true);
4088 } 4089 }
4089 else filter->setEnabled(false); 4090 else filter->setEnabled(false);
4090 mCalendar->setFilter(filter); 4091 mCalendar->setFilter(filter);
4091 updateView(); 4092 updateView();
4092 if ( !mess.isEmpty() ) 4093 if ( !mess.isEmpty() )
4093 topLevelWidget()->setCaption( mess ); 4094 topLevelWidget()->setCaption( mess );
4094 4095
4095 } 4096 }
4097 emit filtersUpdated();
4096} 4098}
4097 4099
4098void CalendarView::filterEdited() 4100void CalendarView::filterEdited()
4099{ 4101{
4100 mFilterView->updateFilters(); 4102 mFilterView->updateFilters();
4101 updateFilter(); 4103 updateFilter();
4102 writeSettings(); 4104 writeSettings();
4103} 4105}
4104 4106
4105 4107
4106void CalendarView::takeOverEvent() 4108void CalendarView::takeOverEvent()
4107{ 4109{
4108 Incidence *incidence = currentSelection(); 4110 Incidence *incidence = currentSelection();
4109 4111
4110 if (!incidence) return; 4112 if (!incidence) return;
4111 4113
4112 incidence->setOrganizer(KOPrefs::instance()->email()); 4114 incidence->setOrganizer(KOPrefs::instance()->email());
4113 incidence->recreate(); 4115 incidence->recreate();
4114 incidence->setReadOnly(false); 4116 incidence->setReadOnly(false);
4115 4117
4116 updateView(); 4118 updateView();
4117} 4119}
4118 4120
4119void CalendarView::takeOverCalendar() 4121void CalendarView::takeOverCalendar()
4120{ 4122{
4121 // TODO: Create Calendar::allIncidences() function and use it here 4123 // TODO: Create Calendar::allIncidences() function and use it here
4122 4124
4123 clearAllViews(); 4125 clearAllViews();
4124 QPtrList<Event> events = mCalendar->events(); 4126 QPtrList<Event> events = mCalendar->events();
4125 for(uint i=0; i<events.count(); ++i) { 4127 for(uint i=0; i<events.count(); ++i) {
4126 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4128 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4127 events.at(i)->recreate(); 4129 events.at(i)->recreate();
4128 events.at(i)->setReadOnly(false); 4130 events.at(i)->setReadOnly(false);
4129 } 4131 }
4130 4132
4131 QPtrList<Todo> todos = mCalendar->todos(); 4133 QPtrList<Todo> todos = mCalendar->todos();
4132 for(uint i=0; i<todos.count(); ++i) { 4134 for(uint i=0; i<todos.count(); ++i) {
4133 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4135 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4134 todos.at(i)->recreate(); 4136 todos.at(i)->recreate();
4135 todos.at(i)->setReadOnly(false); 4137 todos.at(i)->setReadOnly(false);
4136 } 4138 }
4137 4139
4138 QPtrList<Journal> journals = mCalendar->journals(); 4140 QPtrList<Journal> journals = mCalendar->journals();
4139 for(uint i=0; i<journals.count(); ++i) { 4141 for(uint i=0; i<journals.count(); ++i) {
4140 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4142 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4141 journals.at(i)->recreate(); 4143 journals.at(i)->recreate();
4142 journals.at(i)->setReadOnly(false); 4144 journals.at(i)->setReadOnly(false);
4143 } 4145 }
4144 4146
4145 updateView(); 4147 updateView();
4146} 4148}
4147 4149
4148void CalendarView::showIntro() 4150void CalendarView::showIntro()
4149{ 4151{
4150 kdDebug() << "To be implemented." << endl; 4152 kdDebug() << "To be implemented." << endl;
4151} 4153}
4152 4154
4153QWidgetStack *CalendarView::viewStack() 4155QWidgetStack *CalendarView::viewStack()
4154{ 4156{
4155 return mRightFrame; 4157 return mRightFrame;
4156} 4158}
4157 4159
4158QWidget *CalendarView::leftFrame() 4160QWidget *CalendarView::leftFrame()
4159{ 4161{
4160 return ( QWidget *)mLeftFrame; 4162 return ( QWidget *)mLeftFrame;
4161} 4163}
4162 4164
4163DateNavigator *CalendarView::dateNavigator() 4165DateNavigator *CalendarView::dateNavigator()
4164{ 4166{
4165 return mNavigator; 4167 return mNavigator;
4166} 4168}
4167 4169
4168KDateNavigator* CalendarView::dateNavigatorWidget() 4170KDateNavigator* CalendarView::dateNavigatorWidget()
4169{ 4171{
4170 return mDateNavigator->navigatorView(); 4172 return mDateNavigator->navigatorView();
4171} 4173}
4172void CalendarView::toggleDateNavigatorWidget() 4174void CalendarView::toggleDateNavigatorWidget()
4173{ 4175{
4174 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4176 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4175 4177
4176 if (!KOPrefs::instance()->mShowDateNavigator ) 4178 if (!KOPrefs::instance()->mShowDateNavigator )
4177 mDateNavigator->hide(); 4179 mDateNavigator->hide();
4178 else 4180 else
4179 mDateNavigator->show(); 4181 mDateNavigator->show();
4180} 4182}
4181void CalendarView::addView(KOrg::BaseView *view) 4183void CalendarView::addView(KOrg::BaseView *view)
4182{ 4184{
4183 mViewManager->addView(view); 4185 mViewManager->addView(view);
4184} 4186}
4185 4187
4186void CalendarView::showView(KOrg::BaseView *view) 4188void CalendarView::showView(KOrg::BaseView *view)
4187{ 4189{
4188 mViewManager->showView(view, mLeftFrame->isVisible()); 4190 mViewManager->showView(view, mLeftFrame->isVisible());
4189} 4191}
4190 4192
4191Incidence *CalendarView::currentSelection() 4193Incidence *CalendarView::currentSelection()
4192{ 4194{
4193 return mViewManager->currentSelection(); 4195 return mViewManager->currentSelection();
4194} 4196}
4195void CalendarView::toggleAllDaySize() 4197void CalendarView::toggleAllDaySize()
4196{ 4198{
4197 /* 4199 /*
4198 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4200 if ( KOPrefs::instance()->mAllDaySize > 47 )
4199 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4201 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4200 else 4202 else
4201 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4203 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4202 */ 4204 */
4203 viewManager()->agendaView()->toggleAllDay(); 4205 viewManager()->agendaView()->toggleAllDay();
4204} 4206}
4205void CalendarView::toggleExpand() 4207void CalendarView::toggleExpand()
4206{ 4208{
4207 // if ( mLeftFrame->isHidden() ) { 4209 // if ( mLeftFrame->isHidden() ) {
4208 // mLeftFrame->show(); 4210 // mLeftFrame->show();
4209 // emit calendarViewExpanded( false ); 4211 // emit calendarViewExpanded( false );
4210 // } else { 4212 // } else {
4211 // mLeftFrame->hide(); 4213 // mLeftFrame->hide();
4212 // emit calendarViewExpanded( true ); 4214 // emit calendarViewExpanded( true );
4213 // } 4215 // }
4214 //qDebug(" CalendarView::toggleExpand()"); 4216 //qDebug(" CalendarView::toggleExpand()");
4215 globalFlagBlockAgenda = 1; 4217 globalFlagBlockAgenda = 1;
4216 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4218 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4217 globalFlagBlockAgenda = 5; 4219 globalFlagBlockAgenda = 5;
4218 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4220 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4219 //mViewManager->showView( 0, true ); 4221 //mViewManager->showView( 0, true );
4220} 4222}
4221 4223
4222void CalendarView::calendarModified( bool modified, Calendar * ) 4224void CalendarView::calendarModified( bool modified, Calendar * )
4223{ 4225{
4224 setModified( modified ); 4226 setModified( modified );
4225} 4227}
4226 4228
4227Todo *CalendarView::selectedTodo() 4229Todo *CalendarView::selectedTodo()
4228{ 4230{
4229 Incidence *incidence = currentSelection(); 4231 Incidence *incidence = currentSelection();
4230 if ( incidence && incidence->typeID() == todoID ) { 4232 if ( incidence && incidence->typeID() == todoID ) {
4231 return static_cast<Todo *>( incidence ); 4233 return static_cast<Todo *>( incidence );
4232 } 4234 }
4233 4235
4234 incidence = mTodoList->selectedIncidences().first(); 4236 incidence = mTodoList->selectedIncidences().first();
4235 if ( incidence && incidence->typeID() == todoID ) { 4237 if ( incidence && incidence->typeID() == todoID ) {
4236 return static_cast<Todo *>( incidence ); 4238 return static_cast<Todo *>( incidence );
4237 } 4239 }
4238 4240
4239 return 0; 4241 return 0;
4240} 4242}
4241 4243
4242void CalendarView::dialogClosing(Incidence *in) 4244void CalendarView::dialogClosing(Incidence *in)
4243{ 4245{
4244 // mDialogList.remove(in); 4246 // mDialogList.remove(in);
4245} 4247}
4246 4248
4247void CalendarView::showIncidence() 4249void CalendarView::showIncidence()
4248{ 4250{
4249 mViewerCallerIsSearchDialog = false; 4251 mViewerCallerIsSearchDialog = false;
4250 Incidence *incidence = currentSelection(); 4252 Incidence *incidence = currentSelection();
4251 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4253 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4252 if ( incidence ) { 4254 if ( incidence ) {
4253 ShowIncidenceVisitor v; 4255 ShowIncidenceVisitor v;
4254 v.act( incidence, this ); 4256 v.act( incidence, this );
4255 } 4257 }
4256} 4258}
4257void CalendarView::editIncidenceDescription() 4259void CalendarView::editIncidenceDescription()
4258{ 4260{
4259 mFlagEditDescription = true; 4261 mFlagEditDescription = true;
4260 editIncidence(); 4262 editIncidence();
4261 mFlagEditDescription = false; 4263 mFlagEditDescription = false;
4262} 4264}
4263void CalendarView::editIncidence() 4265void CalendarView::editIncidence()
4264{ 4266{
4265 // qDebug("editIncidence() "); 4267 // qDebug("editIncidence() ");
4266 Incidence *incidence = currentSelection(); 4268 Incidence *incidence = currentSelection();
4267 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4269 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4268 if ( incidence ) { 4270 if ( incidence ) {
4269 EditIncidenceVisitor v; 4271 EditIncidenceVisitor v;
4270 v.act( incidence, this ); 4272 v.act( incidence, this );
4271 } 4273 }
4272} 4274}
4273 4275
4274void CalendarView::deleteIncidence() 4276void CalendarView::deleteIncidence()
4275{ 4277{
4276 Incidence *incidence = currentSelection(); 4278 Incidence *incidence = currentSelection();
4277 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4279 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4278 if ( incidence ) { 4280 if ( incidence ) {
4279 deleteIncidence(incidence); 4281 deleteIncidence(incidence);
4280 } 4282 }
4281} 4283}
4282void CalendarView::showIncidence(QString uid) 4284void CalendarView::showIncidence(QString uid)
4283{ 4285{
4284 Incidence *inc = mCalendar->incidence( uid ); 4286 Incidence *inc = mCalendar->incidence( uid );
4285 if ( inc ) 4287 if ( inc )
4286 showIncidence( inc ); 4288 showIncidence( inc );
4287} 4289}
4288void CalendarView::showIncidence(Incidence *incidence) 4290void CalendarView::showIncidence(Incidence *incidence)
4289{ 4291{
4290 mViewerCallerIsSearchDialog = false; 4292 mViewerCallerIsSearchDialog = false;
4291 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4293 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4292 if ( sender() && mDialogManager->getSearchDialog() ) { 4294 if ( sender() && mDialogManager->getSearchDialog() ) {
4293 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4295 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4294 mViewerCallerIsSearchDialog = true; 4296 mViewerCallerIsSearchDialog = true;
4295 } 4297 }
4296 } 4298 }
4297 if ( incidence ) { 4299 if ( incidence ) {
4298 ShowIncidenceVisitor v; 4300 ShowIncidenceVisitor v;
4299 v.act( incidence, this ); 4301 v.act( incidence, this );
4300 } 4302 }
4301} 4303}
4302 4304
4303void CalendarView::editIncidence(Incidence *incidence) 4305void CalendarView::editIncidence(Incidence *incidence)
4304{ 4306{
4305 if ( incidence ) { 4307 if ( incidence ) {
4306 4308
4307 EditIncidenceVisitor v; 4309 EditIncidenceVisitor v;
4308 v.act( incidence, this ); 4310 v.act( incidence, this );
4309 4311
4310 } 4312 }
4311} 4313}
4312 4314
4313void CalendarView::deleteIncidence(Incidence *incidence) 4315void CalendarView::deleteIncidence(Incidence *incidence)
4314{ 4316{
4315 //qDebug(" CalendarView::deleteIncidence "); 4317 //qDebug(" CalendarView::deleteIncidence ");
4316 if ( incidence ) { 4318 if ( incidence ) {
4317 DeleteIncidenceVisitor v; 4319 DeleteIncidenceVisitor v;
4318 v.act( incidence, this ); 4320 v.act( incidence, this );
4319 } 4321 }
4320} 4322}
4321 4323
4322 4324
4323void CalendarView::lookForOutgoingMessages() 4325void CalendarView::lookForOutgoingMessages()
4324{ 4326{
4325 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4327 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4326 ogd->loadMessages(); 4328 ogd->loadMessages();
4327} 4329}
4328 4330
4329void CalendarView::lookForIncomingMessages() 4331void CalendarView::lookForIncomingMessages()
4330{ 4332{
4331 IncomingDialog *icd = mDialogManager->incomingDialog(); 4333 IncomingDialog *icd = mDialogManager->incomingDialog();
4332 icd->retrieve(); 4334 icd->retrieve();
4333} 4335}
4334 4336
4335bool CalendarView::removeCompletedSubTodos( Todo* t ) 4337bool CalendarView::removeCompletedSubTodos( Todo* t )
4336{ 4338{
4337 bool deleteTodo = true; 4339 bool deleteTodo = true;
4338 QPtrList<Incidence> subTodos; 4340 QPtrList<Incidence> subTodos;
4339 Incidence *aTodo; 4341 Incidence *aTodo;
4340 subTodos = t->relations(); 4342 subTodos = t->relations();
4341 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4343 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4342 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4344 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4343 deleteTodo = false; 4345 deleteTodo = false;
4344 } 4346 }
4345 if ( deleteTodo ) { 4347 if ( deleteTodo ) {
4346 if ( t->isCompleted() && !t->doesRecur()) { 4348 if ( t->isCompleted() && !t->doesRecur()) {
4347 checkExternalId( t ); 4349 checkExternalId( t );
4348 mCalendar->deleteTodo( t ); 4350 mCalendar->deleteTodo( t );
4349 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4351 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4350 } 4352 }
4351 else 4353 else
4352 deleteTodo = false; 4354 deleteTodo = false;
4353 } 4355 }
4354 return deleteTodo; 4356 return deleteTodo;
4355 4357
4356} 4358}
4357void CalendarView::purgeCompleted() 4359void CalendarView::purgeCompleted()
4358{ 4360{
4359 int result = KMessageBox::warningContinueCancel(this, 4361 int result = KMessageBox::warningContinueCancel(this,
4360 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4362 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4361 4363
4362 if (result == KMessageBox::Continue) { 4364 if (result == KMessageBox::Continue) {
4363 4365
4364 QPtrList<Todo> todoCal; 4366 QPtrList<Todo> todoCal;
4365 QPtrList<Todo> rootTodos; 4367 QPtrList<Todo> rootTodos;
4366 //QPtrList<Incidence> rel; 4368 //QPtrList<Incidence> rel;
4367 Todo *aTodo;//, *rTodo; 4369 Todo *aTodo;//, *rTodo;
4368 Incidence *rIncidence; 4370 Incidence *rIncidence;
4369 bool childDelete = false; 4371 bool childDelete = false;
4370 bool deletedOne = true; 4372 bool deletedOne = true;
4371 todoCal = calendar()->todos(); 4373 todoCal = calendar()->todos();
4372 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4374 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4373 if ( !aTodo->relatedTo() ) 4375 if ( !aTodo->relatedTo() )
4374 rootTodos.append( aTodo ); 4376 rootTodos.append( aTodo );
4375 } 4377 }
4376 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4378 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4377 removeCompletedSubTodos( aTodo ); 4379 removeCompletedSubTodos( aTodo );
4378 } 4380 }
4379 4381
4380 updateView(); 4382 updateView();
4381 } 4383 }
4382} 4384}
4383 4385
4384void CalendarView::slotCalendarChanged() 4386void CalendarView::slotCalendarChanged()
4385{ 4387{
4386 ; 4388 ;
4387} 4389}
4388 4390
4389void CalendarView::keyPressEvent ( QKeyEvent *e) 4391void CalendarView::keyPressEvent ( QKeyEvent *e)
4390{ 4392{
4391 //qDebug(" alendarView::keyPressEvent "); 4393 //qDebug(" alendarView::keyPressEvent ");
4392 e->ignore(); 4394 e->ignore();
4393} 4395}
4394 4396
4395 4397
4396bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4398bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4397{ 4399{
4398 // mSyncManager = manager; 4400 // mSyncManager = manager;
4399 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4401 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4400 qDebug("KO: SyncKDE request detected!"); 4402 qDebug("KO: SyncKDE request detected!");
4401 } 4403 }
4402 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4404 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4403 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4405 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4404 return syncCalendar( filename, mode ); 4406 return syncCalendar( filename, mode );
4405} 4407}
4406bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4408bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4407{ 4409{
4408 //mSyncManager = manager; 4410 //mSyncManager = manager;
4409 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4411 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4410 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4412 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4411 if ( resource == "sharp" ) 4413 if ( resource == "sharp" )
4412 syncExternal( 0 ); 4414 syncExternal( 0 );
4413 if ( resource == "phone" ) 4415 if ( resource == "phone" )
4414 syncExternal( 1 ); 4416 syncExternal( 1 );
4415 // pending setmodified 4417 // pending setmodified
4416 return true; 4418 return true;
4417} 4419}
4418void CalendarView::setSyncManager(KSyncManager* manager) 4420void CalendarView::setSyncManager(KSyncManager* manager)
4419{ 4421{
4420 mSyncManager = manager; 4422 mSyncManager = manager;
4421} 4423}
4422 4424
4423void CalendarView::removeSyncInfo( QString syncProfile) 4425void CalendarView::removeSyncInfo( QString syncProfile)
4424{ 4426{
4425 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4427 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4426 mCalendar->removeSyncInfo( syncProfile ); 4428 mCalendar->removeSyncInfo( syncProfile );
4427 4429
4428} 4430}
4429 4431
4430void CalendarView::undo_delete() 4432void CalendarView::undo_delete()
4431{ 4433{
4432 //qDebug("undo_delete() "); 4434 //qDebug("undo_delete() ");
4433 Incidence* undo = mCalendar->undoIncidence(); 4435 Incidence* undo = mCalendar->undoIncidence();
4434 if ( !undo ) { 4436 if ( !undo ) {
4435 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4437 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4436 i18n("KO/Pi")); 4438 i18n("KO/Pi"));
4437 return; 4439 return;
4438 } 4440 }
4439 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4441 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4440 i18n("\nAre you sure you want\nto restore this?"), 4442 i18n("\nAre you sure you want\nto restore this?"),
4441 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4443 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4442 mCalendar->undoDeleteIncidence(); 4444 mCalendar->undoDeleteIncidence();
4443 updateView(); 4445 updateView();
4444 } 4446 }
4445} 4447}
4446 4448
4447void CalendarView::slotViewerClosed() 4449void CalendarView::slotViewerClosed()
4448{ 4450{
4449 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4451 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4450} 4452}
4451 4453
4452void CalendarView::resetFocus() 4454void CalendarView::resetFocus()
4453{ 4455{
4454 if ( mViewerCallerIsSearchDialog ) { 4456 if ( mViewerCallerIsSearchDialog ) {
4455 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4457 if ( mDialogManager->getSearchDialog()->isVisible() ){
4456 mDialogManager->getSearchDialog()->raise(); 4458 mDialogManager->getSearchDialog()->raise();
4457 mDialogManager->getSearchDialog()->setActiveWindow(); 4459 mDialogManager->getSearchDialog()->setActiveWindow();
4458 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4460 mDialogManager->getSearchDialog()->listview()->resetFocus();
4459 } else 4461 } else
4460 mViewerCallerIsSearchDialog = false; 4462 mViewerCallerIsSearchDialog = false;
4461 } 4463 }
4462 if ( !mViewerCallerIsSearchDialog ) { 4464 if ( !mViewerCallerIsSearchDialog ) {
4463 //mViewManager->currentView()->setFocus(); 4465 //mViewManager->currentView()->setFocus();
4464 //qDebug("sssssssssssssssset focus "); 4466 //qDebug("sssssssssssssssset focus ");
4465 topLevelWidget()->raise(); 4467 topLevelWidget()->raise();
4466 setActiveWindow(); 4468 setActiveWindow();
4467 //setFocus(); 4469 //setFocus();
4468 } 4470 }
4469 mViewerCallerIsSearchDialog = false; 4471 mViewerCallerIsSearchDialog = false;
4470} 4472}
4471 4473
4472void CalendarView::showNextAlarms() 4474void CalendarView::showNextAlarms()
4473{ 4475{
4474 QString message; 4476 QString message;
4475 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4477 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4476 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4478 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4477 QString sum = mCalendar->nextSummary(); 4479 QString sum = mCalendar->nextSummary();
4478 QDateTime nextA = mNextAlarmDateTime; 4480 QDateTime nextA = mNextAlarmDateTime;
4479 QDateTime cur = QDateTime::currentDateTime(); 4481 QDateTime cur = QDateTime::currentDateTime();
4480 int secs = cur.secsTo( nextA ); 4482 int secs = cur.secsTo( nextA );
4481 int min = secs /60; 4483 int min = secs /60;
4482 int hours = min /60; 4484 int hours = min /60;
4483 min = min % 60; 4485 min = min % 60;
4484 int days = hours /24; 4486 int days = hours /24;
4485 hours = hours % 24; 4487 hours = hours % 24;
4486 4488
4487 //message = i18n("The next alarm is in:\n"); 4489 //message = i18n("The next alarm is in:\n");
4488 if ( days > 1 ) 4490 if ( days > 1 )
4489 message += i18n("%1 days\n").arg( days ); 4491 message += i18n("%1 days\n").arg( days );
4490 else if ( days == 1 ) 4492 else if ( days == 1 )
4491 message += i18n("1 day\n"); 4493 message += i18n("1 day\n");
4492 if ( hours > 1 ) 4494 if ( hours > 1 )
4493 message += i18n("%1 hours\n").arg( hours ); 4495 message += i18n("%1 hours\n").arg( hours );
4494 else if ( hours == 1 ) 4496 else if ( hours == 1 )
4495 message += i18n("1 hour\n"); 4497 message += i18n("1 hour\n");
4496 if ( min > 1 ) 4498 if ( min > 1 )
4497 message += i18n("%1 minutes\n").arg( min ); 4499 message += i18n("%1 minutes\n").arg( min );
4498 else if ( min == 1 ) 4500 else if ( min == 1 )
4499 message += i18n("1 minute\n"); 4501 message += i18n("1 minute\n");
4500 if ( message.isEmpty() ) 4502 if ( message.isEmpty() )
4501 message = i18n("The next alarm is in\nless than one minute!"); 4503 message = i18n("The next alarm is in\nless than one minute!");
4502 else 4504 else
4503 message = i18n("The next alarm is in:\n") + message; 4505 message = i18n("The next alarm is in:\n") + message;
4504 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4506 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4505 } else { 4507 } else {
4506 message = i18n("There is no next alarm."); 4508 message = i18n("There is no next alarm.");
4507 4509
4508 } 4510 }
4509#ifdef DESKTOP_VERSION 4511#ifdef DESKTOP_VERSION
4510 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4512 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4511 message += i18n("\nThe internal alarm notification is disabled!\n"); 4513 message += i18n("\nThe internal alarm notification is disabled!\n");
4512 message += i18n("Enable it in the settings menu, TAB alarm."); 4514 message += i18n("Enable it in the settings menu, TAB alarm.");
4513 } 4515 }
4514 4516
4515#endif 4517#endif
4516 KMessageBox::information( this, message); 4518 KMessageBox::information( this, message);
4517} 4519}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index d836fee..be18e8f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,652 +1,653 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h> 42#include <KDGanttMinimizeSplitter.h>
43 43
44#include <korganizer/calendarviewbase.h> 44#include <korganizer/calendarviewbase.h>
45 45
46#include <ksyncmanager.h> 46#include <ksyncmanager.h>
47//#include <koprefs.h> 47//#include <koprefs.h>
48 48
49class QWidgetStack; 49class QWidgetStack;
50class QSplitter; 50class QSplitter;
51class KopiCalendarFile; 51class KopiCalendarFile;
52class CalPrinter; 52class CalPrinter;
53class KOFilterView; 53class KOFilterView;
54class KOCalEditView; 54class KOCalEditView;
55class KOViewManager; 55class KOViewManager;
56class KODialogManager; 56class KODialogManager;
57class KOTodoView; 57class KOTodoView;
58class KDateNavigator; 58class KDateNavigator;
59class DateNavigatorContainer; 59class DateNavigatorContainer;
60class DateNavigator; 60class DateNavigator;
61class KOIncidenceEditor; 61class KOIncidenceEditor;
62class KDatePicker; 62class KDatePicker;
63class ResourceView; 63class ResourceView;
64class KOEventEditor; 64class KOEventEditor;
65class KOTodoEditor ; 65class KOTodoEditor ;
66class KOEventViewerDialog; 66class KOEventViewerDialog;
67class KOBeamPrefs; 67class KOBeamPrefs;
68class KSyncProfile; 68class KSyncProfile;
69class AlarmDialog; 69class AlarmDialog;
70class KCal::Attendee; 70class KCal::Attendee;
71 71
72namespace KCal { class FileStorage; } 72namespace KCal { class FileStorage; }
73 73
74using namespace KCal; 74using namespace KCal;
75 75
76/** 76/**
77 This is the main calendar widget. It provides the different vies on t he 77 This is the main calendar widget. It provides the different vies on t he
78 calendar data as well as the date navigator. It also handles synchronisation 78 calendar data as well as the date navigator. It also handles synchronisation
79 of the different views and controls the different dialogs like preferences, 79 of the different views and controls the different dialogs like preferences,
80 event editor, search dialog etc. 80 event editor, search dialog etc.
81 81
82 @short main calendar view widget 82 @short main calendar view widget
83 @author Cornelius Schumacher 83 @author Cornelius Schumacher
84*/ 84*/
85 85
86#include <qtextbrowser.h> 86#include <qtextbrowser.h>
87#include <qtextcodec.h> 87#include <qtextcodec.h>
88 88
89class MissedAlarmTextBrowser : public QTextBrowser { 89class MissedAlarmTextBrowser : public QTextBrowser {
90 Q_OBJECT 90 Q_OBJECT
91 public: 91 public:
92 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 92 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
93 ~MissedAlarmTextBrowser(); 93 ~MissedAlarmTextBrowser();
94 void setSource(const QString & n); 94 void setSource(const QString & n);
95 95
96 private: 96 private:
97 Incidence * getNextInc(QDateTime start ); 97 Incidence * getNextInc(QDateTime start );
98 QPtrList<Incidence> mAlarms; 98 QPtrList<Incidence> mAlarms;
99 signals: 99 signals:
100 void showIncidence( QString uid); 100 void showIncidence( QString uid);
101}; 101};
102 102
103 103
104class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 104class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
105{ 105{
106 Q_OBJECT 106 Q_OBJECT
107 public: 107 public:
108 /** 108 /**
109 Constructs a new calendar view widget. 109 Constructs a new calendar view widget.
110 110
111 @param calendar calendar document 111 @param calendar calendar document
112 @param parent parent window 112 @param parent parent window
113 @param name Qt internal widget object name 113 @param name Qt internal widget object name
114 */ 114 */
115 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 115 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
116 const char *name = 0 ); 116 const char *name = 0 );
117 CalendarView( Calendar *calendar, QWidget *parent = 0, 117 CalendarView( Calendar *calendar, QWidget *parent = 0,
118 const char *name = 0 ); 118 const char *name = 0 );
119 virtual ~CalendarView(); 119 virtual ~CalendarView();
120 120
121 Calendar *calendar() { return mCalendar; } 121 Calendar *calendar() { return mCalendar; }
122 122
123 KOViewManager *viewManager(); 123 KOViewManager *viewManager();
124 KODialogManager *dialogManager(); 124 KODialogManager *dialogManager();
125 125
126 QDate startDate(); 126 QDate startDate();
127 QDate endDate(); 127 QDate endDate();
128 128
129 QWidgetStack *viewStack(); 129 QWidgetStack *viewStack();
130 QWidget *leftFrame(); 130 QWidget *leftFrame();
131 131
132 DateNavigator *dateNavigator(); 132 DateNavigator *dateNavigator();
133 KDateNavigator *dateNavigatorWidget(); 133 KDateNavigator *dateNavigatorWidget();
134 134
135 void addView(KOrg::BaseView *); 135 void addView(KOrg::BaseView *);
136 void showView(KOrg::BaseView *); 136 void showView(KOrg::BaseView *);
137 KOEventViewerDialog* getEventViewerDialog(); 137 KOEventViewerDialog* getEventViewerDialog();
138 Incidence *currentSelection(); 138 Incidence *currentSelection();
139 139
140 signals: 140 signals:
141 void save (); 141 void save ();
142 void saveStopTimer (); 142 void saveStopTimer ();
143 void tempDisableBR(bool); 143 void tempDisableBR(bool);
144 /** This todo has been modified */ 144 /** This todo has been modified */
145 void todoModified(Todo *, int); 145 void todoModified(Todo *, int);
146 146
147 /** when change is made to options dialog, the topwidget will catch this 147 /** when change is made to options dialog, the topwidget will catch this
148 * and emit this signal which notifies all widgets which have registered 148 * and emit this signal which notifies all widgets which have registered
149 * for notification to update their settings. */ 149 * for notification to update their settings. */
150 void configChanged(); 150 void configChanged();
151 /** emitted when the topwidget is closing down, so that any attached 151 /** emitted when the topwidget is closing down, so that any attached
152 child windows can also close. */ 152 child windows can also close. */
153 void closingDown(); 153 void closingDown();
154 /** emitted right before we die */ 154 /** emitted right before we die */
155 void closed(QWidget *); 155 void closed(QWidget *);
156 156
157 /** Emitted when state of modified flag changes */ 157 /** Emitted when state of modified flag changes */
158 void modifiedChanged(bool); 158 void modifiedChanged(bool);
159 void signalmodified(); 159 void signalmodified();
160 160
161 /** Emitted when state of read-only flag changes */ 161 /** Emitted when state of read-only flag changes */
162 void readOnlyChanged(bool); 162 void readOnlyChanged(bool);
163 163
164 /** Emitted when the unit of navigation changes */ 164 /** Emitted when the unit of navigation changes */
165 void changeNavStringPrev(const QString &); 165 void changeNavStringPrev(const QString &);
166 void changeNavStringNext(const QString &); 166 void changeNavStringNext(const QString &);
167 167
168 /** Emitted when state of events selection has changed and user is organizer*/ 168 /** Emitted when state of events selection has changed and user is organizer*/
169 void organizerEventsSelected(bool); 169 void organizerEventsSelected(bool);
170 /** Emitted when state of events selection has changed and user is attendee*/ 170 /** Emitted when state of events selection has changed and user is attendee*/
171 void groupEventsSelected(bool); 171 void groupEventsSelected(bool);
172 /** 172 /**
173 Emitted when an incidence gets selected. If the selection is cleared the 173 Emitted when an incidence gets selected. If the selection is cleared the
174 signal is emitted with 0 as argument. 174 signal is emitted with 0 as argument.
175 */ 175 */
176 void incidenceSelected( Incidence * ); 176 void incidenceSelected( Incidence * );
177 /** Emitted, when a todoitem is selected or deselected. */ 177 /** Emitted, when a todoitem is selected or deselected. */
178 void todoSelected( bool ); 178 void todoSelected( bool );
179 179
180 /** 180 /**
181 Emitted, when clipboard content changes. Parameter indicates if paste 181 Emitted, when clipboard content changes. Parameter indicates if paste
182 is possible or not. 182 is possible or not.
183 */ 183 */
184 void pasteEnabled(bool); 184 void pasteEnabled(bool);
185 185
186 /** Emitted, when the number of incoming messages has changed. */ 186 /** Emitted, when the number of incoming messages has changed. */
187 void numIncomingChanged(int); 187 void numIncomingChanged(int);
188 188
189 /** Emitted, when the number of outgoing messages has changed. */ 189 /** Emitted, when the number of outgoing messages has changed. */
190 void numOutgoingChanged(int); 190 void numOutgoingChanged(int);
191 191
192 /** Send status message, which can e.g. be displayed in the status bar. */ 192 /** Send status message, which can e.g. be displayed in the status bar. */
193 void statusMessage(const QString &); 193 void statusMessage(const QString &);
194 194
195 void calendarViewExpanded( bool ); 195 void calendarViewExpanded( bool );
196 void updateSearchDialog(); 196 void updateSearchDialog();
197 void filtersUpdated();
197 198
198 199
199 public slots: 200 public slots:
200 void checkAlarms(); 201 void checkAlarms();
201 void slotprintSelInc(); 202 void slotprintSelInc();
202 void showNextAlarms(); 203 void showNextAlarms();
203 void showOpenError(); 204 void showOpenError();
204 void watchSavedFile(); 205 void watchSavedFile();
205 void recheckTimerAlarm(); 206 void recheckTimerAlarm();
206 void checkNextTimerAlarm(); 207 void checkNextTimerAlarm();
207 void addAlarm(const QDateTime &qdt, const QString &noti ); 208 void addAlarm(const QDateTime &qdt, const QString &noti );
208 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 209 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
209 void removeAlarm(const QDateTime &qdt, const QString &noti ); 210 void removeAlarm(const QDateTime &qdt, const QString &noti );
210 211
211 /** options dialog made a changed to the configuration. we catch this 212 /** options dialog made a changed to the configuration. we catch this
212 * and notify all widgets which need to update their configuration. */ 213 * and notify all widgets which need to update their configuration. */
213 void updateConfig(); 214 void updateConfig();
214 215
215 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 216 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
216 const QStringList& anniversaryList, const QStringList& realNameList, 217 const QStringList& anniversaryList, const QStringList& realNameList,
217 const QStringList& emailList, const QStringList& assembledNameList, 218 const QStringList& emailList, const QStringList& assembledNameList,
218 const QStringList& uidList); 219 const QStringList& uidList);
219 220
220 /** 221 /**
221 Load calendar from file \a filename. If \a merge is true, load 222 Load calendar from file \a filename. If \a merge is true, load
222 calendar into existing one, if it is false, clear calendar, before 223 calendar into existing one, if it is false, clear calendar, before
223 loading. Return true, if calendar could be successfully loaded. 224 loading. Return true, if calendar could be successfully loaded.
224 */ 225 */
225 bool openCalendar(QString filename, bool merge=false); 226 bool openCalendar(QString filename, bool merge=false);
226 bool loadCalendars(); 227 bool loadCalendars();
227 bool saveCalendars(); 228 bool saveCalendars();
228 bool restoreCalendarSettings(); 229 bool restoreCalendarSettings();
229 bool addCalendar( KopiCalendarFile * ); 230 bool addCalendar( KopiCalendarFile * );
230 void addCalendarId( int id ); 231 void addCalendarId( int id );
231 bool syncCalendar(QString filename,int mode = 0 ); 232 bool syncCalendar(QString filename,int mode = 0 );
232 233
233 /** 234 /**
234 Save calendar data to file. Return true if calendar could be 235 Save calendar data to file. Return true if calendar could be
235 successfully saved. 236 successfully saved.
236 */ 237 */
237 bool saveCalendar(QString filename); 238 bool saveCalendar(QString filename);
238 239
239 /** 240 /**
240 Close calendar. Clear calendar data and reset views to display an empty 241 Close calendar. Clear calendar data and reset views to display an empty
241 calendar. 242 calendar.
242 */ 243 */
243 void closeCalendar(); 244 void closeCalendar();
244 245
245 /** Archive old events of calendar */ 246 /** Archive old events of calendar */
246 void archiveCalendar(); 247 void archiveCalendar();
247 248
248 void showIncidence(); 249 void showIncidence();
249 void editIncidence(); 250 void editIncidence();
250 void editIncidenceDescription(); 251 void editIncidenceDescription();
251 void deleteIncidence(); 252 void deleteIncidence();
252 void cloneIncidence(); 253 void cloneIncidence();
253 void moveIncidence(); 254 void moveIncidence();
254 void beamIncidence(); 255 void beamIncidence();
255 void toggleCancelIncidence(); 256 void toggleCancelIncidence();
256 257
257 /** create an editeventwin with supplied date/time, and if bool is true, 258 /** create an editeventwin with supplied date/time, and if bool is true,
258 * make the event take all day. */ 259 * make the event take all day. */
259 void newEvent(QDateTime, QDateTime, bool allDay ); 260 void newEvent(QDateTime, QDateTime, bool allDay );
260 void newEvent(QDateTime, QDateTime); 261 void newEvent(QDateTime, QDateTime);
261 void newEvent(QDateTime fh); 262 void newEvent(QDateTime fh);
262 void newEvent(QDate dt); 263 void newEvent(QDate dt);
263 /** create new event without having a date hint. Takes current date as 264 /** create new event without having a date hint. Takes current date as
264 default hint. */ 265 default hint. */
265 void newEvent(); 266 void newEvent();
266 void newFloatingEvent(); 267 void newFloatingEvent();
267 268
268 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 269 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
269 void showIncidence(Incidence *); 270 void showIncidence(Incidence *);
270 void showIncidence(QString uid); 271 void showIncidence(QString uid);
271 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 272 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
272 void editIncidence(Incidence *); 273 void editIncidence(Incidence *);
273 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 274 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
274 void deleteIncidence(Incidence *); 275 void deleteIncidence(Incidence *);
275 void cloneIncidence(Incidence *); 276 void cloneIncidence(Incidence *);
276 void cancelIncidence(Incidence *); 277 void cancelIncidence(Incidence *);
277 /** Create an editor for the supplied event. */ 278 /** Create an editor for the supplied event. */
278 void editEvent(Event *); 279 void editEvent(Event *);
279 /** Delete the supplied event. */ 280 /** Delete the supplied event. */
280 void deleteEvent(Event *); 281 void deleteEvent(Event *);
281 /** Delete the event with the given unique ID. Returns false, if event wasn't 282 /** Delete the event with the given unique ID. Returns false, if event wasn't
282 found. */ 283 found. */
283 bool deleteEvent(const QString &uid); 284 bool deleteEvent(const QString &uid);
284 /** Create a read-only viewer dialog for the supplied event. */ 285 /** Create a read-only viewer dialog for the supplied event. */
285 void showEvent(Event *); 286 void showEvent(Event *);
286 287
287 void editJournal(Journal *); 288 void editJournal(Journal *);
288 void showJournal(Journal *); 289 void showJournal(Journal *);
289 void deleteJournal(Journal *); 290 void deleteJournal(Journal *);
290 /** Create an editor dialog for a todo */ 291 /** Create an editor dialog for a todo */
291 void editTodo(Todo *); 292 void editTodo(Todo *);
292 /** Create a read-only viewer dialog for the supplied todo */ 293 /** Create a read-only viewer dialog for the supplied todo */
293 void showTodo(Todo *); 294 void showTodo(Todo *);
294 /** create new todo */ 295 /** create new todo */
295 void newTodo(); 296 void newTodo();
296 void newTodoDateTime(QDateTime, bool allday); 297 void newTodoDateTime(QDateTime, bool allday);
297 /** create new todo with a parent todo */ 298 /** create new todo with a parent todo */
298 void newSubTodo(); 299 void newSubTodo();
299 /** create new todo with a parent todo */ 300 /** create new todo with a parent todo */
300 void newSubTodo(Todo *); 301 void newSubTodo(Todo *);
301 /** Delete todo */ 302 /** Delete todo */
302 void deleteTodo(Todo *); 303 void deleteTodo(Todo *);
303 304
304 305
305 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 306 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
306 * emitted as result. */ 307 * emitted as result. */
307 void checkClipboard(); 308 void checkClipboard();
308 309
309 /** using the KConfig associated with the kapp variable, read in the 310 /** using the KConfig associated with the kapp variable, read in the
310 * settings from the config file. 311 * settings from the config file.
311 */ 312 */
312 void readSettings(); 313 void readSettings();
313 314
314 /** write current state to config file. */ 315 /** write current state to config file. */
315 void writeSettings(); 316 void writeSettings();
316 317
317 /** read settings for calendar filters */ 318 /** read settings for calendar filters */
318 void readFilterSettings(KConfig *config); 319 void readFilterSettings(KConfig *config);
319 320
320 /** write settings for calendar filters */ 321 /** write settings for calendar filters */
321 void writeFilterSettings(KConfig *config); 322 void writeFilterSettings(KConfig *config);
322 323
323 /** passes on the message that an event has changed to the currently 324 /** passes on the message that an event has changed to the currently
324 * activated view so that it can make appropriate display changes. */ 325 * activated view so that it can make appropriate display changes. */
325 void changeEventDisplay(Event *, int); 326 void changeEventDisplay(Event *, int);
326 void changeIncidenceDisplay(Incidence *, int); 327 void changeIncidenceDisplay(Incidence *, int);
327 void changeTodoDisplay(Todo *, int); 328 void changeTodoDisplay(Todo *, int);
328 329
329 void eventAdded(Event *); 330 void eventAdded(Event *);
330 void eventChanged(Event *); 331 void eventChanged(Event *);
331 void eventToBeDeleted(Event *); 332 void eventToBeDeleted(Event *);
332 void eventDeleted(); 333 void eventDeleted();
333 334
334 void todoAdded(Todo *); 335 void todoAdded(Todo *);
335 void todoChanged(Todo *); 336 void todoChanged(Todo *);
336 void todoToBeDeleted(Todo *); 337 void todoToBeDeleted(Todo *);
337 void todoDeleted(); 338 void todoDeleted();
338 339
339 void updateView(const QDate &start, const QDate &end); 340 void updateView(const QDate &start, const QDate &end);
340 void updateView(); 341 void updateView();
341 void clearAllViews(); 342 void clearAllViews();
342 343
343 /** Full update of visible todo views */ 344 /** Full update of visible todo views */
344 void updateTodoViews(); 345 void updateTodoViews();
345 346
346 void updateUnmanagedViews(); 347 void updateUnmanagedViews();
347 348
348 /** cut the current appointment to the clipboard */ 349 /** cut the current appointment to the clipboard */
349 void edit_cut(); 350 void edit_cut();
350 351
351 /** copy the current appointment(s) to the clipboard */ 352 /** copy the current appointment(s) to the clipboard */
352 void edit_copy(); 353 void edit_copy();
353 354
354 /** paste the current vobject(s) in the clipboard buffer into calendar */ 355 /** paste the current vobject(s) in the clipboard buffer into calendar */
355 void edit_paste(); 356 void edit_paste();
356 357
357 /** edit viewing and configuration options. */ 358 /** edit viewing and configuration options. */
358 void edit_options(); 359 void edit_options();
359 void edit_global_options(); 360 void edit_global_options();
360 /** 361 /**
361 Functions for printing, previewing a print, and setting up printing 362 Functions for printing, previewing a print, and setting up printing
362 parameters. 363 parameters.
363 */ 364 */
364 void print(); 365 void print();
365 void printSetup(); 366 void printSetup();
366 void printPreview(); 367 void printPreview();
367 368
368 /** Export as iCalendar file */ 369 /** Export as iCalendar file */
369 void exportICalendar(); 370 void exportICalendar();
370 371
371 /** Export as vCalendar file */ 372 /** Export as vCalendar file */
372 bool exportVCalendar( QString fn); 373 bool exportVCalendar( QString fn);
373 374
374 /** pop up a dialog to show an existing appointment. */ 375 /** pop up a dialog to show an existing appointment. */
375 void appointment_show(); 376 void appointment_show();
376 /** 377 /**
377 * pop up an Appointment Dialog to edit an existing appointment.Get 378 * pop up an Appointment Dialog to edit an existing appointment.Get
378 * information on the appointment from the list of unique IDs that is 379 * information on the appointment from the list of unique IDs that is
379 * currently in the View, called currIds. 380 * currently in the View, called currIds.
380 */ 381 */
381 void appointment_edit(); 382 void appointment_edit();
382 /** 383 /**
383 * pop up dialog confirming deletion of currently selected event in the 384 * pop up dialog confirming deletion of currently selected event in the
384 * View. 385 * View.
385 */ 386 */
386 void appointment_delete(); 387 void appointment_delete();
387 388
388 /** mails the currently selected event to a particular user as a vCalendar 389 /** mails the currently selected event to a particular user as a vCalendar
389 attachment. */ 390 attachment. */
390 void action_mail(); 391 void action_mail();
391 392
392 /* frees a subtodo from it's relation */ 393 /* frees a subtodo from it's relation */
393 void todo_unsub( Todo * ); 394 void todo_unsub( Todo * );
394 void todo_resub( Todo * parent, Todo * sub ); 395 void todo_resub( Todo * parent, Todo * sub );
395 396
396 /** Take ownership of selected event. */ 397 /** Take ownership of selected event. */
397 void takeOverEvent(); 398 void takeOverEvent();
398 399
399 /** Take ownership of all events in calendar. */ 400 /** Take ownership of all events in calendar. */
400 void takeOverCalendar(); 401 void takeOverCalendar();
401 402
402 /** query whether or not the calendar is "dirty". */ 403 /** query whether or not the calendar is "dirty". */
403 bool isModified(); 404 bool isModified();
404 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 405 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
405 void setModified(bool modified=true); 406 void setModified(bool modified=true);
406 407
407 /** query if the calendar is read-only. */ 408 /** query if the calendar is read-only. */
408 bool isReadOnly(); 409 bool isReadOnly();
409 /** set state of calendar to read-only */ 410 /** set state of calendar to read-only */
410 void setReadOnly(bool readOnly=true); 411 void setReadOnly(bool readOnly=true);
411 412
412 void eventUpdated(Incidence *); 413 void eventUpdated(Incidence *);
413 414
414 /* iTIP scheduling actions */ 415 /* iTIP scheduling actions */
415 void schedule_publish(Incidence *incidence = 0); 416 void schedule_publish(Incidence *incidence = 0);
416 void schedule_request(Incidence *incidence = 0); 417 void schedule_request(Incidence *incidence = 0);
417 void schedule_refresh(Incidence *incidence = 0); 418 void schedule_refresh(Incidence *incidence = 0);
418 void schedule_cancel(Incidence *incidence = 0); 419 void schedule_cancel(Incidence *incidence = 0);
419 void schedule_add(Incidence *incidence = 0); 420 void schedule_add(Incidence *incidence = 0);
420 void schedule_reply(Incidence *incidence = 0); 421 void schedule_reply(Incidence *incidence = 0);
421 void schedule_counter(Incidence *incidence = 0); 422 void schedule_counter(Incidence *incidence = 0);
422 void schedule_declinecounter(Incidence *incidence = 0); 423 void schedule_declinecounter(Incidence *incidence = 0);
423 void schedule_publish_freebusy(int daysToPublish = 30); 424 void schedule_publish_freebusy(int daysToPublish = 30);
424 425
425 void openAddressbook(); 426 void openAddressbook();
426 427
427 void editFilters(); 428 void editFilters();
428 void toggleFilerEnabled(); 429 void toggleFilerEnabled();
429 QPtrList<CalFilter> filters(); 430 QPtrList<CalFilter> filters();
430 void toggleFilter(); 431 void toggleFilter();
431 void showFilter(bool visible); 432 void showFilter(bool visible);
432 void updateFilter(); 433 void updateFilter();
433 void filterEdited(); 434 void filterEdited();
434 void selectFilter( int ); 435 void selectFilter( int );
435 KOFilterView *filterView(); 436 KOFilterView *filterView();
436 437
437 void showIntro(); 438 void showIntro();
438 439
439 /** Move the curdatepient view date to today */ 440 /** Move the curdatepient view date to today */
440 void goToday(); 441 void goToday();
441 442
442 /** Move to the next date(s) in the current view */ 443 /** Move to the next date(s) in the current view */
443 void goNext(); 444 void goNext();
444 445
445 /** Move to the previous date(s) in the current view */ 446 /** Move to the previous date(s) in the current view */
446 void goPrevious(); 447 void goPrevious();
447 /** Move to the next date(s) in the current view */ 448 /** Move to the next date(s) in the current view */
448 void goNextMonth(); 449 void goNextMonth();
449 450
450 /** Move to the previous date(s) in the current view */ 451 /** Move to the previous date(s) in the current view */
451 void goPreviousMonth(); 452 void goPreviousMonth();
452 453
453 void toggleExpand(); 454 void toggleExpand();
454 void toggleDateNavigatorWidget(); 455 void toggleDateNavigatorWidget();
455 void toggleAllDaySize(); 456 void toggleAllDaySize();
456 void dialogClosing(Incidence *); 457 void dialogClosing(Incidence *);
457 458
458 /** Look for new messages in the inbox */ 459 /** Look for new messages in the inbox */
459 void lookForIncomingMessages(); 460 void lookForIncomingMessages();
460 /** Look for new messages in the outbox */ 461 /** Look for new messages in the outbox */
461 void lookForOutgoingMessages(); 462 void lookForOutgoingMessages();
462 463
463 void processMainViewSelection( Incidence * ); 464 void processMainViewSelection( Incidence * );
464 void processTodoListSelection( Incidence * ); 465 void processTodoListSelection( Incidence * );
465 466
466 void processIncidenceSelection( Incidence * ); 467 void processIncidenceSelection( Incidence * );
467 468
468 void purgeCompleted(); 469 void purgeCompleted();
469 bool removeCompletedSubTodos( Todo* ); 470 bool removeCompletedSubTodos( Todo* );
470 void slotCalendarChanged(); 471 void slotCalendarChanged();
471 bool importBday(); 472 bool importBday();
472 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 473 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
473 bool importQtopia( const QString &categoriesFile, 474 bool importQtopia( const QString &categoriesFile,
474 const QString &datebookFile, 475 const QString &datebookFile,
475 const QString &tasklistFile ); 476 const QString &tasklistFile );
476 void syncExternal( int mode ); 477 void syncExternal( int mode );
477 void slotSelectPickerDate( QDate ) ; 478 void slotSelectPickerDate( QDate ) ;
478 void showDatePicker() ; 479 void showDatePicker() ;
479 void showDatePickerPopup() ; 480 void showDatePickerPopup() ;
480 void moveIncidence(Incidence *) ; 481 void moveIncidence(Incidence *) ;
481 void beamIncidence(Incidence *) ; 482 void beamIncidence(Incidence *) ;
482 void beamCalendar() ; 483 void beamCalendar() ;
483 void beamFilteredCalendar() ; 484 void beamFilteredCalendar() ;
484 void beamIncidenceList(QPtrList<Incidence>) ; 485 void beamIncidenceList(QPtrList<Incidence>) ;
485 void manageCategories(); 486 void manageCategories();
486 int addCategories(); 487 int addCategories();
487 void removeCategories(); 488 void removeCategories();
488 void setSyncDevice( QString ); 489 void setSyncDevice( QString );
489 void setSyncName( QString ); 490 void setSyncName( QString );
490 void showDay( QDate ); 491 void showDay( QDate );
491 void undo_delete(); 492 void undo_delete();
492 protected slots: 493 protected slots:
493 void resetFocus(); 494 void resetFocus();
494 void slotViewerClosed(); 495 void slotViewerClosed();
495 void timerAlarm(); 496 void timerAlarm();
496 void suspendAlarm(); 497 void suspendAlarm();
497 void beamDone( Ir *ir ); 498 void beamDone( Ir *ir );
498 /** Select a view or adapt the current view to display the specified dates. */ 499 /** Select a view or adapt the current view to display the specified dates. */
499 void showDates( const KCal::DateList & ); 500 void showDates( const KCal::DateList & );
500 void selectWeekNum ( int ); 501 void selectWeekNum ( int );
501 502
502 public: 503 public:
503 // show a standard warning 504 // show a standard warning
504 // returns KMsgBox::yesNoCancel() 505 // returns KMsgBox::yesNoCancel()
505 int msgCalModified(); 506 int msgCalModified();
506 virtual bool sync(KSyncManager* manager, QString filename, int mode); 507 virtual bool sync(KSyncManager* manager, QString filename, int mode);
507 508
508 virtual bool syncExternal(KSyncManager* manager, QString resource); 509 virtual bool syncExternal(KSyncManager* manager, QString resource);
509 virtual void removeSyncInfo( QString syncProfile); 510 virtual void removeSyncInfo( QString syncProfile);
510 void setSyncManager(KSyncManager* manager); 511 void setSyncManager(KSyncManager* manager);
511 void setLoadedFileVersion(QDateTime); 512 void setLoadedFileVersion(QDateTime);
512 bool checkFileVersion(QString fn); 513 bool checkFileVersion(QString fn);
513 bool checkAllFileVersions(); 514 bool checkAllFileVersions();
514 bool checkFileChanged(QString fn); 515 bool checkFileChanged(QString fn);
515 Event* getLastSyncEvent(); 516 Event* getLastSyncEvent();
516 /** Adapt navigation units correpsonding to step size of navigation of the 517 /** Adapt navigation units correpsonding to step size of navigation of the
517 * current view. 518 * current view.
518 */ 519 */
519 void adaptNavigationUnits(); 520 void adaptNavigationUnits();
520 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 521 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
521 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 522 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
522 //Attendee* getYourAttendee(Event *event); 523 //Attendee* getYourAttendee(Event *event);
523 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 524 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
524 protected: 525 protected:
525 void schedule(Scheduler::Method, Incidence *incidence = 0); 526 void schedule(Scheduler::Method, Incidence *incidence = 0);
526 527
527 // returns KMsgBox::OKCandel() 528 // returns KMsgBox::OKCandel()
528 int msgItemDelete(const QString name); 529 int msgItemDelete(const QString name);
529 void showEventEditor(); 530 void showEventEditor();
530 void showTodoEditor(); 531 void showTodoEditor();
531 void writeLocale(); 532 void writeLocale();
532 Todo *selectedTodo(); 533 Todo *selectedTodo();
533 534
534 private: 535 private:
535 QDateTime mNextAlarmDateTime; 536 QDateTime mNextAlarmDateTime;
536 bool mViewerCallerIsSearchDialog; 537 bool mViewerCallerIsSearchDialog;
537 bool mBlockShowDates; 538 bool mBlockShowDates;
538 KSyncManager* mSyncManager; 539 KSyncManager* mSyncManager;
539 AlarmDialog * mAlarmDialog; 540 AlarmDialog * mAlarmDialog;
540 QString mAlarmNotification; 541 QString mAlarmNotification;
541 QString mSuspendAlarmNotification; 542 QString mSuspendAlarmNotification;
542 QTimer* mSuspendTimer; 543 QTimer* mSuspendTimer;
543 QTimer* mAlarmTimer; 544 QTimer* mAlarmTimer;
544 QTimer* mRecheckAlarmTimer; 545 QTimer* mRecheckAlarmTimer;
545 void computeAlarm( QString ); 546 void computeAlarm( QString );
546 void startAlarm( QString, QString ); 547 void startAlarm( QString, QString );
547 void setSyncEventsReadOnly(); 548 void setSyncEventsReadOnly();
548 549
549 QDateTime loadedFileVersion; 550 QDateTime loadedFileVersion;
550 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 551 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
551 void checkExternalId( Incidence * inc ); 552 void checkExternalId( Incidence * inc );
552 int mGlobalSyncMode; 553 int mGlobalSyncMode;
553 QString mCurrentSyncDevice; 554 QString mCurrentSyncDevice;
554 QString mCurrentSyncName; 555 QString mCurrentSyncName;
555 KOBeamPrefs* beamDialog; 556 KOBeamPrefs* beamDialog;
556 void init(); 557 void init();
557 int mDatePickerMode; 558 int mDatePickerMode;
558 bool mFlagEditDescription; 559 bool mFlagEditDescription;
559 QDateTime mLastCalendarSync; 560 QDateTime mLastCalendarSync;
560 void createPrinter(); 561 void createPrinter();
561 562
562 void calendarModified( bool, Calendar * ); 563 void calendarModified( bool, Calendar * );
563 564
564 CalPrinter *mCalPrinter; 565 CalPrinter *mCalPrinter;
565 566
566 QSplitter *mPanner; 567 QSplitter *mPanner;
567 QSplitter *mLeftSplitter; 568 QSplitter *mLeftSplitter;
568 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 569 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
569 QWidgetStack *mRightFrame; 570 QWidgetStack *mRightFrame;
570 571
571 KDatePicker* mDatePicker; 572 KDatePicker* mDatePicker;
572 QVBox* mDateFrame; 573 QVBox* mDateFrame;
573 574
574 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 575 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
575 576
576 KOFilterView *mFilterView; 577 KOFilterView *mFilterView;
577 KOCalEditView *mCalEditView; 578 KOCalEditView *mCalEditView;
578 579
579 ResourceView *mResourceView; 580 ResourceView *mResourceView;
580 581
581 // calendar object for this viewing instance 582 // calendar object for this viewing instance
582 Calendar *mCalendar; 583 Calendar *mCalendar;
583 584
584 CalendarResourceManager *mResourceManager; 585 CalendarResourceManager *mResourceManager;
585 586
586 FileStorage *mStorage; 587 FileStorage *mStorage;
587 588
588 DateNavigator *mNavigator; 589 DateNavigator *mNavigator;
589 590
590 KOViewManager *mViewManager; 591 KOViewManager *mViewManager;
591 KODialogManager *mDialogManager; 592 KODialogManager *mDialogManager;
592 593
593 // Calendar filters 594 // Calendar filters
594 QPtrList<CalFilter> mFilters; 595 QPtrList<CalFilter> mFilters;
595 596
596 // various housekeeping variables. 597 // various housekeeping variables.
597 bool mModified; // flag indicating if calendar is modified 598 bool mModified; // flag indicating if calendar is modified
598 bool mReadOnly; // flag indicating if calendar is read-only 599 bool mReadOnly; // flag indicating if calendar is read-only
599 QDate mSaveSingleDate; 600 QDate mSaveSingleDate;
600 601
601 Incidence *mSelectedIncidence; 602 Incidence *mSelectedIncidence;
602 Incidence *mMoveIncidence; 603 Incidence *mMoveIncidence;
603 QDate mMoveIncidenceOldDate; 604 QDate mMoveIncidenceOldDate;
604 KOTodoView *mTodoList; 605 KOTodoView *mTodoList;
605 KOEventEditor * mEventEditor; 606 KOEventEditor * mEventEditor;
606 KOTodoEditor * mTodoEditor; 607 KOTodoEditor * mTodoEditor;
607 KOEventViewerDialog * mEventViewerDialog; 608 KOEventViewerDialog * mEventViewerDialog;
608 void keyPressEvent ( QKeyEvent *e) ; 609 void keyPressEvent ( QKeyEvent *e) ;
609 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 610 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
610}; 611};
611 612
612 613
613class CalendarViewVisitor : public Incidence::Visitor 614class CalendarViewVisitor : public Incidence::Visitor
614{ 615{
615 public: 616 public:
616 CalendarViewVisitor() : mView( 0 ) {} 617 CalendarViewVisitor() : mView( 0 ) {}
617 618
618 bool act( Incidence *incidence, CalendarView *view ) 619 bool act( Incidence *incidence, CalendarView *view )
619 { 620 {
620 mView = view; 621 mView = view;
621 return incidence->accept( *this ); 622 return incidence->accept( *this );
622 } 623 }
623 624
624 protected: 625 protected:
625 CalendarView *mView; 626 CalendarView *mView;
626}; 627};
627 628
628class ShowIncidenceVisitor : public CalendarViewVisitor 629class ShowIncidenceVisitor : public CalendarViewVisitor
629{ 630{
630 protected: 631 protected:
631 bool visit( Event *event ) { mView->showEvent( event ); return true; } 632 bool visit( Event *event ) { mView->showEvent( event ); return true; }
632 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 633 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
633 bool visit( Journal * j ) { mView->showJournal( j );return true; } 634 bool visit( Journal * j ) { mView->showJournal( j );return true; }
634}; 635};
635 636
636class EditIncidenceVisitor : public CalendarViewVisitor 637class EditIncidenceVisitor : public CalendarViewVisitor
637{ 638{
638 protected: 639 protected:
639 bool visit( Event *event ) { mView->editEvent( event ); return true; } 640 bool visit( Event *event ) { mView->editEvent( event ); return true; }
640 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 641 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
641 bool visit( Journal *j ) { mView->editJournal( j); return true; } 642 bool visit( Journal *j ) { mView->editJournal( j); return true; }
642}; 643};
643 644
644class DeleteIncidenceVisitor : public CalendarViewVisitor 645class DeleteIncidenceVisitor : public CalendarViewVisitor
645{ 646{
646 protected: 647 protected:
647 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 648 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
648 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 649 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
649 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 650 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
650}; 651};
651 652
652#endif 653#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 472a978..13e186d 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -536,1537 +536,1537 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
536 } 536 }
537 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 537 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
538 if ( msg == "-newEvent" ) { 538 if ( msg == "-newEvent" ) {
539 mView->newEvent(); 539 mView->newEvent();
540 } 540 }
541 if ( msg == "-newTodo" ) { 541 if ( msg == "-newTodo" ) {
542 mView->newTodo(); 542 mView->newTodo();
543 543
544 } 544 }
545 if ( msg == "-showWN" ) { 545 if ( msg == "-showWN" ) {
546 mView->viewManager()->showWhatsNextView(); 546 mView->viewManager()->showWhatsNextView();
547 } 547 }
548 if ( msg == "-showTodo" ) { 548 if ( msg == "-showTodo" ) {
549 mView->viewManager()->showTodoView(); 549 mView->viewManager()->showTodoView();
550 } 550 }
551 if ( msg == "-showList" ) { 551 if ( msg == "-showList" ) {
552 mView->viewManager()->showListView(); 552 mView->viewManager()->showListView();
553 } 553 }
554 else if ( msg == "-showDay" ) { 554 else if ( msg == "-showDay" ) {
555 mView->viewManager()->showDayView(); 555 mView->viewManager()->showDayView();
556 } 556 }
557 else if ( msg == "-showWWeek" ) { 557 else if ( msg == "-showWWeek" ) {
558 mView->viewManager()->showWorkWeekView(); 558 mView->viewManager()->showWorkWeekView();
559 } 559 }
560 else if ( msg == "-ringSync" ) { 560 else if ( msg == "-ringSync" ) {
561 mSyncManager->multiSync( false ); 561 mSyncManager->multiSync( false );
562 } 562 }
563 else if ( msg == "-showWeek" ) { 563 else if ( msg == "-showWeek" ) {
564 mView->viewManager()->showWeekView(); 564 mView->viewManager()->showWeekView();
565 } 565 }
566 else if ( msg == "-showTodo" ) { 566 else if ( msg == "-showTodo" ) {
567 mView->viewManager()->showTodoView(); 567 mView->viewManager()->showTodoView();
568 } 568 }
569 else if ( msg == "-showJournal" ) { 569 else if ( msg == "-showJournal" ) {
570 mView->dateNavigator()->selectDates( 1 ); 570 mView->dateNavigator()->selectDates( 1 );
571 mView->dateNavigator()->selectToday(); 571 mView->dateNavigator()->selectToday();
572 mView->viewManager()->showJournalView(); 572 mView->viewManager()->showJournalView();
573 } 573 }
574 else if ( msg == "-showKO" ) { 574 else if ( msg == "-showKO" ) {
575 mView->viewManager()->showNextXView(); 575 mView->viewManager()->showNextXView();
576 } 576 }
577 else if ( msg == "-showWNext" ) { 577 else if ( msg == "-showWNext" ) {
578 mView->viewManager()->showWhatsNextView(); 578 mView->viewManager()->showWhatsNextView();
579 } 579 }
580 else if ( msg == "nextView()" ) { 580 else if ( msg == "nextView()" ) {
581 mView->viewManager()->showNextView(); 581 mView->viewManager()->showNextView();
582 } 582 }
583 else if ( msg == "-showNextXView" ) { 583 else if ( msg == "-showNextXView" ) {
584 mView->viewManager()->showNextXView(); 584 mView->viewManager()->showNextXView();
585 } 585 }
586 586
587 587
588 } 588 }
589 589
590 showMaximized(); 590 showMaximized();
591 raise(); 591 raise();
592} 592}
593 593
594QPixmap MainWindow::loadPixmap( QString name ) 594QPixmap MainWindow::loadPixmap( QString name )
595{ 595{
596 return SmallIcon( name ); 596 return SmallIcon( name );
597 597
598} 598}
599void MainWindow::setUsesBigPixmaps ( bool b ) 599void MainWindow::setUsesBigPixmaps ( bool b )
600{ 600{
601 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 601 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
602 if ( b ) 602 if ( b )
603 qDebug("KO: BigPixmaps are not supported "); 603 qDebug("KO: BigPixmaps are not supported ");
604} 604}
605void MainWindow::initActions() 605void MainWindow::initActions()
606{ 606{
607 //KOPrefs::instance()->mShowFullMenu 607 //KOPrefs::instance()->mShowFullMenu
608 iconToolBar->clear(); 608 iconToolBar->clear();
609 KOPrefs *p = KOPrefs::instance(); 609 KOPrefs *p = KOPrefs::instance();
610 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 610 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
611 611
612 QPopupMenu *viewMenu = new QPopupMenu( this ); 612 QPopupMenu *viewMenu = new QPopupMenu( this );
613 QPopupMenu *actionMenu = new QPopupMenu( this ); 613 QPopupMenu *actionMenu = new QPopupMenu( this );
614 QPopupMenu *importMenu = new QPopupMenu( this ); 614 QPopupMenu *importMenu = new QPopupMenu( this );
615 QPopupMenu *importMenu_X = new QPopupMenu( this ); 615 QPopupMenu *importMenu_X = new QPopupMenu( this );
616 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 616 QPopupMenu *exportMenu_X = new QPopupMenu( this );
617 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 617 QPopupMenu *beamMenu_X = new QPopupMenu( this );
618 selectFilterMenu = new QPopupMenu( this ); 618 selectFilterMenu = new QPopupMenu( this );
619 selectFilterMenu->setCheckable( true ); 619 selectFilterMenu->setCheckable( true );
620 syncMenu = new QPopupMenu( this ); 620 syncMenu = new QPopupMenu( this );
621 configureAgendaMenu = new QPopupMenu( this ); 621 configureAgendaMenu = new QPopupMenu( this );
622 configureToolBarMenu = new QPopupMenu( this ); 622 configureToolBarMenu = new QPopupMenu( this );
623 QPopupMenu *helpMenu = new QPopupMenu( this ); 623 QPopupMenu *helpMenu = new QPopupMenu( this );
624 QIconSet icon; 624 QIconSet icon;
625 int pixWid = 22, pixHei = 22; 625 int pixWid = 22, pixHei = 22;
626 QString pathString = ""; 626 QString pathString = "";
627 if ( !p->mToolBarMiniIcons ) { 627 if ( !p->mToolBarMiniIcons ) {
628 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 628 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
629 pathString += "icons16/"; 629 pathString += "icons16/";
630 pixWid = 18; pixHei = 16; 630 pixWid = 18; pixHei = 16;
631 } 631 }
632 } else { 632 } else {
633 pathString += "iconsmini/"; 633 pathString += "iconsmini/";
634 pixWid = 18; pixHei = 16; 634 pixWid = 18; pixHei = 16;
635 } 635 }
636 if ( KOPrefs::instance()->mShowFullMenu ) { 636 if ( KOPrefs::instance()->mShowFullMenu ) {
637 QMenuBar *menuBar1; 637 QMenuBar *menuBar1;
638 menuBar1 = menuBar(); 638 menuBar1 = menuBar();
639 menuBar1->insertItem( i18n("File"), importMenu ); 639 menuBar1->insertItem( i18n("File"), importMenu );
640 menuBar1->insertItem( i18n("View"), viewMenu ); 640 menuBar1->insertItem( i18n("View"), viewMenu );
641 menuBar1->insertItem( i18n("Actions"), actionMenu ); 641 menuBar1->insertItem( i18n("Actions"), actionMenu );
642#ifdef DESKTOP_VERSION 642#ifdef DESKTOP_VERSION
643 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 643 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
644 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 644 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
645#else 645#else
646 menuBar1->insertItem( i18n("Sync"), syncMenu ); 646 menuBar1->insertItem( i18n("Sync"), syncMenu );
647 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 647 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
648#endif 648#endif
649 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 649 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
650 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 650 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
651 menuBar1->insertItem( i18n("Help"), helpMenu ); 651 menuBar1->insertItem( i18n("Help"), helpMenu );
652 } else { 652 } else {
653 QPEMenuBar *menuBar1; 653 QPEMenuBar *menuBar1;
654 menuBar1 = new QPEMenuBar( iconToolBar ); 654 menuBar1 = new QPEMenuBar( iconToolBar );
655 QPopupMenu *menuBar = new QPopupMenu( this ); 655 QPopupMenu *menuBar = new QPopupMenu( this );
656 icon = loadPixmap( pathString + "z_menu" ); 656 icon = loadPixmap( pathString + "z_menu" );
657 menuBar1->insertItem( icon.pixmap(), menuBar); 657 menuBar1->insertItem( icon.pixmap(), menuBar);
658 //menuBar1->insertItem( i18n("ME"), menuBar); 658 //menuBar1->insertItem( i18n("ME"), menuBar);
659 menuBar->insertItem( i18n("File"), importMenu ); 659 menuBar->insertItem( i18n("File"), importMenu );
660 menuBar->insertItem( i18n("View"), viewMenu ); 660 menuBar->insertItem( i18n("View"), viewMenu );
661 menuBar->insertItem( i18n("Actions"), actionMenu ); 661 menuBar->insertItem( i18n("Actions"), actionMenu );
662 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 662 menuBar->insertItem( i18n("Synchronize"), syncMenu );
663 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 663 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
664 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 664 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
665 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 665 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
666 menuBar->insertItem( i18n("Help"), helpMenu ); 666 menuBar->insertItem( i18n("Help"), helpMenu );
667 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 667 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
668 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 668 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
669 } 669 }
670 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 670 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
671 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 671 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
672 672
673 673
674 mWeekBgColor = iconToolBar->backgroundColor(); 674 mWeekBgColor = iconToolBar->backgroundColor();
675 mWeekPixmap.resize( pixWid , pixHei ); 675 mWeekPixmap.resize( pixWid , pixHei );
676 mWeekPixmap.fill( mWeekBgColor ); 676 mWeekPixmap.fill( mWeekBgColor );
677 icon = mWeekPixmap; 677 icon = mWeekPixmap;
678 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 678 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
679 if ( p-> mShowIconWeekNum ) 679 if ( p-> mShowIconWeekNum )
680 mWeekAction->addTo( iconToolBar ); 680 mWeekAction->addTo( iconToolBar );
681 mWeekFont = font(); 681 mWeekFont = font();
682 682
683 int fontPoint = mWeekFont.pointSize(); 683 int fontPoint = mWeekFont.pointSize();
684 QFontMetrics f( mWeekFont ); 684 QFontMetrics f( mWeekFont );
685 int fontWid = f.width( "30" ); 685 int fontWid = f.width( "30" );
686 while ( fontWid > pixWid ) { 686 while ( fontWid > pixWid ) {
687 --fontPoint; 687 --fontPoint;
688 mWeekFont.setPointSize( fontPoint ); 688 mWeekFont.setPointSize( fontPoint );
689 QFontMetrics f( mWeekFont ); 689 QFontMetrics f( mWeekFont );
690 fontWid = f.width( "30" ); 690 fontWid = f.width( "30" );
691 //qDebug("dec-- "); 691 //qDebug("dec-- ");
692 } 692 }
693 693
694 connect( mWeekAction, SIGNAL( activated() ), 694 connect( mWeekAction, SIGNAL( activated() ),
695 this, SLOT( weekAction() ) ); 695 this, SLOT( weekAction() ) );
696 696
697 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 697 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
698 if ( p->mShowIconFilterview ) { 698 if ( p->mShowIconFilterview ) {
699 icon = loadPixmap( pathString + "filter" ); 699 icon = loadPixmap( pathString + "filter" );
700 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 700 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
701 connect( actionFilterMenuTB, SIGNAL( activated() ), 701 connect( actionFilterMenuTB, SIGNAL( activated() ),
702 this, SLOT( fillFilterMenuTB() ) ); 702 this, SLOT( fillFilterMenuTB() ) );
703 actionFilterMenuTB->addTo( iconToolBar ); 703 actionFilterMenuTB->addTo( iconToolBar );
704 selectFilterMenuTB = new QPopupMenu( this ); 704 selectFilterMenuTB = new QPopupMenu( this );
705 selectFilterMenuTB->setCheckable( true ); 705 selectFilterMenuTB->setCheckable( true );
706 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 706 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
707 } 707 }
708 708
709 //#endif 709 //#endif
710 // ****************** 710 // ******************
711 QAction *action; 711 QAction *action;
712 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 712 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
713 configureToolBarMenu->setCheckable( true ); 713 configureToolBarMenu->setCheckable( true );
714 714
715 715
716 configureAgendaMenu->setCheckable( true ); 716 configureAgendaMenu->setCheckable( true );
717 int iii ; 717 int iii ;
718 for ( iii = 1;iii<= 10 ;++iii ){ 718 for ( iii = 1;iii<= 10 ;++iii ){
719 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 719 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
720 } 720 }
721 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 721 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
722 722
723 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 723 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
724 this, SLOT( showConfigureAgenda( ) ) ); 724 this, SLOT( showConfigureAgenda( ) ) );
725 725
726 icon = loadPixmap( pathString + "configure" ); 726 icon = loadPixmap( pathString + "configure" );
727 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 727 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
728 action->addTo( actionMenu ); 728 action->addTo( actionMenu );
729 connect( action, SIGNAL( activated() ), 729 connect( action, SIGNAL( activated() ),
730 mView, SLOT( edit_options() ) ); 730 mView, SLOT( edit_options() ) );
731 icon = loadPixmap( pathString + "configure" ); 731 icon = loadPixmap( pathString + "configure" );
732 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 732 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
733 action->addTo( actionMenu ); 733 action->addTo( actionMenu );
734 connect( action, SIGNAL( activated() ), 734 connect( action, SIGNAL( activated() ),
735 mView, SLOT( edit_global_options() ) ); 735 mView, SLOT( edit_global_options() ) );
736 actionMenu->insertSeparator(); 736 actionMenu->insertSeparator();
737 737
738 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 738 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
739 action->addTo( actionMenu ); 739 action->addTo( actionMenu );
740 connect( action, SIGNAL( activated() ), 740 connect( action, SIGNAL( activated() ),
741 mView, SLOT( undo_delete() ) ); 741 mView, SLOT( undo_delete() ) );
742 actionMenu->insertSeparator(); 742 actionMenu->insertSeparator();
743 743
744 icon = loadPixmap( pathString + "newevent" ); 744 icon = loadPixmap( pathString + "newevent" );
745 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 745 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
746 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 746 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
747 configureToolBarMenu->insertSeparator(); 747 configureToolBarMenu->insertSeparator();
748 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 748 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
749 configureToolBarMenu->insertSeparator(); 749 configureToolBarMenu->insertSeparator();
750 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 750 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
751 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 751 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
752 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 752 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
753 ne_action->addTo( actionMenu ); 753 ne_action->addTo( actionMenu );
754 connect( ne_action, SIGNAL( activated() ), 754 connect( ne_action, SIGNAL( activated() ),
755 mView, SLOT( newEvent() ) ); 755 mView, SLOT( newEvent() ) );
756 icon = loadPixmap( pathString + "newtodo" ); 756 icon = loadPixmap( pathString + "newtodo" );
757 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 757 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
758 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 758 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
759 nt_action->addTo( actionMenu ); 759 nt_action->addTo( actionMenu );
760 connect( nt_action, SIGNAL( activated() ), 760 connect( nt_action, SIGNAL( activated() ),
761 mView, SLOT( newTodo() ) ); 761 mView, SLOT( newTodo() ) );
762 762
763 icon = loadPixmap( pathString + "today" ); 763 icon = loadPixmap( pathString + "today" );
764 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 764 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
765 today_action->addTo( viewMenu ); 765 today_action->addTo( viewMenu );
766 connect( today_action, SIGNAL( activated() ), 766 connect( today_action, SIGNAL( activated() ),
767 mView, SLOT( goToday() ) ); 767 mView, SLOT( goToday() ) );
768 viewMenu->insertSeparator(); 768 viewMenu->insertSeparator();
769 769
770 // *********************** 770 // ***********************
771 if ( KOPrefs::instance()->mVerticalScreen ) { 771 if ( KOPrefs::instance()->mVerticalScreen ) {
772 icon = SmallIcon( "1updownarrow" ); 772 icon = SmallIcon( "1updownarrow" );
773 } else { 773 } else {
774 icon = SmallIcon("1leftrightarrow" ); 774 icon = SmallIcon("1leftrightarrow" );
775 } 775 }
776 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 776 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
777 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 777 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
778 FSaction->addTo( viewMenu ); 778 FSaction->addTo( viewMenu );
779 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 779 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
780 780
781 icon = loadPixmap( pathString + "navi" ); 781 icon = loadPixmap( pathString + "navi" );
782 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 782 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
783 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 783 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
784 action->addTo( viewMenu ); 784 action->addTo( viewMenu );
785 connect( action, SIGNAL( activated() ), 785 connect( action, SIGNAL( activated() ),
786 mView, SLOT( toggleDateNavigatorWidget() ) ); 786 mView, SLOT( toggleDateNavigatorWidget() ) );
787 mToggleNav = action ; 787 mToggleNav = action ;
788 icon = loadPixmap( pathString + "filter" ); 788 icon = loadPixmap( pathString + "filter" );
789 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 789 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
790 icon = loadPixmap( pathString + "configure" ); 790 icon = loadPixmap( pathString + "configure" );
791 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 791 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
792 action->addTo( viewMenu ); 792 action->addTo( viewMenu );
793 connect( action, SIGNAL( activated() ), 793 connect( action, SIGNAL( activated() ),
794 mView, SLOT( toggleFilter() ) ); 794 mView, SLOT( toggleFilter() ) );
795 mToggleFilter = action; 795 mToggleFilter = action;
796 icon = loadPixmap( pathString + "allday" ); 796 icon = loadPixmap( pathString + "allday" );
797 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 797 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
798 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 798 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
799 action->addTo( viewMenu ); 799 action->addTo( viewMenu );
800 connect( action, SIGNAL( activated() ), 800 connect( action, SIGNAL( activated() ),
801 mView, SLOT( toggleAllDaySize() ) ); 801 mView, SLOT( toggleAllDaySize() ) );
802 mToggleAllday = action; 802 mToggleAllday = action;
803 803
804 804
805 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 805 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
806 mToggleNav, SLOT( setEnabled ( bool ) ) ); 806 mToggleNav, SLOT( setEnabled ( bool ) ) );
807 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 807 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
808 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 808 mToggleFilter, SLOT( setEnabled ( bool ) ) );
809 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 809 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
810 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 810 mToggleAllday, SLOT( setEnabled ( bool ) ) );
811 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 811 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
812 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 812 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
813 813
814 viewMenu->insertSeparator(); 814 viewMenu->insertSeparator();
815 icon = loadPixmap( pathString + "picker" ); 815 icon = loadPixmap( pathString + "picker" );
816 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 816 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
817 action->addTo( viewMenu ); 817 action->addTo( viewMenu );
818 connect( action, SIGNAL( activated() ), 818 connect( action, SIGNAL( activated() ),
819 mView, SLOT( showDatePicker() ) ); 819 mView, SLOT( showDatePicker() ) );
820 action->addTo( iconToolBar ); 820 action->addTo( iconToolBar );
821 viewMenu->insertSeparator(); 821 viewMenu->insertSeparator();
822 822
823 if ( p-> mShowIconToggleFull ) 823 if ( p-> mShowIconToggleFull )
824 FSaction->addTo( iconToolBar ); 824 FSaction->addTo( iconToolBar );
825 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 825 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
826 826
827 //******************** 827 //********************
828 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 828 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
829 829
830 830
831 icon = loadPixmap( pathString + "whatsnext" ); 831 icon = loadPixmap( pathString + "whatsnext" );
832 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 832 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
833 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 833 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
834 whatsnext_action->addTo( viewMenu ); 834 whatsnext_action->addTo( viewMenu );
835 connect( whatsnext_action, SIGNAL( activated() ), 835 connect( whatsnext_action, SIGNAL( activated() ),
836 mView->viewManager(), SLOT( showWhatsNextView() ) ); 836 mView->viewManager(), SLOT( showWhatsNextView() ) );
837 837
838 icon = loadPixmap( pathString + "xdays" ); 838 icon = loadPixmap( pathString + "xdays" );
839 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 839 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
840 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 840 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
841 xdays_action->addTo( viewMenu ); 841 xdays_action->addTo( viewMenu );
842 connect( xdays_action, SIGNAL( activated() ), 842 connect( xdays_action, SIGNAL( activated() ),
843 mView->viewManager(), SLOT( showNextXView() ) ); 843 mView->viewManager(), SLOT( showNextXView() ) );
844 844
845 845
846 icon = loadPixmap( pathString + "journal" ); 846 icon = loadPixmap( pathString + "journal" );
847 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 847 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
848 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 848 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
849 viewjournal_action->addTo( viewMenu ); 849 viewjournal_action->addTo( viewMenu );
850 connect( viewjournal_action, SIGNAL( activated() ), 850 connect( viewjournal_action, SIGNAL( activated() ),
851 mView->viewManager(), SLOT( showJournalView() ) ); 851 mView->viewManager(), SLOT( showJournalView() ) );
852 852
853 853
854 icon = loadPixmap( pathString + "day" ); 854 icon = loadPixmap( pathString + "day" );
855 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 855 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
856 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 856 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
857 day1_action->addTo( viewMenu ); 857 day1_action->addTo( viewMenu );
858 // action->addTo( toolBar ); 858 // action->addTo( toolBar );
859 connect( day1_action, SIGNAL( activated() ), 859 connect( day1_action, SIGNAL( activated() ),
860 mView->viewManager(), SLOT( showDayView() ) ); 860 mView->viewManager(), SLOT( showDayView() ) );
861 861
862 icon = loadPixmap( pathString + "workweek" ); 862 icon = loadPixmap( pathString + "workweek" );
863 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 863 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
864 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 864 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
865 day5_action->addTo( viewMenu ); 865 day5_action->addTo( viewMenu );
866 connect( day5_action, SIGNAL( activated() ), 866 connect( day5_action, SIGNAL( activated() ),
867 mView->viewManager(), SLOT( showWorkWeekView() ) ); 867 mView->viewManager(), SLOT( showWorkWeekView() ) );
868 868
869 icon = loadPixmap( pathString + "week" ); 869 icon = loadPixmap( pathString + "week" );
870 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 870 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
871 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 871 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
872 day7_action->addTo( viewMenu ); 872 day7_action->addTo( viewMenu );
873 connect( day7_action, SIGNAL( activated() ), 873 connect( day7_action, SIGNAL( activated() ),
874 mView->viewManager(), SLOT( showWeekView() ) ); 874 mView->viewManager(), SLOT( showWeekView() ) );
875 875
876 icon = loadPixmap( pathString + "workweek2" ); 876 icon = loadPixmap( pathString + "workweek2" );
877 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 877 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
878 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 878 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
879 day6_action->addTo( viewMenu ); 879 day6_action->addTo( viewMenu );
880 connect( day6_action, SIGNAL( activated() ), 880 connect( day6_action, SIGNAL( activated() ),
881 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 881 mView->viewManager(), SLOT( showMonthViewWeek() ) );
882 882
883 icon = loadPixmap( pathString + "month" ); 883 icon = loadPixmap( pathString + "month" );
884 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 884 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
885 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 885 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
886 month_action->addTo( viewMenu ); 886 month_action->addTo( viewMenu );
887 connect( month_action, SIGNAL( activated() ), 887 connect( month_action, SIGNAL( activated() ),
888 mView->viewManager(), SLOT( showMonthView() ) ); 888 mView->viewManager(), SLOT( showMonthView() ) );
889 889
890 icon = loadPixmap( pathString + "list" ); 890 icon = loadPixmap( pathString + "list" );
891 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 891 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
892 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 892 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
893 showlist_action->addTo( viewMenu ); 893 showlist_action->addTo( viewMenu );
894 connect( showlist_action, SIGNAL( activated() ), 894 connect( showlist_action, SIGNAL( activated() ),
895 mView->viewManager(), SLOT( showListView() ) ); 895 mView->viewManager(), SLOT( showListView() ) );
896 896
897 icon = loadPixmap( pathString + "todo" ); 897 icon = loadPixmap( pathString + "todo" );
898 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 898 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
899 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 899 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
900 todoview_action->addTo( viewMenu ); 900 todoview_action->addTo( viewMenu );
901 connect( todoview_action, SIGNAL( activated() ), 901 connect( todoview_action, SIGNAL( activated() ),
902 mView->viewManager(), SLOT( showTodoView() ) ); 902 mView->viewManager(), SLOT( showTodoView() ) );
903 903
904 904
905 905
906#if 0 906#if 0
907 action = new QAction( "view_timespan", "Time Span", 0, this ); 907 action = new QAction( "view_timespan", "Time Span", 0, this );
908 action->addTo( viewMenu ); 908 action->addTo( viewMenu );
909 connect( action, SIGNAL( activated() ), 909 connect( action, SIGNAL( activated() ),
910 mView->viewManager(), SLOT( showTimeSpanView() ) ); 910 mView->viewManager(), SLOT( showTimeSpanView() ) );
911#endif 911#endif
912 912
913 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 913 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
914 this ); 914 this );
915 mNewSubTodoAction->addTo( actionMenu ); 915 mNewSubTodoAction->addTo( actionMenu );
916 connect( mNewSubTodoAction, SIGNAL( activated() ), 916 connect( mNewSubTodoAction, SIGNAL( activated() ),
917 mView, SLOT( newSubTodo() ) ); 917 mView, SLOT( newSubTodo() ) );
918 918
919 actionMenu->insertSeparator(); 919 actionMenu->insertSeparator();
920 920
921 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 921 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
922 mShowAction->addTo( actionMenu ); 922 mShowAction->addTo( actionMenu );
923 connect( mShowAction, SIGNAL( activated() ), 923 connect( mShowAction, SIGNAL( activated() ),
924 mView, SLOT( showIncidence() ) ); 924 mView, SLOT( showIncidence() ) );
925 925
926 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 926 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
927 mEditAction->addTo( actionMenu ); 927 mEditAction->addTo( actionMenu );
928 connect( mEditAction, SIGNAL( activated() ), 928 connect( mEditAction, SIGNAL( activated() ),
929 mView, SLOT( editIncidence() ) ); 929 mView, SLOT( editIncidence() ) );
930 930
931 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 931 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
932 mDeleteAction->addTo( actionMenu ); 932 mDeleteAction->addTo( actionMenu );
933 connect( mDeleteAction, SIGNAL( activated() ), 933 connect( mDeleteAction, SIGNAL( activated() ),
934 mView, SLOT( deleteIncidence() ) ); 934 mView, SLOT( deleteIncidence() ) );
935 935
936 936
937 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 937 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
938 mCloneAction->addTo( actionMenu ); 938 mCloneAction->addTo( actionMenu );
939 connect( mCloneAction, SIGNAL( activated() ), 939 connect( mCloneAction, SIGNAL( activated() ),
940 mView, SLOT( cloneIncidence() ) ); 940 mView, SLOT( cloneIncidence() ) );
941 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 941 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
942 mMoveAction->addTo( actionMenu ); 942 mMoveAction->addTo( actionMenu );
943 connect( mMoveAction, SIGNAL( activated() ), 943 connect( mMoveAction, SIGNAL( activated() ),
944 mView, SLOT( moveIncidence() ) ); 944 mView, SLOT( moveIncidence() ) );
945 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 945 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
946 mBeamAction->addTo( actionMenu ); 946 mBeamAction->addTo( actionMenu );
947 connect( mBeamAction, SIGNAL( activated() ), 947 connect( mBeamAction, SIGNAL( activated() ),
948 mView, SLOT( beamIncidence() ) ); 948 mView, SLOT( beamIncidence() ) );
949 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 949 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
950 mCancelAction->addTo( actionMenu ); 950 mCancelAction->addTo( actionMenu );
951 connect( mCancelAction, SIGNAL( activated() ), 951 connect( mCancelAction, SIGNAL( activated() ),
952 mView, SLOT( toggleCancelIncidence() ) ); 952 mView, SLOT( toggleCancelIncidence() ) );
953 953
954 actionMenu->insertSeparator(); 954 actionMenu->insertSeparator();
955 955
956 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 956 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
957 this ); 957 this );
958 action->addTo( actionMenu ); 958 action->addTo( actionMenu );
959 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 959 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
960 960
961 icon = loadPixmap( pathString + "search" ); 961 icon = loadPixmap( pathString + "search" );
962 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 962 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
963 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 963 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
964 search_action->addTo( actionMenu ); 964 search_action->addTo( actionMenu );
965 connect( search_action, SIGNAL( activated() ), 965 connect( search_action, SIGNAL( activated() ),
966 mView->dialogManager(), SLOT( showSearchDialog() ) ); 966 mView->dialogManager(), SLOT( showSearchDialog() ) );
967 967
968 968
969 969
970 if ( KOPrefs::instance()->mShowFullMenu ) { 970 if ( KOPrefs::instance()->mShowFullMenu ) {
971 actionMenu->insertSeparator(); 971 actionMenu->insertSeparator();
972 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 972 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
973 973
974 } 974 }
975 // actionMenu->insertSeparator(); 975 // actionMenu->insertSeparator();
976 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 976 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
977 this ); 977 this );
978 action->addTo( importMenu_X ); 978 action->addTo( importMenu_X );
979 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 979 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
980 action = new QAction( "import_quick", i18n("Import last file"), 0, 980 action = new QAction( "import_quick", i18n("Import last file"), 0,
981 this ); 981 this );
982 action->addTo( importMenu_X ); 982 action->addTo( importMenu_X );
983 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 983 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
984 importMenu_X->insertSeparator(); 984 importMenu_X->insertSeparator();
985 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 985 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
986 this ); 986 this );
987 action->addTo( importMenu_X ); 987 action->addTo( importMenu_X );
988 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 988 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
989 //#ifndef DESKTOP_VERSION 989 //#ifndef DESKTOP_VERSION
990 importMenu_X->insertSeparator(); 990 importMenu_X->insertSeparator();
991 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 991 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
992 this ); 992 this );
993 action->addTo( importMenu_X ); 993 action->addTo( importMenu_X );
994 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 994 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
995 //#else 995 //#else
996#ifdef _OL_IMPORT_ 996#ifdef _OL_IMPORT_
997 importMenu_X->insertSeparator(); 997 importMenu_X->insertSeparator();
998 action = new QAction( "import_ol", i18n("Import from OL"), 0, 998 action = new QAction( "import_ol", i18n("Import from OL"), 0,
999 this ); 999 this );
1000 action->addTo( importMenu_X ); 1000 action->addTo( importMenu_X );
1001 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1001 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1002#endif 1002#endif
1003 //#endif 1003 //#endif
1004 1004
1005 //importMenu->insertSeparator(); 1005 //importMenu->insertSeparator();
1006 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1006 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1007 this ); 1007 this );
1008 action->addTo( importMenu ); 1008 action->addTo( importMenu );
1009 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1009 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1010 1010
1011 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 1011 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
1012 this ); 1012 this );
1013 action->addTo( importMenu ); 1013 action->addTo( importMenu );
1014 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1014 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1015 importMenu->insertSeparator(); 1015 importMenu->insertSeparator();
1016 importMenu->insertItem( i18n("Import"), importMenu_X ); 1016 importMenu->insertItem( i18n("Import"), importMenu_X );
1017 //importMenu->insertSeparator(); 1017 //importMenu->insertSeparator();
1018 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1018 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1019 this ); 1019 this );
1020 action->addTo( exportMenu_X ); 1020 action->addTo( exportMenu_X );
1021 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1021 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1022 1022
1023 1023
1024 //LR 1024 //LR
1025 QPopupMenu *ex2phone = new QPopupMenu( this ); 1025 QPopupMenu *ex2phone = new QPopupMenu( this );
1026 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1026 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1027 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1027 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1028 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1028 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1029 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1029 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1030 1030
1031 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1031 importMenu->insertItem( i18n("Export"), exportMenu_X );
1032#ifndef DESKTOP_VERSION 1032#ifndef DESKTOP_VERSION
1033 //importMenu->insertSeparator(); 1033 //importMenu->insertSeparator();
1034 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1034 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1035 this ); 1035 this );
1036 brAction->addTo( beamMenu_X ); 1036 brAction->addTo( beamMenu_X );
1037 brAction->setToggleAction (true ) ; 1037 brAction->setToggleAction (true ) ;
1038 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1038 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1039 1039
1040 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1040 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1041 this ); 1041 this );
1042 action->addTo( beamMenu_X ); 1042 action->addTo( beamMenu_X );
1043 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1043 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1044 1044
1045 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1045 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1046 this ); 1046 this );
1047 action->addTo( beamMenu_X ); 1047 action->addTo( beamMenu_X );
1048 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1048 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1049 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1049 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1050#else 1050#else
1051 //importMenu->insertSeparator(); 1051 //importMenu->insertSeparator();
1052 icon = loadPixmap( pathString + "print" ); 1052 icon = loadPixmap( pathString + "print" );
1053 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1053 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1054 action->addTo( beamMenu_X ); 1054 action->addTo( beamMenu_X );
1055 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
1056 this, SLOT( printCal() ) ); 1056 this, SLOT( printCal() ) );
1057 1057
1058 icon = loadPixmap( pathString + "print" ); 1058 icon = loadPixmap( pathString + "print" );
1059 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1059 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1060 action->addTo( beamMenu_X ); 1060 action->addTo( beamMenu_X );
1061 connect( action, SIGNAL( activated() ), 1061 connect( action, SIGNAL( activated() ),
1062 this, SLOT( printSel() ) ); 1062 this, SLOT( printSel() ) );
1063 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1063 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1064 action->addTo( beamMenu_X ); 1064 action->addTo( beamMenu_X );
1065 connect( action, SIGNAL( activated() ), 1065 connect( action, SIGNAL( activated() ),
1066 mView->viewManager(), SLOT( slotprintWNV() ) ); 1066 mView->viewManager(), SLOT( slotprintWNV() ) );
1067 1067
1068 1068
1069 icon = loadPixmap( pathString + "print" ); 1069 icon = loadPixmap( pathString + "print" );
1070 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1070 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1071 action->addTo( beamMenu_X ); 1071 action->addTo( beamMenu_X );
1072 connect( action, SIGNAL( activated() ), 1072 connect( action, SIGNAL( activated() ),
1073 this, SLOT( printListView() ) ); 1073 this, SLOT( printListView() ) );
1074 1074
1075 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1075 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1076 action->addTo( beamMenu_X ); 1076 action->addTo( beamMenu_X );
1077 connect( action, SIGNAL( activated() ), 1077 connect( action, SIGNAL( activated() ),
1078 mView, SLOT( slotprintSelInc() ) ); 1078 mView, SLOT( slotprintSelInc() ) );
1079 1079
1080 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1080 importMenu->insertItem( i18n("Print"), beamMenu_X );
1081#endif 1081#endif
1082 importMenu->insertSeparator(); 1082 importMenu->insertSeparator();
1083 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1083 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1084 this ); 1084 this );
1085 action->addTo( importMenu ); 1085 action->addTo( importMenu );
1086 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1086 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1087 importMenu->insertSeparator(); 1087 importMenu->insertSeparator();
1088 action = new QAction( "beam all", i18n("Save"), 0, 1088 action = new QAction( "beam all", i18n("Save"), 0,
1089 this ); 1089 this );
1090 action->addTo( importMenu ); 1090 action->addTo( importMenu );
1091 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1091 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1092 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1092 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1093 this ); 1093 this );
1094 action->addTo( importMenu ); 1094 action->addTo( importMenu );
1095 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1095 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1096 1096
1097 //menuBar->insertItem( "Configure",configureMenu ); 1097 //menuBar->insertItem( "Configure",configureMenu );
1098 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1098 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1099 icon = loadPixmap( "korganizer/korganizer" ); 1099 icon = loadPixmap( "korganizer/korganizer" );
1100 1100
1101 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1101 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1102 action->addTo( helpMenu ); 1102 action->addTo( helpMenu );
1103 connect( action, SIGNAL( activated() ), 1103 connect( action, SIGNAL( activated() ),
1104 SLOT( whatsNew() ) ); 1104 SLOT( whatsNew() ) );
1105 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1105 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1106 action->addTo( helpMenu ); 1106 action->addTo( helpMenu );
1107 connect( action, SIGNAL( activated() ), 1107 connect( action, SIGNAL( activated() ),
1108 SLOT( features() ) ); 1108 SLOT( features() ) );
1109 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1109 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1110 action->addTo( helpMenu ); 1110 action->addTo( helpMenu );
1111 connect( action, SIGNAL( activated() ), 1111 connect( action, SIGNAL( activated() ),
1112 SLOT( keyBindings() ) ); 1112 SLOT( keyBindings() ) );
1113 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1113 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1114 action->addTo( helpMenu ); 1114 action->addTo( helpMenu );
1115 connect( action, SIGNAL( activated() ), 1115 connect( action, SIGNAL( activated() ),
1116 SLOT( storagehowto() ) ); 1116 SLOT( storagehowto() ) );
1117 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1117 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1118 action->addTo( helpMenu ); 1118 action->addTo( helpMenu );
1119 connect( action, SIGNAL( activated() ), 1119 connect( action, SIGNAL( activated() ),
1120 SLOT( timetrackinghowto() ) ); 1120 SLOT( timetrackinghowto() ) );
1121 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1121 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1122 action->addTo( helpMenu ); 1122 action->addTo( helpMenu );
1123 connect( action, SIGNAL( activated() ), 1123 connect( action, SIGNAL( activated() ),
1124 SLOT( synchowto() ) ); 1124 SLOT( synchowto() ) );
1125 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1125 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1126 action->addTo( helpMenu ); 1126 action->addTo( helpMenu );
1127 connect( action, SIGNAL( activated() ), 1127 connect( action, SIGNAL( activated() ),
1128 SLOT( kdesynchowto() ) ); 1128 SLOT( kdesynchowto() ) );
1129 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1129 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1130 action->addTo( helpMenu ); 1130 action->addTo( helpMenu );
1131 connect( action, SIGNAL( activated() ), 1131 connect( action, SIGNAL( activated() ),
1132 SLOT( multisynchowto() ) ); 1132 SLOT( multisynchowto() ) );
1133 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1133 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1134 action->addTo( helpMenu ); 1134 action->addTo( helpMenu );
1135 connect( action, SIGNAL( activated() ), 1135 connect( action, SIGNAL( activated() ),
1136 SLOT( aboutAutoSaving() ) ); 1136 SLOT( aboutAutoSaving() ) );
1137 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1137 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1138 action->addTo( helpMenu ); 1138 action->addTo( helpMenu );
1139 connect( action, SIGNAL( activated() ), 1139 connect( action, SIGNAL( activated() ),
1140 SLOT( aboutKnownBugs() ) ); 1140 SLOT( aboutKnownBugs() ) );
1141 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1141 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1142 action->addTo( helpMenu ); 1142 action->addTo( helpMenu );
1143 connect( action, SIGNAL( activated() ), 1143 connect( action, SIGNAL( activated() ),
1144 SLOT( usertrans() ) ); 1144 SLOT( usertrans() ) );
1145 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1145 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1146 action->addTo( helpMenu ); 1146 action->addTo( helpMenu );
1147 connect( action, SIGNAL( activated() ), 1147 connect( action, SIGNAL( activated() ),
1148 SLOT( faq() ) ); 1148 SLOT( faq() ) );
1149 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1149 action = new QAction( "licence", i18n("Licence..."), 0, this );
1150 action->addTo( helpMenu ); 1150 action->addTo( helpMenu );
1151 connect( action, SIGNAL( activated() ), 1151 connect( action, SIGNAL( activated() ),
1152 SLOT( licence() ) ); 1152 SLOT( licence() ) );
1153 action = new QAction( "about", i18n("About..."), 0, this ); 1153 action = new QAction( "about", i18n("About..."), 0, this );
1154 action->addTo( helpMenu ); 1154 action->addTo( helpMenu );
1155 connect( action, SIGNAL( activated() ), 1155 connect( action, SIGNAL( activated() ),
1156 SLOT( about() ) ); 1156 SLOT( about() ) );
1157 //menuBar->insertSeparator(); 1157 //menuBar->insertSeparator();
1158 1158
1159 // ****************************************************** 1159 // ******************************************************
1160 // menubar icons 1160 // menubar icons
1161 1161
1162 1162
1163 1163
1164 //menuBar->insertItem( iconToolBar ); 1164 //menuBar->insertItem( iconToolBar );
1165 //xdays_action 1165 //xdays_action
1166 if (p-> mShowIconNewEvent) 1166 if (p-> mShowIconNewEvent)
1167 ne_action->addTo( iconToolBar ); 1167 ne_action->addTo( iconToolBar );
1168 if (p->mShowIconNewTodo ) 1168 if (p->mShowIconNewTodo )
1169 nt_action->addTo( iconToolBar ); 1169 nt_action->addTo( iconToolBar );
1170 if (p-> mShowIconSearch) 1170 if (p-> mShowIconSearch)
1171 search_action->addTo( iconToolBar ); 1171 search_action->addTo( iconToolBar );
1172 if (p-> mShowIconWhatsThis) 1172 if (p-> mShowIconWhatsThis)
1173 QWhatsThis::whatsThisButton ( iconToolBar ); 1173 QWhatsThis::whatsThisButton ( iconToolBar );
1174 if (p-> mShowIconNext) 1174 if (p-> mShowIconNext)
1175 whatsnext_action->addTo( viewToolBar ); 1175 whatsnext_action->addTo( viewToolBar );
1176 if (p-> mShowIconNextDays) 1176 if (p-> mShowIconNextDays)
1177 xdays_action->addTo( viewToolBar ); 1177 xdays_action->addTo( viewToolBar );
1178 if (p-> mShowIconJournal) 1178 if (p-> mShowIconJournal)
1179 viewjournal_action->addTo( viewToolBar ); 1179 viewjournal_action->addTo( viewToolBar );
1180 if (p-> mShowIconDay1) 1180 if (p-> mShowIconDay1)
1181 day1_action->addTo( viewToolBar ); 1181 day1_action->addTo( viewToolBar );
1182 if (p-> mShowIconDay5) 1182 if (p-> mShowIconDay5)
1183 day5_action->addTo( viewToolBar ); 1183 day5_action->addTo( viewToolBar );
1184 if (p-> mShowIconDay7) 1184 if (p-> mShowIconDay7)
1185 day7_action->addTo( viewToolBar ); 1185 day7_action->addTo( viewToolBar );
1186 if (p-> mShowIconDay6) 1186 if (p-> mShowIconDay6)
1187 day6_action->addTo( viewToolBar ); 1187 day6_action->addTo( viewToolBar );
1188 if (p-> mShowIconMonth) 1188 if (p-> mShowIconMonth)
1189 month_action->addTo( viewToolBar ); 1189 month_action->addTo( viewToolBar );
1190 if (p-> mShowIconList) 1190 if (p-> mShowIconList)
1191 showlist_action->addTo( viewToolBar ); 1191 showlist_action->addTo( viewToolBar );
1192 if (p-> mShowIconTodoview) 1192 if (p-> mShowIconTodoview)
1193 todoview_action->addTo( viewToolBar ); 1193 todoview_action->addTo( viewToolBar );
1194 1194
1195 icon = loadPixmap( pathString + "2leftarrowB" ); 1195 icon = loadPixmap( pathString + "2leftarrowB" );
1196 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1196 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1197 if (p-> mShowIconBackFast) { 1197 if (p-> mShowIconBackFast) {
1198 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1198 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1199 connect( action, SIGNAL( activated() ), 1199 connect( action, SIGNAL( activated() ),
1200 mView, SLOT( goPreviousMonth() ) ); 1200 mView, SLOT( goPreviousMonth() ) );
1201 action->addTo( navigatorToolBar ); 1201 action->addTo( navigatorToolBar );
1202 } 1202 }
1203 icon = loadPixmap( pathString + "1leftarrowB" ); 1203 icon = loadPixmap( pathString + "1leftarrowB" );
1204 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1204 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1205 if (p-> mShowIconBack) { 1205 if (p-> mShowIconBack) {
1206 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1206 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1207 connect( action, SIGNAL( activated() ), 1207 connect( action, SIGNAL( activated() ),
1208 mView, SLOT( goPrevious() ) ); 1208 mView, SLOT( goPrevious() ) );
1209 action->addTo( navigatorToolBar ); 1209 action->addTo( navigatorToolBar );
1210 } 1210 }
1211 icon = loadPixmap( pathString + "today" ); 1211 icon = loadPixmap( pathString + "today" );
1212 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1212 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1213 if (p-> mShowIconToday) 1213 if (p-> mShowIconToday)
1214 today_action->addTo( navigatorToolBar ); 1214 today_action->addTo( navigatorToolBar );
1215 icon = loadPixmap( pathString + "1rightarrowB" ); 1215 icon = loadPixmap( pathString + "1rightarrowB" );
1216 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1216 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1217 if (p-> mShowIconForward) { 1217 if (p-> mShowIconForward) {
1218 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1218 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1219 connect( action, SIGNAL( activated() ), 1219 connect( action, SIGNAL( activated() ),
1220 mView, SLOT( goNext() ) ); 1220 mView, SLOT( goNext() ) );
1221 action->addTo( navigatorToolBar ); 1221 action->addTo( navigatorToolBar );
1222 } 1222 }
1223 icon = loadPixmap( pathString + "2rightarrowB" ); 1223 icon = loadPixmap( pathString + "2rightarrowB" );
1224 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1224 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1225 if (p-> mShowIconForwardFast) { 1225 if (p-> mShowIconForwardFast) {
1226 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1226 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1227 connect( action, SIGNAL( activated() ), 1227 connect( action, SIGNAL( activated() ),
1228 mView, SLOT( goNextMonth() ) ); 1228 mView, SLOT( goNextMonth() ) );
1229 action->addTo( navigatorToolBar ); 1229 action->addTo( navigatorToolBar );
1230 } 1230 }
1231 1231
1232 1232
1233 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1233 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1234 1234
1235 1235
1236 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1236 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1237 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1237 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1238 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1238 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1239 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1239 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1240 1240
1241 if (p-> mShowIconNewEvent) 1241 if (p-> mShowIconNewEvent)
1242 configureToolBarMenu->setItemChecked( 10, true ); 1242 configureToolBarMenu->setItemChecked( 10, true );
1243 if (p->mShowIconNewTodo ) 1243 if (p->mShowIconNewTodo )
1244 configureToolBarMenu->setItemChecked( 20, true ); 1244 configureToolBarMenu->setItemChecked( 20, true );
1245 if (p-> mShowIconSearch) 1245 if (p-> mShowIconSearch)
1246 configureToolBarMenu->setItemChecked( 120, true ); 1246 configureToolBarMenu->setItemChecked( 120, true );
1247 if (p-> mShowIconList) 1247 if (p-> mShowIconList)
1248 configureToolBarMenu->setItemChecked( 30, true ); 1248 configureToolBarMenu->setItemChecked( 30, true );
1249 if (p-> mShowIconDay1) 1249 if (p-> mShowIconDay1)
1250 configureToolBarMenu->setItemChecked( 40, true ); 1250 configureToolBarMenu->setItemChecked( 40, true );
1251 if (p-> mShowIconDay5) 1251 if (p-> mShowIconDay5)
1252 configureToolBarMenu->setItemChecked( 50, true ); 1252 configureToolBarMenu->setItemChecked( 50, true );
1253 if (p-> mShowIconDay6) 1253 if (p-> mShowIconDay6)
1254 configureToolBarMenu->setItemChecked( 75, true ); 1254 configureToolBarMenu->setItemChecked( 75, true );
1255 if (p-> mShowIconDay7) 1255 if (p-> mShowIconDay7)
1256 configureToolBarMenu->setItemChecked( 60, true ); 1256 configureToolBarMenu->setItemChecked( 60, true );
1257 if (p-> mShowIconMonth) 1257 if (p-> mShowIconMonth)
1258 configureToolBarMenu->setItemChecked( 70, true ); 1258 configureToolBarMenu->setItemChecked( 70, true );
1259 if (p-> mShowIconTodoview) 1259 if (p-> mShowIconTodoview)
1260 configureToolBarMenu->setItemChecked( 80, true ); 1260 configureToolBarMenu->setItemChecked( 80, true );
1261 if (p-> mShowIconBackFast) 1261 if (p-> mShowIconBackFast)
1262 configureToolBarMenu->setItemChecked( 200, true ); 1262 configureToolBarMenu->setItemChecked( 200, true );
1263 if (p-> mShowIconBack) 1263 if (p-> mShowIconBack)
1264 configureToolBarMenu->setItemChecked( 210, true ); 1264 configureToolBarMenu->setItemChecked( 210, true );
1265 if (p-> mShowIconToday) 1265 if (p-> mShowIconToday)
1266 configureToolBarMenu->setItemChecked( 130, true ); 1266 configureToolBarMenu->setItemChecked( 130, true );
1267 if (p-> mShowIconForward) 1267 if (p-> mShowIconForward)
1268 configureToolBarMenu->setItemChecked( 220, true ); 1268 configureToolBarMenu->setItemChecked( 220, true );
1269 if (p-> mShowIconForwardFast) 1269 if (p-> mShowIconForwardFast)
1270 configureToolBarMenu->setItemChecked( 230, true ); 1270 configureToolBarMenu->setItemChecked( 230, true );
1271 if (p-> mShowIconNextDays) 1271 if (p-> mShowIconNextDays)
1272 configureToolBarMenu->setItemChecked( 100, true ); 1272 configureToolBarMenu->setItemChecked( 100, true );
1273 if (p-> mShowIconNext) 1273 if (p-> mShowIconNext)
1274 configureToolBarMenu->setItemChecked( 110, true ); 1274 configureToolBarMenu->setItemChecked( 110, true );
1275 if (p-> mShowIconJournal) 1275 if (p-> mShowIconJournal)
1276 configureToolBarMenu->setItemChecked( 90, true ); 1276 configureToolBarMenu->setItemChecked( 90, true );
1277 if (p-> mShowIconWhatsThis) 1277 if (p-> mShowIconWhatsThis)
1278 configureToolBarMenu->setItemChecked( 300, true ); 1278 configureToolBarMenu->setItemChecked( 300, true );
1279 if (p-> mShowIconWeekNum) 1279 if (p-> mShowIconWeekNum)
1280 configureToolBarMenu->setItemChecked( 400, true ); 1280 configureToolBarMenu->setItemChecked( 400, true );
1281 if (!p-> mShowIconStretch) { 1281 if (!p-> mShowIconStretch) {
1282 QLabel* dummy = new QLabel( iconToolBar ); 1282 QLabel* dummy = new QLabel( iconToolBar );
1283 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1283 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1284 dummy->setMinimumWidth( 0 ); 1284 dummy->setMinimumWidth( 0 );
1285 iconToolBar->setStretchableWidget ( dummy ) ; 1285 iconToolBar->setStretchableWidget ( dummy ) ;
1286 } 1286 }
1287 else { 1287 else {
1288 iconToolBar->setHorizontalStretchable (true ); 1288 iconToolBar->setHorizontalStretchable (true );
1289 viewToolBar->setHorizontalStretchable (true ); 1289 viewToolBar->setHorizontalStretchable (true );
1290 navigatorToolBar->setHorizontalStretchable (true ); 1290 navigatorToolBar->setHorizontalStretchable (true );
1291 iconToolBar->setVerticalStretchable (true ); 1291 iconToolBar->setVerticalStretchable (true );
1292 viewToolBar->setVerticalStretchable (true ); 1292 viewToolBar->setVerticalStretchable (true );
1293 navigatorToolBar->setVerticalStretchable (true ); 1293 navigatorToolBar->setVerticalStretchable (true );
1294 configureToolBarMenu->setItemChecked( 5, true ); 1294 configureToolBarMenu->setItemChecked( 5, true );
1295 } 1295 }
1296 if (p-> mShowIconFilter) 1296 if (p-> mShowIconFilter)
1297 configureToolBarMenu->setItemChecked( 7, true ); 1297 configureToolBarMenu->setItemChecked( 7, true );
1298 if (p-> mShowIconOnetoolbar) 1298 if (p-> mShowIconOnetoolbar)
1299 configureToolBarMenu->setItemChecked( 6, true ); 1299 configureToolBarMenu->setItemChecked( 6, true );
1300 1300
1301 1301
1302 if ( filterMenubar ) { 1302 if ( filterMenubar ) {
1303 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1303 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1304 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1304 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1305 } 1305 }
1306 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1306 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1307 configureAgenda( p->mHourSize ); 1307 configureAgenda( p->mHourSize );
1308 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1308 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1309} 1309}
1310 1310
1311void MainWindow::exportToPhone( int mode ) 1311void MainWindow::exportToPhone( int mode )
1312{ 1312{
1313 1313
1314 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1314 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1315 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1315 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1316 KOex2phonePrefs ex2phone; 1316 KOex2phonePrefs ex2phone;
1317 1317
1318 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1318 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1319 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1319 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1320 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1320 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1321 if ( mode == 1 ) 1321 if ( mode == 1 )
1322 ex2phone.setCaption(i18n("Export complete calendar")); 1322 ex2phone.setCaption(i18n("Export complete calendar"));
1323 if ( mode == 2 ) 1323 if ( mode == 2 )
1324 ex2phone.setCaption(i18n("Export filtered calendar")); 1324 ex2phone.setCaption(i18n("Export filtered calendar"));
1325 1325
1326 if ( !ex2phone.exec() ) { 1326 if ( !ex2phone.exec() ) {
1327 return; 1327 return;
1328 } 1328 }
1329 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1329 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1330 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1330 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1331 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1331 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1332 1332
1333 int inFuture = 0; 1333 int inFuture = 0;
1334 if ( ex2phone.mWriteBackFuture->isChecked() ) 1334 if ( ex2phone.mWriteBackFuture->isChecked() )
1335 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1335 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1336 QPtrList<Incidence> delSel; 1336 QPtrList<Incidence> delSel;
1337 if ( mode == 1 ) 1337 if ( mode == 1 )
1338 delSel = mCalendar->rawIncidences(); 1338 delSel = mCalendar->rawIncidences();
1339 if ( mode == 2 ) 1339 if ( mode == 2 )
1340 delSel = mCalendar->incidences(); 1340 delSel = mCalendar->incidences();
1341 CalendarLocal* cal = new CalendarLocal(); 1341 CalendarLocal* cal = new CalendarLocal();
1342 cal->setLocalTime(); 1342 cal->setLocalTime();
1343 Incidence *incidence = delSel.first(); 1343 Incidence *incidence = delSel.first();
1344 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1344 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1345 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1345 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1346 while ( incidence ) { 1346 while ( incidence ) {
1347 if ( incidence->typeID() != journalID ) { 1347 if ( incidence->typeID() != journalID ) {
1348 bool add = true; 1348 bool add = true;
1349 if ( inFuture ) { 1349 if ( inFuture ) {
1350 QDateTime dt; 1350 QDateTime dt;
1351 if ( incidence->typeID() == todoID ) { 1351 if ( incidence->typeID() == todoID ) {
1352 Todo * t = (Todo*)incidence; 1352 Todo * t = (Todo*)incidence;
1353 if ( t->hasDueDate() ) 1353 if ( t->hasDueDate() )
1354 dt = t->dtDue(); 1354 dt = t->dtDue();
1355 else 1355 else
1356 dt = cur.addSecs( 62 ); 1356 dt = cur.addSecs( 62 );
1357 } 1357 }
1358 else { 1358 else {
1359 bool ok; 1359 bool ok;
1360 dt = incidence->getNextOccurence( cur, &ok ); 1360 dt = incidence->getNextOccurence( cur, &ok );
1361 if ( !ok ) 1361 if ( !ok )
1362 dt = cur.addSecs( -62 ); 1362 dt = cur.addSecs( -62 );
1363 } 1363 }
1364 if ( dt < cur || dt > end ) { 1364 if ( dt < cur || dt > end ) {
1365 add = false; 1365 add = false;
1366 } 1366 }
1367 } 1367 }
1368 if ( add ) { 1368 if ( add ) {
1369 Incidence *in = incidence->clone(); 1369 Incidence *in = incidence->clone();
1370 cal->addIncidence( in ); 1370 cal->addIncidence( in );
1371 } 1371 }
1372 } 1372 }
1373 incidence = delSel.next(); 1373 incidence = delSel.next();
1374 } 1374 }
1375 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1375 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1376 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1376 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1377 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1377 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1378 1378
1379 setCaption( i18n("Writing to phone...")); 1379 setCaption( i18n("Writing to phone..."));
1380 if ( PhoneFormat::writeToPhone( cal ) ) 1380 if ( PhoneFormat::writeToPhone( cal ) )
1381 setCaption( i18n("Export to phone successful!")); 1381 setCaption( i18n("Export to phone successful!"));
1382 else 1382 else
1383 setCaption( i18n("Error exporting to phone!")); 1383 setCaption( i18n("Error exporting to phone!"));
1384 delete cal; 1384 delete cal;
1385} 1385}
1386 1386
1387 1387
1388void MainWindow::setDefaultPreferences() 1388void MainWindow::setDefaultPreferences()
1389{ 1389{
1390 KOPrefs *p = KOPrefs::instance(); 1390 KOPrefs *p = KOPrefs::instance();
1391 1391
1392 p->mCompactDialogs = true; 1392 p->mCompactDialogs = true;
1393 p->mConfirm = true; 1393 p->mConfirm = true;
1394 // p->mEnableQuickTodo = false; 1394 // p->mEnableQuickTodo = false;
1395 1395
1396} 1396}
1397 1397
1398QString MainWindow::resourcePath() 1398QString MainWindow::resourcePath()
1399{ 1399{
1400 return KGlobal::iconLoader()->iconPath(); 1400 return KGlobal::iconLoader()->iconPath();
1401} 1401}
1402 1402
1403void MainWindow::displayText( QString text ,QString cap ) 1403void MainWindow::displayText( QString text ,QString cap )
1404{ 1404{
1405 QDialog dia( this, "name", true ); ; 1405 QDialog dia( this, "name", true ); ;
1406 dia.setCaption( cap ); 1406 dia.setCaption( cap );
1407 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1407 QVBoxLayout* lay = new QVBoxLayout( &dia );
1408 lay->setSpacing( 3 ); 1408 lay->setSpacing( 3 );
1409 lay->setMargin( 3 ); 1409 lay->setMargin( 3 );
1410 QTextBrowser tb ( &dia ); 1410 QTextBrowser tb ( &dia );
1411 lay->addWidget( &tb ); 1411 lay->addWidget( &tb );
1412 tb.setText( text ); 1412 tb.setText( text );
1413#ifdef DESKTOP_VERSION 1413#ifdef DESKTOP_VERSION
1414 dia.resize( 640, 480); 1414 dia.resize( 640, 480);
1415#else 1415#else
1416 dia.showMaximized(); 1416 dia.showMaximized();
1417#endif 1417#endif
1418 dia.exec(); 1418 dia.exec();
1419} 1419}
1420 1420
1421void MainWindow::features() 1421void MainWindow::features()
1422{ 1422{
1423 1423
1424 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1424 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1425} 1425}
1426 1426
1427void MainWindow::usertrans() 1427void MainWindow::usertrans()
1428{ 1428{
1429 1429
1430 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1430 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1431} 1431}
1432 1432
1433void MainWindow::storagehowto() 1433void MainWindow::storagehowto()
1434{ 1434{
1435 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1435 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1436} 1436}
1437void MainWindow::timetrackinghowto() 1437void MainWindow::timetrackinghowto()
1438{ 1438{
1439 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1439 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1440} 1440}
1441void MainWindow::kdesynchowto() 1441void MainWindow::kdesynchowto()
1442{ 1442{
1443 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1443 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1444} 1444}
1445void MainWindow::multisynchowto() 1445void MainWindow::multisynchowto()
1446{ 1446{
1447 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1447 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1448} 1448}
1449void MainWindow::synchowto() 1449void MainWindow::synchowto()
1450{ 1450{
1451 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1451 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1452} 1452}
1453void MainWindow::faq() 1453void MainWindow::faq()
1454{ 1454{
1455 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1455 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1456 1456
1457} 1457}
1458void MainWindow::whatsNew() 1458void MainWindow::whatsNew()
1459{ 1459{
1460 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1460 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1461 1461
1462} 1462}
1463void MainWindow::licence() 1463void MainWindow::licence()
1464{ 1464{
1465 KApplication::showLicence(); 1465 KApplication::showLicence();
1466 1466
1467} 1467}
1468void MainWindow::about() 1468void MainWindow::about()
1469{ 1469{
1470 QString version; 1470 QString version;
1471#include <../version> 1471#include <../version>
1472 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1472 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1473 i18n("KOrganizer/Platform-independent\n") + 1473 i18n("KOrganizer/Platform-independent\n") +
1474 "(KO/Pi) " + version + " - " + 1474 "(KO/Pi) " + version + " - " +
1475 1475
1476#ifdef DESKTOP_VERSION 1476#ifdef DESKTOP_VERSION
1477 i18n("Desktop Edition\n") + 1477 i18n("Desktop Edition\n") +
1478#else 1478#else
1479 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1479 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1480#endif 1480#endif
1481 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1481 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1482} 1482}
1483void MainWindow::keyBindings() 1483void MainWindow::keyBindings()
1484{ 1484{
1485 QString cap = i18n("KO/Pi Keys + Colors"); 1485 QString cap = i18n("KO/Pi Keys + Colors");
1486 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1486 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1487 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1487 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1488 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1488 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1489 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1489 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1490 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1490 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1491 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1491 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1492 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1492 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1493 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1493 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1494 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1494 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1495 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1495 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1496 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1496 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1497 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1497 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1498 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1498 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1499 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1499 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1500 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1500 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1501 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1501 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1502 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1502 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1503 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1503 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1504 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1504 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1505 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1505 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1506 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1506 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1507 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1507 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1508 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1508 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1509 i18n("<p><h3>In agenda view:</h3></p>\n") + 1509 i18n("<p><h3>In agenda view:</h3></p>\n") +
1510 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1510 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1511 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1511 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1512 i18n("<p><h3>In todo view:</h3></p>\n") + 1512 i18n("<p><h3>In todo view:</h3></p>\n") +
1513 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1513 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1514 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1514 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1515 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1515 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1516 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1516 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1517 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1517 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1518 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1518 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1519 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1519 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1520 i18n("<p><h3>In list view:</h3></p>\n") + 1520 i18n("<p><h3>In list view:</h3></p>\n") +
1521 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1521 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1522 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1522 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1523 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1523 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1524 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1524 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1525 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1525 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1526 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1526 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1527 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1527 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1528 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1528 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1529 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1529 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1530 i18n("<p><b>E</b>: Edit item</p>\n") + 1530 i18n("<p><b>E</b>: Edit item</p>\n") +
1531 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1531 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1532 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1532 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1533 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1533 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1534 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1534 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1535 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1535 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1536 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1536 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1537 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1537 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1538 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1538 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1539 i18n("<p><b>White</b>: Item readonly</p>\n"); 1539 i18n("<p><b>White</b>: Item readonly</p>\n");
1540 displayText( text, cap); 1540 displayText( text, cap);
1541} 1541}
1542void MainWindow::aboutAutoSaving() 1542void MainWindow::aboutAutoSaving()
1543{ 1543{
1544 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1544 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1545 1545
1546 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1546 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1547 1547
1548} 1548}
1549void MainWindow::aboutKnownBugs() 1549void MainWindow::aboutKnownBugs()
1550{ 1550{
1551 QMessageBox* msg; 1551 QMessageBox* msg;
1552 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1552 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1553 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1553 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1554 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1554 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1555 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1555 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1556 i18n("\nor report them in the bugtracker on\n") + 1556 i18n("\nor report them in the bugtracker on\n") +
1557 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1557 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1558 QMessageBox::NoIcon, 1558 QMessageBox::NoIcon,
1559 QMessageBox::Ok, 1559 QMessageBox::Ok,
1560 QMessageBox::NoButton, 1560 QMessageBox::NoButton,
1561 QMessageBox::NoButton); 1561 QMessageBox::NoButton);
1562 msg->exec(); 1562 msg->exec();
1563 delete msg; 1563 delete msg;
1564 1564
1565} 1565}
1566 1566
1567QString MainWindow::defaultFileName() 1567QString MainWindow::defaultFileName()
1568{ 1568{
1569 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1569 return locateLocal( "data", "korganizer/mycalendar.ics" );
1570} 1570}
1571QString MainWindow::syncFileName() 1571QString MainWindow::syncFileName()
1572{ 1572{
1573#ifdef DESKTOP_VERSION 1573#ifdef DESKTOP_VERSION
1574 return locateLocal( "tmp", "synccalendar.ics" ); 1574 return locateLocal( "tmp", "synccalendar.ics" );
1575#else 1575#else
1576 return QString( "/tmp/synccalendar.ics" ); 1576 return QString( "/tmp/synccalendar.ics" );
1577#endif 1577#endif
1578} 1578}
1579#include "koglobals.h" 1579#include "koglobals.h"
1580#include <kcalendarsystem.h> 1580#include <kcalendarsystem.h>
1581void MainWindow::updateWeek(QDate seda) 1581void MainWindow::updateWeek(QDate seda)
1582{ 1582{
1583 int weekNum = KGlobal::locale()->weekNum ( seda ); 1583 int weekNum = KGlobal::locale()->weekNum ( seda );
1584 mWeekPixmap.fill( mWeekBgColor ); 1584 mWeekPixmap.fill( mWeekBgColor );
1585 QPainter p ( &mWeekPixmap ); 1585 QPainter p ( &mWeekPixmap );
1586 p.setFont( mWeekFont ); 1586 p.setFont( mWeekFont );
1587 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1587 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1588 p.end(); 1588 p.end();
1589 QIconSet icon3 ( mWeekPixmap ); 1589 QIconSet icon3 ( mWeekPixmap );
1590 mWeekAction->setIconSet ( icon3 ); 1590 mWeekAction->setIconSet ( icon3 );
1591 1591
1592} 1592}
1593void MainWindow::updateWeekNum(const DateList &selectedDates) 1593void MainWindow::updateWeekNum(const DateList &selectedDates)
1594{ 1594{
1595 updateWeek( selectedDates.first() ); 1595 updateWeek( selectedDates.first() );
1596} 1596}
1597void MainWindow::processIncidenceSelection( Incidence *incidence ) 1597void MainWindow::processIncidenceSelection( Incidence *incidence )
1598{ 1598{
1599 1599
1600 if ( !incidence ) { 1600 if ( !incidence ) {
1601 enableIncidenceActions( false ); 1601 enableIncidenceActions( false );
1602 1602
1603 mNewSubTodoAction->setEnabled( false ); 1603 mNewSubTodoAction->setEnabled( false );
1604 setCaptionToDates(); 1604 setCaptionToDates();
1605 return; 1605 return;
1606 1606
1607 } 1607 }
1608 1608
1609 //KGlobal::locale()->formatDateTime(nextA, true); 1609 //KGlobal::locale()->formatDateTime(nextA, true);
1610 QString startString = ""; 1610 QString startString = "";
1611 if ( incidence->typeID() != todoID ) { 1611 if ( incidence->typeID() != todoID ) {
1612 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1612 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1613 if ( incidence->doesFloat() ) { 1613 if ( incidence->doesFloat() ) {
1614 startString += ": "+incidence->dtStartDateStr( true ); 1614 startString += ": "+incidence->dtStartDateStr( true );
1615 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1615 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1616 1616
1617 } else { 1617 } else {
1618 startString = ": "+incidence->dtStartStr(true); 1618 startString = ": "+incidence->dtStartStr(true);
1619 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1619 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1620 1620
1621 } 1621 }
1622 1622
1623 } else { 1623 } else {
1624 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1624 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1625 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1625 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1626 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1626 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1627 1627
1628 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1628 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1629 bool ok; 1629 bool ok;
1630 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1630 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1631 if ( ok ) { 1631 if ( ok ) {
1632 int years = noc.date().year() - incidence->dtStart().date().year(); 1632 int years = noc.date().year() - incidence->dtStart().date().year();
1633 startString += i18n(" (%1 y.)"). arg( years ); 1633 startString += i18n(" (%1 y.)"). arg( years );
1634 } 1634 }
1635 } 1635 }
1636 else 1636 else
1637 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1637 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1638 } 1638 }
1639 1639
1640 } 1640 }
1641 else 1641 else
1642 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1642 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1643 if ( !incidence->location().isEmpty() ) 1643 if ( !incidence->location().isEmpty() )
1644 startString += " (" +incidence->location()+")"; 1644 startString += " (" +incidence->location()+")";
1645 setCaption( incidence->summary()+startString); 1645 setCaption( incidence->summary()+startString);
1646 1646
1647 enableIncidenceActions( true ); 1647 enableIncidenceActions( true );
1648 1648
1649 if ( incidence->typeID() == eventID ) { 1649 if ( incidence->typeID() == eventID ) {
1650 mShowAction->setText( i18n("Show Event...") ); 1650 mShowAction->setText( i18n("Show Event...") );
1651 mEditAction->setText( i18n("Edit Event...") ); 1651 mEditAction->setText( i18n("Edit Event...") );
1652 mDeleteAction->setText( i18n("Delete Event...") ); 1652 mDeleteAction->setText( i18n("Delete Event...") );
1653 1653
1654 mNewSubTodoAction->setEnabled( false ); 1654 mNewSubTodoAction->setEnabled( false );
1655 } else if ( incidence->typeID() == todoID ) { 1655 } else if ( incidence->typeID() == todoID ) {
1656 mShowAction->setText( i18n("Show Todo...") ); 1656 mShowAction->setText( i18n("Show Todo...") );
1657 mEditAction->setText( i18n("Edit Todo...") ); 1657 mEditAction->setText( i18n("Edit Todo...") );
1658 mDeleteAction->setText( i18n("Delete Todo...") ); 1658 mDeleteAction->setText( i18n("Delete Todo...") );
1659 1659
1660 mNewSubTodoAction->setEnabled( true ); 1660 mNewSubTodoAction->setEnabled( true );
1661 } else { 1661 } else {
1662 mShowAction->setText( i18n("Show...") ); 1662 mShowAction->setText( i18n("Show...") );
1663 mShowAction->setText( i18n("Edit...") ); 1663 mShowAction->setText( i18n("Edit...") );
1664 mShowAction->setText( i18n("Delete...") ); 1664 mShowAction->setText( i18n("Delete...") );
1665 1665
1666 mNewSubTodoAction->setEnabled( false ); 1666 mNewSubTodoAction->setEnabled( false );
1667 } 1667 }
1668} 1668}
1669 1669
1670void MainWindow::enableIncidenceActions( bool enabled ) 1670void MainWindow::enableIncidenceActions( bool enabled )
1671{ 1671{
1672 mShowAction->setEnabled( enabled ); 1672 mShowAction->setEnabled( enabled );
1673 mEditAction->setEnabled( enabled ); 1673 mEditAction->setEnabled( enabled );
1674 mDeleteAction->setEnabled( enabled ); 1674 mDeleteAction->setEnabled( enabled );
1675 1675
1676 mCloneAction->setEnabled( enabled ); 1676 mCloneAction->setEnabled( enabled );
1677 mMoveAction->setEnabled( enabled ); 1677 mMoveAction->setEnabled( enabled );
1678 mBeamAction->setEnabled( enabled ); 1678 mBeamAction->setEnabled( enabled );
1679 mCancelAction->setEnabled( enabled ); 1679 mCancelAction->setEnabled( enabled );
1680} 1680}
1681 1681
1682void MainWindow::importOL() 1682void MainWindow::importOL()
1683{ 1683{
1684#ifdef _OL_IMPORT_ 1684#ifdef _OL_IMPORT_
1685 mView->clearAllViews(); 1685 mView->clearAllViews();
1686 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1686 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1687 id->exec(); 1687 id->exec();
1688 delete id; 1688 delete id;
1689 mView->calendar()->checkAlarmForIncidence( 0, true ); 1689 mView->calendar()->checkAlarmForIncidence( 0, true );
1690 mView->updateView(); 1690 mView->updateView();
1691#endif 1691#endif
1692} 1692}
1693void MainWindow::importBday() 1693void MainWindow::importBday()
1694{ 1694{
1695 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1695 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1696 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1696 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1697 i18n("Import!"), i18n("Cancel"), 0, 1697 i18n("Import!"), i18n("Cancel"), 0,
1698 0, 1 ); 1698 0, 1 );
1699 if ( result == 0 ) { 1699 if ( result == 0 ) {
1700 mView->importBday(); 1700 mView->importBday();
1701 1701
1702 } 1702 }
1703 1703
1704 1704
1705} 1705}
1706void MainWindow::importQtopia() 1706void MainWindow::importQtopia()
1707{ 1707{
1708 //#ifndef DESKTOP_VERSION 1708 //#ifndef DESKTOP_VERSION
1709 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1709 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1710#ifdef DESKTOP_VERSION 1710#ifdef DESKTOP_VERSION
1711 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1711 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1712#endif 1712#endif
1713 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1713 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1714 i18n("Import!"), i18n("Cancel"), 0, 1714 i18n("Import!"), i18n("Cancel"), 0,
1715 0, 1 ); 1715 0, 1 );
1716 if ( result == 0 ) { 1716 if ( result == 0 ) {
1717#ifndef DESKTOP_VERSION 1717#ifndef DESKTOP_VERSION
1718 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1718 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1719 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1719 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1720 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1720 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1721#else 1721#else
1722 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1722 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1723 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1723 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1724 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1724 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1725#endif 1725#endif
1726 mView->importQtopia( categories, datebook, todolist ); 1726 mView->importQtopia( categories, datebook, todolist );
1727 } 1727 }
1728 mView->calendar()->reInitAlarmSettings(); 1728 mView->calendar()->reInitAlarmSettings();
1729#if 0 1729#if 0
1730 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1730 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1731 i18n("Not supported \non desktop!\n"), 1731 i18n("Not supported \non desktop!\n"),
1732 i18n("Ok"), i18n("Cancel"), 0, 1732 i18n("Ok"), i18n("Cancel"), 0,
1733 0, 1 ); 1733 0, 1 );
1734 1734
1735#endif 1735#endif
1736} 1736}
1737 1737
1738void MainWindow::saveOnClose() 1738void MainWindow::saveOnClose()
1739{ 1739{
1740 KOPrefs *p = KOPrefs::instance(); 1740 KOPrefs *p = KOPrefs::instance();
1741 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1741 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1742 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1742 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1743 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1743 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1744 if ( filterToolBar ) { 1744 if ( filterToolBar ) {
1745 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1745 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1746 } 1746 }
1747#ifdef DESKTOP_VERSION 1747#ifdef DESKTOP_VERSION
1748 1748
1749 QPoint myP; 1749 QPoint myP;
1750 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1750 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1751 if ( p->mToolBarHor ) 1751 if ( p->mToolBarHor )
1752 p->mToolBarUp = myP.y() > height()/2; 1752 p->mToolBarUp = myP.y() > height()/2;
1753 else 1753 else
1754 p->mToolBarUp = myP.x() > width()/2; 1754 p->mToolBarUp = myP.x() > width()/2;
1755 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1755 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1756 if ( p->mToolBarHorV ) 1756 if ( p->mToolBarHorV )
1757 p->mToolBarUpV = myP.y() > height()/2; 1757 p->mToolBarUpV = myP.y() > height()/2;
1758 else 1758 else
1759 p->mToolBarUpV = myP.x() > width()/2 ; 1759 p->mToolBarUpV = myP.x() > width()/2 ;
1760 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1760 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1761 if ( p->mToolBarHorN ) 1761 if ( p->mToolBarHorN )
1762 p->mToolBarUpN = myP.y() > height()/2; 1762 p->mToolBarUpN = myP.y() > height()/2;
1763 else 1763 else
1764 p->mToolBarUpN = myP.x() > width()/2 ; 1764 p->mToolBarUpN = myP.x() > width()/2 ;
1765 if ( filterToolBar ) { 1765 if ( filterToolBar ) {
1766 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1766 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1767 if ( p->mToolBarHorF ) 1767 if ( p->mToolBarHorF )
1768 p->mToolBarUpF = myP.y() > height()/2; 1768 p->mToolBarUpF = myP.y() > height()/2;
1769 else 1769 else
1770 p->mToolBarUpF = myP.x() > width()/2 ; 1770 p->mToolBarUpF = myP.x() > width()/2 ;
1771 } 1771 }
1772#else 1772#else
1773 if ( p->mToolBarHor ) 1773 if ( p->mToolBarHor )
1774 p->mToolBarUp = iconToolBar->y() > height()/2; 1774 p->mToolBarUp = iconToolBar->y() > height()/2;
1775 else 1775 else
1776 p->mToolBarUp = iconToolBar->x() > width()/2; 1776 p->mToolBarUp = iconToolBar->x() > width()/2;
1777 if ( p->mToolBarHorV ) 1777 if ( p->mToolBarHorV )
1778 p->mToolBarUpV = viewToolBar->y() > height()/2; 1778 p->mToolBarUpV = viewToolBar->y() > height()/2;
1779 else 1779 else
1780 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1780 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1781 1781
1782 if ( p->mToolBarHorN ) 1782 if ( p->mToolBarHorN )
1783 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1783 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1784 else 1784 else
1785 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1785 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1786 if ( filterToolBar ) { 1786 if ( filterToolBar ) {
1787 if ( p->mToolBarHorF ) 1787 if ( p->mToolBarHorF )
1788 p->mToolBarUpF = filterToolBar->y() > height()/2; 1788 p->mToolBarUpF = filterToolBar->y() > height()/2;
1789 else 1789 else
1790 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1790 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1791 } 1791 }
1792#endif 1792#endif
1793 1793
1794 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1794 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1795 save(); 1795 save();
1796 mView->writeSettings(); 1796 mView->writeSettings();
1797} 1797}
1798void MainWindow::slotModifiedChanged( bool changed ) 1798void MainWindow::slotModifiedChanged( bool changed )
1799{ 1799{
1800 if ( mBlockAtStartup ) 1800 if ( mBlockAtStartup )
1801 return; 1801 return;
1802 1802
1803 int msec; 1803 int msec;
1804 // we store the changes after 1 minute, 1804 // we store the changes after 1 minute,
1805 // and for safety reasons after 10 minutes again 1805 // and for safety reasons after 10 minutes again
1806 if ( !mSyncManager->blockSave() ) 1806 if ( !mSyncManager->blockSave() )
1807 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1807 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1808 else 1808 else
1809 msec = 1000 * 600; 1809 msec = 1000 * 600;
1810 mSaveTimer.start( msec, true ); // 1 minute 1810 mSaveTimer.start( msec, true ); // 1 minute
1811 qDebug("KO: Saving File in %d secs!", msec/1000); 1811 qDebug("KO: Saving File in %d secs!", msec/1000);
1812 mCalendarModifiedFlag = true; 1812 mCalendarModifiedFlag = true;
1813} 1813}
1814void MainWindow::saveStopTimer() 1814void MainWindow::saveStopTimer()
1815{ 1815{
1816 mSaveTimer.stop(); 1816 mSaveTimer.stop();
1817} 1817}
1818void MainWindow::save() 1818void MainWindow::save()
1819{ 1819{
1820 if ( !mCalendarModifiedFlag ) { 1820 if ( !mCalendarModifiedFlag ) {
1821 qDebug("KO: Calendar not modified. Nothing saved."); 1821 qDebug("KO: Calendar not modified. Nothing saved.");
1822 return; 1822 return;
1823 } 1823 }
1824 if ( mSyncManager->blockSave() ) 1824 if ( mSyncManager->blockSave() )
1825 return; 1825 return;
1826 mSyncManager->setBlockSave(true); 1826 mSyncManager->setBlockSave(true);
1827 if ( mView->checkAllFileVersions() ) { 1827 if ( mView->checkAllFileVersions() ) {
1828 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1828 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1829 QDate reference ( 2000,1,1); 1829 QDate reference ( 2000,1,1);
1830 int daysTo = reference.daysTo ( QDate::currentDate() ); 1830 int daysTo = reference.daysTo ( QDate::currentDate() );
1831 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1831 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1832 setCaption(i18n("Creating backup ... please wait ..." )); 1832 setCaption(i18n("Creating backup ... please wait ..." ));
1833 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1833 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1834 // we need the file path, the backup dir and the number of bups as param 1834 // we need the file path, the backup dir and the number of bups as param
1835 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1835 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1836 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1836 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1837 bupDir = KGlobalSettings::backupDataDir(); 1837 bupDir = KGlobalSettings::backupDataDir();
1838 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1838 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1839 if ( retval == 0 ) { 1839 if ( retval == 0 ) {
1840 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1840 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1841 // retval == 0 : backup skipped for today, try again tomorrow 1841 // retval == 0 : backup skipped for today, try again tomorrow
1842 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1842 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1843 } else if ( retval == 1 ){ 1843 } else if ( retval == 1 ){
1844 qDebug("KO: Backup created."); 1844 qDebug("KO: Backup created.");
1845 // backup ok 1845 // backup ok
1846 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1846 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1847 KopiCalendarFile * cal = calendars.first(); 1847 KopiCalendarFile * cal = calendars.first();
1848 cal = calendars.next(); 1848 cal = calendars.next();
1849 while ( cal ) { 1849 while ( cal ) {
1850 if ( !cal->mErrorOnLoad ) { 1850 if ( !cal->mErrorOnLoad ) {
1851 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1851 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1852 } 1852 }
1853 cal = calendars.next(); 1853 cal = calendars.next();
1854 } 1854 }
1855 KOPrefs::instance()->mLastBackupDate = daysTo; 1855 KOPrefs::instance()->mLastBackupDate = daysTo;
1856 } else if ( retval == 2 ){ 1856 } else if ( retval == 2 ){
1857 qDebug("KO: Backup globally cancelled."); 1857 qDebug("KO: Backup globally cancelled.");
1858 // backup globally cancelled 1858 // backup globally cancelled
1859 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1859 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1860 } 1860 }
1861 // retval == 3: do nothing, try again later 1861 // retval == 3: do nothing, try again later
1862 } 1862 }
1863 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1863 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1864 } 1864 }
1865 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1865 QTime neededSaveTime = QDateTime::currentDateTime().time();
1866 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1866 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1867 qDebug("KO: Start saving data to file!"); 1867 qDebug("KO: Start saving data to file!");
1868 mView->saveCalendars(); 1868 mView->saveCalendars();
1869 mCalendarModifiedFlag = false; 1869 mCalendarModifiedFlag = false;
1870 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1870 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1871 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1871 qDebug("KO: Needed %d ms for saving.",msNeeded );
1872 QString savemes; 1872 QString savemes;
1873 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1873 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1874 setCaption(savemes); 1874 setCaption(savemes);
1875 } else 1875 } else
1876 setCaption(i18n("Saving cancelled!")); 1876 setCaption(i18n("Saving cancelled!"));
1877 mSyncManager->setBlockSave( false ); 1877 mSyncManager->setBlockSave( false );
1878} 1878}
1879 1879
1880void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1880void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1881{ 1881{
1882 if ( !e->isAutoRepeat() ) { 1882 if ( !e->isAutoRepeat() ) {
1883 mFlagKeyPressed = false; 1883 mFlagKeyPressed = false;
1884 } 1884 }
1885} 1885}
1886void MainWindow::keyPressEvent ( QKeyEvent * e ) 1886void MainWindow::keyPressEvent ( QKeyEvent * e )
1887{ 1887{
1888 qApp->processEvents(); 1888 qApp->processEvents();
1889 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1889 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1890 e->ignore(); 1890 e->ignore();
1891 // qDebug(" ignore %d",e->isAutoRepeat() ); 1891 // qDebug(" ignore %d",e->isAutoRepeat() );
1892 return; 1892 return;
1893 } 1893 }
1894 if (! e->isAutoRepeat() ) 1894 if (! e->isAutoRepeat() )
1895 mFlagKeyPressed = true; 1895 mFlagKeyPressed = true;
1896 KOPrefs *p = KOPrefs::instance(); 1896 KOPrefs *p = KOPrefs::instance();
1897 bool showSelectedDates = false; 1897 bool showSelectedDates = false;
1898 int size; 1898 int size;
1899 int pro = 0; 1899 int pro = 0;
1900 //qDebug("MainWindow::keyPressEvent "); 1900 //qDebug("MainWindow::keyPressEvent ");
1901 switch ( e->key() ) { 1901 switch ( e->key() ) {
1902 case Qt::Key_Right: 1902 case Qt::Key_Right:
1903 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1903 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1904 mView->goNextMonth(); 1904 mView->goNextMonth();
1905 else 1905 else
1906 mView->goNext(); 1906 mView->goNext();
1907 showSelectedDates = true; 1907 showSelectedDates = true;
1908 break; 1908 break;
1909 case Qt::Key_Left: 1909 case Qt::Key_Left:
1910 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1910 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1911 mView->goPreviousMonth(); 1911 mView->goPreviousMonth();
1912 else 1912 else
1913 mView->goPrevious(); 1913 mView->goPrevious();
1914 showSelectedDates = true; 1914 showSelectedDates = true;
1915 break; 1915 break;
1916 case Qt::Key_Down: 1916 case Qt::Key_Down:
1917 mView->viewManager()->agendaView()->scrollOneHourDown(); 1917 mView->viewManager()->agendaView()->scrollOneHourDown();
1918 break; 1918 break;
1919 case Qt::Key_Up: 1919 case Qt::Key_Up:
1920 mView->viewManager()->agendaView()->scrollOneHourUp(); 1920 mView->viewManager()->agendaView()->scrollOneHourUp();
1921 break; 1921 break;
1922 case Qt::Key_K: 1922 case Qt::Key_K:
1923 mView->viewManager()->showMonthViewWeek(); 1923 mView->viewManager()->showMonthViewWeek();
1924 break; 1924 break;
1925 case Qt::Key_I: 1925 case Qt::Key_I:
1926 mView->showIncidence(); 1926 mView->showIncidence();
1927 break; 1927 break;
1928 case Qt::Key_Delete: 1928 case Qt::Key_Delete:
1929 case Qt::Key_Backspace: 1929 case Qt::Key_Backspace:
1930 mView->deleteIncidence(); 1930 mView->deleteIncidence();
1931 break; 1931 break;
1932 case Qt::Key_D: 1932 case Qt::Key_D:
1933 mView->viewManager()->showDayView(); 1933 mView->viewManager()->showDayView();
1934 showSelectedDates = true; 1934 showSelectedDates = true;
1935 break; 1935 break;
1936 case Qt::Key_O: 1936 case Qt::Key_O:
1937 mView->toggleFilerEnabled( ); 1937 mView->toggleFilerEnabled( );
1938 break; 1938 break;
1939 case Qt::Key_0: 1939 case Qt::Key_0:
1940 case Qt::Key_1: 1940 case Qt::Key_1:
1941 case Qt::Key_2: 1941 case Qt::Key_2:
1942 case Qt::Key_3: 1942 case Qt::Key_3:
1943 case Qt::Key_4: 1943 case Qt::Key_4:
1944 case Qt::Key_5: 1944 case Qt::Key_5:
1945 case Qt::Key_6: 1945 case Qt::Key_6:
1946 case Qt::Key_7: 1946 case Qt::Key_7:
1947 case Qt::Key_8: 1947 case Qt::Key_8:
1948 case Qt::Key_9: 1948 case Qt::Key_9:
1949 pro = e->key()-48; 1949 pro = e->key()-48;
1950 if ( pro == 0 ) 1950 if ( pro == 0 )
1951 pro = 10; 1951 pro = 10;
1952 if ( e->state() == Qt::ControlButton) 1952 if ( e->state() == Qt::ControlButton)
1953 pro += 10; 1953 pro += 10;
1954 break; 1954 break;
1955 case Qt::Key_M: 1955 case Qt::Key_M:
1956 mView->viewManager()->showMonthView(); 1956 mView->viewManager()->showMonthView();
1957 showSelectedDates = true; 1957 showSelectedDates = true;
1958 break; 1958 break;
1959 case Qt::Key_Insert: 1959 case Qt::Key_Insert:
1960 mView->newEvent(); 1960 mView->newEvent();
1961 break; 1961 break;
1962 case Qt::Key_S : 1962 case Qt::Key_S :
1963 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1963 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1964 mView->newSubTodo(); 1964 mView->newSubTodo();
1965 else 1965 else
1966 mView->dialogManager()->showSearchDialog(); 1966 mView->dialogManager()->showSearchDialog();
1967 break; 1967 break;
1968 case Qt::Key_Y : 1968 case Qt::Key_Y :
1969 case Qt::Key_Z : 1969 case Qt::Key_Z :
1970 mView->viewManager()->showWorkWeekView(); 1970 mView->viewManager()->showWorkWeekView();
1971 showSelectedDates = true; 1971 showSelectedDates = true;
1972 break; 1972 break;
1973 case Qt::Key_U : 1973 case Qt::Key_U :
1974 mView->viewManager()->showWeekView(); 1974 mView->viewManager()->showWeekView();
1975 showSelectedDates = true; 1975 showSelectedDates = true;
1976 break; 1976 break;
1977 case Qt::Key_H : 1977 case Qt::Key_H :
1978 keyBindings(); 1978 keyBindings();
1979 break; 1979 break;
1980 case Qt::Key_W: 1980 case Qt::Key_W:
1981 mView->viewManager()->showWhatsNextView(); 1981 mView->viewManager()->showWhatsNextView();
1982 break; 1982 break;
1983 case Qt::Key_L: 1983 case Qt::Key_L:
1984 mView->viewManager()->showListView(); 1984 mView->viewManager()->showListView();
1985 break; 1985 break;
1986 case Qt::Key_N: 1986 case Qt::Key_N:
1987 mView->viewManager()->showNextView(); 1987 mView->viewManager()->showNextView();
1988 break; 1988 break;
1989 case Qt::Key_V: 1989 case Qt::Key_V:
1990 mView->viewManager()->showTodoView(); 1990 mView->viewManager()->showTodoView();
1991 break; 1991 break;
1992 case Qt::Key_C: 1992 case Qt::Key_C:
1993 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1993 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1994 break; 1994 break;
1995 case Qt::Key_P: 1995 case Qt::Key_P:
1996 mView->showDatePicker( ); 1996 mView->showDatePicker( );
1997 break; 1997 break;
1998 case Qt::Key_F: 1998 case Qt::Key_F:
1999 mView->editFilters(); 1999 mView->editFilters();
2000 break; 2000 break;
2001 case Qt::Key_R: 2001 case Qt::Key_R:
2002 mView->toggleFilter(); 2002 mView->toggleFilter();
2003 break; 2003 break;
2004 case Qt::Key_X: 2004 case Qt::Key_X:
2005 if ( e->state() == Qt::ControlButton ) 2005 if ( e->state() == Qt::ControlButton )
2006 mView->toggleDateNavigatorWidget(); 2006 mView->toggleDateNavigatorWidget();
2007 else { 2007 else {
2008 mView->viewManager()->showNextXView(); 2008 mView->viewManager()->showNextXView();
2009 showSelectedDates = true; 2009 showSelectedDates = true;
2010 } 2010 }
2011 break; 2011 break;
2012 case Qt::Key_Space: 2012 case Qt::Key_Space:
2013 mView->toggleExpand(); 2013 mView->toggleExpand();
2014 break; 2014 break;
2015 case Qt::Key_A: 2015 case Qt::Key_A:
2016 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2016 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2017 mView->showNextAlarms(); 2017 mView->showNextAlarms();
2018 else 2018 else
2019 mView->toggleAllDaySize(); 2019 mView->toggleAllDaySize();
2020 break; 2020 break;
2021 case Qt::Key_T: 2021 case Qt::Key_T:
2022 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2022 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2023 mView->newTodo(); 2023 mView->newTodo();
2024 else { 2024 else {
2025 mView->goToday(); 2025 mView->goToday();
2026 showSelectedDates = true; 2026 showSelectedDates = true;
2027 } 2027 }
2028 break; 2028 break;
2029 case Qt::Key_J: 2029 case Qt::Key_J:
2030 mView->viewManager()->showJournalView(); 2030 mView->viewManager()->showJournalView();
2031 break; 2031 break;
2032 case Qt::Key_B: 2032 case Qt::Key_B:
2033 mView->editIncidenceDescription();; 2033 mView->editIncidenceDescription();;
2034 break; 2034 break;
2035 // case Qt::Key_Return: 2035 // case Qt::Key_Return:
2036 case Qt::Key_E: 2036 case Qt::Key_E:
2037 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2037 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2038 mView->newEvent(); 2038 mView->newEvent();
2039 else 2039 else
2040 mView->editIncidence(); 2040 mView->editIncidence();
2041 break; 2041 break;
2042 case Qt::Key_Plus: 2042 case Qt::Key_Plus:
2043 size = p->mHourSize +2; 2043 size = p->mHourSize +2;
2044 if ( size <= 22 ) 2044 if ( size <= 22 )
2045 configureAgenda( size ); 2045 configureAgenda( size );
2046 break; 2046 break;
2047 case Qt::Key_Minus: 2047 case Qt::Key_Minus:
2048 size = p->mHourSize - 2; 2048 size = p->mHourSize - 2;
2049 if ( size >= 4 ) 2049 if ( size >= 4 )
2050 configureAgenda( size ); 2050 configureAgenda( size );
2051 break; 2051 break;
2052 2052
2053 2053
2054 default: 2054 default:
2055 e->ignore(); 2055 e->ignore();
2056 } 2056 }
2057 if ( pro > 0 ) { 2057 if ( pro > 0 ) {
2058 mView->selectFilter( pro-1 ); 2058 mView->selectFilter( pro-1 );
2059 } 2059 }
2060 if ( showSelectedDates ) { 2060 if ( showSelectedDates ) {
2061 ;// setCaptionToDates(); 2061 ;// setCaptionToDates();
2062 } 2062 }
2063 2063
2064} 2064}
2065void MainWindow::fillFilterMenuTB() 2065void MainWindow::fillFilterMenuTB()
2066{ 2066{
2067 selectFilterMenuTB->clear(); 2067 selectFilterMenuTB->clear();
2068 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2068 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2069 selectFilterMenuTB->insertSeparator(); 2069 selectFilterMenuTB->insertSeparator();
2070 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2070 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2071 2071
2072 selectFilterMenuTB->insertSeparator(); 2072 selectFilterMenuTB->insertSeparator();