author | zautrix <zautrix> | 2005-06-30 15:06:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 15:06:11 (UTC) |
commit | d401e425af46703a89eb80802606edeea06c9538 (patch) (unidiff) | |
tree | e32a98c44e340a6af6706fa99544cba648aa19f1 | |
parent | af48ba51eeb7a766ca7b458d2287e55c121388cf (diff) | |
download | kdepimpi-d401e425af46703a89eb80802606edeea06c9538.zip kdepimpi-d401e425af46703a89eb80802606edeea06c9538.tar.gz kdepimpi-d401e425af46703a89eb80802606edeea06c9538.tar.bz2 |
desk fixes
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/journalentry.cpp | 8 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 3 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 6 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 14 |
5 files changed, 21 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 214b829..d0de233 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2470,257 +2470,259 @@ void CalendarView::writeFilterSettings(KConfig *config) | |||
2470 | config->setGroup("General"); | 2470 | config->setGroup("General"); |
2471 | config->writeEntry("CalendarFilters",filterList); | 2471 | config->writeEntry("CalendarFilters",filterList); |
2472 | 2472 | ||
2473 | config->setGroup("FilterView"); | 2473 | config->setGroup("FilterView"); |
2474 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2474 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2475 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2475 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2476 | } | 2476 | } |
2477 | 2477 | ||
2478 | 2478 | ||
2479 | void CalendarView::goToday() | 2479 | void CalendarView::goToday() |
2480 | { | 2480 | { |
2481 | if ( mViewManager->currentView()->isMonthView() ) | 2481 | if ( mViewManager->currentView()->isMonthView() ) |
2482 | mNavigator->selectTodayMonth(); | 2482 | mNavigator->selectTodayMonth(); |
2483 | else | 2483 | else |
2484 | mNavigator->selectToday(); | 2484 | mNavigator->selectToday(); |
2485 | } | 2485 | } |
2486 | 2486 | ||
2487 | void CalendarView::goNext() | 2487 | void CalendarView::goNext() |
2488 | { | 2488 | { |
2489 | mNavigator->selectNext(); | 2489 | mNavigator->selectNext(); |
2490 | } | 2490 | } |
2491 | 2491 | ||
2492 | void CalendarView::goPrevious() | 2492 | void CalendarView::goPrevious() |
2493 | { | 2493 | { |
2494 | mNavigator->selectPrevious(); | 2494 | mNavigator->selectPrevious(); |
2495 | } | 2495 | } |
2496 | void CalendarView::goNextMonth() | 2496 | void CalendarView::goNextMonth() |
2497 | { | 2497 | { |
2498 | mNavigator->selectNextMonth(); | 2498 | mNavigator->selectNextMonth(); |
2499 | } | 2499 | } |
2500 | 2500 | ||
2501 | void CalendarView::goPreviousMonth() | 2501 | void CalendarView::goPreviousMonth() |
2502 | { | 2502 | { |
2503 | mNavigator->selectPreviousMonth(); | 2503 | mNavigator->selectPreviousMonth(); |
2504 | } | 2504 | } |
2505 | 2505 | ||
2506 | void CalendarView::updateConfig() | 2506 | void CalendarView::updateConfig() |
2507 | { | 2507 | { |
2508 | if ( KOPrefs::instance()->mUseAppColors ) | 2508 | if ( KOPrefs::instance()->mUseAppColors ) |
2509 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2509 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2510 | emit configChanged(); | 2510 | emit configChanged(); |
2511 | mTodoList->updateConfig(); | 2511 | mTodoList->updateConfig(); |
2512 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2512 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2513 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2513 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2514 | // To make the "fill window" configurations work | 2514 | // To make the "fill window" configurations work |
2515 | //mViewManager->raiseCurrentView(); | 2515 | //mViewManager->raiseCurrentView(); |
2516 | } | 2516 | } |
2517 | 2517 | ||
2518 | 2518 | ||
2519 | void CalendarView::eventChanged(Event *event) | 2519 | void CalendarView::eventChanged(Event *event) |
2520 | { | 2520 | { |
2521 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2521 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2522 | //updateUnmanagedViews(); | 2522 | //updateUnmanagedViews(); |
2523 | } | 2523 | } |
2524 | 2524 | ||
2525 | void CalendarView::eventAdded(Event *event) | 2525 | void CalendarView::eventAdded(Event *event) |
2526 | { | 2526 | { |
2527 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2527 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2528 | } | 2528 | } |
2529 | 2529 | ||
2530 | void CalendarView::eventToBeDeleted(Event *) | 2530 | void CalendarView::eventToBeDeleted(Event *) |
2531 | { | 2531 | { |
2532 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2532 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2533 | } | 2533 | } |
2534 | 2534 | ||
2535 | void CalendarView::eventDeleted() | 2535 | void CalendarView::eventDeleted() |
2536 | { | 2536 | { |
2537 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2537 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2538 | } | 2538 | } |
2539 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2539 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2540 | { | 2540 | { |
2541 | changeIncidenceDisplay((Incidence *)which, action); | 2541 | changeIncidenceDisplay((Incidence *)which, action); |
2542 | mDateNavigator->updateView(); //LR | 2542 | mDateNavigator->updateView(); //LR |
2543 | //mDialogManager->updateSearchDialog(); | 2543 | //mDialogManager->updateSearchDialog(); |
2544 | 2544 | ||
2545 | if (which) { | 2545 | if (which) { |
2546 | mViewManager->updateWNview(); | 2546 | mViewManager->updateWNview(); |
2547 | //mTodoList->updateView(); | 2547 | //mTodoList->updateView(); |
2548 | } | 2548 | } |
2549 | 2549 | ||
2550 | } | 2550 | } |
2551 | 2551 | ||
2552 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2552 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2553 | { | 2553 | { |
2554 | updateUnmanagedViews(); | 2554 | updateUnmanagedViews(); |
2555 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2555 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2556 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2556 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2557 | mCalendar->checkAlarmForIncidence( 0, true ); | 2557 | mCalendar->checkAlarmForIncidence( 0, true ); |
2558 | if ( mEventViewerDialog ) | 2558 | if ( mEventViewerDialog ) |
2559 | mEventViewerDialog->hide(); | 2559 | mEventViewerDialog->hide(); |
2560 | } | 2560 | } |
2561 | else | 2561 | else |
2562 | mCalendar->checkAlarmForIncidence( which , false ); | 2562 | mCalendar->checkAlarmForIncidence( which , false ); |
2563 | } | 2563 | } |
2564 | 2564 | ||
2565 | // most of the changeEventDisplays() right now just call the view's | 2565 | // most of the changeEventDisplays() right now just call the view's |
2566 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2566 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2567 | void CalendarView::changeEventDisplay(Event *which, int action) | 2567 | void CalendarView::changeEventDisplay(Event *which, int action) |
2568 | { | 2568 | { |
2569 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2569 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2570 | changeIncidenceDisplay((Incidence *)which, action); | 2570 | changeIncidenceDisplay((Incidence *)which, action); |
2571 | mDateNavigator->updateView(); | 2571 | mDateNavigator->updateView(); |
2572 | //mDialogManager->updateSearchDialog(); | 2572 | //mDialogManager->updateSearchDialog(); |
2573 | 2573 | ||
2574 | if (which) { | 2574 | if (which) { |
2575 | // If there is an event view visible update the display | 2575 | // If there is an event view visible update the display |
2576 | mViewManager->currentView()->changeEventDisplay(which,action); | 2576 | mViewManager->currentView()->changeEventDisplay(which,action); |
2577 | // TODO: check, if update needed | 2577 | // TODO: check, if update needed |
2578 | // if (which->getTodoStatus()) { | 2578 | // if (which->getTodoStatus()) { |
2579 | mTodoList->updateView(); | 2579 | mTodoList->updateView(); |
2580 | // } | 2580 | // } |
2581 | } else { | 2581 | } else { |
2582 | mViewManager->currentView()->updateView(); | 2582 | mViewManager->currentView()->updateView(); |
2583 | } | 2583 | } |
2584 | } | 2584 | } |
2585 | 2585 | ||
2586 | 2586 | ||
2587 | void CalendarView::updateTodoViews() | 2587 | void CalendarView::updateTodoViews() |
2588 | { | 2588 | { |
2589 | mTodoList->updateView(); | 2589 | mTodoList->updateView(); |
2590 | mViewManager->currentView()->updateView(); | 2590 | mViewManager->currentView()->updateView(); |
2591 | 2591 | ||
2592 | } | 2592 | } |
2593 | 2593 | ||
2594 | 2594 | ||
2595 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2595 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2596 | { | 2596 | { |
2597 | #ifdef DESKTOP_VERSION | 2597 | #ifdef DESKTOP_VERSION |
2598 | mDateScrollBar->blockSignals( true ); | ||
2598 | mDateScrollBar->setValue( start.dayOfYear()-1); | 2599 | mDateScrollBar->setValue( start.dayOfYear()-1); |
2600 | mDateScrollBar->blockSignals( false ); | ||
2599 | #endif | 2601 | #endif |
2600 | mTodoList->updateView(); | 2602 | mTodoList->updateView(); |
2601 | mViewManager->updateView(start, end); | 2603 | mViewManager->updateView(start, end); |
2602 | //mDateNavigator->updateView(); | 2604 | //mDateNavigator->updateView(); |
2603 | } | 2605 | } |
2604 | 2606 | ||
2605 | void CalendarView::clearAllViews() | 2607 | void CalendarView::clearAllViews() |
2606 | { | 2608 | { |
2607 | mTodoList->clearList(); | 2609 | mTodoList->clearList(); |
2608 | mViewManager->clearAllViews(); | 2610 | mViewManager->clearAllViews(); |
2609 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2611 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2610 | if ( sd ) { | 2612 | if ( sd ) { |
2611 | KOListView* kol = sd->listview(); | 2613 | KOListView* kol = sd->listview(); |
2612 | if ( kol ) | 2614 | if ( kol ) |
2613 | kol->clearList(); | 2615 | kol->clearList(); |
2614 | } | 2616 | } |
2615 | } | 2617 | } |
2616 | void CalendarView::updateView() | 2618 | void CalendarView::updateView() |
2617 | { | 2619 | { |
2618 | DateList tmpList = mNavigator->selectedDates(); | 2620 | DateList tmpList = mNavigator->selectedDates(); |
2619 | 2621 | ||
2620 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2622 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2621 | mTodoList->updateView(); | 2623 | mTodoList->updateView(); |
2622 | // We assume that the navigator only selects consecutive days. | 2624 | // We assume that the navigator only selects consecutive days. |
2623 | updateView( tmpList.first(), tmpList.last() ); | 2625 | updateView( tmpList.first(), tmpList.last() ); |
2624 | } | 2626 | } |
2625 | 2627 | ||
2626 | void CalendarView::updateUnmanagedViews() | 2628 | void CalendarView::updateUnmanagedViews() |
2627 | { | 2629 | { |
2628 | mDateNavigator->updateDayMatrix(); | 2630 | mDateNavigator->updateDayMatrix(); |
2629 | } | 2631 | } |
2630 | 2632 | ||
2631 | int CalendarView::msgItemDelete(const QString name) | 2633 | int CalendarView::msgItemDelete(const QString name) |
2632 | { | 2634 | { |
2633 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2635 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2634 | i18n("This item will be\npermanently deleted."), | 2636 | i18n("This item will be\npermanently deleted."), |
2635 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2637 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2636 | } | 2638 | } |
2637 | 2639 | ||
2638 | 2640 | ||
2639 | void CalendarView::edit_cut() | 2641 | void CalendarView::edit_cut() |
2640 | { | 2642 | { |
2641 | Event *anEvent=0; | 2643 | Event *anEvent=0; |
2642 | 2644 | ||
2643 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2645 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2644 | 2646 | ||
2645 | if (mViewManager->currentView()->isEventView()) { | 2647 | if (mViewManager->currentView()->isEventView()) { |
2646 | if ( incidence && incidence->typeID() == eventID ) { | 2648 | if ( incidence && incidence->typeID() == eventID ) { |
2647 | anEvent = static_cast<Event *>(incidence); | 2649 | anEvent = static_cast<Event *>(incidence); |
2648 | } | 2650 | } |
2649 | } | 2651 | } |
2650 | 2652 | ||
2651 | if (!anEvent) { | 2653 | if (!anEvent) { |
2652 | KNotifyClient::beep(); | 2654 | KNotifyClient::beep(); |
2653 | return; | 2655 | return; |
2654 | } | 2656 | } |
2655 | DndFactory factory( mCalendar ); | 2657 | DndFactory factory( mCalendar ); |
2656 | factory.cutIncidence(anEvent); | 2658 | factory.cutIncidence(anEvent); |
2657 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2659 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2658 | } | 2660 | } |
2659 | 2661 | ||
2660 | void CalendarView::edit_copy() | 2662 | void CalendarView::edit_copy() |
2661 | { | 2663 | { |
2662 | Event *anEvent=0; | 2664 | Event *anEvent=0; |
2663 | 2665 | ||
2664 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2666 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2665 | 2667 | ||
2666 | if (mViewManager->currentView()->isEventView()) { | 2668 | if (mViewManager->currentView()->isEventView()) { |
2667 | if ( incidence && incidence->typeID() == eventID ) { | 2669 | if ( incidence && incidence->typeID() == eventID ) { |
2668 | anEvent = static_cast<Event *>(incidence); | 2670 | anEvent = static_cast<Event *>(incidence); |
2669 | } | 2671 | } |
2670 | } | 2672 | } |
2671 | 2673 | ||
2672 | if (!anEvent) { | 2674 | if (!anEvent) { |
2673 | KNotifyClient::beep(); | 2675 | KNotifyClient::beep(); |
2674 | return; | 2676 | return; |
2675 | } | 2677 | } |
2676 | DndFactory factory( mCalendar ); | 2678 | DndFactory factory( mCalendar ); |
2677 | factory.copyIncidence(anEvent); | 2679 | factory.copyIncidence(anEvent); |
2678 | } | 2680 | } |
2679 | 2681 | ||
2680 | void CalendarView::edit_paste() | 2682 | void CalendarView::edit_paste() |
2681 | { | 2683 | { |
2682 | QDate date = mNavigator->selectedDates().first(); | 2684 | QDate date = mNavigator->selectedDates().first(); |
2683 | 2685 | ||
2684 | DndFactory factory( mCalendar ); | 2686 | DndFactory factory( mCalendar ); |
2685 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2687 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2686 | 2688 | ||
2687 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2689 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2688 | } | 2690 | } |
2689 | void CalendarView::edit_global_options() | 2691 | void CalendarView::edit_global_options() |
2690 | { | 2692 | { |
2691 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2693 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2692 | emit save(); | 2694 | emit save(); |
2693 | emit saveStopTimer(); | 2695 | emit saveStopTimer(); |
2694 | mDialogManager->showGlobalOptionsDialog(); | 2696 | mDialogManager->showGlobalOptionsDialog(); |
2695 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2697 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2696 | emit saveStopTimer(); | 2698 | emit saveStopTimer(); |
2697 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2699 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2698 | i18n("Timezone settings"),i18n("Reload"))) { | 2700 | i18n("Timezone settings"),i18n("Reload"))) { |
2699 | qDebug("KO: TZ reload cancelled "); | 2701 | qDebug("KO: TZ reload cancelled "); |
2700 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2701 | return; | 2703 | return; |
2702 | } | 2704 | } |
2703 | qDebug("KO: Timezone change "); | 2705 | qDebug("KO: Timezone change "); |
2704 | loadCalendars(); | 2706 | loadCalendars(); |
2705 | setModified(true); | 2707 | setModified(true); |
2706 | } | 2708 | } |
2707 | else | 2709 | else |
2708 | qDebug("KO: No tz change "); | 2710 | qDebug("KO: No tz change "); |
2709 | } | 2711 | } |
2710 | void CalendarView::edit_options() | 2712 | void CalendarView::edit_options() |
2711 | { | 2713 | { |
2712 | mDialogManager->showOptionsDialog(); | 2714 | mDialogManager->showOptionsDialog(); |
2713 | } | 2715 | } |
2714 | 2716 | ||
2715 | 2717 | ||
2716 | void CalendarView::slotSelectPickerDate( QDate d) | 2718 | void CalendarView::slotSelectPickerDate( QDate d) |
2717 | { | 2719 | { |
2718 | mDateFrame->hide(); | 2720 | mDateFrame->hide(); |
2719 | if ( mDatePickerMode == 1 ) { | 2721 | if ( mDatePickerMode == 1 ) { |
2720 | mNavigator->slotDaySelect( d ); | 2722 | mNavigator->slotDaySelect( d ); |
2721 | } else if ( mDatePickerMode == 2 ) { | 2723 | } else if ( mDatePickerMode == 2 ) { |
2722 | if ( mMoveIncidence->typeID() == todoID ) { | 2724 | if ( mMoveIncidence->typeID() == todoID ) { |
2723 | Todo * to = (Todo *) mMoveIncidence; | 2725 | Todo * to = (Todo *) mMoveIncidence; |
2724 | QTime tim; | 2726 | QTime tim; |
2725 | int len = 0; | 2727 | int len = 0; |
2726 | if ( to->hasStartDate() && to->hasDueDate() ) | 2728 | if ( to->hasStartDate() && to->hasDueDate() ) |
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index ca8d5f7..3c38f34 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -1,188 +1,194 @@ | |||
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 | // | 24 | // |
25 | // Journal Entry | 25 | // Journal Entry |
26 | 26 | ||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtextcodec.h> | 33 | #include <qtextcodec.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <ktextedit.h> | 41 | #include <ktextedit.h> |
42 | #include <kfiledialog.h> | 42 | #include <kfiledialog.h> |
43 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include <klineedit.h> | 45 | #include <klineedit.h> |
46 | 46 | ||
47 | #include <libkcal/journal.h> | 47 | #include <libkcal/journal.h> |
48 | #include <libkcal/calendarresources.h> | 48 | #include <libkcal/calendarresources.h> |
49 | #include <libkcal/resourcecalendar.h> | 49 | #include <libkcal/resourcecalendar.h> |
50 | #include <kresources/resourceselectdialog.h> | 50 | #include <kresources/resourceselectdialog.h> |
51 | 51 | ||
52 | #include "journalentry.h" | 52 | #include "journalentry.h" |
53 | //#include "journalentry.moc" | 53 | //#include "journalentry.moc" |
54 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
55 | #include <qpe/qpeapplication.h> | 55 | #include <qpe/qpeapplication.h> |
56 | #endif | 56 | #endif |
57 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 57 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
58 | QFrame(parent) | 58 | QFrame(parent) |
59 | { | 59 | { |
60 | heiHint = QApplication::desktop()->height() / 5 ; | 60 | |
61 | int fac = 5; | ||
62 | heiHint = QApplication::desktop()->height(); | ||
63 | if ( heiHint > 800 ) | ||
64 | fac += 2; | ||
65 | heiHint = heiHint / fac; | ||
66 | |||
61 | showOnlyMode = false; | 67 | showOnlyMode = false; |
62 | mCalendar = calendar; | 68 | mCalendar = calendar; |
63 | mJournal = 0; | 69 | mJournal = 0; |
64 | visibleMode = true; | 70 | visibleMode = true; |
65 | QHBox * vb = new QHBox ( this ); | 71 | QHBox * vb = new QHBox ( this ); |
66 | QPixmap iconp; | 72 | QPixmap iconp; |
67 | 73 | ||
68 | QPushButton * toggleJournal = new QPushButton( vb ); | 74 | QPushButton * toggleJournal = new QPushButton( vb ); |
69 | iconp = SmallIcon("1updownarrow"); | 75 | iconp = SmallIcon("1updownarrow"); |
70 | toggleJournal->setPixmap (iconp ) ; | 76 | toggleJournal->setPixmap (iconp ) ; |
71 | new QLabel(" "+i18n("Title: "),vb); | 77 | new QLabel(" "+i18n("Title: "),vb); |
72 | mTitle = new KLineEdit ( vb ); | 78 | mTitle = new KLineEdit ( vb ); |
73 | mTitleLabel = new QLabel(i18n("Title"),vb); | 79 | mTitleLabel = new QLabel(i18n("Title"),vb); |
74 | mTitleLabel->setMargin(0); | 80 | mTitleLabel->setMargin(0); |
75 | mTitleLabel->setAlignment(AlignCenter); | 81 | mTitleLabel->setAlignment(AlignCenter); |
76 | QPushButton * loadTemplate = new QPushButton( vb ); | 82 | QPushButton * loadTemplate = new QPushButton( vb ); |
77 | QPushButton * saveTemplate = new QPushButton( vb ); | 83 | QPushButton * saveTemplate = new QPushButton( vb ); |
78 | if ( QApplication::desktop()->width() < 321 ) | 84 | if ( QApplication::desktop()->width() < 321 ) |
79 | iconp = SmallIcon("fileexport16"); | 85 | iconp = SmallIcon("fileexport16"); |
80 | else | 86 | else |
81 | iconp = SmallIcon("fileexport"); | 87 | iconp = SmallIcon("fileexport"); |
82 | saveTemplate->setPixmap (iconp ) ; | 88 | saveTemplate->setPixmap (iconp ) ; |
83 | int size = saveTemplate->sizeHint().height(); | 89 | int size = saveTemplate->sizeHint().height(); |
84 | if ( QApplication::desktop()->width() < 321 ) | 90 | if ( QApplication::desktop()->width() < 321 ) |
85 | iconp = SmallIcon("fileimport16"); | 91 | iconp = SmallIcon("fileimport16"); |
86 | else | 92 | else |
87 | iconp = SmallIcon("fileimport"); | 93 | iconp = SmallIcon("fileimport"); |
88 | loadTemplate->setPixmap (iconp ) ; | 94 | loadTemplate->setPixmap (iconp ) ; |
89 | loadTemplate->setFixedSize( size, size ); | 95 | loadTemplate->setFixedSize( size, size ); |
90 | saveTemplate->setFixedSize( size, size ); | 96 | saveTemplate->setFixedSize( size, size ); |
91 | toggleJournal->setFixedSize( size , size ); | 97 | toggleJournal->setFixedSize( size , size ); |
92 | mEditor = new KTextEdit(this); | 98 | mEditor = new KTextEdit(this); |
93 | #ifndef DESKTOP_VERSION | 99 | #ifndef DESKTOP_VERSION |
94 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 100 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
95 | #endif | 101 | #endif |
96 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 102 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
97 | QBoxLayout *topLayout = new QVBoxLayout(this); | 103 | QBoxLayout *topLayout = new QVBoxLayout(this); |
98 | topLayout->addWidget(vb); | 104 | topLayout->addWidget(vb); |
99 | topLayout->addWidget(mEditor); | 105 | topLayout->addWidget(mEditor); |
100 | mEditor->installEventFilter(this); | 106 | mEditor->installEventFilter(this); |
101 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 107 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
102 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 108 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
103 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 109 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
104 | } | 110 | } |
105 | 111 | ||
106 | JournalEntry::~JournalEntry() | 112 | JournalEntry::~JournalEntry() |
107 | { | 113 | { |
108 | //qDebug("JournalEntry::~JournalEntry() "); | 114 | //qDebug("JournalEntry::~JournalEntry() "); |
109 | } | 115 | } |
110 | QSize JournalEntry::sizeHint() const | 116 | QSize JournalEntry::sizeHint() const |
111 | { | 117 | { |
112 | return QSize ( 240, heiHint ); | 118 | return QSize ( 240, heiHint ); |
113 | } | 119 | } |
114 | void JournalEntry::slotSaveTemplate() | 120 | void JournalEntry::slotSaveTemplate() |
115 | { | 121 | { |
116 | QString fileName =locateLocal( "templates", "journals" ); | 122 | QString fileName =locateLocal( "templates", "journals" ); |
117 | QDir t_dir; | 123 | QDir t_dir; |
118 | if ( !t_dir.exists(fileName) ) | 124 | if ( !t_dir.exists(fileName) ) |
119 | t_dir.mkdir ( fileName ); | 125 | t_dir.mkdir ( fileName ); |
120 | fileName += "/journal"; | 126 | fileName += "/journal"; |
121 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 127 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
122 | if ( fileName.length() == 0 ) | 128 | if ( fileName.length() == 0 ) |
123 | return; | 129 | return; |
124 | 130 | ||
125 | QFile fileIn( fileName ); | 131 | QFile fileIn( fileName ); |
126 | if (!fileIn.open( IO_WriteOnly ) ) { | 132 | if (!fileIn.open( IO_WriteOnly ) ) { |
127 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 133 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
128 | .arg( fileName ) ); | 134 | .arg( fileName ) ); |
129 | return; | 135 | return; |
130 | } | 136 | } |
131 | // QString text; | 137 | // QString text; |
132 | QTextStream tsIn( &fileIn ); | 138 | QTextStream tsIn( &fileIn ); |
133 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 139 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
134 | tsIn << mEditor->text(); | 140 | tsIn << mEditor->text(); |
135 | fileIn.close(); | 141 | fileIn.close(); |
136 | } | 142 | } |
137 | void JournalEntry::slotLoadTemplate() | 143 | void JournalEntry::slotLoadTemplate() |
138 | { | 144 | { |
139 | QString fileName =locateLocal( "templates", "journals" ); | 145 | QString fileName =locateLocal( "templates", "journals" ); |
140 | QDir t_dir; | 146 | QDir t_dir; |
141 | if ( !t_dir.exists(fileName) ) | 147 | if ( !t_dir.exists(fileName) ) |
142 | t_dir.mkdir ( fileName ); | 148 | t_dir.mkdir ( fileName ); |
143 | fileName += "/journal"; | 149 | fileName += "/journal"; |
144 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 150 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
145 | if ( fileName.length() == 0 ) | 151 | if ( fileName.length() == 0 ) |
146 | return; | 152 | return; |
147 | QFile fileIn( fileName ); | 153 | QFile fileIn( fileName ); |
148 | if (!fileIn.open( IO_ReadOnly ) ) { | 154 | if (!fileIn.open( IO_ReadOnly ) ) { |
149 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 155 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
150 | .arg( fileName ) ); | 156 | .arg( fileName ) ); |
151 | return; | 157 | return; |
152 | } | 158 | } |
153 | QTextStream tsIn( &fileIn ); | 159 | QTextStream tsIn( &fileIn ); |
154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 160 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
155 | QString text = tsIn.read(); | 161 | QString text = tsIn.read(); |
156 | fileIn.close(); | 162 | fileIn.close(); |
157 | int line, col; | 163 | int line, col; |
158 | mEditor->getCursorPosition (& line, & col ); | 164 | mEditor->getCursorPosition (& line, & col ); |
159 | mEditor-> insertAt ( text, line, col, true ); | 165 | mEditor-> insertAt ( text, line, col, true ); |
160 | //mEditor->setIgnoreMark( true ); | 166 | //mEditor->setIgnoreMark( true ); |
161 | } | 167 | } |
162 | void JournalEntry::setDate(const QDate &date) | 168 | void JournalEntry::setDate(const QDate &date) |
163 | { | 169 | { |
164 | showOnlyMode = false; | 170 | showOnlyMode = false; |
165 | writeJournal(); | 171 | writeJournal(); |
166 | mDate = date; | 172 | mDate = date; |
167 | int id = mCalendar->defaultCalendar(); | 173 | int id = mCalendar->defaultCalendar(); |
168 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 174 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
169 | mTitleLabel->setText( " (" + calname +")"); | 175 | mTitleLabel->setText( " (" + calname +")"); |
170 | } | 176 | } |
171 | 177 | ||
172 | void JournalEntry::toggleShowJournal() | 178 | void JournalEntry::toggleShowJournal() |
173 | { | 179 | { |
174 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) | 180 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) |
175 | flushEntry(); | 181 | flushEntry(); |
176 | if ( showOnlyMode ) | 182 | if ( showOnlyMode ) |
177 | emit showJournalOnly( 0 ); | 183 | emit showJournalOnly( 0 ); |
178 | else { | 184 | else { |
179 | // we have to protect mJournal from deleting if mJournal has empty text | 185 | // we have to protect mJournal from deleting if mJournal has empty text |
180 | visibleMode = false; // set to true via :setShowOnly() | 186 | visibleMode = false; // set to true via :setShowOnly() |
181 | emit showJournalOnly( mJournal ); | 187 | emit showJournalOnly( mJournal ); |
182 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); | 188 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); |
183 | } | 189 | } |
184 | } | 190 | } |
185 | void JournalEntry::setVisibleOn() | 191 | void JournalEntry::setVisibleOn() |
186 | { | 192 | { |
187 | visibleMode = true; | 193 | visibleMode = true; |
188 | } | 194 | } |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 067c34c..ec1154a 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1072,145 +1072,146 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
1072 | } else { | 1072 | } else { |
1073 | actcol = mDefaultTextColorShaded; | 1073 | actcol = mDefaultTextColorShaded; |
1074 | } | 1074 | } |
1075 | p.setPen(actcol); | 1075 | p.setPen(actcol); |
1076 | } | 1076 | } |
1077 | if (actcol == mDefaultTextColorShaded) { | 1077 | if (actcol == mDefaultTextColorShaded) { |
1078 | if ( ! mouseDown ) { | 1078 | if ( ! mouseDown ) { |
1079 | continue; | 1079 | continue; |
1080 | } | 1080 | } |
1081 | } | 1081 | } |
1082 | //Reset pen color after selected days block | 1082 | //Reset pen color after selected days block |
1083 | if (i == mSelEndT+1) { | 1083 | if (i == mSelEndT+1) { |
1084 | p.setPen(actcol); | 1084 | p.setPen(actcol); |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | // if today then draw rectangle around day | 1087 | // if today then draw rectangle around day |
1088 | if (today == i) { | 1088 | if (today == i) { |
1089 | tmppen = p.pen(); | 1089 | tmppen = p.pen(); |
1090 | QPen mTodayPen(p.pen()); | 1090 | QPen mTodayPen(p.pen()); |
1091 | if ( daysize.width() < 20 ) | 1091 | if ( daysize.width() < 20 ) |
1092 | mTodayPen.setWidth(1); | 1092 | mTodayPen.setWidth(1); |
1093 | else | 1093 | else |
1094 | mTodayPen.setWidth(mTodayMarginWidth); | 1094 | mTodayPen.setWidth(mTodayMarginWidth); |
1095 | //draw red rectangle for holidays | 1095 | //draw red rectangle for holidays |
1096 | if (pDays.testBit(i)) { | 1096 | if (pDays.testBit(i)) { |
1097 | if (actcol == mDefaultTextColor) { | 1097 | if (actcol == mDefaultTextColor) { |
1098 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 1098 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
1099 | } else { | 1099 | } else { |
1100 | mTodayPen.setColor(mHolidayColorShaded); | 1100 | mTodayPen.setColor(mHolidayColorShaded); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | //draw gray rectangle for today if in selection | 1103 | //draw gray rectangle for today if in selection |
1104 | if (i >= mSelStartT && i <= mSelEndT) { | 1104 | if (i >= mSelStartT && i <= mSelEndT) { |
1105 | QColor grey("grey"); | 1105 | QColor grey("grey"); |
1106 | mTodayPen.setColor(grey); | 1106 | mTodayPen.setColor(grey); |
1107 | } | 1107 | } |
1108 | p.setPen(mTodayPen); | 1108 | p.setPen(mTodayPen); |
1109 | 1109 | ||
1110 | 1110 | ||
1111 | int addCol = 0; | 1111 | int addCol = 0; |
1112 | int addRow = 0; | 1112 | int addRow = 0; |
1113 | if (rowModulo) { | 1113 | if (rowModulo) { |
1114 | if ( row >= 6 - rowModulo ) | 1114 | if ( row >= 6 - rowModulo ) |
1115 | addRow = row - 5 + rowModulo; | 1115 | addRow = row - 5 + rowModulo; |
1116 | } | 1116 | } |
1117 | if ( colModulo ) { | 1117 | if ( colModulo ) { |
1118 | if ( col >= 7 - colModulo ) | 1118 | if ( col >= 7 - colModulo ) |
1119 | addCol = col - 6 + colModulo-1; | 1119 | addCol = col - 6 + colModulo-1; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | addCol += 1; | 1122 | addCol += 1; |
1123 | if ( row == 0 ) | 1123 | if ( row == 0 ) |
1124 | addRow = 1; | 1124 | addRow = 1; |
1125 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); | 1125 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); |
1126 | p.setPen(tmppen); | 1126 | p.setPen(tmppen); |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | // if any events are on that day then draw it using a bold font | 1129 | // if any events are on that day then draw it using a bold font |
1130 | if ( eDays.testBit(i) ) { | 1130 | if ( eDays.testBit(i) ) { |
1131 | QFont myFont = font(); | 1131 | QFont myFont = font(); |
1132 | myFont.setBold(true); | 1132 | myFont.setBold(true); |
1133 | p.setFont(myFont); | 1133 | p.setFont(myFont); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | // if it is a holiday then use the default holiday color | 1136 | // if it is a holiday then use the default holiday color |
1137 | if ( pDays.testBit(i)) { | 1137 | if ( pDays.testBit(i)) { |
1138 | if ( bDays.testBit(i) ) { | 1138 | if ( bDays.testBit(i) ) { |
1139 | if ( hDays.testBit(i) ) | 1139 | if ( hDays.testBit(i) ) |
1140 | p.setPen(QColor(0,200,0)); | 1140 | p.setPen(QColor(0,200,0)); |
1141 | else | 1141 | else |
1142 | p.setPen(QColor(Qt::blue)); | 1142 | p.setPen(QColor(Qt::blue)); |
1143 | } else { | 1143 | } else { |
1144 | if (actcol == mDefaultTextColor ) { | 1144 | if (actcol == mDefaultTextColor ) { |
1145 | p.setPen(KOPrefs::instance()->mHolidayColor); | 1145 | p.setPen(KOPrefs::instance()->mHolidayColor); |
1146 | } else { | 1146 | } else { |
1147 | p.setPen(mHolidayColorShaded); | 1147 | p.setPen(mHolidayColorShaded); |
1148 | } | 1148 | } |
1149 | } | 1149 | } |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | // draw selected days with special color | 1152 | // draw selected days with special color |
1153 | // DO NOT specially highlight holidays in selection ! | 1153 | // DO NOT specially highlight holidays in selection ! |
1154 | if (i >= mSelStartT && i <= mSelEndT) { | 1154 | if (i >= mSelStartT && i <= mSelEndT) { |
1155 | ;//p.setPen(mSelectedDaysColor); | 1155 | ;//p.setPen(mSelectedDaysColor); |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | int addCol = 0; | 1158 | int addCol = 0; |
1159 | int addRow = 0; | 1159 | int addRow = 0; |
1160 | if ( colModulo ) { | 1160 | if ( colModulo ) { |
1161 | if ( col >= 7 - colModulo ) | 1161 | if ( col >= 7 - colModulo ) |
1162 | addCol = col - 7 + colModulo; | 1162 | addCol = col - 7 + colModulo; |
1163 | } | 1163 | } |
1164 | if ( rowModulo ) { | 1164 | if ( rowModulo ) { |
1165 | if ( row >= 6 - rowModulo ) | 1165 | if ( row >= 6 - rowModulo ) |
1166 | addRow = row - 5 + rowModulo; | 1166 | addRow = row - 5 + rowModulo; |
1167 | } | 1167 | } |
1168 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 1168 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
1169 | ++addCol;//++addCol; | 1169 | ++addCol;//++addCol; |
1170 | if ( row == 0) | 1170 | if ( row == 0) |
1171 | addRow = 1; | 1171 | addRow = 1; |
1172 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 1172 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
1173 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 1173 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
1174 | 1174 | ||
1175 | // reset color to actual color | 1175 | // reset color to actual color |
1176 | if (pDays.testBit(i)) { | 1176 | if (pDays.testBit(i)) { |
1177 | p.setPen(actcol); | 1177 | p.setPen(actcol); |
1178 | } | 1178 | } |
1179 | // reset bold font to plain font | 1179 | // reset bold font to plain font |
1180 | if ( eDays.testBit(i)) { | 1180 | if ( eDays.testBit(i)) { |
1181 | QFont myFont = font(); | 1181 | QFont myFont = font(); |
1182 | myFont.setBold(false); | 1182 | myFont.setBold(false); |
1183 | p.setFont(myFont); | 1183 | p.setFont(myFont); |
1184 | } | 1184 | } |
1185 | } | 1185 | } |
1186 | p.setPen(mDefaultTextColor); | 1186 | p.setPen(mDefaultTextColor); |
1187 | p.drawRect(0, 0, width(), height()); | 1187 | p.drawRect(0, 0, width(), height()); |
1188 | } else { | 1188 | } else { |
1189 | //qDebug("NO redraw "); | 1189 | //qDebug("NO redraw "); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); | 1192 | bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); |
1193 | mRedrawNeeded = false; | 1193 | mRedrawNeeded = false; |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | // ---------------------------------------------------------------------------- | 1196 | // ---------------------------------------------------------------------------- |
1197 | // R E SI Z E E V E N T H A N D L I N G | 1197 | // R E SI Z E E V E N T H A N D L I N G |
1198 | // ---------------------------------------------------------------------------- | 1198 | // ---------------------------------------------------------------------------- |
1199 | 1199 | ||
1200 | void KODayMatrix::resizeEvent(QResizeEvent *) | 1200 | void KODayMatrix::resizeEvent(QResizeEvent * e) |
1201 | { | 1201 | { |
1202 | QRect sz = frameRect(); | 1202 | QRect sz = frameRect(); |
1203 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 1203 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
1204 | daysize.setWidth(sz.width() / 7); | 1204 | daysize.setWidth(sz.width() / 7); |
1205 | QFrame::resizeEvent( e ); | ||
1205 | } | 1206 | } |
1206 | 1207 | ||
1207 | QSize KODayMatrix::sizeHint() const | 1208 | QSize KODayMatrix::sizeHint() const |
1208 | { | 1209 | { |
1209 | 1210 | ||
1210 | QFontMetrics fm ( font() ); | 1211 | QFontMetrics fm ( font() ); |
1211 | int wid = fm.width( "30") *7+3; | 1212 | int wid = fm.width( "30") *7+3; |
1212 | int hei = fm.height() * 6+3; | 1213 | int hei = fm.height() * 6+3; |
1213 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | 1214 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); |
1214 | return QSize ( wid, hei ); | 1215 | return QSize ( wid, hei ); |
1215 | 1216 | ||
1216 | } | 1217 | } |
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 2fbcd42..e07bc53 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -59,263 +59,263 @@ | |||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 61 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : |
62 | QObject( parent, name) | 62 | QObject( parent, name) |
63 | { | 63 | { |
64 | mNextFocus = 0; | 64 | mNextFocus = 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | KOEditorGeneral::~KOEditorGeneral() | 67 | KOEditorGeneral::~KOEditorGeneral() |
68 | { | 68 | { |
69 | } | 69 | } |
70 | 70 | ||
71 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 71 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
72 | { | 72 | { |
73 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 73 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
74 | 74 | ||
75 | #if 0 | 75 | #if 0 |
76 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 76 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
77 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 77 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 80 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
81 | headerLayout->addWidget(summaryLabel,1,0); | 81 | headerLayout->addWidget(summaryLabel,1,0); |
82 | 82 | ||
83 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 83 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
84 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 84 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
85 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 85 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
86 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 86 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
87 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 87 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
88 | if ( QApplication::desktop()->width() > 320 ) | 88 | if ( QApplication::desktop()->width() > 320 ) |
89 | mSummaryEdit->setMaximumHeight( hei +6 ); | 89 | mSummaryEdit->setMaximumHeight( hei +6 ); |
90 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); | 90 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); |
91 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } | 91 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } |
92 | // mSummaryEdit = new QLineEdit(parent); | 92 | // mSummaryEdit = new QLineEdit(parent); |
93 | headerLayout->addWidget(mSummaryEdit,1,1); | 93 | headerLayout->addWidget(mSummaryEdit,1,1); |
94 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 94 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
95 | 95 | ||
96 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 96 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
97 | if ( QApplication::desktop()->height() < 320 ) | 97 | if ( QApplication::desktop()->height() < 320 ) |
98 | headerLayout->addWidget(locationLabel,1,2); | 98 | headerLayout->addWidget(locationLabel,1,2); |
99 | else | 99 | else |
100 | headerLayout->addWidget(locationLabel,2,0); | 100 | headerLayout->addWidget(locationLabel,2,0); |
101 | 101 | ||
102 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 102 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
103 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 103 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
104 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) | 104 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) |
105 | mLocationEdit->setMaximumHeight( hei + 6); | 105 | mLocationEdit->setMaximumHeight( hei + 6); |
106 | 106 | ||
107 | // mLocationEdit = new QLineEdit(parent); | 107 | // mLocationEdit = new QLineEdit(parent); |
108 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 108 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
109 | if ( QApplication::desktop()->height() < 320 ) { | 109 | if ( QApplication::desktop()->height() < 320 ) { |
110 | headerLayout->addWidget(mLocationEdit,1,3); | 110 | headerLayout->addWidget(mLocationEdit,1,3); |
111 | headerLayout->setColStretch( 1, 10); | 111 | headerLayout->setColStretch( 1, 10); |
112 | headerLayout->setColStretch( 3, 10); | 112 | headerLayout->setColStretch( 3, 10); |
113 | } | 113 | } |
114 | else { | 114 | else { |
115 | headerLayout->addWidget(mLocationEdit,2,1); | 115 | headerLayout->addWidget(mLocationEdit,2,1); |
116 | headerLayout->setColStretch( 1, 10); | 116 | headerLayout->setColStretch( 1, 10); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | void KOEditorGeneral::setFocusOn( int i ) | 119 | void KOEditorGeneral::setFocusOn( int i ) |
120 | { | 120 | { |
121 | mNextFocus = i; | 121 | mNextFocus = i; |
122 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 122 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
123 | } | 123 | } |
124 | void KOEditorGeneral::slotSetFocusOn() | 124 | void KOEditorGeneral::slotSetFocusOn() |
125 | { | 125 | { |
126 | mNextFocus; | 126 | mNextFocus; |
127 | if ( mNextFocus == 1 ) { | 127 | if ( mNextFocus == 1 ) { |
128 | mDescriptionEdit->setFocus(); | 128 | mDescriptionEdit->setFocus(); |
129 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 129 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
130 | } | 130 | } |
131 | if ( mNextFocus == 2 ) { | 131 | if ( mNextFocus == 2 ) { |
132 | mSummaryEdit->setFocus(); | 132 | mSummaryEdit->setFocus(); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | void KOEditorGeneral::editCategories() | 135 | void KOEditorGeneral::editCategories() |
136 | { | 136 | { |
137 | // qDebug("KOEditorGeneral::editCategories() "); | 137 | // qDebug("KOEditorGeneral::editCategories() "); |
138 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 138 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
139 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 139 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
140 | //KOGlobals::fitDialogToScreen( csd ); | 140 | //KOGlobals::fitDialogToScreen( csd ); |
141 | csd->setColorEnabled(); | 141 | csd->setColorEnabled(); |
142 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 142 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
143 | csd->exec(); | 143 | csd->exec(); |
144 | delete csd; | 144 | delete csd; |
145 | } | 145 | } |
146 | 146 | ||
147 | void KOEditorGeneral::showCatPopup() | 147 | void KOEditorGeneral::showCatPopup() |
148 | { | 148 | { |
149 | mCatPopup->clear(); | 149 | mCatPopup->clear(); |
150 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | 150 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); |
151 | int index = 0; | 151 | int index = 0; |
152 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 152 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
153 | it != KOPrefs::instance()->mCustomCategories.end (); | 153 | it != KOPrefs::instance()->mCustomCategories.end (); |
154 | ++it) { | 154 | ++it) { |
155 | mCatPopup->insertItem (*it, index ); | 155 | mCatPopup->insertItem (*it, index ); |
156 | //mCategory[index] = *it; | 156 | //mCategory[index] = *it; |
157 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); | 157 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); |
158 | ++index; | 158 | ++index; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | void KOEditorGeneral::selectedCatPopup( int index ) | 161 | void KOEditorGeneral::selectedCatPopup( int index ) |
162 | { | 162 | { |
163 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); | 163 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); |
164 | QString colcat = categories.first(); | 164 | QString colcat = categories.first(); |
165 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 165 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
166 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 166 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
167 | else | 167 | else |
168 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | 168 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); |
169 | categories.sort (); | 169 | categories.sort (); |
170 | if ( !colcat.isEmpty() ) { | 170 | if ( !colcat.isEmpty() ) { |
171 | if ( categories.find ( colcat ) != categories.end () ) { | 171 | if ( categories.find ( colcat ) != categories.end () ) { |
172 | categories.remove( colcat ); | 172 | categories.remove( colcat ); |
173 | categories.prepend( colcat ); | 173 | categories.prepend( colcat ); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | setCategories( categories.join(",") ); | 176 | setCategories( categories.join(",") ); |
177 | } | 177 | } |
178 | 178 | ||
179 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 179 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
180 | { | 180 | { |
181 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 181 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
182 | mCatPopup = new QPopupMenu ( parent ); | 182 | mCatPopup = new QPopupMenu ( parent ); |
183 | mCatPopup->setCheckable (true); | 183 | mCatPopup->setCheckable (true); |
184 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | 184 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); |
185 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | 185 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); |
186 | mCategoriesButton = new QPushButton(parent); | 186 | mCategoriesButton = new QPushButton(parent); |
187 | mCategoriesButton->setText(i18n("Categories")); | 187 | mCategoriesButton->setText(i18n("Categories...")); |
188 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | ||
188 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 189 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
189 | categoriesLayout->addWidget(mCategoriesButton); | 190 | categoriesLayout->addWidget(mCategoriesButton); |
190 | mCategoriesButton->setPopup( mCatPopup ); | ||
191 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); | 191 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); |
192 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 192 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
193 | connect(mCategoriesLabel,SIGNAL(clicked()),this, SLOT(editCategories() )); | 193 | mCategoriesLabel->setPopup( mCatPopup ); |
194 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 194 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
195 | categoriesLayout->addWidget(mCategoriesLabel,1); | 195 | categoriesLayout->addWidget(mCategoriesLabel,1); |
196 | } | 196 | } |
197 | 197 | ||
198 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 198 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
199 | { | 199 | { |
200 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 200 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
201 | 201 | ||
202 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 202 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
203 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 203 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
204 | secrecyLayout->addWidget(mCancelBox); | 204 | secrecyLayout->addWidget(mCancelBox); |
205 | secrecyLayout->addWidget(secrecyLabel); | 205 | secrecyLayout->addWidget(secrecyLabel); |
206 | 206 | ||
207 | mSecrecyCombo = new QComboBox(parent); | 207 | mSecrecyCombo = new QComboBox(parent); |
208 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 208 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
209 | secrecyLayout->addWidget(mSecrecyCombo); | 209 | secrecyLayout->addWidget(mSecrecyCombo); |
210 | } | 210 | } |
211 | 211 | ||
212 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 212 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) |
213 | { | 213 | { |
214 | mDescriptionEdit = new KTextEdit(parent); | 214 | mDescriptionEdit = new KTextEdit(parent); |
215 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 215 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
216 | mDescriptionEdit->append(""); | 216 | mDescriptionEdit->append(""); |
217 | mDescriptionEdit->setReadOnly(false); | 217 | mDescriptionEdit->setReadOnly(false); |
218 | mDescriptionEdit->setOverwriteMode(false); | 218 | mDescriptionEdit->setOverwriteMode(false); |
219 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); | 219 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); |
220 | topLayout->addWidget(mDescriptionEdit); | 220 | topLayout->addWidget(mDescriptionEdit); |
221 | #ifndef DESKTOP_VERSION | 221 | #ifndef DESKTOP_VERSION |
222 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 222 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
223 | #endif | 223 | #endif |
224 | 224 | ||
225 | } | 225 | } |
226 | 226 | ||
227 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 227 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) |
228 | { | 228 | { |
229 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 229 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); |
230 | 230 | ||
231 | //mAlarmBell = new QLabel(parent); | 231 | //mAlarmBell = new QLabel(parent); |
232 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 232 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
233 | //alarmLayout->addWidget(mAlarmBell); | 233 | //alarmLayout->addWidget(mAlarmBell); |
234 | if ( QApplication::desktop()->width() < 320 ) | 234 | if ( QApplication::desktop()->width() < 320 ) |
235 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 235 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
236 | else | 236 | else |
237 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 237 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
238 | 238 | ||
239 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); | 239 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); |
240 | alarmLayout->addWidget(mAlarmButton); | 240 | alarmLayout->addWidget(mAlarmButton); |
241 | 241 | ||
242 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 242 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
243 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); | 243 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); |
244 | alarmLayout->addWidget(mAlarmTimeEdit); | 244 | alarmLayout->addWidget(mAlarmTimeEdit); |
245 | mAlarmIncrCombo = new QComboBox(false, parent); | 245 | mAlarmIncrCombo = new QComboBox(false, parent); |
246 | if ( QApplication::desktop()->width() < 320 ) { | 246 | if ( QApplication::desktop()->width() < 320 ) { |
247 | mAlarmIncrCombo->insertItem(i18n("min")); | 247 | mAlarmIncrCombo->insertItem(i18n("min")); |
248 | mAlarmIncrCombo->insertItem(i18n("hou")); | 248 | mAlarmIncrCombo->insertItem(i18n("hou")); |
249 | mAlarmIncrCombo->insertItem(i18n("day")); | 249 | mAlarmIncrCombo->insertItem(i18n("day")); |
250 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); | 250 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); |
251 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); | 251 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); |
252 | } else { | 252 | } else { |
253 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 253 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
254 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 254 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
255 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 255 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
256 | } | 256 | } |
257 | 257 | ||
258 | // mAlarmIncrCombo->setMinimumHeight(20); | 258 | // mAlarmIncrCombo->setMinimumHeight(20); |
259 | alarmLayout->addWidget(mAlarmIncrCombo); | 259 | alarmLayout->addWidget(mAlarmIncrCombo); |
260 | mAlarmSoundButton = new QPushButton(parent); | 260 | mAlarmSoundButton = new QPushButton(parent); |
261 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 261 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
262 | mAlarmSoundButton->setToggleButton(true); | 262 | mAlarmSoundButton->setToggleButton(true); |
263 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 263 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
264 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 264 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
265 | alarmLayout->addWidget(mAlarmSoundButton); | 265 | alarmLayout->addWidget(mAlarmSoundButton); |
266 | 266 | ||
267 | mAlarmProgramButton = new QPushButton(parent); | 267 | mAlarmProgramButton = new QPushButton(parent); |
268 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 268 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
269 | mAlarmProgramButton->setToggleButton(true); | 269 | mAlarmProgramButton->setToggleButton(true); |
270 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 270 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
271 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 271 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
272 | alarmLayout->addWidget(mAlarmProgramButton); | 272 | alarmLayout->addWidget(mAlarmProgramButton); |
273 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 273 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
274 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 274 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
275 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 275 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
276 | // mAlarmSoundButton->hide(); | 276 | // mAlarmSoundButton->hide(); |
277 | // mAlarmProgramButton->hide(); | 277 | // mAlarmProgramButton->hide(); |
278 | // } | 278 | // } |
279 | } | 279 | } |
280 | 280 | ||
281 | void KOEditorGeneral::pickAlarmSound() | 281 | void KOEditorGeneral::pickAlarmSound() |
282 | { | 282 | { |
283 | 283 | ||
284 | //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); | 284 | //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); |
285 | 285 | ||
286 | bool oldState = mAlarmSoundButton->isOn(); | 286 | bool oldState = mAlarmSoundButton->isOn(); |
287 | 287 | ||
288 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 288 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, |
289 | i18n("*.wav|Wav Files"), 0)); | 289 | i18n("*.wav|Wav Files"), 0)); |
290 | if (!fileName.isEmpty()) { | 290 | if (!fileName.isEmpty()) { |
291 | mAlarmSound = fileName; | 291 | mAlarmSound = fileName; |
292 | QToolTip::remove(mAlarmSoundButton); | 292 | QToolTip::remove(mAlarmSoundButton); |
293 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 293 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
294 | QToolTip::add(mAlarmSoundButton, dispStr); | 294 | QToolTip::add(mAlarmSoundButton, dispStr); |
295 | mAlarmProgramButton->setOn(false); | 295 | mAlarmProgramButton->setOn(false); |
296 | mAlarmSoundButton->setOn(true); | 296 | mAlarmSoundButton->setOn(true); |
297 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 297 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
298 | } else { | 298 | } else { |
299 | mAlarmProgramButton->setOn(oldState); | 299 | mAlarmProgramButton->setOn(oldState); |
300 | mAlarmSoundButton->setOn(!oldState); | 300 | mAlarmSoundButton->setOn(!oldState); |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | if (mAlarmProgramButton->isOn()) | 305 | if (mAlarmProgramButton->isOn()) |
306 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 306 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
307 | if ( mAlarmSoundButton->isOn()) | 307 | if ( mAlarmSoundButton->isOn()) |
308 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 308 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
309 | 309 | ||
310 | } | 310 | } |
311 | 311 | ||
312 | void KOEditorGeneral::pickAlarmProgram() | 312 | void KOEditorGeneral::pickAlarmProgram() |
313 | { | 313 | { |
314 | bool oldState = mAlarmProgramButton->isOn(); | 314 | bool oldState = mAlarmProgramButton->isOn(); |
315 | 315 | ||
316 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 316 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
317 | if (!fileName.isEmpty()) { | 317 | if (!fileName.isEmpty()) { |
318 | mAlarmProgram = fileName; | 318 | mAlarmProgram = fileName; |
319 | QToolTip::remove(mAlarmProgramButton); | 319 | QToolTip::remove(mAlarmProgramButton); |
320 | QString dispStr = i18n("Running '%1'").arg(fileName); | 320 | QString dispStr = i18n("Running '%1'").arg(fileName); |
321 | QToolTip::add(mAlarmProgramButton, dispStr); | 321 | QToolTip::add(mAlarmProgramButton, dispStr); |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 9db2040..02d7aae 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -266,269 +266,269 @@ KOPrefs::KOPrefs() : | |||
266 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 266 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
267 | #ifdef DESKTOP_VERSION | 267 | #ifdef DESKTOP_VERSION |
268 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 268 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
269 | #else | 269 | #else |
270 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 270 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
271 | #endif | 271 | #endif |
272 | addItemInt("Day Begins",&mDayBegins,7); | 272 | addItemInt("Day Begins",&mDayBegins,7); |
273 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 273 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
274 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 274 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
275 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 275 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
276 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 276 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
277 | 277 | ||
278 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 278 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
279 | addItemBool("Full View Month",&mFullViewMonth,true); | 279 | addItemBool("Full View Month",&mFullViewMonth,true); |
280 | addItemBool("Full View Todo",&mFullViewTodo,true); | 280 | addItemBool("Full View Todo",&mFullViewTodo,true); |
281 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 281 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
282 | 282 | ||
283 | addItemInt("Next X Days",&mNextXDays,3); | 283 | addItemInt("Next X Days",&mNextXDays,3); |
284 | 284 | ||
285 | KPrefs::setCurrentGroup("Printer"); | 285 | KPrefs::setCurrentGroup("Printer"); |
286 | 286 | ||
287 | KPrefs::setCurrentGroup("Layout"); | 287 | KPrefs::setCurrentGroup("Layout"); |
288 | 288 | ||
289 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 289 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
290 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 290 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
291 | 291 | ||
292 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 292 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
293 | 293 | ||
294 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 294 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
295 | 295 | ||
296 | KPrefs::setCurrentGroup("Group Scheduling"); | 296 | KPrefs::setCurrentGroup("Group Scheduling"); |
297 | 297 | ||
298 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 298 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
299 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 299 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
300 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 300 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
301 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 301 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
302 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 302 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
303 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 303 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
304 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 304 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
305 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 305 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
306 | 306 | ||
307 | KPrefs::setCurrentGroup( "Editors" ); | 307 | KPrefs::setCurrentGroup( "Editors" ); |
308 | 308 | ||
309 | addItemStringList( "EventTemplates", &mEventTemplates ); | 309 | addItemStringList( "EventTemplates", &mEventTemplates ); |
310 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 310 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
311 | 311 | ||
312 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 312 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
313 | 313 | ||
314 | KPrefs::setCurrentGroup( "ViewOptions" ); | 314 | KPrefs::setCurrentGroup( "ViewOptions" ); |
315 | addItemBool("EVshowDetails",&mEVshowDetails,true); | 315 | addItemBool("EVshowDetails",&mEVshowDetails,true); |
316 | addItemBool("EVshowCreated",&mEVshowCreated,true); | 316 | addItemBool("EVshowCreated",&mEVshowCreated,true); |
317 | addItemBool("EVshowChanged",&mEVshowChanged,true); | 317 | addItemBool("EVshowChanged",&mEVshowChanged,true); |
318 | addItemBool("WTshowDetails",&mWTshowDetails,false); | 318 | addItemBool("WTshowDetails",&mWTshowDetails,false); |
319 | addItemBool("WTshowCreated",&mWTshowCreated,false); | 319 | addItemBool("WTshowCreated",&mWTshowCreated,false); |
320 | addItemBool("WTshowChanged",&mWTshowChanged,false); | 320 | addItemBool("WTshowChanged",&mWTshowChanged,false); |
321 | mCalendars.setAutoDelete( true ); | 321 | mCalendars.setAutoDelete( true ); |
322 | } | 322 | } |
323 | 323 | ||
324 | 324 | ||
325 | KOPrefs::~KOPrefs() | 325 | KOPrefs::~KOPrefs() |
326 | { | 326 | { |
327 | if (mInstance == this) | 327 | if (mInstance == this) |
328 | mInstance = insd.setObject(0); | 328 | mInstance = insd.setObject(0); |
329 | mCalendars.setAutoDelete( true ); | 329 | mCalendars.setAutoDelete( true ); |
330 | mCalendars.clear(); | 330 | mCalendars.clear(); |
331 | //qDebug("KOPrefs::~KOPrefs() "); | 331 | //qDebug("KOPrefs::~KOPrefs() "); |
332 | } | 332 | } |
333 | 333 | ||
334 | 334 | ||
335 | KOPrefs *KOPrefs::instance() | 335 | KOPrefs *KOPrefs::instance() |
336 | { | 336 | { |
337 | if (!mInstance) { | 337 | if (!mInstance) { |
338 | mInstance = insd.setObject(new KOPrefs()); | 338 | mInstance = insd.setObject(new KOPrefs()); |
339 | mInstance->readConfig(); | 339 | mInstance->readConfig(); |
340 | } | 340 | } |
341 | 341 | ||
342 | return mInstance; | 342 | return mInstance; |
343 | } | 343 | } |
344 | 344 | ||
345 | void KOPrefs::usrSetDefaults() | 345 | void KOPrefs::usrSetDefaults() |
346 | { | 346 | { |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | void KOPrefs::fillMailDefaults() | 350 | void KOPrefs::fillMailDefaults() |
351 | { | 351 | { |
352 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 352 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
353 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 353 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
354 | } | 354 | } |
355 | 355 | ||
356 | void KOPrefs::setTimeZoneIdDefault() | 356 | void KOPrefs::setTimeZoneIdDefault() |
357 | { | 357 | { |
358 | ; | 358 | ; |
359 | } | 359 | } |
360 | 360 | ||
361 | void KOPrefs::setAllDefaults() | 361 | void KOPrefs::setAllDefaults() |
362 | { | 362 | { |
363 | setCategoryDefaults(); | 363 | setCategoryDefaults(); |
364 | mEventSummaryUser = getDefaultList() ; | 364 | mEventSummaryUser = getDefaultList() ; |
365 | mTodoSummaryUser = getDefaultList() ; | 365 | mTodoSummaryUser = getDefaultList() ; |
366 | mLocationDefaults = getLocationDefaultList(); | 366 | mLocationDefaults = getLocationDefaultList(); |
367 | } | 367 | } |
368 | 368 | ||
369 | void KOPrefs::setCategoryDefaults() | 369 | void KOPrefs::setCategoryDefaults() |
370 | { | 370 | { |
371 | mCustomCategories.clear(); | 371 | mCustomCategories.clear(); |
372 | mCustomCategories = getDefaultList(); | 372 | mCustomCategories = getDefaultList(); |
373 | 373 | ||
374 | QStringList::Iterator it; | 374 | QStringList::Iterator it; |
375 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 375 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
376 | setCategoryColor(*it,mDefaultCategoryColor); | 376 | setCategoryColor(*it,mDefaultCategoryColor); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | QStringList KOPrefs::getLocationDefaultList() | 379 | QStringList KOPrefs::getLocationDefaultList() |
380 | { | 380 | { |
381 | QStringList retval ; | 381 | QStringList retval ; |
382 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 382 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
383 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 383 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
384 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 384 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
385 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 385 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
386 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 386 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
387 | 387 | ||
388 | retval.sort(); | 388 | retval.sort(); |
389 | return retval; | 389 | return retval; |
390 | } | 390 | } |
391 | QStringList KOPrefs::getDefaultList() | 391 | QStringList KOPrefs::getDefaultList() |
392 | { | 392 | { |
393 | QStringList retval ; | 393 | QStringList retval ; |
394 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Cinema") << i18n("Customer") | 394 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") |
395 | << i18n("Break") | 395 | << i18n("Break") |
396 | << i18n("Family") << i18n("Favorites") << i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 396 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") |
397 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Key Customer") | 397 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") |
398 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") | 398 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") |
399 | << i18n("PHB") << i18n("Phone Calls") << i18n("School") << i18n("Shopping") | 399 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") |
400 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 400 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") |
401 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 401 | << i18n("Vacation") ; |
402 | retval.sort(); | 402 | retval.sort(); |
403 | //qDebug("cat %s ", retval.join("-").latin1()); | 403 | //qDebug("cat %s ", retval.join("-").latin1()); |
404 | return retval; | 404 | return retval; |
405 | } | 405 | } |
406 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch") | 406 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") |
407 | void KOPrefs::usrReadConfig() | 407 | void KOPrefs::usrReadConfig() |
408 | { | 408 | { |
409 | config()->setGroup("General"); | 409 | config()->setGroup("General"); |
410 | 410 | ||
411 | //qDebug("KOPrefs::usrReadConfig() "); | 411 | //qDebug("KOPrefs::usrReadConfig() "); |
412 | mCustomCategories = config()->readListEntry("Custom Categories"); | 412 | mCustomCategories = config()->readListEntry("Custom Categories"); |
413 | mOldLoadedLanguage = mOldLanguage ; | 413 | mOldLoadedLanguage = mOldLanguage ; |
414 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 414 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
415 | if (mLocationDefaults.isEmpty()) { | 415 | if (mLocationDefaults.isEmpty()) { |
416 | mLocationDefaults = getLocationDefaultList(); | 416 | mLocationDefaults = getLocationDefaultList(); |
417 | } | 417 | } |
418 | 418 | ||
419 | if (mEventSummaryUser.isEmpty()) { | 419 | if (mEventSummaryUser.isEmpty()) { |
420 | mEventSummaryUser = getDefaultList() ; | 420 | mEventSummaryUser = getDefaultList() ; |
421 | } | 421 | } |
422 | if (mTodoSummaryUser.isEmpty()) { | 422 | if (mTodoSummaryUser.isEmpty()) { |
423 | mTodoSummaryUser = getDefaultList() ; | 423 | mTodoSummaryUser = getDefaultList() ; |
424 | } | 424 | } |
425 | 425 | ||
426 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 426 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
427 | 427 | ||
428 | config()->setGroup("Personal Settings"); | 428 | config()->setGroup("Personal Settings"); |
429 | mName = config()->readEntry("user_name",""); | 429 | mName = config()->readEntry("user_name",""); |
430 | mEmail = config()->readEntry("user_email",""); | 430 | mEmail = config()->readEntry("user_email",""); |
431 | fillMailDefaults(); | 431 | fillMailDefaults(); |
432 | 432 | ||
433 | config()->setGroup("Category Colors"); | 433 | config()->setGroup("Category Colors"); |
434 | QStringList::Iterator it; | 434 | QStringList::Iterator it; |
435 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 435 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
436 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 436 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
437 | 437 | ||
438 | } | 438 | } |
439 | KConfig fc (locateLocal("config","kopicalendarrc")); | 439 | KConfig fc (locateLocal("config","kopicalendarrc")); |
440 | fc.setGroup("CC"); | 440 | fc.setGroup("CC"); |
441 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 441 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
442 | mNextAvailableCalendar = 1; | 442 | mNextAvailableCalendar = 1; |
443 | if ( numCals == 0 ) { | 443 | if ( numCals == 0 ) { |
444 | KopiCalendarFile *kkf = getNewCalendar(); | 444 | KopiCalendarFile *kkf = getNewCalendar(); |
445 | kkf->isStandard = true; | 445 | kkf->isStandard = true; |
446 | kkf->mName = i18n("Standard"); | 446 | kkf->mName = i18n("Standard"); |
447 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 447 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
448 | } | 448 | } |
449 | while ( mNextAvailableCalendar <= numCals ) { | 449 | while ( mNextAvailableCalendar <= numCals ) { |
450 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); | 450 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); |
451 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); | 451 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); |
452 | KopiCalendarFile *kkf = getNewCalendar(); | 452 | KopiCalendarFile *kkf = getNewCalendar(); |
453 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); | 453 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); |
454 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); | 454 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); |
455 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); | 455 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); |
456 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); | 456 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); |
457 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); | 457 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); |
458 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); | 458 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); |
459 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); | 459 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); |
460 | if ( kkf->mCalNumber == 1 ) { | 460 | if ( kkf->mCalNumber == 1 ) { |
461 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 461 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
462 | } | 462 | } |
463 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); | 463 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); |
464 | if ( kkf->mName == i18n("Birthdays") ) { | 464 | if ( kkf->mName == i18n("Birthdays") ) { |
465 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); | 465 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | KPimPrefs::usrReadConfig(); | 469 | KPimPrefs::usrReadConfig(); |
470 | } | 470 | } |
471 | 471 | ||
472 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 472 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
473 | { | 473 | { |
474 | return mDefCalColors[num-1]; | 474 | return mDefCalColors[num-1]; |
475 | } | 475 | } |
476 | 476 | ||
477 | KopiCalendarFile * KOPrefs::getNewCalendar() | 477 | KopiCalendarFile * KOPrefs::getNewCalendar() |
478 | { | 478 | { |
479 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 479 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
480 | kkf->mCalNumber = mNextAvailableCalendar; | 480 | kkf->mCalNumber = mNextAvailableCalendar; |
481 | mDefCalColors.resize( mNextAvailableCalendar ); | 481 | mDefCalColors.resize( mNextAvailableCalendar ); |
482 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 482 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
483 | ++mNextAvailableCalendar; | 483 | ++mNextAvailableCalendar; |
484 | kkf->mDefaultColor = mEventColor; | 484 | kkf->mDefaultColor = mEventColor; |
485 | kkf->mName = i18n("New Calendar"); | 485 | kkf->mName = i18n("New Calendar"); |
486 | mCalendars.append( kkf ); | 486 | mCalendars.append( kkf ); |
487 | return kkf; | 487 | return kkf; |
488 | } | 488 | } |
489 | void KOPrefs::deleteCalendar( int num ) | 489 | void KOPrefs::deleteCalendar( int num ) |
490 | { | 490 | { |
491 | KopiCalendarFile * kkf = mCalendars.first(); | 491 | KopiCalendarFile * kkf = mCalendars.first(); |
492 | while ( kkf ) { | 492 | while ( kkf ) { |
493 | if ( kkf->mCalNumber == num ) { | 493 | if ( kkf->mCalNumber == num ) { |
494 | qDebug("KOPrefs::deleteCalendar %d ", num ); | 494 | qDebug("KOPrefs::deleteCalendar %d ", num ); |
495 | mCalendars.remove( kkf ); | 495 | mCalendars.remove( kkf ); |
496 | delete kkf; | 496 | delete kkf; |
497 | return; | 497 | return; |
498 | } | 498 | } |
499 | kkf = mCalendars.next(); | 499 | kkf = mCalendars.next(); |
500 | } | 500 | } |
501 | } | 501 | } |
502 | QString KOPrefs::calName( int calNum) const | 502 | QString KOPrefs::calName( int calNum) const |
503 | { | 503 | { |
504 | return (mDefCalColors[calNum-1])->mName; | 504 | return (mDefCalColors[calNum-1])->mName; |
505 | } | 505 | } |
506 | QColor KOPrefs::defaultColor( int calNum ) const | 506 | QColor KOPrefs::defaultColor( int calNum ) const |
507 | { | 507 | { |
508 | if ( calNum == 1 ) return mEventColor; | 508 | if ( calNum == 1 ) return mEventColor; |
509 | return (mDefCalColors[calNum-1])->mDefaultColor; | 509 | return (mDefCalColors[calNum-1])->mDefaultColor; |
510 | } | 510 | } |
511 | void KOPrefs::usrWriteConfig() | 511 | void KOPrefs::usrWriteConfig() |
512 | { | 512 | { |
513 | config()->setGroup("General"); | 513 | config()->setGroup("General"); |
514 | config()->writeEntry("Custom Categories",mCustomCategories); | 514 | config()->writeEntry("Custom Categories",mCustomCategories); |
515 | 515 | ||
516 | config()->setGroup("Personal Settings"); | 516 | config()->setGroup("Personal Settings"); |
517 | config()->writeEntry("user_name",mName); | 517 | config()->writeEntry("user_name",mName); |
518 | config()->writeEntry("user_email",mEmail); | 518 | config()->writeEntry("user_email",mEmail); |
519 | 519 | ||
520 | config()->setGroup("Category Colors"); | 520 | config()->setGroup("Category Colors"); |
521 | QDictIterator<QColor> it(mCategoryColors); | 521 | QDictIterator<QColor> it(mCategoryColors); |
522 | while (it.current()) { | 522 | while (it.current()) { |
523 | config()->writeEntry(it.currentKey(),*(it.current())); | 523 | config()->writeEntry(it.currentKey(),*(it.current())); |
524 | ++it; | 524 | ++it; |
525 | } | 525 | } |
526 | KConfig fc (locateLocal("config","kopicalendarrc")); | 526 | KConfig fc (locateLocal("config","kopicalendarrc")); |
527 | fc.setGroup("CC"); | 527 | fc.setGroup("CC"); |
528 | fc.writeEntry("NumberCalendars",mCalendars.count()); | 528 | fc.writeEntry("NumberCalendars",mCalendars.count()); |
529 | int numCal = 1; | 529 | int numCal = 1; |
530 | int writeCal = 0; | 530 | int writeCal = 0; |
531 | while ( numCal < mNextAvailableCalendar ) { | 531 | while ( numCal < mNextAvailableCalendar ) { |
532 | KopiCalendarFile * kkf = mCalendars.first(); | 532 | KopiCalendarFile * kkf = mCalendars.first(); |
533 | while ( kkf ) { | 533 | while ( kkf ) { |
534 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); | 534 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); |