summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp7
-rw-r--r--korganizer/kofilterview.cpp255
-rw-r--r--korganizer/kofilterview.h118
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp1
-rw-r--r--microkde/kcolorbutton.cpp7
-rw-r--r--microkde/kcolorbutton.h3
8 files changed, 323 insertions, 76 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 753d81f..1024b4e 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3175,1221 +3175,1224 @@ void CalendarView::showTodo(Todo *event)
3175 getEventViewerDialog()->showMe(); 3175 getEventViewerDialog()->showMe();
3176} 3176}
3177void CalendarView::showJournal( Journal *jour ) 3177void CalendarView::showJournal( Journal *jour )
3178{ 3178{
3179 getEventViewerDialog()->setJournal(jour); 3179 getEventViewerDialog()->setJournal(jour);
3180 getEventViewerDialog()->showMe(); 3180 getEventViewerDialog()->showMe();
3181 3181
3182} 3182}
3183// void CalendarView::todoModified (Todo *event, int changed) 3183// void CalendarView::todoModified (Todo *event, int changed)
3184// { 3184// {
3185// // if (mDialogList.find (event) != mDialogList.end ()) { 3185// // if (mDialogList.find (event) != mDialogList.end ()) {
3186// // kdDebug() << "Todo modified and open" << endl; 3186// // kdDebug() << "Todo modified and open" << endl;
3187// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 3187// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
3188// // temp->modified (changed); 3188// // temp->modified (changed);
3189 3189
3190// // } 3190// // }
3191 3191
3192// mViewManager->updateView(); 3192// mViewManager->updateView();
3193// } 3193// }
3194 3194
3195void CalendarView::appointment_show() 3195void CalendarView::appointment_show()
3196{ 3196{
3197 Event *anEvent = 0; 3197 Event *anEvent = 0;
3198 3198
3199 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3199 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3200 3200
3201 if (mViewManager->currentView()->isEventView()) { 3201 if (mViewManager->currentView()->isEventView()) {
3202 if ( incidence && incidence->typeID() == eventID ) { 3202 if ( incidence && incidence->typeID() == eventID ) {
3203 anEvent = static_cast<Event *>(incidence); 3203 anEvent = static_cast<Event *>(incidence);
3204 } 3204 }
3205 } 3205 }
3206 3206
3207 if (!anEvent) { 3207 if (!anEvent) {
3208 KNotifyClient::beep(); 3208 KNotifyClient::beep();
3209 return; 3209 return;
3210 } 3210 }
3211 3211
3212 showEvent(anEvent); 3212 showEvent(anEvent);
3213} 3213}
3214 3214
3215void CalendarView::appointment_edit() 3215void CalendarView::appointment_edit()
3216{ 3216{
3217 Event *anEvent = 0; 3217 Event *anEvent = 0;
3218 3218
3219 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3219 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3220 3220
3221 if (mViewManager->currentView()->isEventView()) { 3221 if (mViewManager->currentView()->isEventView()) {
3222 if ( incidence && incidence->typeID() == eventID ) { 3222 if ( incidence && incidence->typeID() == eventID ) {
3223 anEvent = static_cast<Event *>(incidence); 3223 anEvent = static_cast<Event *>(incidence);
3224 } 3224 }
3225 } 3225 }
3226 3226
3227 if (!anEvent) { 3227 if (!anEvent) {
3228 KNotifyClient::beep(); 3228 KNotifyClient::beep();
3229 return; 3229 return;
3230 } 3230 }
3231 3231
3232 editEvent(anEvent); 3232 editEvent(anEvent);
3233} 3233}
3234 3234
3235void CalendarView::appointment_delete() 3235void CalendarView::appointment_delete()
3236{ 3236{
3237 Event *anEvent = 0; 3237 Event *anEvent = 0;
3238 3238
3239 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3239 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3240 3240
3241 if (mViewManager->currentView()->isEventView()) { 3241 if (mViewManager->currentView()->isEventView()) {
3242 if ( incidence && incidence->typeID() == eventID ) { 3242 if ( incidence && incidence->typeID() == eventID ) {
3243 anEvent = static_cast<Event *>(incidence); 3243 anEvent = static_cast<Event *>(incidence);
3244 } 3244 }
3245 } 3245 }
3246 3246
3247 if (!anEvent) { 3247 if (!anEvent) {
3248 KNotifyClient::beep(); 3248 KNotifyClient::beep();
3249 return; 3249 return;
3250 } 3250 }
3251 3251
3252 deleteEvent(anEvent); 3252 deleteEvent(anEvent);
3253} 3253}
3254 3254
3255void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3255void CalendarView::todo_resub( Todo * parent, Todo * sub )
3256{ 3256{
3257 if (!sub) return; 3257 if (!sub) return;
3258 if ( sub->relatedTo() == parent ) 3258 if ( sub->relatedTo() == parent )
3259 return; 3259 return;
3260 sub->setRelatedTo(parent); 3260 sub->setRelatedTo(parent);
3261 sub->updated(); 3261 sub->updated();
3262 setModified(true); 3262 setModified(true);
3263 updateView(); 3263 updateView();
3264} 3264}
3265void CalendarView::todo_unsub(Todo *anTodo ) 3265void CalendarView::todo_unsub(Todo *anTodo )
3266{ 3266{
3267 todo_resub( 0, anTodo ); 3267 todo_resub( 0, anTodo );
3268} 3268}
3269 3269
3270void CalendarView::deleteTodo(Todo *todo) 3270void CalendarView::deleteTodo(Todo *todo)
3271{ 3271{
3272 if (!todo) { 3272 if (!todo) {
3273 KNotifyClient::beep(); 3273 KNotifyClient::beep();
3274 return; 3274 return;
3275 } 3275 }
3276 if (KOPrefs::instance()->mConfirm) { 3276 if (KOPrefs::instance()->mConfirm) {
3277 QString text = todo->summary().left(20); 3277 QString text = todo->summary().left(20);
3278 if (!todo->relations().isEmpty()) { 3278 if (!todo->relations().isEmpty()) {
3279 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 3279 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
3280 3280
3281 } 3281 }
3282 switch (msgItemDelete(text)) { 3282 switch (msgItemDelete(text)) {
3283 case KMessageBox::Continue: // OK 3283 case KMessageBox::Continue: // OK
3284 bool deleteT = false; 3284 bool deleteT = false;
3285 if (!todo->relations().isEmpty()) { 3285 if (!todo->relations().isEmpty()) {
3286 deleteT = removeCompletedSubTodos( todo ); 3286 deleteT = removeCompletedSubTodos( todo );
3287 } 3287 }
3288 // deleteT == true: todo already deleted in removeCompletedSubTodos 3288 // deleteT == true: todo already deleted in removeCompletedSubTodos
3289 if ( !deleteT ) { 3289 if ( !deleteT ) {
3290 checkExternalId( todo ); 3290 checkExternalId( todo );
3291 calendar()->deleteTodo(todo); 3291 calendar()->deleteTodo(todo);
3292 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3292 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3293 updateView(); 3293 updateView();
3294 } 3294 }
3295 break; 3295 break;
3296 } // switch 3296 } // switch
3297 } else { 3297 } else {
3298 checkExternalId( todo ); 3298 checkExternalId( todo );
3299 mCalendar->deleteTodo(todo); 3299 mCalendar->deleteTodo(todo);
3300 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3300 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3301 updateView(); 3301 updateView();
3302 } 3302 }
3303 3303
3304 emit updateSearchDialog(); 3304 emit updateSearchDialog();
3305} 3305}
3306void CalendarView::deleteJournal(Journal *jour) 3306void CalendarView::deleteJournal(Journal *jour)
3307{ 3307{
3308 if (!jour) { 3308 if (!jour) {
3309 KNotifyClient::beep(); 3309 KNotifyClient::beep();
3310 return; 3310 return;
3311 } 3311 }
3312 if (KOPrefs::instance()->mConfirm) { 3312 if (KOPrefs::instance()->mConfirm) {
3313 switch (msgItemDelete( jour->description().left(20))) { 3313 switch (msgItemDelete( jour->description().left(20))) {
3314 case KMessageBox::Continue: // OK 3314 case KMessageBox::Continue: // OK
3315 calendar()->deleteJournal(jour); 3315 calendar()->deleteJournal(jour);
3316 updateView(); 3316 updateView();
3317 break; 3317 break;
3318 } // switch 3318 } // switch
3319 } else { 3319 } else {
3320 calendar()->deleteJournal(jour);; 3320 calendar()->deleteJournal(jour);;
3321 updateView(); 3321 updateView();
3322 } 3322 }
3323 emit updateSearchDialog(); 3323 emit updateSearchDialog();
3324} 3324}
3325 3325
3326void CalendarView::deleteEvent(Event *anEvent) 3326void CalendarView::deleteEvent(Event *anEvent)
3327{ 3327{
3328 if (!anEvent) { 3328 if (!anEvent) {
3329 KNotifyClient::beep(); 3329 KNotifyClient::beep();
3330 return; 3330 return;
3331 } 3331 }
3332 3332
3333 if (anEvent->recurrence()->doesRecur()) { 3333 if (anEvent->recurrence()->doesRecur()) {
3334 QDate itemDate = mViewManager->currentSelectionDate(); 3334 QDate itemDate = mViewManager->currentSelectionDate();
3335 int km; 3335 int km;
3336 if (!itemDate.isValid()) { 3336 if (!itemDate.isValid()) {
3337 //kdDebug() << "Date Not Valid" << endl; 3337 //kdDebug() << "Date Not Valid" << endl;
3338 if (KOPrefs::instance()->mConfirm) { 3338 if (KOPrefs::instance()->mConfirm) {
3339 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3339 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3340 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 3340 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
3341 i18n("KO/Pi Confirmation"),i18n("Delete All")); 3341 i18n("KO/Pi Confirmation"),i18n("Delete All"));
3342 if ( km == KMessageBox::Continue ) 3342 if ( km == KMessageBox::Continue )
3343 km = KMessageBox::No; // No = all below 3343 km = KMessageBox::No; // No = all below
3344 } else 3344 } else
3345 km = KMessageBox::No; 3345 km = KMessageBox::No;
3346 } else { 3346 } else {
3347 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 3347 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
3348 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 3348 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
3349 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 3349 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
3350 i18n("KO/Pi Confirmation"),i18n("Current"), 3350 i18n("KO/Pi Confirmation"),i18n("Current"),
3351 i18n("All")); 3351 i18n("All"));
3352 } 3352 }
3353 switch(km) { 3353 switch(km) {
3354 3354
3355 case KMessageBox::No: // Continue // all 3355 case KMessageBox::No: // Continue // all
3356 //qDebug("KMessageBox::No "); 3356 //qDebug("KMessageBox::No ");
3357 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3357 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3358 schedule(Scheduler::Cancel,anEvent); 3358 schedule(Scheduler::Cancel,anEvent);
3359 3359
3360 checkExternalId( anEvent); 3360 checkExternalId( anEvent);
3361 mCalendar->deleteEvent(anEvent); 3361 mCalendar->deleteEvent(anEvent);
3362 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 3362 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
3363 break; 3363 break;
3364 3364
3365 // Disabled because it does not work 3365 // Disabled because it does not work
3366 //#if 0 3366 //#if 0
3367 case KMessageBox::Yes: // just this one 3367 case KMessageBox::Yes: // just this one
3368 //QDate qd = mNavigator->selectedDates().first(); 3368 //QDate qd = mNavigator->selectedDates().first();
3369 //if (!qd.isValid()) { 3369 //if (!qd.isValid()) {
3370 // kdDebug() << "no date selected, or invalid date" << endl; 3370 // kdDebug() << "no date selected, or invalid date" << endl;
3371 // KNotifyClient::beep(); 3371 // KNotifyClient::beep();
3372 // return; 3372 // return;
3373 //} 3373 //}
3374 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 3374 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
3375 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 3375 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
3376 anEvent->addExDate(itemDate); 3376 anEvent->addExDate(itemDate);
3377 int duration = anEvent->recurrence()->duration(); 3377 int duration = anEvent->recurrence()->duration();
3378 if ( duration > 0 ) { 3378 if ( duration > 0 ) {
3379 anEvent->recurrence()->setDuration( duration - 1 ); 3379 anEvent->recurrence()->setDuration( duration - 1 );
3380 } 3380 }
3381 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 3381 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
3382 } 3382 }
3383 break; 3383 break;
3384 //#endif 3384 //#endif
3385 } // switch 3385 } // switch
3386 } else { 3386 } else {
3387 if (KOPrefs::instance()->mConfirm) { 3387 if (KOPrefs::instance()->mConfirm) {
3388 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3388 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3389 i18n("\nAre you sure you want\nto delete this event?"), 3389 i18n("\nAre you sure you want\nto delete this event?"),
3390 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3390 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3391 case KMessageBox::Continue: // OK 3391 case KMessageBox::Continue: // OK
3392 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3392 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3393 schedule(Scheduler::Cancel,anEvent); 3393 schedule(Scheduler::Cancel,anEvent);
3394 checkExternalId( anEvent); 3394 checkExternalId( anEvent);
3395 mCalendar->deleteEvent(anEvent); 3395 mCalendar->deleteEvent(anEvent);
3396 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3396 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3397 break; 3397 break;
3398 } // switch 3398 } // switch
3399 } else { 3399 } else {
3400 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3400 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3401 schedule(Scheduler::Cancel,anEvent); 3401 schedule(Scheduler::Cancel,anEvent);
3402 checkExternalId( anEvent); 3402 checkExternalId( anEvent);
3403 mCalendar->deleteEvent(anEvent); 3403 mCalendar->deleteEvent(anEvent);
3404 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3404 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3405 } 3405 }
3406 } // if-else 3406 } // if-else
3407 emit updateSearchDialog(); 3407 emit updateSearchDialog();
3408} 3408}
3409 3409
3410bool CalendarView::deleteEvent(const QString &uid) 3410bool CalendarView::deleteEvent(const QString &uid)
3411{ 3411{
3412 Event *ev = mCalendar->event(uid); 3412 Event *ev = mCalendar->event(uid);
3413 if (ev) { 3413 if (ev) {
3414 deleteEvent(ev); 3414 deleteEvent(ev);
3415 return true; 3415 return true;
3416 } else { 3416 } else {
3417 return false; 3417 return false;
3418 } 3418 }
3419} 3419}
3420 3420
3421/*****************************************************************************/ 3421/*****************************************************************************/
3422 3422
3423void CalendarView::action_mail() 3423void CalendarView::action_mail()
3424{ 3424{
3425#ifndef KORG_NOMAIL 3425#ifndef KORG_NOMAIL
3426 KOMailClient mailClient; 3426 KOMailClient mailClient;
3427 3427
3428 Incidence *incidence = currentSelection(); 3428 Incidence *incidence = currentSelection();
3429 3429
3430 if (!incidence) { 3430 if (!incidence) {
3431 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3431 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3432 return; 3432 return;
3433 } 3433 }
3434 if(incidence->attendeeCount() == 0 ) { 3434 if(incidence->attendeeCount() == 0 ) {
3435 KMessageBox::sorry(this, 3435 KMessageBox::sorry(this,
3436 i18n("Can't generate mail:\nNo attendees defined.\n")); 3436 i18n("Can't generate mail:\nNo attendees defined.\n"));
3437 return; 3437 return;
3438 } 3438 }
3439 3439
3440 CalendarLocal cal_tmp; 3440 CalendarLocal cal_tmp;
3441 Event *event = 0; 3441 Event *event = 0;
3442 Event *ev = 0; 3442 Event *ev = 0;
3443 if ( incidence && incidence->typeID() == eventID ) { 3443 if ( incidence && incidence->typeID() == eventID ) {
3444 event = static_cast<Event *>(incidence); 3444 event = static_cast<Event *>(incidence);
3445 ev = new Event(*event); 3445 ev = new Event(*event);
3446 cal_tmp.addEvent(ev); 3446 cal_tmp.addEvent(ev);
3447 } 3447 }
3448 ICalFormat mForm(); 3448 ICalFormat mForm();
3449 QString attachment = mForm.toString( &cal_tmp ); 3449 QString attachment = mForm.toString( &cal_tmp );
3450 if (ev) delete(ev); 3450 if (ev) delete(ev);
3451 3451
3452 mailClient.mailAttendees(currentSelection(), attachment); 3452 mailClient.mailAttendees(currentSelection(), attachment);
3453 3453
3454#endif 3454#endif
3455 3455
3456#if 0 3456#if 0
3457 Event *anEvent = 0; 3457 Event *anEvent = 0;
3458 if (mViewManager->currentView()->isEventView()) { 3458 if (mViewManager->currentView()->isEventView()) {
3459 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3459 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3460 } 3460 }
3461 3461
3462 if (!anEvent) { 3462 if (!anEvent) {
3463 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3463 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3464 return; 3464 return;
3465 } 3465 }
3466 if(anEvent->attendeeCount() == 0 ) { 3466 if(anEvent->attendeeCount() == 0 ) {
3467 KMessageBox::sorry(this, 3467 KMessageBox::sorry(this,
3468 i18n("Can't generate mail:\nNo attendees defined.\n")); 3468 i18n("Can't generate mail:\nNo attendees defined.\n"));
3469 return; 3469 return;
3470 } 3470 }
3471 3471
3472 mailobject.emailEvent(anEvent); 3472 mailobject.emailEvent(anEvent);
3473#endif 3473#endif
3474} 3474}
3475 3475
3476 3476
3477void CalendarView::schedule_publish(Incidence *incidence) 3477void CalendarView::schedule_publish(Incidence *incidence)
3478{ 3478{
3479 Event *event = 0; 3479 Event *event = 0;
3480 Todo *todo = 0; 3480 Todo *todo = 0;
3481 3481
3482 if (incidence == 0) { 3482 if (incidence == 0) {
3483 incidence = mViewManager->currentView()->selectedIncidences().first(); 3483 incidence = mViewManager->currentView()->selectedIncidences().first();
3484 if (incidence == 0) { 3484 if (incidence == 0) {
3485 incidence = mTodoList->selectedIncidences().first(); 3485 incidence = mTodoList->selectedIncidences().first();
3486 } 3486 }
3487 } 3487 }
3488 if ( incidence && incidence->typeID() == eventID ) { 3488 if ( incidence && incidence->typeID() == eventID ) {
3489 event = static_cast<Event *>(incidence); 3489 event = static_cast<Event *>(incidence);
3490 } else { 3490 } else {
3491 if ( incidence && incidence->typeID() == todoID ) { 3491 if ( incidence && incidence->typeID() == todoID ) {
3492 todo = static_cast<Todo *>(incidence); 3492 todo = static_cast<Todo *>(incidence);
3493 } 3493 }
3494 } 3494 }
3495 3495
3496 if (!event && !todo) { 3496 if (!event && !todo) {
3497 KMessageBox::sorry(this,i18n("No event selected.")); 3497 KMessageBox::sorry(this,i18n("No event selected."));
3498 return; 3498 return;
3499 } 3499 }
3500 3500
3501 PublishDialog *publishdlg = new PublishDialog(); 3501 PublishDialog *publishdlg = new PublishDialog();
3502 if (incidence->attendeeCount()>0) { 3502 if (incidence->attendeeCount()>0) {
3503 QPtrList<Attendee> attendees = incidence->attendees(); 3503 QPtrList<Attendee> attendees = incidence->attendees();
3504 attendees.first(); 3504 attendees.first();
3505 while ( attendees.current()!=0 ) { 3505 while ( attendees.current()!=0 ) {
3506 publishdlg->addAttendee(attendees.current()); 3506 publishdlg->addAttendee(attendees.current());
3507 attendees.next(); 3507 attendees.next();
3508 } 3508 }
3509 } 3509 }
3510 bool send = true; 3510 bool send = true;
3511 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3511 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3512 if ( publishdlg->exec() != QDialog::Accepted ) 3512 if ( publishdlg->exec() != QDialog::Accepted )
3513 send = false; 3513 send = false;
3514 } 3514 }
3515 if ( send ) { 3515 if ( send ) {
3516 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3516 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3517 if ( event ) { 3517 if ( event ) {
3518 Event *ev = new Event(*event); 3518 Event *ev = new Event(*event);
3519 ev->registerObserver(0); 3519 ev->registerObserver(0);
3520 ev->clearAttendees(); 3520 ev->clearAttendees();
3521 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3521 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3522 delete(ev); 3522 delete(ev);
3523 } 3523 }
3524 } else { 3524 } else {
3525 if ( todo ) { 3525 if ( todo ) {
3526 Todo *ev = new Todo(*todo); 3526 Todo *ev = new Todo(*todo);
3527 ev->registerObserver(0); 3527 ev->registerObserver(0);
3528 ev->clearAttendees(); 3528 ev->clearAttendees();
3529 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3529 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3530 delete(ev); 3530 delete(ev);
3531 } 3531 }
3532 } 3532 }
3533 } 3533 }
3534 } 3534 }
3535 delete publishdlg; 3535 delete publishdlg;
3536} 3536}
3537 3537
3538void CalendarView::schedule_request(Incidence *incidence) 3538void CalendarView::schedule_request(Incidence *incidence)
3539{ 3539{
3540 schedule(Scheduler::Request,incidence); 3540 schedule(Scheduler::Request,incidence);
3541} 3541}
3542 3542
3543void CalendarView::schedule_refresh(Incidence *incidence) 3543void CalendarView::schedule_refresh(Incidence *incidence)
3544{ 3544{
3545 schedule(Scheduler::Refresh,incidence); 3545 schedule(Scheduler::Refresh,incidence);
3546} 3546}
3547 3547
3548void CalendarView::schedule_cancel(Incidence *incidence) 3548void CalendarView::schedule_cancel(Incidence *incidence)
3549{ 3549{
3550 schedule(Scheduler::Cancel,incidence); 3550 schedule(Scheduler::Cancel,incidence);
3551} 3551}
3552 3552
3553void CalendarView::schedule_add(Incidence *incidence) 3553void CalendarView::schedule_add(Incidence *incidence)
3554{ 3554{
3555 schedule(Scheduler::Add,incidence); 3555 schedule(Scheduler::Add,incidence);
3556} 3556}
3557 3557
3558void CalendarView::schedule_reply(Incidence *incidence) 3558void CalendarView::schedule_reply(Incidence *incidence)
3559{ 3559{
3560 schedule(Scheduler::Reply,incidence); 3560 schedule(Scheduler::Reply,incidence);
3561} 3561}
3562 3562
3563void CalendarView::schedule_counter(Incidence *incidence) 3563void CalendarView::schedule_counter(Incidence *incidence)
3564{ 3564{
3565 schedule(Scheduler::Counter,incidence); 3565 schedule(Scheduler::Counter,incidence);
3566} 3566}
3567 3567
3568void CalendarView::schedule_declinecounter(Incidence *incidence) 3568void CalendarView::schedule_declinecounter(Incidence *incidence)
3569{ 3569{
3570 schedule(Scheduler::Declinecounter,incidence); 3570 schedule(Scheduler::Declinecounter,incidence);
3571} 3571}
3572 3572
3573void CalendarView::schedule_publish_freebusy(int daysToPublish) 3573void CalendarView::schedule_publish_freebusy(int daysToPublish)
3574{ 3574{
3575 QDateTime start = QDateTime::currentDateTime(); 3575 QDateTime start = QDateTime::currentDateTime();
3576 QDateTime end = start.addDays(daysToPublish); 3576 QDateTime end = start.addDays(daysToPublish);
3577 3577
3578 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3578 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3579 freebusy->setOrganizer(KOPrefs::instance()->email()); 3579 freebusy->setOrganizer(KOPrefs::instance()->email());
3580 3580
3581 3581
3582 PublishDialog *publishdlg = new PublishDialog(); 3582 PublishDialog *publishdlg = new PublishDialog();
3583 if ( publishdlg->exec() == QDialog::Accepted ) { 3583 if ( publishdlg->exec() == QDialog::Accepted ) {
3584 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3584 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3585 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3585 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3586 delete(freebusy); 3586 delete(freebusy);
3587 } 3587 }
3588 } 3588 }
3589 delete publishdlg; 3589 delete publishdlg;
3590} 3590}
3591 3591
3592void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3592void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3593{ 3593{
3594 Event *event = 0; 3594 Event *event = 0;
3595 Todo *todo = 0; 3595 Todo *todo = 0;
3596 3596
3597 if (incidence == 0) { 3597 if (incidence == 0) {
3598 incidence = mViewManager->currentView()->selectedIncidences().first(); 3598 incidence = mViewManager->currentView()->selectedIncidences().first();
3599 if (incidence == 0) { 3599 if (incidence == 0) {
3600 incidence = mTodoList->selectedIncidences().first(); 3600 incidence = mTodoList->selectedIncidences().first();
3601 } 3601 }
3602 } 3602 }
3603 if ( incidence && incidence->typeID() == eventID ) { 3603 if ( incidence && incidence->typeID() == eventID ) {
3604 event = static_cast<Event *>(incidence); 3604 event = static_cast<Event *>(incidence);
3605 } 3605 }
3606 if ( incidence && incidence->typeID() == todoID ) { 3606 if ( incidence && incidence->typeID() == todoID ) {
3607 todo = static_cast<Todo *>(incidence); 3607 todo = static_cast<Todo *>(incidence);
3608 } 3608 }
3609 3609
3610 if (!event && !todo) { 3610 if (!event && !todo) {
3611 KMessageBox::sorry(this,i18n("No event selected.")); 3611 KMessageBox::sorry(this,i18n("No event selected."));
3612 return; 3612 return;
3613 } 3613 }
3614 3614
3615 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3615 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3616 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3616 KMessageBox::sorry(this,i18n("The event has no attendees."));
3617 return; 3617 return;
3618 } 3618 }
3619 3619
3620 Event *ev = 0; 3620 Event *ev = 0;
3621 if (event) ev = new Event(*event); 3621 if (event) ev = new Event(*event);
3622 Todo *to = 0; 3622 Todo *to = 0;
3623 if (todo) to = new Todo(*todo); 3623 if (todo) to = new Todo(*todo);
3624 3624
3625 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3625 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3626 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3626 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3627 if (!me) { 3627 if (!me) {
3628 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3628 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3629 return; 3629 return;
3630 } 3630 }
3631 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3631 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3632 StatusDialog *statdlg = new StatusDialog(this); 3632 StatusDialog *statdlg = new StatusDialog(this);
3633 if (!statdlg->exec()==QDialog::Accepted) return; 3633 if (!statdlg->exec()==QDialog::Accepted) return;
3634 me->setStatus( statdlg->status() ); 3634 me->setStatus( statdlg->status() );
3635 delete(statdlg); 3635 delete(statdlg);
3636 } 3636 }
3637 Attendee *menew = new Attendee(*me); 3637 Attendee *menew = new Attendee(*me);
3638 if (ev) { 3638 if (ev) {
3639 ev->clearAttendees(); 3639 ev->clearAttendees();
3640 ev->addAttendee(menew,false); 3640 ev->addAttendee(menew,false);
3641 } else { 3641 } else {
3642 if (to) { 3642 if (to) {
3643 todo->clearAttendees(); 3643 todo->clearAttendees();
3644 todo->addAttendee(menew,false); 3644 todo->addAttendee(menew,false);
3645 } 3645 }
3646 } 3646 }
3647 } 3647 }
3648 3648
3649 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3649 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3650 if (ev) { 3650 if (ev) {
3651 if ( !dlg->addMessage(ev,method) ) delete(ev); 3651 if ( !dlg->addMessage(ev,method) ) delete(ev);
3652 } else { 3652 } else {
3653 if (to) { 3653 if (to) {
3654 if ( !dlg->addMessage(to,method) ) delete(to); 3654 if ( !dlg->addMessage(to,method) ) delete(to);
3655 } 3655 }
3656 } 3656 }
3657} 3657}
3658 3658
3659void CalendarView::openAddressbook() 3659void CalendarView::openAddressbook()
3660{ 3660{
3661 KRun::runCommand("kaddressbook"); 3661 KRun::runCommand("kaddressbook");
3662} 3662}
3663 3663
3664void CalendarView::setModified(bool modified) 3664void CalendarView::setModified(bool modified)
3665{ 3665{
3666 if ( modified ) 3666 if ( modified )
3667 emit signalmodified(); 3667 emit signalmodified();
3668 if (mModified != modified) { 3668 if (mModified != modified) {
3669 mModified = modified; 3669 mModified = modified;
3670 emit modifiedChanged(mModified); 3670 emit modifiedChanged(mModified);
3671 } 3671 }
3672} 3672}
3673 3673
3674bool CalendarView::isReadOnly() 3674bool CalendarView::isReadOnly()
3675{ 3675{
3676 return mReadOnly; 3676 return mReadOnly;
3677} 3677}
3678 3678
3679void CalendarView::setReadOnly(bool readOnly) 3679void CalendarView::setReadOnly(bool readOnly)
3680{ 3680{
3681 if (mReadOnly != readOnly) { 3681 if (mReadOnly != readOnly) {
3682 mReadOnly = readOnly; 3682 mReadOnly = readOnly;
3683 emit readOnlyChanged(mReadOnly); 3683 emit readOnlyChanged(mReadOnly);
3684 } 3684 }
3685} 3685}
3686 3686
3687bool CalendarView::isModified() 3687bool CalendarView::isModified()
3688{ 3688{
3689 return mModified; 3689 return mModified;
3690} 3690}
3691void CalendarView::slotprintSelInc() 3691void CalendarView::slotprintSelInc()
3692{ 3692{
3693 if ( currentSelection() == 0 ) { 3693 if ( currentSelection() == 0 ) {
3694 KMessageBox::sorry(this,i18n("There is nothing selected!")); 3694 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3695 return; 3695 return;
3696 } 3696 }
3697 showIncidence(); 3697 showIncidence();
3698 getEventViewerDialog()->print(); 3698 getEventViewerDialog()->print();
3699 3699
3700} 3700}
3701void CalendarView::printSetup() 3701void CalendarView::printSetup()
3702{ 3702{
3703#ifndef KORG_NOPRINTER 3703#ifndef KORG_NOPRINTER
3704 createPrinter(); 3704 createPrinter();
3705 3705
3706 mCalPrinter->setupPrinter(); 3706 mCalPrinter->setupPrinter();
3707#endif 3707#endif
3708} 3708}
3709 3709
3710void CalendarView::print() 3710void CalendarView::print()
3711{ 3711{
3712#ifndef KORG_NOPRINTER 3712#ifndef KORG_NOPRINTER
3713 createPrinter(); 3713 createPrinter();
3714 3714
3715 DateList tmpDateList = mNavigator->selectedDates(); 3715 DateList tmpDateList = mNavigator->selectedDates();
3716 mCalPrinter->print(CalPrinter::Month, 3716 mCalPrinter->print(CalPrinter::Month,
3717 tmpDateList.first(), tmpDateList.last()); 3717 tmpDateList.first(), tmpDateList.last());
3718#endif 3718#endif
3719} 3719}
3720 3720
3721void CalendarView::printPreview() 3721void CalendarView::printPreview()
3722{ 3722{
3723#ifndef KORG_NOPRINTER 3723#ifndef KORG_NOPRINTER
3724 kdDebug() << "CalendarView::printPreview()" << endl; 3724 kdDebug() << "CalendarView::printPreview()" << endl;
3725 3725
3726 createPrinter(); 3726 createPrinter();
3727 3727
3728 DateList tmpDateList = mNavigator->selectedDates(); 3728 DateList tmpDateList = mNavigator->selectedDates();
3729 3729
3730 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3730 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3731 tmpDateList.last()); 3731 tmpDateList.last());
3732#endif 3732#endif
3733} 3733}
3734 3734
3735void CalendarView::exportICalendar() 3735void CalendarView::exportICalendar()
3736{ 3736{
3737 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3737 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3738 3738
3739 // Force correct extension 3739 // Force correct extension
3740 if (filename.right(4) != ".ics") filename += ".ics"; 3740 if (filename.right(4) != ".ics") filename += ".ics";
3741 3741
3742 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3742 FileStorage storage( mCalendar, filename, new ICalFormat() );
3743 storage.save(); 3743 storage.save();
3744} 3744}
3745 3745
3746bool CalendarView::exportVCalendar( QString filename ) 3746bool CalendarView::exportVCalendar( QString filename )
3747{ 3747{
3748 if (mCalendar->journals().count() > 0) { 3748 if (mCalendar->journals().count() > 0) {
3749 int result = KMessageBox::warningContinueCancel(this, 3749 int result = KMessageBox::warningContinueCancel(this,
3750 i18n("The journal entries can not be\nexported to a vCalendar file."), 3750 i18n("The journal entries can not be\nexported to a vCalendar file."),
3751 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3751 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3752 true); 3752 true);
3753 if (result != KMessageBox::Continue) return false; 3753 if (result != KMessageBox::Continue) return false;
3754 } 3754 }
3755 3755
3756 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3756 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3757 3757
3758 // Force correct extension 3758 // Force correct extension
3759 if (filename.right(4) != ".vcs") filename += ".vcs"; 3759 if (filename.right(4) != ".vcs") filename += ".vcs";
3760 3760
3761 FileStorage storage( mCalendar, filename, new VCalFormat ); 3761 FileStorage storage( mCalendar, filename, new VCalFormat );
3762 return storage.save(); 3762 return storage.save();
3763 3763
3764} 3764}
3765 3765
3766void CalendarView::eventUpdated(Incidence *) 3766void CalendarView::eventUpdated(Incidence *)
3767{ 3767{
3768 setModified(); 3768 setModified();
3769 // Don't call updateView here. The code, which has caused the update of the 3769 // Don't call updateView here. The code, which has caused the update of the
3770 // event is responsible for updating the view. 3770 // event is responsible for updating the view.
3771 // updateView(); 3771 // updateView();
3772} 3772}
3773 3773
3774void CalendarView::adaptNavigationUnits() 3774void CalendarView::adaptNavigationUnits()
3775{ 3775{
3776 if (mViewManager->currentView()->isEventView()) { 3776 if (mViewManager->currentView()->isEventView()) {
3777 int days = mViewManager->currentView()->currentDateCount(); 3777 int days = mViewManager->currentView()->currentDateCount();
3778 if (days == 1) { 3778 if (days == 1) {
3779 emit changeNavStringPrev(i18n("&Previous Day")); 3779 emit changeNavStringPrev(i18n("&Previous Day"));
3780 emit changeNavStringNext(i18n("&Next Day")); 3780 emit changeNavStringNext(i18n("&Next Day"));
3781 } else { 3781 } else {
3782 emit changeNavStringPrev(i18n("&Previous Week")); 3782 emit changeNavStringPrev(i18n("&Previous Week"));
3783 emit changeNavStringNext(i18n("&Next Week")); 3783 emit changeNavStringNext(i18n("&Next Week"));
3784 } 3784 }
3785 } 3785 }
3786} 3786}
3787 3787
3788void CalendarView::processMainViewSelection( Incidence *incidence ) 3788void CalendarView::processMainViewSelection( Incidence *incidence )
3789{ 3789{
3790 if ( incidence ) mTodoList->clearSelection(); 3790 if ( incidence ) mTodoList->clearSelection();
3791 processIncidenceSelection( incidence ); 3791 processIncidenceSelection( incidence );
3792} 3792}
3793 3793
3794void CalendarView::processTodoListSelection( Incidence *incidence ) 3794void CalendarView::processTodoListSelection( Incidence *incidence )
3795{ 3795{
3796 if ( incidence && mViewManager->currentView() ) { 3796 if ( incidence && mViewManager->currentView() ) {
3797 mViewManager->currentView()->clearSelection(); 3797 mViewManager->currentView()->clearSelection();
3798 } 3798 }
3799 processIncidenceSelection( incidence ); 3799 processIncidenceSelection( incidence );
3800} 3800}
3801 3801
3802void CalendarView::processIncidenceSelection( Incidence *incidence ) 3802void CalendarView::processIncidenceSelection( Incidence *incidence )
3803{ 3803{
3804 if ( incidence == mSelectedIncidence ) return; 3804 if ( incidence == mSelectedIncidence ) return;
3805 3805
3806 mSelectedIncidence = incidence; 3806 mSelectedIncidence = incidence;
3807 3807
3808 emit incidenceSelected( mSelectedIncidence ); 3808 emit incidenceSelected( mSelectedIncidence );
3809 3809
3810 if ( incidence && incidence->typeID() == eventID ) { 3810 if ( incidence && incidence->typeID() == eventID ) {
3811 Event *event = static_cast<Event *>( incidence ); 3811 Event *event = static_cast<Event *>( incidence );
3812 if ( event->organizer() == KOPrefs::instance()->email() ) { 3812 if ( event->organizer() == KOPrefs::instance()->email() ) {
3813 emit organizerEventsSelected( true ); 3813 emit organizerEventsSelected( true );
3814 } else { 3814 } else {
3815 emit organizerEventsSelected(false); 3815 emit organizerEventsSelected(false);
3816 } 3816 }
3817 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3817 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3818 KOPrefs::instance()->email() ) ) { 3818 KOPrefs::instance()->email() ) ) {
3819 emit groupEventsSelected( true ); 3819 emit groupEventsSelected( true );
3820 } else { 3820 } else {
3821 emit groupEventsSelected(false); 3821 emit groupEventsSelected(false);
3822 } 3822 }
3823 return; 3823 return;
3824 } else { 3824 } else {
3825 if ( incidence && incidence->typeID() == todoID ) { 3825 if ( incidence && incidence->typeID() == todoID ) {
3826 emit todoSelected( true ); 3826 emit todoSelected( true );
3827 Todo *event = static_cast<Todo *>( incidence ); 3827 Todo *event = static_cast<Todo *>( incidence );
3828 if ( event->organizer() == KOPrefs::instance()->email() ) { 3828 if ( event->organizer() == KOPrefs::instance()->email() ) {
3829 emit organizerEventsSelected( true ); 3829 emit organizerEventsSelected( true );
3830 } else { 3830 } else {
3831 emit organizerEventsSelected(false); 3831 emit organizerEventsSelected(false);
3832 } 3832 }
3833 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3833 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3834 KOPrefs::instance()->email() ) ) { 3834 KOPrefs::instance()->email() ) ) {
3835 emit groupEventsSelected( true ); 3835 emit groupEventsSelected( true );
3836 } else { 3836 } else {
3837 emit groupEventsSelected(false); 3837 emit groupEventsSelected(false);
3838 } 3838 }
3839 return; 3839 return;
3840 } else { 3840 } else {
3841 emit todoSelected( false ); 3841 emit todoSelected( false );
3842 emit organizerEventsSelected(false); 3842 emit organizerEventsSelected(false);
3843 emit groupEventsSelected(false); 3843 emit groupEventsSelected(false);
3844 } 3844 }
3845 return; 3845 return;
3846 } 3846 }
3847 3847
3848 /* if ( incidence && incidence->typeID() == todoID ) { 3848 /* if ( incidence && incidence->typeID() == todoID ) {
3849 emit todoSelected( true ); 3849 emit todoSelected( true );
3850 } else { 3850 } else {
3851 emit todoSelected( false ); 3851 emit todoSelected( false );
3852 }*/ 3852 }*/
3853} 3853}
3854 3854
3855 3855
3856void CalendarView::checkClipboard() 3856void CalendarView::checkClipboard()
3857{ 3857{
3858#ifndef KORG_NODND 3858#ifndef KORG_NODND
3859 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3859 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3860 emit pasteEnabled(true); 3860 emit pasteEnabled(true);
3861 } else { 3861 } else {
3862 emit pasteEnabled(false); 3862 emit pasteEnabled(false);
3863 } 3863 }
3864#endif 3864#endif
3865} 3865}
3866 3866
3867void CalendarView::showDates(const DateList &selectedDates) 3867void CalendarView::showDates(const DateList &selectedDates)
3868{ 3868{
3869 // kdDebug() << "CalendarView::selectDates()" << endl; 3869 // kdDebug() << "CalendarView::selectDates()" << endl;
3870 3870
3871 3871
3872 if ( !mBlockShowDates ) { 3872 if ( !mBlockShowDates ) {
3873 if ( mViewManager->currentView() ) { 3873 if ( mViewManager->currentView() ) {
3874 updateView( selectedDates.first(), selectedDates.last() ); 3874 updateView( selectedDates.first(), selectedDates.last() );
3875 } else { 3875 } else {
3876 mViewManager->showAgendaView(); 3876 mViewManager->showAgendaView();
3877 } 3877 }
3878 } 3878 }
3879 3879
3880 QDate date = selectedDates.first(); 3880 QDate date = selectedDates.first();
3881 if ( ! date.isValid() ) { 3881 if ( ! date.isValid() ) {
3882 topLevelWidget()->setCaption(""); 3882 topLevelWidget()->setCaption("");
3883 return; 3883 return;
3884 } 3884 }
3885 3885
3886 QString selDates; 3886 QString selDates;
3887 selDates = KGlobal::locale()->formatDate( date, true); 3887 selDates = KGlobal::locale()->formatDate( date, true);
3888 if (selectedDates.first() < selectedDates.last() ) 3888 if (selectedDates.first() < selectedDates.last() )
3889 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3889 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3890 else { 3890 else {
3891 QString addString; 3891 QString addString;
3892 if ( date == QDateTime::currentDateTime().date() ) 3892 if ( date == QDateTime::currentDateTime().date() )
3893 addString = i18n("Today"); 3893 addString = i18n("Today");
3894 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3894 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3895 addString = i18n("Tomorrow"); 3895 addString = i18n("Tomorrow");
3896 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3896 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3897 addString = i18n("Yesterday"); 3897 addString = i18n("Yesterday");
3898 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3898 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3899 addString = i18n("Day before yesterday"); 3899 addString = i18n("Day before yesterday");
3900 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3900 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3901 addString = i18n("Day after tomorrow"); 3901 addString = i18n("Day after tomorrow");
3902 if ( !addString.isEmpty() ) { 3902 if ( !addString.isEmpty() ) {
3903 topLevelWidget()->setCaption( addString+", " + selDates ); 3903 topLevelWidget()->setCaption( addString+", " + selDates );
3904 return; 3904 return;
3905 } 3905 }
3906 } 3906 }
3907 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3907 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3908 3908
3909} 3909}
3910 3910
3911QPtrList<CalFilter> CalendarView::filters() 3911QPtrList<CalFilter> CalendarView::filters()
3912{ 3912{
3913 return mFilters; 3913 return mFilters;
3914 3914
3915} 3915}
3916void CalendarView::editFilters() 3916void CalendarView::editFilters()
3917{ 3917{
3918 // kdDebug() << "CalendarView::editFilters()" << endl; 3918 // kdDebug() << "CalendarView::editFilters()" << endl;
3919 3919
3920 CalFilter *filter = mFilters.first(); 3920 CalFilter *filter = mFilters.first();
3921 while(filter) { 3921 while(filter) {
3922 kdDebug() << " Filter: " << filter->name() << endl; 3922 kdDebug() << " Filter: " << filter->name() << endl;
3923 filter = mFilters.next(); 3923 filter = mFilters.next();
3924 } 3924 }
3925 3925
3926 mDialogManager->showFilterEditDialog(&mFilters); 3926 mDialogManager->showFilterEditDialog(&mFilters);
3927} 3927}
3928void CalendarView::toggleFilter() 3928void CalendarView::toggleFilter()
3929{ 3929{
3930 showFilter(! mFilterView->isVisible()); 3930 showFilter(! mFilterView->isVisible());
3931} 3931}
3932 3932
3933KOFilterView *CalendarView::filterView() 3933KOFilterView *CalendarView::filterView()
3934{ 3934{
3935 return mFilterView; 3935 return mFilterView;
3936} 3936}
3937void CalendarView::selectFilter( int fil ) 3937void CalendarView::selectFilter( int fil )
3938{ 3938{
3939 mFilterView->setSelectedFilter( fil ); 3939 mFilterView->setSelectedFilter( fil );
3940} 3940}
3941void CalendarView::showFilter(bool visible) 3941void CalendarView::showFilter(bool visible)
3942{ 3942{
3943#if 0 3943#if 1
3944 if (visible) mCalEditView->show(); 3944 if (visible) {
3945 mCalEditView->readConfig();
3946 mCalEditView->show();
3947 }
3945 else mCalEditView->hide(); 3948 else mCalEditView->hide();
3946#else 3949#else
3947 if (visible) mFilterView->show(); 3950 if (visible) mFilterView->show();
3948 else mFilterView->hide(); 3951 else mFilterView->hide();
3949#endif 3952#endif
3950} 3953}
3951void CalendarView::toggleFilerEnabled( ) 3954void CalendarView::toggleFilerEnabled( )
3952{ 3955{
3953 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3956 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3954 if ( !mFilterView->filtersEnabled() ) 3957 if ( !mFilterView->filtersEnabled() )
3955 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3958 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3956 3959
3957} 3960}
3958void CalendarView::updateFilter() 3961void CalendarView::updateFilter()
3959{ 3962{
3960 CalFilter *filter = mFilterView->selectedFilter(); 3963 CalFilter *filter = mFilterView->selectedFilter();
3961 if (filter) { 3964 if (filter) {
3962 QString mess; 3965 QString mess;
3963 if (mFilterView->filtersEnabled()) { 3966 if (mFilterView->filtersEnabled()) {
3964 mess = i18n("Filter selected: ")+filter->name(); 3967 mess = i18n("Filter selected: ")+filter->name();
3965 filter->setEnabled(true); 3968 filter->setEnabled(true);
3966 } 3969 }
3967 else filter->setEnabled(false); 3970 else filter->setEnabled(false);
3968 mCalendar->setFilter(filter); 3971 mCalendar->setFilter(filter);
3969 updateView(); 3972 updateView();
3970 if ( !mess.isEmpty() ) 3973 if ( !mess.isEmpty() )
3971 topLevelWidget()->setCaption( mess ); 3974 topLevelWidget()->setCaption( mess );
3972 3975
3973 } 3976 }
3974} 3977}
3975 3978
3976void CalendarView::filterEdited() 3979void CalendarView::filterEdited()
3977{ 3980{
3978 mFilterView->updateFilters(); 3981 mFilterView->updateFilters();
3979 updateFilter(); 3982 updateFilter();
3980 writeSettings(); 3983 writeSettings();
3981} 3984}
3982 3985
3983 3986
3984void CalendarView::takeOverEvent() 3987void CalendarView::takeOverEvent()
3985{ 3988{
3986 Incidence *incidence = currentSelection(); 3989 Incidence *incidence = currentSelection();
3987 3990
3988 if (!incidence) return; 3991 if (!incidence) return;
3989 3992
3990 incidence->setOrganizer(KOPrefs::instance()->email()); 3993 incidence->setOrganizer(KOPrefs::instance()->email());
3991 incidence->recreate(); 3994 incidence->recreate();
3992 incidence->setReadOnly(false); 3995 incidence->setReadOnly(false);
3993 3996
3994 updateView(); 3997 updateView();
3995} 3998}
3996 3999
3997void CalendarView::takeOverCalendar() 4000void CalendarView::takeOverCalendar()
3998{ 4001{
3999 // TODO: Create Calendar::allIncidences() function and use it here 4002 // TODO: Create Calendar::allIncidences() function and use it here
4000 4003
4001 clearAllViews(); 4004 clearAllViews();
4002 QPtrList<Event> events = mCalendar->events(); 4005 QPtrList<Event> events = mCalendar->events();
4003 for(uint i=0; i<events.count(); ++i) { 4006 for(uint i=0; i<events.count(); ++i) {
4004 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4007 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4005 events.at(i)->recreate(); 4008 events.at(i)->recreate();
4006 events.at(i)->setReadOnly(false); 4009 events.at(i)->setReadOnly(false);
4007 } 4010 }
4008 4011
4009 QPtrList<Todo> todos = mCalendar->todos(); 4012 QPtrList<Todo> todos = mCalendar->todos();
4010 for(uint i=0; i<todos.count(); ++i) { 4013 for(uint i=0; i<todos.count(); ++i) {
4011 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4014 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4012 todos.at(i)->recreate(); 4015 todos.at(i)->recreate();
4013 todos.at(i)->setReadOnly(false); 4016 todos.at(i)->setReadOnly(false);
4014 } 4017 }
4015 4018
4016 QPtrList<Journal> journals = mCalendar->journals(); 4019 QPtrList<Journal> journals = mCalendar->journals();
4017 for(uint i=0; i<journals.count(); ++i) { 4020 for(uint i=0; i<journals.count(); ++i) {
4018 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4021 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4019 journals.at(i)->recreate(); 4022 journals.at(i)->recreate();
4020 journals.at(i)->setReadOnly(false); 4023 journals.at(i)->setReadOnly(false);
4021 } 4024 }
4022 4025
4023 updateView(); 4026 updateView();
4024} 4027}
4025 4028
4026void CalendarView::showIntro() 4029void CalendarView::showIntro()
4027{ 4030{
4028 kdDebug() << "To be implemented." << endl; 4031 kdDebug() << "To be implemented." << endl;
4029} 4032}
4030 4033
4031QWidgetStack *CalendarView::viewStack() 4034QWidgetStack *CalendarView::viewStack()
4032{ 4035{
4033 return mRightFrame; 4036 return mRightFrame;
4034} 4037}
4035 4038
4036QWidget *CalendarView::leftFrame() 4039QWidget *CalendarView::leftFrame()
4037{ 4040{
4038 return ( QWidget *)mLeftFrame; 4041 return ( QWidget *)mLeftFrame;
4039} 4042}
4040 4043
4041DateNavigator *CalendarView::dateNavigator() 4044DateNavigator *CalendarView::dateNavigator()
4042{ 4045{
4043 return mNavigator; 4046 return mNavigator;
4044} 4047}
4045 4048
4046KDateNavigator* CalendarView::dateNavigatorWidget() 4049KDateNavigator* CalendarView::dateNavigatorWidget()
4047{ 4050{
4048 return mDateNavigator->navigatorView(); 4051 return mDateNavigator->navigatorView();
4049} 4052}
4050void CalendarView::toggleDateNavigatorWidget() 4053void CalendarView::toggleDateNavigatorWidget()
4051{ 4054{
4052 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4055 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4053 4056
4054 if (!KOPrefs::instance()->mShowDateNavigator ) 4057 if (!KOPrefs::instance()->mShowDateNavigator )
4055 mDateNavigator->hide(); 4058 mDateNavigator->hide();
4056 else 4059 else
4057 mDateNavigator->show(); 4060 mDateNavigator->show();
4058} 4061}
4059void CalendarView::addView(KOrg::BaseView *view) 4062void CalendarView::addView(KOrg::BaseView *view)
4060{ 4063{
4061 mViewManager->addView(view); 4064 mViewManager->addView(view);
4062} 4065}
4063 4066
4064void CalendarView::showView(KOrg::BaseView *view) 4067void CalendarView::showView(KOrg::BaseView *view)
4065{ 4068{
4066 mViewManager->showView(view, mLeftFrame->isVisible()); 4069 mViewManager->showView(view, mLeftFrame->isVisible());
4067} 4070}
4068 4071
4069Incidence *CalendarView::currentSelection() 4072Incidence *CalendarView::currentSelection()
4070{ 4073{
4071 return mViewManager->currentSelection(); 4074 return mViewManager->currentSelection();
4072} 4075}
4073void CalendarView::toggleAllDaySize() 4076void CalendarView::toggleAllDaySize()
4074{ 4077{
4075 /* 4078 /*
4076 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4079 if ( KOPrefs::instance()->mAllDaySize > 47 )
4077 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4080 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4078 else 4081 else
4079 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4082 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4080 */ 4083 */
4081 viewManager()->agendaView()->toggleAllDay(); 4084 viewManager()->agendaView()->toggleAllDay();
4082} 4085}
4083void CalendarView::toggleExpand() 4086void CalendarView::toggleExpand()
4084{ 4087{
4085 // if ( mLeftFrame->isHidden() ) { 4088 // if ( mLeftFrame->isHidden() ) {
4086 // mLeftFrame->show(); 4089 // mLeftFrame->show();
4087 // emit calendarViewExpanded( false ); 4090 // emit calendarViewExpanded( false );
4088 // } else { 4091 // } else {
4089 // mLeftFrame->hide(); 4092 // mLeftFrame->hide();
4090 // emit calendarViewExpanded( true ); 4093 // emit calendarViewExpanded( true );
4091 // } 4094 // }
4092 //qDebug(" CalendarView::toggleExpand()"); 4095 //qDebug(" CalendarView::toggleExpand()");
4093 globalFlagBlockAgenda = 1; 4096 globalFlagBlockAgenda = 1;
4094 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4097 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4095 globalFlagBlockAgenda = 5; 4098 globalFlagBlockAgenda = 5;
4096 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4099 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4097 //mViewManager->showView( 0, true ); 4100 //mViewManager->showView( 0, true );
4098} 4101}
4099 4102
4100void CalendarView::calendarModified( bool modified, Calendar * ) 4103void CalendarView::calendarModified( bool modified, Calendar * )
4101{ 4104{
4102 setModified( modified ); 4105 setModified( modified );
4103} 4106}
4104 4107
4105Todo *CalendarView::selectedTodo() 4108Todo *CalendarView::selectedTodo()
4106{ 4109{
4107 Incidence *incidence = currentSelection(); 4110 Incidence *incidence = currentSelection();
4108 if ( incidence && incidence->typeID() == todoID ) { 4111 if ( incidence && incidence->typeID() == todoID ) {
4109 return static_cast<Todo *>( incidence ); 4112 return static_cast<Todo *>( incidence );
4110 } 4113 }
4111 4114
4112 incidence = mTodoList->selectedIncidences().first(); 4115 incidence = mTodoList->selectedIncidences().first();
4113 if ( incidence && incidence->typeID() == todoID ) { 4116 if ( incidence && incidence->typeID() == todoID ) {
4114 return static_cast<Todo *>( incidence ); 4117 return static_cast<Todo *>( incidence );
4115 } 4118 }
4116 4119
4117 return 0; 4120 return 0;
4118} 4121}
4119 4122
4120void CalendarView::dialogClosing(Incidence *in) 4123void CalendarView::dialogClosing(Incidence *in)
4121{ 4124{
4122 // mDialogList.remove(in); 4125 // mDialogList.remove(in);
4123} 4126}
4124 4127
4125void CalendarView::showIncidence() 4128void CalendarView::showIncidence()
4126{ 4129{
4127 mViewerCallerIsSearchDialog = false; 4130 mViewerCallerIsSearchDialog = false;
4128 Incidence *incidence = currentSelection(); 4131 Incidence *incidence = currentSelection();
4129 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4132 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4130 if ( incidence ) { 4133 if ( incidence ) {
4131 ShowIncidenceVisitor v; 4134 ShowIncidenceVisitor v;
4132 v.act( incidence, this ); 4135 v.act( incidence, this );
4133 } 4136 }
4134} 4137}
4135void CalendarView::editIncidenceDescription() 4138void CalendarView::editIncidenceDescription()
4136{ 4139{
4137 mFlagEditDescription = true; 4140 mFlagEditDescription = true;
4138 editIncidence(); 4141 editIncidence();
4139 mFlagEditDescription = false; 4142 mFlagEditDescription = false;
4140} 4143}
4141void CalendarView::editIncidence() 4144void CalendarView::editIncidence()
4142{ 4145{
4143 // qDebug("editIncidence() "); 4146 // qDebug("editIncidence() ");
4144 Incidence *incidence = currentSelection(); 4147 Incidence *incidence = currentSelection();
4145 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4148 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4146 if ( incidence ) { 4149 if ( incidence ) {
4147 EditIncidenceVisitor v; 4150 EditIncidenceVisitor v;
4148 v.act( incidence, this ); 4151 v.act( incidence, this );
4149 } 4152 }
4150} 4153}
4151 4154
4152void CalendarView::deleteIncidence() 4155void CalendarView::deleteIncidence()
4153{ 4156{
4154 Incidence *incidence = currentSelection(); 4157 Incidence *incidence = currentSelection();
4155 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4158 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4156 if ( incidence ) { 4159 if ( incidence ) {
4157 deleteIncidence(incidence); 4160 deleteIncidence(incidence);
4158 } 4161 }
4159} 4162}
4160void CalendarView::showIncidence(QString uid) 4163void CalendarView::showIncidence(QString uid)
4161{ 4164{
4162 Incidence *inc = mCalendar->incidence( uid ); 4165 Incidence *inc = mCalendar->incidence( uid );
4163 if ( inc ) 4166 if ( inc )
4164 showIncidence( inc ); 4167 showIncidence( inc );
4165} 4168}
4166void CalendarView::showIncidence(Incidence *incidence) 4169void CalendarView::showIncidence(Incidence *incidence)
4167{ 4170{
4168 mViewerCallerIsSearchDialog = false; 4171 mViewerCallerIsSearchDialog = false;
4169 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4172 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4170 if ( sender() && mDialogManager->getSearchDialog() ) { 4173 if ( sender() && mDialogManager->getSearchDialog() ) {
4171 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4174 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4172 mViewerCallerIsSearchDialog = true; 4175 mViewerCallerIsSearchDialog = true;
4173 } 4176 }
4174 } 4177 }
4175 if ( incidence ) { 4178 if ( incidence ) {
4176 ShowIncidenceVisitor v; 4179 ShowIncidenceVisitor v;
4177 v.act( incidence, this ); 4180 v.act( incidence, this );
4178 } 4181 }
4179} 4182}
4180 4183
4181void CalendarView::editIncidence(Incidence *incidence) 4184void CalendarView::editIncidence(Incidence *incidence)
4182{ 4185{
4183 if ( incidence ) { 4186 if ( incidence ) {
4184 4187
4185 EditIncidenceVisitor v; 4188 EditIncidenceVisitor v;
4186 v.act( incidence, this ); 4189 v.act( incidence, this );
4187 4190
4188 } 4191 }
4189} 4192}
4190 4193
4191void CalendarView::deleteIncidence(Incidence *incidence) 4194void CalendarView::deleteIncidence(Incidence *incidence)
4192{ 4195{
4193 //qDebug(" CalendarView::deleteIncidence "); 4196 //qDebug(" CalendarView::deleteIncidence ");
4194 if ( incidence ) { 4197 if ( incidence ) {
4195 DeleteIncidenceVisitor v; 4198 DeleteIncidenceVisitor v;
4196 v.act( incidence, this ); 4199 v.act( incidence, this );
4197 } 4200 }
4198} 4201}
4199 4202
4200 4203
4201void CalendarView::lookForOutgoingMessages() 4204void CalendarView::lookForOutgoingMessages()
4202{ 4205{
4203 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4206 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4204 ogd->loadMessages(); 4207 ogd->loadMessages();
4205} 4208}
4206 4209
4207void CalendarView::lookForIncomingMessages() 4210void CalendarView::lookForIncomingMessages()
4208{ 4211{
4209 IncomingDialog *icd = mDialogManager->incomingDialog(); 4212 IncomingDialog *icd = mDialogManager->incomingDialog();
4210 icd->retrieve(); 4213 icd->retrieve();
4211} 4214}
4212 4215
4213bool CalendarView::removeCompletedSubTodos( Todo* t ) 4216bool CalendarView::removeCompletedSubTodos( Todo* t )
4214{ 4217{
4215 bool deleteTodo = true; 4218 bool deleteTodo = true;
4216 QPtrList<Incidence> subTodos; 4219 QPtrList<Incidence> subTodos;
4217 Incidence *aTodo; 4220 Incidence *aTodo;
4218 subTodos = t->relations(); 4221 subTodos = t->relations();
4219 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4222 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4220 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4223 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4221 deleteTodo = false; 4224 deleteTodo = false;
4222 } 4225 }
4223 if ( deleteTodo ) { 4226 if ( deleteTodo ) {
4224 if ( t->isCompleted() && !t->doesRecur()) { 4227 if ( t->isCompleted() && !t->doesRecur()) {
4225 checkExternalId( t ); 4228 checkExternalId( t );
4226 mCalendar->deleteTodo( t ); 4229 mCalendar->deleteTodo( t );
4227 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4230 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4228 } 4231 }
4229 else 4232 else
4230 deleteTodo = false; 4233 deleteTodo = false;
4231 } 4234 }
4232 return deleteTodo; 4235 return deleteTodo;
4233 4236
4234} 4237}
4235void CalendarView::purgeCompleted() 4238void CalendarView::purgeCompleted()
4236{ 4239{
4237 int result = KMessageBox::warningContinueCancel(this, 4240 int result = KMessageBox::warningContinueCancel(this,
4238 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4241 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4239 4242
4240 if (result == KMessageBox::Continue) { 4243 if (result == KMessageBox::Continue) {
4241 4244
4242 QPtrList<Todo> todoCal; 4245 QPtrList<Todo> todoCal;
4243 QPtrList<Todo> rootTodos; 4246 QPtrList<Todo> rootTodos;
4244 //QPtrList<Incidence> rel; 4247 //QPtrList<Incidence> rel;
4245 Todo *aTodo;//, *rTodo; 4248 Todo *aTodo;//, *rTodo;
4246 Incidence *rIncidence; 4249 Incidence *rIncidence;
4247 bool childDelete = false; 4250 bool childDelete = false;
4248 bool deletedOne = true; 4251 bool deletedOne = true;
4249 todoCal = calendar()->todos(); 4252 todoCal = calendar()->todos();
4250 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4253 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4251 if ( !aTodo->relatedTo() ) 4254 if ( !aTodo->relatedTo() )
4252 rootTodos.append( aTodo ); 4255 rootTodos.append( aTodo );
4253 } 4256 }
4254 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4257 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4255 removeCompletedSubTodos( aTodo ); 4258 removeCompletedSubTodos( aTodo );
4256 } 4259 }
4257 4260
4258 updateView(); 4261 updateView();
4259 } 4262 }
4260} 4263}
4261 4264
4262void CalendarView::slotCalendarChanged() 4265void CalendarView::slotCalendarChanged()
4263{ 4266{
4264 ; 4267 ;
4265} 4268}
4266 4269
4267void CalendarView::keyPressEvent ( QKeyEvent *e) 4270void CalendarView::keyPressEvent ( QKeyEvent *e)
4268{ 4271{
4269 //qDebug(" alendarView::keyPressEvent "); 4272 //qDebug(" alendarView::keyPressEvent ");
4270 e->ignore(); 4273 e->ignore();
4271} 4274}
4272 4275
4273 4276
4274bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4277bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4275{ 4278{
4276 // mSyncManager = manager; 4279 // mSyncManager = manager;
4277 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4280 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4278 qDebug("KO: SyncKDE request detected!"); 4281 qDebug("KO: SyncKDE request detected!");
4279 } 4282 }
4280 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4283 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4281 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4284 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4282 return syncCalendar( filename, mode ); 4285 return syncCalendar( filename, mode );
4283} 4286}
4284bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4287bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4285{ 4288{
4286 //mSyncManager = manager; 4289 //mSyncManager = manager;
4287 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4290 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4288 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4291 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4289 if ( resource == "sharp" ) 4292 if ( resource == "sharp" )
4290 syncExternal( 0 ); 4293 syncExternal( 0 );
4291 if ( resource == "phone" ) 4294 if ( resource == "phone" )
4292 syncExternal( 1 ); 4295 syncExternal( 1 );
4293 // pending setmodified 4296 // pending setmodified
4294 return true; 4297 return true;
4295} 4298}
4296void CalendarView::setSyncManager(KSyncManager* manager) 4299void CalendarView::setSyncManager(KSyncManager* manager)
4297{ 4300{
4298 mSyncManager = manager; 4301 mSyncManager = manager;
4299} 4302}
4300 4303
4301void CalendarView::removeSyncInfo( QString syncProfile) 4304void CalendarView::removeSyncInfo( QString syncProfile)
4302{ 4305{
4303 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4306 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4304 mCalendar->removeSyncInfo( syncProfile ); 4307 mCalendar->removeSyncInfo( syncProfile );
4305 4308
4306} 4309}
4307 4310
4308void CalendarView::undo_delete() 4311void CalendarView::undo_delete()
4309{ 4312{
4310 //qDebug("undo_delete() "); 4313 //qDebug("undo_delete() ");
4311 Incidence* undo = mCalendar->undoIncidence(); 4314 Incidence* undo = mCalendar->undoIncidence();
4312 if ( !undo ) { 4315 if ( !undo ) {
4313 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4316 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4314 i18n("KO/Pi")); 4317 i18n("KO/Pi"));
4315 return; 4318 return;
4316 } 4319 }
4317 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4320 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4318 i18n("\nAre you sure you want\nto restore this?"), 4321 i18n("\nAre you sure you want\nto restore this?"),
4319 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4322 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4320 mCalendar->undoDeleteIncidence(); 4323 mCalendar->undoDeleteIncidence();
4321 updateView(); 4324 updateView();
4322 } 4325 }
4323} 4326}
4324 4327
4325void CalendarView::slotViewerClosed() 4328void CalendarView::slotViewerClosed()
4326{ 4329{
4327 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4330 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4328} 4331}
4329 4332
4330void CalendarView::resetFocus() 4333void CalendarView::resetFocus()
4331{ 4334{
4332 if ( mViewerCallerIsSearchDialog ) { 4335 if ( mViewerCallerIsSearchDialog ) {
4333 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4336 if ( mDialogManager->getSearchDialog()->isVisible() ){
4334 mDialogManager->getSearchDialog()->raise(); 4337 mDialogManager->getSearchDialog()->raise();
4335 mDialogManager->getSearchDialog()->setActiveWindow(); 4338 mDialogManager->getSearchDialog()->setActiveWindow();
4336 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4339 mDialogManager->getSearchDialog()->listview()->resetFocus();
4337 } else 4340 } else
4338 mViewerCallerIsSearchDialog = false; 4341 mViewerCallerIsSearchDialog = false;
4339 } 4342 }
4340 if ( !mViewerCallerIsSearchDialog ) { 4343 if ( !mViewerCallerIsSearchDialog ) {
4341 //mViewManager->currentView()->setFocus(); 4344 //mViewManager->currentView()->setFocus();
4342 //qDebug("sssssssssssssssset focus "); 4345 //qDebug("sssssssssssssssset focus ");
4343 topLevelWidget()->raise(); 4346 topLevelWidget()->raise();
4344 setActiveWindow(); 4347 setActiveWindow();
4345 //setFocus(); 4348 //setFocus();
4346 } 4349 }
4347 mViewerCallerIsSearchDialog = false; 4350 mViewerCallerIsSearchDialog = false;
4348} 4351}
4349 4352
4350void CalendarView::showNextAlarms() 4353void CalendarView::showNextAlarms()
4351{ 4354{
4352 QString message; 4355 QString message;
4353 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4356 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4354 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4357 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4355 QString sum = mCalendar->nextSummary(); 4358 QString sum = mCalendar->nextSummary();
4356 QDateTime nextA = mNextAlarmDateTime; 4359 QDateTime nextA = mNextAlarmDateTime;
4357 QDateTime cur = QDateTime::currentDateTime(); 4360 QDateTime cur = QDateTime::currentDateTime();
4358 int secs = cur.secsTo( nextA ); 4361 int secs = cur.secsTo( nextA );
4359 int min = secs /60; 4362 int min = secs /60;
4360 int hours = min /60; 4363 int hours = min /60;
4361 min = min % 60; 4364 min = min % 60;
4362 int days = hours /24; 4365 int days = hours /24;
4363 hours = hours % 24; 4366 hours = hours % 24;
4364 4367
4365 //message = i18n("The next alarm is in:\n"); 4368 //message = i18n("The next alarm is in:\n");
4366 if ( days > 1 ) 4369 if ( days > 1 )
4367 message += i18n("%1 days\n").arg( days ); 4370 message += i18n("%1 days\n").arg( days );
4368 else if ( days == 1 ) 4371 else if ( days == 1 )
4369 message += i18n("1 day\n"); 4372 message += i18n("1 day\n");
4370 if ( hours > 1 ) 4373 if ( hours > 1 )
4371 message += i18n("%1 hours\n").arg( hours ); 4374 message += i18n("%1 hours\n").arg( hours );
4372 else if ( hours == 1 ) 4375 else if ( hours == 1 )
4373 message += i18n("1 hour\n"); 4376 message += i18n("1 hour\n");
4374 if ( min > 1 ) 4377 if ( min > 1 )
4375 message += i18n("%1 minutes\n").arg( min ); 4378 message += i18n("%1 minutes\n").arg( min );
4376 else if ( min == 1 ) 4379 else if ( min == 1 )
4377 message += i18n("1 minute\n"); 4380 message += i18n("1 minute\n");
4378 if ( message.isEmpty() ) 4381 if ( message.isEmpty() )
4379 message = i18n("The next alarm is in\nless than one minute!"); 4382 message = i18n("The next alarm is in\nless than one minute!");
4380 else 4383 else
4381 message = i18n("The next alarm is in:\n") + message; 4384 message = i18n("The next alarm is in:\n") + message;
4382 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4385 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4383 } else { 4386 } else {
4384 message = i18n("There is no next alarm."); 4387 message = i18n("There is no next alarm.");
4385 4388
4386 } 4389 }
4387#ifdef DESKTOP_VERSION 4390#ifdef DESKTOP_VERSION
4388 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4391 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4389 message += i18n("\nThe internal alarm notification is disabled!\n"); 4392 message += i18n("\nThe internal alarm notification is disabled!\n");
4390 message += i18n("Enable it in the settings menu, TAB alarm."); 4393 message += i18n("Enable it in the settings menu, TAB alarm.");
4391 } 4394 }
4392 4395
4393#endif 4396#endif
4394 KMessageBox::information( this, message); 4397 KMessageBox::information( this, message);
4395} 4398}
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index dc6237b..d79b28e 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -1,176 +1,383 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h>
29 30
30 31
31#include <libkcal/calfilter.h> 32#include <libkcal/calfilter.h>
32 33
33#include "kofilterview.h" 34#include "kofilterview.h"
35#include "koprefs.h"
34#include <kiconloader.h> 36#include <kiconloader.h>
35#include <kglobal.h> 37#include <kglobal.h>
38#include <kcolorbutton.h>
39#include <kmessagebox.h>
40
41
42#include <kurlrequester.h>
43#include <klineedit.h>
44
45class KONewCalPrefs : public QDialog
46{
47 public:
48 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) :
49 QDialog( parent, name, true )
50 {
51 setCaption( i18n("Add new Calendar") );
52 QVBoxLayout* lay = new QVBoxLayout( this );
53 lay->setSpacing( 3 );
54 lay->setMargin( 3 );
55 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this );
56 lay->addWidget( lab );
57 nameE = new KLineEdit( this );
58 lay->addWidget( nameE );
59 lab = new QLabel( i18n("Local ical (*.ics) file:"), this );
60 lay->addWidget( lab );
61 url = new KURLRequester ( this );
62 lay->addWidget( url );
63 QPushButton * ok = new QPushButton( i18n("OK"), this );
64 lay->addWidget( ok );
65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
66 lay->addWidget( cancel );
67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
69 resize( 200, 200 );
70 }
71
72 QString calName() { return nameE->text(); }
73 QString calFileName() { return url->url(); }
74private:
75 KLineEdit* nameE;
76 KURLRequester *url;
77};
78
36 79
37KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 80KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
38 const char* name,WFlags fl ) 81 const char* name,WFlags fl )
39 : KOFilterView_base(parent,name,fl) 82 : KOFilterView_base(parent,name,fl)
40{ 83{
41 mFilters = filterList; 84 mFilters = filterList;
42 85
43 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 86 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
44 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 87 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
45 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 88 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
46} 89}
47 90
48KOFilterView::~KOFilterView() 91KOFilterView::~KOFilterView()
49{ 92{
50 // no need to delete child widgets, Qt does it all for us 93 // no need to delete child widgets, Qt does it all for us
51} 94}
52 95
53bool KOFilterView::filtersEnabled() 96bool KOFilterView::filtersEnabled()
54{ 97{
55 return mEnabledCheck->isChecked(); 98 return mEnabledCheck->isChecked();
56} 99}
57 100
58void KOFilterView::setFiltersEnabled(bool set) 101void KOFilterView::setFiltersEnabled(bool set)
59{ 102{
60 mEnabledCheck->setChecked(set); 103 mEnabledCheck->setChecked(set);
61 emit filterChanged(); 104 emit filterChanged();
62} 105}
63 106
64 107
65void KOFilterView::updateFilters() 108void KOFilterView::updateFilters()
66{ 109{
67 mSelectionCombo->clear(); 110 mSelectionCombo->clear();
68 111
69 CalFilter *filter = mFilters->first(); 112 CalFilter *filter = mFilters->first();
70 while(filter) { 113 while(filter) {
71 mSelectionCombo->insertItem(filter->name()); 114 mSelectionCombo->insertItem(filter->name());
72 filter = mFilters->next(); 115 filter = mFilters->next();
73 } 116 }
74} 117}
75 118
76CalFilter *KOFilterView::selectedFilter() 119CalFilter *KOFilterView::selectedFilter()
77{ 120{
78 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
79 return f; 122 return f;
80} 123}
81 124
82void KOFilterView::setSelectedFilter(QString filterName) 125void KOFilterView::setSelectedFilter(QString filterName)
83{ 126{
84 int filter_num = mSelectionCombo->count(); 127 int filter_num = mSelectionCombo->count();
85 int i; 128 int i;
86 for (i=0;i<filter_num;i++) { 129 for (i=0;i<filter_num;i++) {
87 if (mSelectionCombo->text(i)==filterName) 130 if (mSelectionCombo->text(i)==filterName)
88 mSelectionCombo->setCurrentItem(i); 131 mSelectionCombo->setCurrentItem(i);
89 } 132 }
90 emit filterChanged(); 133 emit filterChanged();
91} 134}
92void KOFilterView::setSelectedFilter( int fil ) 135void KOFilterView::setSelectedFilter( int fil )
93{ 136{
94 if ( fil >= mSelectionCombo->count() ) 137 if ( fil >= mSelectionCombo->count() )
95 return; 138 return;
96 mSelectionCombo->setCurrentItem( fil ); 139 mSelectionCombo->setCurrentItem( fil );
97 emit filterChanged(); 140 emit filterChanged();
98} 141}
99 142
100 143
101 144
102KOCalEditView::KOCalEditView(QWidget* parent, 145KOCalEditView::KOCalEditView(QWidget* parent,
103 const char* name ) 146 const char* name )
104 : QWidget(parent,name) 147 : QWidget(parent,name)
105{ 148{
106 /* 149 mw = 0;
107 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 150 ml = new QVBoxLayout ( this );
108 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 151}
109 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editCalEdits())); 152
110 */ 153KOCalEditView::~KOCalEditView()
111 QGridLayout* mainLayout = new QGridLayout ( this , 2, 6 ); 154{
112 QPushButton * addBut = new QPushButton ( this ); 155 // no need to delete child widgets, Qt does it all for us
156}
157void KOCalEditView::selectCal(int id ,bool b)
158{
159 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
160 emit calendarEnabled ( id, b );
161
162}
163void KOCalEditView::selectStdCal( int id, bool b )
164{
165
166 if ( !b ) {
167 KOCalCheckButton* it = (KOCalCheckButton*) sender();
168 if ( it ) {
169 it->blockSignals( true );
170 it->setChecked( true );
171 it->blockSignals( false );
172 return;
173 }
174 return;
175 }
176 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
177 KOCalCheckButton* it = mStdandardB.first();
178 while ( it ) {
179 if ( it->isChecked() ) {
180 if ( it != sen ) {
181 it->blockSignals( true );
182 it->setChecked( false );
183 it->blockSignals( false );
184 break;
185 }
186 }
187 it = mStdandardB.next();
188 }
189 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
190 while ( kkf ) {
191 kkf->isStandard = false;
192 kkf = KOPrefs::instance()->mCalendars.next();
193 }
194 KOPrefs::instance()->getCalendar( id )->isStandard = true;
195 emit setCalendarDefault ( id );
196}
197
198void KOCalEditView::selectCalAlarm(int id ,bool b )
199{
200 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
201 emit alarmEnabled ( id , b );
202}
203void KOCalEditView::selectReadOnly(int id ,bool b )
204{
205 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
206 emit calendarReadonly ( id , b );
207
208}
209void KOCalEditView::setColor( const QColor& c, int id )
210{
211 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
212}
213void KOCalEditView::deleteCal( int id )
214{
215 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
216 QString name = kkf->mName;
217 QString file = kkf->mFileName;
218 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
219 emit removeCalendar ( id );
220 KOPrefs::instance()->mCalendars.remove ( kkf );
221 readConfig();
222}
223void KOCalEditView::infoCal( int id )
224{
225 QString name = KOPrefs::instance()->getCalendar( id )->mName;
226 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
227 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
228}
229void KOCalEditView::readConfig()
230{
231
232 mStdandardB.clear();
233 mEnabledB.clear();
234 mAlarmB.clear();
235 mROB.clear();
236
237 if ( mw ) delete mw;
238 mw = new QWidget ( this );
239 ml->addWidget ( mw );
240
241 mainLayout = new QGridLayout ( mw , 2, 8 );
242 mainLayout->setSpacing( 3 );
243 QPushButton * addBut = new QPushButton ( mw );
113 mainLayout->addWidget( addBut,0,0 ); 244 mainLayout->addWidget( addBut,0,0 );
114 addBut->setPixmap ( SmallIcon("plus")); 245 addBut->setPixmap ( SmallIcon("plus"));
115 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 246 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
116 addBut->setMaximumWidth( addBut->sizeHint().height() ); 247 addBut->setMaximumWidth( addBut->sizeHint().height() );
117 248
118 addBut = new QPushButton ( this ); 249 addBut = new QPushButton ( mw );
119 mainLayout->addWidget( addBut,0,1 ); 250 mainLayout->addWidget( addBut,0,1 );
120 addBut->setPixmap ( SmallIcon("eye")); 251 addBut->setPixmap ( SmallIcon("eye"));
121 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 252 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
122 addBut->setMaximumWidth( addBut->sizeHint().height() ); 253 addBut->setMaximumWidth( addBut->sizeHint().height() );
123 254
124 QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", this ); 255 QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw );
125 mainLayout->addWidget( lab,0,2 ); 256 mainLayout->addWidget( lab,0,2 );
126 257
127 addBut = new QPushButton ( this ); 258 addBut = new QPushButton ( mw );
128 mainLayout->addWidget( addBut,0,3 ); 259 mainLayout->addWidget( addBut,0,3 );
129 addBut->setPixmap ( SmallIcon("bell")); 260 addBut->setPixmap ( SmallIcon("bell"));
130 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 261 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
131 addBut->setMaximumWidth( addBut->sizeHint().height() ); 262 addBut->setMaximumWidth( addBut->sizeHint().height() );
132 263
133 addBut = new QPushButton ( this ); 264 addBut = new QPushButton ( mw );
134 mainLayout->addWidget( addBut,0,4 ); 265 mainLayout->addWidget( addBut,0,4 );
135 addBut->setPixmap ( SmallIcon("pencil")); 266 addBut->setPixmap ( SmallIcon("pencil"));
136 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 267 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
137 addBut->setMaximumWidth( addBut->sizeHint().height() ); 268 addBut->setMaximumWidth( addBut->sizeHint().height() );
138 269
139 addBut = new QPushButton ( this ); 270 lab = new QLabel ( i18n(" Color "), mw );
140 mainLayout->addWidget( addBut,0,5 ); 271 mainLayout->addWidget( lab,0,5 );
272#if 0
273 addBut = new QPushButton ( mw );
274 mainLayout->addWidget( addBut,0,6 );
141 addBut->setPixmap ( SmallIcon("minus")); 275 addBut->setPixmap ( SmallIcon("minus"));
142 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); 276 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
143 addBut->setMaximumWidth( addBut->sizeHint().height() ); 277 addBut->setMaximumWidth( addBut->sizeHint().height() );
278#endif
144 279
145 280
281 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
282 int row = 1;
283 while ( kkf ) {
146 284
147} 285 KOCalCheckButton* cb = new KOCalCheckButton( mw );
148 286 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
149KOCalEditView::~KOCalEditView() 287 cb->setChecked( kkf->isStandard );
150{ 288 cb->setNum( kkf->mCalNumber );
151 // no need to delete child widgets, Qt does it all for us 289 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
152} 290 cb = new KOCalCheckButton( mw );
153void KOCalEditView::readConfig( KConfig *) 291 mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb );
154{ 292 cb->setChecked( kkf->isEnabled );
293 cb->setNum( kkf->mCalNumber );
294 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
295 KOCalButton* name = new KOCalButton( mw );
296 name->setNum( kkf->mCalNumber );
297 name->setText( kkf->mName );
298 mainLayout->addWidget( name,row,2 );
299 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
300 cb = new KOCalCheckButton( mw );
301 mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb );
302 cb->setChecked( kkf->isAlarmEnabled );
303 cb->setNum( kkf->mCalNumber );
304 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
305 cb = new KOCalCheckButton( mw );
306 mainLayout->addWidget( cb,row,4 );mROB.append( cb );
307 cb->setChecked( kkf->isReadOnly );
308 cb->setNum( kkf->mCalNumber );
309 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
310 KColorButton *colb = new KColorButton( mw );
311 mainLayout->addWidget( colb,row,5 );
312 colb->setID( kkf->mCalNumber );
313 colb->setColor( kkf->mDefaultColor );
314 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
315 if ( row > 1) {
316 KOCalButton* calb = new KOCalButton( mw );
317 mainLayout->addWidget( calb,row,6 );
318 calb->setNum( kkf->mCalNumber );
319 calb->setPixmap ( SmallIcon("minus"));
320 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
321 int hei = calb->sizeHint().height();
322 calb->setMaximumSize( hei*9/10, hei*9/10 );
323 }
324 ++row;
325 kkf = KOPrefs::instance()->mCalendars.next();
326 }
327 lab = new QLabel ( "", mw );
328 mainLayout->addWidget( lab,row,0 );
329 mw->show();
155 330
156} 331}
157void KOCalEditView::addCal() 332void KOCalEditView::addCal()
158{ 333{
159 qDebug("addcal "); 334 qDebug("addcal ");
335 KONewCalPrefs prefs ( this );
336 if ( ! prefs.exec() )
337 return;
338 QString name = prefs.calName();
339 QString file = prefs.calFileName();
340 QFileInfo fi ( file );
341 if (!fi.exists() ) {
342 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
343 return;
344 }
345 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
346 kkf->mName = name;
347 kkf->mFileName = file;
348 emit calendarAdded( kkf->mCalNumber );
349 readConfig();
160} 350}
161void KOCalEditView::enableAll() 351void KOCalEditView::enableAll()
162{ 352{
163 qDebug("enableAll"); 353 toggleList( mEnabledB );
164} 354}
165void KOCalEditView::enableAlarm() 355void KOCalEditView::enableAlarm()
166{ 356{
167 qDebug("enableAlarm"); 357 toggleList( mAlarmB );
168} 358}
169void KOCalEditView::disableRO() 359void KOCalEditView::disableRO()
170{ 360{
171 qDebug("OCalEditView::disableRO() "); 361 toggleList( mROB );
362}
363void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
364{
365 bool dis = false;
366 KOCalCheckButton* it = list.first();
367 while ( it ) {
368 if ( !it->isChecked() ) {
369 dis = true;
370 break;
371 }
372 it = list.next();
373 }
374 it = list.first();
375 while ( it ) {
376 it->setChecked(dis);
377 it = list.next();
378 }
172} 379}
173void KOCalEditView::deleteAll() 380void KOCalEditView::deleteAll()
174{ 381{
175 qDebug("delteAll"); 382 qDebug("delteAll");
176} 383}
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 060108f..aaf0eb6 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -1,133 +1,155 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOFILTERVIEW_H 23#ifndef KOFILTERVIEW_H
24#define KOFILTERVIEW_H 24#define KOFILTERVIEW_H
25 25
26#include <qstring.h> 26#include <qstring.h>
27#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <kconfig.h> 29#include <kconfig.h>
30#include "kofilterview_base.h" 30#include "kofilterview_base.h"
31 31
32#include <libkcal/calfilter.h> 32#include <libkcal/calfilter.h>
33 33
34using namespace KCal; 34class QGridLayout;
35
36class KOFilterView : public KOFilterView_base
37{
38 Q_OBJECT
39 public:
40 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
41 ~KOFilterView();
42
43 void updateFilters();
44
45 bool filtersEnabled();
46 void setFiltersEnabled(bool);
47 CalFilter *selectedFilter();
48 void setSelectedFilter(QString);
49 void setSelectedFilter( int );
50
51 signals:
52 void filterChanged();
53 void editFilters();
54
55 private:
56 QPtrList<CalFilter> *mFilters;
57};
58
59class KOCalEditView : public QWidget
60{
61 Q_OBJECT
62 public:
63 KOCalEditView( QWidget* parent=0,const char* name=0);
64 ~KOCalEditView();
65
66 void readConfig( KConfig *);
67 public slots:
68 void addCal();
69 void enableAll();
70 void enableAlarm();
71 void disableRO();
72 void deleteAll();
73 signals:
74 void alarmEnabled ( int cal, bool enable );
75 void calendarEnabled ( int cal, bool enable );
76 void calendarReadonly ( int cal, bool readonly );
77 void setCalendarDefault ( int cal );
78 void removeCalendar ( int cal );
79
80 private:
81};
82 35
36using namespace KCal;
83class KOCalButton : public QPushButton 37class KOCalButton : public QPushButton
84{ 38{
85 Q_OBJECT 39 Q_OBJECT
86 public: 40 public:
87 KOCalButton( QWidget *parent=0, const char *name=0 ) : 41 KOCalButton( QWidget *parent=0, const char *name=0 ) :
88 QPushButton( parent, name) 42 QPushButton( parent, name)
89 { 43 {
90 connect( this, SIGNAL( clicked() ), 44 connect( this, SIGNAL( clicked() ),
91 SLOT( bottonClicked() )); 45 SLOT( bottonClicked() ));
92 mNumber = -1; 46 mNumber = -1;
93 } 47 }
94 void setNum ( int num ) {mNumber = num; } 48 void setNum ( int num ) {mNumber = num; }
95 signals: 49 signals:
96 void selectNum ( int ); 50 void selectNum ( int );
97private: 51private:
98 int mNumber; 52 int mNumber;
99 void keyPressEvent ( QKeyEvent * e ) 53 void keyPressEvent ( QKeyEvent * e )
100 { 54 {
101 e->ignore(); 55 e->ignore();
102 } 56 }
103 57
104private slots : 58private slots :
105 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } 59 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); }
106}; 60};
107class KOCalCheckButton : public QCheckBox 61class KOCalCheckButton : public QCheckBox
108{ 62{
109 Q_OBJECT 63 Q_OBJECT
110 public: 64 public:
111 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : 65 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) :
112 QCheckBox( parent, name) 66 QCheckBox( parent, name)
113 { 67 {
114 connect( this, SIGNAL( toggled ( bool ) ), 68 connect( this, SIGNAL( toggled ( bool ) ),
115 SLOT( bottonClicked( bool ) )); 69 SLOT( bottonClicked( bool ) ));
116 mNumber = -1; 70 mNumber = -1;
71 //setMaximumWidth( 10 );
72
117 } 73 }
118 void setNum ( int num ) {mNumber = num; } 74 void setNum ( int num ) {mNumber = num; }
119 signals: 75 signals:
120 void selectNum ( int, bool ); 76 void selectNum ( int, bool );
121private: 77private:
122 int mNumber; 78 int mNumber;
123 void keyPressEvent ( QKeyEvent * e ) 79 void keyPressEvent ( QKeyEvent * e )
124 { 80 {
125 e->ignore(); 81 e->ignore();
126 } 82 }
127 83
128private slots : 84private slots :
129 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } 85 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
130}; 86};
131 87
132 88
89
90class KOFilterView : public KOFilterView_base
91{
92 Q_OBJECT
93 public:
94 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
95 ~KOFilterView();
96
97 void updateFilters();
98
99 bool filtersEnabled();
100 void setFiltersEnabled(bool);
101 CalFilter *selectedFilter();
102 void setSelectedFilter(QString);
103 void setSelectedFilter( int );
104
105 signals:
106 void filterChanged();
107 void editFilters();
108
109 private:
110 QPtrList<CalFilter> *mFilters;
111};
112
113class KOCalEditView : public QWidget
114{
115 Q_OBJECT
116 public:
117 KOCalEditView( QWidget* parent=0,const char* name=0);
118 ~KOCalEditView();
119
120 void readConfig();
121 public slots:
122 void addCal();
123 void enableAll();
124 void enableAlarm();
125 void disableRO();
126 void deleteAll();
127 void selectStdCal(int,bool );
128 void selectCal(int,bool );
129 void selectCalAlarm(int,bool );
130 void selectReadOnly(int,bool );
131 void setColor(const QColor &,int) ;
132 void deleteCal(int) ;
133 void infoCal(int) ;
134 signals:
135 void alarmEnabled ( int cal, bool enable );
136 void calendarEnabled ( int cal, bool enable );
137 void calendarReadonly ( int cal, bool readonly );
138 void setCalendarDefault ( int cal );
139 void removeCalendar ( int cal );
140 void calendarAdded( int );
141
142 private:
143 QVBoxLayout* ml;
144 QWidget *mw;
145 void toggleList ( QPtrList<KOCalCheckButton> );
146 QPtrList<KOCalCheckButton> mStdandardB;
147 QPtrList<KOCalCheckButton> mEnabledB;
148 QPtrList<KOCalCheckButton> mAlarmB;
149 QPtrList<KOCalCheckButton> mROB;
150 QGridLayout* mainLayout;
151};
152
153
154
133#endif // KOFILTERVIEW_H 155#endif // KOFILTERVIEW_H
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 179f586..bc6aae4 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,588 +1,591 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 QColor defaultTodoRunColor = QColor(99,194,30); 65 QColor defaultTodoRunColor = QColor(99,194,30);
66 KPrefs::setCurrentGroup("General"); 66 KPrefs::setCurrentGroup("General");
67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
70 addItemBool("ShowIconSearch",&mShowIconSearch,true); 70 addItemBool("ShowIconSearch",&mShowIconSearch,true);
71 addItemBool("ShowIconList",&mShowIconList,true); 71 addItemBool("ShowIconList",&mShowIconList,true);
72 addItemBool("ShowIconDay1",&mShowIconDay1,true); 72 addItemBool("ShowIconDay1",&mShowIconDay1,true);
73 addItemBool("ShowIconDay5",&mShowIconDay5,true); 73 addItemBool("ShowIconDay5",&mShowIconDay5,true);
74 addItemBool("ShowIconDay6",&mShowIconDay6,true); 74 addItemBool("ShowIconDay6",&mShowIconDay6,true);
75 addItemBool("ShowIconDay7",&mShowIconDay7,true); 75 addItemBool("ShowIconDay7",&mShowIconDay7,true);
76 addItemBool("ShowIconMonth",&mShowIconMonth,true); 76 addItemBool("ShowIconMonth",&mShowIconMonth,true);
77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
79 addItemBool("ShowIconBack",&mShowIconBack,true); 79 addItemBool("ShowIconBack",&mShowIconBack,true);
80 addItemBool("ShowIconToday",&mShowIconToday,true); 80 addItemBool("ShowIconToday",&mShowIconToday,true);
81 addItemBool("ShowIconForward",&mShowIconForward,true); 81 addItemBool("ShowIconForward",&mShowIconForward,true);
82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); 84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
86 addItemBool("ShowIconNext",&mShowIconNext,true); 86 addItemBool("ShowIconNext",&mShowIconNext,true);
87 addItemBool("ShowIconJournal",&mShowIconJournal,true); 87 addItemBool("ShowIconJournal",&mShowIconJournal,true);
88 addItemBool("ShowIconStretch",&mShowIconStretch,true); 88 addItemBool("ShowIconStretch",&mShowIconStretch,true);
89 addItemBool("ShowIconFilter",&mShowIconFilter,false); 89 addItemBool("ShowIconFilter",&mShowIconFilter,false);
90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); 90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true);
91 91
92 bool addIcons = false; 92 bool addIcons = false;
93#ifdef DESKTOP_VERSION 93#ifdef DESKTOP_VERSION
94 addIcons = true; 94 addIcons = true;
95#endif 95#endif
96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); 96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons);
97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); 97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons);
98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); 98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons);
99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); 99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons);
100 100
101 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 101 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
102 102
103 addItemBool("AskForQuit",&mAskForQuit,false); 103 addItemBool("AskForQuit",&mAskForQuit,false);
104 104
105#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
106 addItemBool("ShowFullMenu",&mShowFullMenu,false); 106 addItemBool("ShowFullMenu",&mShowFullMenu,false);
107#else 107#else
108 addItemBool("ShowFullMenu",&mShowFullMenu,true); 108 addItemBool("ShowFullMenu",&mShowFullMenu,true);
109#endif 109#endif
110 addItemBool("ToolBarHor",&mToolBarHor, true ); 110 addItemBool("ToolBarHor",&mToolBarHor, true );
111 addItemBool("ToolBarUp",&mToolBarUp, false ); 111 addItemBool("ToolBarUp",&mToolBarUp, false );
112 addItemBool("ToolBarHorV",&mToolBarHorV, true ); 112 addItemBool("ToolBarHorV",&mToolBarHorV, true );
113 addItemBool("ToolBarUpV",&mToolBarUpV, false ); 113 addItemBool("ToolBarUpV",&mToolBarUpV, false );
114 addItemBool("ToolBarHorN",&mToolBarHorN, true ); 114 addItemBool("ToolBarHorN",&mToolBarHorN, true );
115 addItemBool("ToolBarUpN",&mToolBarUpN, false ); 115 addItemBool("ToolBarUpN",&mToolBarUpN, false );
116 addItemBool("ToolBarHorF",&mToolBarHorF, true ); 116 addItemBool("ToolBarHorF",&mToolBarHorF, true );
117 addItemBool("ToolBarUpF",&mToolBarUpF, false ); 117 addItemBool("ToolBarUpF",&mToolBarUpF, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 119 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 121
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); 123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true);
124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
127 addItemInt("AllDay Size",&mAllDaySize,28); 127 addItemInt("AllDay Size",&mAllDaySize,28);
128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
130 130
131 addItemStringList("LocationDefaults",&mLocationDefaults ); 131 addItemStringList("LocationDefaults",&mLocationDefaults );
132 addItemStringList("EventSummary User",&mEventSummaryUser); 132 addItemStringList("EventSummary User",&mEventSummaryUser);
133 addItemStringList("TodoSummary User",&mTodoSummaryUser); 133 addItemStringList("TodoSummary User",&mTodoSummaryUser);
134 134
135 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 135 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
136 addItemBool("Enable Project View",&mEnableProjectView,false); 136 addItemBool("Enable Project View",&mEnableProjectView,false);
137 addItemBool("Auto Save",&mAutoSave,false); 137 addItemBool("Auto Save",&mAutoSave,false);
138 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 138 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
139 addItemBool("Confirm Deletes",&mConfirm,true); 139 addItemBool("Confirm Deletes",&mConfirm,true);
140 addItemString("Archive File",&mArchiveFile); 140 addItemString("Archive File",&mArchiveFile);
141 addItemString("Html Export File",&mHtmlExportFile, 141 addItemString("Html Export File",&mHtmlExportFile,
142 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 142 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
143 addItemBool("Html With Save",&mHtmlWithSave,false); 143 addItemBool("Html With Save",&mHtmlWithSave,false);
144 144
145 KPrefs::setCurrentGroup("Personal Settings"); 145 KPrefs::setCurrentGroup("Personal Settings");
146 146
147 addItemInt("Mail Client",&mMailClient,MailClientKMail); 147 addItemInt("Mail Client",&mMailClient,MailClientKMail);
148 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 148 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
149 addItemBool("Bcc",&mBcc,false); 149 addItemBool("Bcc",&mBcc,false);
150 150
151 KPrefs::setCurrentGroup("Time & Date"); 151 KPrefs::setCurrentGroup("Time & Date");
152 152
153 153
154 addItemInt("Default Start Time",&mStartTime,10); 154 addItemInt("Default Start Time",&mStartTime,10);
155 addItemInt("Default Duration",&mDefaultDuration,2); 155 addItemInt("Default Duration",&mDefaultDuration,2);
156 addItemInt("Default Alarm Time",&mAlarmTime,3); 156 addItemInt("Default Alarm Time",&mAlarmTime,3);
157 KPrefs::setCurrentGroup("AlarmSettings"); 157 KPrefs::setCurrentGroup("AlarmSettings");
158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
162 162
163 163
164 KPrefs::setCurrentGroup("Calendar"); 164 KPrefs::setCurrentGroup("Calendar");
165 165
166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
167 167
168 KPrefs::setCurrentGroup("Fonts"); 168 KPrefs::setCurrentGroup("Fonts");
169 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 169 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
170 QFont fon = KGlobalSettings::generalFont(); 170 QFont fon = KGlobalSettings::generalFont();
171 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 171 addItemFont("TimeBar Font",&mTimeBarFont,fon );
172 addItemFont("MonthView Font",&mMonthViewFont,fon); 172 addItemFont("MonthView Font",&mMonthViewFont,fon);
173 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 173 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
174 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 174 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
175 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 175 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
176 addItemFont("TodoView Font",&mTodoViewFont,fon); 176 addItemFont("TodoView Font",&mTodoViewFont,fon);
177 addItemFont("ListView Font",&mListViewFont,fon); 177 addItemFont("ListView Font",&mListViewFont,fon);
178 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 178 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
179 addItemFont("EditBox Font",&mEditBoxFont,fon); 179 addItemFont("EditBox Font",&mEditBoxFont,fon);
180 addItemFont("JournalView Font",&mJornalViewFont,fon); 180 addItemFont("JournalView Font",&mJornalViewFont,fon);
181 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 181 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
182 addItemFont("EventView Font",&mEventViewFont,fon); 182 addItemFont("EventView Font",&mEventViewFont,fon);
183 183
184 KPrefs::setCurrentGroup("RemoteSyncing"); 184 KPrefs::setCurrentGroup("RemoteSyncing");
185 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 185 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
186 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 186 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
187 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 187 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
188 addItemInt("LastSyncTime",&mLastSyncTime,0); 188 addItemInt("LastSyncTime",&mLastSyncTime,0);
189 189
190#ifdef _WIN32_ 190#ifdef _WIN32_
191 QString hdp= locateLocal("data","korganizer")+"\\\\"; 191 QString hdp= locateLocal("data","korganizer")+"\\\\";
192#else 192#else
193 QString hdp= locateLocal("data","korganizer")+"/"; 193 QString hdp= locateLocal("data","korganizer")+"/";
194#endif 194#endif
195 195
196 KPrefs::setCurrentGroup("LoadSaveFileNames"); 196 KPrefs::setCurrentGroup("LoadSaveFileNames");
197 197
198 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 198 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
199 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 199 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
200 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 200 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
201 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 201 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
202 202
203 203
204 KPrefs::setCurrentGroup("Locale"); 204 KPrefs::setCurrentGroup("Locale");
205 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 205 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
206 206
207 207
208 KPrefs::setCurrentGroup("Colors"); 208 KPrefs::setCurrentGroup("Colors");
209 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 209 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
210 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 210 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
211 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 211 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
212 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 212 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
213 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 213 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
214 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 214 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
215 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 215 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
216 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 216 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
217 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 217 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
218 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 218 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
219 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 219 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
220 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 220 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
221 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 221 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
222 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 222 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
223 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 223 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
224 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 224 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
225 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 225 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
226 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 226 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
227 addItemBool("UseAppColors",&mUseAppColors,false); 227 addItemBool("UseAppColors",&mUseAppColors,false);
228 228
229 229
230 230
231 KPrefs::setCurrentGroup("Views"); 231 KPrefs::setCurrentGroup("Views");
232 addItemBool("Block Popup Menu",&mBlockPopupMenu,true); 232 addItemBool("Block Popup Menu",&mBlockPopupMenu,true);
233 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 233 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
234 addItemInt("Hour Size",&mHourSize,8); 234 addItemInt("Hour Size",&mHourSize,8);
235 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 235 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
236 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 236 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
237 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 237 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
238 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 238 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
239 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 239 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
240 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 240 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
241 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); 241 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
242#ifdef DESKTOP_VERION 242#ifdef DESKTOP_VERION
243 addItemBool("Enable ToolTips",&mEnableToolTips,true); 243 addItemBool("Enable ToolTips",&mEnableToolTips,true);
244#else 244#else
245 addItemBool("Enable ToolTips",&mEnableToolTips,false); 245 addItemBool("Enable ToolTips",&mEnableToolTips,false);
246#endif 246#endif
247 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 247 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
248 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 248 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
249 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 249 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
250 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 250 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
251 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 251 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
252 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 252 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
253 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 253 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
254 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 254 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
255 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 255 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
256 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 256 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
257 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 257 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
258 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 258 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
259 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 259 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
260 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 260 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
261 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 261 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
262 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 262 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
263 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 263 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
264 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 264 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
265 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 265 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
266 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 266 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
267#ifdef DESKTOP_VERSION 267#ifdef DESKTOP_VERSION
268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
269#else 269#else
270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
271#endif 271#endif
272 addItemInt("Day Begins",&mDayBegins,7); 272 addItemInt("Day Begins",&mDayBegins,7);
273 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 273 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
274 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 274 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
275 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 275 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
276 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 276 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
277 277
278 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 278 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
279 addItemBool("Full View Month",&mFullViewMonth,true); 279 addItemBool("Full View Month",&mFullViewMonth,true);
280 addItemBool("Full View Todo",&mFullViewTodo,true); 280 addItemBool("Full View Todo",&mFullViewTodo,true);
281 addItemBool("Quick Todo",&mEnableQuickTodo,false); 281 addItemBool("Quick Todo",&mEnableQuickTodo,false);
282 282
283 addItemInt("Next X Days",&mNextXDays,3); 283 addItemInt("Next X Days",&mNextXDays,3);
284 284
285 KPrefs::setCurrentGroup("Printer"); 285 KPrefs::setCurrentGroup("Printer");
286 286
287 KPrefs::setCurrentGroup("Layout"); 287 KPrefs::setCurrentGroup("Layout");
288 288
289 addItemBool("CompactDialogs",&mCompactDialogs,false); 289 addItemBool("CompactDialogs",&mCompactDialogs,false);
290 addItemBool("VerticalScreen",&mVerticalScreen,true); 290 addItemBool("VerticalScreen",&mVerticalScreen,true);
291 291
292 KPrefs::setCurrentGroup("KOrganizer Plugins"); 292 KPrefs::setCurrentGroup("KOrganizer Plugins");
293 293
294 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 294 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
295 295
296 KPrefs::setCurrentGroup("Group Scheduling"); 296 KPrefs::setCurrentGroup("Group Scheduling");
297 297
298 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 298 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
299 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 299 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
300 addItemStringList("AdditionalMails",&mAdditionalMails,""); 300 addItemStringList("AdditionalMails",&mAdditionalMails,"");
301 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 301 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
302 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 302 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
303 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 303 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
304 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 304 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
305 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 305 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
306 306
307 KPrefs::setCurrentGroup( "Editors" ); 307 KPrefs::setCurrentGroup( "Editors" );
308 308
309 addItemStringList( "EventTemplates", &mEventTemplates ); 309 addItemStringList( "EventTemplates", &mEventTemplates );
310 addItemStringList( "TodoTemplates", &mTodoTemplates ); 310 addItemStringList( "TodoTemplates", &mTodoTemplates );
311 311
312 addItemInt("DestinationPolicy",&mDestination,standardDestination); 312 addItemInt("DestinationPolicy",&mDestination,standardDestination);
313 313
314 KPrefs::setCurrentGroup( "ViewOptions" ); 314 KPrefs::setCurrentGroup( "ViewOptions" );
315 addItemBool("EVshowDetails",&mEVshowDetails,true); 315 addItemBool("EVshowDetails",&mEVshowDetails,true);
316 addItemBool("EVshowCreated",&mEVshowCreated,true); 316 addItemBool("EVshowCreated",&mEVshowCreated,true);
317 addItemBool("EVshowChanged",&mEVshowChanged,true); 317 addItemBool("EVshowChanged",&mEVshowChanged,true);
318 addItemBool("WTshowDetails",&mWTshowDetails,false); 318 addItemBool("WTshowDetails",&mWTshowDetails,false);
319 addItemBool("WTshowCreated",&mWTshowCreated,false); 319 addItemBool("WTshowCreated",&mWTshowCreated,false);
320 addItemBool("WTshowChanged",&mWTshowChanged,false); 320 addItemBool("WTshowChanged",&mWTshowChanged,false);
321 mCalendars.setAutoDelete( true ); 321 mCalendars.setAutoDelete( true );
322} 322}
323 323
324 324
325KOPrefs::~KOPrefs() 325KOPrefs::~KOPrefs()
326{ 326{
327 if (mInstance == this) 327 if (mInstance == this)
328 mInstance = insd.setObject(0); 328 mInstance = insd.setObject(0);
329 mCalendars.setAutoDelete( true ); 329 mCalendars.setAutoDelete( true );
330 mCalendars.clear(); 330 mCalendars.clear();
331 //qDebug("KOPrefs::~KOPrefs() "); 331 //qDebug("KOPrefs::~KOPrefs() ");
332} 332}
333 333
334 334
335KOPrefs *KOPrefs::instance() 335KOPrefs *KOPrefs::instance()
336{ 336{
337 if (!mInstance) { 337 if (!mInstance) {
338 mInstance = insd.setObject(new KOPrefs()); 338 mInstance = insd.setObject(new KOPrefs());
339 mInstance->readConfig(); 339 mInstance->readConfig();
340 } 340 }
341 341
342 return mInstance; 342 return mInstance;
343} 343}
344 344
345void KOPrefs::usrSetDefaults() 345void KOPrefs::usrSetDefaults()
346{ 346{
347 347
348} 348}
349 349
350void KOPrefs::fillMailDefaults() 350void KOPrefs::fillMailDefaults()
351{ 351{
352 if (mName.isEmpty()) mName = i18n("Anonymous"); 352 if (mName.isEmpty()) mName = i18n("Anonymous");
353 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 353 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
354} 354}
355 355
356void KOPrefs::setTimeZoneIdDefault() 356void KOPrefs::setTimeZoneIdDefault()
357{ 357{
358 ; 358 ;
359} 359}
360 360
361void KOPrefs::setAllDefaults() 361void KOPrefs::setAllDefaults()
362{ 362{
363 setCategoryDefaults(); 363 setCategoryDefaults();
364 mEventSummaryUser = getDefaultList() ; 364 mEventSummaryUser = getDefaultList() ;
365 mTodoSummaryUser = getDefaultList() ; 365 mTodoSummaryUser = getDefaultList() ;
366 mLocationDefaults = getLocationDefaultList(); 366 mLocationDefaults = getLocationDefaultList();
367} 367}
368 368
369void KOPrefs::setCategoryDefaults() 369void KOPrefs::setCategoryDefaults()
370{ 370{
371 mCustomCategories.clear(); 371 mCustomCategories.clear();
372 mCustomCategories = getDefaultList(); 372 mCustomCategories = getDefaultList();
373 373
374 QStringList::Iterator it; 374 QStringList::Iterator it;
375 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 375 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
376 setCategoryColor(*it,mDefaultCategoryColor); 376 setCategoryColor(*it,mDefaultCategoryColor);
377 } 377 }
378} 378}
379QStringList KOPrefs::getLocationDefaultList() 379QStringList KOPrefs::getLocationDefaultList()
380{ 380{
381 QStringList retval ; 381 QStringList retval ;
382 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 382 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
383 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 383 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
384 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 384 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
385 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 385 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
386 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 386 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
387 387
388 retval.sort(); 388 retval.sort();
389 return retval; 389 return retval;
390} 390}
391QStringList KOPrefs::getDefaultList() 391QStringList KOPrefs::getDefaultList()
392{ 392{
393 QStringList retval ; 393 QStringList retval ;
394 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 394 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
395 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 395 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
396 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 396 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
397 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 397 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
398 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 398 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
399 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 399 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
400 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 400 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
401 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 401 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
402 retval.sort(); 402 retval.sort();
403 //qDebug("cat %s ", retval.join("-").latin1()); 403 //qDebug("cat %s ", retval.join("-").latin1());
404 return retval; 404 return retval;
405} 405}
406 406
407void KOPrefs::usrReadConfig() 407void KOPrefs::usrReadConfig()
408{ 408{
409 config()->setGroup("General"); 409 config()->setGroup("General");
410 410
411 //qDebug("KOPrefs::usrReadConfig() "); 411 //qDebug("KOPrefs::usrReadConfig() ");
412 mCustomCategories = config()->readListEntry("Custom Categories"); 412 mCustomCategories = config()->readListEntry("Custom Categories");
413 mOldLoadedLanguage = mOldLanguage ; 413 mOldLoadedLanguage = mOldLanguage ;
414 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 414 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
415 if (mLocationDefaults.isEmpty()) { 415 if (mLocationDefaults.isEmpty()) {
416 mLocationDefaults = getLocationDefaultList(); 416 mLocationDefaults = getLocationDefaultList();
417 } 417 }
418 418
419 if (mEventSummaryUser.isEmpty()) { 419 if (mEventSummaryUser.isEmpty()) {
420 mEventSummaryUser = getDefaultList() ; 420 mEventSummaryUser = getDefaultList() ;
421 } 421 }
422 if (mTodoSummaryUser.isEmpty()) { 422 if (mTodoSummaryUser.isEmpty()) {
423 mTodoSummaryUser = getDefaultList() ; 423 mTodoSummaryUser = getDefaultList() ;
424 } 424 }
425 425
426 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 426 if (mCustomCategories.isEmpty()) setCategoryDefaults();
427 427
428 config()->setGroup("Personal Settings"); 428 config()->setGroup("Personal Settings");
429 mName = config()->readEntry("user_name",""); 429 mName = config()->readEntry("user_name","");
430 mEmail = config()->readEntry("user_email",""); 430 mEmail = config()->readEntry("user_email","");
431 fillMailDefaults(); 431 fillMailDefaults();
432 432
433 config()->setGroup("Category Colors"); 433 config()->setGroup("Category Colors");
434 QStringList::Iterator it; 434 QStringList::Iterator it;
435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
437 437
438 } 438 }
439 config()->setGroup("CCal"); 439 config()->setGroup("CCal");
440 int numCals = config()->readNumEntry("NumberCalendars",0 ); 440 int numCals = config()->readNumEntry("NumberCalendars",0 );
441 mNextAvailableCalendar = 1; 441 mNextAvailableCalendar = 1;
442 if ( numCals == 0 ) { 442 if ( numCals == 0 ) {
443 KopiCalendarFile *kkf = getNewCalendar(); 443 KopiCalendarFile *kkf = getNewCalendar();
444 kkf->isStandard = true; 444 kkf->isStandard = true;
445 kkf->mName = i18n("Standard Calendar"); 445 kkf->mName = i18n("Standard");
446 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 446 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
447 } 447 }
448 while ( mNextAvailableCalendar <= numCals ) { 448 while ( mNextAvailableCalendar <= numCals ) {
449 qDebug("Read cal #%d ", mNextAvailableCalendar ); 449 qDebug("Read cal #%d ", mNextAvailableCalendar );
450 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 450 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
451 KopiCalendarFile *kkf = getNewCalendar(); 451 KopiCalendarFile *kkf = getNewCalendar();
452 kkf->isStandard = config()->readBoolEntry( prefix+"_isStandard", false ); 452 kkf->isStandard = config()->readBoolEntry( prefix+"_isStandard", false );
453 kkf->isEnabled = config()->readBoolEntry( prefix+"_isEnabled", true); 453 kkf->isEnabled = config()->readBoolEntry( prefix+"_isEnabled", true);
454 kkf->isAlarmEnabled = config()->readBoolEntry( prefix+"_isAlarmEnabled", true); 454 kkf->isAlarmEnabled = config()->readBoolEntry( prefix+"_isAlarmEnabled", true);
455 kkf->isReadOnly = config()->readBoolEntry( prefix+"_isReadOnly", false); 455 kkf->isReadOnly = config()->readBoolEntry( prefix+"_isReadOnly", false);
456 kkf->mName = config()->readEntry( prefix+"_Name", "Calendar"); 456 kkf->mName = config()->readEntry( prefix+"_Name", "Calendar");
457 kkf->mFileName = config()->readEntry( prefix+"_FileName", kkf->mFileName); 457 kkf->mFileName = config()->readEntry( prefix+"_FileName", kkf->mFileName);
458 kkf->mDefaultColor = config()->readColorEntry( prefix+"_Color",&mEventColor); 458 kkf->mDefaultColor = config()->readColorEntry( prefix+"_Color",&mEventColor);
459 if ( kkf->mCalNumber == 1 ) { 459 if ( kkf->mCalNumber == 1 ) {
460 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 460 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
461 //kkf->mName = i18n("Standard Calendar");
462 } 461 }
463 } 462 }
464 463
465 KPimPrefs::usrReadConfig(); 464 KPimPrefs::usrReadConfig();
466} 465}
467 466
467KopiCalendarFile * KOPrefs::getCalendar( int num )
468{
469 return mDefCalColors[num-1];
470}
468 471
469KopiCalendarFile * KOPrefs::getNewCalendar() 472KopiCalendarFile * KOPrefs::getNewCalendar()
470{ 473{
471 KopiCalendarFile * kkf = new KopiCalendarFile(); 474 KopiCalendarFile * kkf = new KopiCalendarFile();
472 kkf->mCalNumber = mNextAvailableCalendar; 475 kkf->mCalNumber = mNextAvailableCalendar;
473 mDefCalColors.resize( mNextAvailableCalendar ); 476 mDefCalColors.resize( mNextAvailableCalendar );
474 mDefCalColors[mNextAvailableCalendar-1] = kkf; 477 mDefCalColors[mNextAvailableCalendar-1] = kkf;
475 ++mNextAvailableCalendar; 478 ++mNextAvailableCalendar;
476 kkf->mDefaultColor = mEventColor; 479 kkf->mDefaultColor = mEventColor;
477 kkf->mName = i18n("New Calendar"); 480 kkf->mName = i18n("New Calendar");
478 mCalendars.append( kkf ); 481 mCalendars.append( kkf );
479 return kkf; 482 return kkf;
480} 483}
481void KOPrefs::deleteCalendar( int num ) 484void KOPrefs::deleteCalendar( int num )
482{ 485{
483 KopiCalendarFile * kkf = mCalendars.first(); 486 KopiCalendarFile * kkf = mCalendars.first();
484 while ( kkf ) { 487 while ( kkf ) {
485 if ( kkf->mCalNumber == num ) { 488 if ( kkf->mCalNumber == num ) {
486 qDebug("KOPrefs::deleteCalendar %d ", num ); 489 qDebug("KOPrefs::deleteCalendar %d ", num );
487 mCalendars.remove( kkf ); 490 mCalendars.remove( kkf );
488 delete kkf; 491 delete kkf;
489 return; 492 return;
490 } 493 }
491 kkf = mCalendars.next(); 494 kkf = mCalendars.next();
492 } 495 }
493} 496}
494QColor KOPrefs::defaultColor( int calNum ) const 497QColor KOPrefs::defaultColor( int calNum ) const
495{ 498{
496 return (mDefCalColors[calNum-1])->mDefaultColor; 499 return (mDefCalColors[calNum-1])->mDefaultColor;
497} 500}
498void KOPrefs::usrWriteConfig() 501void KOPrefs::usrWriteConfig()
499{ 502{
500 config()->setGroup("General"); 503 config()->setGroup("General");
501 config()->writeEntry("Custom Categories",mCustomCategories); 504 config()->writeEntry("Custom Categories",mCustomCategories);
502 505
503 config()->setGroup("Personal Settings"); 506 config()->setGroup("Personal Settings");
504 config()->writeEntry("user_name",mName); 507 config()->writeEntry("user_name",mName);
505 config()->writeEntry("user_email",mEmail); 508 config()->writeEntry("user_email",mEmail);
506 509
507 config()->setGroup("Category Colors"); 510 config()->setGroup("Category Colors");
508 QDictIterator<QColor> it(mCategoryColors); 511 QDictIterator<QColor> it(mCategoryColors);
509 while (it.current()) { 512 while (it.current()) {
510 config()->writeEntry(it.currentKey(),*(it.current())); 513 config()->writeEntry(it.currentKey(),*(it.current()));
511 ++it; 514 ++it;
512 } 515 }
513 config()->setGroup("CCal"); 516 config()->setGroup("CCal");
514 config()->writeEntry("NumberCalendars",mCalendars.count()); 517 config()->writeEntry("NumberCalendars",mCalendars.count());
515 int numCal = 1; 518 int numCal = 1;
516 int writeCal = 0; 519 int writeCal = 0;
517 while ( numCal < mNextAvailableCalendar ) { 520 while ( numCal < mNextAvailableCalendar ) {
518 KopiCalendarFile * kkf = mCalendars.first(); 521 KopiCalendarFile * kkf = mCalendars.first();
519 while ( kkf ) { 522 while ( kkf ) {
520 qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 523 qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
521 if ( kkf->mCalNumber == numCal ) { 524 if ( kkf->mCalNumber == numCal ) {
522 ++writeCal; 525 ++writeCal;
523 qDebug("Write calendar %d %d ", numCal , writeCal); 526 qDebug("Write calendar %d %d ", numCal , writeCal);
524 QString prefix = "Cal_" + QString::number( writeCal ); 527 QString prefix = "Cal_" + QString::number( writeCal );
525 config()->writeEntry( prefix+"_isStandard", kkf->isStandard ); 528 config()->writeEntry( prefix+"_isStandard", kkf->isStandard );
526 config()->writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 529 config()->writeEntry( prefix+"_isEnabled", kkf->isEnabled );
527 config()->writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 530 config()->writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
528 config()->writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 531 config()->writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
529 config()->writeEntry( prefix+"_Name", kkf->mName); 532 config()->writeEntry( prefix+"_Name", kkf->mName);
530 config()->writeEntry( prefix+"_FileName", kkf->mFileName); 533 config()->writeEntry( prefix+"_FileName", kkf->mFileName);
531 config()->writeEntry( prefix+"_Color",kkf->mDefaultColor); 534 config()->writeEntry( prefix+"_Color",kkf->mDefaultColor);
532 } 535 }
533 kkf = mCalendars.next(); 536 kkf = mCalendars.next();
534 } 537 }
535 ++numCal; 538 ++numCal;
536 } 539 }
537 KPimPrefs::usrWriteConfig(); 540 KPimPrefs::usrWriteConfig();
538} 541}
539 542
540void KOPrefs::setCategoryColor(QString cat,const QColor & color) 543void KOPrefs::setCategoryColor(QString cat,const QColor & color)
541{ 544{
542 mCategoryColors.replace(cat,new QColor(color)); 545 mCategoryColors.replace(cat,new QColor(color));
543} 546}
544 547
545QColor *KOPrefs::categoryColor(QString cat) 548QColor *KOPrefs::categoryColor(QString cat)
546{ 549{
547 QColor *color = 0; 550 QColor *color = 0;
548 551
549 if (!cat.isEmpty()) color = mCategoryColors[cat]; 552 if (!cat.isEmpty()) color = mCategoryColors[cat];
550 553
551 if (color) return color; 554 if (color) return color;
552 else return &mDefaultCategoryColor; 555 else return &mDefaultCategoryColor;
553} 556}
554 557
555void KOPrefs::setFullName(const QString &name) 558void KOPrefs::setFullName(const QString &name)
556{ 559{
557 mName = name; 560 mName = name;
558} 561}
559 562
560void KOPrefs::setEmail(const QString &email) 563void KOPrefs::setEmail(const QString &email)
561{ 564{
562 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 565 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
563 mEmail = email; 566 mEmail = email;
564} 567}
565 568
566QString KOPrefs::fullName() 569QString KOPrefs::fullName()
567{ 570{
568 if (mEmailControlCenter) { 571 if (mEmailControlCenter) {
569 KEMailSettings settings; 572 KEMailSettings settings;
570 return settings.getSetting(KEMailSettings::RealName); 573 return settings.getSetting(KEMailSettings::RealName);
571 } else { 574 } else {
572 return mName; 575 return mName;
573 } 576 }
574} 577}
575 578
576QString KOPrefs::email() 579QString KOPrefs::email()
577{ 580{
578 if (mEmailControlCenter) { 581 if (mEmailControlCenter) {
579 KEMailSettings settings; 582 KEMailSettings settings;
580 return settings.getSetting(KEMailSettings::EmailAddress); 583 return settings.getSetting(KEMailSettings::EmailAddress);
581 } else { 584 } else {
582 return mEmail; 585 return mEmail;
583 } 586 }
584} 587}
585KConfig* KOPrefs::getConfig() 588KConfig* KOPrefs::getConfig()
586{ 589{
587 return config(); 590 return config();
588} 591}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 7d71cbd..f114d88 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,351 +1,352 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <qdict.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qobject.h> 30#include <qobject.h>
31 31
32class KConfig; 32class KConfig;
33class QFont; 33class QFont;
34class QColor; 34class QColor;
35class QStringList; 35class QStringList;
36 36
37#define VIEW_WN_VIEW 1 37#define VIEW_WN_VIEW 1
38#define VIEW_NX_VIEW 2 38#define VIEW_NX_VIEW 2
39#define VIEW_J_VIEW 3 39#define VIEW_J_VIEW 3
40#define VIEW_A_VIEW 4 40#define VIEW_A_VIEW 4
41#define VIEW_ML_VIEW 5 41#define VIEW_ML_VIEW 5
42#define VIEW_M_VIEW 6 42#define VIEW_M_VIEW 6
43#define VIEW_L_VIEW 7 43#define VIEW_L_VIEW 7
44#define VIEW_T_VIEW 8 44#define VIEW_T_VIEW 8
45 45
46class KopiCalendarFile : public QObject 46class KopiCalendarFile : public QObject
47{ 47{
48 public: 48 public:
49 KopiCalendarFile( ) : QObject( ) 49 KopiCalendarFile( ) : QObject( )
50 { 50 {
51 isStandard = false; 51 isStandard = false;
52 isEnabled = true; 52 isEnabled = true;
53 isAlarmEnabled = true; 53 isAlarmEnabled = true;
54 isReadOnly = false; 54 isReadOnly = false;
55 mName = "Calendar"; 55 mName = "Calendar";
56 mFileName = QDir::homeDirPath() + "/icalfile.ics"; 56 mFileName = QDir::homeDirPath() + "/icalfile.ics";
57 mCalNumber = 0; 57 mCalNumber = 0;
58 mDefaultColor = Qt::red; 58 mDefaultColor = Qt::red;
59 } 59 }
60 bool isStandard; 60 bool isStandard;
61 bool isEnabled; 61 bool isEnabled;
62 bool isAlarmEnabled; 62 bool isAlarmEnabled;
63 bool isReadOnly; 63 bool isReadOnly;
64 QString mName; 64 QString mName;
65 QString mFileName; 65 QString mFileName;
66 int mCalNumber; 66 int mCalNumber;
67 QColor mDefaultColor; 67 QColor mDefaultColor;
68}; 68};
69class KOPrefs : public KPimPrefs 69class KOPrefs : public KPimPrefs
70{ 70{
71 public: 71 public:
72 enum { FormatVCalendar, FormatICalendar }; 72 enum { FormatVCalendar, FormatICalendar };
73 enum { MailClientKMail, MailClientSendmail }; 73 enum { MailClientKMail, MailClientSendmail };
74 enum { IMIPDummy, IMIPKMail }; 74 enum { IMIPDummy, IMIPKMail };
75 enum { IMIPOutbox, IMIPdirectsend }; 75 enum { IMIPOutbox, IMIPdirectsend };
76 enum { neverAuto, addressbookAuto, selectedAuto }; 76 enum { neverAuto, addressbookAuto, selectedAuto };
77 enum { standardDestination, askDestination }; 77 enum { standardDestination, askDestination };
78 78
79 virtual ~KOPrefs(); 79 virtual ~KOPrefs();
80 80
81 /** Get instance of KOPrefs. It is made sure that there is only one 81 /** Get instance of KOPrefs. It is made sure that there is only one
82 instance. */ 82 instance. */
83 static KOPrefs *instance(); 83 static KOPrefs *instance();
84 84
85 /** Set preferences to default values */ 85 /** Set preferences to default values */
86 void usrSetDefaults(); 86 void usrSetDefaults();
87 87
88 /** Read preferences from config file */ 88 /** Read preferences from config file */
89 void usrReadConfig(); 89 void usrReadConfig();
90 90
91 /** Write preferences to config file */ 91 /** Write preferences to config file */
92 void usrWriteConfig(); 92 void usrWriteConfig();
93 void setCategoryDefaults(); 93 void setCategoryDefaults();
94 void setAllDefaults(); 94 void setAllDefaults();
95 KopiCalendarFile * getNewCalendar(); 95 KopiCalendarFile * getNewCalendar();
96 KopiCalendarFile * getCalendar( int );
96 void deleteCalendar( int ); 97 void deleteCalendar( int );
97 QColor defaultColor( int ) const; 98 QColor defaultColor( int ) const;
98 protected: 99 protected:
99 void setTimeZoneIdDefault(); 100 void setTimeZoneIdDefault();
100 101
101 /** Fill empty mail fields with default values. */ 102 /** Fill empty mail fields with default values. */
102 void fillMailDefaults(); 103 void fillMailDefaults();
103 104
104 private: 105 private:
105 /** Constructor disabled for public. Use instance() to create a KOPrefs 106 /** Constructor disabled for public. Use instance() to create a KOPrefs
106 object. */ 107 object. */
107 KOPrefs(); 108 KOPrefs();
108 109
109 static KOPrefs *mInstance; 110 static KOPrefs *mInstance;
110 QStringList getDefaultList(); 111 QStringList getDefaultList();
111 QStringList getLocationDefaultList(); 112 QStringList getLocationDefaultList();
112 public: 113 public:
113 // preferences data 114 // preferences data
114 KConfig* getConfig(); 115 KConfig* getConfig();
115 void setFullName(const QString &); 116 void setFullName(const QString &);
116 QString fullName(); 117 QString fullName();
117 void setEmail(const QString &); 118 void setEmail(const QString &);
118 QString email(); 119 QString email();
119 120
120 QString mAdditional; 121 QString mAdditional;
121 122
122 bool mEmailControlCenter; 123 bool mEmailControlCenter;
123 124
124 bool mBcc; 125 bool mBcc;
125 bool mAutoSave; 126 bool mAutoSave;
126 int mAutoSaveInterval; 127 int mAutoSaveInterval;
127 bool mConfirm; 128 bool mConfirm;
128 129
129 bool mEnableGroupScheduling; 130 bool mEnableGroupScheduling;
130 bool mEnableProjectView; 131 bool mEnableProjectView;
131 132
132 int mDefaultFormat; 133 int mDefaultFormat;
133 int mMailClient; 134 int mMailClient;
134 135
135 int mStartTime; 136 int mStartTime;
136 int mDefaultDuration; 137 int mDefaultDuration;
137 int mAlarmTime; 138 int mAlarmTime;
138 139
139 int mWorkingHoursStart; 140 int mWorkingHoursStart;
140 int mWorkingHoursEnd; 141 int mWorkingHoursEnd;
141 bool mExcludeHolidays; 142 bool mExcludeHolidays;
142 bool mExcludeSaturdays; 143 bool mExcludeSaturdays;
143 bool mMarcusBainsShowSeconds; 144 bool mMarcusBainsShowSeconds;
144 145
145 QFont mTimeBarFont; 146 QFont mTimeBarFont;
146 QFont mMonthViewFont; 147 QFont mMonthViewFont;
147 QFont mAgendaViewFont; 148 QFont mAgendaViewFont;
148 QFont mMarcusBainsFont; 149 QFont mMarcusBainsFont;
149 QFont mTimeLabelsFont; 150 QFont mTimeLabelsFont;
150 QFont mTodoViewFont; 151 QFont mTodoViewFont;
151 QFont mListViewFont; 152 QFont mListViewFont;
152 QFont mDateNavigatorFont; 153 QFont mDateNavigatorFont;
153 QFont mEditBoxFont; 154 QFont mEditBoxFont;
154 QFont mJornalViewFont; 155 QFont mJornalViewFont;
155 QFont mWhatsNextFont; 156 QFont mWhatsNextFont;
156 QFont mEventViewFont; 157 QFont mEventViewFont;
157 158
158 159
159 160
160 161
161 QColor mHolidayColor; 162 QColor mHolidayColor;
162 QColor mHighlightColor; 163 QColor mHighlightColor;
163 QColor mEventColor; 164 QColor mEventColor;
164 QColor mTodoDoneColor; 165 QColor mTodoDoneColor;
165 QColor mAgendaBgColor; 166 QColor mAgendaBgColor;
166 QColor mWorkingHoursColor; 167 QColor mWorkingHoursColor;
167 QColor mTodoDueTodayColor; 168 QColor mTodoDueTodayColor;
168 QColor mTodoOverdueColor; 169 QColor mTodoOverdueColor;
169 QColor mTodoRunColor; 170 QColor mTodoRunColor;
170 QColor mMonthViewEvenColor; 171 QColor mMonthViewEvenColor;
171 QColor mMonthViewOddColor; 172 QColor mMonthViewOddColor;
172 QColor mMonthViewHolidayColor; 173 QColor mMonthViewHolidayColor;
173 bool mMonthViewUsesDayColors; 174 bool mMonthViewUsesDayColors;
174 bool mMonthViewSatSunTog; 175 bool mMonthViewSatSunTog;
175 bool mMonthViewWeek; 176 bool mMonthViewWeek;
176 QColor mAppColor1; 177 QColor mAppColor1;
177 QColor mAppColor2; 178 QColor mAppColor2;
178 bool mUseAppColors; 179 bool mUseAppColors;
179 180
180 int mDayBegins; 181 int mDayBegins;
181 int mHourSize; 182 int mHourSize;
182 int mAllDaySize; 183 int mAllDaySize;
183 bool mShowFullMenu; 184 bool mShowFullMenu;
184 bool mDailyRecur; 185 bool mDailyRecur;
185 bool mWeeklyRecur; 186 bool mWeeklyRecur;
186 bool mMonthDailyRecur; 187 bool mMonthDailyRecur;
187 bool mMonthWeeklyRecur; 188 bool mMonthWeeklyRecur;
188 bool mMonthShowIcons; 189 bool mMonthShowIcons;
189 bool mMonthShowTimes; 190 bool mMonthShowTimes;
190 bool mMonthShowShort; 191 bool mMonthShowShort;
191 bool mEnableToolTips; 192 bool mEnableToolTips;
192 bool mEnableMonthScroll; 193 bool mEnableMonthScroll;
193 bool mFullViewMonth; 194 bool mFullViewMonth;
194 bool mMonthViewUsesCategoryColor; 195 bool mMonthViewUsesCategoryColor;
195 bool mFullViewTodo; 196 bool mFullViewTodo;
196 bool mShowCompletedTodo; 197 bool mShowCompletedTodo;
197 bool mMarcusBainsEnabled; 198 bool mMarcusBainsEnabled;
198 int mNextXDays; 199 int mNextXDays;
199 int mWhatsNextDays; 200 int mWhatsNextDays;
200 int mWhatsNextPrios; 201 int mWhatsNextPrios;
201 bool mEnableQuickTodo; 202 bool mEnableQuickTodo;
202 203
203 bool mCompactDialogs; 204 bool mCompactDialogs;
204 bool mVerticalScreen; 205 bool mVerticalScreen;
205 206
206 bool mShowIconNewTodo; 207 bool mShowIconNewTodo;
207 bool mShowIconNewEvent; 208 bool mShowIconNewEvent;
208 bool mShowIconSearch; 209 bool mShowIconSearch;
209 bool mShowIconList; 210 bool mShowIconList;
210 bool mShowIconDay1; 211 bool mShowIconDay1;
211 bool mShowIconDay5; 212 bool mShowIconDay5;
212 bool mShowIconDay6; 213 bool mShowIconDay6;
213 bool mShowIconDay7; 214 bool mShowIconDay7;
214 bool mShowIconMonth; 215 bool mShowIconMonth;
215 bool mShowIconTodoview; 216 bool mShowIconTodoview;
216 bool mShowIconBackFast; 217 bool mShowIconBackFast;
217 bool mShowIconBack; 218 bool mShowIconBack;
218 bool mShowIconToday; 219 bool mShowIconToday;
219 bool mShowIconForward; 220 bool mShowIconForward;
220 bool mShowIconForwardFast; 221 bool mShowIconForwardFast;
221 bool mShowIconWhatsThis; 222 bool mShowIconWhatsThis;
222 bool mShowIconWeekNum; 223 bool mShowIconWeekNum;
223 bool mShowIconNextDays; 224 bool mShowIconNextDays;
224 bool mShowIconNext; 225 bool mShowIconNext;
225 bool mShowIconJournal; 226 bool mShowIconJournal;
226 bool mShowIconFilter; 227 bool mShowIconFilter;
227 bool mShowIconOnetoolbar; 228 bool mShowIconOnetoolbar;
228 bool mShowIconNavigator; 229 bool mShowIconNavigator;
229 bool mShowIconAllday; 230 bool mShowIconAllday;
230 bool mShowIconFilterview; 231 bool mShowIconFilterview;
231 bool mShowIconToggleFull; 232 bool mShowIconToggleFull;
232 233
233 bool mShowIconStretch; 234 bool mShowIconStretch;
234 235
235 bool mToolBarHor; 236 bool mToolBarHor;
236 bool mToolBarUp; 237 bool mToolBarUp;
237 bool mToolBarHorV; 238 bool mToolBarHorV;
238 bool mToolBarUpV; 239 bool mToolBarUpV;
239 bool mToolBarHorN; 240 bool mToolBarHorN;
240 bool mToolBarUpN; 241 bool mToolBarUpN;
241 bool mToolBarHorF; 242 bool mToolBarHorF;
242 bool mToolBarUpF; 243 bool mToolBarUpF;
243 bool mToolBarMiniIcons; 244 bool mToolBarMiniIcons;
244 245
245 bool mAskForQuit; 246 bool mAskForQuit;
246 bool mUsePassWd; 247 bool mUsePassWd;
247 bool mShowSyncEvents; 248 bool mShowSyncEvents;
248 bool mShowTodoInAgenda; 249 bool mShowTodoInAgenda;
249 bool mShowCompletedTodoInAgenda; 250 bool mShowCompletedTodoInAgenda;
250 bool mShowTimeInAgenda; 251 bool mShowTimeInAgenda;
251 bool mHideNonStartedTodos; 252 bool mHideNonStartedTodos;
252 253
253 bool mBlockPopupMenu; 254 bool mBlockPopupMenu;
254 255
255 int mLastSyncTime; 256 int mLastSyncTime;
256 void setCategoryColor(QString cat,const QColor & color); 257 void setCategoryColor(QString cat,const QColor & color);
257 QColor *categoryColor(QString cat); 258 QColor *categoryColor(QString cat);
258 259
259 QString mArchiveFile; 260 QString mArchiveFile;
260 QString mHtmlExportFile; 261 QString mHtmlExportFile;
261 bool mHtmlWithSave; 262 bool mHtmlWithSave;
262 263
263 QStringList mSelectedPlugins; 264 QStringList mSelectedPlugins;
264 265
265 QString mLastImportFile; 266 QString mLastImportFile;
266 QString mLastVcalFile; 267 QString mLastVcalFile;
267 QString mLastSaveFile; 268 QString mLastSaveFile;
268 QString mLastLoadFile; 269 QString mLastLoadFile;
269 270
270 271
271 QString mDefaultAlarmFile; 272 QString mDefaultAlarmFile;
272 int mIMIPScheduler; 273 int mIMIPScheduler;
273 int mIMIPSend; 274 int mIMIPSend;
274 QStringList mAdditionalMails; 275 QStringList mAdditionalMails;
275 int mIMIPAutoRefresh; 276 int mIMIPAutoRefresh;
276 int mIMIPAutoInsertReply; 277 int mIMIPAutoInsertReply;
277 int mIMIPAutoInsertRequest; 278 int mIMIPAutoInsertRequest;
278 int mIMIPAutoFreeBusy; 279 int mIMIPAutoFreeBusy;
279 int mIMIPAutoFreeBusyReply; 280 int mIMIPAutoFreeBusyReply;
280 281
281 QStringList mTodoTemplates; 282 QStringList mTodoTemplates;
282 QStringList mEventTemplates; 283 QStringList mEventTemplates;
283 284
284 int mDestination; 285 int mDestination;
285 286
286 287
287 bool mEditOnDoubleClick; 288 bool mEditOnDoubleClick;
288 bool mViewChangeHoldFullscreen; 289 bool mViewChangeHoldFullscreen;
289 bool mViewChangeHoldNonFullscreen; 290 bool mViewChangeHoldNonFullscreen;
290 bool mCenterOnCurrentTime; 291 bool mCenterOnCurrentTime;
291 bool mSetTimeToDayStartAt; 292 bool mSetTimeToDayStartAt;
292 bool mHighlightCurrentDay; 293 bool mHighlightCurrentDay;
293 bool mUseHighlightLightColor; 294 bool mUseHighlightLightColor;
294 bool mListViewMonthTimespan; 295 bool mListViewMonthTimespan;
295 bool mWNViewShowsParents; 296 bool mWNViewShowsParents;
296 bool mWNViewShowsPast; 297 bool mWNViewShowsPast;
297 bool mWNViewShowLocation; 298 bool mWNViewShowLocation;
298 bool mTodoViewShowsPercentage; 299 bool mTodoViewShowsPercentage;
299 bool mTodoViewUsesCatColors; 300 bool mTodoViewUsesCatColors;
300 bool mMonthViewUsesBigFont; 301 bool mMonthViewUsesBigFont;
301 bool mTodoViewUsesSmallFont; 302 bool mTodoViewUsesSmallFont;
302 bool mTodoViewUsesForegroundColor; 303 bool mTodoViewUsesForegroundColor;
303 bool mMonthViewUsesForegroundColor; 304 bool mMonthViewUsesForegroundColor;
304 305
305 bool mHightlightDateTimeEdit; 306 bool mHightlightDateTimeEdit;
306 bool mShortDateInViewer; 307 bool mShortDateInViewer;
307 308
308 bool mShowDateNavigator; 309 bool mShowDateNavigator;
309 310
310 QStringList mLocationDefaults; 311 QStringList mLocationDefaults;
311 QStringList mEventSummaryUser; 312 QStringList mEventSummaryUser;
312 QStringList mTodoSummaryUser; 313 QStringList mTodoSummaryUser;
313 314
314 bool mUseInternalAlarmNotification; 315 bool mUseInternalAlarmNotification;
315 int mAlarmPlayBeeps; 316 int mAlarmPlayBeeps;
316 int mAlarmSuspendTime; 317 int mAlarmSuspendTime;
317 int mAlarmSuspendCount; 318 int mAlarmSuspendCount;
318 int mAlarmBeepInterval; 319 int mAlarmBeepInterval;
319 int mOldLanguage; 320 int mOldLanguage;
320 int mOldLoadedLanguage; 321 int mOldLoadedLanguage;
321 322
322 323
323 QString mActiveSyncPort; 324 QString mActiveSyncPort;
324 QString mActiveSyncIP; 325 QString mActiveSyncIP;
325 326
326 // settings for eventviewer 327 // settings for eventviewer
327 bool mEVshowDetails; 328 bool mEVshowDetails;
328 bool mEVshowCreated; 329 bool mEVshowCreated;
329 bool mEVshowChanged; 330 bool mEVshowChanged;
330 bool mWTshowDetails; 331 bool mWTshowDetails;
331 bool mWTshowCreated; 332 bool mWTshowCreated;
332 bool mWTshowChanged; 333 bool mWTshowChanged;
333 334
334 int mCurrentDisplayedView; 335 int mCurrentDisplayedView;
335 QPtrList<KopiCalendarFile> mCalendars; 336 QPtrList<KopiCalendarFile> mCalendars;
336 int mNextAvailableCalendar; 337 int mNextAvailableCalendar;
337 338
338 private: 339 private:
339 QDict<QColor> mCategoryColors; 340 QDict<QColor> mCategoryColors;
340 QArray<KopiCalendarFile*> mDefCalColors; 341 QArray<KopiCalendarFile*> mDefCalColors;
341 QColor mDefaultCategoryColor; 342 QColor mDefaultCategoryColor;
342 343
343 QFont mDefaultTimeBarFont; 344 QFont mDefaultTimeBarFont;
344 QFont mDefaultViewFont; 345 QFont mDefaultViewFont;
345 QFont mDefaultMonthViewFont; 346 QFont mDefaultMonthViewFont;
346 347
347 QString mName; 348 QString mName;
348 QString mEmail; 349 QString mEmail;
349}; 350};
350 351
351#endif 352#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index a0f9d2e..ff1e240 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,859 +1,860 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qvbox.h> 40#include <qvbox.h>
41#include <qdir.h> 41#include <qdir.h>
42#include <qregexp.h> 42#include <qregexp.h>
43#include <qspinbox.h> 43#include <qspinbox.h>
44 44
45#include <kdialog.h> 45#include <kdialog.h>
46#include <kprefsdialog.h> 46#include <kprefsdialog.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobalsettings.h> 48#include <kglobalsettings.h>
49#include <kdateedit.h> 49#include <kdateedit.h>
50#include <kglobal.h> 50#include <kglobal.h>
51#include <stdlib.h> 51#include <stdlib.h>
52 52
53/*US 53/*US
54#include <qcheckbox.h> 54#include <qcheckbox.h>
55#include <qframe.h> 55#include <qframe.h>
56#include <qpushbutton.h> 56#include <qpushbutton.h>
57#include <qcombobox.h> 57#include <qcombobox.h>
58#include <qlineedit.h> 58#include <qlineedit.h>
59#include <qlabel.h> 59#include <qlabel.h>
60#include <qfile.h> 60#include <qfile.h>
61 61
62#include <kconfig.h> 62#include <kconfig.h>
63#include <kdebug.h> 63#include <kdebug.h>
64#include <kdialog.h> 64#include <kdialog.h>
65#include <klistview.h> 65#include <klistview.h>
66#include <klocale.h> 66#include <klocale.h>
67#include <kglobal.h> 67#include <kglobal.h>
68#include <kmessagebox.h> 68#include <kmessagebox.h>
69#include <kstandarddirs.h> 69#include <kstandarddirs.h>
70 70
71#ifndef KAB_EMBEDDED 71#ifndef KAB_EMBEDDED
72#include <ktrader.h> 72#include <ktrader.h>
73#else // KAB_EMBEDDED 73#else // KAB_EMBEDDED
74#include <mergewidget.h> 74#include <mergewidget.h>
75#include <distributionlistwidget.h> 75#include <distributionlistwidget.h>
76#endif // KAB_EMBEDDED 76#endif // KAB_EMBEDDED
77 77
78#include "addresseewidget.h" 78#include "addresseewidget.h"
79#include "extensionconfigdialog.h" 79#include "extensionconfigdialog.h"
80#include "extensionwidget.h" 80#include "extensionwidget.h"
81*/ 81*/
82 82
83#include "qapplication.h" 83#include "qapplication.h"
84 84
85#include "kpimglobalprefs.h" 85#include "kpimglobalprefs.h"
86 86
87#include "kdepimconfigwidget.h" 87#include "kdepimconfigwidget.h"
88#include <kprefs.h> 88#include <kprefs.h>
89#include <kmessagebox.h> 89#include <kmessagebox.h>
90 90
91 91
92
92KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 93KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
93 : KPrefsWidget(prefs, parent, name ) 94 : KPrefsWidget(prefs, parent, name )
94{ 95{
95 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 96 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
96 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 97 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
97 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 98 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
98 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 99 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
99 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 100 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
100 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 101 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
101 102
102 103
103 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 104 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
104 KDialog::spacingHint() ); 105 KDialog::spacingHint() );
105 106
106 tabWidget = new QTabWidget( this ); 107 tabWidget = new QTabWidget( this );
107 topLayout->addWidget( tabWidget ); 108 topLayout->addWidget( tabWidget );
108 109
109 110
110 setupLocaleTab(); 111 setupLocaleTab();
111 setupLocaleDateTab(); 112 setupLocaleDateTab();
112 setupTimeZoneTab(); 113 setupTimeZoneTab();
113 setupExternalAppTab(); 114 setupExternalAppTab();
114 setupStoreTab(); 115 setupStoreTab();
115 setupBackupTab(); 116 setupBackupTab();
116} 117}
117void KDEPIMConfigWidget::showTimeZoneTab() 118void KDEPIMConfigWidget::showTimeZoneTab()
118{ 119{
119 tabWidget->setCurrentPage ( 3 ) ; 120 tabWidget->setCurrentPage ( 3 ) ;
120} 121}
121void KDEPIMConfigWidget::setupBackupTab() 122void KDEPIMConfigWidget::setupBackupTab()
122{ 123{
123 QVBox *colorPage = new QVBox( this ); 124 QVBox *colorPage = new QVBox( this );
124 tabWidget->addTab( colorPage, i18n( "Backup" ) ); 125 tabWidget->addTab( colorPage, i18n( "Backup" ) );
125 QWidget* topFrame = new QWidget( colorPage ); 126 QWidget* topFrame = new QWidget( colorPage );
126 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 127 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
127 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), 128 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
128 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); 129 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
129 topLayout->addWidget((QWidget*)sb->checkBox()); 130 topLayout->addWidget((QWidget*)sb->checkBox());
130 QWidget* bupFrame = new QWidget( topFrame ); 131 QWidget* bupFrame = new QWidget( topFrame );
131 topLayout->addWidget((bupFrame)); 132 topLayout->addWidget((bupFrame));
132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); 133 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); 134 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
134 sb = addWidBool(i18n("Use standard backup dir"), 135 sb = addWidBool(i18n("Use standard backup dir"),
135 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); 136 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
136 bupLayout->addWidget((QWidget*)sb->checkBox()); 137 bupLayout->addWidget((QWidget*)sb->checkBox());
137 mBackupUrl = new KURLRequester( bupFrame ); 138 mBackupUrl = new KURLRequester( bupFrame );
138 mBackupUrl->setPathIsDir(); 139 mBackupUrl->setPathIsDir();
139 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 140 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
140 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); 141 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
141 bupLayout->addWidget( mBackupUrl ); 142 bupLayout->addWidget( mBackupUrl );
142 143
143 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); 144 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
144 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); 145 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
145 QHBox *dummy = new QHBox(bupFrame); 146 QHBox *dummy = new QHBox(bupFrame);
146 new QLabel(i18n("Number of Backups:"),dummy); 147 new QLabel(i18n("Number of Backups:"),dummy);
147 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); 148 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
148 new QLabel(i18n(" "),dummy); 149 new QLabel(i18n(" "),dummy);
149 bupLayout->addWidget( dummy ); 150 bupLayout->addWidget( dummy );
150 151
151 dummy = new QHBox(bupFrame); 152 dummy = new QHBox(bupFrame);
152 new QLabel(i18n("Make backup every "),dummy); 153 new QLabel(i18n("Make backup every "),dummy);
153 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); 154 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
154 new QLabel(i18n(" days"),dummy); 155 new QLabel(i18n(" days"),dummy);
155 new QLabel(i18n(" "),dummy); 156 new QLabel(i18n(" "),dummy);
156 bupLayout->addWidget( dummy ); 157 bupLayout->addWidget( dummy );
157 QString localKdeDir; 158 QString localKdeDir;
158 localKdeDir = readEnvPath("LOCALMICROKDEHOME"); 159 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
159 if ( ! localKdeDir.isEmpty() ) { 160 if ( ! localKdeDir.isEmpty() ) {
160 sb->checkBox()->setEnabled( false ); 161 sb->checkBox()->setEnabled( false );
161 sb->checkBox()->setChecked( true ); 162 sb->checkBox()->setChecked( true );
162 mBackupUrl->setEnabled( false ); 163 mBackupUrl->setEnabled( false );
163 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; 164 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
164 } 165 }
165 166
166} 167}
167void KDEPIMConfigWidget::setupStoreTab() 168void KDEPIMConfigWidget::setupStoreTab()
168{ 169{
169 QVBox *colorPage = new QVBox( this ); 170 QVBox *colorPage = new QVBox( this );
170 tabWidget->addTab( colorPage, i18n( "Colors" ) ); 171 tabWidget->addTab( colorPage, i18n( "Colors" ) );
171 QWidget* cw = new QWidget( colorPage ); 172 QWidget* cw = new QWidget( colorPage );
172 KPrefsWidColor *holidayColor = 173 KPrefsWidColor *holidayColor =
173 addWidColor(i18n("Alternating background of list views"), 174 addWidColor(i18n("Alternating background of list views"),
174 &(KPimGlobalPrefs::instance()->mAlternateColor),cw); 175 &(KPimGlobalPrefs::instance()->mAlternateColor),cw);
175 QHBoxLayout *topLayout = new QHBoxLayout(cw); 176 QHBoxLayout *topLayout = new QHBoxLayout(cw);
176 topLayout->addWidget(holidayColor->label()); 177 topLayout->addWidget(holidayColor->label());
177 topLayout->addWidget( (QWidget* )holidayColor->button()); 178 topLayout->addWidget( (QWidget* )holidayColor->button());
178 179
179 180
180 QVBox *storePage = new QVBox( this ); 181 QVBox *storePage = new QVBox( this );
181 if ( QApplication::desktop()->height() > 240 ) 182 if ( QApplication::desktop()->height() > 240 )
182 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); 183 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
183 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 184 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
184 mStoreUrl = new KURLRequester( storePage ); 185 mStoreUrl = new KURLRequester( storePage );
185 mStoreUrl->setPathIsDir(); 186 mStoreUrl->setPathIsDir();
186 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 187 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
187#ifdef DESKTOP_VERSION 188#ifdef DESKTOP_VERSION
188 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 189 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
189 QFileInfo fi ( confFile ); 190 QFileInfo fi ( confFile );
190 if ( fi.exists() ) { 191 if ( fi.exists() ) {
191 KConfig cfg ( confFile ); 192 KConfig cfg ( confFile );
192 cfg.setGroup("Global"); 193 cfg.setGroup("Global");
193 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); 194 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
194 if ( localKdeDir != "x_x_x" ) { 195 if ( localKdeDir != "x_x_x" ) {
195 mStoreUrl->setURL( localKdeDir ); 196 mStoreUrl->setURL( localKdeDir );
196 qDebug("Reading config from %s ", confFile.latin1()); 197 qDebug("Reading config from %s ", confFile.latin1());
197 } 198 }
198 } 199 }
199 200
200#endif 201#endif
201 new QLabel( i18n("New dirs are created automatically"), storePage ); 202 new QLabel( i18n("New dirs are created automatically"), storePage );
202 QHBox *bb = new QHBox( storePage ); 203 QHBox *bb = new QHBox( storePage );
203 QPushButton * pb; 204 QPushButton * pb;
204 if ( QApplication::desktop()->width() < 640 ) 205 if ( QApplication::desktop()->width() < 640 )
205 pb = new QPushButton ( i18n("Save"), bb ); 206 pb = new QPushButton ( i18n("Save"), bb );
206 else 207 else
207 pb = new QPushButton ( i18n("Save settings"), bb ); 208 pb = new QPushButton ( i18n("Save settings"), bb );
208 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 209 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
209 pb = new QPushButton ( i18n("Save standard"), bb ); 210 pb = new QPushButton ( i18n("Save standard"), bb );
210 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 211 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
211#ifdef DESKTOP_VERSION 212#ifdef DESKTOP_VERSION
212 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); 213 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
213 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); 214 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
214#endif 215#endif
215 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 216 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
216 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 217 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
217 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 218 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
218} 219}
219void KDEPIMConfigWidget::setLocalStore() 220void KDEPIMConfigWidget::setLocalStore()
220{ 221{
221 mStoreUrl->setURL( "LOCAL:kdepimpi" ); 222 mStoreUrl->setURL( "LOCAL:kdepimpi" );
222 saveStoreSettings(); 223 saveStoreSettings();
223 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); 224 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data.");
224 KMessageBox::information( this, message); 225 KMessageBox::information( this, message);
225} 226}
226void KDEPIMConfigWidget::setStandardStore() 227void KDEPIMConfigWidget::setStandardStore()
227{ 228{
228 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 229 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
229 saveStoreSettings(); 230 saveStoreSettings();
230} 231}
231void KDEPIMConfigWidget::saveStoreSettings() 232void KDEPIMConfigWidget::saveStoreSettings()
232{ 233{
233 if ( !mStoreUrl->url().isEmpty() ) { 234 if ( !mStoreUrl->url().isEmpty() ) {
234 QString path = QDir::homeDirPath(); 235 QString path = QDir::homeDirPath();
235 QString url = mStoreUrl->url(); 236 QString url = mStoreUrl->url();
236#ifdef DESKTOP_VERSION 237#ifdef DESKTOP_VERSION
237 if ( url.startsWith( "LOCAL:" ) ) { 238 if ( url.startsWith( "LOCAL:" ) ) {
238 path = qApp->applicationDirPath () ; 239 path = qApp->applicationDirPath () ;
239 } 240 }
240#endif 241#endif
241 KConfig cfg ( path + "/.microkdehome" ); 242 KConfig cfg ( path + "/.microkdehome" );
242 cfg.setGroup("Global"); 243 cfg.setGroup("Global");
243 cfg.writeEntry( "MICROKDEHOME", url ); 244 cfg.writeEntry( "MICROKDEHOME", url );
244 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); 245 qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1());
245 cfg.sync(); 246 cfg.sync();
246 } else { 247 } else {
247 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 248 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
248 saveStoreSettings(); 249 saveStoreSettings();
249 } 250 }
250} 251}
251void KDEPIMConfigWidget::setupExternalAppTab() 252void KDEPIMConfigWidget::setupExternalAppTab()
252{ 253{
253 QWidget *externalAppsPage = new QWidget( this ); 254 QWidget *externalAppsPage = new QWidget( this );
254 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 255 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
255 KDialog::spacingHintSmall() ); 256 KDialog::spacingHintSmall() );
256 257
257 mExternalApps = new QComboBox( externalAppsPage ); 258 mExternalApps = new QComboBox( externalAppsPage );
258 259
259 QMap<ExternalAppHandler::Types, QString>::Iterator it; 260 QMap<ExternalAppHandler::Types, QString>::Iterator it;
260 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 261 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
261 mExternalApps->insertItem( it.data(), it.key() ); 262 mExternalApps->insertItem( it.data(), it.key() );
262 263
263 layout->addWidget( mExternalApps ); 264 layout->addWidget( mExternalApps );
264 265
265 connect( mExternalApps, SIGNAL( activated( int ) ), 266 connect( mExternalApps, SIGNAL( activated( int ) ),
266 this, SLOT (externalapp_changed( int ) ) ); 267 this, SLOT (externalapp_changed( int ) ) );
267 268
268 269
269 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 270 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
270 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 271 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
271 mExternalAppGroupBox->layout()->setMargin(4); 272 mExternalAppGroupBox->layout()->setMargin(4);
272 273
273 mClient = new QComboBox( mExternalAppGroupBox ); 274 mClient = new QComboBox( mExternalAppGroupBox );
274 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 275 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
275 276
276 connect( mClient, SIGNAL( activated( int ) ), 277 connect( mClient, SIGNAL( activated( int ) ),
277 this, SLOT (client_changed( int ) ) ); 278 this, SLOT (client_changed( int ) ) );
278 279
279 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 280 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
280 boxLayout->addWidget( lab, 1, 0 ); 281 boxLayout->addWidget( lab, 1, 0 );
281 mChannel = new QLineEdit(mExternalAppGroupBox); 282 mChannel = new QLineEdit(mExternalAppGroupBox);
282 mChannel->setReadOnly(true); 283 mChannel->setReadOnly(true);
283 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 284 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
284 285
285 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 286 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
286 boxLayout->addWidget( lab, 3, 0 ); 287 boxLayout->addWidget( lab, 3, 0 );
287 mMessage = new QLineEdit(mExternalAppGroupBox); 288 mMessage = new QLineEdit(mExternalAppGroupBox);
288 mMessage->setReadOnly(true); 289 mMessage->setReadOnly(true);
289 boxLayout->addWidget( mMessage , 4, 0); 290 boxLayout->addWidget( mMessage , 4, 0);
290 291
291 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 292 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
292 boxLayout->addWidget( lab, 3, 1 ); 293 boxLayout->addWidget( lab, 3, 1 );
293 mParameters = new QLineEdit(mExternalAppGroupBox); 294 mParameters = new QLineEdit(mExternalAppGroupBox);
294 mParameters->setReadOnly(true); 295 mParameters->setReadOnly(true);
295 boxLayout->addWidget( mParameters, 4, 1 ); 296 boxLayout->addWidget( mParameters, 4, 1 );
296 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 297 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
297 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 298 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
298 299
299 300
300 if ( QApplication::desktop()->height() > 240 ) { 301 if ( QApplication::desktop()->height() > 240 ) {
301 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 302 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
302 boxLayout->addWidget( lab, 6, 0 ); 303 boxLayout->addWidget( lab, 6, 0 );
303 mMessage2 = new QLineEdit(mExternalAppGroupBox); 304 mMessage2 = new QLineEdit(mExternalAppGroupBox);
304 mMessage2->setReadOnly(true); 305 mMessage2->setReadOnly(true);
305 boxLayout->addWidget( mMessage2 , 7, 0); 306 boxLayout->addWidget( mMessage2 , 7, 0);
306 307
307 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 308 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
308 boxLayout->addWidget( lab, 6, 1 ); 309 boxLayout->addWidget( lab, 6, 1 );
309 mParameters2 = new QLineEdit(mExternalAppGroupBox); 310 mParameters2 = new QLineEdit(mExternalAppGroupBox);
310 mParameters2->setReadOnly(true); 311 mParameters2->setReadOnly(true);
311 boxLayout->addWidget( mParameters2, 7, 1 ); 312 boxLayout->addWidget( mParameters2, 7, 1 );
312 313
313 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 314 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
314 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 315 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
315 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 316 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
316 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 317 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
317 } else { 318 } else {
318 mMessage2 = 0; 319 mMessage2 = 0;
319 mParameters2 = 0; 320 mParameters2 = 0;
320 } 321 }
321 322
322 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 323 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
323 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 324 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
324 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 325 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
325 326
326 327
327 layout->addWidget( mExternalAppGroupBox ); 328 layout->addWidget( mExternalAppGroupBox );
328 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 329 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
329 330
330} 331}
331 332
332 333
333void KDEPIMConfigWidget::setupLocaleDateTab() 334void KDEPIMConfigWidget::setupLocaleDateTab()
334{ 335{
335 QWidget *topFrame = new QWidget( this ); 336 QWidget *topFrame = new QWidget( this );
336 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 337 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
337 338
338 topLayout->setSpacing(KDialog::spacingHintSmall()); 339 topLayout->setSpacing(KDialog::spacingHintSmall());
339 topLayout->setMargin(KDialog::marginHintSmall()); 340 topLayout->setMargin(KDialog::marginHintSmall());
340 int iii = 0; 341 int iii = 0;
341 342
342 343
343 KPrefsWidRadios *syncPrefsGroup = 344 KPrefsWidRadios *syncPrefsGroup =
344 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); 345 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
345 QString format; 346 QString format;
346 if ( QApplication::desktop()->width() < 480 ) 347 if ( QApplication::desktop()->width() < 480 )
347 format = "(%d.%m.%Y)"; 348 format = "(%d.%m.%Y)";
348 else 349 else
349 format = "(%d.%m.%Y|%A %d %B %Y)"; 350 format = "(%d.%m.%Y|%A %d %B %Y)";
350 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 351 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
351 if ( QApplication::desktop()->width() < 480 ) 352 if ( QApplication::desktop()->width() < 480 )
352 format = "(%m.%d.%Y)"; 353 format = "(%m.%d.%Y)";
353 else 354 else
354 format = "(%m.%d.%Y|%A %B %d %Y)"; 355 format = "(%m.%d.%Y|%A %B %d %Y)";
355 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 356 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
356 if ( QApplication::desktop()->width() < 480 ) 357 if ( QApplication::desktop()->width() < 480 )
357 format = "(%Y-%m-%d)"; 358 format = "(%Y-%m-%d)";
358 else 359 else
359 format = "(%Y-%m-%d|%A %Y %B %d)"; 360 format = "(%Y-%m-%d|%A %Y %B %d)";
360 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 361 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
361 syncPrefsGroup->addRadio(i18n("User defined")); 362 syncPrefsGroup->addRadio(i18n("User defined"));
362 if ( QApplication::desktop()->width() < 480 ) { 363 if ( QApplication::desktop()->width() < 480 ) {
363 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 364 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
364 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 365 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
365 } 366 }
366 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 367 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
367 ++iii; 368 ++iii;
368 ++iii; 369 ++iii;
369 QLabel * lab; 370 QLabel * lab;
370 mUserDateFormatLong = new QLineEdit(topFrame); 371 mUserDateFormatLong = new QLineEdit(topFrame);
371 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 372 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
372 topLayout->addWidget(lab ,iii,0); 373 topLayout->addWidget(lab ,iii,0);
373 topLayout->addWidget(mUserDateFormatLong,iii,1); 374 topLayout->addWidget(mUserDateFormatLong,iii,1);
374 ++iii; 375 ++iii;
375 mUserDateFormatShort = new QLineEdit(topFrame); 376 mUserDateFormatShort = new QLineEdit(topFrame);
376 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 377 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
377 topLayout->addWidget(lab ,iii,0); 378 topLayout->addWidget(lab ,iii,0);
378 topLayout->addWidget(mUserDateFormatShort,iii,1); 379 topLayout->addWidget(mUserDateFormatShort,iii,1);
379 ++iii; 380 ++iii;
380 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 381 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
381 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 382 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
382 ++iii; 383 ++iii;
383 //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); 384 //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() );
384 if ( QApplication::desktop()->height() > 240 ) { 385 if ( QApplication::desktop()->height() > 240 ) {
385 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 386 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
386 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 387 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
387 ++iii; 388 ++iii;
388 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 389 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
389 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 390 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
390 ++iii; 391 ++iii;
391 } 392 }
392 393
393 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 394 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
394 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 395 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
395 396
396 397
397 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 398 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
398} 399}
399 400
400void KDEPIMConfigWidget::setupLocaleTab() 401void KDEPIMConfigWidget::setupLocaleTab()
401{ 402{
402 403
403 QWidget *topFrame = new QWidget( this ); 404 QWidget *topFrame = new QWidget( this );
404 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 405 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
405 406
406 topLayout->setSpacing(KDialog::spacingHint()); 407 topLayout->setSpacing(KDialog::spacingHint());
407 topLayout->setMargin(KDialog::marginHint()); 408 topLayout->setMargin(KDialog::marginHint());
408 int iii = 0; 409 int iii = 0;
409 KPrefsWidRadios *syncPrefsGroup = 410 KPrefsWidRadios *syncPrefsGroup =
410 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 411 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
411 syncPrefsGroup->addRadio(i18n("English")); 412 syncPrefsGroup->addRadio(i18n("English"));
412 syncPrefsGroup->addRadio(i18n("German")); 413 syncPrefsGroup->addRadio(i18n("German"));
413 syncPrefsGroup->addRadio(i18n("French")); 414 syncPrefsGroup->addRadio(i18n("French"));
414 syncPrefsGroup->addRadio(i18n("Italian")); 415 syncPrefsGroup->addRadio(i18n("Italian"));
415 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 416 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
416 if ( QApplication::desktop()->width() < 300 ) { 417 if ( QApplication::desktop()->width() < 300 ) {
417 syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); 418 syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
418 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); 419 syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
419 } 420 }
420 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 421 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
421 ++iii; 422 ++iii;
422 423
423 424
424 tabWidget->addTab( topFrame, i18n( "Language" ) ); 425 tabWidget->addTab( topFrame, i18n( "Language" ) );
425 topFrame = new QWidget( this ); 426 topFrame = new QWidget( this );
426 topLayout = new QGridLayout(topFrame,4,2); 427 topLayout = new QGridLayout(topFrame,4,2);
427 428
428 topLayout->setSpacing(KDialog::spacingHint()); 429 topLayout->setSpacing(KDialog::spacingHint());
429 topLayout->setMargin(KDialog::marginHint()); 430 topLayout->setMargin(KDialog::marginHint());
430 iii = 0; 431 iii = 0;
431 syncPrefsGroup = 432 syncPrefsGroup =
432 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 433 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
433 if ( QApplication::desktop()->width() > 300 ) 434 if ( QApplication::desktop()->width() > 300 )
434 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 435 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
435 syncPrefsGroup->addRadio(i18n("24:00")); 436 syncPrefsGroup->addRadio(i18n("24:00"));
436 syncPrefsGroup->addRadio(i18n("12:00am")); 437 syncPrefsGroup->addRadio(i18n("12:00am"));
437 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 438 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
438 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 439 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
439 ++iii; 440 ++iii;
440 441
441 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 442 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
442 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 443 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
443 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 444 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
444 ++iii; 445 ++iii;
445 446
446 447
447 tabWidget->addTab( topFrame, i18n( "Time Format" ) ); 448 tabWidget->addTab( topFrame, i18n( "Time Format" ) );
448 449
449} 450}
450 451
451 452
452void KDEPIMConfigWidget::setupTimeZoneTab() 453void KDEPIMConfigWidget::setupTimeZoneTab()
453{ 454{
454 QWidget *topFrame; 455 QWidget *topFrame;
455 QGridLayout *topLayout ; 456 QGridLayout *topLayout ;
456 457
457 458
458 459
459 460
460 461
461 462
462 topFrame = new QWidget( this ); 463 topFrame = new QWidget( this );
463 topLayout = new QGridLayout( topFrame, 5, 2); 464 topLayout = new QGridLayout( topFrame, 5, 2);
464 topLayout->setSpacing(KDialog::spacingHintSmall()); 465 topLayout->setSpacing(KDialog::spacingHintSmall());
465 topLayout->setMargin(KDialog::marginHintSmall()); 466 topLayout->setMargin(KDialog::marginHintSmall());
466 467
467 QHBox *timeZoneBox = new QHBox( topFrame ); 468 QHBox *timeZoneBox = new QHBox( topFrame );
468 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 469 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
469 470
470 new QLabel( i18n("Timezone:"), timeZoneBox ); 471 new QLabel( i18n("Timezone:"), timeZoneBox );
471 mTimeZoneCombo = new QComboBox( timeZoneBox ); 472 mTimeZoneCombo = new QComboBox( timeZoneBox );
472 if ( QApplication::desktop()->width() < 300 ) { 473 if ( QApplication::desktop()->width() < 300 ) {
473 mTimeZoneCombo->setMaximumWidth(150); 474 mTimeZoneCombo->setMaximumWidth(150);
474 } 475 }
475 476
476 QStringList list; 477 QStringList list;
477 list = KGlobal::locale()->timeZoneList(); 478 list = KGlobal::locale()->timeZoneList();
478 mTimeZoneCombo->insertStringList(list); 479 mTimeZoneCombo->insertStringList(list);
479 480
480 // find the currently set time zone and select it 481 // find the currently set time zone and select it
481 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 482 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
482 int nCurrentlySet = 11; 483 int nCurrentlySet = 11;
483 for (int i = 0; i < mTimeZoneCombo->count(); i++) 484 for (int i = 0; i < mTimeZoneCombo->count(); i++)
484 { 485 {
485 if (mTimeZoneCombo->text(i) == sCurrentlySet) 486 if (mTimeZoneCombo->text(i) == sCurrentlySet)
486 { 487 {
487 nCurrentlySet = i; 488 nCurrentlySet = i;
488 break; 489 break;
489 } 490 }
490 } 491 }
491 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 492 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
492 int iii = 1; 493 int iii = 1;
493 KPrefsWidBool *sb = 494 KPrefsWidBool *sb =
494 addWidBool(i18n("Add 30 min to selected Timezone"), 495 addWidBool(i18n("Add 30 min to selected Timezone"),
495 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); 496 &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
496 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 497 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
497 ++iii; 498 ++iii;
498 sb = 499 sb =
499 addWidBool(i18n("Timezone has daylight saving"), 500 addWidBool(i18n("Timezone has daylight saving"),
500 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 501 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
501 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 502 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
502 ++iii; 503 ++iii;
503 QLabel* lab; 504 QLabel* lab;
504 505
505 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 506 lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
506 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 507 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
507 ++iii; 508 ++iii;
508 509
509 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 510 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
510 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 511 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
511 ++iii; 512 ++iii;
512 lab = new QLabel( i18n("Daylight start:"), topFrame ); 513 lab = new QLabel( i18n("Daylight start:"), topFrame );
513 topLayout->addWidget(lab, iii,0); 514 topLayout->addWidget(lab, iii,0);
514 mStartDateSavingEdit = new KDateEdit(topFrame); 515 mStartDateSavingEdit = new KDateEdit(topFrame);
515 topLayout->addWidget(mStartDateSavingEdit, iii,1); 516 topLayout->addWidget(mStartDateSavingEdit, iii,1);
516 ++iii; 517 ++iii;
517 518
518 lab = new QLabel( i18n("Daylight end:"), topFrame ); 519 lab = new QLabel( i18n("Daylight end:"), topFrame );
519 topLayout->addWidget(lab, iii,0); 520 topLayout->addWidget(lab, iii,0);
520 mEndDateSavingEdit = new KDateEdit(topFrame); 521 mEndDateSavingEdit = new KDateEdit(topFrame);
521 topLayout->addWidget(mEndDateSavingEdit, iii,1); 522 topLayout->addWidget(mEndDateSavingEdit, iii,1);
522 ++iii; 523 ++iii;
523 QDate current ( 2001, 1,1); 524 QDate current ( 2001, 1,1);
524 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 525 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
525 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 526 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
526 527
527 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 528 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
528 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 529 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
529 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 530 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
530 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 531 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
531 532
532 533
533 topFrame = new QWidget( this ); 534 topFrame = new QWidget( this );
534 topLayout = new QGridLayout( topFrame, 3, 2); 535 topLayout = new QGridLayout( topFrame, 3, 2);
535 topLayout->setSpacing(KDialog::spacingHintSmall()); 536 topLayout->setSpacing(KDialog::spacingHintSmall());
536 topLayout->setMargin(KDialog::marginHintSmall()); 537 topLayout->setMargin(KDialog::marginHintSmall());
537 tabWidget->addTab( topFrame, i18n( "Fonts" ) ); 538 tabWidget->addTab( topFrame, i18n( "Fonts" ) );
538 539
539 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); 540 QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame );
540 topLayout->addMultiCellWidget(labb,0,0,0,2); 541 topLayout->addMultiCellWidget(labb,0,0,0,2);
541 int i = 1; 542 int i = 1;
542 KPrefsWidFont *timeLabelsFont = 543 KPrefsWidFont *timeLabelsFont =
543 addWidFont(i18n("Kx/Pi"),i18n("Application Font"), 544 addWidFont(i18n("Kx/Pi"),i18n("Application Font"),
544 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); 545 &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame);
545 topLayout->addWidget(timeLabelsFont->label(),i,0); 546 topLayout->addWidget(timeLabelsFont->label(),i,0);
546 topLayout->addWidget(timeLabelsFont->preview(),i,1); 547 topLayout->addWidget(timeLabelsFont->preview(),i,1);
547 topLayout->addWidget(timeLabelsFont->button(),i,2); 548 topLayout->addWidget(timeLabelsFont->button(),i,2);
548} 549}
549 550
550void KDEPIMConfigWidget::externalapp_changed( int newApp ) 551void KDEPIMConfigWidget::externalapp_changed( int newApp )
551{ 552{
552 // first store the current data 553 // first store the current data
553 saveEditFieldSettings(); 554 saveEditFieldSettings();
554 555
555 // set mCurrentApp 556 // set mCurrentApp
556 mCurrentApp = (ExternalAppHandler::Types)newApp; 557 mCurrentApp = (ExternalAppHandler::Types)newApp;
557 558
558 // set mCurrentClient 559 // set mCurrentClient
559 switch(mCurrentApp) 560 switch(mCurrentApp)
560 { 561 {
561 case(ExternalAppHandler::EMAIL): 562 case(ExternalAppHandler::EMAIL):
562 mCurrentClient = mEmailClient; 563 mCurrentClient = mEmailClient;
563 break; 564 break;
564 case(ExternalAppHandler::PHONE): 565 case(ExternalAppHandler::PHONE):
565 mCurrentClient = mPhoneClient; 566 mCurrentClient = mPhoneClient;
566 break; 567 break;
567 case(ExternalAppHandler::SMS): 568 case(ExternalAppHandler::SMS):
568 mCurrentClient = mSMSClient; 569 mCurrentClient = mSMSClient;
569 break; 570 break;
570 case(ExternalAppHandler::FAX): 571 case(ExternalAppHandler::FAX):
571 mCurrentClient = mFaxClient; 572 mCurrentClient = mFaxClient;
572 break; 573 break;
573 case(ExternalAppHandler::PAGER): 574 case(ExternalAppHandler::PAGER):
574 mCurrentClient = mPagerClient; 575 mCurrentClient = mPagerClient;
575 break; 576 break;
576 case(ExternalAppHandler::SIP): 577 case(ExternalAppHandler::SIP):
577 mCurrentClient = mSipClient; 578 mCurrentClient = mSipClient;
578 break; 579 break;
579 default: 580 default:
580 return; 581 return;
581 } 582 }
582 583
583 // and at last update the widgets 584 // and at last update the widgets
584 updateClientWidgets(); 585 updateClientWidgets();
585} 586}
586 587
587 588
588 589
589void KDEPIMConfigWidget::client_changed( int newClient ) 590void KDEPIMConfigWidget::client_changed( int newClient )
590{ 591{
591 if (newClient == mCurrentClient) 592 if (newClient == mCurrentClient)
592 return; 593 return;
593 594
594 // first store the current data 595 // first store the current data
595 saveEditFieldSettings(); 596 saveEditFieldSettings();
596 597
597 598
598 //then reset the clientvariable 599 //then reset the clientvariable
599 mCurrentClient = newClient; 600 mCurrentClient = newClient;
600 601
601 // and at last update the widgets 602 // and at last update the widgets
602 updateClientWidgets(); 603 updateClientWidgets();
603 604
604 KPrefsWidget::modified(); 605 KPrefsWidget::modified();
605} 606}
606 607
607void KDEPIMConfigWidget::saveEditFieldSettings() 608void KDEPIMConfigWidget::saveEditFieldSettings()
608{ 609{
609 610
610 switch(mCurrentApp) 611 switch(mCurrentApp)
611 { 612 {
612 case(ExternalAppHandler::EMAIL): 613 case(ExternalAppHandler::EMAIL):
613 mEmailClient = mClient->currentItem(); 614 mEmailClient = mClient->currentItem();
614 break; 615 break;
615 case(ExternalAppHandler::PHONE): 616 case(ExternalAppHandler::PHONE):
616 mPhoneClient= mClient->currentItem(); 617 mPhoneClient= mClient->currentItem();
617 break; 618 break;
618 case(ExternalAppHandler::SMS): 619 case(ExternalAppHandler::SMS):
619 mSMSClient = mClient->currentItem(); 620 mSMSClient = mClient->currentItem();
620 break; 621 break;
621 case(ExternalAppHandler::FAX): 622 case(ExternalAppHandler::FAX):
622 mFaxClient = mClient->currentItem(); 623 mFaxClient = mClient->currentItem();
623 break; 624 break;
624 case(ExternalAppHandler::PAGER): 625 case(ExternalAppHandler::PAGER):
625 mPagerClient = mClient->currentItem(); 626 mPagerClient = mClient->currentItem();
626 break; 627 break;
627 case(ExternalAppHandler::SIP): 628 case(ExternalAppHandler::SIP):
628 mSipClient = mClient->currentItem(); 629 mSipClient = mClient->currentItem();
629 break; 630 break;
630 default: 631 default:
631 return; 632 return;
632 } 633 }
633 634
634 //store the current data back to the apropriate membervariables if we had set it to "other" 635 //store the current data back to the apropriate membervariables if we had set it to "other"
635 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 636 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
636 { 637 {
637 mEmailOtherChannel = mChannel->text(); 638 mEmailOtherChannel = mChannel->text();
638 mEmailOtherMessage = mMessage->text(); 639 mEmailOtherMessage = mMessage->text();
639 mEmailOtherMessageParameters = mParameters->text(); 640 mEmailOtherMessageParameters = mParameters->text();
640 if ( mMessage2 ) 641 if ( mMessage2 )
641 mEmailOtherMessage2 = mMessage2->text(); 642 mEmailOtherMessage2 = mMessage2->text();
642 if ( mParameters2 ) 643 if ( mParameters2 )
643 mEmailOtherMessageParameters2 = mParameters2->text(); 644 mEmailOtherMessageParameters2 = mParameters2->text();
644 } 645 }
645 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 646 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
646 { 647 {
647 mPhoneOtherChannel = mChannel->text(); 648 mPhoneOtherChannel = mChannel->text();
648 mPhoneOtherMessage = mMessage->text(); 649 mPhoneOtherMessage = mMessage->text();
649 mPhoneOtherMessageParameters = mParameters->text(); 650 mPhoneOtherMessageParameters = mParameters->text();
650 } 651 }
651 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 652 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
652 { 653 {
653 mSMSOtherChannel = mChannel->text(); 654 mSMSOtherChannel = mChannel->text();
654 mSMSOtherMessage = mMessage->text(); 655 mSMSOtherMessage = mMessage->text();
655 mSMSOtherMessageParameters = mParameters->text(); 656 mSMSOtherMessageParameters = mParameters->text();
656 } 657 }
657 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 658 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
658 { 659 {
659 mFaxOtherChannel = mChannel->text(); 660 mFaxOtherChannel = mChannel->text();
660 mFaxOtherMessage = mMessage->text(); 661 mFaxOtherMessage = mMessage->text();
661 mFaxOtherMessageParameters = mParameters->text(); 662 mFaxOtherMessageParameters = mParameters->text();
662 } 663 }
663 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 664 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
664 { 665 {
665 mPagerOtherChannel = mChannel->text(); 666 mPagerOtherChannel = mChannel->text();
666 mPagerOtherMessage = mMessage->text(); 667 mPagerOtherMessage = mMessage->text();
667 mPagerOtherMessageParameters = mParameters->text(); 668 mPagerOtherMessageParameters = mParameters->text();
668 } 669 }
669 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 670 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
670 { 671 {
671 mSipOtherChannel = mChannel->text(); 672 mSipOtherChannel = mChannel->text();
672 mSipOtherMessage = mMessage->text(); 673 mSipOtherMessage = mMessage->text();
673 mSipOtherMessageParameters = mParameters->text(); 674 mSipOtherMessageParameters = mParameters->text();
674 } 675 }
675 676
676 677
677} 678}
678 679
679void KDEPIMConfigWidget::updateClientWidgets() 680void KDEPIMConfigWidget::updateClientWidgets()
680{ 681{
681 bool blocked = signalsBlocked(); 682 bool blocked = signalsBlocked();
682 blockSignals( true ); 683 blockSignals( true );
683 684
684 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 685 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
685 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 686 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
686 if (it == mExternalAppsMap.end()) 687 if (it == mExternalAppsMap.end())
687 return; 688 return;
688 689
689 // update group box 690 // update group box
690 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 691 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
691 692
692 //update the entries in the client combobox 693 //update the entries in the client combobox
693 mClient->clear(); 694 mClient->clear();
694 695
695 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 696 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
696 DefaultAppItem* dai; 697 DefaultAppItem* dai;
697 for ( dai=items.first(); dai != 0; dai=items.next() ) 698 for ( dai=items.first(); dai != 0; dai=items.next() )
698 { 699 {
699 mClient->insertItem( i18n(dai->_label), dai->_id ); 700 mClient->insertItem( i18n(dai->_label), dai->_id );
700 701
701 if (dai->_id == mCurrentClient) 702 if (dai->_id == mCurrentClient)
702 { 703 {
703 //restore the edit fields with the data of the local membervariables if we had set it to "other". 704 //restore the edit fields with the data of the local membervariables if we had set it to "other".
704 //Otherwise take the default data from externalapphandler. 705 //Otherwise take the default data from externalapphandler.
705 mChannel->setText(dai->_channel); 706 mChannel->setText(dai->_channel);
706 mMessage->setText(dai->_message); 707 mMessage->setText(dai->_message);
707 mParameters->setText(dai->_parameters); 708 mParameters->setText(dai->_parameters);
708 if ( mMessage2 ) 709 if ( mMessage2 )
709 mMessage2->setText(dai->_message2); 710 mMessage2->setText(dai->_message2);
710 if ( mParameters2 ) 711 if ( mParameters2 )
711 mParameters2->setText(dai->_parameters2); 712 mParameters2->setText(dai->_parameters2);
712 713
713 714
714 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 715 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
715 { 716 {
716 mChannel->setText(mEmailOtherChannel); 717 mChannel->setText(mEmailOtherChannel);
717 mMessage->setText(mEmailOtherMessage); 718 mMessage->setText(mEmailOtherMessage);
718 mParameters->setText(mEmailOtherMessageParameters); 719 mParameters->setText(mEmailOtherMessageParameters);
719 if ( mMessage2 ) 720 if ( mMessage2 )
720 mMessage2->setText(mEmailOtherMessage2); 721 mMessage2->setText(mEmailOtherMessage2);
721 if ( mParameters2 ) 722 if ( mParameters2 )
722 mParameters2->setText(mEmailOtherMessageParameters2); 723 mParameters2->setText(mEmailOtherMessageParameters2);
723 } 724 }
724 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 725 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
725 { 726 {
726 mChannel->setText(mPhoneOtherChannel); 727 mChannel->setText(mPhoneOtherChannel);
727 mMessage->setText(mPhoneOtherMessage); 728 mMessage->setText(mPhoneOtherMessage);
728 mParameters->setText(mPhoneOtherMessageParameters); 729 mParameters->setText(mPhoneOtherMessageParameters);
729 } 730 }
730 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 731 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
731 { 732 {
732 mChannel->setText(mSMSOtherChannel); 733 mChannel->setText(mSMSOtherChannel);
733 mMessage->setText(mSMSOtherMessage); 734 mMessage->setText(mSMSOtherMessage);
734 mParameters->setText(mSMSOtherMessageParameters); 735 mParameters->setText(mSMSOtherMessageParameters);
735 } 736 }
736 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 737 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
737 { 738 {
738 mChannel->setText(mFaxOtherChannel); 739 mChannel->setText(mFaxOtherChannel);
739 mMessage->setText(mFaxOtherMessage); 740 mMessage->setText(mFaxOtherMessage);
740 mParameters->setText(mFaxOtherMessageParameters); 741 mParameters->setText(mFaxOtherMessageParameters);
741 } 742 }
742 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 743 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
743 { 744 {
744 mChannel->setText(mPagerOtherChannel); 745 mChannel->setText(mPagerOtherChannel);
745 mMessage->setText(mPagerOtherMessage); 746 mMessage->setText(mPagerOtherMessage);
746 mParameters->setText(mPagerOtherMessageParameters); 747 mParameters->setText(mPagerOtherMessageParameters);
747 } 748 }
748 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 749 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
749 { 750 {
750 mChannel->setText(mSipOtherChannel); 751 mChannel->setText(mSipOtherChannel);
751 mMessage->setText(mSipOtherMessage); 752 mMessage->setText(mSipOtherMessage);
752 mParameters->setText(mSipOtherMessageParameters); 753 mParameters->setText(mSipOtherMessageParameters);
753 } 754 }
754 } 755 }
755 756
756 } 757 }
757 758
758 bool readonly; 759 bool readonly;
759 bool enabled; 760 bool enabled;
760 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 761 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
761 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 762 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
762 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 763 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
763 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 764 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
764 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 765 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
765 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 766 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
766 { 767 {
767 readonly = false; 768 readonly = false;
768 } 769 }
769 else 770 else
770 { 771 {
771 readonly = true; 772 readonly = true;
772 } 773 }
773 774
774 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 775 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
775 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 776 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
776 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 777 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
777 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 778 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
778 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 779 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
779 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 780 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
780 { 781 {
781 enabled = false; 782 enabled = false;
782 } 783 }
783 else 784 else
784 { 785 {
785 enabled = true; 786 enabled = true;
786 } 787 }
787 788
788 789
789 mChannel->setReadOnly(readonly); 790 mChannel->setReadOnly(readonly);
790 mMessage->setReadOnly(readonly); 791 mMessage->setReadOnly(readonly);
791 mParameters->setReadOnly(readonly); 792 mParameters->setReadOnly(readonly);
792 if ( mMessage2 ) 793 if ( mMessage2 )
793 mMessage2->setReadOnly(readonly); 794 mMessage2->setReadOnly(readonly);
794 if ( mParameters2 ) 795 if ( mParameters2 )
795 mParameters2->setReadOnly(readonly); 796 mParameters2->setReadOnly(readonly);
796 797
797 mChannel->setEnabled(enabled); 798 mChannel->setEnabled(enabled);
798 mMessage->setEnabled(enabled); 799 mMessage->setEnabled(enabled);
799 mParameters->setEnabled(enabled); 800 mParameters->setEnabled(enabled);
800 if ( mMessage2 ) 801 if ( mMessage2 )
801 mMessage2->setEnabled(enabled); 802 mMessage2->setEnabled(enabled);
802 if ( mParameters2 ) 803 if ( mParameters2 )
803 mParameters2->setEnabled(enabled); 804 mParameters2->setEnabled(enabled);
804 805
805 806
806 807
807 mClient->setCurrentItem(mCurrentClient); 808 mClient->setCurrentItem(mCurrentClient);
808 809
809 810
810 // enable/disable the extra message/parameter field 811 // enable/disable the extra message/parameter field
811 if (mCurrentApp == ExternalAppHandler::EMAIL) 812 if (mCurrentApp == ExternalAppHandler::EMAIL)
812 { 813 {
813 } 814 }
814 else 815 else
815 { 816 {
816 if ( mMessage2 ) 817 if ( mMessage2 )
817 mMessage2->setText( "" ); 818 mMessage2->setText( "" );
818 if ( mParameters2 ) 819 if ( mParameters2 )
819 mParameters2->setText( "" ); 820 mParameters2->setText( "" );
820 } 821 }
821 822
822 if (enabled == true) { 823 if (enabled == true) {
823 if ( mMessage2 ) 824 if ( mMessage2 )
824 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 825 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
825 if ( mParameters2 ) 826 if ( mParameters2 )
826 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 827 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
827 } 828 }
828 829
829 830
830 blockSignals( blocked ); 831 blockSignals( blocked );
831 832
832} 833}
833 834
834void KDEPIMConfigWidget::usrReadConfig() 835void KDEPIMConfigWidget::usrReadConfig()
835{ 836{
836 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 837 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
837 838
838 bool blocked = signalsBlocked(); 839 bool blocked = signalsBlocked();
839 blockSignals( true ); 840 blockSignals( true );
840 841
841 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) 842 if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir )
842 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 843 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
843 else 844 else
844 mBackupUrl->setURL(prefs->mBackupDatadir); 845 mBackupUrl->setURL(prefs->mBackupDatadir);
845 mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); 846 mBackupNumbersSpin->setValue( prefs->mBackupNumbers );
846 mBackupDayCountSpin->setValue( prefs->mBackupDayCount); 847 mBackupDayCountSpin->setValue( prefs->mBackupDayCount);
847 848
848 QString dummy = prefs->mUserDateFormatLong; 849 QString dummy = prefs->mUserDateFormatLong;
849 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 850 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
850 dummy = prefs->mUserDateFormatShort; 851 dummy = prefs->mUserDateFormatShort;
851 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 852 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
852 853
853 QDate current ( 2001, 1,1); 854 QDate current ( 2001, 1,1);
854 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 855 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
855 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 856 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
856 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 857 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
857 858
858 mEmailClient = prefs->mEmailClient; 859 mEmailClient = prefs->mEmailClient;
859 mEmailOtherChannel = prefs->mEmailOtherChannel; 860 mEmailOtherChannel = prefs->mEmailOtherChannel;
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 96dc256..197bea2 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -1,47 +1,54 @@
1#include "kcolorbutton.h" 1#include "kcolorbutton.h"
2#include "kcolordialog.h" 2#include "kcolordialog.h"
3#include "qapplication.h" 3#include "qapplication.h"
4 4
5 5
6#include "qlayout.h" 6#include "qlayout.h"
7#ifdef DESKTOP_VERSION 7#ifdef DESKTOP_VERSION
8#include <qcolordialog.h> 8#include <qcolordialog.h>
9#endif 9#endif
10void KColorButton:: edit() 10void KColorButton:: edit()
11{ 11{
12 12
13#ifdef DESKTOP_VERSION 13#ifdef DESKTOP_VERSION
14 QColor col = QColorDialog::getColor ( mColor ); 14 QColor col = QColorDialog::getColor ( mColor );
15 if ( col.isValid () ) { 15 if ( col.isValid () ) {
16 mColor = col; 16 mColor = col;
17 setColor ( mColor ); 17 setColor ( mColor );
18 emit changed ( mColor ); 18 emit changed ( mColor );
19 emit changedID ( mColor, id );
19 } 20 }
20#else 21#else
21 KColorDialog* k = new KColorDialog( this ); 22 KColorDialog* k = new KColorDialog( this );
22 k->setColor( mColor ); 23 k->setColor( mColor );
23 int res = k->exec(); 24 int res = k->exec();
24 if ( res ) { 25 if ( res ) {
25 mColor = k->getColor(); 26 mColor = k->getColor();
26 setColor ( mColor ); 27 setColor ( mColor );
27 emit changed ( mColor ); 28 emit changed ( mColor );
29 emit changedID ( mColor, id );
28 } 30 }
29 delete k; 31 delete k;
30#endif 32#endif
31} 33}
32KColorButton::KColorButton( QWidget *p ):QPushButton( p ) 34KColorButton::KColorButton( QWidget *p ):QPushButton( p )
33{ 35{
34 int size = 24; 36 int size = 24;
35 if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 ) 37 if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 )
36 size = 18; 38 size = 18;
37 setFixedSize( size,size ); 39 setFixedSize( size,size );
40 int id = 0;
38 connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); 41 connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() ));
39 42
40} 43}
44void KColorButton::setID ( int i)
45{
46 id = i;
47}
41void KColorButton::setColor ( const QColor & c) 48void KColorButton::setColor ( const QColor & c)
42{ 49{
43 mColor = c; 50 mColor = c;
44 QPixmap pix ( height() - 4, width() - 4 ); 51 QPixmap pix ( height() - 4, width() - 4 );
45 pix.fill( c ); 52 pix.fill( c );
46 setPixmap ( pix ); 53 setPixmap ( pix );
47} 54}
diff --git a/microkde/kcolorbutton.h b/microkde/kcolorbutton.h
index 88b3774..983771b 100644
--- a/microkde/kcolorbutton.h
+++ b/microkde/kcolorbutton.h
@@ -1,26 +1,29 @@
1#ifndef MICROKDE_KCOLORBUTTON_H 1#ifndef MICROKDE_KCOLORBUTTON_H
2#define MICROKDE_KCOLORBUTTON_H 2#define MICROKDE_KCOLORBUTTON_H
3 3
4#include <qpushbutton.h> 4#include <qpushbutton.h>
5#include <qcolor.h> 5#include <qcolor.h>
6#include <kglobal.h> 6#include <kglobal.h>
7#include <qpixmap.h> 7#include <qpixmap.h>
8#include <qlabel.h> 8#include <qlabel.h>
9 9
10 10
11class KColorButton : public QPushButton 11class KColorButton : public QPushButton
12{ 12{
13Q_OBJECT 13Q_OBJECT
14public: 14public:
15 KColorButton( QWidget *p ); 15 KColorButton( QWidget *p );
16 void setColor ( const QColor &); 16 void setColor ( const QColor &);
17 void setID ( int i) ;
17 QColor color() const { return mColor ; } 18 QColor color() const { return mColor ; }
18 signals: 19 signals:
19 void changed(const QColor &); 20 void changed(const QColor &);
21 void changedID(const QColor &, int id);
20private slots: 22private slots:
21 void edit(); 23 void edit();
22 private: 24 private:
23 QColor mColor; 25 QColor mColor;
26 int id;
24}; 27};
25 28
26#endif 29#endif