author | zautrix <zautrix> | 2005-02-08 14:12:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-08 14:12:31 (UTC) |
commit | 41111b332c2a5f1b2ec152df309b9199f5e9c921 (patch) (unidiff) | |
tree | 3a2e5c5a25cdb52f542b2fe84a03f94599be2fe3 | |
parent | 9927a063f34bb826a4b5f7f7029308c9c66acbce (diff) | |
download | kdepimpi-41111b332c2a5f1b2ec152df309b9199f5e9c921.zip kdepimpi-41111b332c2a5f1b2ec152df309b9199f5e9c921.tar.gz kdepimpi-41111b332c2a5f1b2ec152df309b9199f5e9c921.tar.bz2 |
fixes
-rw-r--r-- | korganizer/calendarview.cpp | 33 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 28 | ||||
-rw-r--r-- | korganizer/ktimeedit.cpp | 8 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 27 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 3 | ||||
-rw-r--r-- | libkdepim/kdatepicker.cpp | 10 | ||||
-rw-r--r-- | microkde/kdatetbl.cpp | 26 | ||||
-rw-r--r-- | microkde/kglobalsettings.cpp | 10 |
10 files changed, 98 insertions, 55 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 0fbaa9a..a9de65a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2367,232 +2367,235 @@ void CalendarView::manageCategories() | |||
2367 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2367 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2368 | } else { | 2368 | } else { |
2369 | removeCategories(); | 2369 | removeCategories(); |
2370 | updateView(); | 2370 | updateView(); |
2371 | } | 2371 | } |
2372 | delete cp; | 2372 | delete cp; |
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | void CalendarView::beamIncidence(Incidence * Inc) | 2375 | void CalendarView::beamIncidence(Incidence * Inc) |
2376 | { | 2376 | { |
2377 | QPtrList<Incidence> delSel ; | 2377 | QPtrList<Incidence> delSel ; |
2378 | delSel.append(Inc); | 2378 | delSel.append(Inc); |
2379 | beamIncidenceList( delSel ); | 2379 | beamIncidenceList( delSel ); |
2380 | } | 2380 | } |
2381 | void CalendarView::beamCalendar() | 2381 | void CalendarView::beamCalendar() |
2382 | { | 2382 | { |
2383 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2383 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2384 | //qDebug("beamCalendar() "); | 2384 | //qDebug("beamCalendar() "); |
2385 | beamIncidenceList( delSel ); | 2385 | beamIncidenceList( delSel ); |
2386 | } | 2386 | } |
2387 | void CalendarView::beamFilteredCalendar() | 2387 | void CalendarView::beamFilteredCalendar() |
2388 | { | 2388 | { |
2389 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2389 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2390 | //qDebug("beamFilteredCalendar() "); | 2390 | //qDebug("beamFilteredCalendar() "); |
2391 | beamIncidenceList( delSel ); | 2391 | beamIncidenceList( delSel ); |
2392 | } | 2392 | } |
2393 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2393 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2394 | { | 2394 | { |
2395 | if ( beamDialog->exec () == QDialog::Rejected ) | 2395 | if ( beamDialog->exec () == QDialog::Rejected ) |
2396 | return; | 2396 | return; |
2397 | #ifdef DESKTOP_VERSION | 2397 | #ifdef DESKTOP_VERSION |
2398 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2398 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2399 | #else | 2399 | #else |
2400 | QString fn = "/tmp/kopibeamfile"; | 2400 | QString fn = "/tmp/kopibeamfile"; |
2401 | #endif | 2401 | #endif |
2402 | QString mes; | 2402 | QString mes; |
2403 | bool createbup = true; | 2403 | bool createbup = true; |
2404 | if ( createbup ) { | 2404 | if ( createbup ) { |
2405 | QString description = "\n"; | 2405 | QString description = "\n"; |
2406 | CalendarLocal* cal = new CalendarLocal(); | 2406 | CalendarLocal* cal = new CalendarLocal(); |
2407 | if ( beamDialog->beamLocal() ) | 2407 | if ( beamDialog->beamLocal() ) |
2408 | cal->setLocalTime(); | 2408 | cal->setLocalTime(); |
2409 | else | 2409 | else |
2410 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2410 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2411 | Incidence *incidence = delSel.first(); | 2411 | Incidence *incidence = delSel.first(); |
2412 | bool addText = false; | 2412 | bool addText = false; |
2413 | if ( delSel.count() < 10 ) | 2413 | if ( delSel.count() < 10 ) |
2414 | addText = true; | 2414 | addText = true; |
2415 | else { | 2415 | else { |
2416 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2416 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2417 | } | 2417 | } |
2418 | while ( incidence ) { | 2418 | while ( incidence ) { |
2419 | Incidence *in = incidence->clone(); | 2419 | Incidence *in = incidence->clone(); |
2420 | if ( ! in->summary().isEmpty() ) { | 2420 | if ( ! in->summary().isEmpty() ) { |
2421 | in->setDescription(""); | 2421 | in->setDescription(""); |
2422 | } else { | 2422 | } else { |
2423 | in->setSummary( in->description().left(20)); | 2423 | in->setSummary( in->description().left(20)); |
2424 | in->setDescription(""); | 2424 | in->setDescription(""); |
2425 | } | 2425 | } |
2426 | if ( addText ) | 2426 | if ( addText ) |
2427 | description += in->summary() + "\n"; | 2427 | description += in->summary() + "\n"; |
2428 | cal->addIncidence( in ); | 2428 | cal->addIncidence( in ); |
2429 | incidence = delSel.next(); | 2429 | incidence = delSel.next(); |
2430 | } | 2430 | } |
2431 | if ( beamDialog->beamVcal() ) { | 2431 | if ( beamDialog->beamVcal() ) { |
2432 | fn += ".vcs"; | 2432 | fn += ".vcs"; |
2433 | FileStorage storage( cal, fn, new VCalFormat ); | 2433 | FileStorage storage( cal, fn, new VCalFormat ); |
2434 | storage.save(); | 2434 | storage.save(); |
2435 | } else { | 2435 | } else { |
2436 | fn += ".ics"; | 2436 | fn += ".ics"; |
2437 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2437 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2438 | storage.save(); | 2438 | storage.save(); |
2439 | } | 2439 | } |
2440 | delete cal; | 2440 | delete cal; |
2441 | mes = i18n("KO/Pi: Ready for beaming"); | 2441 | mes = i18n("KO/Pi: Ready for beaming"); |
2442 | topLevelWidget()->setCaption(mes); | 2442 | topLevelWidget()->setCaption(mes); |
2443 | KApplication::convert2latin1( fn ); | 2443 | KApplication::convert2latin1( fn ); |
2444 | #ifndef DESKTOP_VERSION | 2444 | #ifndef DESKTOP_VERSION |
2445 | Ir *ir = new Ir( this ); | 2445 | Ir *ir = new Ir( this ); |
2446 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2446 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2447 | ir->send( fn, description, "text/x-vCalendar" ); | 2447 | ir->send( fn, description, "text/x-vCalendar" ); |
2448 | #endif | 2448 | #endif |
2449 | } | 2449 | } |
2450 | } | 2450 | } |
2451 | void CalendarView::beamDone( Ir *ir ) | 2451 | void CalendarView::beamDone( Ir *ir ) |
2452 | { | 2452 | { |
2453 | #ifndef DESKTOP_VERSION | 2453 | #ifndef DESKTOP_VERSION |
2454 | delete ir; | 2454 | delete ir; |
2455 | #endif | 2455 | #endif |
2456 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2456 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2457 | topLevelWidget()->raise(); | 2457 | topLevelWidget()->raise(); |
2458 | } | 2458 | } |
2459 | 2459 | ||
2460 | void CalendarView::moveIncidence(Incidence * inc ) | 2460 | void CalendarView::moveIncidence(Incidence * inc ) |
2461 | { | 2461 | { |
2462 | if ( !inc ) return; | 2462 | if ( !inc ) return; |
2463 | // qDebug("showDatePickerForIncidence( ) "); | 2463 | showDatePickerPopup(); |
2464 | if ( mDateFrame->isVisible() ) | ||
2465 | mDateFrame->hide(); | ||
2466 | else { | ||
2467 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | ||
2468 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | ||
2469 | int dw = QApplication::desktop()->width(); | ||
2470 | int dh = QApplication::desktop()->height(); | ||
2471 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
2472 | mDateFrame->show(); | ||
2473 | } | ||
2474 | mDatePickerMode = 2; | 2464 | mDatePickerMode = 2; |
2475 | mMoveIncidence = inc ; | 2465 | mMoveIncidence = inc ; |
2476 | QDate da; | 2466 | QDate da; |
2477 | if ( mMoveIncidence->type() == "Todo" ) { | 2467 | if ( mMoveIncidence->type() == "Todo" ) { |
2478 | Todo * to = (Todo *) mMoveIncidence; | 2468 | Todo * to = (Todo *) mMoveIncidence; |
2479 | if ( to->hasDueDate() ) | 2469 | if ( to->hasDueDate() ) |
2480 | da = to->dtDue().date(); | 2470 | da = to->dtDue().date(); |
2481 | else | 2471 | else |
2482 | da = QDate::currentDate(); | 2472 | da = QDate::currentDate(); |
2483 | } else { | 2473 | } else { |
2484 | da = mMoveIncidence->dtStart().date(); | 2474 | da = mMoveIncidence->dtStart().date(); |
2485 | } | 2475 | } |
2486 | //PENDING set date for recurring incidence to date of recurrence | 2476 | //PENDING set date for recurring incidence to date of recurrence |
2487 | //mMoveIncidenceOldDate; | 2477 | //mMoveIncidenceOldDate; |
2488 | mDatePicker->setDate( da ); | 2478 | mDatePicker->setDate( da ); |
2489 | } | 2479 | } |
2490 | void CalendarView::showDatePicker( ) | 2480 | void CalendarView::showDatePickerPopup() |
2491 | { | 2481 | { |
2492 | //qDebug("CalendarView::showDatePicker( ) "); | 2482 | if ( mDateFrame->isVisible() ) |
2493 | if ( mDateFrame->isVisible() ) | ||
2494 | mDateFrame->hide(); | 2483 | mDateFrame->hide(); |
2495 | else { | 2484 | else { |
2485 | int offX = 0, offY = 0; | ||
2486 | #ifdef DESKTOP_VERSION | ||
2487 | int w =mDatePicker->sizeHint().width() ; | ||
2488 | int h = mDatePicker->sizeHint().height() ; | ||
2489 | int dw = topLevelWidget()->width(); | ||
2490 | int dh = topLevelWidget()->height(); | ||
2491 | offX = topLevelWidget()->x(); | ||
2492 | offY = topLevelWidget()->y(); | ||
2493 | #else | ||
2496 | int w =mDatePicker->sizeHint().width() ; | 2494 | int w =mDatePicker->sizeHint().width() ; |
2497 | int h = mDatePicker->sizeHint().height() ; | 2495 | int h = mDatePicker->sizeHint().height() ; |
2498 | int dw = QApplication::desktop()->width(); | 2496 | int dw = QApplication::desktop()->width(); |
2499 | int dh = QApplication::desktop()->height(); | 2497 | int dh = QApplication::desktop()->height(); |
2500 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2498 | #endif |
2499 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | ||
2501 | mDateFrame->show(); | 2500 | mDateFrame->show(); |
2502 | } | 2501 | } |
2502 | } | ||
2503 | void CalendarView::showDatePicker( ) | ||
2504 | { | ||
2505 | showDatePickerPopup(); | ||
2503 | mDatePickerMode = 1; | 2506 | mDatePickerMode = 1; |
2504 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2507 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2505 | } | 2508 | } |
2506 | 2509 | ||
2507 | void CalendarView::showEventEditor() | 2510 | void CalendarView::showEventEditor() |
2508 | { | 2511 | { |
2509 | #ifdef DESKTOP_VERSION | 2512 | #ifdef DESKTOP_VERSION |
2510 | mEventEditor->show(); | 2513 | mEventEditor->show(); |
2511 | #else | 2514 | #else |
2512 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2515 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2513 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2516 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2514 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2517 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2515 | qApp->processEvents(); | 2518 | qApp->processEvents(); |
2516 | delete mEventEditor; | 2519 | delete mEventEditor; |
2517 | mEventEditor = mDialogManager->getEventEditor(); | 2520 | mEventEditor = mDialogManager->getEventEditor(); |
2518 | topLevelWidget()->setCaption( i18n("") ); | 2521 | topLevelWidget()->setCaption( i18n("") ); |
2519 | } | 2522 | } |
2520 | mEventEditor->showMaximized(); | 2523 | mEventEditor->showMaximized(); |
2521 | #endif | 2524 | #endif |
2522 | } | 2525 | } |
2523 | void CalendarView::showTodoEditor() | 2526 | void CalendarView::showTodoEditor() |
2524 | { | 2527 | { |
2525 | #ifdef DESKTOP_VERSION | 2528 | #ifdef DESKTOP_VERSION |
2526 | mTodoEditor->show(); | 2529 | mTodoEditor->show(); |
2527 | #else | 2530 | #else |
2528 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2531 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2529 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2532 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2530 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2533 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2531 | qApp->processEvents(); | 2534 | qApp->processEvents(); |
2532 | delete mTodoEditor; | 2535 | delete mTodoEditor; |
2533 | mTodoEditor = mDialogManager->getTodoEditor(); | 2536 | mTodoEditor = mDialogManager->getTodoEditor(); |
2534 | topLevelWidget()->setCaption( i18n("") ); | 2537 | topLevelWidget()->setCaption( i18n("") ); |
2535 | } | 2538 | } |
2536 | mTodoEditor->showMaximized(); | 2539 | mTodoEditor->showMaximized(); |
2537 | #endif | 2540 | #endif |
2538 | } | 2541 | } |
2539 | 2542 | ||
2540 | void CalendarView::cloneIncidence() | 2543 | void CalendarView::cloneIncidence() |
2541 | { | 2544 | { |
2542 | Incidence *incidence = currentSelection(); | 2545 | Incidence *incidence = currentSelection(); |
2543 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2546 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2544 | if ( incidence ) { | 2547 | if ( incidence ) { |
2545 | cloneIncidence(incidence); | 2548 | cloneIncidence(incidence); |
2546 | } | 2549 | } |
2547 | } | 2550 | } |
2548 | void CalendarView::moveIncidence() | 2551 | void CalendarView::moveIncidence() |
2549 | { | 2552 | { |
2550 | Incidence *incidence = currentSelection(); | 2553 | Incidence *incidence = currentSelection(); |
2551 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2554 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2552 | if ( incidence ) { | 2555 | if ( incidence ) { |
2553 | moveIncidence(incidence); | 2556 | moveIncidence(incidence); |
2554 | } | 2557 | } |
2555 | } | 2558 | } |
2556 | void CalendarView::beamIncidence() | 2559 | void CalendarView::beamIncidence() |
2557 | { | 2560 | { |
2558 | Incidence *incidence = currentSelection(); | 2561 | Incidence *incidence = currentSelection(); |
2559 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2562 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2560 | if ( incidence ) { | 2563 | if ( incidence ) { |
2561 | beamIncidence(incidence); | 2564 | beamIncidence(incidence); |
2562 | } | 2565 | } |
2563 | } | 2566 | } |
2564 | void CalendarView::toggleCancelIncidence() | 2567 | void CalendarView::toggleCancelIncidence() |
2565 | { | 2568 | { |
2566 | Incidence *incidence = currentSelection(); | 2569 | Incidence *incidence = currentSelection(); |
2567 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2570 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2568 | if ( incidence ) { | 2571 | if ( incidence ) { |
2569 | cancelIncidence(incidence); | 2572 | cancelIncidence(incidence); |
2570 | } | 2573 | } |
2571 | } | 2574 | } |
2572 | 2575 | ||
2573 | 2576 | ||
2574 | void CalendarView::cancelIncidence(Incidence * inc ) | 2577 | void CalendarView::cancelIncidence(Incidence * inc ) |
2575 | { | 2578 | { |
2576 | inc->setCancelled( ! inc->cancelled() ); | 2579 | inc->setCancelled( ! inc->cancelled() ); |
2577 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2580 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2578 | updateView(); | 2581 | updateView(); |
2579 | } | 2582 | } |
2580 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2583 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2581 | { | 2584 | { |
2582 | Incidence * newInc = orgInc->clone(); | 2585 | Incidence * newInc = orgInc->clone(); |
2583 | newInc->recreate(); | 2586 | newInc->recreate(); |
2584 | 2587 | ||
2585 | if ( newInc->type() == "Todo" ) { | 2588 | if ( newInc->type() == "Todo" ) { |
2586 | Todo* t = (Todo*) newInc; | 2589 | Todo* t = (Todo*) newInc; |
2587 | showTodoEditor(); | 2590 | showTodoEditor(); |
2588 | mTodoEditor->editTodo( t ); | 2591 | mTodoEditor->editTodo( t ); |
2589 | if ( mTodoEditor->exec() ) { | 2592 | if ( mTodoEditor->exec() ) { |
2590 | mCalendar->addTodo( t ); | 2593 | mCalendar->addTodo( t ); |
2591 | updateView(); | 2594 | updateView(); |
2592 | } else { | 2595 | } else { |
2593 | delete t; | 2596 | delete t; |
2594 | } | 2597 | } |
2595 | } | 2598 | } |
2596 | else { | 2599 | else { |
2597 | Event* e = (Event*) newInc; | 2600 | Event* e = (Event*) newInc; |
2598 | showEventEditor(); | 2601 | showEventEditor(); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 731298d..e626ea3 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -348,193 +348,194 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
348 | /** | 348 | /** |
349 | * pop up dialog confirming deletion of currently selected event in the | 349 | * pop up dialog confirming deletion of currently selected event in the |
350 | * View. | 350 | * View. |
351 | */ | 351 | */ |
352 | void appointment_delete(); | 352 | void appointment_delete(); |
353 | 353 | ||
354 | /** mails the currently selected event to a particular user as a vCalendar | 354 | /** mails the currently selected event to a particular user as a vCalendar |
355 | attachment. */ | 355 | attachment. */ |
356 | void action_mail(); | 356 | void action_mail(); |
357 | 357 | ||
358 | /* frees a subtodo from it's relation */ | 358 | /* frees a subtodo from it's relation */ |
359 | void todo_unsub( Todo * ); | 359 | void todo_unsub( Todo * ); |
360 | void todo_resub( Todo * parent, Todo * sub ); | 360 | void todo_resub( Todo * parent, Todo * sub ); |
361 | 361 | ||
362 | /** Take ownership of selected event. */ | 362 | /** Take ownership of selected event. */ |
363 | void takeOverEvent(); | 363 | void takeOverEvent(); |
364 | 364 | ||
365 | /** Take ownership of all events in calendar. */ | 365 | /** Take ownership of all events in calendar. */ |
366 | void takeOverCalendar(); | 366 | void takeOverCalendar(); |
367 | 367 | ||
368 | /** query whether or not the calendar is "dirty". */ | 368 | /** query whether or not the calendar is "dirty". */ |
369 | bool isModified(); | 369 | bool isModified(); |
370 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 370 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
371 | void setModified(bool modified=true); | 371 | void setModified(bool modified=true); |
372 | 372 | ||
373 | /** query if the calendar is read-only. */ | 373 | /** query if the calendar is read-only. */ |
374 | bool isReadOnly(); | 374 | bool isReadOnly(); |
375 | /** set state of calendar to read-only */ | 375 | /** set state of calendar to read-only */ |
376 | void setReadOnly(bool readOnly=true); | 376 | void setReadOnly(bool readOnly=true); |
377 | 377 | ||
378 | void eventUpdated(Incidence *); | 378 | void eventUpdated(Incidence *); |
379 | 379 | ||
380 | /* iTIP scheduling actions */ | 380 | /* iTIP scheduling actions */ |
381 | void schedule_publish(Incidence *incidence = 0); | 381 | void schedule_publish(Incidence *incidence = 0); |
382 | void schedule_request(Incidence *incidence = 0); | 382 | void schedule_request(Incidence *incidence = 0); |
383 | void schedule_refresh(Incidence *incidence = 0); | 383 | void schedule_refresh(Incidence *incidence = 0); |
384 | void schedule_cancel(Incidence *incidence = 0); | 384 | void schedule_cancel(Incidence *incidence = 0); |
385 | void schedule_add(Incidence *incidence = 0); | 385 | void schedule_add(Incidence *incidence = 0); |
386 | void schedule_reply(Incidence *incidence = 0); | 386 | void schedule_reply(Incidence *incidence = 0); |
387 | void schedule_counter(Incidence *incidence = 0); | 387 | void schedule_counter(Incidence *incidence = 0); |
388 | void schedule_declinecounter(Incidence *incidence = 0); | 388 | void schedule_declinecounter(Incidence *incidence = 0); |
389 | void schedule_publish_freebusy(int daysToPublish = 30); | 389 | void schedule_publish_freebusy(int daysToPublish = 30); |
390 | 390 | ||
391 | void openAddressbook(); | 391 | void openAddressbook(); |
392 | 392 | ||
393 | void editFilters(); | 393 | void editFilters(); |
394 | void toggleFilerEnabled(); | 394 | void toggleFilerEnabled(); |
395 | QPtrList<CalFilter> filters(); | 395 | QPtrList<CalFilter> filters(); |
396 | void toggleFilter(); | 396 | void toggleFilter(); |
397 | void showFilter(bool visible); | 397 | void showFilter(bool visible); |
398 | void updateFilter(); | 398 | void updateFilter(); |
399 | void filterEdited(); | 399 | void filterEdited(); |
400 | void selectFilter( int ); | 400 | void selectFilter( int ); |
401 | KOFilterView *filterView(); | 401 | KOFilterView *filterView(); |
402 | 402 | ||
403 | void showIntro(); | 403 | void showIntro(); |
404 | 404 | ||
405 | /** Move the curdatepient view date to today */ | 405 | /** Move the curdatepient view date to today */ |
406 | void goToday(); | 406 | void goToday(); |
407 | 407 | ||
408 | /** Move to the next date(s) in the current view */ | 408 | /** Move to the next date(s) in the current view */ |
409 | void goNext(); | 409 | void goNext(); |
410 | 410 | ||
411 | /** Move to the previous date(s) in the current view */ | 411 | /** Move to the previous date(s) in the current view */ |
412 | void goPrevious(); | 412 | void goPrevious(); |
413 | /** Move to the next date(s) in the current view */ | 413 | /** Move to the next date(s) in the current view */ |
414 | void goNextMonth(); | 414 | void goNextMonth(); |
415 | 415 | ||
416 | /** Move to the previous date(s) in the current view */ | 416 | /** Move to the previous date(s) in the current view */ |
417 | void goPreviousMonth(); | 417 | void goPreviousMonth(); |
418 | 418 | ||
419 | void toggleExpand(); | 419 | void toggleExpand(); |
420 | void toggleDateNavigatorWidget(); | 420 | void toggleDateNavigatorWidget(); |
421 | void toggleAllDaySize(); | 421 | void toggleAllDaySize(); |
422 | void dialogClosing(Incidence *); | 422 | void dialogClosing(Incidence *); |
423 | 423 | ||
424 | /** Look for new messages in the inbox */ | 424 | /** Look for new messages in the inbox */ |
425 | void lookForIncomingMessages(); | 425 | void lookForIncomingMessages(); |
426 | /** Look for new messages in the outbox */ | 426 | /** Look for new messages in the outbox */ |
427 | void lookForOutgoingMessages(); | 427 | void lookForOutgoingMessages(); |
428 | 428 | ||
429 | void processMainViewSelection( Incidence * ); | 429 | void processMainViewSelection( Incidence * ); |
430 | void processTodoListSelection( Incidence * ); | 430 | void processTodoListSelection( Incidence * ); |
431 | 431 | ||
432 | void processIncidenceSelection( Incidence * ); | 432 | void processIncidenceSelection( Incidence * ); |
433 | 433 | ||
434 | void purgeCompleted(); | 434 | void purgeCompleted(); |
435 | bool removeCompletedSubTodos( Todo* ); | 435 | bool removeCompletedSubTodos( Todo* ); |
436 | void slotCalendarChanged(); | 436 | void slotCalendarChanged(); |
437 | bool importBday(); | 437 | bool importBday(); |
438 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 438 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
439 | bool importQtopia( const QString &categoriesFile, | 439 | bool importQtopia( const QString &categoriesFile, |
440 | const QString &datebookFile, | 440 | const QString &datebookFile, |
441 | const QString &tasklistFile ); | 441 | const QString &tasklistFile ); |
442 | void syncExternal( int mode ); | 442 | void syncExternal( int mode ); |
443 | void slotSelectPickerDate( QDate ) ; | 443 | void slotSelectPickerDate( QDate ) ; |
444 | void showDatePicker( ) ; | 444 | void showDatePicker() ; |
445 | void showDatePickerPopup() ; | ||
445 | void moveIncidence(Incidence *) ; | 446 | void moveIncidence(Incidence *) ; |
446 | void beamIncidence(Incidence *) ; | 447 | void beamIncidence(Incidence *) ; |
447 | void beamCalendar() ; | 448 | void beamCalendar() ; |
448 | void beamFilteredCalendar() ; | 449 | void beamFilteredCalendar() ; |
449 | void beamIncidenceList(QPtrList<Incidence>) ; | 450 | void beamIncidenceList(QPtrList<Incidence>) ; |
450 | void manageCategories(); | 451 | void manageCategories(); |
451 | int addCategories(); | 452 | int addCategories(); |
452 | void removeCategories(); | 453 | void removeCategories(); |
453 | void setSyncDevice( QString ); | 454 | void setSyncDevice( QString ); |
454 | void setSyncName( QString ); | 455 | void setSyncName( QString ); |
455 | void showDay( QDate ); | 456 | void showDay( QDate ); |
456 | void undo_delete(); | 457 | void undo_delete(); |
457 | protected slots: | 458 | protected slots: |
458 | void timerAlarm(); | 459 | void timerAlarm(); |
459 | void suspendAlarm(); | 460 | void suspendAlarm(); |
460 | void beamDone( Ir *ir ); | 461 | void beamDone( Ir *ir ); |
461 | /** Select a view or adapt the current view to display the specified dates. */ | 462 | /** Select a view or adapt the current view to display the specified dates. */ |
462 | void showDates( const KCal::DateList & ); | 463 | void showDates( const KCal::DateList & ); |
463 | void selectWeekNum ( int ); | 464 | void selectWeekNum ( int ); |
464 | 465 | ||
465 | public: | 466 | public: |
466 | // show a standard warning | 467 | // show a standard warning |
467 | // returns KMsgBox::yesNoCancel() | 468 | // returns KMsgBox::yesNoCancel() |
468 | int msgCalModified(); | 469 | int msgCalModified(); |
469 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 470 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
470 | 471 | ||
471 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 472 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
472 | virtual void removeSyncInfo( QString syncProfile); | 473 | virtual void removeSyncInfo( QString syncProfile); |
473 | void setSyncManager(KSyncManager* manager); | 474 | void setSyncManager(KSyncManager* manager); |
474 | void setLoadedFileVersion(QDateTime); | 475 | void setLoadedFileVersion(QDateTime); |
475 | bool checkFileVersion(QString fn); | 476 | bool checkFileVersion(QString fn); |
476 | bool checkFileChanged(QString fn); | 477 | bool checkFileChanged(QString fn); |
477 | Event* getLastSyncEvent(); | 478 | Event* getLastSyncEvent(); |
478 | /** Adapt navigation units correpsonding to step size of navigation of the | 479 | /** Adapt navigation units correpsonding to step size of navigation of the |
479 | * current view. | 480 | * current view. |
480 | */ | 481 | */ |
481 | void adaptNavigationUnits(); | 482 | void adaptNavigationUnits(); |
482 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 483 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
483 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 484 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
484 | //Attendee* getYourAttendee(Event *event); | 485 | //Attendee* getYourAttendee(Event *event); |
485 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 486 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
486 | protected: | 487 | protected: |
487 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 488 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
488 | 489 | ||
489 | // returns KMsgBox::OKCandel() | 490 | // returns KMsgBox::OKCandel() |
490 | int msgItemDelete(const QString name); | 491 | int msgItemDelete(const QString name); |
491 | void showEventEditor(); | 492 | void showEventEditor(); |
492 | void showTodoEditor(); | 493 | void showTodoEditor(); |
493 | void writeLocale(); | 494 | void writeLocale(); |
494 | Todo *selectedTodo(); | 495 | Todo *selectedTodo(); |
495 | 496 | ||
496 | private: | 497 | private: |
497 | bool mBlockShowDates; | 498 | bool mBlockShowDates; |
498 | KSyncManager* mSyncManager; | 499 | KSyncManager* mSyncManager; |
499 | AlarmDialog * mAlarmDialog; | 500 | AlarmDialog * mAlarmDialog; |
500 | QString mAlarmNotification; | 501 | QString mAlarmNotification; |
501 | QString mSuspendAlarmNotification; | 502 | QString mSuspendAlarmNotification; |
502 | QTimer* mSuspendTimer; | 503 | QTimer* mSuspendTimer; |
503 | QTimer* mAlarmTimer; | 504 | QTimer* mAlarmTimer; |
504 | QTimer* mRecheckAlarmTimer; | 505 | QTimer* mRecheckAlarmTimer; |
505 | void computeAlarm( QString ); | 506 | void computeAlarm( QString ); |
506 | void startAlarm( QString, QString ); | 507 | void startAlarm( QString, QString ); |
507 | void setSyncEventsReadOnly(); | 508 | void setSyncEventsReadOnly(); |
508 | 509 | ||
509 | QDateTime loadedFileVersion; | 510 | QDateTime loadedFileVersion; |
510 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 511 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
511 | void checkExternalId( Incidence * inc ); | 512 | void checkExternalId( Incidence * inc ); |
512 | int mGlobalSyncMode; | 513 | int mGlobalSyncMode; |
513 | QString mCurrentSyncDevice; | 514 | QString mCurrentSyncDevice; |
514 | QString mCurrentSyncName; | 515 | QString mCurrentSyncName; |
515 | KOBeamPrefs* beamDialog; | 516 | KOBeamPrefs* beamDialog; |
516 | void init(); | 517 | void init(); |
517 | int mDatePickerMode; | 518 | int mDatePickerMode; |
518 | bool mFlagEditDescription; | 519 | bool mFlagEditDescription; |
519 | QDateTime mLastCalendarSync; | 520 | QDateTime mLastCalendarSync; |
520 | void createPrinter(); | 521 | void createPrinter(); |
521 | 522 | ||
522 | void calendarModified( bool, Calendar * ); | 523 | void calendarModified( bool, Calendar * ); |
523 | 524 | ||
524 | CalPrinter *mCalPrinter; | 525 | CalPrinter *mCalPrinter; |
525 | 526 | ||
526 | QSplitter *mPanner; | 527 | QSplitter *mPanner; |
527 | QSplitter *mLeftSplitter; | 528 | QSplitter *mLeftSplitter; |
528 | QWidget *mLeftFrame; | 529 | QWidget *mLeftFrame; |
529 | QWidgetStack *mRightFrame; | 530 | QWidgetStack *mRightFrame; |
530 | 531 | ||
531 | KDatePicker* mDatePicker; | 532 | KDatePicker* mDatePicker; |
532 | QVBox* mDateFrame; | 533 | QVBox* mDateFrame; |
533 | 534 | ||
534 | KDateNavigator *mDateNavigator; // widget showing small month view. | 535 | KDateNavigator *mDateNavigator; // widget showing small month view. |
535 | 536 | ||
536 | KOFilterView *mFilterView; | 537 | KOFilterView *mFilterView; |
537 | 538 | ||
538 | ResourceView *mResourceView; | 539 | ResourceView *mResourceView; |
539 | 540 | ||
540 | // calendar object for this viewing instance | 541 | // calendar object for this viewing instance |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 6ae4c6f..02d2585 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -832,194 +832,197 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
832 | label->setFont(bfont); | 832 | label->setFont(bfont); |
833 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 833 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
834 | label->setLineWidth(1); | 834 | label->setLineWidth(1); |
835 | label->setAlignment(AlignCenter); | 835 | label->setAlignment(AlignCenter); |
836 | mDayLabels.insert( i, label ); | 836 | mDayLabels.insert( i, label ); |
837 | label = new QLabel( mWeekView ); | 837 | label = new QLabel( mWeekView ); |
838 | label->setFont(bfont); | 838 | label->setFont(bfont); |
839 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 839 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
840 | label->setLineWidth(1); | 840 | label->setLineWidth(1); |
841 | label->setAlignment(AlignCenter); | 841 | label->setAlignment(AlignCenter); |
842 | mDayLabelsW.insert( i, label ); | 842 | mDayLabelsW.insert( i, label ); |
843 | } | 843 | } |
844 | 844 | ||
845 | bfont.setBold( false ); | 845 | bfont.setBold( false ); |
846 | mWeekLabels.resize( mNumWeeks+1 ); | 846 | mWeekLabels.resize( mNumWeeks+1 ); |
847 | mWeekLabelsW.resize( 2 ); | 847 | mWeekLabelsW.resize( 2 ); |
848 | for( i = 0; i < mNumWeeks+1; i++ ) { | 848 | for( i = 0; i < mNumWeeks+1; i++ ) { |
849 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 849 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
850 | label->setFocusPolicy(NoFocus); | 850 | label->setFocusPolicy(NoFocus); |
851 | label->setFont(bfont); | 851 | label->setFont(bfont); |
852 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 852 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
853 | label->setFlat(true); | 853 | label->setFlat(true); |
854 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 854 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
855 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 855 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
856 | //label->setLineWidth(1); | 856 | //label->setLineWidth(1); |
857 | //label->setAlignment(AlignCenter); | 857 | //label->setAlignment(AlignCenter); |
858 | mWeekLabels.insert( i, label ); | 858 | mWeekLabels.insert( i, label ); |
859 | } | 859 | } |
860 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 860 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
861 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 861 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
862 | 862 | ||
863 | for( i = 0; i < 1+1; i++ ) { | 863 | for( i = 0; i < 1+1; i++ ) { |
864 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 864 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
865 | label->setFocusPolicy(NoFocus); | 865 | label->setFocusPolicy(NoFocus); |
866 | label->setFont(bfont); | 866 | label->setFont(bfont); |
867 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 867 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
868 | label->setFlat(true); | 868 | label->setFlat(true); |
869 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 869 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
870 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 870 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
871 | //label->setLineWidth(1); | 871 | //label->setLineWidth(1); |
872 | //label->setAlignment(AlignCenter); | 872 | //label->setAlignment(AlignCenter); |
873 | mWeekLabelsW.insert( i, label ); | 873 | mWeekLabelsW.insert( i, label ); |
874 | } | 874 | } |
875 | mWeekLabelsW[1]->setText( i18n("W")); | 875 | mWeekLabelsW[1]->setText( i18n("W")); |
876 | 876 | ||
877 | 877 | ||
878 | int row, col; | 878 | int row, col; |
879 | mCells.resize( mNumCells ); | 879 | mCells.resize( mNumCells ); |
880 | for( row = 0; row < mNumWeeks; ++row ) { | 880 | for( row = 0; row < mNumWeeks; ++row ) { |
881 | for( col = 0; col < mDaysPerWeek; ++col ) { | 881 | for( col = 0; col < mDaysPerWeek; ++col ) { |
882 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 882 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
883 | mCells.insert( row * mDaysPerWeek + col, cell ); | 883 | mCells.insert( row * mDaysPerWeek + col, cell ); |
884 | 884 | ||
885 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 885 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
886 | SLOT( defaultAction( Incidence * ) ) ); | 886 | SLOT( defaultAction( Incidence * ) ) ); |
887 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 887 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
888 | SIGNAL( newEventSignal( QDateTime ) ) ); | 888 | SIGNAL( newEventSignal( QDateTime ) ) ); |
889 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 889 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
890 | SIGNAL( showDaySignal( QDate ) ) ); | 890 | SIGNAL( showDaySignal( QDate ) ) ); |
891 | } | 891 | } |
892 | } | 892 | } |
893 | mCellsW.resize( mDaysPerWeek ); | 893 | mCellsW.resize( mDaysPerWeek ); |
894 | for( col = 0; col < mDaysPerWeek; ++col ) { | 894 | for( col = 0; col < mDaysPerWeek; ++col ) { |
895 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 895 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
896 | mCellsW.insert( col, cell ); | 896 | mCellsW.insert( col, cell ); |
897 | 897 | ||
898 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 898 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
899 | SLOT( defaultAction( Incidence * ) ) ); | 899 | SLOT( defaultAction( Incidence * ) ) ); |
900 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 900 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
901 | SIGNAL( newEventSignal( QDateTime ) ) ); | 901 | SIGNAL( newEventSignal( QDateTime ) ) ); |
902 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 902 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
903 | SIGNAL( showDaySignal( QDate ) ) ); | 903 | SIGNAL( showDaySignal( QDate ) ) ); |
904 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 904 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
905 | } | 905 | } |
906 | 906 | ||
907 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 907 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
908 | mContextMenu = eventPopup(); | 908 | mContextMenu = eventPopup(); |
909 | // updateConfig(); //useless here... | 909 | // updateConfig(); //useless here... |
910 | // ... but we need mWidthLongDayLabel computed | 910 | // ... but we need mWidthLongDayLabel computed |
911 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 911 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
912 | mWidthLongDayLabel = 0; | 912 | mWidthLongDayLabel = 0; |
913 | for (int i = 0; i < 7; i++) { | 913 | for (int i = 0; i < 7; i++) { |
914 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 914 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
915 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 915 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
916 | } | 916 | } |
917 | 917 | ||
918 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 918 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
919 | 919 | ||
920 | if ( mShowWeekView ) | 920 | if ( mShowWeekView ) |
921 | mWidStack->raiseWidget( mWeekView ); | 921 | mWidStack->raiseWidget( mWeekView ); |
922 | else | 922 | else |
923 | mWidStack->raiseWidget( mMonthView ); | 923 | mWidStack->raiseWidget( mMonthView ); |
924 | 924 | ||
925 | emit incidenceSelected( 0 ); | 925 | emit incidenceSelected( 0 ); |
926 | #ifndef DESKTOP_VERSION | 926 | #ifndef DESKTOP_VERSION |
927 | resize( QApplication::desktop()->size() ); | 927 | resize( QApplication::desktop()->size() ); |
928 | computeLayout(); | 928 | #else |
929 | resize(640, 480 ); | ||
929 | #endif | 930 | #endif |
931 | computeLayout(); | ||
932 | |||
930 | } | 933 | } |
931 | 934 | ||
932 | KOMonthView::~KOMonthView() | 935 | KOMonthView::~KOMonthView() |
933 | { | 936 | { |
934 | delete mContextMenu; | 937 | delete mContextMenu; |
935 | } | 938 | } |
936 | 939 | ||
937 | void KOMonthView::selectInternalWeekNum ( int n ) | 940 | void KOMonthView::selectInternalWeekNum ( int n ) |
938 | { | 941 | { |
939 | switchView(); | 942 | switchView(); |
940 | emit selectWeekNum ( n ); | 943 | emit selectWeekNum ( n ); |
941 | } | 944 | } |
942 | 945 | ||
943 | int KOMonthView::currentWeek() | 946 | int KOMonthView::currentWeek() |
944 | { | 947 | { |
945 | if ( mShowWeekView ) | 948 | if ( mShowWeekView ) |
946 | return mWeekLabelsW[0]->getWeekNum(); | 949 | return mWeekLabelsW[0]->getWeekNum(); |
947 | return mWeekLabels[0]->getWeekNum(); | 950 | return mWeekLabels[0]->getWeekNum(); |
948 | } | 951 | } |
949 | void KOMonthView::switchView() | 952 | void KOMonthView::switchView() |
950 | { | 953 | { |
951 | 954 | ||
952 | if ( selectedCell( ) ) | 955 | if ( selectedCell( ) ) |
953 | selectedCell()->deselect(); | 956 | selectedCell()->deselect(); |
954 | mShowWeekView = !mShowWeekView; | 957 | mShowWeekView = !mShowWeekView; |
955 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 958 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
956 | if ( clPending ) { | 959 | if ( clPending ) { |
957 | computeLayout(); | 960 | computeLayout(); |
958 | updateConfig(); | 961 | updateConfig(); |
959 | } | 962 | } |
960 | if ( mShowWeekView ) | 963 | if ( mShowWeekView ) |
961 | mWidStack->raiseWidget( mWeekView ); | 964 | mWidStack->raiseWidget( mWeekView ); |
962 | else | 965 | else |
963 | mWidStack->raiseWidget( mMonthView ); | 966 | mWidStack->raiseWidget( mMonthView ); |
964 | clPending = false; | 967 | clPending = false; |
965 | } | 968 | } |
966 | 969 | ||
967 | int KOMonthView::maxDatesHint() | 970 | int KOMonthView::maxDatesHint() |
968 | { | 971 | { |
969 | return mNumCells; | 972 | return mNumCells; |
970 | } | 973 | } |
971 | 974 | ||
972 | int KOMonthView::currentDateCount() | 975 | int KOMonthView::currentDateCount() |
973 | { | 976 | { |
974 | return mNumCells; | 977 | return mNumCells; |
975 | } | 978 | } |
976 | 979 | ||
977 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 980 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
978 | { | 981 | { |
979 | QPtrList<Incidence> selected; | 982 | QPtrList<Incidence> selected; |
980 | 983 | ||
981 | if ( mSelectedCell ) { | 984 | if ( mSelectedCell ) { |
982 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 985 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
983 | if ( incidence ) selected.append( incidence ); | 986 | if ( incidence ) selected.append( incidence ); |
984 | } | 987 | } |
985 | 988 | ||
986 | return selected; | 989 | return selected; |
987 | } | 990 | } |
988 | 991 | ||
989 | DateList KOMonthView::selectedDates() | 992 | DateList KOMonthView::selectedDates() |
990 | { | 993 | { |
991 | DateList selected; | 994 | DateList selected; |
992 | 995 | ||
993 | if ( mSelectedCell ) { | 996 | if ( mSelectedCell ) { |
994 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 997 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
995 | if ( qd.isValid() ) selected.append( qd ); | 998 | if ( qd.isValid() ) selected.append( qd ); |
996 | } | 999 | } |
997 | 1000 | ||
998 | return selected; | 1001 | return selected; |
999 | } | 1002 | } |
1000 | 1003 | ||
1001 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1004 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1002 | const QDate &td) | 1005 | const QDate &td) |
1003 | { | 1006 | { |
1004 | #ifndef KORG_NOPRINTER | 1007 | #ifndef KORG_NOPRINTER |
1005 | calPrinter->preview(CalPrinter::Month, fd, td); | 1008 | calPrinter->preview(CalPrinter::Month, fd, td); |
1006 | #endif | 1009 | #endif |
1007 | } | 1010 | } |
1008 | 1011 | ||
1009 | void KOMonthView::updateConfig() | 1012 | void KOMonthView::updateConfig() |
1010 | { | 1013 | { |
1011 | 1014 | ||
1012 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1015 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1013 | 1016 | ||
1014 | if ( mShowWeekView ) { | 1017 | if ( mShowWeekView ) { |
1015 | mWeekStartsMonday = true; | 1018 | mWeekStartsMonday = true; |
1016 | } | 1019 | } |
1017 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1020 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1018 | mWidthLongDayLabel = 0; | 1021 | mWidthLongDayLabel = 0; |
1019 | 1022 | ||
1020 | for (int i = 0; i < 7; i++) { | 1023 | for (int i = 0; i < 7; i++) { |
1021 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1024 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1022 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1025 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1023 | } | 1026 | } |
1024 | bool temp = mShowSatSunComp ; | 1027 | bool temp = mShowSatSunComp ; |
1025 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1028 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 576c265..5bfe2a1 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,266 +1,270 @@ | |||
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 <kconfig.h> | 40 | #include <kconfig.h> |
40 | #include <klocale.h> | 41 | #include <klocale.h> |
41 | #include <kdebug.h> | 42 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
45 | 46 | ||
46 | #include "koprefs.h" | 47 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
48 | 49 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
51 | 52 | ||
52 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
53 | KPimPrefs("korganizerrc") | 54 | KPimPrefs("korganizerrc") |
54 | { | 55 | { |
55 | mCategoryColors.setAutoDelete(true); | 56 | mCategoryColors.setAutoDelete(true); |
56 | fillMailDefaults(); | 57 | fillMailDefaults(); |
57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
58 | QColor defaultHolidayColor = QColor(255,0,0); | 59 | QColor defaultHolidayColor = QColor(255,0,0); |
59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
63 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 64 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
64 | 65 | ||
66 | /* | ||
65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | 67 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); |
66 | mDefaultViewFont = QFont("helvetica",10); | 68 | mDefaultViewFont = QFont("helvetica",10); |
67 | mDefaultMonthViewFont = QFont("helvetica",8); | 69 | mDefaultMonthViewFont = QFont("helvetica",8); |
68 | mMarcusBainsFont= QFont("helvetica",10); | 70 | mMarcusBainsFont= QFont("helvetica",10); |
69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 71 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
70 | mEditBoxFont = QFont("helvetica",12); | 72 | mEditBoxFont = QFont("helvetica",12); |
71 | mJornalViewFont = QFont("helvetica",12); | 73 | mJornalViewFont = QFont("helvetica",12); |
74 | */ | ||
75 | |||
72 | 76 | ||
73 | KPrefs::setCurrentGroup("General"); | 77 | KPrefs::setCurrentGroup("General"); |
74 | 78 | ||
75 | 79 | ||
76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 80 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
77 | 81 | ||
78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 82 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 83 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 84 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
81 | addItemBool("ShowIconList",&mShowIconList,true); | 85 | addItemBool("ShowIconList",&mShowIconList,true); |
82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 86 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 87 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 88 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 89 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 90 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 91 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
88 | addItemBool("ShowIconBack",&mShowIconBack,true); | 92 | addItemBool("ShowIconBack",&mShowIconBack,true); |
89 | addItemBool("ShowIconToday",&mShowIconToday,true); | 93 | addItemBool("ShowIconToday",&mShowIconToday,true); |
90 | addItemBool("ShowIconForward",&mShowIconForward,true); | 94 | addItemBool("ShowIconForward",&mShowIconForward,true); |
91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 95 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 96 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 97 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
94 | addItemBool("ShowIconNext",&mShowIconNext,true); | 98 | addItemBool("ShowIconNext",&mShowIconNext,true); |
95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 99 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 100 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 101 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
98 | 102 | ||
99 | addItemBool("AskForQuit",&mAskForQuit,false); | 103 | addItemBool("AskForQuit",&mAskForQuit,false); |
100 | 104 | ||
101 | #ifndef DESKTOP_VERSION | 105 | #ifndef DESKTOP_VERSION |
102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
103 | #else | 107 | #else |
104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
105 | #endif | 109 | #endif |
106 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 110 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
107 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 111 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 112 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 113 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 114 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
111 | 115 | ||
112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 116 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 117 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 118 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 119 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
116 | addItemInt("AllDay Size",&mAllDaySize,28); | 120 | addItemInt("AllDay Size",&mAllDaySize,28); |
117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 121 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 122 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
119 | 123 | ||
120 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 124 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
121 | addItemStringList("EventSummary User",&mEventSummaryUser); | 125 | addItemStringList("EventSummary User",&mEventSummaryUser); |
122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 126 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
123 | 127 | ||
124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 128 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
125 | addItemBool("Enable Project View",&mEnableProjectView,false); | 129 | addItemBool("Enable Project View",&mEnableProjectView,false); |
126 | addItemBool("Auto Save",&mAutoSave,false); | 130 | addItemBool("Auto Save",&mAutoSave,false); |
127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 131 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
128 | addItemBool("Confirm Deletes",&mConfirm,true); | 132 | addItemBool("Confirm Deletes",&mConfirm,true); |
129 | addItemString("Archive File",&mArchiveFile); | 133 | addItemString("Archive File",&mArchiveFile); |
130 | addItemString("Html Export File",&mHtmlExportFile, | 134 | addItemString("Html Export File",&mHtmlExportFile, |
131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 135 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
132 | addItemBool("Html With Save",&mHtmlWithSave,false); | 136 | addItemBool("Html With Save",&mHtmlWithSave,false); |
133 | 137 | ||
134 | KPrefs::setCurrentGroup("Personal Settings"); | 138 | KPrefs::setCurrentGroup("Personal Settings"); |
135 | 139 | ||
136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 140 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 141 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
138 | addItemBool("Bcc",&mBcc,false); | 142 | addItemBool("Bcc",&mBcc,false); |
139 | 143 | ||
140 | KPrefs::setCurrentGroup("Time & Date"); | 144 | KPrefs::setCurrentGroup("Time & Date"); |
141 | 145 | ||
142 | 146 | ||
143 | addItemInt("Default Start Time",&mStartTime,10); | 147 | addItemInt("Default Start Time",&mStartTime,10); |
144 | addItemInt("Default Duration",&mDefaultDuration,2); | 148 | addItemInt("Default Duration",&mDefaultDuration,2); |
145 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 149 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
146 | KPrefs::setCurrentGroup("AlarmSettings"); | 150 | KPrefs::setCurrentGroup("AlarmSettings"); |
147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 151 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 152 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 153 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 154 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
151 | 155 | ||
152 | 156 | ||
153 | KPrefs::setCurrentGroup("Calendar"); | 157 | KPrefs::setCurrentGroup("Calendar"); |
154 | 158 | ||
155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 159 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
156 | 160 | ||
157 | KPrefs::setCurrentGroup("Fonts"); | 161 | KPrefs::setCurrentGroup("Fonts"); |
158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 162 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
159 | addItemFont("TimeBar Font",&mTimeBarFont); | 163 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); |
160 | addItemFont("MonthView Font",&mMonthViewFont); | 164 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); |
161 | addItemFont("AgendaView Font",&mAgendaViewFont); | 165 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); |
162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 166 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); |
163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 167 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); |
164 | addItemFont("TodoView Font",&mTodoViewFont); | 168 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); |
165 | addItemFont("ListView Font",&mListViewFont); | 169 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); |
166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 170 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); |
167 | addItemFont("EditBox Font",&mEditBoxFont); | 171 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); |
168 | addItemFont("JournalView Font",&mJornalViewFont); | 172 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); |
169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 173 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); |
170 | addItemFont("EventView Font",&mEventViewFont); | 174 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); |
171 | 175 | ||
172 | KPrefs::setCurrentGroup("RemoteSyncing"); | 176 | KPrefs::setCurrentGroup("RemoteSyncing"); |
173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 177 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 178 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 179 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
176 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 180 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
177 | 181 | ||
178 | #ifdef _WIN32_ | 182 | #ifdef _WIN32_ |
179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 183 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
180 | #else | 184 | #else |
181 | QString hdp= locateLocal("data","korganizer")+"/"; | 185 | QString hdp= locateLocal("data","korganizer")+"/"; |
182 | #endif | 186 | #endif |
183 | 187 | ||
184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 188 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
185 | 189 | ||
186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 190 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 191 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 192 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 193 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
190 | 194 | ||
191 | 195 | ||
192 | KPrefs::setCurrentGroup("Locale"); | 196 | KPrefs::setCurrentGroup("Locale"); |
193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 197 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
194 | 198 | ||
195 | 199 | ||
196 | KPrefs::setCurrentGroup("Colors"); | 200 | KPrefs::setCurrentGroup("Colors"); |
197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 201 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 202 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 203 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 204 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 205 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 206 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 207 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 208 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 209 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 210 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 211 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 212 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 213 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
210 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 214 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
211 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 215 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
212 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 216 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
213 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 217 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
214 | addItemBool("UseAppColors",&mUseAppColors,false); | 218 | addItemBool("UseAppColors",&mUseAppColors,false); |
215 | 219 | ||
216 | 220 | ||
217 | 221 | ||
218 | KPrefs::setCurrentGroup("Views"); | 222 | KPrefs::setCurrentGroup("Views"); |
219 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 223 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
220 | addItemInt("Hour Size",&mHourSize,8); | 224 | addItemInt("Hour Size",&mHourSize,8); |
221 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 225 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
222 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 226 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
223 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 227 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
224 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 228 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
225 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 229 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
226 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 230 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
227 | #ifdef DESKTOP_VERION | 231 | #ifdef DESKTOP_VERION |
228 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 232 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
229 | #else | 233 | #else |
230 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 234 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
231 | #endif | 235 | #endif |
232 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 236 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
233 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 237 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
234 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 238 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
235 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 239 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
236 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 240 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
237 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 241 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
238 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 242 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
239 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 243 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
240 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 244 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
241 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 245 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
242 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 246 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 247 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 248 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 249 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 250 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 251 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 252 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
249 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 253 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
250 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 254 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
251 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 255 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
252 | #ifdef DESKTOP_VERSION | 256 | #ifdef DESKTOP_VERSION |
253 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 257 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
254 | #else | 258 | #else |
255 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 259 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
256 | #endif | 260 | #endif |
257 | addItemInt("Day Begins",&mDayBegins,7); | 261 | addItemInt("Day Begins",&mDayBegins,7); |
258 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 262 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
259 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 263 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
260 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 264 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
261 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 265 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
262 | 266 | ||
263 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 267 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
264 | addItemBool("Full View Month",&mFullViewMonth,true); | 268 | addItemBool("Full View Month",&mFullViewMonth,true); |
265 | addItemBool("Full View Todo",&mFullViewTodo,true); | 269 | addItemBool("Full View Todo",&mFullViewTodo,true); |
266 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 270 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index 5222ac9..61a0931 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp | |||
@@ -1,151 +1,153 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown, Ian Dawes | 3 | Copyright (c) 1999 Preston Brown, Ian Dawes |
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 <qkeycode.h> | 24 | #include <qkeycode.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qlistbox.h> | 28 | #include <qlistbox.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kdebug.h> | 33 | #include <kdebug.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kpimglobalprefs.h> | 35 | #include <kpimglobalprefs.h> |
36 | 36 | ||
37 | #include "ktimeedit.h" | 37 | #include "ktimeedit.h" |
38 | #include "koprefs.h" | 38 | #include "koprefs.h" |
39 | #include <qvalidator.h> | 39 | #include <qvalidator.h> |
40 | 40 | ||
41 | // Validator for a time value with only hours and minutes (no seconds) | 41 | // Validator for a time value with only hours and minutes (no seconds) |
42 | // Mostly locale aware. Author: David Faure <faure@kde.org> | 42 | // Mostly locale aware. Author: David Faure <faure@kde.org> |
43 | 43 | ||
44 | // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. | 44 | // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. |
45 | // Difficult to get all in one... | 45 | // Difficult to get all in one... |
46 | // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. | 46 | // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. |
47 | KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) | 47 | KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) |
48 | : QComboBox(TRUE, parent, name) | 48 | : QComboBox(TRUE, parent, name) |
49 | { | 49 | { |
50 | setInsertionPolicy(NoInsertion); | 50 | setInsertionPolicy(NoInsertion); |
51 | mFlagKeyPressed = false; | 51 | mFlagKeyPressed = false; |
52 | 52 | if ( QApplication::desktop()->height() <= 480 ) { | |
53 | if ( QApplication::desktop()->width() < 650 ) | ||
54 | setSizeLimit ( 6 ); | 53 | setSizeLimit ( 6 ); |
55 | mTime = qt; | 54 | } else { |
55 | setSizeLimit ( 12 ); | ||
56 | } | ||
57 | mTime = qt; | ||
56 | 58 | ||
57 | // mNoTimeString = i18n("No Time"); | 59 | // mNoTimeString = i18n("No Time"); |
58 | // insertItem( mNoTimeString ); | 60 | // insertItem( mNoTimeString ); |
59 | 61 | ||
60 | // Fill combo box with selection of times in localized format. | 62 | // Fill combo box with selection of times in localized format. |
61 | QTime timeEntry(0,0,0); | 63 | QTime timeEntry(0,0,0); |
62 | do { | 64 | do { |
63 | insertItem(KGlobal::locale()->formatTime(timeEntry)); | 65 | insertItem(KGlobal::locale()->formatTime(timeEntry)); |
64 | timeEntry = timeEntry.addSecs(60*15); | 66 | timeEntry = timeEntry.addSecs(60*15); |
65 | } while (!timeEntry.isNull()); | 67 | } while (!timeEntry.isNull()); |
66 | // Add end of day. | 68 | // Add end of day. |
67 | insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); | 69 | insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); |
68 | 70 | ||
69 | updateText(); | 71 | updateText(); |
70 | setFocusPolicy(QWidget::StrongFocus); | 72 | setFocusPolicy(QWidget::StrongFocus); |
71 | 73 | ||
72 | connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); | 74 | connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); |
73 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); | 75 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); |
74 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); | 76 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); |
75 | QFontMetrics fm ( font() ); | 77 | QFontMetrics fm ( font() ); |
76 | QString timeString = "24:00"; | 78 | QString timeString = "24:00"; |
77 | if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) | 79 | if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) |
78 | timeString = "02:00pm"; | 80 | timeString = "02:00pm"; |
79 | int addSpace = 32; | 81 | int addSpace = 32; |
80 | if ( QApplication::desktop()->width() > 320 ) | 82 | if ( QApplication::desktop()->width() > 320 ) |
81 | timeString += ":00"; | 83 | timeString += ":00"; |
82 | setFixedWidth(fm.width( timeString ) + 32 ); | 84 | setFixedWidth(fm.width( timeString ) + 32 ); |
83 | 85 | ||
84 | // Highlight Background and Textcolor change from default | 86 | // Highlight Background and Textcolor change from default |
85 | QPalette palette = QWidget::palette(); | 87 | QPalette palette = QWidget::palette(); |
86 | unsigned char red, green, blue; | 88 | unsigned char red, green, blue; |
87 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; | 89 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; |
88 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; | 90 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; |
89 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; | 91 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; |
90 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); | 92 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); |
91 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); | 93 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); |
92 | setPalette( palette ); | 94 | setPalette( palette ); |
93 | } | 95 | } |
94 | 96 | ||
95 | KOTimeEdit::~KOTimeEdit() | 97 | KOTimeEdit::~KOTimeEdit() |
96 | { | 98 | { |
97 | } | 99 | } |
98 | 100 | ||
99 | bool KOTimeEdit::hasTime() const | 101 | bool KOTimeEdit::hasTime() const |
100 | { | 102 | { |
101 | // Can't happen | 103 | // Can't happen |
102 | if ( currentText().isEmpty() ) return false; | 104 | if ( currentText().isEmpty() ) return false; |
103 | //if ( currentText() == mNoTimeString ) return false; | 105 | //if ( currentText() == mNoTimeString ) return false; |
104 | 106 | ||
105 | return true; // always | 107 | return true; // always |
106 | } | 108 | } |
107 | 109 | ||
108 | QTime KOTimeEdit::getTime() const | 110 | QTime KOTimeEdit::getTime() const |
109 | { | 111 | { |
110 | return KGlobal::locale()->readTime(currentText()); | 112 | return KGlobal::locale()->readTime(currentText()); |
111 | } | 113 | } |
112 | /* | 114 | /* |
113 | QSizePolicy KOTimeEdit::sizePolicy() const | 115 | QSizePolicy KOTimeEdit::sizePolicy() const |
114 | { | 116 | { |
115 | // Set size policy to Fixed, because edit cannot contain more text than the | 117 | // Set size policy to Fixed, because edit cannot contain more text than the |
116 | // string representing the time. It doesn't make sense to provide more space. | 118 | // string representing the time. It doesn't make sense to provide more space. |
117 | QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); | 119 | QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); |
118 | 120 | ||
119 | return sizePolicy; | 121 | return sizePolicy; |
120 | } | 122 | } |
121 | */ | 123 | */ |
122 | void KOTimeEdit::setTime(QTime newTime) | 124 | void KOTimeEdit::setTime(QTime newTime) |
123 | { | 125 | { |
124 | if ( mTime != newTime ) | 126 | if ( mTime != newTime ) |
125 | { | 127 | { |
126 | mTime = newTime; | 128 | mTime = newTime; |
127 | updateText(); | 129 | updateText(); |
128 | } | 130 | } |
129 | 131 | ||
130 | } | 132 | } |
131 | 133 | ||
132 | void KOTimeEdit::activ(int i) | 134 | void KOTimeEdit::activ(int i) |
133 | { | 135 | { |
134 | // The last entry, 23:59, is a special case | 136 | // The last entry, 23:59, is a special case |
135 | if( i == count() - 1 ) | 137 | if( i == count() - 1 ) |
136 | mTime = QTime( 23, 59, 0 ); | 138 | mTime = QTime( 23, 59, 0 ); |
137 | else | 139 | else |
138 | mTime = QTime(0,0,0).addSecs(i*15*60); | 140 | mTime = QTime(0,0,0).addSecs(i*15*60); |
139 | emit timeChanged(mTime); | 141 | emit timeChanged(mTime); |
140 | } | 142 | } |
141 | 143 | ||
142 | void KOTimeEdit::hilit(int ) | 144 | void KOTimeEdit::hilit(int ) |
143 | { | 145 | { |
144 | // we don't currently need to do anything here. | 146 | // we don't currently need to do anything here. |
145 | } | 147 | } |
146 | 148 | ||
147 | void KOTimeEdit::addTime(QTime qt, bool update) | 149 | void KOTimeEdit::addTime(QTime qt, bool update) |
148 | { | 150 | { |
149 | // Calculate the new time. | 151 | // Calculate the new time. |
150 | //qDebug("add h %d min %d ", qt.hour(),qt.minute() ); | 152 | //qDebug("add h %d min %d ", qt.hour(),qt.minute() ); |
151 | mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600); | 153 | mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7810bf9..61c39f5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1937,113 +1937,130 @@ void MainWindow::importFile( QString fn, bool quick ) | |||
1937 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1937 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1938 | mess, | 1938 | mess, |
1939 | "Import", "Cancel", 0, | 1939 | "Import", "Cancel", 0, |
1940 | 0, 1 ); | 1940 | 0, 1 ); |
1941 | } | 1941 | } |
1942 | if ( result == 0 ) { | 1942 | if ( result == 0 ) { |
1943 | if ( mView->openCalendar( fn, true )) { | 1943 | if ( mView->openCalendar( fn, true )) { |
1944 | KOPrefs::instance()->mLastImportFile = fn; | 1944 | KOPrefs::instance()->mLastImportFile = fn; |
1945 | setCaption(i18n("Imported file successfully")); | 1945 | setCaption(i18n("Imported file successfully")); |
1946 | } else { | 1946 | } else { |
1947 | setCaption(i18n("Error importing file")); | 1947 | setCaption(i18n("Error importing file")); |
1948 | } | 1948 | } |
1949 | } | 1949 | } |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | void MainWindow::importIcal() | 1952 | void MainWindow::importIcal() |
1953 | { | 1953 | { |
1954 | 1954 | ||
1955 | QString fn =KOPrefs::instance()->mLastImportFile; | 1955 | QString fn =KOPrefs::instance()->mLastImportFile; |
1956 | 1956 | ||
1957 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1957 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1958 | if ( fn == "" ) | 1958 | if ( fn == "" ) |
1959 | return; | 1959 | return; |
1960 | importFile( fn, true ); | 1960 | importFile( fn, true ); |
1961 | 1961 | ||
1962 | } | 1962 | } |
1963 | 1963 | ||
1964 | void MainWindow::exportVCalendar() | 1964 | void MainWindow::exportVCalendar() |
1965 | { | 1965 | { |
1966 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1966 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1967 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1967 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1968 | if ( fn == "" ) | 1968 | if ( fn == "" ) |
1969 | return; | 1969 | return; |
1970 | QFileInfo info; | 1970 | QFileInfo info; |
1971 | info.setFile( fn ); | 1971 | info.setFile( fn ); |
1972 | QString mes; | 1972 | QString mes; |
1973 | bool createbup = true; | 1973 | bool createbup = true; |
1974 | if ( info. exists() ) { | 1974 | if ( info. exists() ) { |
1975 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1975 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1976 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1976 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1977 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1977 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1978 | 0, 1 ); | 1978 | 0, 1 ); |
1979 | if ( result != 0 ) { | 1979 | if ( result != 0 ) { |
1980 | createbup = false; | 1980 | createbup = false; |
1981 | } | 1981 | } |
1982 | } | 1982 | } |
1983 | if ( createbup ) { | 1983 | if ( createbup ) { |
1984 | if ( mView->exportVCalendar( fn ) ) { | 1984 | if ( mView->exportVCalendar( fn ) ) { |
1985 | KOPrefs::instance()->mLastVcalFile = fn; | 1985 | KOPrefs::instance()->mLastVcalFile = fn; |
1986 | if ( fn.length() > 20 ) | 1986 | if ( fn.length() > 20 ) |
1987 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1987 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1988 | else | 1988 | else |
1989 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1989 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1990 | setCaption(mes); | 1990 | setCaption(mes); |
1991 | } | 1991 | } |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | } | 1994 | } |
1995 | 1995 | ||
1996 | void MainWindow::syncFileRequest() | 1996 | void MainWindow::syncFileRequest() |
1997 | { | 1997 | { |
1998 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1998 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1999 | mSyncManager->slotSyncMenu( 999 ); | 1999 | mSyncManager->slotSyncMenu( 999 ); |
2000 | } | 2000 | } |
2001 | save(); | 2001 | save(); |
2002 | } | 2002 | } |
2003 | void MainWindow::getFile( bool success ) | 2003 | void MainWindow::getFile( bool success ) |
2004 | { | 2004 | { |
2005 | if ( ! success ) { | 2005 | if ( ! success ) { |
2006 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2006 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2007 | return; | 2007 | return; |
2008 | } | 2008 | } |
2009 | mView->openCalendar( defaultFileName() ); | 2009 | mView->openCalendar( defaultFileName() ); |
2010 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2010 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2011 | mSyncManager->slotSyncMenu( 999 ); | 2011 | mSyncManager->slotSyncMenu( 999 ); |
2012 | } | 2012 | } |
2013 | setCaption( i18n("Pi-Sync successful!") ); | 2013 | setCaption( i18n("Pi-Sync successful!") ); |
2014 | } | 2014 | } |
2015 | 2015 | ||
2016 | void MainWindow::printSel( ) | 2016 | void MainWindow::printSel( ) |
2017 | { | 2017 | { |
2018 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2018 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2019 | } | 2019 | } |
2020 | 2020 | ||
2021 | void MainWindow::printCal() | 2021 | void MainWindow::printCal() |
2022 | { | 2022 | { |
2023 | mView->print();//mCp->showDialog(); | 2023 | mView->print();//mCp->showDialog(); |
2024 | } | 2024 | } |
2025 | 2025 | ||
2026 | 2026 | ||
2027 | #include "libkdepim/kdatepicker.h" | 2027 | #include "libkdepim/kdatepicker.h" |
2028 | #include <kdatetbl.h> | 2028 | #include <kdatetbl.h> |
2029 | void MainWindow::weekAction() | 2029 | void MainWindow::weekAction() |
2030 | { | 2030 | { |
2031 | int month; | 2031 | int month; |
2032 | KPopupFrame* popup = new KPopupFrame(this); | 2032 | KPopupFrame* popup = new KPopupFrame(this); |
2033 | int size = 12; | 2033 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(10, popup); |
2034 | if ( QApplication::desktop()->width() >= 480 ) | ||
2035 | size = 18; | ||
2036 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(size, popup); | ||
2037 | // ----- | 2034 | // ----- |
2038 | picker->resize(picker->sizeHint()); | 2035 | picker->resize(picker->sizeHint()); |
2039 | popup->setMainWidget(picker); | 2036 | popup->setMainWidget(picker); |
2040 | picker->setFocus(); | 2037 | picker->setFocus(); |
2041 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2038 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2042 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(0, iconToolBar->height())))) | 2039 | int x = 0; |
2040 | int y = iconToolBar->height(); | ||
2041 | int dX = 0; | ||
2042 | int dY = 0; | ||
2043 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | ||
2044 | if ( iconToolBar->y() > height()/2 ) { | ||
2045 | dY = iconToolBar->height()+picker->sizeHint().height(); | ||
2046 | y = 0; | ||
2047 | } | ||
2048 | } else { | ||
2049 | if ( iconToolBar->x() > width()/2 ) { // right side | ||
2050 | x=0; | ||
2051 | dX= iconToolBar->width()+picker->sizeHint().width(); | ||
2052 | y = 0; | ||
2053 | } else { | ||
2054 | x= iconToolBar->width(); | ||
2055 | y = 0; | ||
2056 | } | ||
2057 | } | ||
2058 | qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | ||
2059 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | ||
2043 | { | 2060 | { |
2044 | month = picker->getResult(); | 2061 | month = picker->getResult(); |
2045 | emit selectWeek ( month ); | 2062 | emit selectWeek ( month ); |
2046 | //qDebug("weekSelected %d ", month); | 2063 | //qDebug("weekSelected %d ", month); |
2047 | } | 2064 | } |
2048 | delete popup; | 2065 | delete popup; |
2049 | } | 2066 | } |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index f05e6f6..4a31c77 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,160 +1,161 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | ||
43 | #include "koprefs.h" | 44 | #include "koprefs.h" |
44 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
45 | #include "kocore.h" | 46 | #include "kocore.h" |
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
49 | 50 | ||
50 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
51 | 52 | ||
52 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
53 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
54 | { | 55 | { |
55 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
56 | 57 | ||
57 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
58 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
59 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
60 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
61 | 62 | ||
62 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
63 | 64 | ||
64 | QFont tfont = font(); | 65 | QFont tfont = KGlobalSettings::generalFont();//font(); |
65 | if ( QApplication::desktop()->width() >= 480 ) | 66 | if ( QApplication::desktop()->width() >= 480 ) |
66 | tfont.setPointSize(tfont.pointSize()+2); | 67 | tfont.setPointSize(tfont.pointSize()+2); |
67 | tfont.setBold(true); | 68 | tfont.setBold(true); |
68 | 69 | ||
69 | bool isRTL = KOGlobals::self()->reverseLayout(); | 70 | bool isRTL = KOGlobals::self()->reverseLayout(); |
70 | #ifndef DESKTOP_VERSION | 71 | #ifndef DESKTOP_VERSION |
71 | bool isDesktop = false; | 72 | bool isDesktop = false; |
72 | #else | 73 | #else |
73 | bool isDesktop = true; | 74 | bool isDesktop = true; |
74 | #endif | 75 | #endif |
75 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 76 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
76 | isDesktop = true; | 77 | isDesktop = true; |
77 | // Create backward navigation buttons | 78 | // Create backward navigation buttons |
78 | mPrevYear = new QPushButton( mCtrlFrame ); | 79 | mPrevYear = new QPushButton( mCtrlFrame ); |
79 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
80 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
81 | 82 | ||
82 | mPrevMonth = new QPushButton( mCtrlFrame ); | 83 | mPrevMonth = new QPushButton( mCtrlFrame ); |
83 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
84 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
85 | 86 | ||
86 | // Create forward navigation buttons | 87 | // Create forward navigation buttons |
87 | mNextMonth = new QPushButton( mCtrlFrame ); | 88 | mNextMonth = new QPushButton( mCtrlFrame ); |
88 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
89 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 90 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
90 | 91 | ||
91 | mNextYear = new QPushButton( mCtrlFrame ); | 92 | mNextYear = new QPushButton( mCtrlFrame ); |
92 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 93 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
93 | QToolTip::add( mNextYear, i18n("Next Year") ); | 94 | QToolTip::add( mNextYear, i18n("Next Year") ); |
94 | mSelectMonth = new QPushButton( mCtrlFrame ); | 95 | mSelectMonth = new QPushButton( mCtrlFrame ); |
95 | // Create month name label | 96 | // Create month name label |
96 | //selectMonth->setFont( tfont ); | 97 | //selectMonth->setFont( tfont ); |
97 | // selectMonth->setAlignment( AlignCenter ); | 98 | // selectMonth->setAlignment( AlignCenter ); |
98 | //mDateLabel = new QLabel( selectMonth ); | 99 | //mDateLabel = new QLabel( selectMonth ); |
99 | //mDateLabel->setFont( tfont ); | 100 | //mDateLabel->setFont( tfont ); |
100 | //mDateLabel->setAlignment( AlignCenter ); | 101 | //mDateLabel->setAlignment( AlignCenter ); |
101 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 102 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
102 | mNextMonth->setFlat( true); | 103 | mNextMonth->setFlat( true); |
103 | mNextYear->setFlat( true); | 104 | mNextYear->setFlat( true); |
104 | mSelectMonth->setFlat( true); | 105 | mSelectMonth->setFlat( true); |
105 | mPrevYear->setFlat( true); | 106 | mPrevYear->setFlat( true); |
106 | mPrevMonth->setFlat( true); | 107 | mPrevMonth->setFlat( true); |
107 | } | 108 | } |
108 | mSelectMonth->setFont( tfont ); | 109 | mSelectMonth->setFont( tfont ); |
109 | // Set minimum width to width of widest month name label | 110 | // Set minimum width to width of widest month name label |
110 | int i; | 111 | int i; |
111 | int maxwidth = 0; | 112 | int maxwidth = 0; |
112 | QFontMetrics fm ( mSelectMonth->font() ); | 113 | QFontMetrics fm ( mSelectMonth->font() ); |
113 | int width = fm.width("September '00" ); | 114 | int width = fm.width("September '00" ); |
114 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 115 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
115 | // ++i ) { | 116 | // ++i ) { |
116 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | 117 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, |
117 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | 118 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); |
118 | // int width = fm.width("September 2000" ); | 119 | // int width = fm.width("September 2000" ); |
119 | // if ( width > maxwidth ) maxwidth = width; | 120 | // if ( width > maxwidth ) maxwidth = width; |
120 | // } | 121 | // } |
121 | maxwidth = width+2; | 122 | maxwidth = width+2; |
122 | int size = fm.height()+2; | 123 | int size = fm.height()+2; |
123 | if ( QApplication::desktop()->width() >= 480 ) { | 124 | if ( QApplication::desktop()->width() >= 480 ) { |
124 | size += 6; | 125 | size += 6; |
125 | maxwidth+= 6; | 126 | maxwidth+= 6; |
126 | } | 127 | } |
127 | 128 | ||
128 | mSelectMonth->setFixedWidth( maxwidth ); | 129 | mSelectMonth->setFixedWidth( maxwidth ); |
129 | mSelectMonth->setFixedHeight( size ); | 130 | mSelectMonth->setFixedHeight( size ); |
130 | mPrevYear->setFixedHeight( size ); | 131 | mPrevYear->setFixedHeight( size ); |
131 | mPrevMonth->setFixedHeight( size ); | 132 | mPrevMonth->setFixedHeight( size ); |
132 | mNextMonth->setFixedHeight( size ); | 133 | mNextMonth->setFixedHeight( size ); |
133 | mNextYear->setFixedHeight ( size ); | 134 | mNextYear->setFixedHeight ( size ); |
134 | // set up control frame layout | 135 | // set up control frame layout |
135 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 136 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
136 | ctrlLayout->addWidget( mPrevYear, 3 ); | 137 | ctrlLayout->addWidget( mPrevYear, 3 ); |
137 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 138 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
138 | //ctrlLayout->addStretch( 1 ); | 139 | //ctrlLayout->addStretch( 1 ); |
139 | // ctrlLayout->addSpacing( 1 ); | 140 | // ctrlLayout->addSpacing( 1 ); |
140 | // ctrlLayout->addWidget( mDateLabel ); | 141 | // ctrlLayout->addWidget( mDateLabel ); |
141 | ctrlLayout->addWidget( mSelectMonth ); | 142 | ctrlLayout->addWidget( mSelectMonth ); |
142 | // ctrlLayout->addSpacing( 1 ); | 143 | // ctrlLayout->addSpacing( 1 ); |
143 | // ctrlLayout->addStretch( 1 ); | 144 | // ctrlLayout->addStretch( 1 ); |
144 | ctrlLayout->addWidget( mNextMonth, 3 ); | 145 | ctrlLayout->addWidget( mNextMonth, 3 ); |
145 | ctrlLayout->addWidget( mNextYear, 3 ); | 146 | ctrlLayout->addWidget( mNextYear, 3 ); |
146 | 147 | ||
147 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 148 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
148 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 149 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
149 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 150 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
150 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
151 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
152 | mPrevYear->setFocusPolicy(NoFocus); | 153 | mPrevYear->setFocusPolicy(NoFocus); |
153 | mPrevMonth->setFocusPolicy(NoFocus); | 154 | mPrevMonth->setFocusPolicy(NoFocus); |
154 | mNextMonth->setFocusPolicy(NoFocus); | 155 | mNextMonth->setFocusPolicy(NoFocus); |
155 | mNextYear->setFocusPolicy(NoFocus); | 156 | mNextYear->setFocusPolicy(NoFocus); |
156 | mSelectMonth->setFocusPolicy(NoFocus); | 157 | mSelectMonth->setFocusPolicy(NoFocus); |
157 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 158 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
158 | 159 | ||
159 | } | 160 | } |
160 | 161 | ||
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index d8bc9f5..2be9c9e 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp | |||
@@ -1,157 +1,153 @@ | |||
1 | /* -*- C++ -*- | 1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) | 3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) |
4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) | 4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) |
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "kdatepicker.h" | 21 | #include "kdatepicker.h" |
22 | #include <kglobal.h> | 22 | #include <kglobal.h> |
23 | #include <kapplication.h> | 23 | #include <kapplication.h> |
24 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | #include <kiconloader.h> | 25 | #include <kiconloader.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qfont.h> | 30 | #include <qfont.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qvalidator.h> | 33 | #include <qvalidator.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <knotifyclient.h> | 35 | #include <knotifyclient.h> |
36 | #include <kglobalsettings.h> | ||
36 | #include "kdatetbl.h" | 37 | #include "kdatetbl.h" |
37 | #include "kdateedit.h" | 38 | #include "kdateedit.h" |
38 | //#include "kdatepicker.moc" | 39 | //#include "kdatepicker.moc" |
39 | 40 | ||
40 | 41 | ||
41 | KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) | 42 | KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) |
42 | : QFrame(parent,name), | 43 | : QFrame(parent,name), |
43 | yearForward(new QToolButton(this)), | 44 | yearForward(new QToolButton(this)), |
44 | yearBackward(new QToolButton(this)), | 45 | yearBackward(new QToolButton(this)), |
45 | monthForward(new QToolButton(this)), | 46 | monthForward(new QToolButton(this)), |
46 | monthBackward(new QToolButton(this)), | 47 | monthBackward(new QToolButton(this)), |
47 | selectMonth(new QToolButton(this)), | 48 | selectMonth(new QToolButton(this)), |
48 | selectYear(new QToolButton(this)), | 49 | selectYear(new QToolButton(this)), |
49 | //line(new QLineEdit(this)), | 50 | //line(new QLineEdit(this)), |
50 | val(new KDateValidator(this)) | 51 | val(new KDateValidator(this)) |
51 | //table(new KDateTable(this)), | 52 | //table(new KDateTable(this)), |
52 | //fontsize(1) | 53 | //fontsize(1) |
53 | { | 54 | { |
54 | // ----- | 55 | setFont ( KGlobalSettings::generalFont() ); |
55 | int size = 12; | ||
56 | if ( QApplication::desktop()->width() >= 480 ) | ||
57 | size = 18; | ||
58 | fontsize = size; | ||
59 | setFont ( QFont("helvetica",size) ); | ||
60 | table = new KDateTable(this); | 56 | table = new KDateTable(this); |
61 | setFontSize(size); | 57 | setFontSize(font().pointSize()+2); |
62 | //line->setValidator(val); | 58 | //line->setValidator(val); |
63 | lineDate = new KDateEdit( this, "dateediipicker", true ); | 59 | lineDate = new KDateEdit( this, "dateediipicker", true ); |
64 | yearForward->setPixmap(SmallIcon("2rightarrowB")); | 60 | yearForward->setPixmap(SmallIcon("2rightarrowB")); |
65 | yearBackward->setPixmap(SmallIcon("2leftarrowB")); | 61 | yearBackward->setPixmap(SmallIcon("2leftarrowB")); |
66 | monthForward->setPixmap(SmallIcon("1rightarrowB")); | 62 | monthForward->setPixmap(SmallIcon("1rightarrowB")); |
67 | monthBackward->setPixmap(SmallIcon("1leftarrowB")); | 63 | monthBackward->setPixmap(SmallIcon("1leftarrowB")); |
68 | setDate(dt); // set button texts | 64 | setDate(dt); // set button texts |
69 | connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); | 65 | connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); |
70 | connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); | 66 | connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); |
71 | connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); | 67 | connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); |
72 | connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); | 68 | connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); |
73 | connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); | 69 | connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); |
74 | connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); | 70 | connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); |
75 | connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); | 71 | connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); |
76 | connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); | 72 | connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); |
77 | //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); | 73 | //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); |
78 | connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); | 74 | connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); |
79 | connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); | 75 | connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); |
80 | table->setFocus(); | 76 | table->setFocus(); |
81 | 77 | ||
82 | } | 78 | } |
83 | 79 | ||
84 | KDatePicker::~KDatePicker() | 80 | KDatePicker::~KDatePicker() |
85 | { | 81 | { |
86 | } | 82 | } |
87 | 83 | ||
88 | void | 84 | void |
89 | KDatePicker::resizeEvent(QResizeEvent*) | 85 | KDatePicker::resizeEvent(QResizeEvent*) |
90 | { | 86 | { |
91 | QWidget *buttons[] = { | 87 | QWidget *buttons[] = { |
92 | yearBackward, | 88 | yearBackward, |
93 | monthBackward, | 89 | monthBackward, |
94 | selectMonth, | 90 | selectMonth, |
95 | selectYear, | 91 | selectYear, |
96 | monthForward, | 92 | monthForward, |
97 | yearForward }; | 93 | yearForward }; |
98 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); | 94 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); |
99 | QSize sizes[NoOfButtons]; | 95 | QSize sizes[NoOfButtons]; |
100 | int buttonHeight=0; | 96 | int buttonHeight=0; |
101 | int count; | 97 | int count; |
102 | int w; | 98 | int w; |
103 | int x=0; | 99 | int x=0; |
104 | // ----- calculate button row height: | 100 | // ----- calculate button row height: |
105 | for(count=0; count<NoOfButtons; ++count) { | 101 | for(count=0; count<NoOfButtons; ++count) { |
106 | int xS = buttons[count]->sizeHint().width(); | 102 | int xS = buttons[count]->sizeHint().width(); |
107 | int yS = buttons[count]->sizeHint().height(); | 103 | int yS = buttons[count]->sizeHint().height(); |
108 | if ( QApplication::desktop()->width() < 320 ) | 104 | if ( QApplication::desktop()->width() < 320 ) |
109 | sizes[count]=QSize ( xS+4, yS ); | 105 | sizes[count]=QSize ( xS+4, yS ); |
110 | else | 106 | else |
111 | sizes[count]=QSize ( xS+10, yS ); | 107 | sizes[count]=QSize ( xS+10, yS ); |
112 | 108 | ||
113 | buttonHeight=QMAX(buttonHeight, sizes[count].height()); | 109 | buttonHeight=QMAX(buttonHeight, sizes[count].height()); |
114 | } | 110 | } |
115 | buttonHeight += 10; | 111 | buttonHeight += 10; |
116 | // ----- calculate size of the month button: | 112 | // ----- calculate size of the month button: |
117 | w=0; | 113 | w=0; |
118 | for(count=0; count<NoOfButtons; ++count) { | 114 | for(count=0; count<NoOfButtons; ++count) { |
119 | if(buttons[count]!=selectMonth) | 115 | if(buttons[count]!=selectMonth) |
120 | { | 116 | { |
121 | w+=sizes[count].width(); | 117 | w+=sizes[count].width(); |
122 | } else { | 118 | } else { |
123 | x=count; | 119 | x=count; |
124 | } | 120 | } |
125 | } | 121 | } |
126 | sizes[x].setWidth(width()-w); // stretch the month button | 122 | sizes[x].setWidth(width()-w); // stretch the month button |
127 | // ----- place the buttons: | 123 | // ----- place the buttons: |
128 | x=0; | 124 | x=0; |
129 | for(count=0; count<NoOfButtons; ++count) | 125 | for(count=0; count<NoOfButtons; ++count) |
130 | { | 126 | { |
131 | w=sizes[count].width(); | 127 | w=sizes[count].width(); |
132 | buttons[count]->setGeometry(x, 0, w, buttonHeight); | 128 | buttons[count]->setGeometry(x, 0, w, buttonHeight); |
133 | x+=w; | 129 | x+=w; |
134 | } | 130 | } |
135 | // ----- place the line edit for direct input: | 131 | // ----- place the line edit for direct input: |
136 | sizes[0]=lineDate->sizeHint(); | 132 | sizes[0]=lineDate->sizeHint(); |
137 | //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); | 133 | //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); |
138 | lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); | 134 | lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); |
139 | // ----- adjust the table: | 135 | // ----- adjust the table: |
140 | table->setGeometry(0, buttonHeight, width(), | 136 | table->setGeometry(0, buttonHeight, width(), |
141 | height()-buttonHeight-sizes[0].height()); | 137 | height()-buttonHeight-sizes[0].height()); |
142 | } | 138 | } |
143 | 139 | ||
144 | void | 140 | void |
145 | KDatePicker::dateChangedSlot(QDate date) | 141 | KDatePicker::dateChangedSlot(QDate date) |
146 | { | 142 | { |
147 | lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); | 143 | lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); |
148 | //line->setText(KGlobal::locale()->formatDate(date, true)); | 144 | //line->setText(KGlobal::locale()->formatDate(date, true)); |
149 | emit(dateChanged(date)); | 145 | emit(dateChanged(date)); |
150 | } | 146 | } |
151 | 147 | ||
152 | void | 148 | void |
153 | KDatePicker::tableClickedSlot() | 149 | KDatePicker::tableClickedSlot() |
154 | { | 150 | { |
155 | 151 | ||
156 | emit(dateSelected(table->getDate())); | 152 | emit(dateSelected(table->getDate())); |
157 | emit(tableClicked()); | 153 | emit(tableClicked()); |
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index fce0e5a..e827412 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp | |||
@@ -105,438 +105,448 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
105 | QRect rect; | 105 | QRect rect; |
106 | QString text; | 106 | QString text; |
107 | QPen pen; | 107 | QPen pen; |
108 | int w=cellWidth(); | 108 | int w=cellWidth(); |
109 | int h=cellHeight(); | 109 | int h=cellHeight(); |
110 | int pos; | 110 | int pos; |
111 | QBrush brushBlue(blue); | 111 | QBrush brushBlue(blue); |
112 | QBrush brushLightblue(QColor(220,245,255)); | 112 | QBrush brushLightblue(QColor(220,245,255)); |
113 | QFont font=KGlobalSettings::generalFont(); | 113 | QFont font=KGlobalSettings::generalFont(); |
114 | // ----- | 114 | // ----- |
115 | font.setPointSize(fontsize); | 115 | font.setPointSize(fontsize); |
116 | if(row==0) | 116 | if(row==0) |
117 | { // we are drawing the headline | 117 | { // we are drawing the headline |
118 | font.setBold(true); | 118 | font.setBold(true); |
119 | painter->setFont(font); | 119 | painter->setFont(font); |
120 | bool normalday = true; | 120 | bool normalday = true; |
121 | QString daystr; | 121 | QString daystr; |
122 | if (KGlobal::locale()->weekStartsMonday()) | 122 | if (KGlobal::locale()->weekStartsMonday()) |
123 | { | 123 | { |
124 | daystr = KGlobal::locale()->weekDayName(col+1, true); | 124 | daystr = KGlobal::locale()->weekDayName(col+1, true); |
125 | if (col == 5 || col == 6) | 125 | if (col == 5 || col == 6) |
126 | normalday = false; | 126 | normalday = false; |
127 | } else { | 127 | } else { |
128 | daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true); | 128 | daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true); |
129 | if (col == 0 || col == 6) | 129 | if (col == 0 || col == 6) |
130 | normalday = false; | 130 | normalday = false; |
131 | } | 131 | } |
132 | if (!normalday) | 132 | if (!normalday) |
133 | { | 133 | { |
134 | painter->setPen(QColor(220,245,255)); | 134 | painter->setPen(QColor(220,245,255)); |
135 | painter->setBrush(brushLightblue); | 135 | painter->setBrush(brushLightblue); |
136 | painter->drawRect(0, 0, w, h); | 136 | painter->drawRect(0, 0, w, h); |
137 | painter->setPen(blue); | 137 | painter->setPen(blue); |
138 | } else { | 138 | } else { |
139 | painter->setPen(blue); | 139 | painter->setPen(blue); |
140 | painter->setBrush(brushBlue); | 140 | painter->setBrush(brushBlue); |
141 | painter->drawRect(0, 0, w, h); | 141 | painter->drawRect(0, 0, w, h); |
142 | painter->setPen(white); | 142 | painter->setPen(white); |
143 | } | 143 | } |
144 | painter->drawText(0, 0, w, h-1, AlignCenter, | 144 | painter->drawText(0, 0, w, h-1, AlignCenter, |
145 | daystr, -1, &rect); | 145 | daystr, -1, &rect); |
146 | painter->setPen(black); | 146 | painter->setPen(black); |
147 | painter->moveTo(0, h-1); | 147 | painter->moveTo(0, h-1); |
148 | painter->lineTo(w-1, h-1); | 148 | painter->lineTo(w-1, h-1); |
149 | // ----- draw the weekday: | 149 | // ----- draw the weekday: |
150 | } else { | 150 | } else { |
151 | painter->setFont(font); | 151 | painter->setFont(font); |
152 | pos=7*(row-1)+col; | 152 | pos=7*(row-1)+col; |
153 | if (KGlobal::locale()->weekStartsMonday()) | 153 | if (KGlobal::locale()->weekStartsMonday()) |
154 | pos++; | 154 | pos++; |
155 | if(pos<firstday || (firstday+numdays<=pos)) | 155 | if(pos<firstday || (firstday+numdays<=pos)) |
156 | { // we are either | 156 | { // we are either |
157 | // ° painting a day of the previous month or | 157 | // ° painting a day of the previous month or |
158 | // ° painting a day of the following month | 158 | // ° painting a day of the following month |
159 | if(pos<firstday) | 159 | if(pos<firstday) |
160 | { // previous month | 160 | { // previous month |
161 | text.setNum(numDaysPrevMonth+pos-firstday+1); | 161 | text.setNum(numDaysPrevMonth+pos-firstday+1); |
162 | } else { // following month | 162 | } else { // following month |
163 | text.setNum(pos-firstday-numdays+1); | 163 | text.setNum(pos-firstday-numdays+1); |
164 | } | 164 | } |
165 | painter->setPen(gray); | 165 | painter->setPen(gray); |
166 | } else { // paint a day of the current month | 166 | } else { // paint a day of the current month |
167 | text.setNum(pos-firstday+1); | 167 | text.setNum(pos-firstday+1); |
168 | painter->setPen(black); | 168 | painter->setPen(black); |
169 | } | 169 | } |
170 | 170 | ||
171 | pen=painter->pen(); | 171 | pen=painter->pen(); |
172 | if(firstday+date.day()-1==pos) | 172 | if(firstday+date.day()-1==pos) |
173 | { | 173 | { |
174 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) | 174 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) |
175 | painter->setPen(green); | 175 | painter->setPen(green); |
176 | else | 176 | else |
177 | painter->setPen(red); | 177 | painter->setPen(red); |
178 | if(hasFocus()) | 178 | if(hasFocus()) |
179 | { | 179 | { |
180 | painter->setBrush(darkRed); | 180 | painter->setBrush(darkRed); |
181 | pen=white; | 181 | pen=white; |
182 | } else { | 182 | } else { |
183 | painter->setBrush(darkGray); | 183 | painter->setBrush(darkGray); |
184 | pen=white; | 184 | pen=white; |
185 | } | 185 | } |
186 | } else { | 186 | } else { |
187 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) | 187 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) |
188 | { | 188 | { |
189 | painter->setPen(green); | 189 | painter->setPen(green); |
190 | painter->setBrush(darkGreen); | 190 | painter->setBrush(darkGreen); |
191 | pen=white; | 191 | pen=white; |
192 | } else { | 192 | } else { |
193 | painter->setBrush(QColor(220,245,255)); | 193 | painter->setBrush(QColor(220,245,255)); |
194 | painter->setPen(QColor(220,245,255)); | 194 | painter->setPen(QColor(220,245,255)); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | painter->drawRect(0, 0, w, h); | 197 | painter->drawRect(0, 0, w, h); |
198 | painter->setPen(pen); | 198 | painter->setPen(pen); |
199 | painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); | 199 | painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); |
200 | } | 200 | } |
201 | if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); | 201 | /* |
202 | if(rect.height()>maxCell.height()) maxCell.setHeight(rect.height()); | 202 | if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); |
203 | if(rect.height()>maxCell.height()) { | ||
204 | maxCell.setHeight(rect.height()); | ||
205 | } | ||
206 | */ | ||
203 | } | 207 | } |
204 | 208 | ||
205 | void | 209 | void |
206 | KDateTable::keyPressEvent( QKeyEvent *e ) | 210 | KDateTable::keyPressEvent( QKeyEvent *e ) |
207 | { | 211 | { |
208 | /* | 212 | /* |
209 | // not working properly | 213 | // not working properly |
210 | if ( e->key() == Qt::Key_Prior ) { | 214 | if ( e->key() == Qt::Key_Prior ) { |
211 | if ( date.month() == 1 ) { | 215 | if ( date.month() == 1 ) { |
212 | KNotifyClient::beep(); | 216 | KNotifyClient::beep(); |
213 | return; | 217 | return; |
214 | } | 218 | } |
215 | int day = date.day(); | 219 | int day = date.day(); |
216 | if ( day > 27 ) | 220 | if ( day > 27 ) |
217 | while ( !QDate::isValid( date.year(), date.month()-1, day ) ) | 221 | while ( !QDate::isValid( date.year(), date.month()-1, day ) ) |
218 | day--; | 222 | day--; |
219 | setDate(QDate(date.year(), date.month()-1, day)); | 223 | setDate(QDate(date.year(), date.month()-1, day)); |
220 | return; | 224 | return; |
221 | } | 225 | } |
222 | if ( e->key() == Qt::Key_Next ) { | 226 | if ( e->key() == Qt::Key_Next ) { |
223 | if ( date.month() == 12 ) { | 227 | if ( date.month() == 12 ) { |
224 | KNotifyClient::beep(); | 228 | KNotifyClient::beep(); |
225 | return; | 229 | return; |
226 | } | 230 | } |
227 | int day = date.day(); | 231 | int day = date.day(); |
228 | if ( day > 27 ) | 232 | if ( day > 27 ) |
229 | while ( !QDate::isValid( date.year(), date.month()+1, day ) ) | 233 | while ( !QDate::isValid( date.year(), date.month()+1, day ) ) |
230 | day--; | 234 | day--; |
231 | setDate(QDate(date.year(), date.month()+1, day)); | 235 | setDate(QDate(date.year(), date.month()+1, day)); |
232 | return; | 236 | return; |
233 | } | 237 | } |
234 | */ | 238 | */ |
235 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; | 239 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; |
236 | 240 | ||
237 | int temp=firstday+date.day()-dayoff; | 241 | int temp=firstday+date.day()-dayoff; |
238 | int pos = temp; | 242 | int pos = temp; |
239 | bool irgnore = true; | 243 | bool irgnore = true; |
240 | if ( e->state() != Qt::ControlButton ) { | 244 | if ( e->state() != Qt::ControlButton ) { |
241 | if ( e->key() == Qt::Key_Up ) { | 245 | if ( e->key() == Qt::Key_Up ) { |
242 | pos -= 7; | 246 | pos -= 7; |
243 | irgnore = false; | 247 | irgnore = false; |
244 | } | 248 | } |
245 | if ( e->key() == Qt::Key_Down ) { | 249 | if ( e->key() == Qt::Key_Down ) { |
246 | pos += 7; | 250 | pos += 7; |
247 | irgnore = false; | 251 | irgnore = false; |
248 | } | 252 | } |
249 | if ( e->key() == Qt::Key_Left ) { | 253 | if ( e->key() == Qt::Key_Left ) { |
250 | pos--; | 254 | pos--; |
251 | irgnore = false; | 255 | irgnore = false; |
252 | } | 256 | } |
253 | if ( e->key() == Qt::Key_Right ) { | 257 | if ( e->key() == Qt::Key_Right ) { |
254 | pos++; | 258 | pos++; |
255 | irgnore = false; | 259 | irgnore = false; |
256 | } | 260 | } |
257 | } | 261 | } |
258 | if ( irgnore ) | 262 | if ( irgnore ) |
259 | e->ignore(); | 263 | e->ignore(); |
260 | 264 | ||
261 | if(pos+dayoff<=firstday) | 265 | if(pos+dayoff<=firstday) |
262 | { // this day is in the previous month | 266 | { // this day is in the previous month |
263 | KNotifyClient::beep(); | 267 | KNotifyClient::beep(); |
264 | return; | 268 | return; |
265 | } | 269 | } |
266 | if(firstday+numdays<pos+dayoff) | 270 | if(firstday+numdays<pos+dayoff) |
267 | { // this date is in the next month | 271 | { // this date is in the next month |
268 | KNotifyClient::beep(i18n( "Month not long enough" )); | 272 | KNotifyClient::beep(i18n( "Month not long enough" )); |
269 | return; | 273 | return; |
270 | } | 274 | } |
271 | 275 | ||
272 | if ( pos == temp ) | 276 | if ( pos == temp ) |
273 | return; | 277 | return; |
274 | 278 | ||
275 | setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); | 279 | setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); |
276 | updateCell(temp/7+1, temp%7); // Update the previously selected cell | 280 | updateCell(temp/7+1, temp%7); // Update the previously selected cell |
277 | updateCell(pos/7+1, pos%7); // Update the selected cell | 281 | updateCell(pos/7+1, pos%7); // Update the selected cell |
278 | assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); | 282 | assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); |
279 | 283 | ||
280 | 284 | ||
281 | } | 285 | } |
282 | 286 | ||
283 | void | 287 | void |
284 | KDateTable::viewportResizeEvent(QResizeEvent * e) | 288 | KDateTable::viewportResizeEvent(QResizeEvent * e) |
285 | { | 289 | { |
286 | QGridView::viewportResizeEvent(e); | 290 | QGridView::viewportResizeEvent(e); |
287 | 291 | ||
288 | setCellWidth(viewport()->width()/7); | 292 | setCellWidth(viewport()->width()/7); |
289 | setCellHeight(viewport()->height()/7); | 293 | setCellHeight(viewport()->height()/7); |
290 | } | 294 | } |
291 | 295 | ||
292 | void | 296 | void |
293 | KDateTable::setFontSize(int size) | 297 | KDateTable::setFontSize(int size) |
294 | { | 298 | { |
295 | int count; | 299 | int count; |
296 | QRect rect; | 300 | QRect rect; |
297 | // ----- store rectangles: | 301 | // ----- store rectangles: |
298 | fontsize=size; | 302 | fontsize=size; |
299 | QFont font = KGlobalSettings::generalFont(); | 303 | QFont font = KGlobalSettings::generalFont(); |
300 | font.setPointSize(fontsize); | 304 | font.setPointSize(fontsize); |
301 | font.setBold( true ); | 305 | font.setBold( true ); |
302 | QFontMetrics metrics(font); | 306 | QFontMetrics metrics(font); |
303 | 307 | ||
304 | // ----- find largest day name: | 308 | // ----- find largest day name: |
305 | maxCell.setWidth(0); | 309 | maxCell.setWidth(0); |
306 | maxCell.setHeight(0); | 310 | maxCell.setHeight(0); |
307 | for(count=0; count<7; ++count) | 311 | for(count=0; count<7; ++count) |
308 | { | 312 | { |
309 | rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); | 313 | rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); |
310 | maxCell.setWidth(QMAX(maxCell.width(), rect.width())); | 314 | maxCell.setWidth(QMAX(maxCell.width(), rect.width())); |
311 | maxCell.setHeight(QMAX(maxCell.height(), rect.height())); | 315 | maxCell.setHeight(QMAX(maxCell.height(), rect.height())); |
312 | } | 316 | } |
313 | // ----- compare with a real wide number and add some space: | 317 | // ----- compare with a real wide number and add some space: |
314 | rect=metrics.boundingRect(QString::fromLatin1("88")); | 318 | rect=metrics.boundingRect(QString::fromLatin1("88")); |
315 | maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); | 319 | maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); |
320 | #ifdef DESKTOP_VERSION | ||
321 | maxCell.setHeight(QMAX(maxCell.height()+8, rect.height())); | ||
322 | #else | ||
316 | maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); | 323 | maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); |
317 | if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) | 324 | #endif |
325 | if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) { | ||
318 | maxCell.setHeight(maxCell.width() * 1000 / 1900 ); | 326 | maxCell.setHeight(maxCell.width() * 1000 / 1900 ); |
327 | qDebug("setmax "); | ||
328 | } | ||
319 | } | 329 | } |
320 | 330 | ||
321 | void | 331 | void |
322 | KDateTable::contentsMousePressEvent(QMouseEvent *e) | 332 | KDateTable::contentsMousePressEvent(QMouseEvent *e) |
323 | { | 333 | { |
324 | if(e->type()!=QEvent::MouseButtonPress) | 334 | if(e->type()!=QEvent::MouseButtonPress) |
325 | { // the KDatePicker only reacts on mouse press events: | 335 | { // the KDatePicker only reacts on mouse press events: |
326 | return; | 336 | return; |
327 | } | 337 | } |
328 | if(!isEnabled()) | 338 | if(!isEnabled()) |
329 | { | 339 | { |
330 | KNotifyClient::beep(); | 340 | KNotifyClient::beep(); |
331 | return; | 341 | return; |
332 | } | 342 | } |
333 | 343 | ||
334 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; | 344 | int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; |
335 | // ----- | 345 | // ----- |
336 | int row, col, pos, temp; | 346 | int row, col, pos, temp; |
337 | QPoint mouseCoord; | 347 | QPoint mouseCoord; |
338 | // ----- | 348 | // ----- |
339 | mouseCoord = e->pos(); | 349 | mouseCoord = e->pos(); |
340 | row=rowAt(mouseCoord.y()); | 350 | row=rowAt(mouseCoord.y()); |
341 | col=columnAt(mouseCoord.x()); | 351 | col=columnAt(mouseCoord.x()); |
342 | if(row<0 || col<0) | 352 | if(row<0 || col<0) |
343 | { // the user clicked on the frame of the table | 353 | { // the user clicked on the frame of the table |
344 | return; | 354 | return; |
345 | } | 355 | } |
346 | pos=7*(row-1)+col+1; | 356 | pos=7*(row-1)+col+1; |
347 | #if 0 | 357 | #if 0 |
348 | if(pos+dayoff<=firstday) | 358 | if(pos+dayoff<=firstday) |
349 | { // this day is in the previous month | 359 | { // this day is in the previous month |
350 | KNotifyClient::beep(); | 360 | KNotifyClient::beep(); |
351 | return; | 361 | return; |
352 | } | 362 | } |
353 | if(firstday+numdays<pos+dayoff) | 363 | if(firstday+numdays<pos+dayoff) |
354 | { // this date is in the next month | 364 | { // this date is in the next month |
355 | KNotifyClient::beep(); | 365 | KNotifyClient::beep(); |
356 | return; | 366 | return; |
357 | } | 367 | } |
358 | #endif | 368 | #endif |
359 | temp=firstday+date.day()-dayoff-1; | 369 | temp=firstday+date.day()-dayoff-1; |
360 | QDate da = QDate(date.year(), date.month(),1); | 370 | QDate da = QDate(date.year(), date.month(),1); |
361 | setDate(da.addDays( pos-firstday+dayoff-1)); | 371 | setDate(da.addDays( pos-firstday+dayoff-1)); |
362 | updateCell(temp/7+1, temp%7); // Update the previously selected cell | 372 | updateCell(temp/7+1, temp%7); // Update the previously selected cell |
363 | updateCell(row, col); // Update the selected cell | 373 | updateCell(row, col); // Update the selected cell |
364 | // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); | 374 | // assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); |
365 | emit(tableClicked()); | 375 | emit(tableClicked()); |
366 | } | 376 | } |
367 | 377 | ||
368 | bool | 378 | bool |
369 | KDateTable::setDate(const QDate& date_) | 379 | KDateTable::setDate(const QDate& date_) |
370 | { | 380 | { |
371 | bool changed=false; | 381 | bool changed=false; |
372 | QDate temp; | 382 | QDate temp; |
373 | mMarkCurrent = false; | 383 | mMarkCurrent = false; |
374 | // ----- | 384 | // ----- |
375 | if(!date_.isValid()) | 385 | if(!date_.isValid()) |
376 | { | 386 | { |
377 | kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl; | 387 | kdDebug() << "KDateTable::setDate: refusing to set invalid date." << endl; |
378 | return false; | 388 | return false; |
379 | } | 389 | } |
380 | if(date!=date_) | 390 | if(date!=date_) |
381 | { | 391 | { |
382 | date=date_; | 392 | date=date_; |
383 | changed=true; | 393 | changed=true; |
384 | } | 394 | } |
385 | mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() ); | 395 | mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() ); |
386 | temp.setYMD(date.year(), date.month(), 1); | 396 | temp.setYMD(date.year(), date.month(), 1); |
387 | firstday=temp.dayOfWeek(); | 397 | firstday=temp.dayOfWeek(); |
388 | if(firstday==1) firstday=8; | 398 | if(firstday==1) firstday=8; |
389 | numdays=date.daysInMonth(); | 399 | numdays=date.daysInMonth(); |
390 | if(date.month()==1) | 400 | if(date.month()==1) |
391 | { // set to december of previous year | 401 | { // set to december of previous year |
392 | temp.setYMD(date.year()-1, 12, 1); | 402 | temp.setYMD(date.year()-1, 12, 1); |
393 | } else { // set to previous month | 403 | } else { // set to previous month |
394 | temp.setYMD(date.year(), date.month()-1, 1); | 404 | temp.setYMD(date.year(), date.month()-1, 1); |
395 | } | 405 | } |
396 | numDaysPrevMonth=temp.daysInMonth(); | 406 | numDaysPrevMonth=temp.daysInMonth(); |
397 | if(changed) | 407 | if(changed) |
398 | { | 408 | { |
399 | repaintContents(false); | 409 | repaintContents(false); |
400 | } | 410 | } |
401 | emit(dateChanged(date)); | 411 | emit(dateChanged(date)); |
402 | return true; | 412 | return true; |
403 | } | 413 | } |
404 | 414 | ||
405 | const QDate& | 415 | const QDate& |
406 | KDateTable::getDate() const | 416 | KDateTable::getDate() const |
407 | { | 417 | { |
408 | return date; | 418 | return date; |
409 | } | 419 | } |
410 | 420 | ||
411 | void KDateTable::focusInEvent( QFocusEvent *e ) | 421 | void KDateTable::focusInEvent( QFocusEvent *e ) |
412 | { | 422 | { |
413 | repaintContents(false); | 423 | repaintContents(false); |
414 | QGridView::focusInEvent( e ); | 424 | QGridView::focusInEvent( e ); |
415 | } | 425 | } |
416 | 426 | ||
417 | void KDateTable::focusOutEvent( QFocusEvent *e ) | 427 | void KDateTable::focusOutEvent( QFocusEvent *e ) |
418 | { | 428 | { |
419 | repaintContents(false); | 429 | repaintContents(false); |
420 | QGridView::focusOutEvent( e ); | 430 | QGridView::focusOutEvent( e ); |
421 | } | 431 | } |
422 | 432 | ||
423 | QSize | 433 | QSize |
424 | KDateTable::sizeHint() const | 434 | KDateTable::sizeHint() const |
425 | { | 435 | { |
426 | if(maxCell.height()>0 && maxCell.width()>0) | 436 | if(maxCell.height()>0 && maxCell.width()>0) |
427 | { | 437 | { |
428 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), | 438 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), |
429 | (maxCell.height()+4)*numRows()+2*frameWidth()); | 439 | (maxCell.height()+4)*numRows()+2*frameWidth()); |
430 | } else { | 440 | } else { |
431 | return QSize(-1, -1); | 441 | return QSize(-1, -1); |
432 | } | 442 | } |
433 | } | 443 | } |
434 | 444 | ||
435 | KDateInternalMonthPicker::KDateInternalMonthPicker | 445 | KDateInternalMonthPicker::KDateInternalMonthPicker |
436 | (int fontsize, QWidget* parent, const char* name) | 446 | (int fontsize, QWidget* parent, const char* name) |
437 | : QGridView(parent, name), | 447 | : QGridView(parent, name), |
438 | result(0) // invalid | 448 | result(0) // invalid |
439 | { | 449 | { |
440 | QRect rect; | 450 | QRect rect; |
441 | QFont font; | 451 | QFont font; |
442 | // ----- | 452 | // ----- |
443 | activeCol = -1; | 453 | activeCol = -1; |
444 | activeRow = -1; | 454 | activeRow = -1; |
445 | font=KGlobalSettings::generalFont(); | 455 | font=KGlobalSettings::generalFont(); |
446 | font.setPointSize(fontsize); | 456 | //font.setPointSize(fontsize); |
447 | setFont(font); | 457 | setFont(font); |
448 | setHScrollBarMode(AlwaysOff); | 458 | setHScrollBarMode(AlwaysOff); |
449 | setVScrollBarMode(AlwaysOff); | 459 | setVScrollBarMode(AlwaysOff); |
450 | setFrameStyle(QFrame::NoFrame); | 460 | setFrameStyle(QFrame::NoFrame); |
451 | setNumRows(4); | 461 | setNumRows(4); |
452 | setNumCols(3); | 462 | setNumCols(3); |
453 | // enable to find drawing failures: | 463 | // enable to find drawing failures: |
454 | // setTableFlags(Tbl_clipCellPainting); | 464 | // setTableFlags(Tbl_clipCellPainting); |
455 | #if 0 | 465 | #if 0 |
456 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 466 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker |
457 | #endif | 467 | #endif |
458 | // ----- find the preferred size | 468 | // ----- find the preferred size |
459 | // (this is slow, possibly, but unfortunatly it is needed here): | 469 | // (this is slow, possibly, but unfortunatly it is needed here): |
460 | QFontMetrics metrics(font); | 470 | QFontMetrics metrics(font); |
461 | for(int i=1; i <= 12; ++i) | 471 | for(int i=1; i <= 12; ++i) |
462 | { | 472 | { |
463 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); | 473 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); |
464 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 474 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
465 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 475 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
466 | } | 476 | } |
467 | 477 | ||
468 | } | 478 | } |
469 | 479 | ||
470 | QSize | 480 | QSize |
471 | KDateInternalMonthPicker::sizeHint() const | 481 | KDateInternalMonthPicker::sizeHint() const |
472 | { | 482 | { |
473 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 483 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
474 | (max.height()+6)*numRows()+2*frameWidth()); | 484 | (max.height()+6)*numRows()+2*frameWidth()); |
475 | } | 485 | } |
476 | 486 | ||
477 | int | 487 | int |
478 | KDateInternalMonthPicker::getResult() const | 488 | KDateInternalMonthPicker::getResult() const |
479 | { | 489 | { |
480 | return result; | 490 | return result; |
481 | } | 491 | } |
482 | 492 | ||
483 | void | 493 | void |
484 | KDateInternalMonthPicker::setupPainter(QPainter *p) | 494 | KDateInternalMonthPicker::setupPainter(QPainter *p) |
485 | { | 495 | { |
486 | p->setPen(black); | 496 | p->setPen(black); |
487 | } | 497 | } |
488 | 498 | ||
489 | void | 499 | void |
490 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) | 500 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) |
491 | { | 501 | { |
492 | setCellWidth(width()/3); | 502 | setCellWidth(width()/3); |
493 | setCellHeight(height()/4); | 503 | setCellHeight(height()/4); |
494 | } | 504 | } |
495 | 505 | ||
496 | void | 506 | void |
497 | KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) | 507 | KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) |
498 | { | 508 | { |
499 | int index; | 509 | int index; |
500 | QString text; | 510 | QString text; |
501 | // ----- find the number of the cell: | 511 | // ----- find the number of the cell: |
502 | index=3*row+col+1; | 512 | index=3*row+col+1; |
503 | text=KGlobal::locale()->monthName(index, false); | 513 | text=KGlobal::locale()->monthName(index, false); |
504 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 514 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); |
505 | if ( activeCol == col && activeRow == row ) | 515 | if ( activeCol == col && activeRow == row ) |
506 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); | 516 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); |
507 | } | 517 | } |
508 | 518 | ||
509 | void | 519 | void |
510 | KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) | 520 | KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) |
511 | { | 521 | { |
512 | if(!isEnabled() || e->button() != LeftButton) | 522 | if(!isEnabled() || e->button() != LeftButton) |
513 | { | 523 | { |
514 | KNotifyClient::beep(); | 524 | KNotifyClient::beep(); |
515 | return; | 525 | return; |
516 | } | 526 | } |
517 | // ----- | 527 | // ----- |
518 | int row, col; | 528 | int row, col; |
519 | QPoint mouseCoord; | 529 | QPoint mouseCoord; |
520 | // ----- | 530 | // ----- |
521 | mouseCoord = e->pos(); | 531 | mouseCoord = e->pos(); |
522 | row=rowAt(mouseCoord.y()); | 532 | row=rowAt(mouseCoord.y()); |
523 | col=columnAt(mouseCoord.x()); | 533 | col=columnAt(mouseCoord.x()); |
524 | 534 | ||
525 | if(row<0 || col<0) | 535 | if(row<0 || col<0) |
526 | { // the user clicked on the frame of the table | 536 | { // the user clicked on the frame of the table |
527 | activeCol = -1; | 537 | activeCol = -1; |
528 | activeRow = -1; | 538 | activeRow = -1; |
529 | } else { | 539 | } else { |
530 | activeCol = col; | 540 | activeCol = col; |
531 | activeRow = row; | 541 | activeRow = row; |
532 | updateCell( row, col /*, false */ ); | 542 | updateCell( row, col /*, false */ ); |
533 | } | 543 | } |
534 | } | 544 | } |
535 | 545 | ||
536 | void | 546 | void |
537 | KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) | 547 | KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) |
538 | { | 548 | { |
539 | if (e->state() & LeftButton) | 549 | if (e->state() & LeftButton) |
540 | { | 550 | { |
541 | int row, col; | 551 | int row, col; |
542 | QPoint mouseCoord; | 552 | QPoint mouseCoord; |
@@ -668,214 +678,218 @@ KPopupFrame::KPopupFrame(QWidget* parent, const char* name) | |||
668 | void | 678 | void |
669 | KPopupFrame::keyPressEvent(QKeyEvent* e) | 679 | KPopupFrame::keyPressEvent(QKeyEvent* e) |
670 | { | 680 | { |
671 | if(e->key()==Key_Escape) | 681 | if(e->key()==Key_Escape) |
672 | { | 682 | { |
673 | result=0; // rejected | 683 | result=0; // rejected |
674 | qApp->exit_loop(); | 684 | qApp->exit_loop(); |
675 | } | 685 | } |
676 | } | 686 | } |
677 | 687 | ||
678 | void | 688 | void |
679 | KPopupFrame::close(int r) | 689 | KPopupFrame::close(int r) |
680 | { | 690 | { |
681 | result=r; | 691 | result=r; |
682 | qApp->exit_loop(); | 692 | qApp->exit_loop(); |
683 | } | 693 | } |
684 | 694 | ||
685 | void | 695 | void |
686 | KPopupFrame::setMainWidget(QWidget* m) | 696 | KPopupFrame::setMainWidget(QWidget* m) |
687 | { | 697 | { |
688 | main=m; | 698 | main=m; |
689 | if(main!=0) | 699 | if(main!=0) |
690 | { | 700 | { |
691 | resize(main->width()+2*frameWidth(), main->height()+2*frameWidth()); | 701 | resize(main->width()+2*frameWidth(), main->height()+2*frameWidth()); |
692 | } | 702 | } |
693 | } | 703 | } |
694 | 704 | ||
695 | void | 705 | void |
696 | KPopupFrame::resizeEvent(QResizeEvent*) | 706 | KPopupFrame::resizeEvent(QResizeEvent*) |
697 | { | 707 | { |
698 | if(main!=0) | 708 | if(main!=0) |
699 | { | 709 | { |
700 | main->setGeometry(frameWidth(), frameWidth(), | 710 | main->setGeometry(frameWidth(), frameWidth(), |
701 | width()-2*frameWidth(), height()-2*frameWidth()); | 711 | width()-2*frameWidth(), height()-2*frameWidth()); |
702 | } | 712 | } |
703 | } | 713 | } |
704 | 714 | ||
705 | void | 715 | void |
706 | KPopupFrame::popup(const QPoint &pos) | 716 | KPopupFrame::popup(const QPoint &pos) |
707 | { | 717 | { |
708 | // Make sure the whole popup is visible. | 718 | // Make sure the whole popup is visible. |
709 | QRect d = QApplication::desktop()->frameGeometry(); | 719 | QRect d = QApplication::desktop()->frameGeometry(); |
710 | int x = pos.x(); | 720 | int x = pos.x(); |
711 | int y = pos.y(); | 721 | int y = pos.y(); |
712 | int w = width(); | 722 | int w = width(); |
713 | int h = height(); | 723 | int h = height(); |
714 | if (x+w > d.x()+d.width()) | 724 | if (x+w > d.x()+d.width()) |
715 | x = d.width() - w; | 725 | x = d.width() - w; |
716 | if (y+h > d.y()+d.height()) | 726 | if (y+h > d.y()+d.height()) |
717 | y = d.height() - h; | 727 | y = d.height() - h; |
718 | if (x < d.x()) | 728 | if (x < d.x()) |
719 | x = 0; | 729 | x = 0; |
720 | if (y < d.y()) | 730 | if (y < d.y()) |
721 | y = 0; | 731 | y = 0; |
722 | 732 | ||
723 | // Pop the thingy up. | 733 | // Pop the thingy up. |
724 | move(x, y); | 734 | move(x, y); |
725 | show(); | 735 | show(); |
726 | } | 736 | } |
727 | 737 | ||
728 | int | 738 | int |
729 | KPopupFrame::exec(QPoint pos) | 739 | KPopupFrame::exec(QPoint pos) |
730 | { | 740 | { |
731 | popup(pos); | 741 | popup(pos); |
732 | repaint(); | 742 | repaint(); |
733 | qApp->enter_loop(); | 743 | qApp->enter_loop(); |
734 | hide(); | 744 | hide(); |
735 | return result; | 745 | return result; |
736 | } | 746 | } |
737 | 747 | ||
738 | int | 748 | int |
739 | KPopupFrame::exec(int x, int y) | 749 | KPopupFrame::exec(int x, int y) |
740 | { | 750 | { |
741 | return exec(QPoint(x, y)); | 751 | return exec(QPoint(x, y)); |
742 | } | 752 | } |
743 | 753 | ||
744 | void KPopupFrame::virtual_hook( int, void* ) | 754 | void KPopupFrame::virtual_hook( int, void* ) |
745 | { /*BASE::virtual_hook( id, data );*/ } | 755 | { /*BASE::virtual_hook( id, data );*/ } |
746 | 756 | ||
747 | void KDateTable::virtual_hook( int, void* ) | 757 | void KDateTable::virtual_hook( int, void* ) |
748 | { /*BASE::virtual_hook( id, data );*/ } | 758 | { /*BASE::virtual_hook( id, data );*/ } |
749 | 759 | ||
750 | //#include "kdatetbl.moc" | 760 | //#include "kdatetbl.moc" |
751 | 761 | ||
752 | 762 | ||
753 | KDateInternalWeekPicker::KDateInternalWeekPicker | 763 | KDateInternalWeekPicker::KDateInternalWeekPicker |
754 | (int fontsize, QWidget* parent, const char* name) | 764 | (int fontsize, QWidget* parent, const char* name) |
755 | : QGridView(parent, name), | 765 | : QGridView(parent, name), |
756 | result(0) // invalid | 766 | result(0) // invalid |
757 | { | 767 | { |
758 | QRect rect; | 768 | QRect rect; |
759 | QFont font; | 769 | QFont font; |
760 | // ----- | 770 | // ----- |
761 | activeCol = -1; | 771 | activeCol = -1; |
762 | activeRow = -1; | 772 | activeRow = -1; |
763 | font=KGlobalSettings::generalFont(); | 773 | font=KGlobalSettings::generalFont(); |
764 | font.setPointSize(fontsize); | 774 | //font.setPointSize(fontsize); |
765 | setFont(font); | 775 | setFont(font); |
766 | setHScrollBarMode(AlwaysOff); | 776 | setHScrollBarMode(AlwaysOff); |
767 | setVScrollBarMode(AlwaysOff); | 777 | setVScrollBarMode(AlwaysOff); |
768 | setFrameStyle(QFrame::NoFrame); | 778 | setFrameStyle(QFrame::NoFrame); |
769 | setNumRows(13); | 779 | setNumRows(13); |
770 | setNumCols(4); | 780 | setNumCols(4); |
771 | // enable to find drawing failures: | 781 | // enable to find drawing failures: |
772 | // setTableFlags(Tbl_clipCellPainting); | 782 | // setTableFlags(Tbl_clipCellPainting); |
773 | #if 0 | 783 | #if 0 |
774 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 784 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker |
775 | #endif | 785 | #endif |
776 | // ----- find the preferred size | 786 | // ----- find the preferred size |
777 | // (this is slow, possibly, but unfortunatly it is needed here): | 787 | // (this is slow, possibly, but unfortunatly it is needed here): |
778 | QFontMetrics metrics(font); | 788 | QFontMetrics metrics(font); |
779 | for(int i=1; i <= 52; ++i) | 789 | for(int i=1; i <= 52; ++i) |
780 | { | 790 | { |
781 | rect=metrics.boundingRect(QString::number( i )); | 791 | rect=metrics.boundingRect(QString::number( i )); |
782 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 792 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
783 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 793 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
784 | } | 794 | } |
785 | 795 | if ( QApplication::desktop()->width() > 640 ) { | |
796 | |||
797 | max.setWidth(max.width()+6); | ||
798 | max.setHeight(max.height()+8); | ||
799 | } | ||
786 | } | 800 | } |
787 | 801 | ||
788 | QSize | 802 | QSize |
789 | KDateInternalWeekPicker::sizeHint() const | 803 | KDateInternalWeekPicker::sizeHint() const |
790 | { | 804 | { |
791 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 805 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
792 | (max.height()+6)*numRows()+2*frameWidth()); | 806 | (max.height()+6)*numRows()+2*frameWidth()); |
793 | } | 807 | } |
794 | 808 | ||
795 | int | 809 | int |
796 | KDateInternalWeekPicker::getResult() const | 810 | KDateInternalWeekPicker::getResult() const |
797 | { | 811 | { |
798 | return result; | 812 | return result; |
799 | } | 813 | } |
800 | 814 | ||
801 | void | 815 | void |
802 | KDateInternalWeekPicker::setupPainter(QPainter *p) | 816 | KDateInternalWeekPicker::setupPainter(QPainter *p) |
803 | { | 817 | { |
804 | p->setPen(black); | 818 | p->setPen(black); |
805 | } | 819 | } |
806 | 820 | ||
807 | void | 821 | void |
808 | KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) | 822 | KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) |
809 | { | 823 | { |
810 | setCellWidth(width()/4); | 824 | setCellWidth(width()/4); |
811 | setCellHeight(height()/13); | 825 | setCellHeight(height()/13); |
812 | } | 826 | } |
813 | 827 | ||
814 | void | 828 | void |
815 | KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) | 829 | KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) |
816 | { | 830 | { |
817 | int index; | 831 | int index; |
818 | QString text; | 832 | QString text; |
819 | // ----- find the number of the cell: | 833 | // ----- find the number of the cell: |
820 | index=4*row+col+1; | 834 | index=4*row+col+1; |
821 | text=QString::number( index ); | 835 | text=QString::number( index ); |
822 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 836 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); |
823 | if ( activeCol == col && activeRow == row ) | 837 | if ( activeCol == col && activeRow == row ) |
824 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); | 838 | painter->drawRect( 0, 0, cellWidth(), cellHeight() ); |
825 | } | 839 | } |
826 | 840 | ||
827 | void | 841 | void |
828 | KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) | 842 | KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) |
829 | { | 843 | { |
830 | if(!isEnabled() || e->button() != LeftButton) | 844 | if(!isEnabled() || e->button() != LeftButton) |
831 | { | 845 | { |
832 | KNotifyClient::beep(); | 846 | KNotifyClient::beep(); |
833 | return; | 847 | return; |
834 | } | 848 | } |
835 | // ----- | 849 | // ----- |
836 | int row, col; | 850 | int row, col; |
837 | QPoint mouseCoord; | 851 | QPoint mouseCoord; |
838 | // ----- | 852 | // ----- |
839 | mouseCoord = e->pos(); | 853 | mouseCoord = e->pos(); |
840 | row=rowAt(mouseCoord.y()); | 854 | row=rowAt(mouseCoord.y()); |
841 | col=columnAt(mouseCoord.x()); | 855 | col=columnAt(mouseCoord.x()); |
842 | 856 | ||
843 | if(row<0 || col<0) | 857 | if(row<0 || col<0) |
844 | { // the user clicked on the frame of the table | 858 | { // the user clicked on the frame of the table |
845 | activeCol = -1; | 859 | activeCol = -1; |
846 | activeRow = -1; | 860 | activeRow = -1; |
847 | } else { | 861 | } else { |
848 | activeCol = col; | 862 | activeCol = col; |
849 | activeRow = row; | 863 | activeRow = row; |
850 | updateCell( row, col /*, false */ ); | 864 | updateCell( row, col /*, false */ ); |
851 | } | 865 | } |
852 | } | 866 | } |
853 | 867 | ||
854 | void | 868 | void |
855 | KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e) | 869 | KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e) |
856 | { | 870 | { |
857 | if (e->state() & LeftButton) | 871 | if (e->state() & LeftButton) |
858 | { | 872 | { |
859 | int row, col; | 873 | int row, col; |
860 | QPoint mouseCoord; | 874 | QPoint mouseCoord; |
861 | // ----- | 875 | // ----- |
862 | mouseCoord = e->pos(); | 876 | mouseCoord = e->pos(); |
863 | row=rowAt(mouseCoord.y()); | 877 | row=rowAt(mouseCoord.y()); |
864 | col=columnAt(mouseCoord.x()); | 878 | col=columnAt(mouseCoord.x()); |
865 | int tmpRow = -1, tmpCol = -1; | 879 | int tmpRow = -1, tmpCol = -1; |
866 | if(row<0 || col<0) | 880 | if(row<0 || col<0) |
867 | { // the user clicked on the frame of the table | 881 | { // the user clicked on the frame of the table |
868 | if ( activeCol > -1 ) | 882 | if ( activeCol > -1 ) |
869 | { | 883 | { |
870 | tmpRow = activeRow; | 884 | tmpRow = activeRow; |
871 | tmpCol = activeCol; | 885 | tmpCol = activeCol; |
872 | } | 886 | } |
873 | activeCol = -1; | 887 | activeCol = -1; |
874 | activeRow = -1; | 888 | activeRow = -1; |
875 | } else { | 889 | } else { |
876 | bool differentCell = (activeRow != row || activeCol != col); | 890 | bool differentCell = (activeRow != row || activeCol != col); |
877 | if ( activeCol > -1 && differentCell) | 891 | if ( activeCol > -1 && differentCell) |
878 | { | 892 | { |
879 | tmpRow = activeRow; | 893 | tmpRow = activeRow; |
880 | tmpCol = activeCol; | 894 | tmpCol = activeCol; |
881 | } | 895 | } |
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index 2fff8fc..30e793f 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -1,41 +1,43 @@ | |||
1 | #include "kglobalsettings.h" | 1 | #include "kglobalsettings.h" |
2 | #include "kconfig.h" | 2 | #include "kconfig.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | #include "kconfigbase.h" | 4 | #include "kconfigbase.h" |
5 | 5 | ||
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | QFont KGlobalSettings::generalFont() | 8 | QFont KGlobalSettings::generalFont() |
9 | { | 9 | { |
10 | int size = 12; | 10 | int size = 12; |
11 | if (QApplication::desktop()->width() < 480 ) | 11 | if (QApplication::desktop()->width() < 480 ) |
12 | size = 10; | 12 | size = 10; |
13 | return QFont("helvetica",size); | 13 | QFont f = QApplication::font(); |
14 | f.setPointSize( size ); | ||
15 | return f; | ||
14 | } | 16 | } |
15 | QFont KGlobalSettings::toolBarFont() | 17 | QFont KGlobalSettings::toolBarFont() |
16 | { | 18 | { |
17 | return QFont("helevetica",12); | 19 | return QApplication::font(); |
18 | } | 20 | } |
19 | 21 | ||
20 | QColor KGlobalSettings::toolBarHighlightColor() | 22 | QColor KGlobalSettings::toolBarHighlightColor() |
21 | { | 23 | { |
22 | return QColor("black"); | 24 | return QColor( "black" ); |
23 | } | 25 | } |
24 | 26 | ||
25 | QRect KGlobalSettings::desktopGeometry( QWidget * ) | 27 | QRect KGlobalSettings::desktopGeometry( QWidget * ) |
26 | { | 28 | { |
27 | return QApplication::desktop()->rect(); | 29 | return QApplication::desktop()->rect(); |
28 | } | 30 | } |
29 | 31 | ||
30 | /** | 32 | /** |
31 | * Returns whether KDE runs in single (default) or double click | 33 | * Returns whether KDE runs in single (default) or double click |
32 | * mode. | 34 | * mode. |
33 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 35 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
34 | * @return true if single click mode, or false if double click mode. | 36 | * @return true if single click mode, or false if double click mode. |
35 | **/ | 37 | **/ |
36 | bool KGlobalSettings::singleClick() | 38 | bool KGlobalSettings::singleClick() |
37 | { | 39 | { |
38 | KConfig *c = KGlobal::config(); | 40 | KConfig *c = KGlobal::config(); |
39 | KConfigGroupSaver cgs( c, "KDE" ); | 41 | KConfigGroupSaver cgs( c, "KDE" ); |
40 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | 42 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); |
41 | } | 43 | } |