author | zautrix <zautrix> | 2005-07-07 12:30:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-07 12:30:17 (UTC) |
commit | 766b53919de14b8faec22db32b6a750acde0b760 (patch) (unidiff) | |
tree | bb07c0af89b0dddf4257a61e9f5b1cf23c4a282a /korganizer | |
parent | b4d85da57e2d558ec088af6f3b2a34b1854462c0 (diff) | |
download | kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.zip kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.gz kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/calendarview.cpp | 70 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 39 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 124 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 4 |
8 files changed, 192 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9a114d0..e766b8f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2529,390 +2529,460 @@ void CalendarView::writeSettings() | |||
2529 | list.clear(); | 2529 | list.clear(); |
2530 | list << QString::number( x ); | 2530 | list << QString::number( x ); |
2531 | list << QString::number( y ); | 2531 | list << QString::number( y ); |
2532 | list << QString::number( w ); | 2532 | list << QString::number( w ); |
2533 | list << QString::number( h ); | 2533 | list << QString::number( h ); |
2534 | config->writeEntry("SearchLayout",list ); | 2534 | config->writeEntry("SearchLayout",list ); |
2535 | } | 2535 | } |
2536 | #endif | 2536 | #endif |
2537 | 2537 | ||
2538 | 2538 | ||
2539 | config->sync(); | 2539 | config->sync(); |
2540 | } | 2540 | } |
2541 | 2541 | ||
2542 | void CalendarView::readFilterSettings(KConfig *config) | 2542 | void CalendarView::readFilterSettings(KConfig *config) |
2543 | { | 2543 | { |
2544 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2544 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2545 | 2545 | ||
2546 | mFilters.clear(); | 2546 | mFilters.clear(); |
2547 | 2547 | ||
2548 | config->setGroup("General"); | 2548 | config->setGroup("General"); |
2549 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2549 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2550 | 2550 | ||
2551 | QStringList::ConstIterator it = filterList.begin(); | 2551 | QStringList::ConstIterator it = filterList.begin(); |
2552 | QStringList::ConstIterator end = filterList.end(); | 2552 | QStringList::ConstIterator end = filterList.end(); |
2553 | while(it != end) { | 2553 | while(it != end) { |
2554 | // kdDebug() << " filter: " << (*it) << endl; | 2554 | // kdDebug() << " filter: " << (*it) << endl; |
2555 | 2555 | ||
2556 | CalFilter *filter; | 2556 | CalFilter *filter; |
2557 | filter = new CalFilter(*it); | 2557 | filter = new CalFilter(*it); |
2558 | config->setGroup("Filter_" + (*it).utf8()); | 2558 | config->setGroup("Filter_" + (*it).utf8()); |
2559 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2559 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2560 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2560 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2561 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2561 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2562 | mFilters.append(filter); | 2562 | mFilters.append(filter); |
2563 | 2563 | ||
2564 | ++it; | 2564 | ++it; |
2565 | } | 2565 | } |
2566 | 2566 | ||
2567 | if (mFilters.count() == 0) { | 2567 | if (mFilters.count() == 0) { |
2568 | CalFilter *filter = new CalFilter(i18n("Default")); | 2568 | CalFilter *filter = new CalFilter(i18n("Default")); |
2569 | mFilters.append(filter); | 2569 | mFilters.append(filter); |
2570 | } | 2570 | } |
2571 | mFilterView->updateFilters(); | 2571 | mFilterView->updateFilters(); |
2572 | config->setGroup("FilterView"); | 2572 | config->setGroup("FilterView"); |
2573 | 2573 | ||
2574 | mFilterView->blockSignals(true); | 2574 | mFilterView->blockSignals(true); |
2575 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2575 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2576 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2576 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2577 | mFilterView->blockSignals(false); | 2577 | mFilterView->blockSignals(false); |
2578 | // We do it manually to avoid it being done twice by the above calls | 2578 | // We do it manually to avoid it being done twice by the above calls |
2579 | updateFilter(); | 2579 | updateFilter(); |
2580 | } | 2580 | } |
2581 | 2581 | ||
2582 | void CalendarView::writeFilterSettings(KConfig *config) | 2582 | void CalendarView::writeFilterSettings(KConfig *config) |
2583 | { | 2583 | { |
2584 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2584 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2585 | 2585 | ||
2586 | QStringList filterList; | 2586 | QStringList filterList; |
2587 | 2587 | ||
2588 | CalFilter *filter = mFilters.first(); | 2588 | CalFilter *filter = mFilters.first(); |
2589 | while(filter) { | 2589 | while(filter) { |
2590 | // kdDebug() << " fn: " << filter->name() << endl; | 2590 | // kdDebug() << " fn: " << filter->name() << endl; |
2591 | filterList << filter->name(); | 2591 | filterList << filter->name(); |
2592 | config->setGroup("Filter_" + filter->name().utf8()); | 2592 | config->setGroup("Filter_" + filter->name().utf8()); |
2593 | config->writeEntry("Criteria",filter->criteria()); | 2593 | config->writeEntry("Criteria",filter->criteria()); |
2594 | config->writeEntry("CategoryList",filter->categoryList()); | 2594 | config->writeEntry("CategoryList",filter->categoryList()); |
2595 | filter = mFilters.next(); | 2595 | filter = mFilters.next(); |
2596 | } | 2596 | } |
2597 | config->setGroup("General"); | 2597 | config->setGroup("General"); |
2598 | config->writeEntry("CalendarFilters",filterList); | 2598 | config->writeEntry("CalendarFilters",filterList); |
2599 | 2599 | ||
2600 | config->setGroup("FilterView"); | 2600 | config->setGroup("FilterView"); |
2601 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2601 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2602 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2602 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2603 | } | 2603 | } |
2604 | 2604 | ||
2605 | 2605 | ||
2606 | void CalendarView::goToday() | 2606 | void CalendarView::goToday() |
2607 | { | 2607 | { |
2608 | if ( mViewManager->currentView()->isMonthView() ) | 2608 | if ( mViewManager->currentView()->isMonthView() ) |
2609 | mNavigator->selectTodayMonth(); | 2609 | mNavigator->selectTodayMonth(); |
2610 | else | 2610 | else |
2611 | mNavigator->selectToday(); | 2611 | mNavigator->selectToday(); |
2612 | } | 2612 | } |
2613 | 2613 | ||
2614 | void CalendarView::goNext() | 2614 | void CalendarView::goNext() |
2615 | { | 2615 | { |
2616 | mNavigator->selectNext(); | 2616 | mNavigator->selectNext(); |
2617 | } | 2617 | } |
2618 | 2618 | ||
2619 | void CalendarView::goPrevious() | 2619 | void CalendarView::goPrevious() |
2620 | { | 2620 | { |
2621 | mNavigator->selectPrevious(); | 2621 | mNavigator->selectPrevious(); |
2622 | } | 2622 | } |
2623 | void CalendarView::goNextMonth() | 2623 | void CalendarView::goNextMonth() |
2624 | { | 2624 | { |
2625 | mNavigator->selectNextMonth(); | 2625 | mNavigator->selectNextMonth(); |
2626 | } | 2626 | } |
2627 | 2627 | ||
2628 | void CalendarView::goPreviousMonth() | 2628 | void CalendarView::goPreviousMonth() |
2629 | { | 2629 | { |
2630 | mNavigator->selectPreviousMonth(); | 2630 | mNavigator->selectPreviousMonth(); |
2631 | } | 2631 | } |
2632 | 2632 | ||
2633 | void CalendarView::updateConfig() | 2633 | void CalendarView::updateConfig() |
2634 | { | 2634 | { |
2635 | if ( KOPrefs::instance()->mUseAppColors ) | 2635 | if ( KOPrefs::instance()->mUseAppColors ) |
2636 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2636 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2637 | emit configChanged(); | 2637 | emit configChanged(); |
2638 | mTodoList->updateConfig(); | 2638 | mTodoList->updateConfig(); |
2639 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2639 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2640 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2640 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2641 | // To make the "fill window" configurations work | 2641 | // To make the "fill window" configurations work |
2642 | //mViewManager->raiseCurrentView(); | 2642 | //mViewManager->raiseCurrentView(); |
2643 | } | 2643 | } |
2644 | 2644 | ||
2645 | 2645 | ||
2646 | void CalendarView::eventChanged(Event *event) | 2646 | void CalendarView::eventChanged(Event *event) |
2647 | { | 2647 | { |
2648 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2648 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2649 | //updateUnmanagedViews(); | 2649 | //updateUnmanagedViews(); |
2650 | } | 2650 | } |
2651 | 2651 | ||
2652 | void CalendarView::eventAdded(Event *event) | 2652 | void CalendarView::eventAdded(Event *event) |
2653 | { | 2653 | { |
2654 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2654 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2655 | } | 2655 | } |
2656 | 2656 | ||
2657 | void CalendarView::eventToBeDeleted(Event *) | 2657 | void CalendarView::eventToBeDeleted(Event *) |
2658 | { | 2658 | { |
2659 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2659 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2660 | } | 2660 | } |
2661 | 2661 | ||
2662 | void CalendarView::eventDeleted() | 2662 | void CalendarView::eventDeleted() |
2663 | { | 2663 | { |
2664 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2664 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2665 | } | 2665 | } |
2666 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2666 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2667 | { | 2667 | { |
2668 | changeIncidenceDisplay((Incidence *)which, action); | 2668 | changeIncidenceDisplay((Incidence *)which, action); |
2669 | mDateNavigator->updateView(); //LR | 2669 | mDateNavigator->updateView(); //LR |
2670 | //mDialogManager->updateSearchDialog(); | 2670 | //mDialogManager->updateSearchDialog(); |
2671 | 2671 | ||
2672 | if (which) { | 2672 | if (which) { |
2673 | mViewManager->updateWNview(); | 2673 | mViewManager->updateWNview(); |
2674 | //mTodoList->updateView(); | 2674 | //mTodoList->updateView(); |
2675 | } | 2675 | } |
2676 | 2676 | ||
2677 | } | 2677 | } |
2678 | 2678 | ||
2679 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2679 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2680 | { | 2680 | { |
2681 | updateUnmanagedViews(); | 2681 | updateUnmanagedViews(); |
2682 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2682 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2683 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2683 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2684 | mCalendar->checkAlarmForIncidence( 0, true ); | 2684 | mCalendar->checkAlarmForIncidence( 0, true ); |
2685 | if ( mEventViewerDialog ) | 2685 | if ( mEventViewerDialog ) |
2686 | mEventViewerDialog->hide(); | 2686 | mEventViewerDialog->hide(); |
2687 | } | 2687 | } |
2688 | else | 2688 | else |
2689 | mCalendar->checkAlarmForIncidence( which , false ); | 2689 | mCalendar->checkAlarmForIncidence( which , false ); |
2690 | } | 2690 | } |
2691 | 2691 | ||
2692 | // most of the changeEventDisplays() right now just call the view's | 2692 | // most of the changeEventDisplays() right now just call the view's |
2693 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2693 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2694 | void CalendarView::changeEventDisplay(Event *which, int action) | 2694 | void CalendarView::changeEventDisplay(Event *which, int action) |
2695 | { | 2695 | { |
2696 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2696 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2697 | changeIncidenceDisplay((Incidence *)which, action); | 2697 | changeIncidenceDisplay((Incidence *)which, action); |
2698 | 2698 | ||
2699 | 2699 | ||
2700 | static bool clearallviews = false; | 2700 | static bool clearallviews = false; |
2701 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2701 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2702 | if ( clearallviews ) { | 2702 | if ( clearallviews ) { |
2703 | clearAllViews(); | 2703 | clearAllViews(); |
2704 | clearallviews = false; | 2704 | clearallviews = false; |
2705 | } | 2705 | } |
2706 | return; | 2706 | return; |
2707 | } | 2707 | } |
2708 | clearallviews = true; | 2708 | clearallviews = true; |
2709 | 2709 | ||
2710 | 2710 | ||
2711 | 2711 | ||
2712 | mDateNavigator->updateView(); | 2712 | mDateNavigator->updateView(); |
2713 | //mDialogManager->updateSearchDialog(); | 2713 | //mDialogManager->updateSearchDialog(); |
2714 | 2714 | ||
2715 | if (which) { | 2715 | if (which) { |
2716 | // If there is an event view visible update the display | 2716 | // If there is an event view visible update the display |
2717 | mViewManager->currentView()->changeEventDisplay(which,action); | 2717 | mViewManager->currentView()->changeEventDisplay(which,action); |
2718 | // TODO: check, if update needed | 2718 | // TODO: check, if update needed |
2719 | // if (which->getTodoStatus()) { | 2719 | // if (which->getTodoStatus()) { |
2720 | mTodoList->updateView(); | 2720 | mTodoList->updateView(); |
2721 | if ( action != KOGlobals::EVENTDELETED ) { | ||
2722 | mConflictingEvent = which ; | ||
2723 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); | ||
2724 | } | ||
2721 | // } | 2725 | // } |
2722 | } else { | 2726 | } else { |
2723 | mViewManager->currentView()->updateView(); | 2727 | mViewManager->currentView()->updateView(); |
2724 | } | 2728 | } |
2725 | } | 2729 | } |
2730 | void CalendarView::checkConflictForEvent() | ||
2731 | { | ||
2732 | |||
2733 | if (!KOPrefs::instance()->mConfirm) | ||
2734 | return; | ||
2735 | if ( ! mConflictingEvent ) return; | ||
2736 | if ( mConflictingEvent->doesFloat() ) { | ||
2737 | mConflictingEvent = 0; | ||
2738 | return; | ||
2739 | } | ||
2740 | bool all = false; | ||
2741 | bool allday = false; | ||
2742 | Event * ev = mConflictingEvent; | ||
2743 | mConflictingEvent = 0; | ||
2744 | QDate start = ev->dtStart().date(); | ||
2745 | QDate end = ev->dtEnd().date().addDays(1); | ||
2746 | while ( start < end ) { | ||
2747 | QPtrList<Event> test = calendar()->events( start ); | ||
2748 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); | ||
2749 | Event * t_ev = test.first(); | ||
2750 | QDateTime es = ev->dtStart(); | ||
2751 | QDateTime ee = ev->dtEnd(); | ||
2752 | if ( ev->doesFloat() ) | ||
2753 | ee = ee.addDays( 1 ); | ||
2754 | if ( ! all ) { | ||
2755 | if ( ev->doesFloat() != allday ) | ||
2756 | t_ev = 0; | ||
2757 | } | ||
2758 | while ( t_ev ) { | ||
2759 | bool skip = false; | ||
2760 | if ( ! all ) { | ||
2761 | if ( t_ev->doesFloat() != allday ) | ||
2762 | skip = true; | ||
2763 | } | ||
2764 | if ( !skip && ev != t_ev ) { | ||
2765 | QDateTime ets = t_ev->dtStart(); | ||
2766 | QDateTime ete = t_ev->dtEnd(); | ||
2767 | if ( t_ev->doesFloat() ) | ||
2768 | ete = ete.addDays( 1 ); | ||
2769 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); | ||
2770 | if ( es < ete && ets < ee ) { | ||
2771 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( ev->summary(),0 ) ).arg( KGlobal::formatMessage ( t_ev->summary(),0 )).arg(KGlobal::locale()->formatDate(start) ) ; | ||
2772 | qApp->processEvents(); | ||
2773 | int km = KMessageBox::warningContinueCancel(this,mess, | ||
2774 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | ||
2775 | if ( km != KMessageBox::Continue ) | ||
2776 | return; | ||
2777 | |||
2778 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | ||
2779 | mViewManager->showDayView(); | ||
2780 | mNavigator->slotDaySelect( start ); | ||
2781 | int hour = es.time().hour(); | ||
2782 | if ( ets > es ) | ||
2783 | hour = ets.time().hour(); | ||
2784 | mViewManager->agendaView()->setStartHour( hour ); | ||
2785 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); | ||
2786 | return; | ||
2787 | } | ||
2788 | } | ||
2789 | t_ev = test.next(); | ||
2790 | } | ||
2791 | start = start.addDays( 1 ); | ||
2792 | } | ||
2793 | qDebug("No conflict found "); | ||
2794 | |||
2726 | 2795 | ||
2796 | } | ||
2727 | 2797 | ||
2728 | void CalendarView::updateTodoViews() | 2798 | void CalendarView::updateTodoViews() |
2729 | { | 2799 | { |
2730 | mTodoList->updateView(); | 2800 | mTodoList->updateView(); |
2731 | mViewManager->currentView()->updateView(); | 2801 | mViewManager->currentView()->updateView(); |
2732 | 2802 | ||
2733 | } | 2803 | } |
2734 | 2804 | ||
2735 | 2805 | ||
2736 | 2806 | ||
2737 | void CalendarView::clearAllViews() | 2807 | void CalendarView::clearAllViews() |
2738 | { | 2808 | { |
2739 | mTodoList->clearList(); | 2809 | mTodoList->clearList(); |
2740 | mViewManager->clearAllViews(); | 2810 | mViewManager->clearAllViews(); |
2741 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2811 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2742 | if ( sd ) { | 2812 | if ( sd ) { |
2743 | KOListView* kol = sd->listview(); | 2813 | KOListView* kol = sd->listview(); |
2744 | if ( kol ) | 2814 | if ( kol ) |
2745 | kol->clearList(); | 2815 | kol->clearList(); |
2746 | } | 2816 | } |
2747 | } | 2817 | } |
2748 | void CalendarView::updateView() | 2818 | void CalendarView::updateView() |
2749 | { | 2819 | { |
2750 | static bool clearallviews = false; | 2820 | static bool clearallviews = false; |
2751 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2821 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2752 | if ( clearallviews ) { | 2822 | if ( clearallviews ) { |
2753 | clearAllViews(); | 2823 | clearAllViews(); |
2754 | clearallviews = false; | 2824 | clearallviews = false; |
2755 | } | 2825 | } |
2756 | return; | 2826 | return; |
2757 | } | 2827 | } |
2758 | clearallviews = true; | 2828 | clearallviews = true; |
2759 | DateList tmpList = mNavigator->selectedDates(); | 2829 | DateList tmpList = mNavigator->selectedDates(); |
2760 | 2830 | ||
2761 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2831 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2762 | mTodoList->updateView(); | 2832 | mTodoList->updateView(); |
2763 | // We assume that the navigator only selects consecutive days. | 2833 | // We assume that the navigator only selects consecutive days. |
2764 | updateView( tmpList.first(), tmpList.last() ); | 2834 | updateView( tmpList.first(), tmpList.last() ); |
2765 | } | 2835 | } |
2766 | 2836 | ||
2767 | void CalendarView::updateUnmanagedViews() | 2837 | void CalendarView::updateUnmanagedViews() |
2768 | { | 2838 | { |
2769 | mDateNavigator->updateDayMatrix(); | 2839 | mDateNavigator->updateDayMatrix(); |
2770 | } | 2840 | } |
2771 | 2841 | ||
2772 | int CalendarView::msgItemDelete(const QString name) | 2842 | int CalendarView::msgItemDelete(const QString name) |
2773 | { | 2843 | { |
2774 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2844 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2775 | i18n("This item will be\npermanently deleted."), | 2845 | i18n("This item will be\npermanently deleted."), |
2776 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2846 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2777 | } | 2847 | } |
2778 | 2848 | ||
2779 | 2849 | ||
2780 | void CalendarView::edit_cut() | 2850 | void CalendarView::edit_cut() |
2781 | { | 2851 | { |
2782 | Event *anEvent=0; | 2852 | Event *anEvent=0; |
2783 | 2853 | ||
2784 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2854 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2785 | 2855 | ||
2786 | if (mViewManager->currentView()->isEventView()) { | 2856 | if (mViewManager->currentView()->isEventView()) { |
2787 | if ( incidence && incidence->typeID() == eventID ) { | 2857 | if ( incidence && incidence->typeID() == eventID ) { |
2788 | anEvent = static_cast<Event *>(incidence); | 2858 | anEvent = static_cast<Event *>(incidence); |
2789 | } | 2859 | } |
2790 | } | 2860 | } |
2791 | 2861 | ||
2792 | if (!anEvent) { | 2862 | if (!anEvent) { |
2793 | KNotifyClient::beep(); | 2863 | KNotifyClient::beep(); |
2794 | return; | 2864 | return; |
2795 | } | 2865 | } |
2796 | DndFactory factory( mCalendar ); | 2866 | DndFactory factory( mCalendar ); |
2797 | factory.cutIncidence(anEvent); | 2867 | factory.cutIncidence(anEvent); |
2798 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2868 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2799 | } | 2869 | } |
2800 | 2870 | ||
2801 | void CalendarView::edit_copy() | 2871 | void CalendarView::edit_copy() |
2802 | { | 2872 | { |
2803 | Event *anEvent=0; | 2873 | Event *anEvent=0; |
2804 | 2874 | ||
2805 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2875 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2806 | 2876 | ||
2807 | if (mViewManager->currentView()->isEventView()) { | 2877 | if (mViewManager->currentView()->isEventView()) { |
2808 | if ( incidence && incidence->typeID() == eventID ) { | 2878 | if ( incidence && incidence->typeID() == eventID ) { |
2809 | anEvent = static_cast<Event *>(incidence); | 2879 | anEvent = static_cast<Event *>(incidence); |
2810 | } | 2880 | } |
2811 | } | 2881 | } |
2812 | 2882 | ||
2813 | if (!anEvent) { | 2883 | if (!anEvent) { |
2814 | KNotifyClient::beep(); | 2884 | KNotifyClient::beep(); |
2815 | return; | 2885 | return; |
2816 | } | 2886 | } |
2817 | DndFactory factory( mCalendar ); | 2887 | DndFactory factory( mCalendar ); |
2818 | factory.copyIncidence(anEvent); | 2888 | factory.copyIncidence(anEvent); |
2819 | } | 2889 | } |
2820 | 2890 | ||
2821 | void CalendarView::edit_paste() | 2891 | void CalendarView::edit_paste() |
2822 | { | 2892 | { |
2823 | QDate date = mNavigator->selectedDates().first(); | 2893 | QDate date = mNavigator->selectedDates().first(); |
2824 | 2894 | ||
2825 | DndFactory factory( mCalendar ); | 2895 | DndFactory factory( mCalendar ); |
2826 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2896 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2827 | 2897 | ||
2828 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2898 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2829 | } | 2899 | } |
2830 | void CalendarView::edit_global_options() | 2900 | void CalendarView::edit_global_options() |
2831 | { | 2901 | { |
2832 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2902 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2833 | emit save(); | 2903 | emit save(); |
2834 | emit saveStopTimer(); | 2904 | emit saveStopTimer(); |
2835 | mDialogManager->showGlobalOptionsDialog(); | 2905 | mDialogManager->showGlobalOptionsDialog(); |
2836 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2906 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2837 | emit saveStopTimer(); | 2907 | emit saveStopTimer(); |
2838 | 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!"), | 2908 | 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!"), |
2839 | i18n("Timezone settings"),i18n("Reload"))) { | 2909 | i18n("Timezone settings"),i18n("Reload"))) { |
2840 | qDebug("KO: TZ reload cancelled "); | 2910 | qDebug("KO: TZ reload cancelled "); |
2841 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2911 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2842 | return; | 2912 | return; |
2843 | } | 2913 | } |
2844 | qDebug("KO: Timezone change "); | 2914 | qDebug("KO: Timezone change "); |
2845 | loadCalendars(); | 2915 | loadCalendars(); |
2846 | setModified(true); | 2916 | setModified(true); |
2847 | } | 2917 | } |
2848 | else | 2918 | else |
2849 | qDebug("KO: No tz change "); | 2919 | qDebug("KO: No tz change "); |
2850 | } | 2920 | } |
2851 | void CalendarView::edit_options() | 2921 | void CalendarView::edit_options() |
2852 | { | 2922 | { |
2853 | mDialogManager->showOptionsDialog(); | 2923 | mDialogManager->showOptionsDialog(); |
2854 | } | 2924 | } |
2855 | 2925 | ||
2856 | 2926 | ||
2857 | void CalendarView::slotSelectPickerDate( QDate d) | 2927 | void CalendarView::slotSelectPickerDate( QDate d) |
2858 | { | 2928 | { |
2859 | mDateFrame->hide(); | 2929 | mDateFrame->hide(); |
2860 | if ( mDatePickerMode == 1 ) { | 2930 | if ( mDatePickerMode == 1 ) { |
2861 | mNavigator->slotDaySelect( d ); | 2931 | mNavigator->slotDaySelect( d ); |
2862 | } else if ( mDatePickerMode == 2 ) { | 2932 | } else if ( mDatePickerMode == 2 ) { |
2863 | if ( mMoveIncidence->typeID() == todoID ) { | 2933 | if ( mMoveIncidence->typeID() == todoID ) { |
2864 | Todo * to = (Todo *) mMoveIncidence; | 2934 | Todo * to = (Todo *) mMoveIncidence; |
2865 | QTime tim; | 2935 | QTime tim; |
2866 | int len = 0; | 2936 | int len = 0; |
2867 | if ( to->hasStartDate() && to->hasDueDate() ) | 2937 | if ( to->hasStartDate() && to->hasDueDate() ) |
2868 | len = to->dtStart().secsTo( to->dtDue()); | 2938 | len = to->dtStart().secsTo( to->dtDue()); |
2869 | if ( to->hasDueDate() ) | 2939 | if ( to->hasDueDate() ) |
2870 | tim = to->dtDue().time(); | 2940 | tim = to->dtDue().time(); |
2871 | else { | 2941 | else { |
2872 | tim = QTime ( 0,0,0 ); | 2942 | tim = QTime ( 0,0,0 ); |
2873 | to->setFloats( true ); | 2943 | to->setFloats( true ); |
2874 | to->setHasDueDate( true ); | 2944 | to->setHasDueDate( true ); |
2875 | } | 2945 | } |
2876 | QDateTime dt ( d,tim ); | 2946 | QDateTime dt ( d,tim ); |
2877 | to->setDtDue( dt ); | 2947 | to->setDtDue( dt ); |
2878 | 2948 | ||
2879 | if ( to->hasStartDate() ) { | 2949 | if ( to->hasStartDate() ) { |
2880 | if ( len>0 ) | 2950 | if ( len>0 ) |
2881 | to->setDtStart(to->dtDue().addSecs( -len )); | 2951 | to->setDtStart(to->dtDue().addSecs( -len )); |
2882 | else | 2952 | else |
2883 | if (to->dtStart() > to->dtDue() ) | 2953 | if (to->dtStart() > to->dtDue() ) |
2884 | to->setDtStart(to->dtDue().addDays( -3 )); | 2954 | to->setDtStart(to->dtDue().addDays( -3 )); |
2885 | } | 2955 | } |
2886 | 2956 | ||
2887 | todoChanged( to ); | 2957 | todoChanged( to ); |
2888 | } else if ( mMoveIncidence->typeID() == eventID ) { | 2958 | } else if ( mMoveIncidence->typeID() == eventID ) { |
2889 | if ( mMoveIncidence->doesRecur() ) { | 2959 | if ( mMoveIncidence->doesRecur() ) { |
2890 | #if 0 | 2960 | #if 0 |
2891 | // PENDING implement this | 2961 | // PENDING implement this |
2892 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2962 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2893 | mCalendar()->addIncidence( newInc ); | 2963 | mCalendar()->addIncidence( newInc ); |
2894 | if ( mMoveIncidence->typeID() == todoID ) | 2964 | if ( mMoveIncidence->typeID() == todoID ) |
2895 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2965 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2896 | else | 2966 | else |
2897 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2967 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2898 | mMoveIncidence = newInc; | 2968 | mMoveIncidence = newInc; |
2899 | 2969 | ||
2900 | #endif | 2970 | #endif |
2901 | } | 2971 | } |
2902 | QTime tim = mMoveIncidence->dtStart().time(); | 2972 | QTime tim = mMoveIncidence->dtStart().time(); |
2903 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2973 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2904 | QDateTime dt ( d,tim ); | 2974 | QDateTime dt ( d,tim ); |
2905 | mMoveIncidence->setDtStart( dt ); | 2975 | mMoveIncidence->setDtStart( dt ); |
2906 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2976 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2907 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2977 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2908 | } else if ( mMoveIncidence->typeID() == journalID ) { | 2978 | } else if ( mMoveIncidence->typeID() == journalID ) { |
2909 | QTime tim = mMoveIncidence->dtStart().time(); | 2979 | QTime tim = mMoveIncidence->dtStart().time(); |
2910 | QDateTime dt ( d,tim ); | 2980 | QDateTime dt ( d,tim ); |
2911 | mMoveIncidence->setDtStart( dt ); | 2981 | mMoveIncidence->setDtStart( dt ); |
2912 | updateView(); | 2982 | updateView(); |
2913 | } | 2983 | } |
2914 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2984 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2915 | } | 2985 | } |
2916 | } | 2986 | } |
2917 | 2987 | ||
2918 | void CalendarView::removeCategories() | 2988 | void CalendarView::removeCategories() |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 51eb1d4..706d05d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -319,346 +319,348 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
319 | * settings from the config file. | 319 | * settings from the config file. |
320 | */ | 320 | */ |
321 | void readSettings(); | 321 | void readSettings(); |
322 | 322 | ||
323 | /** write current state to config file. */ | 323 | /** write current state to config file. */ |
324 | void writeSettings(); | 324 | void writeSettings(); |
325 | 325 | ||
326 | /** read settings for calendar filters */ | 326 | /** read settings for calendar filters */ |
327 | void readFilterSettings(KConfig *config); | 327 | void readFilterSettings(KConfig *config); |
328 | 328 | ||
329 | /** write settings for calendar filters */ | 329 | /** write settings for calendar filters */ |
330 | void writeFilterSettings(KConfig *config); | 330 | void writeFilterSettings(KConfig *config); |
331 | 331 | ||
332 | /** passes on the message that an event has changed to the currently | 332 | /** passes on the message that an event has changed to the currently |
333 | * activated view so that it can make appropriate display changes. */ | 333 | * activated view so that it can make appropriate display changes. */ |
334 | void changeEventDisplay(Event *, int); | 334 | void changeEventDisplay(Event *, int); |
335 | void changeIncidenceDisplay(Incidence *, int); | 335 | void changeIncidenceDisplay(Incidence *, int); |
336 | void changeTodoDisplay(Todo *, int); | 336 | void changeTodoDisplay(Todo *, int); |
337 | 337 | ||
338 | void eventAdded(Event *); | 338 | void eventAdded(Event *); |
339 | void eventChanged(Event *); | 339 | void eventChanged(Event *); |
340 | void eventToBeDeleted(Event *); | 340 | void eventToBeDeleted(Event *); |
341 | void eventDeleted(); | 341 | void eventDeleted(); |
342 | 342 | ||
343 | void todoAdded(Todo *); | 343 | void todoAdded(Todo *); |
344 | void todoChanged(Todo *); | 344 | void todoChanged(Todo *); |
345 | void todoToBeDeleted(Todo *); | 345 | void todoToBeDeleted(Todo *); |
346 | void todoDeleted(); | 346 | void todoDeleted(); |
347 | 347 | ||
348 | void updateView(const QDate &start, const QDate &end); | 348 | void updateView(const QDate &start, const QDate &end); |
349 | void updateView(); | 349 | void updateView(); |
350 | void clearAllViews(); | 350 | void clearAllViews(); |
351 | 351 | ||
352 | /** Full update of visible todo views */ | 352 | /** Full update of visible todo views */ |
353 | void updateTodoViews(); | 353 | void updateTodoViews(); |
354 | 354 | ||
355 | void updateUnmanagedViews(); | 355 | void updateUnmanagedViews(); |
356 | 356 | ||
357 | /** cut the current appointment to the clipboard */ | 357 | /** cut the current appointment to the clipboard */ |
358 | void edit_cut(); | 358 | void edit_cut(); |
359 | 359 | ||
360 | /** copy the current appointment(s) to the clipboard */ | 360 | /** copy the current appointment(s) to the clipboard */ |
361 | void edit_copy(); | 361 | void edit_copy(); |
362 | 362 | ||
363 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 363 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
364 | void edit_paste(); | 364 | void edit_paste(); |
365 | 365 | ||
366 | /** edit viewing and configuration options. */ | 366 | /** edit viewing and configuration options. */ |
367 | void edit_options(); | 367 | void edit_options(); |
368 | void edit_global_options(); | 368 | void edit_global_options(); |
369 | /** | 369 | /** |
370 | Functions for printing, previewing a print, and setting up printing | 370 | Functions for printing, previewing a print, and setting up printing |
371 | parameters. | 371 | parameters. |
372 | */ | 372 | */ |
373 | void print(); | 373 | void print(); |
374 | void printSetup(); | 374 | void printSetup(); |
375 | void printPreview(); | 375 | void printPreview(); |
376 | 376 | ||
377 | /** Export as iCalendar file */ | 377 | /** Export as iCalendar file */ |
378 | void exportICalendar(); | 378 | void exportICalendar(); |
379 | 379 | ||
380 | /** Export as vCalendar file */ | 380 | /** Export as vCalendar file */ |
381 | bool exportVCalendar( QString fn); | 381 | bool exportVCalendar( QString fn); |
382 | 382 | ||
383 | /** pop up a dialog to show an existing appointment. */ | 383 | /** pop up a dialog to show an existing appointment. */ |
384 | void appointment_show(); | 384 | void appointment_show(); |
385 | /** | 385 | /** |
386 | * pop up an Appointment Dialog to edit an existing appointment.Get | 386 | * pop up an Appointment Dialog to edit an existing appointment.Get |
387 | * information on the appointment from the list of unique IDs that is | 387 | * information on the appointment from the list of unique IDs that is |
388 | * currently in the View, called currIds. | 388 | * currently in the View, called currIds. |
389 | */ | 389 | */ |
390 | void appointment_edit(); | 390 | void appointment_edit(); |
391 | /** | 391 | /** |
392 | * pop up dialog confirming deletion of currently selected event in the | 392 | * pop up dialog confirming deletion of currently selected event in the |
393 | * View. | 393 | * View. |
394 | */ | 394 | */ |
395 | void appointment_delete(); | 395 | void appointment_delete(); |
396 | 396 | ||
397 | /** mails the currently selected event to a particular user as a vCalendar | 397 | /** mails the currently selected event to a particular user as a vCalendar |
398 | attachment. */ | 398 | attachment. */ |
399 | void action_mail(); | 399 | void action_mail(); |
400 | 400 | ||
401 | /* frees a subtodo from it's relation */ | 401 | /* frees a subtodo from it's relation */ |
402 | void todo_unsub( Todo * ); | 402 | void todo_unsub( Todo * ); |
403 | void todo_resub( Todo * parent, Todo * sub ); | 403 | void todo_resub( Todo * parent, Todo * sub ); |
404 | 404 | ||
405 | /** Take ownership of selected event. */ | 405 | /** Take ownership of selected event. */ |
406 | void takeOverEvent(); | 406 | void takeOverEvent(); |
407 | 407 | ||
408 | /** Take ownership of all events in calendar. */ | 408 | /** Take ownership of all events in calendar. */ |
409 | void takeOverCalendar(); | 409 | void takeOverCalendar(); |
410 | 410 | ||
411 | /** query whether or not the calendar is "dirty". */ | 411 | /** query whether or not the calendar is "dirty". */ |
412 | bool isModified(); | 412 | bool isModified(); |
413 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 413 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
414 | void setModified(bool modified=true); | 414 | void setModified(bool modified=true); |
415 | 415 | ||
416 | /** query if the calendar is read-only. */ | 416 | /** query if the calendar is read-only. */ |
417 | bool isReadOnly(); | 417 | bool isReadOnly(); |
418 | /** set state of calendar to read-only */ | 418 | /** set state of calendar to read-only */ |
419 | void setReadOnly(bool readOnly=true); | 419 | void setReadOnly(bool readOnly=true); |
420 | 420 | ||
421 | void eventUpdated(Incidence *); | 421 | void eventUpdated(Incidence *); |
422 | 422 | ||
423 | /* iTIP scheduling actions */ | 423 | /* iTIP scheduling actions */ |
424 | void schedule_publish(Incidence *incidence = 0); | 424 | void schedule_publish(Incidence *incidence = 0); |
425 | void schedule_request(Incidence *incidence = 0); | 425 | void schedule_request(Incidence *incidence = 0); |
426 | void schedule_refresh(Incidence *incidence = 0); | 426 | void schedule_refresh(Incidence *incidence = 0); |
427 | void schedule_cancel(Incidence *incidence = 0); | 427 | void schedule_cancel(Incidence *incidence = 0); |
428 | void schedule_add(Incidence *incidence = 0); | 428 | void schedule_add(Incidence *incidence = 0); |
429 | void schedule_reply(Incidence *incidence = 0); | 429 | void schedule_reply(Incidence *incidence = 0); |
430 | void schedule_counter(Incidence *incidence = 0); | 430 | void schedule_counter(Incidence *incidence = 0); |
431 | void schedule_declinecounter(Incidence *incidence = 0); | 431 | void schedule_declinecounter(Incidence *incidence = 0); |
432 | void schedule_publish_freebusy(int daysToPublish = 30); | 432 | void schedule_publish_freebusy(int daysToPublish = 30); |
433 | 433 | ||
434 | void openAddressbook(); | 434 | void openAddressbook(); |
435 | 435 | ||
436 | void editFilters(); | 436 | void editFilters(); |
437 | void toggleFilerEnabled(); | 437 | void toggleFilerEnabled(); |
438 | QPtrList<CalFilter> filters(); | 438 | QPtrList<CalFilter> filters(); |
439 | void toggleFilter(); | 439 | void toggleFilter(); |
440 | void showFilter(bool visible); | 440 | void showFilter(bool visible); |
441 | void updateFilter(); | 441 | void updateFilter(); |
442 | void filterEdited(); | 442 | void filterEdited(); |
443 | void selectFilter( int ); | 443 | void selectFilter( int ); |
444 | KOFilterView *filterView(); | 444 | KOFilterView *filterView(); |
445 | 445 | ||
446 | void showIntro(); | 446 | void showIntro(); |
447 | 447 | ||
448 | /** Move the curdatepient view date to today */ | 448 | /** Move the curdatepient view date to today */ |
449 | void goToday(); | 449 | void goToday(); |
450 | 450 | ||
451 | /** Move to the next date(s) in the current view */ | 451 | /** Move to the next date(s) in the current view */ |
452 | void goNext(); | 452 | void goNext(); |
453 | 453 | ||
454 | /** Move to the previous date(s) in the current view */ | 454 | /** Move to the previous date(s) in the current view */ |
455 | void goPrevious(); | 455 | void goPrevious(); |
456 | /** Move to the next date(s) in the current view */ | 456 | /** Move to the next date(s) in the current view */ |
457 | void goNextMonth(); | 457 | void goNextMonth(); |
458 | 458 | ||
459 | /** Move to the previous date(s) in the current view */ | 459 | /** Move to the previous date(s) in the current view */ |
460 | void goPreviousMonth(); | 460 | void goPreviousMonth(); |
461 | 461 | ||
462 | void toggleExpand(); | 462 | void toggleExpand(); |
463 | void toggleDateNavigatorWidget(); | 463 | void toggleDateNavigatorWidget(); |
464 | void toggleAllDaySize(); | 464 | void toggleAllDaySize(); |
465 | 465 | ||
466 | /** Look for new messages in the inbox */ | 466 | /** Look for new messages in the inbox */ |
467 | void lookForIncomingMessages(); | 467 | void lookForIncomingMessages(); |
468 | /** Look for new messages in the outbox */ | 468 | /** Look for new messages in the outbox */ |
469 | void lookForOutgoingMessages(); | 469 | void lookForOutgoingMessages(); |
470 | 470 | ||
471 | void processMainViewSelection( Incidence * ); | 471 | void processMainViewSelection( Incidence * ); |
472 | void processTodoListSelection( Incidence * ); | 472 | void processTodoListSelection( Incidence * ); |
473 | 473 | ||
474 | void processIncidenceSelection( Incidence * ); | 474 | void processIncidenceSelection( Incidence * ); |
475 | 475 | ||
476 | void purgeCompleted(); | 476 | void purgeCompleted(); |
477 | bool removeCompletedSubTodos( Todo* ); | 477 | bool removeCompletedSubTodos( Todo* ); |
478 | void slotCalendarChanged(); | 478 | void slotCalendarChanged(); |
479 | bool importBday(); | 479 | bool importBday(); |
480 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 480 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
481 | bool importQtopia( const QString &categoriesFile, | 481 | bool importQtopia( const QString &categoriesFile, |
482 | const QString &datebookFile, | 482 | const QString &datebookFile, |
483 | const QString &tasklistFile ); | 483 | const QString &tasklistFile ); |
484 | void syncExternal( int mode ); | 484 | void syncExternal( int mode ); |
485 | void slotSelectPickerDate( QDate ) ; | 485 | void slotSelectPickerDate( QDate ) ; |
486 | void showDatePicker() ; | 486 | void showDatePicker() ; |
487 | void showDatePickerPopup() ; | 487 | void showDatePickerPopup() ; |
488 | void moveIncidence(Incidence *) ; | 488 | void moveIncidence(Incidence *) ; |
489 | void beamIncidence(Incidence *) ; | 489 | void beamIncidence(Incidence *) ; |
490 | void beamCalendar() ; | 490 | void beamCalendar() ; |
491 | void beamFilteredCalendar() ; | 491 | void beamFilteredCalendar() ; |
492 | void beamIncidenceList(QPtrList<Incidence>) ; | 492 | void beamIncidenceList(QPtrList<Incidence>) ; |
493 | void manageCategories(); | 493 | void manageCategories(); |
494 | void editCategories(); | 494 | void editCategories(); |
495 | int addCategories(); | 495 | int addCategories(); |
496 | void removeCategories(); | 496 | void removeCategories(); |
497 | void setSyncDevice( QString ); | 497 | void setSyncDevice( QString ); |
498 | void setSyncName( QString ); | 498 | void setSyncName( QString ); |
499 | void showDay( QDate ); | 499 | void showDay( QDate ); |
500 | void undo_delete(); | 500 | void undo_delete(); |
501 | protected slots: | 501 | protected slots: |
502 | void resetFocus(); | 502 | void resetFocus(); |
503 | void scrollBarValue(int); | 503 | void scrollBarValue(int); |
504 | void slotViewerClosed(); | 504 | void slotViewerClosed(); |
505 | void timerAlarm(); | 505 | void timerAlarm(); |
506 | void suspendAlarm(); | 506 | void suspendAlarm(); |
507 | void beamDone( Ir *ir ); | 507 | void beamDone( Ir *ir ); |
508 | /** Select a view or adapt the current view to display the specified dates. */ | 508 | /** Select a view or adapt the current view to display the specified dates. */ |
509 | void showDates( const KCal::DateList & ); | 509 | void showDates( const KCal::DateList & ); |
510 | void selectWeekNum ( int ); | 510 | void selectWeekNum ( int ); |
511 | void checkConflictForEvent(); | ||
511 | 512 | ||
512 | public: | 513 | public: |
513 | // show a standard warning | 514 | // show a standard warning |
514 | // returns KMsgBox::yesNoCancel() | 515 | // returns KMsgBox::yesNoCancel() |
515 | int msgCalModified(); | 516 | int msgCalModified(); |
516 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 517 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
517 | 518 | ||
518 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 519 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
519 | virtual void removeSyncInfo( QString syncProfile); | 520 | virtual void removeSyncInfo( QString syncProfile); |
520 | void setSyncManager(KSyncManager* manager); | 521 | void setSyncManager(KSyncManager* manager); |
521 | void setLoadedFileVersion(QDateTime); | 522 | void setLoadedFileVersion(QDateTime); |
522 | bool checkFileVersion(QString fn); | 523 | bool checkFileVersion(QString fn); |
523 | bool checkAllFileVersions(); | 524 | bool checkAllFileVersions(); |
524 | bool checkFileChanged(QString fn); | 525 | bool checkFileChanged(QString fn); |
525 | Event* getLastSyncEvent(); | 526 | Event* getLastSyncEvent(); |
526 | /** Adapt navigation units correpsonding to step size of navigation of the | 527 | /** Adapt navigation units correpsonding to step size of navigation of the |
527 | * current view. | 528 | * current view. |
528 | */ | 529 | */ |
529 | void adaptNavigationUnits(); | 530 | void adaptNavigationUnits(); |
530 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 531 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
531 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 532 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
532 | //Attendee* getYourAttendee(Event *event); | 533 | //Attendee* getYourAttendee(Event *event); |
533 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 534 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
534 | void setScrollBarStep(int val ); | 535 | void setScrollBarStep(int val ); |
535 | 536 | ||
536 | protected: | 537 | protected: |
538 | Event *mConflictingEvent; | ||
537 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 539 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
538 | 540 | ||
539 | // returns KMsgBox::OKCandel() | 541 | // returns KMsgBox::OKCandel() |
540 | int msgItemDelete(const QString name); | 542 | int msgItemDelete(const QString name); |
541 | void showEventEditor(); | 543 | void showEventEditor(); |
542 | void showTodoEditor(); | 544 | void showTodoEditor(); |
543 | Todo *selectedTodo(); | 545 | Todo *selectedTodo(); |
544 | private: | 546 | private: |
545 | #ifdef DESKTOP_VERSION | 547 | #ifdef DESKTOP_VERSION |
546 | QScrollBar * mDateScrollBar; | 548 | QScrollBar * mDateScrollBar; |
547 | #endif | 549 | #endif |
548 | QDateTime mNextAlarmDateTime; | 550 | QDateTime mNextAlarmDateTime; |
549 | bool mViewerCallerIsSearchDialog; | 551 | bool mViewerCallerIsSearchDialog; |
550 | bool mBlockShowDates; | 552 | bool mBlockShowDates; |
551 | KSyncManager* mSyncManager; | 553 | KSyncManager* mSyncManager; |
552 | AlarmDialog * mAlarmDialog; | 554 | AlarmDialog * mAlarmDialog; |
553 | QString mAlarmNotification; | 555 | QString mAlarmNotification; |
554 | QString mSuspendAlarmNotification; | 556 | QString mSuspendAlarmNotification; |
555 | QTimer* mSuspendTimer; | 557 | QTimer* mSuspendTimer; |
556 | QTimer* mAlarmTimer; | 558 | QTimer* mAlarmTimer; |
557 | QTimer* mRecheckAlarmTimer; | 559 | QTimer* mRecheckAlarmTimer; |
558 | void computeAlarm( QString ); | 560 | void computeAlarm( QString ); |
559 | void startAlarm( QString, QString ); | 561 | void startAlarm( QString, QString ); |
560 | void setSyncEventsReadOnly(); | 562 | void setSyncEventsReadOnly(); |
561 | 563 | ||
562 | QDateTime loadedFileVersion; | 564 | QDateTime loadedFileVersion; |
563 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 565 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
564 | void checkExternalId( Incidence * inc ); | 566 | void checkExternalId( Incidence * inc ); |
565 | int mGlobalSyncMode; | 567 | int mGlobalSyncMode; |
566 | QString mCurrentSyncDevice; | 568 | QString mCurrentSyncDevice; |
567 | QString mCurrentSyncName; | 569 | QString mCurrentSyncName; |
568 | void init(); | 570 | void init(); |
569 | int mDatePickerMode; | 571 | int mDatePickerMode; |
570 | bool mFlagEditDescription; | 572 | bool mFlagEditDescription; |
571 | QDateTime mLastCalendarSync; | 573 | QDateTime mLastCalendarSync; |
572 | void createPrinter(); | 574 | void createPrinter(); |
573 | 575 | ||
574 | void calendarModified( bool, Calendar * ); | 576 | void calendarModified( bool, Calendar * ); |
575 | 577 | ||
576 | CalPrinter *mCalPrinter; | 578 | CalPrinter *mCalPrinter; |
577 | 579 | ||
578 | QSplitter *mPanner; | 580 | QSplitter *mPanner; |
579 | QSplitter *mLeftSplitter; | 581 | QSplitter *mLeftSplitter; |
580 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 582 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
581 | QWidgetStack *mRightFrame; | 583 | QWidgetStack *mRightFrame; |
582 | 584 | ||
583 | KDatePicker* mDatePicker; | 585 | KDatePicker* mDatePicker; |
584 | QVBox* mDateFrame; | 586 | QVBox* mDateFrame; |
585 | 587 | ||
586 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 588 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
587 | 589 | ||
588 | KOFilterView *mFilterView; | 590 | KOFilterView *mFilterView; |
589 | KOCalEditView *mCalEditView; | 591 | KOCalEditView *mCalEditView; |
590 | 592 | ||
591 | ResourceView *mResourceView; | 593 | ResourceView *mResourceView; |
592 | 594 | ||
593 | // calendar object for this viewing instance | 595 | // calendar object for this viewing instance |
594 | Calendar *mCalendar; | 596 | Calendar *mCalendar; |
595 | 597 | ||
596 | CalendarResourceManager *mResourceManager; | 598 | CalendarResourceManager *mResourceManager; |
597 | 599 | ||
598 | FileStorage *mStorage; | 600 | FileStorage *mStorage; |
599 | 601 | ||
600 | DateNavigator *mNavigator; | 602 | DateNavigator *mNavigator; |
601 | 603 | ||
602 | KOViewManager *mViewManager; | 604 | KOViewManager *mViewManager; |
603 | KODialogManager *mDialogManager; | 605 | KODialogManager *mDialogManager; |
604 | 606 | ||
605 | // Calendar filters | 607 | // Calendar filters |
606 | QPtrList<CalFilter> mFilters; | 608 | QPtrList<CalFilter> mFilters; |
607 | 609 | ||
608 | // various housekeeping variables. | 610 | // various housekeeping variables. |
609 | bool mModified; // flag indicating if calendar is modified | 611 | bool mModified; // flag indicating if calendar is modified |
610 | bool mReadOnly; // flag indicating if calendar is read-only | 612 | bool mReadOnly; // flag indicating if calendar is read-only |
611 | QDate mSaveSingleDate; | 613 | QDate mSaveSingleDate; |
612 | 614 | ||
613 | Incidence *mSelectedIncidence; | 615 | Incidence *mSelectedIncidence; |
614 | Incidence *mMoveIncidence; | 616 | Incidence *mMoveIncidence; |
615 | QDate mMoveIncidenceOldDate; | 617 | QDate mMoveIncidenceOldDate; |
616 | KOTodoView *mTodoList; | 618 | KOTodoView *mTodoList; |
617 | KOEventEditor * mEventEditor; | 619 | KOEventEditor * mEventEditor; |
618 | KOTodoEditor * mTodoEditor; | 620 | KOTodoEditor * mTodoEditor; |
619 | KOEventViewerDialog * mEventViewerDialog; | 621 | KOEventViewerDialog * mEventViewerDialog; |
620 | void keyPressEvent ( QKeyEvent *e) ; | 622 | void keyPressEvent ( QKeyEvent *e) ; |
621 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 623 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
622 | }; | 624 | }; |
623 | 625 | ||
624 | 626 | ||
625 | class CalendarViewVisitor : public Incidence::Visitor | 627 | class CalendarViewVisitor : public Incidence::Visitor |
626 | { | 628 | { |
627 | public: | 629 | public: |
628 | CalendarViewVisitor() : mView( 0 ) {} | 630 | CalendarViewVisitor() : mView( 0 ) {} |
629 | 631 | ||
630 | bool act( Incidence *incidence, CalendarView *view ) | 632 | bool act( Incidence *incidence, CalendarView *view ) |
631 | { | 633 | { |
632 | mView = view; | 634 | mView = view; |
633 | return incidence->accept( *this ); | 635 | return incidence->accept( *this ); |
634 | } | 636 | } |
635 | 637 | ||
636 | protected: | 638 | protected: |
637 | CalendarView *mView; | 639 | CalendarView *mView; |
638 | }; | 640 | }; |
639 | 641 | ||
640 | class ShowIncidenceVisitor : public CalendarViewVisitor | 642 | class ShowIncidenceVisitor : public CalendarViewVisitor |
641 | { | 643 | { |
642 | protected: | 644 | protected: |
643 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 645 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
644 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 646 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
645 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 647 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
646 | }; | 648 | }; |
647 | 649 | ||
648 | class EditIncidenceVisitor : public CalendarViewVisitor | 650 | class EditIncidenceVisitor : public CalendarViewVisitor |
649 | { | 651 | { |
650 | protected: | 652 | protected: |
651 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 653 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
652 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 654 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
653 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 655 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
654 | }; | 656 | }; |
655 | 657 | ||
656 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 658 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
657 | { | 659 | { |
658 | protected: | 660 | protected: |
659 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 661 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
660 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 662 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
661 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 663 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
662 | }; | 664 | }; |
663 | 665 | ||
664 | #endif | 666 | #endif |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 7783dd4..d25f671 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -328,409 +328,404 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
328 | #ifdef DESKTOP_VERSION | 328 | #ifdef DESKTOP_VERSION |
329 | mPopupMenu->insertSeparator(); | 329 | mPopupMenu->insertSeparator(); |
330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
331 | i18n("Print complete list..."),this, | 331 | i18n("Print complete list..."),this, |
332 | SLOT(printList()),true); | 332 | SLOT(printList()),true); |
333 | #endif | 333 | #endif |
334 | mCalPopup = new QPopupMenu ( this ); | 334 | mCalPopup = new QPopupMenu ( this ); |
335 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); | 335 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
336 | 336 | ||
337 | selPopup->insertItem(i18n("Set categories")+"...",this, | 337 | selPopup->insertItem(i18n("Set categories")+"...",this, |
338 | SLOT(setCat()) ); | 338 | SLOT(setCat()) ); |
339 | selPopup->insertItem( i18n("Set alarm..."),this, | 339 | selPopup->insertItem( i18n("Set alarm..."),this, |
340 | SLOT(setAlarm())); | 340 | SLOT(setAlarm())); |
341 | #if 0 | 341 | #if 0 |
342 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 342 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
343 | i18n("Set categories")+"...",this, | 343 | i18n("Set categories")+"...",this, |
344 | SLOT(setCat()),true); | 344 | SLOT(setCat()),true); |
345 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 345 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
346 | i18n("Set alarm..."),this, | 346 | i18n("Set alarm..."),this, |
347 | SLOT(setAlarm()),true); | 347 | SLOT(setAlarm()),true); |
348 | #endif | 348 | #endif |
349 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 349 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
350 | SLOT( populateCalPopup() )); | 350 | SLOT( populateCalPopup() )); |
351 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 351 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
352 | SLOT( setCalendar( int ) )); | 352 | SLOT( setCalendar( int ) )); |
353 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 353 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
354 | SLOT( catChanged( Incidence * ) )); | 354 | SLOT( catChanged( Incidence * ) )); |
355 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 355 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
356 | SLOT(saveToFile())); | 356 | SLOT(saveToFile())); |
357 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 357 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
358 | SLOT(saveToFileVCS())); | 358 | SLOT(saveToFileVCS())); |
359 | exportPO->insertItem( i18n("Journal/Details..."),this, | 359 | exportPO->insertItem( i18n("Journal/Details..."),this, |
360 | SLOT(saveDescriptionToFile())); | 360 | SLOT(saveDescriptionToFile())); |
361 | // mPopupMenu->insertSeparator(); | 361 | // mPopupMenu->insertSeparator(); |
362 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 362 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
363 | // i18n("Add Categ. to selected..."),this, | 363 | // i18n("Add Categ. to selected..."),this, |
364 | // SLOT(addCat()),true); | 364 | // SLOT(addCat()),true); |
365 | //mPopupMenu->insertSeparator(); | 365 | //mPopupMenu->insertSeparator(); |
366 | #ifndef DESKTOP_VERSION | 366 | #ifndef DESKTOP_VERSION |
367 | selPopup->insertSeparator(); | 367 | selPopup->insertSeparator(); |
368 | selPopup->insertItem( i18n("Beam via IR..."),this, | 368 | selPopup->insertItem( i18n("Beam via IR..."),this, |
369 | SLOT(beamSelected())); | 369 | SLOT(beamSelected())); |
370 | #if 0 | 370 | #if 0 |
371 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 371 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
372 | i18n("Beam via IR"),this, | 372 | i18n("Beam via IR"),this, |
373 | SLOT(beamSelected()),true); | 373 | SLOT(beamSelected()),true); |
374 | #endif | 374 | #endif |
375 | #endif | 375 | #endif |
376 | /* | 376 | /* |
377 | mPopupMenu = new QPopupMenu; | 377 | mPopupMenu = new QPopupMenu; |
378 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 378 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
379 | SLOT (editEvent())); | 379 | SLOT (editEvent())); |
380 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 380 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
381 | SLOT (deleteEvent())); | 381 | SLOT (deleteEvent())); |
382 | mPopupMenu->insertSeparator(); | 382 | mPopupMenu->insertSeparator(); |
383 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 383 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
384 | SLOT(showDates())); | 384 | SLOT(showDates())); |
385 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 385 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
386 | SLOT(hideDates())); | 386 | SLOT(hideDates())); |
387 | */ | 387 | */ |
388 | QObject::connect(mListView,SIGNAL( newEvent()), | 388 | QObject::connect(mListView,SIGNAL( newEvent()), |
389 | this,SIGNAL(signalNewEvent())); | 389 | this,SIGNAL(signalNewEvent())); |
390 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 390 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
391 | this,SLOT(defaultItemAction(QListViewItem *))); | 391 | this,SLOT(defaultItemAction(QListViewItem *))); |
392 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 392 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
393 | const QPoint &, int )), | 393 | const QPoint &, int )), |
394 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 394 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
395 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 395 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
396 | SLOT(processSelectionChange(QListViewItem *))); | 396 | SLOT(processSelectionChange(QListViewItem *))); |
397 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 397 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
398 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 398 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
399 | 399 | ||
400 | readSettings(KOGlobals::config(),"KOListView Layout"); | 400 | readSettings(KOGlobals::config(),"KOListView Layout"); |
401 | } | 401 | } |
402 | 402 | ||
403 | KOListView::~KOListView() | 403 | KOListView::~KOListView() |
404 | { | 404 | { |
405 | delete mPopupMenu; | 405 | delete mPopupMenu; |
406 | #if QT_VERSION >= 0x030000 | 406 | #if QT_VERSION >= 0x030000 |
407 | 407 | ||
408 | #else | 408 | #else |
409 | delete mKOListViewWhatsThis; | 409 | delete mKOListViewWhatsThis; |
410 | #endif | 410 | #endif |
411 | } | 411 | } |
412 | 412 | ||
413 | void KOListView::catChanged( Incidence* inc) | 413 | void KOListView::catChanged( Incidence* inc) |
414 | { | 414 | { |
415 | KOListViewItem* item = getItemForEvent(inc); | 415 | KOListViewItem* item = getItemForEvent(inc); |
416 | if (item) { | 416 | if (item) { |
417 | ListItemVisitor v(item, mStartDate ); | 417 | ListItemVisitor v(item, mStartDate ); |
418 | inc->accept(v); | 418 | inc->accept(v); |
419 | } | 419 | } |
420 | } | 420 | } |
421 | QString KOListView::getWhatsThisText(QPoint p) | 421 | QString KOListView::getWhatsThisText(QPoint p) |
422 | { | 422 | { |
423 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 423 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
424 | if ( item ) | 424 | if ( item ) |
425 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 425 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
426 | KOPrefs::instance()->mWTshowDetails, | 426 | KOPrefs::instance()->mWTshowDetails, |
427 | KOPrefs::instance()->mWTshowCreated, | 427 | KOPrefs::instance()->mWTshowCreated, |
428 | KOPrefs::instance()->mWTshowChanged); | 428 | KOPrefs::instance()->mWTshowChanged); |
429 | return i18n("That is the list view" ); | 429 | return i18n("That is the list view" ); |
430 | 430 | ||
431 | } | 431 | } |
432 | 432 | ||
433 | void KOListView::setCalendar( int c ) | 433 | void KOListView::setCalendar( int c ) |
434 | { | 434 | { |
435 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 435 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
436 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 436 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
437 | i18n("Continue"), i18n("Cancel"), 0, | 437 | i18n("Continue"), i18n("Cancel"), 0, |
438 | 0, 1 ); | 438 | 0, 1 ); |
439 | if ( result != 0 ) { | 439 | if ( result != 0 ) { |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | 442 | ||
443 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 443 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
444 | int icount = delSel.count(); | 444 | int icount = delSel.count(); |
445 | if ( icount ) { | 445 | if ( icount ) { |
446 | Incidence *incidence = delSel.first(); | 446 | Incidence *incidence = delSel.first(); |
447 | while ( incidence ) { | 447 | while ( incidence ) { |
448 | incidence->setCalID( c ); | 448 | incidence->setCalID( c ); |
449 | KOListViewItem * item = getItemForEvent( incidence ); | 449 | KOListViewItem * item = getItemForEvent( incidence ); |
450 | if ( item ) { | 450 | if ( item ) { |
451 | ListItemVisitor v(item, mStartDate ); | 451 | ListItemVisitor v(item, mStartDate ); |
452 | incidence->accept(v); | 452 | incidence->accept(v); |
453 | } | 453 | } |
454 | incidence = delSel.next(); | 454 | incidence = delSel.next(); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 457 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
458 | KopiCalendarFile * cal = calendars.first(); | 458 | KopiCalendarFile * cal = calendars.first(); |
459 | while ( cal ) { | 459 | while ( cal ) { |
460 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 460 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
461 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 461 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
462 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 462 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
463 | if ( cal->isStandard ) | 463 | if ( cal->isStandard ) |
464 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 464 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
465 | cal = calendars.next(); | 465 | cal = calendars.next(); |
466 | } | 466 | } |
467 | mCalendar->setSyncEventsReadOnly(); | 467 | mCalendar->setSyncEventsReadOnly(); |
468 | mCalendar->reInitAlarmSettings(); | 468 | mCalendar->reInitAlarmSettings(); |
469 | 469 | ||
470 | } | 470 | } |
471 | void KOListView::populateCalPopup() | 471 | void KOListView::populateCalPopup() |
472 | { | 472 | { |
473 | mCalPopup->clear(); | 473 | mCalPopup->clear(); |
474 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 474 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
475 | while ( kkf ) { | 475 | while ( kkf ) { |
476 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); | 476 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
477 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 477 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
478 | mCalPopup->setItemEnabled( index, false ); | 478 | mCalPopup->setItemEnabled( index, false ); |
479 | kkf = KOPrefs::instance()->mCalendars.next(); | 479 | kkf = KOPrefs::instance()->mCalendars.next(); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | void KOListView::updateList() | 482 | void KOListView::updateList() |
483 | { | 483 | { |
484 | // qDebug(" KOListView::updateList() "); | 484 | // qDebug(" KOListView::updateList() "); |
485 | 485 | ||
486 | } | 486 | } |
487 | 487 | ||
488 | void KOListView::clearList() | 488 | void KOListView::clearList() |
489 | { | 489 | { |
490 | clear (); | 490 | clear (); |
491 | } | 491 | } |
492 | 492 | ||
493 | void KOListView::setCat() | 493 | void KOListView::setCat() |
494 | { | 494 | { |
495 | 495 | ||
496 | bool set = true; | 496 | bool set = true; |
497 | int result = KMessageBox::warningYesNoCancel(this, | 497 | int result = KMessageBox::warningYesNoCancel(this, |
498 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | 498 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), |
499 | i18n("Set categories"), | 499 | i18n("Set categories"), |
500 | i18n("Add"), | 500 | i18n("Add"), |
501 | i18n("Reset")); | 501 | i18n("Reset")); |
502 | if (result == KMessageBox::Cancel) return; | 502 | if (result == KMessageBox::Cancel) return; |
503 | if (result == KMessageBox::Yes) set = false; | 503 | if (result == KMessageBox::Yes) set = false; |
504 | setCategories( set ); | 504 | setCategories( set ); |
505 | } | 505 | } |
506 | 506 | ||
507 | void KOListView::setAlarm() | 507 | void KOListView::setAlarm() |
508 | { | 508 | { |
509 | KOAlarmPrefs kap( this); | 509 | KOAlarmPrefs kap( this); |
510 | if ( !kap.exec() ) | 510 | if ( !kap.exec() ) |
511 | return; | 511 | return; |
512 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos | 512 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
513 | Incidence* inc = delSel.first(); | 513 | Incidence* inc = delSel.first(); |
514 | int count = 0; | 514 | int count = 0; |
515 | while ( inc ) { | 515 | while ( inc ) { |
516 | ++count; | 516 | ++count; |
517 | if (kap.mAlarmButton->isChecked()) { | 517 | if (kap.mAlarmButton->isChecked()) { |
518 | if (inc->alarms().count() == 0) | 518 | if (inc->alarms().count() == 0) |
519 | inc->newAlarm(); | 519 | inc->newAlarm(); |
520 | Alarm *alarm = inc->alarms().first(); | ||
521 | alarm->setEnabled(true); | ||
522 | int j = kap.mAlarmTimeEdit->value()* -60; | ||
523 | if (kap.mAlarmIncrCombo->currentItem() == 1) | ||
524 | j = j * 60; | ||
525 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | ||
526 | j = j * (60 * 24); | ||
527 | alarm->setStartOffset( j ); | ||
528 | |||
529 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | ||
530 | alarm->setProcedureAlarm(kap.mAlarmProgram); | ||
531 | } | ||
532 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | ||
533 | alarm->setAudioAlarm(kap.mAlarmSound); | ||
534 | else | ||
535 | alarm->setType(Alarm::Invalid); | ||
536 | } else { | ||
520 | QPtrList<Alarm> alarms = inc->alarms(); | 537 | QPtrList<Alarm> alarms = inc->alarms(); |
521 | Alarm *alarm; | 538 | Alarm *alarm; |
522 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 539 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
523 | alarm->setEnabled(true); | ||
524 | int j = kap.mAlarmTimeEdit->value()* -60; | ||
525 | if (kap.mAlarmIncrCombo->currentItem() == 1) | ||
526 | j = j * 60; | ||
527 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | ||
528 | j = j * (60 * 24); | ||
529 | alarm->setStartOffset( j ); | ||
530 | |||
531 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | ||
532 | alarm->setProcedureAlarm(kap.mAlarmProgram); | ||
533 | } | ||
534 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | ||
535 | alarm->setAudioAlarm(kap.mAlarmSound); | ||
536 | else | ||
537 | alarm->setType(Alarm::Invalid); | ||
538 | //alarm->setAudioAlarm("default"); | ||
539 | // TODO: Deal with multiple alarms | ||
540 | break; // For now, stop after the first alarm | ||
541 | } | ||
542 | } else { | ||
543 | Alarm* alarm = inc->alarms().first(); | ||
544 | if ( alarm ) { | ||
545 | alarm->setEnabled(false); | 540 | alarm->setEnabled(false); |
546 | alarm->setType(Alarm::Invalid); | 541 | alarm->setType(Alarm::Invalid); |
547 | } | 542 | } |
548 | } | 543 | } |
549 | KOListViewItem* item = getItemForEvent(inc); | 544 | KOListViewItem* item = getItemForEvent(inc); |
550 | if (item) { | 545 | if (item) { |
551 | ListItemVisitor v(item, mStartDate ); | 546 | ListItemVisitor v(item, mStartDate ); |
552 | inc->accept(v); | 547 | inc->accept(v); |
553 | } | 548 | } |
554 | inc = delSel.next(); | 549 | inc = delSel.next(); |
555 | } | 550 | } |
556 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 551 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
557 | qDebug("KO: Set alarm for %d items", count); | 552 | qDebug("KO: Set alarm for %d items", count); |
558 | calendar()->reInitAlarmSettings(); | 553 | calendar()->reInitAlarmSettings(); |
559 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 554 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
560 | } | 555 | } |
561 | void KOListView::setCategories( bool removeOld ) | 556 | void KOListView::setCategories( bool removeOld ) |
562 | { | 557 | { |
563 | 558 | ||
564 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 559 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
565 | csd->setColorEnabled(); | 560 | csd->setColorEnabled(); |
566 | if (! csd->exec()) { | 561 | if (! csd->exec()) { |
567 | delete csd; | 562 | delete csd; |
568 | return; | 563 | return; |
569 | } | 564 | } |
570 | QStringList catList = csd->selectedCategories(); | 565 | QStringList catList = csd->selectedCategories(); |
571 | delete csd; | 566 | delete csd; |
572 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 567 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
573 | Incidence* inc = delSel.first(); | 568 | Incidence* inc = delSel.first(); |
574 | while ( inc ) { | 569 | while ( inc ) { |
575 | if ( removeOld ) { | 570 | if ( removeOld ) { |
576 | inc->setCategories( catList, false ); | 571 | inc->setCategories( catList, false ); |
577 | } else { | 572 | } else { |
578 | inc->addCategories( catList, false ); | 573 | inc->addCategories( catList, false ); |
579 | } | 574 | } |
580 | KOListViewItem* item = getItemForEvent(inc); | 575 | KOListViewItem* item = getItemForEvent(inc); |
581 | if (item) { | 576 | if (item) { |
582 | ListItemVisitor v(item, mStartDate ); | 577 | ListItemVisitor v(item, mStartDate ); |
583 | inc->accept(v); | 578 | inc->accept(v); |
584 | } | 579 | } |
585 | inc = delSel.next(); | 580 | inc = delSel.next(); |
586 | } | 581 | } |
587 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 582 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
588 | } | 583 | } |
589 | 584 | ||
590 | void KOListView::beamSelected() | 585 | void KOListView::beamSelected() |
591 | { | 586 | { |
592 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 587 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
593 | if ( delSel.count() ) | 588 | if ( delSel.count() ) |
594 | emit beamIncidenceList( delSel ); | 589 | emit beamIncidenceList( delSel ); |
595 | } | 590 | } |
596 | 591 | ||
597 | void KOListView::saveDescriptionToFile() | 592 | void KOListView::saveDescriptionToFile() |
598 | { | 593 | { |
599 | 594 | ||
600 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 595 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
601 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 596 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
602 | i18n("Continue"), i18n("Cancel"), 0, | 597 | i18n("Continue"), i18n("Cancel"), 0, |
603 | 0, 1 ); | 598 | 0, 1 ); |
604 | if ( result != 0 ) { | 599 | if ( result != 0 ) { |
605 | return; | 600 | return; |
606 | } | 601 | } |
607 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 602 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
608 | int icount = delSel.count(); | 603 | int icount = delSel.count(); |
609 | if ( icount ) { | 604 | if ( icount ) { |
610 | QString fn = KOPrefs::instance()->mLastSaveFile; | 605 | QString fn = KOPrefs::instance()->mLastSaveFile; |
611 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 606 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
612 | 607 | ||
613 | if ( fn == "" ) | 608 | if ( fn == "" ) |
614 | return; | 609 | return; |
615 | QFileInfo info; | 610 | QFileInfo info; |
616 | info.setFile( fn ); | 611 | info.setFile( fn ); |
617 | QString mes; | 612 | QString mes; |
618 | bool createbup = true; | 613 | bool createbup = true; |
619 | if ( info. exists() ) { | 614 | if ( info. exists() ) { |
620 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 615 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
621 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 616 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
622 | i18n("Overwrite!"), i18n("Cancel"), 0, | 617 | i18n("Overwrite!"), i18n("Cancel"), 0, |
623 | 0, 1 ); | 618 | 0, 1 ); |
624 | if ( result != 0 ) { | 619 | if ( result != 0 ) { |
625 | createbup = false; | 620 | createbup = false; |
626 | } | 621 | } |
627 | } | 622 | } |
628 | if ( createbup ) { | 623 | if ( createbup ) { |
629 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 624 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
630 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 625 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
631 | Incidence *incidence = delSel.first(); | 626 | Incidence *incidence = delSel.first(); |
632 | icount = 0; | 627 | icount = 0; |
633 | while ( incidence ) { | 628 | while ( incidence ) { |
634 | if ( incidence->typeID() == journalID ) { | 629 | if ( incidence->typeID() == journalID ) { |
635 | text += "\n************************************\n"; | 630 | text += "\n************************************\n"; |
636 | if ( !incidence->summary().isEmpty() ) | 631 | if ( !incidence->summary().isEmpty() ) |
637 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); | 632 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); |
638 | else | 633 | else |
639 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 634 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
640 | if ( !incidence->location().isEmpty() ) | 635 | if ( !incidence->location().isEmpty() ) |
641 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 636 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
642 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 637 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
643 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 638 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
644 | ++icount; | 639 | ++icount; |
645 | 640 | ||
646 | } else { | 641 | } else { |
647 | if ( !incidence->description().isEmpty() ) { | 642 | if ( !incidence->description().isEmpty() ) { |
648 | text += "\n************************************\n"; | 643 | text += "\n************************************\n"; |
649 | if ( incidence->typeID() == todoID ) | 644 | if ( incidence->typeID() == todoID ) |
650 | text += i18n("To-Do: "); | 645 | text += i18n("To-Do: "); |
651 | text += incidence->summary(); | 646 | text += incidence->summary(); |
652 | if ( !incidence->location().isEmpty() ) | 647 | if ( !incidence->location().isEmpty() ) |
653 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 648 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
654 | if ( incidence->hasStartDate() ) | 649 | if ( incidence->hasStartDate() ) |
655 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 650 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
656 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 651 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
657 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 652 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
658 | ++icount; | 653 | ++icount; |
659 | 654 | ||
660 | } | 655 | } |
661 | } | 656 | } |
662 | incidence = delSel.next(); | 657 | incidence = delSel.next(); |
663 | } | 658 | } |
664 | QFile file( fn ); | 659 | QFile file( fn ); |
665 | if (!file.open( IO_WriteOnly ) ) { | 660 | if (!file.open( IO_WriteOnly ) ) { |
666 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 661 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
667 | return; | 662 | return; |
668 | } | 663 | } |
669 | QTextStream ts( &file ); | 664 | QTextStream ts( &file ); |
670 | ts << text; | 665 | ts << text; |
671 | file.close(); | 666 | file.close(); |
672 | //qDebug("%s ", text.latin1()); | 667 | //qDebug("%s ", text.latin1()); |
673 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 668 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
674 | KOPrefs::instance()->mLastSaveFile = fn; | 669 | KOPrefs::instance()->mLastSaveFile = fn; |
675 | topLevelWidget()->setCaption(mes); | 670 | topLevelWidget()->setCaption(mes); |
676 | } | 671 | } |
677 | } | 672 | } |
678 | } | 673 | } |
679 | void KOListView::saveToFileVCS() | 674 | void KOListView::saveToFileVCS() |
680 | { | 675 | { |
681 | writeToFile( false ); | 676 | writeToFile( false ); |
682 | } | 677 | } |
683 | void KOListView::saveToFile() | 678 | void KOListView::saveToFile() |
684 | { | 679 | { |
685 | writeToFile( true ); | 680 | writeToFile( true ); |
686 | } | 681 | } |
687 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) | 682 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
688 | { | 683 | { |
689 | QPtrList<Incidence> delSel ; | 684 | QPtrList<Incidence> delSel ; |
690 | bool addSubTodos = false; | 685 | bool addSubTodos = false; |
691 | bool askSubTodos = true; | 686 | bool askSubTodos = true; |
692 | QListViewItem *item = mListView->firstChild (); | 687 | QListViewItem *item = mListView->firstChild (); |
693 | while ( item ) { | 688 | while ( item ) { |
694 | if ( item->isSelected() ) { | 689 | if ( item->isSelected() ) { |
695 | Incidence* inc = ((KOListViewItem *)item)->data(); | 690 | Incidence* inc = ((KOListViewItem *)item)->data(); |
696 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { | 691 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
697 | if ( (inc->typeID() == todoID && includeTodos) || | 692 | if ( (inc->typeID() == todoID && includeTodos) || |
698 | (inc->typeID() == eventID && includeEvents) || | 693 | (inc->typeID() == eventID && includeEvents) || |
699 | (inc->typeID() == journalID && includeJournals) ) { | 694 | (inc->typeID() == journalID && includeJournals) ) { |
700 | if ( inc->typeID() == todoID && onlyDueTodos ) { | 695 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
701 | if ( ((Todo*)inc)->hasDueDate() ) | 696 | if ( ((Todo*)inc)->hasDueDate() ) |
702 | delSel.append( inc ); | 697 | delSel.append( inc ); |
703 | } else | 698 | } else |
704 | delSel.append( inc ); | 699 | delSel.append( inc ); |
705 | 700 | ||
706 | } | 701 | } |
707 | } | 702 | } |
708 | if ( inc->typeID() == todoID ) { | 703 | if ( inc->typeID() == todoID ) { |
709 | Todo * todo = (Todo*) inc; | 704 | Todo * todo = (Todo*) inc; |
710 | if ( todo->relations().count() ) { | 705 | if ( todo->relations().count() ) { |
711 | if ( askSubTodos ) { | 706 | if ( askSubTodos ) { |
712 | int result = KMessageBox::warningYesNoCancel(this, | 707 | int result = KMessageBox::warningYesNoCancel(this, |
713 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), | 708 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), |
714 | i18n("Todo has subtodos"), | 709 | i18n("Todo has subtodos"), |
715 | i18n("Yes"), | 710 | i18n("Yes"), |
716 | i18n("No")); | 711 | i18n("No")); |
717 | if ( result == KMessageBox::Cancel ) { | 712 | if ( result == KMessageBox::Cancel ) { |
718 | delSel.clear(); | 713 | delSel.clear(); |
719 | return delSel; | 714 | return delSel; |
720 | } | 715 | } |
721 | if (result == KMessageBox::Yes) | 716 | if (result == KMessageBox::Yes) |
722 | addSubTodos = true; | 717 | addSubTodos = true; |
723 | askSubTodos = false; | 718 | askSubTodos = false; |
724 | } | 719 | } |
725 | if ( addSubTodos ) { | 720 | if ( addSubTodos ) { |
726 | QPtrList<Incidence> tempSel ; | 721 | QPtrList<Incidence> tempSel ; |
727 | inc->addRelationsToList( &tempSel ); | 722 | inc->addRelationsToList( &tempSel ); |
728 | Incidence* tempinc = tempSel.first(); | 723 | Incidence* tempinc = tempSel.first(); |
729 | while ( tempinc ) { | 724 | while ( tempinc ) { |
730 | if ( delSel.findRef( tempinc ) == -1 ) { | 725 | if ( delSel.findRef( tempinc ) == -1 ) { |
731 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { | 726 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { |
732 | if ( ((Todo*)tempinc)->hasDueDate() ) | 727 | if ( ((Todo*)tempinc)->hasDueDate() ) |
733 | delSel.append( tempinc ); | 728 | delSel.append( tempinc ); |
734 | } else | 729 | } else |
735 | delSel.append( tempinc ); | 730 | delSel.append( tempinc ); |
736 | } | 731 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 2289977..53bbe28 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1335,823 +1335,889 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1335 | resize( QApplication::desktop()->size() ); | 1335 | resize( QApplication::desktop()->size() ); |
1336 | #else | 1336 | #else |
1337 | resize(640, 480 ); | 1337 | resize(640, 480 ); |
1338 | updatePossible = true; | 1338 | updatePossible = true; |
1339 | #endif | 1339 | #endif |
1340 | computeLayout(); | 1340 | computeLayout(); |
1341 | 1341 | ||
1342 | if ( mShowWeekView ) | 1342 | if ( mShowWeekView ) |
1343 | mWidStack->raiseWidget( mWeekView ); | 1343 | mWidStack->raiseWidget( mWeekView ); |
1344 | else | 1344 | else |
1345 | mWidStack->raiseWidget( mMonthView ); | 1345 | mWidStack->raiseWidget( mMonthView ); |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | KOMonthView::~KOMonthView() | 1348 | KOMonthView::~KOMonthView() |
1349 | { | 1349 | { |
1350 | delete mContextMenu; | 1350 | delete mContextMenu; |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | void KOMonthView::catChanged( Incidence * ) | 1353 | void KOMonthView::catChanged( Incidence * ) |
1354 | { | 1354 | { |
1355 | updateView(); | 1355 | updateView(); |
1356 | } | 1356 | } |
1357 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) | 1357 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) |
1358 | { | 1358 | { |
1359 | static Incidence * lastInc = 0; | 1359 | static Incidence * lastInc = 0; |
1360 | static MonthViewCell * lastCell = 0; | 1360 | static MonthViewCell * lastCell = 0; |
1361 | 1361 | ||
1362 | if ( lastInc == inc && lastCell == mc ) | 1362 | if ( lastInc == inc && lastCell == mc ) |
1363 | return; | 1363 | return; |
1364 | lastInc = inc; | 1364 | lastInc = inc; |
1365 | lastCell = mc; | 1365 | lastCell = mc; |
1366 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1366 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |
1367 | 1367 | ||
1368 | bool weekview = false; | 1368 | bool weekview = false; |
1369 | uint index = 0; | 1369 | uint index = 0; |
1370 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1370 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1371 | if ( mCellsW[i] == mc ) { | 1371 | if ( mCellsW[i] == mc ) { |
1372 | weekview = true; | 1372 | weekview = true; |
1373 | index = i; | 1373 | index = i; |
1374 | break; | 1374 | break; |
1375 | } | 1375 | } |
1376 | } | 1376 | } |
1377 | QPtrVector<MonthViewCell> *cells; | 1377 | QPtrVector<MonthViewCell> *cells; |
1378 | if ( weekview ) | 1378 | if ( weekview ) |
1379 | cells = &mCellsW; | 1379 | cells = &mCellsW; |
1380 | else { | 1380 | else { |
1381 | for (uint i = 0; i < mCells.count(); ++i) { | 1381 | for (uint i = 0; i < mCells.count(); ++i) { |
1382 | if ( mCells[i] == mc ) { | 1382 | if ( mCells[i] == mc ) { |
1383 | index = i; | 1383 | index = i; |
1384 | break; | 1384 | break; |
1385 | } | 1385 | } |
1386 | } | 1386 | } |
1387 | cells = &mCells; | 1387 | cells = &mCells; |
1388 | } | 1388 | } |
1389 | for (uint i = 0; i < (*cells).count(); ++i) { | 1389 | for (uint i = 0; i < (*cells).count(); ++i) { |
1390 | (*cells)[i]->deHighLight(); | 1390 | (*cells)[i]->deHighLight(); |
1391 | } | 1391 | } |
1392 | if ( ! inc ) | 1392 | if ( ! inc ) |
1393 | return; | 1393 | return; |
1394 | 1394 | ||
1395 | uint count = (*cells).count(); | 1395 | uint count = (*cells).count(); |
1396 | bool goLeft = (mday > 1 && index > 0); | 1396 | bool goLeft = (mday > 1 && index > 0); |
1397 | bool goRight = (mday < 3 && mday > 0 && index < count -1); | 1397 | bool goRight = (mday < 3 && mday > 0 && index < count -1); |
1398 | for (uint iii = 1; iii < count; ++iii) { | 1398 | for (uint iii = 1; iii < count; ++iii) { |
1399 | if ( goLeft ) { | 1399 | if ( goLeft ) { |
1400 | int left = index - iii; | 1400 | int left = index - iii; |
1401 | if ( left >= 0 ) { | 1401 | if ( left >= 0 ) { |
1402 | if ( (*cells)[(uint)left]->doHighLight(inc) ) | 1402 | if ( (*cells)[(uint)left]->doHighLight(inc) ) |
1403 | goLeft = false; | 1403 | goLeft = false; |
1404 | } else | 1404 | } else |
1405 | goLeft = false; | 1405 | goLeft = false; |
1406 | } | 1406 | } |
1407 | if ( goRight ) { | 1407 | if ( goRight ) { |
1408 | uint right = index + iii; | 1408 | uint right = index + iii; |
1409 | if ( right < count ) { | 1409 | if ( right < count ) { |
1410 | if ( (*cells)[right]->doHighLight(inc) ) | 1410 | if ( (*cells)[right]->doHighLight(inc) ) |
1411 | goRight = false; | 1411 | goRight = false; |
1412 | 1412 | ||
1413 | } else | 1413 | } else |
1414 | goRight = false; | 1414 | goRight = false; |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | } | 1417 | } |
1418 | #if 0 | 1418 | #if 0 |
1419 | if ( mday > 1 && index > 0 ) | 1419 | if ( mday > 1 && index > 0 ) |
1420 | for (int i = index-1; i >= 0; --i) { | 1420 | for (int i = index-1; i >= 0; --i) { |
1421 | //qDebug("index %d iii %d ", index, i); | 1421 | //qDebug("index %d iii %d ", index, i); |
1422 | if ( (*cells)[(uint)i]->doHighLight(inc) ) | 1422 | if ( (*cells)[(uint)i]->doHighLight(inc) ) |
1423 | break; | 1423 | break; |
1424 | } | 1424 | } |
1425 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) | 1425 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) |
1426 | for (uint i = index+1; i < (*cells).count(); ++i) { | 1426 | for (uint i = index+1; i < (*cells).count(); ++i) { |
1427 | if ( (*cells)[i]->doHighLight(inc) ) | 1427 | if ( (*cells)[i]->doHighLight(inc) ) |
1428 | break; | 1428 | break; |
1429 | } | 1429 | } |
1430 | #endif | 1430 | #endif |
1431 | 1431 | ||
1432 | } | 1432 | } |
1433 | void KOMonthView::selectInternalWeekNum ( int n ) | 1433 | void KOMonthView::selectInternalWeekNum ( int n ) |
1434 | { | 1434 | { |
1435 | switchView(); | 1435 | switchView(); |
1436 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1436 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
1437 | emit selectMonth (); | 1437 | emit selectMonth (); |
1438 | else | 1438 | else |
1439 | emit selectWeekNum ( n ); | 1439 | emit selectWeekNum ( n ); |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | int KOMonthView::currentWeek() | 1442 | int KOMonthView::currentWeek() |
1443 | { | 1443 | { |
1444 | if ( mShowWeekView ) | 1444 | if ( mShowWeekView ) |
1445 | return mWeekLabelsW[0]->getWeekNum(); | 1445 | return mWeekLabelsW[0]->getWeekNum(); |
1446 | return mWeekLabels[0]->getWeekNum(); | 1446 | return mWeekLabels[0]->getWeekNum(); |
1447 | } | 1447 | } |
1448 | void KOMonthView::switchView() | 1448 | void KOMonthView::switchView() |
1449 | { | 1449 | { |
1450 | if ( selectedCell( ) ) | 1450 | if ( selectedCell( ) ) |
1451 | selectedCell()->deselect(); | 1451 | selectedCell()->deselect(); |
1452 | mShowWeekView = !mShowWeekView; | 1452 | mShowWeekView = !mShowWeekView; |
1453 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 1453 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
1454 | if ( clPending ) { | 1454 | if ( clPending ) { |
1455 | computeLayout(); | 1455 | computeLayout(); |
1456 | updateConfig(); | 1456 | updateConfig(); |
1457 | } | 1457 | } |
1458 | if ( mShowWeekView ) | 1458 | if ( mShowWeekView ) |
1459 | mWidStack->raiseWidget( mWeekView ); | 1459 | mWidStack->raiseWidget( mWeekView ); |
1460 | else | 1460 | else |
1461 | mWidStack->raiseWidget( mMonthView ); | 1461 | mWidStack->raiseWidget( mMonthView ); |
1462 | clPending = false; | 1462 | clPending = false; |
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | int KOMonthView::maxDatesHint() | 1465 | int KOMonthView::maxDatesHint() |
1466 | { | 1466 | { |
1467 | return mNumCells; | 1467 | return mNumCells; |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | int KOMonthView::currentDateCount() | 1470 | int KOMonthView::currentDateCount() |
1471 | { | 1471 | { |
1472 | return mNumCells; | 1472 | return mNumCells; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 1475 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
1476 | { | 1476 | { |
1477 | QPtrList<Incidence> selected; | 1477 | QPtrList<Incidence> selected; |
1478 | 1478 | ||
1479 | if ( mSelectedCell ) { | 1479 | if ( mSelectedCell ) { |
1480 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 1480 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
1481 | if ( incidence ) selected.append( incidence ); | 1481 | if ( incidence ) selected.append( incidence ); |
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | return selected; | 1484 | return selected; |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | DateList KOMonthView::selectedDates() | 1487 | DateList KOMonthView::selectedDates() |
1488 | { | 1488 | { |
1489 | DateList selected; | 1489 | DateList selected; |
1490 | 1490 | ||
1491 | if ( mSelectedCell ) { | 1491 | if ( mSelectedCell ) { |
1492 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1492 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1493 | if ( qd.isValid() ) selected.append( qd ); | 1493 | if ( qd.isValid() ) selected.append( qd ); |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | return selected; | 1496 | return selected; |
1497 | } | 1497 | } |
1498 | #if 0 | 1498 | #if 0 |
1499 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1499 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1500 | const QDate &td) | 1500 | const QDate &td) |
1501 | { | 1501 | { |
1502 | #ifndef KORG_NOPRINTER | 1502 | #ifndef KORG_NOPRINTER |
1503 | calPrinter->preview(CalPrinter::Month, fd, td); | 1503 | calPrinter->preview(CalPrinter::Month, fd, td); |
1504 | #endif | 1504 | #endif |
1505 | } | 1505 | } |
1506 | #endif | 1506 | #endif |
1507 | void KOMonthView::updateConfig() | 1507 | void KOMonthView::updateConfig() |
1508 | { | 1508 | { |
1509 | 1509 | ||
1510 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1510 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1511 | 1511 | ||
1512 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1512 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1513 | mWeekStartsMonday = true; | 1513 | mWeekStartsMonday = true; |
1514 | } | 1514 | } |
1515 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1515 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1516 | mWidthLongDayLabel = 0; | 1516 | mWidthLongDayLabel = 0; |
1517 | 1517 | ||
1518 | for (int i = 0; i < 7; i++) { | 1518 | for (int i = 0; i < 7; i++) { |
1519 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1519 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1520 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1520 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1521 | } | 1521 | } |
1522 | bool temp = mShowSatSunComp ; | 1522 | bool temp = mShowSatSunComp ; |
1523 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1523 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1524 | if ( ! mShowWeekView ) { | 1524 | if ( ! mShowWeekView ) { |
1525 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1525 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1526 | computeLayout(); | 1526 | computeLayout(); |
1527 | } | 1527 | } else |
1528 | doComputeLayoutWeek(); | ||
1528 | updateDayLabels(); | 1529 | updateDayLabels(); |
1529 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1530 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1530 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1531 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1531 | //resizeEvent( 0 ); | 1532 | //resizeEvent( 0 ); |
1532 | for (uint i = 0; i < mCells.count(); ++i) { | 1533 | for (uint i = 0; i < mCells.count(); ++i) { |
1533 | mCells[i]->updateConfig(); | 1534 | mCells[i]->updateConfig(); |
1534 | } | 1535 | } |
1535 | 1536 | ||
1536 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1537 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1537 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1538 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1538 | } | 1539 | } |
1539 | #ifdef DESKTOP_VERSION | 1540 | #ifdef DESKTOP_VERSION |
1540 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1541 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1541 | #endif | 1542 | #endif |
1542 | updateView(); | 1543 | updateView(); |
1543 | } | 1544 | } |
1544 | 1545 | ||
1545 | void KOMonthView::updateDayLabels() | 1546 | void KOMonthView::updateDayLabels() |
1546 | { | 1547 | { |
1547 | 1548 | ||
1548 | QPtrVector<QLabel> *mDayLabelsT; | 1549 | QPtrVector<QLabel> *mDayLabelsT; |
1549 | 1550 | ||
1550 | mDayLabelsT = &mDayLabelsW; | 1551 | mDayLabelsT = &mDayLabelsW; |
1551 | for (int i = 0; i < 7; i++) { | 1552 | for (int i = 0; i < 7; i++) { |
1552 | { | 1553 | { |
1553 | bool show = mShortDayLabelsW; | 1554 | bool show = mShortDayLabelsW; |
1554 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1555 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1555 | show = true; | 1556 | show = true; |
1556 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1557 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1557 | } | 1558 | } |
1558 | } | 1559 | } |
1559 | mDayLabelsT = &mDayLabels; | 1560 | mDayLabelsT = &mDayLabels; |
1560 | for (int i = 0; i < 7; i++) { | 1561 | for (int i = 0; i < 7; i++) { |
1561 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1562 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1562 | bool show = mShortDayLabelsM; | 1563 | bool show = mShortDayLabelsM; |
1563 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1564 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1564 | show = true; | 1565 | show = true; |
1565 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1566 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1566 | } else { | 1567 | } else { |
1567 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1568 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1568 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1569 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1569 | 1570 | ||
1570 | } | 1571 | } |
1571 | } | 1572 | } |
1572 | 1573 | ||
1573 | } | 1574 | } |
1574 | 1575 | ||
1575 | void KOMonthView::clearList() | 1576 | void KOMonthView::clearList() |
1576 | { | 1577 | { |
1577 | unsigned int i; | 1578 | unsigned int i; |
1578 | for( i = 0; i < mCells.size(); ++i ) { | 1579 | for( i = 0; i < mCells.size(); ++i ) { |
1579 | mCells[i]->clear(); | 1580 | mCells[i]->clear(); |
1580 | } | 1581 | } |
1581 | for( i = 0; i < mCellsW.size(); ++i ) { | 1582 | for( i = 0; i < mCellsW.size(); ++i ) { |
1582 | mCellsW[i]->clear(); | 1583 | mCellsW[i]->clear(); |
1583 | } | 1584 | } |
1584 | } | 1585 | } |
1585 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1586 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1586 | { | 1587 | { |
1587 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1588 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1588 | 1589 | ||
1589 | QPtrVector<MonthViewCell> *cells; | 1590 | QPtrVector<MonthViewCell> *cells; |
1590 | QPtrVector<QLabel> *dayLabels; | 1591 | QPtrVector<QLabel> *dayLabels; |
1591 | QPtrVector<KOWeekButton> *weekLabels; | 1592 | QPtrVector<KOWeekButton> *weekLabels; |
1592 | uint weekNum = 6; | 1593 | uint weekNum = 6; |
1593 | mStartDate = start; | 1594 | mStartDate = start; |
1594 | if ( mShowWeekView ) { | 1595 | if ( mShowWeekView ) { |
1595 | weekNum = 1; | 1596 | weekNum = 1; |
1596 | cells = &mCellsW; | 1597 | cells = &mCellsW; |
1597 | dayLabels = &mDayLabelsW; | 1598 | dayLabels = &mDayLabelsW; |
1598 | weekLabels = &mWeekLabelsW; | 1599 | weekLabels = &mWeekLabelsW; |
1599 | if ( !KGlobal::locale()->weekStartsMonday() ) { | 1600 | if ( !KGlobal::locale()->weekStartsMonday() ) { |
1600 | mStartDate = mStartDate.addDays( 1 ); | 1601 | mStartDate = mStartDate.addDays( 1 ); |
1601 | } | 1602 | } |
1602 | } else { | 1603 | } else { |
1603 | cells = &mCells; | 1604 | cells = &mCells; |
1604 | dayLabels = &mDayLabels; | 1605 | dayLabels = &mDayLabels; |
1605 | weekLabels = &mWeekLabels; | 1606 | weekLabels = &mWeekLabels; |
1606 | } | 1607 | } |
1607 | 1608 | ||
1608 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1609 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1609 | 1610 | ||
1610 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1611 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1611 | mWeekStartsMonday = true; | 1612 | mWeekStartsMonday = true; |
1612 | } | 1613 | } |
1613 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1614 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1614 | 1615 | ||
1615 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1616 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1616 | mStartDate = mStartDate.addDays( -1 ); | 1617 | mStartDate = mStartDate.addDays( -1 ); |
1617 | } | 1618 | } |
1618 | uint i; | 1619 | uint i; |
1619 | for( i = 0; i < (*cells).size(); ++i ) { | 1620 | for( i = 0; i < (*cells).size(); ++i ) { |
1620 | QDate date = mStartDate.addDays( i ); | 1621 | QDate date = mStartDate.addDays( i ); |
1621 | (*cells)[i]->setDate( date ); | 1622 | (*cells)[i]->setDate( date ); |
1622 | 1623 | ||
1623 | #ifndef KORG_NOPLUGINS | 1624 | #ifndef KORG_NOPLUGINS |
1624 | // add holiday, if present | 1625 | // add holiday, if present |
1625 | QString hstring(KOCore::self()->holiday(date)); | 1626 | QString hstring(KOCore::self()->holiday(date)); |
1626 | (*cells)[i]->setHoliday( hstring ); | 1627 | (*cells)[i]->setHoliday( hstring ); |
1627 | #endif | 1628 | #endif |
1628 | 1629 | ||
1629 | } | 1630 | } |
1630 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1631 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1631 | for( i = 0; i < weekNum; ++i ) { | 1632 | for( i = 0; i < weekNum; ++i ) { |
1632 | int wno; | 1633 | int wno; |
1633 | // remember, according to ISO 8601, the first week of the year is the | 1634 | // remember, according to ISO 8601, the first week of the year is the |
1634 | // first week that contains a thursday. Thus we must subtract off 4, | 1635 | // first week that contains a thursday. Thus we must subtract off 4, |
1635 | // not just 1. | 1636 | // not just 1. |
1636 | int dayOfYear = date.dayOfYear(); | 1637 | int dayOfYear = date.dayOfYear(); |
1637 | if (dayOfYear % 7 != 0) | 1638 | if (dayOfYear % 7 != 0) |
1638 | wno = dayOfYear / 7 + 1; | 1639 | wno = dayOfYear / 7 + 1; |
1639 | else | 1640 | else |
1640 | wno =dayOfYear / 7; | 1641 | wno =dayOfYear / 7; |
1641 | (*weekLabels)[i]->setWeekNum( wno ); | 1642 | (*weekLabels)[i]->setWeekNum( wno ); |
1642 | date = date.addDays( 7 ); | 1643 | date = date.addDays( 7 ); |
1643 | } | 1644 | } |
1644 | updateView(); | 1645 | updateView(); |
1645 | } | 1646 | } |
1646 | 1647 | ||
1647 | void KOMonthView::showEvents(QPtrList<Event>) | 1648 | void KOMonthView::showEvents(QPtrList<Event>) |
1648 | { | 1649 | { |
1649 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1650 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1650 | } | 1651 | } |
1651 | 1652 | ||
1652 | void KOMonthView::changeEventDisplay(Event *, int) | 1653 | void KOMonthView::changeEventDisplay(Event *, int) |
1653 | { | 1654 | { |
1654 | // this should be re-written to be much more efficient, but this | 1655 | // this should be re-written to be much more efficient, but this |
1655 | // quick-and-dirty-hack gets the job done for right now. | 1656 | // quick-and-dirty-hack gets the job done for right now. |
1656 | //qDebug("KOMonthView::changeEventDisplay "); | 1657 | //qDebug("KOMonthView::changeEventDisplay "); |
1657 | updateView(); | 1658 | updateView(); |
1658 | } | 1659 | } |
1659 | 1660 | ||
1660 | void KOMonthView::updateView() | 1661 | void KOMonthView::updateView() |
1661 | { | 1662 | { |
1662 | 1663 | ||
1663 | if ( !updatePossible ) | 1664 | if ( !updatePossible ) |
1664 | return; | 1665 | return; |
1665 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); | 1666 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); |
1666 | //QTime ti; | 1667 | //QTime ti; |
1667 | //ti.start(); | 1668 | //ti.start(); |
1668 | clearSelection(); | 1669 | clearSelection(); |
1669 | QPtrVector<MonthViewCell> *cells; | 1670 | QPtrVector<MonthViewCell> *cells; |
1670 | if ( mShowWeekView ) { | 1671 | if ( mShowWeekView ) { |
1671 | cells = &mCellsW; | 1672 | cells = &mCellsW; |
1672 | } else { | 1673 | } else { |
1673 | cells = &mCells; | 1674 | cells = &mCells; |
1674 | } | 1675 | } |
1675 | #if 1 | 1676 | #if 1 |
1676 | int i; | 1677 | int i; |
1677 | int timeSpan = (*cells).size()-1; | 1678 | int timeSpan = (*cells).size()-1; |
1678 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1679 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1679 | timeSpan = 6; | 1680 | timeSpan = 6; |
1680 | for( i = 0; i < timeSpan + 1; ++i ) { | 1681 | for( i = 0; i < timeSpan + 1; ++i ) { |
1681 | (*cells)[i]->startUpdateCell(); | 1682 | (*cells)[i]->startUpdateCell(); |
1682 | } | 1683 | } |
1683 | 1684 | ||
1684 | QPtrList<Event> events = calendar()->events(); | 1685 | QPtrList<Event> events = calendar()->events(); |
1685 | Event *event; | 1686 | Event *event; |
1686 | QDateTime dt; | 1687 | QDateTime dt; |
1687 | QDate endDate = mStartDate.addDays( timeSpan ); | 1688 | QDate endDate = mStartDate.addDays( timeSpan ); |
1688 | for( event = events.first(); event; event = events.next() ) { // for event | 1689 | for( event = events.first(); event; event = events.next() ) { // for event |
1689 | if ( event->doesRecur() ) { | 1690 | if ( event->doesRecur() ) { |
1690 | bool last; | 1691 | bool last; |
1691 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1692 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1692 | QDateTime incidenceEnd; | 1693 | QDateTime incidenceEnd; |
1693 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1694 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1694 | bool invalid = false; | 1695 | bool invalid = false; |
1695 | while( true ) { | 1696 | while( true ) { |
1696 | if ( incidenceStart.isValid() ) { | 1697 | if ( incidenceStart.isValid() ) { |
1697 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1698 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1698 | int st = incidenceStart.date().daysTo( endDate ); | 1699 | int st = incidenceStart.date().daysTo( endDate ); |
1699 | if ( st >= 0 ) { // start before timeend | 1700 | if ( st >= 0 ) { // start before timeend |
1700 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1701 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1701 | if ( end >= 0 ) { // end after timestart --- got one! | 1702 | if ( end >= 0 ) { // end after timestart --- got one! |
1702 | //normalize | 1703 | //normalize |
1703 | st = timeSpan - st; | 1704 | st = timeSpan - st; |
1704 | if ( st < 0 ) st = 0; | 1705 | if ( st < 0 ) st = 0; |
1705 | if ( end > timeSpan ) end = timeSpan; | 1706 | if ( end > timeSpan ) end = timeSpan; |
1706 | int iii; | 1707 | int iii; |
1707 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1708 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1708 | for ( iii = st;iii<= end;++iii) | 1709 | for ( iii = st;iii<= end;++iii) |
1709 | (*cells)[iii]->insertEvent( event ); | 1710 | (*cells)[iii]->insertEvent( event ); |
1710 | } | 1711 | } |
1711 | } | 1712 | } |
1712 | } else { | 1713 | } else { |
1713 | if ( invalid ) | 1714 | if ( invalid ) |
1714 | break; | 1715 | break; |
1715 | invalid = true; | 1716 | invalid = true; |
1716 | //qDebug("invalid %s", event->summary().latin1()); | 1717 | //qDebug("invalid %s", event->summary().latin1()); |
1717 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1718 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1718 | } | 1719 | } |
1719 | if ( last ) | 1720 | if ( last ) |
1720 | break; | 1721 | break; |
1721 | bool ok; | 1722 | bool ok; |
1722 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1723 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1723 | if ( ! ok ) | 1724 | if ( ! ok ) |
1724 | break; | 1725 | break; |
1725 | if ( incidenceStart.date() > endDate ) | 1726 | if ( incidenceStart.date() > endDate ) |
1726 | break; | 1727 | break; |
1727 | } | 1728 | } |
1728 | } else { // no recur | 1729 | } else { // no recur |
1729 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1730 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1730 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1731 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1731 | continue; | 1732 | continue; |
1732 | int st = event->dtStart().date().daysTo( endDate ); | 1733 | int st = event->dtStart().date().daysTo( endDate ); |
1733 | if ( st >= 0 ) { // start before timeend | 1734 | if ( st >= 0 ) { // start before timeend |
1734 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1735 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1735 | if ( end >= 0 ) { // end after timestart --- got one! | 1736 | if ( end >= 0 ) { // end after timestart --- got one! |
1736 | //normalize | 1737 | //normalize |
1737 | st = timeSpan - st; | 1738 | st = timeSpan - st; |
1738 | if ( st < 0 ) st = 0; | 1739 | if ( st < 0 ) st = 0; |
1739 | if ( end > timeSpan ) end = timeSpan; | 1740 | if ( end > timeSpan ) end = timeSpan; |
1740 | int iii; | 1741 | int iii; |
1741 | for ( iii = st;iii<= end;++iii) | 1742 | for ( iii = st;iii<= end;++iii) |
1742 | (*cells)[iii]->insertEvent( event ); | 1743 | (*cells)[iii]->insertEvent( event ); |
1743 | } | 1744 | } |
1744 | } | 1745 | } |
1745 | } | 1746 | } |
1746 | } | 1747 | } |
1747 | // insert due todos | 1748 | // insert due todos |
1748 | QPtrList<Todo> todos = calendar()->todos( ); | 1749 | QPtrList<Todo> todos = calendar()->todos( ); |
1749 | Todo *todo; | 1750 | Todo *todo; |
1750 | for(todo = todos.first(); todo; todo = todos.next()) { | 1751 | for(todo = todos.first(); todo; todo = todos.next()) { |
1751 | //insertTodo( todo ); | 1752 | //insertTodo( todo ); |
1752 | if ( todo->hasDueDate() ) { | 1753 | if ( todo->hasDueDate() ) { |
1753 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1754 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1754 | if ( day >= 0 && day < timeSpan + 1) { | 1755 | if ( day >= 0 && day < timeSpan + 1) { |
1755 | (*cells)[day]->insertTodo( todo ); | 1756 | (*cells)[day]->insertTodo( todo ); |
1756 | } | 1757 | } |
1757 | } | 1758 | } |
1758 | } | 1759 | } |
1759 | 1760 | ||
1760 | for( i = 0; i < timeSpan+1; ++i ) { | 1761 | for( i = 0; i < timeSpan+1; ++i ) { |
1761 | (*cells)[i]->finishUpdateCell(); | 1762 | (*cells)[i]->finishUpdateCell(); |
1762 | } | 1763 | } |
1763 | processSelectionChange(); | 1764 | processSelectionChange(); |
1764 | //qApp->processEvents(); | 1765 | //qApp->processEvents(); |
1765 | for( i = 0; i < timeSpan+1; ++i ) { | 1766 | for( i = 0; i < timeSpan+1; ++i ) { |
1766 | //(*cells)[i]->repaintfinishUpdateCell(); | 1767 | //(*cells)[i]->repaintfinishUpdateCell(); |
1767 | QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); | 1768 | QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); |
1768 | } | 1769 | } |
1769 | setKeyBFocus(); | 1770 | setKeyBFocus(); |
1770 | #else | 1771 | #else |
1771 | // old code | 1772 | // old code |
1772 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1773 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1773 | int i; | 1774 | int i; |
1774 | for( i = 0; i < (*cells).count(); ++i ) { | 1775 | for( i = 0; i < (*cells).count(); ++i ) { |
1775 | (*cells)[i]->updateCell(); | 1776 | (*cells)[i]->updateCell(); |
1776 | } | 1777 | } |
1777 | 1778 | ||
1778 | //qDebug("KOMonthView::updateView() "); | 1779 | //qDebug("KOMonthView::updateView() "); |
1779 | processSelectionChange(); | 1780 | processSelectionChange(); |
1780 | // qDebug("---------------------------------------------------------------------+ "); | 1781 | // qDebug("---------------------------------------------------------------------+ "); |
1781 | (*cells)[0]->setFocus(); | 1782 | (*cells)[0]->setFocus(); |
1782 | #endif | 1783 | #endif |
1783 | 1784 | ||
1784 | //qDebug("update time %d ", ti.elapsed()); | 1785 | //qDebug("update time %d ", ti.elapsed()); |
1785 | } | 1786 | } |
1786 | 1787 | ||
1787 | void KOMonthView::setKeyBoardFocus() | 1788 | void KOMonthView::setKeyBoardFocus() |
1788 | { | 1789 | { |
1789 | //qDebug("KOMonthView::setKeyBoardFocus() "); | 1790 | //qDebug("KOMonthView::setKeyBoardFocus() "); |
1790 | bool shootAgain = false; | 1791 | bool shootAgain = false; |
1791 | if ( mShowWeekView ) { | 1792 | if ( mShowWeekView ) { |
1792 | shootAgain = !mWeekLabelsW[1]->hasFocus(); | 1793 | shootAgain = !mWeekLabelsW[1]->hasFocus(); |
1793 | mWeekLabelsW[1]->setFocus(); | 1794 | mWeekLabelsW[1]->setFocus(); |
1794 | } | 1795 | } |
1795 | else { | 1796 | else { |
1796 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); | 1797 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); |
1797 | mWeekLabels[mNumWeeks]->setFocus(); | 1798 | mWeekLabels[mNumWeeks]->setFocus(); |
1798 | } | 1799 | } |
1799 | --mKBFcounter; | 1800 | --mKBFcounter; |
1800 | if ( shootAgain && mKBFcounter > 0 ) { | 1801 | if ( shootAgain && mKBFcounter > 0 ) { |
1801 | QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); | 1802 | QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); |
1802 | } | 1803 | } |
1803 | } | 1804 | } |
1804 | void KOMonthView::setKeyBFocus() | 1805 | void KOMonthView::setKeyBFocus() |
1805 | { | 1806 | { |
1806 | //qDebug("KOMonthView::setKeyBFocus() "); | 1807 | //qDebug("KOMonthView::setKeyBFocus() "); |
1807 | mKBFcounter = 10; | 1808 | mKBFcounter = 10; |
1808 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); | 1809 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); |
1809 | } | 1810 | } |
1810 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1811 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1811 | { | 1812 | { |
1812 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1813 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1813 | if ( isVisible() ) { | 1814 | if ( isVisible() ) { |
1814 | //qDebug("KOMonthView::isVisible "); | 1815 | //qDebug("KOMonthView::isVisible "); |
1815 | slotComputeLayout(); | 1816 | slotComputeLayout(); |
1816 | } else | 1817 | } else |
1817 | mComputeLayoutTimer->start( 100 ); | 1818 | mComputeLayoutTimer->start( 100 ); |
1818 | KOEventView::resizeEvent( e ); | 1819 | if ( e ) |
1820 | KOEventView::resizeEvent( e ); | ||
1819 | } | 1821 | } |
1820 | 1822 | ||
1821 | void KOMonthView::slotComputeLayout() | 1823 | void KOMonthView::slotComputeLayout() |
1822 | { | 1824 | { |
1823 | mComputeLayoutTimer->stop(); | 1825 | mComputeLayoutTimer->stop(); |
1824 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); | 1826 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); |
1825 | computeLayout(); | 1827 | computeLayout(); |
1826 | clPending = true; | 1828 | clPending = true; |
1827 | setKeyBFocus(); | 1829 | setKeyBFocus(); |
1828 | } | 1830 | } |
1829 | void KOMonthView::computeLayoutWeek() | 1831 | |
1832 | void KOMonthView::doComputeLayoutWeek() | ||
1830 | { | 1833 | { |
1831 | static int lastWid = 0; | 1834 | |
1832 | static int lastHei = 0; | ||
1833 | int daysToShow; | 1835 | int daysToShow; |
1834 | bool combinedSatSun = false; | 1836 | bool combinedSatSun = false; |
1835 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1837 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1836 | daysToShow = 6; | 1838 | daysToShow = 6; |
1837 | combinedSatSun = true; | 1839 | combinedSatSun = true; |
1838 | } | 1840 | } |
1839 | int tWid = topLevelWidget()->size().width(); | ||
1840 | int tHei = topLevelWidget()->size().height(); | ||
1841 | |||
1842 | int wid = width();//e | 1841 | int wid = width();//e |
1843 | int hei = height()-1-mNavigatorBar->height(); | 1842 | int hei = height()-1-mNavigatorBar->height(); |
1844 | 1843 | if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { | |
1845 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1846 | return; | ||
1847 | |||
1848 | if ( lastWid == width() && lastHei == height() ) { | ||
1849 | //qDebug("KOListWeekView::No compute layout needed "); | ||
1850 | return; | ||
1851 | } | ||
1852 | lastWid = width(); | ||
1853 | lastHei = height(); | ||
1854 | |||
1855 | |||
1856 | if ( wid < hei ) | ||
1857 | daysToShow = 2; | 1844 | daysToShow = 2; |
1858 | else | 1845 | } else { |
1859 | daysToShow = 3; | 1846 | if ( wid < hei ) |
1847 | daysToShow = 2; | ||
1848 | else | ||
1849 | daysToShow = 3; | ||
1850 | } | ||
1851 | bool landscape = (daysToShow == 3); | ||
1860 | mShowSatSunComp = true; | 1852 | mShowSatSunComp = true; |
1861 | combinedSatSun = true; | 1853 | combinedSatSun = true; |
1862 | 1854 | ||
1863 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1855 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1864 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1856 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1865 | int weeklabelwid = fm.width( "888" ); | 1857 | int weeklabelwid = fm.width( "888" ); |
1866 | wid -= weeklabelwid; | 1858 | wid -= weeklabelwid; |
1867 | 1859 | ||
1868 | int colWid = wid / daysToShow; | 1860 | int colWid = wid / daysToShow; |
1869 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1861 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1870 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1862 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1871 | int colModulo = wid % daysToShow; | 1863 | int colModulo = wid % daysToShow; |
1872 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1864 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1873 | //qDebug("rowmod %d ", rowModulo); | 1865 | //qDebug("rowmod %d ", rowModulo); |
1874 | int i; | 1866 | int i; |
1875 | int x,y,w,h; | 1867 | int x,y,w,h; |
1876 | x= 0; | 1868 | x= 0; |
1877 | y= 0; | 1869 | y= 0; |
1878 | w = colWid; | 1870 | w = colWid; |
1879 | h = dayLabelHei ; | 1871 | h = dayLabelHei ; |
1880 | for ( i = 0; i < 7; i++) { | 1872 | for ( i = 0; i < 7; i++) { |
1881 | if ( i && !( i % daysToShow) && i < 6) { | 1873 | if ( i && !( i % daysToShow) && i < 6) { |
1882 | y += hei/(5-daysToShow); | 1874 | y += hei/(5-daysToShow); |
1883 | x = 0; | 1875 | x = 0; |
1884 | w = colWid; | 1876 | w = colWid; |
1885 | } | 1877 | } |
1886 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1878 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1887 | ++w; | 1879 | ++w; |
1888 | } | 1880 | } |
1881 | int xC,yC,wC,hC; | ||
1889 | if ( i >= 5 ) { | 1882 | if ( i >= 5 ) { |
1890 | int wi = width() - x - weeklabelwid; | 1883 | int wi = width() - x - weeklabelwid; |
1891 | if ( i == 5 ) { | 1884 | if ( i == 5 ) { |
1892 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); | 1885 | xC = x+weeklabelwid; |
1886 | yC = y; | ||
1887 | wC = wi/2+wi%2; | ||
1888 | hC = h; | ||
1893 | } else { | 1889 | } else { |
1894 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); | 1890 | xC = x+weeklabelwid; |
1891 | yC = y; | ||
1892 | wC = wi; | ||
1893 | hC = h; | ||
1895 | } | 1894 | } |
1896 | x = x - w + wi - (wi/2 ); | 1895 | x = x - w + wi - (wi/2 ); |
1897 | } | 1896 | } |
1898 | else { | 1897 | else { |
1899 | int wi = w; | 1898 | int wi = w; |
1900 | if ( !(( i+1) % daysToShow)) { | 1899 | if ( !(( i+1) % daysToShow)) { |
1901 | wi = width() - x - weeklabelwid; | 1900 | wi = width() - x - weeklabelwid; |
1902 | } | 1901 | } |
1903 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); | 1902 | xC = x+weeklabelwid; |
1903 | yC = y; | ||
1904 | wC = wi; | ||
1905 | hC = h; | ||
1904 | } | 1906 | } |
1907 | mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC); | ||
1908 | |||
1909 | |||
1905 | x += w; | 1910 | x += w; |
1906 | } | 1911 | } |
1907 | x= 0; | 1912 | x= 0; |
1908 | y= dayLabelHei; | 1913 | y= dayLabelHei; |
1909 | w = colWid; | 1914 | w = colWid; |
1910 | h = cellHei; | 1915 | h = cellHei; |
1911 | int max = 0; | 1916 | int max = 0; |
1912 | int w_count = mCellsW.count(); | 1917 | int w_count = mCellsW.count(); |
1913 | for ( i = 0; i < w_count; ++i) { | 1918 | for ( i = 0; i < w_count; ++i) { |
1914 | if ( i > 6 ) { | 1919 | if ( i > 6 ) { |
1915 | mCellsW[i]->hide(); | 1920 | mCellsW[i]->hide(); |
1916 | continue; | 1921 | continue; |
1917 | } | 1922 | } |
1918 | 1923 | ||
1919 | w = colWid; | 1924 | w = colWid; |
1920 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1925 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1921 | ++w; | 1926 | ++w; |
1922 | } | 1927 | } |
1923 | if ( i == (daysToShow-1-rowModulo)*7) | 1928 | if ( i == (daysToShow-1-rowModulo)*7) |
1924 | ++h; | 1929 | ++h; |
1925 | 1930 | ||
1931 | int xC,yC,wC,hC; | ||
1926 | if ( i >= 5 ) { | 1932 | if ( i >= 5 ) { |
1927 | if ( i ==5 ) { | 1933 | if ( i ==5 ) { |
1928 | max = h/2; | 1934 | max = h/2; |
1929 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1935 | xC = x+weeklabelwid; |
1936 | yC = y; | ||
1937 | wC = w; | ||
1938 | hC = max; | ||
1930 | x -= w ;y += h/2; | 1939 | x -= w ;y += h/2; |
1931 | } else { | 1940 | } else { |
1932 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1941 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1933 | ++w; | 1942 | ++w; |
1934 | } | 1943 | } |
1935 | max = h-h/2; | 1944 | max = h-h/2; |
1936 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1945 | xC = x+weeklabelwid; |
1946 | yC = y; | ||
1947 | wC = w; | ||
1948 | hC = max; | ||
1937 | y -= h/2; | 1949 | y -= h/2; |
1938 | } | 1950 | } |
1939 | } else { | 1951 | } else { |
1940 | max = h; | 1952 | max = h; |
1941 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1953 | xC = x+weeklabelwid; |
1954 | yC = y; | ||
1955 | wC = w; | ||
1956 | hC = h; | ||
1942 | } | 1957 | } |
1958 | mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC ); | ||
1943 | 1959 | ||
1944 | 1960 | ||
1945 | x += w; | 1961 | x += w; |
1946 | if ( x + w/2 > wid ) { | 1962 | if ( x + w/2 > wid ) { |
1947 | x = 0; | 1963 | x = 0; |
1948 | y += h+dayLabelHei ; | 1964 | y += h+dayLabelHei ; |
1949 | } | 1965 | } |
1950 | //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); | 1966 | //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); |
1951 | } | 1967 | } |
1952 | y= dayLabelHei; | 1968 | y= dayLabelHei; |
1953 | h = cellHei ; | 1969 | h = cellHei ; |
1954 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1970 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1955 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1971 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1956 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1972 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1957 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1973 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1958 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; | 1974 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; |
1959 | updateDayLabels(); | 1975 | updateDayLabels(); |
1960 | //bool forceUpdate = !updatePossible; | 1976 | //bool forceUpdate = !updatePossible; |
1961 | updatePossible = true; | 1977 | updatePossible = true; |
1962 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1978 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1963 | //if ( forceUpdate ) | 1979 | //if ( forceUpdate ) |
1964 | // updateView(); | 1980 | // updateView(); |
1965 | } | 1981 | } |
1982 | void KOMonthView::computeLayoutWeek() | ||
1983 | { | ||
1984 | static int lastWid = 0; | ||
1985 | static int lastHei = 0; | ||
1986 | int tWid = topLevelWidget()->size().width(); | ||
1987 | int tHei = topLevelWidget()->size().height(); | ||
1988 | int wid = width();//e | ||
1989 | int hei = height()-1-mNavigatorBar->height(); | ||
1990 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1991 | return; | ||
1992 | |||
1993 | if ( lastWid == width() && lastHei == height() ) { | ||
1994 | //qDebug("KOListWeekView::No compute layout needed "); | ||
1995 | return; | ||
1996 | } | ||
1997 | lastWid = width(); | ||
1998 | lastHei = height(); | ||
1999 | doComputeLayoutWeek(); | ||
2000 | } | ||
2001 | int KOMonthView::mapWeekLayout( int index, bool landscape ) | ||
2002 | { | ||
2003 | if ( KOPrefs::instance()->mMonthViewWeekRowlayout ) | ||
2004 | return index; | ||
2005 | int diff = 0; | ||
2006 | if ( !landscape ) diff = 1; | ||
2007 | switch( index ) { | ||
2008 | case 0: | ||
2009 | case 5: | ||
2010 | case 6: | ||
2011 | return index; | ||
2012 | break; | ||
2013 | case 1: | ||
2014 | return 2+diff; | ||
2015 | break; | ||
2016 | case 2: | ||
2017 | return 4-(3*diff); | ||
2018 | break; | ||
2019 | case 3: | ||
2020 | return 1+(3*diff); | ||
2021 | break; | ||
2022 | case 4: | ||
2023 | return 3-diff; | ||
2024 | break; | ||
2025 | default: | ||
2026 | qDebug("KO: Error in mapping week layout "); | ||
2027 | return index; | ||
2028 | break; | ||
2029 | } | ||
2030 | return index; | ||
2031 | } | ||
1966 | void KOMonthView::computeLayout() | 2032 | void KOMonthView::computeLayout() |
1967 | { | 2033 | { |
1968 | 2034 | ||
1969 | 2035 | ||
1970 | static int lastWid = 0; | 2036 | static int lastWid = 0; |
1971 | static int lastHei = 0; | 2037 | static int lastHei = 0; |
1972 | 2038 | ||
1973 | if ( mShowWeekView ){ | 2039 | if ( mShowWeekView ){ |
1974 | computeLayoutWeek(); | 2040 | computeLayoutWeek(); |
1975 | return; | 2041 | return; |
1976 | } | 2042 | } |
1977 | int daysToShow = 7; | 2043 | int daysToShow = 7; |
1978 | bool combinedSatSun = false; | 2044 | bool combinedSatSun = false; |
1979 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 2045 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1980 | daysToShow = 6; | 2046 | daysToShow = 6; |
1981 | combinedSatSun = true; | 2047 | combinedSatSun = true; |
1982 | } | 2048 | } |
1983 | int tWid = topLevelWidget()->size().width(); | 2049 | int tWid = topLevelWidget()->size().width(); |
1984 | int tHei = topLevelWidget()->size().height(); | 2050 | int tHei = topLevelWidget()->size().height(); |
1985 | 2051 | ||
1986 | int wid = width();//e | 2052 | int wid = width();//e |
1987 | int hei = height()-1-mNavigatorBar->height(); | 2053 | int hei = height()-1-mNavigatorBar->height(); |
1988 | 2054 | ||
1989 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { | 2055 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { |
1990 | return; | 2056 | return; |
1991 | } | 2057 | } |
1992 | if ( lastWid == width() && lastHei == height() ){ | 2058 | if ( lastWid == width() && lastHei == height() ){ |
1993 | //qDebug("KOMonthview::No compute layout needed "); | 2059 | //qDebug("KOMonthview::No compute layout needed "); |
1994 | return; | 2060 | return; |
1995 | } | 2061 | } |
1996 | 2062 | ||
1997 | lastWid = width(); | 2063 | lastWid = width(); |
1998 | lastHei = height(); | 2064 | lastHei = height(); |
1999 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); | 2065 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); |
2000 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 2066 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
2001 | int weeklabelwid = fm.width( "888" ); | 2067 | int weeklabelwid = fm.width( "888" ); |
2002 | wid -= weeklabelwid; | 2068 | wid -= weeklabelwid; |
2003 | 2069 | ||
2004 | int colWid = wid / daysToShow; | 2070 | int colWid = wid / daysToShow; |
2005 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 2071 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
2006 | int cellHei = (hei - dayLabelHei) /6; | 2072 | int cellHei = (hei - dayLabelHei) /6; |
2007 | int colModulo = wid % daysToShow; | 2073 | int colModulo = wid % daysToShow; |
2008 | int rowModulo = (hei- dayLabelHei) % 6; | 2074 | int rowModulo = (hei- dayLabelHei) % 6; |
2009 | //qDebug("rowmod %d ", rowModulo); | 2075 | //qDebug("rowmod %d ", rowModulo); |
2010 | int i; | 2076 | int i; |
2011 | int x,y,w,h; | 2077 | int x,y,w,h; |
2012 | x= 0; | 2078 | x= 0; |
2013 | y= 0; | 2079 | y= 0; |
2014 | w = colWid; | 2080 | w = colWid; |
2015 | h = dayLabelHei ; | 2081 | h = dayLabelHei ; |
2016 | for ( i = 0; i < 7; i++) { | 2082 | for ( i = 0; i < 7; i++) { |
2017 | if ( i == daysToShow-colModulo ) | 2083 | if ( i == daysToShow-colModulo ) |
2018 | ++w; | 2084 | ++w; |
2019 | if ( combinedSatSun ) { | 2085 | if ( combinedSatSun ) { |
2020 | if ( i >= daysToShow-1 ) { | 2086 | if ( i >= daysToShow-1 ) { |
2021 | 2087 | ||
2022 | if ( i == 6 ) | 2088 | if ( i == 6 ) |
2023 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); | 2089 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); |
2024 | else | 2090 | else |
2025 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 2091 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
2026 | x -= w/2 ; | 2092 | x -= w/2 ; |
2027 | } | 2093 | } |
2028 | else | 2094 | else |
2029 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 2095 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
2030 | } else | 2096 | } else |
2031 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 2097 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
2032 | x += w; | 2098 | x += w; |
2033 | } | 2099 | } |
2034 | x= 0; | 2100 | x= 0; |
2035 | y= dayLabelHei; | 2101 | y= dayLabelHei; |
2036 | w = colWid; | 2102 | w = colWid; |
2037 | h = cellHei ; | 2103 | h = cellHei ; |
2038 | int max = 0; | 2104 | int max = 0; |
2039 | int mc_count = mCells.count(); | 2105 | int mc_count = mCells.count(); |
2040 | for ( i = 0; i < mc_count; ++i) { | 2106 | for ( i = 0; i < mc_count; ++i) { |
2041 | //qDebug("iii %d ", i); | 2107 | //qDebug("iii %d ", i); |
2042 | w = colWid; | 2108 | w = colWid; |
2043 | if ( ((i) % 7) >= 7-colModulo ) { | 2109 | if ( ((i) % 7) >= 7-colModulo ) { |
2044 | ++w; | 2110 | ++w; |
2045 | } | 2111 | } |
2046 | if ( i == (6-rowModulo)*7) | 2112 | if ( i == (6-rowModulo)*7) |
2047 | ++h; | 2113 | ++h; |
2048 | if ( combinedSatSun ) { | 2114 | if ( combinedSatSun ) { |
2049 | if ( (i)%7 >= daysToShow-1 ) { | 2115 | if ( (i)%7 >= daysToShow-1 ) { |
2050 | if ( (i)%7 == daysToShow-1 ) { | 2116 | if ( (i)%7 == daysToShow-1 ) { |
2051 | w = width()-x-weeklabelwid; | 2117 | w = width()-x-weeklabelwid; |
2052 | max = h/2; | 2118 | max = h/2; |
2053 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 2119 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
2054 | x -= w ;y += h/2; | 2120 | x -= w ;y += h/2; |
2055 | } else { | 2121 | } else { |
2056 | w = width()-x-weeklabelwid; | 2122 | w = width()-x-weeklabelwid; |
2057 | max = h-h/2; | 2123 | max = h-h/2; |
2058 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 2124 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
2059 | y -= h/2; | 2125 | y -= h/2; |
2060 | } | 2126 | } |
2061 | } else { | 2127 | } else { |
2062 | max = h; | 2128 | max = h; |
2063 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 2129 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
2064 | } | 2130 | } |
2065 | 2131 | ||
2066 | } | 2132 | } |
2067 | else { | 2133 | else { |
2068 | max = h; | 2134 | max = h; |
2069 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 2135 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
2070 | } | 2136 | } |
2071 | x += w; | 2137 | x += w; |
2072 | if ( x + w/2 > wid ) { | 2138 | if ( x + w/2 > wid ) { |
2073 | x = 0; | 2139 | x = 0; |
2074 | y += h; | 2140 | y += h; |
2075 | } | 2141 | } |
2076 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); | 2142 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); |
2077 | } | 2143 | } |
2078 | y= dayLabelHei; | 2144 | y= dayLabelHei; |
2079 | h = cellHei ; | 2145 | h = cellHei ; |
2080 | for ( i = 0; i < 6; i++) { | 2146 | for ( i = 0; i < 6; i++) { |
2081 | if ( i == (6-rowModulo)) | 2147 | if ( i == (6-rowModulo)) |
2082 | ++h; | 2148 | ++h; |
2083 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 2149 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
2084 | y += h; | 2150 | y += h; |
2085 | } | 2151 | } |
2086 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 2152 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
2087 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 2153 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
2088 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 2154 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
2089 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 2155 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
2090 | updateDayLabels(); | 2156 | updateDayLabels(); |
2091 | //bool forceUpdate = !updatePossible; | 2157 | //bool forceUpdate = !updatePossible; |
2092 | updatePossible = true; | 2158 | updatePossible = true; |
2093 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 2159 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
2094 | } | 2160 | } |
2095 | 2161 | ||
2096 | void KOMonthView::showContextMenu( Incidence *incidence ) | 2162 | void KOMonthView::showContextMenu( Incidence *incidence ) |
2097 | { | 2163 | { |
2098 | if( incidence ) | 2164 | if( incidence ) |
2099 | mContextMenu->showIncidencePopup(incidence); | 2165 | mContextMenu->showIncidencePopup(incidence); |
2100 | else { | 2166 | else { |
2101 | //qDebug("KOMonthView::showContextMenu "); | 2167 | //qDebug("KOMonthView::showContextMenu "); |
2102 | mNewItemMenu->popup(QCursor::pos()); | 2168 | mNewItemMenu->popup(QCursor::pos()); |
2103 | } | 2169 | } |
2104 | /* | 2170 | /* |
2105 | if( incidence && incidence->typeID() == eventID ) { | 2171 | if( incidence && incidence->typeID() == eventID ) { |
2106 | Event *event = static_cast<Event *>(incidence); | 2172 | Event *event = static_cast<Event *>(incidence); |
2107 | mContextMenu->showEventPopup(event); | 2173 | mContextMenu->showEventPopup(event); |
2108 | } else { | 2174 | } else { |
2109 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 2175 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
2110 | } | 2176 | } |
2111 | */ | 2177 | */ |
2112 | } | 2178 | } |
2113 | MonthViewCell * KOMonthView::selectedCell( ) | 2179 | MonthViewCell * KOMonthView::selectedCell( ) |
2114 | { | 2180 | { |
2115 | return mSelectedCell; | 2181 | return mSelectedCell; |
2116 | } | 2182 | } |
2117 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 2183 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
2118 | { | 2184 | { |
2119 | //qDebug("KOMonthView::setSelectedCell %d", cell); | 2185 | //qDebug("KOMonthView::setSelectedCell %d", cell); |
2120 | if ( mSelectedCell && mSelectedCell != cell ) { | 2186 | if ( mSelectedCell && mSelectedCell != cell ) { |
2121 | MonthViewCell * mvc = mSelectedCell; | 2187 | MonthViewCell * mvc = mSelectedCell; |
2122 | mSelectedCell = cell; | 2188 | mSelectedCell = cell; |
2123 | mvc->deselect(); | 2189 | mvc->deselect(); |
2124 | } else | 2190 | } else |
2125 | mSelectedCell = cell; | 2191 | mSelectedCell = cell; |
2126 | // if ( mSelectedCell ) | 2192 | // if ( mSelectedCell ) |
2127 | // mSelectedCell->select(); | 2193 | // mSelectedCell->select(); |
2128 | if ( !mSelectedCell ) | 2194 | if ( !mSelectedCell ) |
2129 | emit incidenceSelected( 0 ); | 2195 | emit incidenceSelected( 0 ); |
2130 | else | 2196 | else |
2131 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 2197 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
2132 | } | 2198 | } |
2133 | 2199 | ||
2134 | void KOMonthView::processSelectionChange() | 2200 | void KOMonthView::processSelectionChange() |
2135 | { | 2201 | { |
2136 | QPtrList<Incidence> incidences = selectedIncidences(); | 2202 | QPtrList<Incidence> incidences = selectedIncidences(); |
2137 | if (incidences.count() > 0) { | 2203 | if (incidences.count() > 0) { |
2138 | emit incidenceSelected( incidences.first() ); | 2204 | emit incidenceSelected( incidences.first() ); |
2139 | } else { | 2205 | } else { |
2140 | emit incidenceSelected( 0 ); | 2206 | emit incidenceSelected( 0 ); |
2141 | clearSelection(); | 2207 | clearSelection(); |
2142 | } | 2208 | } |
2143 | } | 2209 | } |
2144 | 2210 | ||
2145 | void KOMonthView::clearSelection() | 2211 | void KOMonthView::clearSelection() |
2146 | { | 2212 | { |
2147 | if ( mSelectedCell ) { | 2213 | if ( mSelectedCell ) { |
2148 | mSelectedCell->deselect(); | 2214 | mSelectedCell->deselect(); |
2149 | mSelectedCell = 0; | 2215 | mSelectedCell = 0; |
2150 | } | 2216 | } |
2151 | } | 2217 | } |
2152 | 2218 | ||
2153 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) | 2219 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) |
2154 | { | 2220 | { |
2155 | if ( !e->isAutoRepeat() ) { | 2221 | if ( !e->isAutoRepeat() ) { |
2156 | mFlagKeyPressed = false; | 2222 | mFlagKeyPressed = false; |
2157 | } | 2223 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 4d62e9b..61a141a 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -113,236 +113,238 @@ class MonthViewItem: public QListBoxItem | |||
113 | void setMoreInfo(bool on) { mInfo = on; } | 113 | void setMoreInfo(bool on) { mInfo = on; } |
114 | void setMultiDay(int type) { mMultiday = type; } | 114 | void setMultiDay(int type) { mMultiday = type; } |
115 | int multiDay() { return mMultiday; } | 115 | int multiDay() { return mMultiday; } |
116 | void setMultiDayPos(int type) { mdayPos = type; } | 116 | void setMultiDayPos(int type) { mdayPos = type; } |
117 | int gettMultiDayPos() { return mdayPos; } | 117 | int gettMultiDayPos() { return mdayPos; } |
118 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 118 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
119 | bool setHighlighted( Incidence * ); | 119 | bool setHighlighted( Incidence * ); |
120 | 120 | ||
121 | void setPalette(const QPalette &p) { mPalette = p; } | 121 | void setPalette(const QPalette &p) { mPalette = p; } |
122 | QPalette palette() const { return mPalette; } | 122 | QPalette palette() const { return mPalette; } |
123 | bool setHighlightedFalse(); | 123 | bool setHighlightedFalse(); |
124 | Incidence *incidence() const { return mIncidence; } | 124 | Incidence *incidence() const { return mIncidence; } |
125 | 125 | ||
126 | protected: | 126 | protected: |
127 | virtual void paint(QPainter *); | 127 | virtual void paint(QPainter *); |
128 | virtual int height(const QListBox *) const; | 128 | virtual int height(const QListBox *) const; |
129 | virtual int width(const QListBox *) const; | 129 | virtual int width(const QListBox *) const; |
130 | 130 | ||
131 | private: | 131 | private: |
132 | int mdayPos; | 132 | int mdayPos; |
133 | bool isWeekItem; | 133 | bool isWeekItem; |
134 | bool mblockRepaint; | 134 | bool mblockRepaint; |
135 | int mMultiday; | 135 | int mMultiday; |
136 | bool mRecur; | 136 | bool mRecur; |
137 | bool mAlarm; | 137 | bool mAlarm; |
138 | bool mReply; | 138 | bool mReply; |
139 | bool mInfo; | 139 | bool mInfo; |
140 | bool mDisplayHighlighted; | 140 | bool mDisplayHighlighted; |
141 | 141 | ||
142 | QPalette mPalette; | 142 | QPalette mPalette; |
143 | QDate mDate; | 143 | QDate mDate; |
144 | 144 | ||
145 | Incidence *mIncidence; | 145 | Incidence *mIncidence; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | 148 | ||
149 | class KOMonthView; | 149 | class KOMonthView; |
150 | 150 | ||
151 | class MonthViewCell : public KNoScrollListBox | 151 | class MonthViewCell : public KNoScrollListBox |
152 | { | 152 | { |
153 | Q_OBJECT | 153 | Q_OBJECT |
154 | public: | 154 | public: |
155 | MonthViewCell(KOMonthView *,QWidget* ); | 155 | MonthViewCell(KOMonthView *,QWidget* ); |
156 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 156 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |
157 | 157 | ||
158 | void setDate( const QDate & ); | 158 | void setDate( const QDate & ); |
159 | QDate date() const; | 159 | QDate date() const; |
160 | 160 | ||
161 | void setPrimary( bool ); | 161 | void setPrimary( bool ); |
162 | bool isPrimary() const; | 162 | bool isPrimary() const; |
163 | 163 | ||
164 | void setHoliday( bool ); | 164 | void setHoliday( bool ); |
165 | void setHoliday( const QString & ); | 165 | void setHoliday( const QString & ); |
166 | 166 | ||
167 | void updateCell(); | 167 | void updateCell(); |
168 | void startUpdateCell(); | 168 | void startUpdateCell(); |
169 | void finishUpdateCell(); | 169 | void finishUpdateCell(); |
170 | int insertEvent(Event *); | 170 | int insertEvent(Event *); |
171 | void insertTodo(Todo *); | 171 | void insertTodo(Todo *); |
172 | 172 | ||
173 | void updateConfig( bool bigFont = false ); | 173 | void updateConfig( bool bigFont = false ); |
174 | 174 | ||
175 | void enableScrollBars( bool ); | 175 | void enableScrollBars( bool ); |
176 | 176 | ||
177 | Incidence *selectedIncidence(); | 177 | Incidence *selectedIncidence(); |
178 | QDate selectedIncidenceDate(); | 178 | QDate selectedIncidenceDate(); |
179 | QPushButton * dateLabel() { return mLabel; } | 179 | QPushButton * dateLabel() { return mLabel; } |
180 | bool doHighLight( Incidence *); | 180 | bool doHighLight( Incidence *); |
181 | void deselect(); | 181 | void deselect(); |
182 | void select(); | 182 | void select(); |
183 | #ifdef DESKTOP_VERSION | 183 | #ifdef DESKTOP_VERSION |
184 | static QToolTipGroup *toolTipGroup(); | 184 | static QToolTipGroup *toolTipGroup(); |
185 | #endif | 185 | #endif |
186 | signals: | 186 | signals: |
187 | void defaultAction( Incidence * ); | 187 | void defaultAction( Incidence * ); |
188 | void newEventSignal( QDateTime ); | 188 | void newEventSignal( QDateTime ); |
189 | void showDaySignal( QDate ); | 189 | void showDaySignal( QDate ); |
190 | 190 | ||
191 | protected: | 191 | protected: |
192 | QStringList mToolTip; | 192 | QStringList mToolTip; |
193 | void resizeEvent( QResizeEvent * ); | 193 | void resizeEvent( QResizeEvent * ); |
194 | 194 | ||
195 | public slots: | 195 | public slots: |
196 | void showDay(); | 196 | void showDay(); |
197 | void deHighLight(); | 197 | void deHighLight(); |
198 | void repaintfinishUpdateCell(); | 198 | void repaintfinishUpdateCell(); |
199 | protected slots: | 199 | protected slots: |
200 | void defaultAction( QListBoxItem * ); | 200 | void defaultAction( QListBoxItem * ); |
201 | void contextMenu( QListBoxItem * ); | 201 | void contextMenu( QListBoxItem * ); |
202 | void selection( QListBoxItem * ); | 202 | void selection( QListBoxItem * ); |
203 | void cellClicked( QListBoxItem * ); | 203 | void cellClicked( QListBoxItem * ); |
204 | void newEvent(); | 204 | void newEvent(); |
205 | 205 | ||
206 | private: | 206 | private: |
207 | int mdayCount; | 207 | int mdayCount; |
208 | QPtrList <MonthViewItem> mAvailItemList; | 208 | QPtrList <MonthViewItem> mAvailItemList; |
209 | KOMonthView *mMonthView; | 209 | KOMonthView *mMonthView; |
210 | int currentPalette; | 210 | int currentPalette; |
211 | 211 | ||
212 | QDate mDate; | 212 | QDate mDate; |
213 | bool mPrimary; | 213 | bool mPrimary; |
214 | bool mHoliday; | 214 | bool mHoliday; |
215 | QString mHolidayString; | 215 | QString mHolidayString; |
216 | 216 | ||
217 | //QLabel *mLabel; | 217 | //QLabel *mLabel; |
218 | QPushButton *mLabel; | 218 | QPushButton *mLabel; |
219 | //QListBox *mItemList; | 219 | //QListBox *mItemList; |
220 | #ifdef DESKTOP_VERSION | 220 | #ifdef DESKTOP_VERSION |
221 | static QToolTipGroup *mToolTipGroup; | 221 | static QToolTipGroup *mToolTipGroup; |
222 | #endif | 222 | #endif |
223 | QSize mLabelSize; | 223 | QSize mLabelSize; |
224 | QSize mLabelBigSize; | 224 | QSize mLabelBigSize; |
225 | QPalette mHolidayPalette; | 225 | QPalette mHolidayPalette; |
226 | QPalette mStandardPalette; | 226 | QPalette mStandardPalette; |
227 | QPalette mPrimaryPalette; | 227 | QPalette mPrimaryPalette; |
228 | QPalette mNonPrimaryPalette; | 228 | QPalette mNonPrimaryPalette; |
229 | void setMyPalette(); | 229 | void setMyPalette(); |
230 | QPalette getPalette (); | 230 | QPalette getPalette (); |
231 | 231 | ||
232 | }; | 232 | }; |
233 | 233 | ||
234 | 234 | ||
235 | class KOMonthView: public KOEventView | 235 | class KOMonthView: public KOEventView |
236 | { | 236 | { |
237 | Q_OBJECT | 237 | Q_OBJECT |
238 | public: | 238 | public: |
239 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 239 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
240 | ~KOMonthView(); | 240 | ~KOMonthView(); |
241 | 241 | ||
242 | /** Returns maximum number of days supported by the komonthview */ | 242 | /** Returns maximum number of days supported by the komonthview */ |
243 | virtual int maxDatesHint(); | 243 | virtual int maxDatesHint(); |
244 | 244 | ||
245 | /** Returns number of currently shown dates. */ | 245 | /** Returns number of currently shown dates. */ |
246 | virtual int currentDateCount(); | 246 | virtual int currentDateCount(); |
247 | 247 | ||
248 | /** returns the currently selected events */ | 248 | /** returns the currently selected events */ |
249 | virtual QPtrList<Incidence> selectedIncidences(); | 249 | virtual QPtrList<Incidence> selectedIncidences(); |
250 | 250 | ||
251 | /** returns dates of the currently selected events */ | 251 | /** returns dates of the currently selected events */ |
252 | virtual DateList selectedDates(); | 252 | virtual DateList selectedDates(); |
253 | #if 0 | 253 | #if 0 |
254 | virtual void printPreview(CalPrinter *calPrinter, | 254 | virtual void printPreview(CalPrinter *calPrinter, |
255 | const QDate &, const QDate &); | 255 | const QDate &, const QDate &); |
256 | #endif | 256 | #endif |
257 | bool isMonthView() { return !mShowWeekView; } | 257 | bool isMonthView() { return !mShowWeekView; } |
258 | bool isUpdatePossible() { return updatePossible; } | 258 | bool isUpdatePossible() { return updatePossible; } |
259 | 259 | ||
260 | MonthViewCell * selectedCell(); | 260 | MonthViewCell * selectedCell(); |
261 | bool skipResize; | 261 | bool skipResize; |
262 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 262 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
263 | void clearList(); | 263 | void clearList(); |
264 | public slots: | 264 | public slots: |
265 | void incidenceHighlighted( Incidence *, MonthViewCell*, int ); | 265 | void incidenceHighlighted( Incidence *, MonthViewCell*, int ); |
266 | void nextCell(); | 266 | void nextCell(); |
267 | void prevCell(); | 267 | void prevCell(); |
268 | virtual void updateView(); | 268 | virtual void updateView(); |
269 | virtual void updateConfig(); | 269 | virtual void updateConfig(); |
270 | virtual void showDates(const QDate &start, const QDate &end); | 270 | virtual void showDates(const QDate &start, const QDate &end); |
271 | virtual void showEvents(QPtrList<Event> eventList); | 271 | virtual void showEvents(QPtrList<Event> eventList); |
272 | 272 | ||
273 | void changeEventDisplay(Event *, int); | 273 | void changeEventDisplay(Event *, int); |
274 | 274 | ||
275 | void clearSelection(); | 275 | void clearSelection(); |
276 | 276 | ||
277 | void showContextMenu( Incidence * ); | 277 | void showContextMenu( Incidence * ); |
278 | 278 | ||
279 | void setSelectedCell( MonthViewCell * ); | 279 | void setSelectedCell( MonthViewCell * ); |
280 | void setPopupCell( MonthViewCell * ); | 280 | void setPopupCell( MonthViewCell * ); |
281 | void switchView(); | 281 | void switchView(); |
282 | void setKeyBFocus(); | 282 | void setKeyBFocus(); |
283 | 283 | ||
284 | protected slots: | 284 | protected slots: |
285 | void catChanged( Incidence * ); | 285 | void catChanged( Incidence * ); |
286 | void setKeyBoardFocus(); | 286 | void setKeyBoardFocus(); |
287 | void slotNewTodo(); | 287 | void slotNewTodo(); |
288 | void slotNewEvent(); | 288 | void slotNewEvent(); |
289 | void slotEditJournal(); | 289 | void slotEditJournal(); |
290 | void slotComputeLayout(); | 290 | void slotComputeLayout(); |
291 | void selectInternalWeekNum ( int ); | 291 | void selectInternalWeekNum ( int ); |
292 | void processSelectionChange(); | 292 | void processSelectionChange(); |
293 | signals: | 293 | signals: |
294 | void nextMonth(); | 294 | void nextMonth(); |
295 | void prevMonth(); | 295 | void prevMonth(); |
296 | void selectWeekNum ( int ); | 296 | void selectWeekNum ( int ); |
297 | void selectMonth (); | 297 | void selectMonth (); |
298 | void showDaySignal( QDate ); | 298 | void showDaySignal( QDate ); |
299 | void newTodoSignal( QDateTime, bool ); | 299 | void newTodoSignal( QDateTime, bool ); |
300 | void showJournalSignal( int,QDate ); | 300 | void showJournalSignal( int,QDate ); |
301 | protected: | 301 | protected: |
302 | void resizeEvent(QResizeEvent *); | 302 | void resizeEvent(QResizeEvent *); |
303 | void viewChanged(); | 303 | void viewChanged(); |
304 | void updateDayLabels(); | 304 | void updateDayLabels(); |
305 | int mapWeekLayout( int, bool ); | ||
305 | 306 | ||
306 | private: | 307 | private: |
307 | int mKBFcounter; | 308 | int mKBFcounter; |
308 | QTimer* mComputeLayoutTimer; | 309 | QTimer* mComputeLayoutTimer; |
309 | NavigatorBar* mNavigatorBar; | 310 | NavigatorBar* mNavigatorBar; |
310 | int currentWeek(); | 311 | int currentWeek(); |
311 | bool clPending; | 312 | bool clPending; |
312 | QWidgetStack * mWidStack; | 313 | QWidgetStack * mWidStack; |
313 | QWidget* mMonthView; | 314 | QWidget* mMonthView; |
314 | QWidget* mWeekView; | 315 | QWidget* mWeekView; |
315 | bool mShowWeekView; | 316 | bool mShowWeekView; |
316 | bool updatePossible; | 317 | bool updatePossible; |
317 | int mDaysPerWeek; | 318 | int mDaysPerWeek; |
318 | int mNumWeeks; | 319 | int mNumWeeks; |
319 | int mNumCells; | 320 | int mNumCells; |
320 | //bool mWeekStartsMonday; | 321 | //bool mWeekStartsMonday; |
321 | bool mShowSatSunComp; | 322 | bool mShowSatSunComp; |
322 | void computeLayout(); | 323 | void computeLayout(); |
323 | void computeLayoutWeek(); | 324 | void computeLayoutWeek(); |
325 | void doComputeLayoutWeek(); | ||
324 | 326 | ||
325 | QPtrVector<MonthViewCell> mCells; | 327 | QPtrVector<MonthViewCell> mCells; |
326 | QPtrVector<QLabel> mDayLabels; | 328 | QPtrVector<QLabel> mDayLabels; |
327 | QPtrVector<KOWeekButton> mWeekLabels; | 329 | QPtrVector<KOWeekButton> mWeekLabels; |
328 | QPtrVector<MonthViewCell> mCellsW; | 330 | QPtrVector<MonthViewCell> mCellsW; |
329 | QPtrVector<QLabel> mDayLabelsW; | 331 | QPtrVector<QLabel> mDayLabelsW; |
330 | QPtrVector<KOWeekButton> mWeekLabelsW; | 332 | QPtrVector<KOWeekButton> mWeekLabelsW; |
331 | 333 | ||
332 | bool mShortDayLabelsM; | 334 | bool mShortDayLabelsM; |
333 | bool mShortDayLabelsW; | 335 | bool mShortDayLabelsW; |
334 | int mWidthLongDayLabel; | 336 | int mWidthLongDayLabel; |
335 | 337 | ||
336 | QDate mStartDate; | 338 | QDate mStartDate; |
337 | 339 | ||
338 | MonthViewCell *mSelectedCell; | 340 | MonthViewCell *mSelectedCell; |
339 | MonthViewCell *mPopupCell; | 341 | MonthViewCell *mPopupCell; |
340 | bool mFlagKeyPressed; | 342 | bool mFlagKeyPressed; |
341 | KOEventPopupMenu *mContextMenu; | 343 | KOEventPopupMenu *mContextMenu; |
342 | QPopupMenu *mNewItemMenu; | 344 | QPopupMenu *mNewItemMenu; |
343 | void keyPressEvent ( QKeyEvent * ) ; | 345 | void keyPressEvent ( QKeyEvent * ) ; |
344 | void keyReleaseEvent ( QKeyEvent * ) ; | 346 | void keyReleaseEvent ( QKeyEvent * ) ; |
345 | 347 | ||
346 | }; | 348 | }; |
347 | 349 | ||
348 | #endif | 350 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index a63297e..9e7f18c 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -75,384 +75,385 @@ KOPrefs::KOPrefs() : | |||
75 | addItemBool("ShowIconDay6",&mShowIconDay6,true); | 75 | addItemBool("ShowIconDay6",&mShowIconDay6,true); |
76 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 76 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
77 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 77 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
78 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 78 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
79 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 79 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
80 | addItemBool("ShowIconBack",&mShowIconBack,true); | 80 | addItemBool("ShowIconBack",&mShowIconBack,true); |
81 | addItemBool("ShowIconToday",&mShowIconToday,true); | 81 | addItemBool("ShowIconToday",&mShowIconToday,true); |
82 | addItemBool("ShowIconForward",&mShowIconForward,true); | 82 | addItemBool("ShowIconForward",&mShowIconForward,true); |
83 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 83 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
84 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 84 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
85 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); | 85 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); |
86 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 86 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
87 | addItemBool("ShowIconNext",&mShowIconNext,true); | 87 | addItemBool("ShowIconNext",&mShowIconNext,true); |
88 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 88 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
89 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 89 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
90 | addItemBool("ShowIconFilter",&mShowIconFilter,false); | 90 | addItemBool("ShowIconFilter",&mShowIconFilter,false); |
91 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); | 91 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); |
92 | 92 | ||
93 | bool addIcons = false; | 93 | bool addIcons = false; |
94 | #ifdef DESKTOP_VERSION | 94 | #ifdef DESKTOP_VERSION |
95 | addIcons = true; | 95 | addIcons = true; |
96 | #endif | 96 | #endif |
97 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); | 97 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); |
98 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); | 98 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); |
99 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); | 99 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); |
100 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); | 100 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); |
101 | 101 | ||
102 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 102 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
103 | 103 | ||
104 | addItemBool("AskForQuit",&mAskForQuit,false); | 104 | addItemBool("AskForQuit",&mAskForQuit,false); |
105 | 105 | ||
106 | #ifndef DESKTOP_VERSION | 106 | #ifndef DESKTOP_VERSION |
107 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 107 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
108 | #else | 108 | #else |
109 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 109 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
110 | #endif | 110 | #endif |
111 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 111 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
112 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 112 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
113 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); | 113 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); |
114 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); | 114 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); |
115 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); | 115 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); |
116 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); | 116 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); |
117 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); | 117 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); |
118 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); | 118 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); |
119 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 119 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
120 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 120 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
121 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 121 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
122 | 122 | ||
123 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 123 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
124 | addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); | 124 | addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); |
125 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 125 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
126 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 126 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
127 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 127 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
128 | addItemInt("AllDay Size",&mAllDaySize,28); | 128 | addItemInt("AllDay Size",&mAllDaySize,28); |
129 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 129 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
130 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 130 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
131 | 131 | ||
132 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 132 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
133 | addItemStringList("EventSummary User",&mEventSummaryUser); | 133 | addItemStringList("EventSummary User",&mEventSummaryUser); |
134 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 134 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
135 | addItemStringList("JournalSummary User",&mJournalSummaryUser); | 135 | addItemStringList("JournalSummary User",&mJournalSummaryUser); |
136 | 136 | ||
137 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 137 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
138 | addItemBool("Enable Project View",&mEnableProjectView,false); | 138 | addItemBool("Enable Project View",&mEnableProjectView,false); |
139 | addItemBool("Auto Save",&mAutoSave,false); | 139 | addItemBool("Auto Save",&mAutoSave,false); |
140 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 140 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
141 | addItemBool("Confirm Deletes",&mConfirm,true); | 141 | addItemBool("Confirm Deletes",&mConfirm,true); |
142 | addItemString("Archive File",&mArchiveFile); | 142 | addItemString("Archive File",&mArchiveFile); |
143 | addItemString("Html Export File",&mHtmlExportFile, | 143 | addItemString("Html Export File",&mHtmlExportFile, |
144 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 144 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
145 | addItemBool("Html With Save",&mHtmlWithSave,false); | 145 | addItemBool("Html With Save",&mHtmlWithSave,false); |
146 | 146 | ||
147 | KPrefs::setCurrentGroup("Personal Settings"); | 147 | KPrefs::setCurrentGroup("Personal Settings"); |
148 | 148 | ||
149 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 149 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
150 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 150 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
151 | addItemBool("Bcc",&mBcc,false); | 151 | addItemBool("Bcc",&mBcc,false); |
152 | 152 | ||
153 | KPrefs::setCurrentGroup("Time & Date"); | 153 | KPrefs::setCurrentGroup("Time & Date"); |
154 | 154 | ||
155 | 155 | ||
156 | addItemInt("Default Start Time",&mStartTime,10); | 156 | addItemInt("Default Start Time",&mStartTime,10); |
157 | addItemInt("Default Duration",&mDefaultDuration,2); | 157 | addItemInt("Default Duration",&mDefaultDuration,2); |
158 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 158 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
159 | KPrefs::setCurrentGroup("AlarmSettings"); | 159 | KPrefs::setCurrentGroup("AlarmSettings"); |
160 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 160 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
161 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 161 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
162 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 162 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
163 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 163 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
164 | 164 | ||
165 | 165 | ||
166 | KPrefs::setCurrentGroup("Calendar"); | 166 | KPrefs::setCurrentGroup("Calendar"); |
167 | 167 | ||
168 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 168 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
169 | 169 | ||
170 | KPrefs::setCurrentGroup("Fonts"); | 170 | KPrefs::setCurrentGroup("Fonts"); |
171 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 171 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
172 | QFont fon = KGlobalSettings::generalFont(); | 172 | QFont fon = KGlobalSettings::generalFont(); |
173 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); | 173 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); |
174 | addItemFont("MonthView Font",&mMonthViewFont,fon); | 174 | addItemFont("MonthView Font",&mMonthViewFont,fon); |
175 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); | 175 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); |
176 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); | 176 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); |
177 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); | 177 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); |
178 | addItemFont("TodoView Font",&mTodoViewFont,fon); | 178 | addItemFont("TodoView Font",&mTodoViewFont,fon); |
179 | addItemFont("ListView Font",&mListViewFont,fon); | 179 | addItemFont("ListView Font",&mListViewFont,fon); |
180 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); | 180 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); |
181 | addItemFont("EditBox Font",&mEditBoxFont,fon); | 181 | addItemFont("EditBox Font",&mEditBoxFont,fon); |
182 | addItemFont("JournalView Font",&mJornalViewFont,fon); | 182 | addItemFont("JournalView Font",&mJornalViewFont,fon); |
183 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); | 183 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); |
184 | addItemFont("EventView Font",&mEventViewFont,fon); | 184 | addItemFont("EventView Font",&mEventViewFont,fon); |
185 | 185 | ||
186 | KPrefs::setCurrentGroup("RemoteSyncing"); | 186 | KPrefs::setCurrentGroup("RemoteSyncing"); |
187 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 187 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
188 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 188 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
189 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 189 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
190 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 190 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
191 | 191 | ||
192 | #ifdef _WIN32_ | 192 | #ifdef _WIN32_ |
193 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 193 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
194 | #else | 194 | #else |
195 | QString hdp= locateLocal("data","korganizer")+"/"; | 195 | QString hdp= locateLocal("data","korganizer")+"/"; |
196 | #endif | 196 | #endif |
197 | 197 | ||
198 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 198 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
199 | 199 | ||
200 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 200 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
201 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 201 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
202 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 202 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
203 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 203 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
204 | 204 | ||
205 | 205 | ||
206 | KPrefs::setCurrentGroup("Locale"); | 206 | KPrefs::setCurrentGroup("Locale"); |
207 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 207 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
208 | 208 | ||
209 | 209 | ||
210 | KPrefs::setCurrentGroup("Colors"); | 210 | KPrefs::setCurrentGroup("Colors"); |
211 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 211 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
212 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 212 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
213 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 213 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
214 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 214 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
215 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 215 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
216 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 216 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
217 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 217 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
218 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 218 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
219 | addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); | 219 | addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); |
220 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 220 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
221 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 221 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
222 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 222 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
223 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 223 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
224 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 224 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
225 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 225 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
226 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 226 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
227 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 227 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
228 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 228 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
229 | addItemBool("UseAppColors",&mUseAppColors,false); | 229 | addItemBool("UseAppColors",&mUseAppColors,false); |
230 | 230 | ||
231 | 231 | ||
232 | 232 | ||
233 | KPrefs::setCurrentGroup("Views"); | 233 | KPrefs::setCurrentGroup("Views"); |
234 | addItemBool("Block Popup Menu",&mBlockPopupMenu,false); | 234 | addItemBool("Block Popup Menu",&mBlockPopupMenu,false); |
235 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 235 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
236 | addItemInt("Hour Size",&mHourSize,8); | 236 | addItemInt("Hour Size",&mHourSize,8); |
237 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 237 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
238 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 238 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
239 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 239 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
240 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 240 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
241 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 241 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
242 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 242 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
243 | addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); | 243 | addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); |
244 | #ifdef DESKTOP_VERION | 244 | #ifdef DESKTOP_VERION |
245 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 245 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
246 | #else | 246 | #else |
247 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 247 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
248 | #endif | 248 | #endif |
249 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 249 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
250 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 250 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
251 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 251 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
252 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 252 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
253 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 253 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
254 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 254 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
255 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 255 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
256 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 256 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
257 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 257 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
258 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 258 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
259 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 259 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
260 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 260 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
261 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 261 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
262 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 262 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
263 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 263 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
264 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 264 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
265 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 265 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
266 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 266 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
267 | addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,true); | ||
267 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 268 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
268 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 269 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
269 | #ifdef DESKTOP_VERSION | 270 | #ifdef DESKTOP_VERSION |
270 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 271 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
271 | #else | 272 | #else |
272 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 273 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
273 | #endif | 274 | #endif |
274 | addItemInt("Day Begins",&mDayBegins,7); | 275 | addItemInt("Day Begins",&mDayBegins,7); |
275 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 276 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
276 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 277 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
277 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 278 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
278 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 279 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
279 | 280 | ||
280 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 281 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
281 | addItemBool("Full View Month",&mFullViewMonth,true); | 282 | addItemBool("Full View Month",&mFullViewMonth,true); |
282 | addItemBool("Full View Todo",&mFullViewTodo,true); | 283 | addItemBool("Full View Todo",&mFullViewTodo,true); |
283 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 284 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
284 | 285 | ||
285 | addItemInt("Next X Days",&mNextXDays,3); | 286 | addItemInt("Next X Days",&mNextXDays,3); |
286 | 287 | ||
287 | KPrefs::setCurrentGroup("Printer"); | 288 | KPrefs::setCurrentGroup("Printer"); |
288 | 289 | ||
289 | KPrefs::setCurrentGroup("Layout"); | 290 | KPrefs::setCurrentGroup("Layout"); |
290 | 291 | ||
291 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 292 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
292 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 293 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
293 | 294 | ||
294 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 295 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
295 | 296 | ||
296 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 297 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
297 | 298 | ||
298 | KPrefs::setCurrentGroup("Group Scheduling"); | 299 | KPrefs::setCurrentGroup("Group Scheduling"); |
299 | 300 | ||
300 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 301 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
301 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 302 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
302 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 303 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
303 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 304 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
304 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 305 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
305 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 306 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
306 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 307 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
307 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 308 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
308 | 309 | ||
309 | KPrefs::setCurrentGroup( "Editors" ); | 310 | KPrefs::setCurrentGroup( "Editors" ); |
310 | 311 | ||
311 | addItemStringList( "EventTemplates", &mEventTemplates ); | 312 | addItemStringList( "EventTemplates", &mEventTemplates ); |
312 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 313 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
313 | 314 | ||
314 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 315 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
315 | 316 | ||
316 | KPrefs::setCurrentGroup( "ViewOptions" ); | 317 | KPrefs::setCurrentGroup( "ViewOptions" ); |
317 | addItemBool("EVshowDetails",&mEVshowDetails,true); | 318 | addItemBool("EVshowDetails",&mEVshowDetails,true); |
318 | addItemBool("EVshowCreated",&mEVshowCreated,true); | 319 | addItemBool("EVshowCreated",&mEVshowCreated,true); |
319 | addItemBool("EVshowChanged",&mEVshowChanged,true); | 320 | addItemBool("EVshowChanged",&mEVshowChanged,true); |
320 | addItemBool("WTshowDetails",&mWTshowDetails,false); | 321 | addItemBool("WTshowDetails",&mWTshowDetails,false); |
321 | addItemBool("WTshowCreated",&mWTshowCreated,false); | 322 | addItemBool("WTshowCreated",&mWTshowCreated,false); |
322 | addItemBool("WTshowChanged",&mWTshowChanged,false); | 323 | addItemBool("WTshowChanged",&mWTshowChanged,false); |
323 | mCalendars.setAutoDelete( true ); | 324 | mCalendars.setAutoDelete( true ); |
324 | } | 325 | } |
325 | 326 | ||
326 | 327 | ||
327 | KOPrefs::~KOPrefs() | 328 | KOPrefs::~KOPrefs() |
328 | { | 329 | { |
329 | if (mInstance == this) | 330 | if (mInstance == this) |
330 | mInstance = insd.setObject(0); | 331 | mInstance = insd.setObject(0); |
331 | mCalendars.setAutoDelete( true ); | 332 | mCalendars.setAutoDelete( true ); |
332 | mCalendars.clear(); | 333 | mCalendars.clear(); |
333 | //qDebug("KOPrefs::~KOPrefs() "); | 334 | //qDebug("KOPrefs::~KOPrefs() "); |
334 | } | 335 | } |
335 | 336 | ||
336 | 337 | ||
337 | KOPrefs *KOPrefs::instance() | 338 | KOPrefs *KOPrefs::instance() |
338 | { | 339 | { |
339 | if (!mInstance) { | 340 | if (!mInstance) { |
340 | mInstance = insd.setObject(new KOPrefs()); | 341 | mInstance = insd.setObject(new KOPrefs()); |
341 | mInstance->readConfig(); | 342 | mInstance->readConfig(); |
342 | } | 343 | } |
343 | 344 | ||
344 | return mInstance; | 345 | return mInstance; |
345 | } | 346 | } |
346 | 347 | ||
347 | void KOPrefs::usrSetDefaults() | 348 | void KOPrefs::usrSetDefaults() |
348 | { | 349 | { |
349 | 350 | ||
350 | } | 351 | } |
351 | 352 | ||
352 | void KOPrefs::fillMailDefaults() | 353 | void KOPrefs::fillMailDefaults() |
353 | { | 354 | { |
354 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 355 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
355 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 356 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
356 | } | 357 | } |
357 | 358 | ||
358 | void KOPrefs::setTimeZoneIdDefault() | 359 | void KOPrefs::setTimeZoneIdDefault() |
359 | { | 360 | { |
360 | ; | 361 | ; |
361 | } | 362 | } |
362 | 363 | ||
363 | void KOPrefs::setAllDefaults() | 364 | void KOPrefs::setAllDefaults() |
364 | { | 365 | { |
365 | setCategoryDefaults(); | 366 | setCategoryDefaults(); |
366 | mEventSummaryUser = getDefaultList() ; | 367 | mEventSummaryUser = getDefaultList() ; |
367 | mTodoSummaryUser = getDefaultList() ; | 368 | mTodoSummaryUser = getDefaultList() ; |
368 | mJournalSummaryUser = getDefaultList() ; | 369 | mJournalSummaryUser = getDefaultList() ; |
369 | mLocationDefaults = getLocationDefaultList(); | 370 | mLocationDefaults = getLocationDefaultList(); |
370 | } | 371 | } |
371 | 372 | ||
372 | void KOPrefs::setCategoryDefaults() | 373 | void KOPrefs::setCategoryDefaults() |
373 | { | 374 | { |
374 | mCustomCategories.clear(); | 375 | mCustomCategories.clear(); |
375 | mCustomCategories = getDefaultList(); | 376 | mCustomCategories = getDefaultList(); |
376 | 377 | ||
377 | QStringList::Iterator it; | 378 | QStringList::Iterator it; |
378 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 379 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
379 | setCategoryColor(*it,mDefaultCategoryColor); | 380 | setCategoryColor(*it,mDefaultCategoryColor); |
380 | } | 381 | } |
381 | } | 382 | } |
382 | QStringList KOPrefs::getLocationDefaultList() | 383 | QStringList KOPrefs::getLocationDefaultList() |
383 | { | 384 | { |
384 | QStringList retval ; | 385 | QStringList retval ; |
385 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 386 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
386 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 387 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
387 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 388 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
388 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 389 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
389 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 390 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
390 | 391 | ||
391 | retval.sort(); | 392 | retval.sort(); |
392 | return retval; | 393 | return retval; |
393 | } | 394 | } |
394 | QStringList KOPrefs::getDefaultList() | 395 | QStringList KOPrefs::getDefaultList() |
395 | { | 396 | { |
396 | QStringList retval ; | 397 | QStringList retval ; |
397 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") | 398 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") |
398 | << i18n("Break") | 399 | << i18n("Break") |
399 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") | 400 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") |
400 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") | 401 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") |
401 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") | 402 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") |
402 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") | 403 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") |
403 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") | 404 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") |
404 | << i18n("Vacation") ; | 405 | << i18n("Vacation") ; |
405 | retval.sort(); | 406 | retval.sort(); |
406 | //qDebug("cat %s ", retval.join("-").latin1()); | 407 | //qDebug("cat %s ", retval.join("-").latin1()); |
407 | return retval; | 408 | return retval; |
408 | } | 409 | } |
409 | // << 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") | 410 | // << 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") |
410 | void KOPrefs::usrReadConfig() | 411 | void KOPrefs::usrReadConfig() |
411 | { | 412 | { |
412 | config()->setGroup("General"); | 413 | config()->setGroup("General"); |
413 | 414 | ||
414 | //qDebug("KOPrefs::usrReadConfig() "); | 415 | //qDebug("KOPrefs::usrReadConfig() "); |
415 | mCustomCategories = config()->readListEntry("Custom Categories"); | 416 | mCustomCategories = config()->readListEntry("Custom Categories"); |
416 | mOldLoadedLanguage = mOldLanguage ; | 417 | mOldLoadedLanguage = mOldLanguage ; |
417 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 418 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
418 | if (mLocationDefaults.isEmpty()) { | 419 | if (mLocationDefaults.isEmpty()) { |
419 | mLocationDefaults = getLocationDefaultList(); | 420 | mLocationDefaults = getLocationDefaultList(); |
420 | } | 421 | } |
421 | 422 | ||
422 | if (mEventSummaryUser.isEmpty()) { | 423 | if (mEventSummaryUser.isEmpty()) { |
423 | mEventSummaryUser = getDefaultList() ; | 424 | mEventSummaryUser = getDefaultList() ; |
424 | } | 425 | } |
425 | if (mTodoSummaryUser.isEmpty()) { | 426 | if (mTodoSummaryUser.isEmpty()) { |
426 | mTodoSummaryUser = getDefaultList() ; | 427 | mTodoSummaryUser = getDefaultList() ; |
427 | } | 428 | } |
428 | 429 | ||
429 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 430 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
430 | 431 | ||
431 | config()->setGroup("Personal Settings"); | 432 | config()->setGroup("Personal Settings"); |
432 | mName = config()->readEntry("user_name",""); | 433 | mName = config()->readEntry("user_name",""); |
433 | mEmail = config()->readEntry("user_email",""); | 434 | mEmail = config()->readEntry("user_email",""); |
434 | fillMailDefaults(); | 435 | fillMailDefaults(); |
435 | 436 | ||
436 | config()->setGroup("Category Colors"); | 437 | config()->setGroup("Category Colors"); |
437 | QStringList::Iterator it; | 438 | QStringList::Iterator it; |
438 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 439 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
439 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 440 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
440 | 441 | ||
441 | } | 442 | } |
442 | KConfig fc (locateLocal("config","kopicalendarrc")); | 443 | KConfig fc (locateLocal("config","kopicalendarrc")); |
443 | fc.setGroup("CC"); | 444 | fc.setGroup("CC"); |
444 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 445 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
445 | mNextAvailableCalendar = 1; | 446 | mNextAvailableCalendar = 1; |
446 | if ( numCals == 0 ) { | 447 | if ( numCals == 0 ) { |
447 | KopiCalendarFile *kkf = getNewCalendar(); | 448 | KopiCalendarFile *kkf = getNewCalendar(); |
448 | kkf->isStandard = true; | 449 | kkf->isStandard = true; |
449 | kkf->mName = i18n("Standard"); | 450 | kkf->mName = i18n("Standard"); |
450 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 451 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
451 | } | 452 | } |
452 | while ( mNextAvailableCalendar <= numCals ) { | 453 | while ( mNextAvailableCalendar <= numCals ) { |
453 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); | 454 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); |
454 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); | 455 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); |
455 | KopiCalendarFile *kkf = getNewCalendar(); | 456 | KopiCalendarFile *kkf = getNewCalendar(); |
456 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); | 457 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); |
457 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); | 458 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); |
458 | kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); | 459 | kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 392360d..2ff03fa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,363 +1,364 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | 31 | ||
32 | class KConfig; | 32 | class KConfig; |
33 | class QFont; | 33 | class QFont; |
34 | class QColor; | 34 | class QColor; |
35 | class QStringList; | 35 | class QStringList; |
36 | 36 | ||
37 | #define VIEW_WN_VIEW 1 | 37 | #define VIEW_WN_VIEW 1 |
38 | #define VIEW_NX_VIEW 2 | 38 | #define VIEW_NX_VIEW 2 |
39 | #define VIEW_J_VIEW 3 | 39 | #define VIEW_J_VIEW 3 |
40 | #define VIEW_A_VIEW 4 | 40 | #define VIEW_A_VIEW 4 |
41 | #define VIEW_ML_VIEW 5 | 41 | #define VIEW_ML_VIEW 5 |
42 | #define VIEW_M_VIEW 6 | 42 | #define VIEW_M_VIEW 6 |
43 | #define VIEW_L_VIEW 7 | 43 | #define VIEW_L_VIEW 7 |
44 | #define VIEW_T_VIEW 8 | 44 | #define VIEW_T_VIEW 8 |
45 | 45 | ||
46 | class KopiCalendarFile : public QObject | 46 | class KopiCalendarFile : public QObject |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | KopiCalendarFile( ) : QObject( ) | 49 | KopiCalendarFile( ) : QObject( ) |
50 | { | 50 | { |
51 | isStandard = false; | 51 | isStandard = false; |
52 | isEnabled = true; | 52 | isEnabled = true; |
53 | isAlarmEnabled = true; | 53 | isAlarmEnabled = true; |
54 | isReadOnly = false; | 54 | isReadOnly = false; |
55 | mName = "Calendar"; | 55 | mName = "Calendar"; |
56 | mFileName = QDir::homeDirPath() + "/icalfile.ics"; | 56 | mFileName = QDir::homeDirPath() + "/icalfile.ics"; |
57 | mSavedFileName = "icalfile.ics"; | 57 | mSavedFileName = "icalfile.ics"; |
58 | mCalNumber = 0; | 58 | mCalNumber = 0; |
59 | mDefaultColor = Qt::red; | 59 | mDefaultColor = Qt::red; |
60 | mErrorOnLoad = false; | 60 | mErrorOnLoad = false; |
61 | isRelative = false; | 61 | isRelative = false; |
62 | } | 62 | } |
63 | bool isStandard; | 63 | bool isStandard; |
64 | bool isEnabled; | 64 | bool isEnabled; |
65 | bool isAlarmEnabled; | 65 | bool isAlarmEnabled; |
66 | bool isReadOnly; | 66 | bool isReadOnly; |
67 | bool mErrorOnLoad; | 67 | bool mErrorOnLoad; |
68 | QString mName; | 68 | QString mName; |
69 | QString mFileName; | 69 | QString mFileName; |
70 | QString mSavedFileName; | 70 | QString mSavedFileName; |
71 | bool isRelative; | 71 | bool isRelative; |
72 | int mCalNumber; | 72 | int mCalNumber; |
73 | QColor mDefaultColor; | 73 | QColor mDefaultColor; |
74 | QDateTime mLoadDt; | 74 | QDateTime mLoadDt; |
75 | }; | 75 | }; |
76 | class KOPrefs : public KPimPrefs | 76 | class KOPrefs : public KPimPrefs |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | enum { FormatVCalendar, FormatICalendar }; | 79 | enum { FormatVCalendar, FormatICalendar }; |
80 | enum { MailClientKMail, MailClientSendmail }; | 80 | enum { MailClientKMail, MailClientSendmail }; |
81 | enum { IMIPDummy, IMIPKMail }; | 81 | enum { IMIPDummy, IMIPKMail }; |
82 | enum { IMIPOutbox, IMIPdirectsend }; | 82 | enum { IMIPOutbox, IMIPdirectsend }; |
83 | enum { neverAuto, addressbookAuto, selectedAuto }; | 83 | enum { neverAuto, addressbookAuto, selectedAuto }; |
84 | enum { standardDestination, askDestination }; | 84 | enum { standardDestination, askDestination }; |
85 | 85 | ||
86 | virtual ~KOPrefs(); | 86 | virtual ~KOPrefs(); |
87 | 87 | ||
88 | /** Get instance of KOPrefs. It is made sure that there is only one | 88 | /** Get instance of KOPrefs. It is made sure that there is only one |
89 | instance. */ | 89 | instance. */ |
90 | static KOPrefs *instance(); | 90 | static KOPrefs *instance(); |
91 | 91 | ||
92 | /** Set preferences to default values */ | 92 | /** Set preferences to default values */ |
93 | void usrSetDefaults(); | 93 | void usrSetDefaults(); |
94 | 94 | ||
95 | /** Read preferences from config file */ | 95 | /** Read preferences from config file */ |
96 | void usrReadConfig(); | 96 | void usrReadConfig(); |
97 | 97 | ||
98 | /** Write preferences to config file */ | 98 | /** Write preferences to config file */ |
99 | void usrWriteConfig(); | 99 | void usrWriteConfig(); |
100 | void setCategoryDefaults(); | 100 | void setCategoryDefaults(); |
101 | void setAllDefaults(); | 101 | void setAllDefaults(); |
102 | KopiCalendarFile * getNewCalendar(); | 102 | KopiCalendarFile * getNewCalendar(); |
103 | KopiCalendarFile * getCalendar( int ); | 103 | KopiCalendarFile * getCalendar( int ); |
104 | void deleteCalendar( int ); | 104 | void deleteCalendar( int ); |
105 | QColor defaultColor( int ) const; | 105 | QColor defaultColor( int ) const; |
106 | QString calName( int ) const; | 106 | QString calName( int ) const; |
107 | int getCalendarID( const QString & name ); | 107 | int getCalendarID( const QString & name ); |
108 | protected: | 108 | protected: |
109 | void setTimeZoneIdDefault(); | 109 | void setTimeZoneIdDefault(); |
110 | 110 | ||
111 | /** Fill empty mail fields with default values. */ | 111 | /** Fill empty mail fields with default values. */ |
112 | void fillMailDefaults(); | 112 | void fillMailDefaults(); |
113 | 113 | ||
114 | private: | 114 | private: |
115 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 115 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
116 | object. */ | 116 | object. */ |
117 | KOPrefs(); | 117 | KOPrefs(); |
118 | 118 | ||
119 | static KOPrefs *mInstance; | 119 | static KOPrefs *mInstance; |
120 | QStringList getDefaultList(); | 120 | QStringList getDefaultList(); |
121 | QStringList getLocationDefaultList(); | 121 | QStringList getLocationDefaultList(); |
122 | public: | 122 | public: |
123 | // preferences data | 123 | // preferences data |
124 | KConfig* getConfig(); | 124 | KConfig* getConfig(); |
125 | void setFullName(const QString &); | 125 | void setFullName(const QString &); |
126 | QString fullName(); | 126 | QString fullName(); |
127 | void setEmail(const QString &); | 127 | void setEmail(const QString &); |
128 | QString email(); | 128 | QString email(); |
129 | 129 | ||
130 | QString mAdditional; | 130 | QString mAdditional; |
131 | 131 | ||
132 | bool mEmailControlCenter; | 132 | bool mEmailControlCenter; |
133 | 133 | ||
134 | bool mBcc; | 134 | bool mBcc; |
135 | bool mAutoSave; | 135 | bool mAutoSave; |
136 | int mAutoSaveInterval; | 136 | int mAutoSaveInterval; |
137 | bool mConfirm; | 137 | bool mConfirm; |
138 | 138 | ||
139 | bool mEnableGroupScheduling; | 139 | bool mEnableGroupScheduling; |
140 | bool mEnableProjectView; | 140 | bool mEnableProjectView; |
141 | 141 | ||
142 | int mDefaultFormat; | 142 | int mDefaultFormat; |
143 | int mMailClient; | 143 | int mMailClient; |
144 | 144 | ||
145 | int mStartTime; | 145 | int mStartTime; |
146 | int mDefaultDuration; | 146 | int mDefaultDuration; |
147 | int mAlarmTime; | 147 | int mAlarmTime; |
148 | 148 | ||
149 | int mWorkingHoursStart; | 149 | int mWorkingHoursStart; |
150 | int mWorkingHoursEnd; | 150 | int mWorkingHoursEnd; |
151 | bool mExcludeHolidays; | 151 | bool mExcludeHolidays; |
152 | bool mExcludeSaturdays; | 152 | bool mExcludeSaturdays; |
153 | bool mMarcusBainsShowSeconds; | 153 | bool mMarcusBainsShowSeconds; |
154 | 154 | ||
155 | QFont mTimeBarFont; | 155 | QFont mTimeBarFont; |
156 | QFont mMonthViewFont; | 156 | QFont mMonthViewFont; |
157 | QFont mAgendaViewFont; | 157 | QFont mAgendaViewFont; |
158 | QFont mMarcusBainsFont; | 158 | QFont mMarcusBainsFont; |
159 | QFont mTimeLabelsFont; | 159 | QFont mTimeLabelsFont; |
160 | QFont mTodoViewFont; | 160 | QFont mTodoViewFont; |
161 | QFont mListViewFont; | 161 | QFont mListViewFont; |
162 | QFont mDateNavigatorFont; | 162 | QFont mDateNavigatorFont; |
163 | QFont mEditBoxFont; | 163 | QFont mEditBoxFont; |
164 | QFont mJornalViewFont; | 164 | QFont mJornalViewFont; |
165 | QFont mWhatsNextFont; | 165 | QFont mWhatsNextFont; |
166 | QFont mEventViewFont; | 166 | QFont mEventViewFont; |
167 | 167 | ||
168 | 168 | ||
169 | 169 | ||
170 | 170 | ||
171 | QColor mHolidayColor; | 171 | QColor mHolidayColor; |
172 | QColor mHighlightColor; | 172 | QColor mHighlightColor; |
173 | QColor mEventColor; | 173 | QColor mEventColor; |
174 | QColor mTodoDoneColor; | 174 | QColor mTodoDoneColor; |
175 | QColor mAgendaBgColor; | 175 | QColor mAgendaBgColor; |
176 | QColor mWorkingHoursColor; | 176 | QColor mWorkingHoursColor; |
177 | QColor mTodoDueTodayColor; | 177 | QColor mTodoDueTodayColor; |
178 | QColor mTodoOverdueColor; | 178 | QColor mTodoOverdueColor; |
179 | QColor mTodoRunColor; | 179 | QColor mTodoRunColor; |
180 | QColor mMonthViewEvenColor; | 180 | QColor mMonthViewEvenColor; |
181 | QColor mMonthViewOddColor; | 181 | QColor mMonthViewOddColor; |
182 | QColor mMonthViewHolidayColor; | 182 | QColor mMonthViewHolidayColor; |
183 | bool mMonthViewUsesDayColors; | 183 | bool mMonthViewUsesDayColors; |
184 | bool mMonthViewSatSunTog; | 184 | bool mMonthViewSatSunTog; |
185 | bool mMonthViewWeek; | 185 | bool mMonthViewWeek; |
186 | bool mMonthViewWeekRowlayout; | ||
186 | QColor mAppColor1; | 187 | QColor mAppColor1; |
187 | QColor mAppColor2; | 188 | QColor mAppColor2; |
188 | bool mUseAppColors; | 189 | bool mUseAppColors; |
189 | 190 | ||
190 | int mDayBegins; | 191 | int mDayBegins; |
191 | int mHourSize; | 192 | int mHourSize; |
192 | int mAllDaySize; | 193 | int mAllDaySize; |
193 | bool mShowFullMenu; | 194 | bool mShowFullMenu; |
194 | bool mDailyRecur; | 195 | bool mDailyRecur; |
195 | bool mWeeklyRecur; | 196 | bool mWeeklyRecur; |
196 | bool mMonthDailyRecur; | 197 | bool mMonthDailyRecur; |
197 | bool mMonthWeeklyRecur; | 198 | bool mMonthWeeklyRecur; |
198 | bool mMonthShowIcons; | 199 | bool mMonthShowIcons; |
199 | bool mMonthShowTimes; | 200 | bool mMonthShowTimes; |
200 | bool mMonthShowShort; | 201 | bool mMonthShowShort; |
201 | bool mEnableToolTips; | 202 | bool mEnableToolTips; |
202 | bool mEnableMonthScroll; | 203 | bool mEnableMonthScroll; |
203 | bool mFullViewMonth; | 204 | bool mFullViewMonth; |
204 | bool mMonthViewUsesCategoryColor; | 205 | bool mMonthViewUsesCategoryColor; |
205 | bool mFullViewTodo; | 206 | bool mFullViewTodo; |
206 | bool mShowCompletedTodo; | 207 | bool mShowCompletedTodo; |
207 | bool mMarcusBainsEnabled; | 208 | bool mMarcusBainsEnabled; |
208 | int mNextXDays; | 209 | int mNextXDays; |
209 | int mWhatsNextDays; | 210 | int mWhatsNextDays; |
210 | int mWhatsNextPrios; | 211 | int mWhatsNextPrios; |
211 | bool mEnableQuickTodo; | 212 | bool mEnableQuickTodo; |
212 | 213 | ||
213 | bool mCompactDialogs; | 214 | bool mCompactDialogs; |
214 | bool mVerticalScreen; | 215 | bool mVerticalScreen; |
215 | 216 | ||
216 | bool mShowIconNewTodo; | 217 | bool mShowIconNewTodo; |
217 | bool mShowIconNewEvent; | 218 | bool mShowIconNewEvent; |
218 | bool mShowIconSearch; | 219 | bool mShowIconSearch; |
219 | bool mShowIconList; | 220 | bool mShowIconList; |
220 | bool mShowIconDay1; | 221 | bool mShowIconDay1; |
221 | bool mShowIconDay5; | 222 | bool mShowIconDay5; |
222 | bool mShowIconDay6; | 223 | bool mShowIconDay6; |
223 | bool mShowIconDay7; | 224 | bool mShowIconDay7; |
224 | bool mShowIconMonth; | 225 | bool mShowIconMonth; |
225 | bool mShowIconTodoview; | 226 | bool mShowIconTodoview; |
226 | bool mShowIconBackFast; | 227 | bool mShowIconBackFast; |
227 | bool mShowIconBack; | 228 | bool mShowIconBack; |
228 | bool mShowIconToday; | 229 | bool mShowIconToday; |
229 | bool mShowIconForward; | 230 | bool mShowIconForward; |
230 | bool mShowIconForwardFast; | 231 | bool mShowIconForwardFast; |
231 | bool mShowIconWhatsThis; | 232 | bool mShowIconWhatsThis; |
232 | bool mShowIconWeekNum; | 233 | bool mShowIconWeekNum; |
233 | bool mShowIconNextDays; | 234 | bool mShowIconNextDays; |
234 | bool mShowIconNext; | 235 | bool mShowIconNext; |
235 | bool mShowIconJournal; | 236 | bool mShowIconJournal; |
236 | bool mShowIconFilter; | 237 | bool mShowIconFilter; |
237 | bool mShowIconOnetoolbar; | 238 | bool mShowIconOnetoolbar; |
238 | bool mShowIconNavigator; | 239 | bool mShowIconNavigator; |
239 | bool mShowIconAllday; | 240 | bool mShowIconAllday; |
240 | bool mShowIconFilterview; | 241 | bool mShowIconFilterview; |
241 | bool mShowIconToggleFull; | 242 | bool mShowIconToggleFull; |
242 | 243 | ||
243 | bool mShowIconStretch; | 244 | bool mShowIconStretch; |
244 | 245 | ||
245 | bool mToolBarHor; | 246 | bool mToolBarHor; |
246 | bool mToolBarUp; | 247 | bool mToolBarUp; |
247 | bool mToolBarHorV; | 248 | bool mToolBarHorV; |
248 | bool mToolBarUpV; | 249 | bool mToolBarUpV; |
249 | bool mToolBarHorN; | 250 | bool mToolBarHorN; |
250 | bool mToolBarUpN; | 251 | bool mToolBarUpN; |
251 | bool mToolBarHorF; | 252 | bool mToolBarHorF; |
252 | bool mToolBarUpF; | 253 | bool mToolBarUpF; |
253 | bool mToolBarMiniIcons; | 254 | bool mToolBarMiniIcons; |
254 | 255 | ||
255 | bool mAskForQuit; | 256 | bool mAskForQuit; |
256 | bool mUsePassWd; | 257 | bool mUsePassWd; |
257 | bool mShowSyncEvents; | 258 | bool mShowSyncEvents; |
258 | bool mShowTodoInAgenda; | 259 | bool mShowTodoInAgenda; |
259 | bool mShowCompletedTodoInAgenda; | 260 | bool mShowCompletedTodoInAgenda; |
260 | bool mShowTimeInAgenda; | 261 | bool mShowTimeInAgenda; |
261 | bool mHideNonStartedTodos; | 262 | bool mHideNonStartedTodos; |
262 | 263 | ||
263 | bool mBlockPopupMenu; | 264 | bool mBlockPopupMenu; |
264 | 265 | ||
265 | int mLastSyncTime; | 266 | int mLastSyncTime; |
266 | void setCategoryColor(QString cat,const QColor & color); | 267 | void setCategoryColor(QString cat,const QColor & color); |
267 | QColor *categoryColor(QString cat); | 268 | QColor *categoryColor(QString cat); |
268 | 269 | ||
269 | QString mArchiveFile; | 270 | QString mArchiveFile; |
270 | QString mHtmlExportFile; | 271 | QString mHtmlExportFile; |
271 | bool mHtmlWithSave; | 272 | bool mHtmlWithSave; |
272 | 273 | ||
273 | QStringList mSelectedPlugins; | 274 | QStringList mSelectedPlugins; |
274 | 275 | ||
275 | QString mLastImportFile; | 276 | QString mLastImportFile; |
276 | QString mLastVcalFile; | 277 | QString mLastVcalFile; |
277 | QString mLastSaveFile; | 278 | QString mLastSaveFile; |
278 | QString mLastLoadFile; | 279 | QString mLastLoadFile; |
279 | 280 | ||
280 | 281 | ||
281 | QString mDefaultAlarmFile; | 282 | QString mDefaultAlarmFile; |
282 | int mIMIPScheduler; | 283 | int mIMIPScheduler; |
283 | int mIMIPSend; | 284 | int mIMIPSend; |
284 | QStringList mAdditionalMails; | 285 | QStringList mAdditionalMails; |
285 | int mIMIPAutoRefresh; | 286 | int mIMIPAutoRefresh; |
286 | int mIMIPAutoInsertReply; | 287 | int mIMIPAutoInsertReply; |
287 | int mIMIPAutoInsertRequest; | 288 | int mIMIPAutoInsertRequest; |
288 | int mIMIPAutoFreeBusy; | 289 | int mIMIPAutoFreeBusy; |
289 | int mIMIPAutoFreeBusyReply; | 290 | int mIMIPAutoFreeBusyReply; |
290 | 291 | ||
291 | QStringList mTodoTemplates; | 292 | QStringList mTodoTemplates; |
292 | QStringList mEventTemplates; | 293 | QStringList mEventTemplates; |
293 | 294 | ||
294 | int mDestination; | 295 | int mDestination; |
295 | 296 | ||
296 | 297 | ||
297 | bool mEditOnDoubleClick; | 298 | bool mEditOnDoubleClick; |
298 | bool mViewChangeHoldFullscreen; | 299 | bool mViewChangeHoldFullscreen; |
299 | bool mViewChangeHoldNonFullscreen; | 300 | bool mViewChangeHoldNonFullscreen; |
300 | bool mCenterOnCurrentTime; | 301 | bool mCenterOnCurrentTime; |
301 | bool mSetTimeToDayStartAt; | 302 | bool mSetTimeToDayStartAt; |
302 | bool mHighlightCurrentDay; | 303 | bool mHighlightCurrentDay; |
303 | bool mUseHighlightLightColor; | 304 | bool mUseHighlightLightColor; |
304 | bool mListViewMonthTimespan; | 305 | bool mListViewMonthTimespan; |
305 | bool mWNViewShowsParents; | 306 | bool mWNViewShowsParents; |
306 | bool mWNViewShowsPast; | 307 | bool mWNViewShowsPast; |
307 | bool mWNViewShowLocation; | 308 | bool mWNViewShowLocation; |
308 | bool mTodoViewShowsPercentage; | 309 | bool mTodoViewShowsPercentage; |
309 | bool mTodoViewUsesCatColors; | 310 | bool mTodoViewUsesCatColors; |
310 | bool mMonthViewUsesBigFont; | 311 | bool mMonthViewUsesBigFont; |
311 | bool mTodoViewUsesSmallFont; | 312 | bool mTodoViewUsesSmallFont; |
312 | bool mTodoViewUsesForegroundColor; | 313 | bool mTodoViewUsesForegroundColor; |
313 | bool mMonthViewUsesForegroundColor; | 314 | bool mMonthViewUsesForegroundColor; |
314 | 315 | ||
315 | bool mHightlightDateTimeEdit; | 316 | bool mHightlightDateTimeEdit; |
316 | bool mShortDateInViewer; | 317 | bool mShortDateInViewer; |
317 | 318 | ||
318 | bool mShowDateNavigator; | 319 | bool mShowDateNavigator; |
319 | 320 | ||
320 | QStringList mLocationDefaults; | 321 | QStringList mLocationDefaults; |
321 | QStringList mEventSummaryUser; | 322 | QStringList mEventSummaryUser; |
322 | QStringList mTodoSummaryUser; | 323 | QStringList mTodoSummaryUser; |
323 | QStringList mJournalSummaryUser; | 324 | QStringList mJournalSummaryUser; |
324 | 325 | ||
325 | bool mUseInternalAlarmNotification; | 326 | bool mUseInternalAlarmNotification; |
326 | int mAlarmPlayBeeps; | 327 | int mAlarmPlayBeeps; |
327 | int mAlarmSuspendTime; | 328 | int mAlarmSuspendTime; |
328 | int mAlarmSuspendCount; | 329 | int mAlarmSuspendCount; |
329 | int mAlarmBeepInterval; | 330 | int mAlarmBeepInterval; |
330 | int mOldLanguage; | 331 | int mOldLanguage; |
331 | int mOldLoadedLanguage; | 332 | int mOldLoadedLanguage; |
332 | 333 | ||
333 | 334 | ||
334 | QString mActiveSyncPort; | 335 | QString mActiveSyncPort; |
335 | QString mActiveSyncIP; | 336 | QString mActiveSyncIP; |
336 | 337 | ||
337 | // settings for eventviewer | 338 | // settings for eventviewer |
338 | bool mEVshowDetails; | 339 | bool mEVshowDetails; |
339 | bool mEVshowCreated; | 340 | bool mEVshowCreated; |
340 | bool mEVshowChanged; | 341 | bool mEVshowChanged; |
341 | bool mWTshowDetails; | 342 | bool mWTshowDetails; |
342 | bool mWTshowCreated; | 343 | bool mWTshowCreated; |
343 | bool mWTshowChanged; | 344 | bool mWTshowChanged; |
344 | 345 | ||
345 | int mCurrentDisplayedView; | 346 | int mCurrentDisplayedView; |
346 | QPtrList<KopiCalendarFile> mCalendars; | 347 | QPtrList<KopiCalendarFile> mCalendars; |
347 | int mNextAvailableCalendar; | 348 | int mNextAvailableCalendar; |
348 | bool mGlobalUpdateDisabled; | 349 | bool mGlobalUpdateDisabled; |
349 | 350 | ||
350 | private: | 351 | private: |
351 | QDict<QColor> mCategoryColors; | 352 | QDict<QColor> mCategoryColors; |
352 | QArray<KopiCalendarFile*> mDefCalColors; | 353 | QArray<KopiCalendarFile*> mDefCalColors; |
353 | QColor mDefaultCategoryColor; | 354 | QColor mDefaultCategoryColor; |
354 | 355 | ||
355 | QFont mDefaultTimeBarFont; | 356 | QFont mDefaultTimeBarFont; |
356 | QFont mDefaultViewFont; | 357 | QFont mDefaultViewFont; |
357 | QFont mDefaultMonthViewFont; | 358 | QFont mDefaultMonthViewFont; |
358 | 359 | ||
359 | QString mName; | 360 | QString mName; |
360 | QString mEmail; | 361 | QString mEmail; |
361 | }; | 362 | }; |
362 | 363 | ||
363 | #endif | 364 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index ebcff33..05bd73f 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -514,384 +514,388 @@ void KOPrefsDialog::setupViewsTab() | |||
514 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 514 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
515 | 515 | ||
516 | 516 | ||
517 | 517 | ||
518 | 518 | ||
519 | 519 | ||
520 | 520 | ||
521 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 521 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
522 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 522 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
523 | //topLayout->setRowStretch(11,1); | 523 | //topLayout->setRowStretch(11,1); |
524 | 524 | ||
525 | 525 | ||
526 | 526 | ||
527 | 527 | ||
528 | #if 0 | 528 | #if 0 |
529 | 529 | ||
530 | topFrame = addPage(i18n("ViewChange"),0,0); | 530 | topFrame = addPage(i18n("ViewChange"),0,0); |
531 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 531 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
532 | 532 | ||
533 | topLayout = new QGridLayout(topFrame,6,1); | 533 | topLayout = new QGridLayout(topFrame,6,1); |
534 | topLayout->setSpacing(mSpacingHint); | 534 | topLayout->setSpacing(mSpacingHint); |
535 | topLayout->setMargin(mMarginHint); | 535 | topLayout->setMargin(mMarginHint); |
536 | ii = 0; | 536 | ii = 0; |
537 | 537 | ||
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | dummy = | 540 | dummy = |
541 | addWidBool(i18n("Hold fullscreen on view change"), | 541 | addWidBool(i18n("Hold fullscreen on view change"), |
542 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 542 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
543 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 543 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
544 | 544 | ||
545 | dummy = | 545 | dummy = |
546 | addWidBool(i18n("Hold non-fullscreen on view change"), | 546 | addWidBool(i18n("Hold non-fullscreen on view change"), |
547 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 547 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
548 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 548 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
549 | 549 | ||
550 | 550 | ||
551 | 551 | ||
552 | KPrefsDialogWidBool *fullViewMonth = | 552 | KPrefsDialogWidBool *fullViewMonth = |
553 | addWidBool(i18n("Next days view uses full window"), | 553 | addWidBool(i18n("Next days view uses full window"), |
554 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 554 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
555 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 555 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
556 | 556 | ||
557 | 557 | ||
558 | KPrefsDialogWidBool *fullViewTodo = | 558 | KPrefsDialogWidBool *fullViewTodo = |
559 | addWidBool(i18n("Event list view uses full window"), | 559 | addWidBool(i18n("Event list view uses full window"), |
560 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 560 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
561 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 561 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
562 | dummy = | 562 | dummy = |
563 | addWidBool(i18n("Listview uses monthly timespan"), | 563 | addWidBool(i18n("Listview uses monthly timespan"), |
564 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 564 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
565 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 565 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
566 | dummy = | 566 | dummy = |
567 | addWidBool(i18n("Highlight selection in Time Edit"), | 567 | addWidBool(i18n("Highlight selection in Time Edit"), |
568 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 568 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
569 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 569 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
570 | 570 | ||
571 | KPrefsDialogWidBool *dailyRecur = | 571 | KPrefsDialogWidBool *dailyRecur = |
572 | addWidBool(i18n("Show events that recur daily in date nav."), | 572 | addWidBool(i18n("Show events that recur daily in date nav."), |
573 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 573 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
574 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 574 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
575 | 575 | ||
576 | KPrefsDialogWidBool *weeklyRecur = | 576 | KPrefsDialogWidBool *weeklyRecur = |
577 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 577 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
578 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 578 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
579 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 579 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
580 | 580 | ||
581 | #ifdef DESKTOP_VERSION | 581 | #ifdef DESKTOP_VERSION |
582 | KPrefsDialogWidBool *enableToolTips = | 582 | KPrefsDialogWidBool *enableToolTips = |
583 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 583 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
584 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 584 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
585 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 585 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
586 | #endif | 586 | #endif |
587 | // ********************************************************* | 587 | // ********************************************************* |
588 | 588 | ||
589 | topFrame = addPage(i18n("Agenda View"),0,0); | 589 | topFrame = addPage(i18n("Agenda View"),0,0); |
590 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 590 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
591 | 591 | ||
592 | topLayout = new QGridLayout(topFrame,5,1); | 592 | topLayout = new QGridLayout(topFrame,5,1); |
593 | topLayout->setSpacing(mSpacingHint); | 593 | topLayout->setSpacing(mSpacingHint); |
594 | topLayout->setMargin(mMarginHint); | 594 | topLayout->setMargin(mMarginHint); |
595 | ii = 0; | 595 | ii = 0; |
596 | 596 | ||
597 | 597 | ||
598 | dummy = | 598 | dummy = |
599 | addWidBool(i18n("Show time in agenda items"), | 599 | addWidBool(i18n("Show time in agenda items"), |
600 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 600 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
601 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 601 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
602 | 602 | ||
603 | dummy = | 603 | dummy = |
604 | addWidBool(i18n("Highlight current day in agenda"), | 604 | addWidBool(i18n("Highlight current day in agenda"), |
605 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 605 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
606 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 606 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
607 | 607 | ||
608 | dummy = | 608 | dummy = |
609 | addWidBool(i18n("Use light color for highlight current day"), | 609 | addWidBool(i18n("Use light color for highlight current day"), |
610 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 610 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
611 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 611 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
612 | 612 | ||
613 | 613 | ||
614 | KPrefsDialogWidBool *marcusBainsEnabled = | 614 | KPrefsDialogWidBool *marcusBainsEnabled = |
615 | addWidBool(i18n("Show current time"), | 615 | addWidBool(i18n("Show current time"), |
616 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 616 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
617 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 617 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
618 | 618 | ||
619 | 619 | ||
620 | dummy = | 620 | dummy = |
621 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 621 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
622 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 622 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
623 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 623 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
624 | 624 | ||
625 | dummy = | 625 | dummy = |
626 | addWidBool(i18n("Set agenda to current time on change"), | 626 | addWidBool(i18n("Set agenda to current time on change"), |
627 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 627 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
628 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 628 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
629 | 629 | ||
630 | 630 | ||
631 | dummy = | 631 | dummy = |
632 | addWidBool(i18n("Allday Agenda view shows todos"), | 632 | addWidBool(i18n("Allday Agenda view shows todos"), |
633 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 633 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
634 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 634 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
635 | 635 | ||
636 | 636 | ||
637 | 637 | ||
638 | dummy = | 638 | dummy = |
639 | addWidBool(i18n("Agenda view shows completed todos"), | 639 | addWidBool(i18n("Agenda view shows completed todos"), |
640 | &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame); | 640 | &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame); |
641 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 641 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
642 | 642 | ||
643 | 643 | ||
644 | 644 | ||
645 | 645 | ||
646 | 646 | ||
647 | topFrame = addPage(i18n("Month View"),0,0); | 647 | topFrame = addPage(i18n("Month View"),0,0); |
648 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 648 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
649 | 649 | ||
650 | topLayout = new QGridLayout(topFrame,5,1); | 650 | topLayout = new QGridLayout(topFrame,5,1); |
651 | topLayout->setSpacing(mSpacingHint); | 651 | topLayout->setSpacing(mSpacingHint); |
652 | topLayout->setMargin(mMarginHint); | 652 | topLayout->setMargin(mMarginHint); |
653 | ii = 0; | 653 | ii = 0; |
654 | QLabel *lab; | 654 | QLabel *lab; |
655 | QHBox *habo = new QHBox( topFrame ); | 655 | QHBox *habo = new QHBox( topFrame ); |
656 | if ( QApplication::desktop()->width() <= 480 ) { | 656 | if ( QApplication::desktop()->width() <= 480 ) { |
657 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 657 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
658 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 658 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
659 | ii++; | 659 | ii++; |
660 | } else { | 660 | } else { |
661 | new QLabel ( i18n("Show events that recur "), habo ); | 661 | new QLabel ( i18n("Show events that recur "), habo ); |
662 | } | 662 | } |
663 | dailyRecur = | 663 | dailyRecur = |
664 | addWidBool(i18n("daily"), | 664 | addWidBool(i18n("daily"), |
665 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 665 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
666 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 666 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
667 | 667 | ||
668 | weeklyRecur = | 668 | weeklyRecur = |
669 | addWidBool(i18n("weekly"), | 669 | addWidBool(i18n("weekly"), |
670 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 670 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
671 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 671 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
672 | ii++; | 672 | ii++; |
673 | 673 | ||
674 | 674 | ||
675 | habo = new QHBox( topFrame ); | 675 | habo = new QHBox( topFrame ); |
676 | if ( QApplication::desktop()->width() <= 480 ) { | 676 | if ( QApplication::desktop()->width() <= 480 ) { |
677 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 677 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
678 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 678 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
679 | ii++; | 679 | ii++; |
680 | 680 | ||
681 | } else { | 681 | } else { |
682 | new QLabel ( i18n("Show in every cell "), habo ); | 682 | new QLabel ( i18n("Show in every cell "), habo ); |
683 | } | 683 | } |
684 | weeklyRecur = | 684 | weeklyRecur = |
685 | addWidBool(i18n("short month"), | 685 | addWidBool(i18n("short month"), |
686 | &(KOPrefs::instance()->mMonthShowShort),habo); | 686 | &(KOPrefs::instance()->mMonthShowShort),habo); |
687 | weeklyRecur = | 687 | weeklyRecur = |
688 | addWidBool(i18n("icons"), | 688 | addWidBool(i18n("icons"), |
689 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 689 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
690 | weeklyRecur = | 690 | weeklyRecur = |
691 | addWidBool(i18n("times"), | 691 | addWidBool(i18n("times"), |
692 | &(KOPrefs::instance()->mMonthShowTimes),habo); | 692 | &(KOPrefs::instance()->mMonthShowTimes),habo); |
693 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 693 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
694 | ii++; | 694 | ii++; |
695 | #ifdef DESKTOP_VERSION | 695 | #ifdef DESKTOP_VERSION |
696 | KPrefsDialogWidBool *enableMonthScroll = | 696 | KPrefsDialogWidBool *enableMonthScroll = |
697 | addWidBool(i18n("Enable scrollbars in month view cells"), | 697 | addWidBool(i18n("Enable scrollbars in month view cells"), |
698 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 698 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
699 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 699 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
700 | #endif | 700 | #endif |
701 | dummy = | 701 | dummy = |
702 | addWidBool(i18n("Week view mode uses bigger font"), | 702 | addWidBool(i18n("Week view mode uses bigger font"), |
703 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 703 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
704 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 704 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
705 | dummy = | 705 | dummy = |
706 | addWidBool(i18n("Week view mode uses row layout"), | ||
707 | &(KOPrefs::instance()->mMonthViewWeekRowlayout),topFrame); | ||
708 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
709 | dummy = | ||
706 | addWidBool(i18n("Show Sat/Sun together"), | 710 | addWidBool(i18n("Show Sat/Sun together"), |
707 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 711 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
708 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 712 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
709 | 713 | ||
710 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 714 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
711 | addWidBool(i18n("Month view uses category colors"), | 715 | addWidBool(i18n("Month view uses category colors"), |
712 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 716 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
713 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 717 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
714 | 718 | ||
715 | dummy = | 719 | dummy = |
716 | addWidBool(i18n("Category colors are applied to text"), | 720 | addWidBool(i18n("Category colors are applied to text"), |
717 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 721 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
718 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 722 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
719 | 723 | ||
720 | 724 | ||
721 | 725 | ||
722 | if ( QApplication::desktop()->height() <= 240 ) { | 726 | if ( QApplication::desktop()->height() <= 240 ) { |
723 | topFrame = addPage(i18n("Month View") +" 2",0,0); | 727 | topFrame = addPage(i18n("Month View") +" 2",0,0); |
724 | topLayout = new QGridLayout(topFrame,4,1); | 728 | topLayout = new QGridLayout(topFrame,4,1); |
725 | topLayout->setSpacing(2); | 729 | topLayout->setSpacing(2); |
726 | topLayout->setMargin(1); | 730 | topLayout->setMargin(1); |
727 | ii = 0; | 731 | ii = 0; |
728 | } | 732 | } |
729 | 733 | ||
730 | 734 | ||
731 | coloredCategoriesInMonthView = | 735 | coloredCategoriesInMonthView = |
732 | addWidBool(i18n("Month view uses day colors"), | 736 | addWidBool(i18n("Month view uses day colors"), |
733 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 737 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
734 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 738 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
735 | 739 | ||
736 | KPrefsDialogWidColor *holidayColor = | 740 | KPrefsDialogWidColor *holidayColor = |
737 | addWidColor(i18n("Day color odd months"), | 741 | addWidColor(i18n("Day color odd months"), |
738 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 742 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
739 | topLayout->addWidget(holidayColor->label(),ii,0); | 743 | topLayout->addWidget(holidayColor->label(),ii,0); |
740 | topLayout->addWidget(holidayColor->button(),ii++,1); | 744 | topLayout->addWidget(holidayColor->button(),ii++,1); |
741 | 745 | ||
742 | holidayColor = | 746 | holidayColor = |
743 | addWidColor(i18n("Day color even months"), | 747 | addWidColor(i18n("Day color even months"), |
744 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 748 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
745 | topLayout->addWidget(holidayColor->label(),ii,0); | 749 | topLayout->addWidget(holidayColor->label(),ii,0); |
746 | topLayout->addWidget(holidayColor->button(),ii++,1); | 750 | topLayout->addWidget(holidayColor->button(),ii++,1); |
747 | 751 | ||
748 | 752 | ||
749 | holidayColor = | 753 | holidayColor = |
750 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 754 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
751 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 755 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
752 | topLayout->addWidget(holidayColor->label(),ii,0); | 756 | topLayout->addWidget(holidayColor->label(),ii,0); |
753 | topLayout->addWidget(holidayColor->button(),ii++,1); | 757 | topLayout->addWidget(holidayColor->button(),ii++,1); |
754 | // *********************** What'sNext View | 758 | // *********************** What'sNext View |
755 | topFrame = addPage(i18n("What's Next View"),0,0); | 759 | topFrame = addPage(i18n("What's Next View"),0,0); |
756 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 760 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
757 | 761 | ||
758 | topLayout = new QGridLayout(topFrame,4,1); | 762 | topLayout = new QGridLayout(topFrame,4,1); |
759 | topLayout->setSpacing(mSpacingHint); | 763 | topLayout->setSpacing(mSpacingHint); |
760 | topLayout->setMargin(mMarginHint); | 764 | topLayout->setMargin(mMarginHint); |
761 | ii = 0; | 765 | ii = 0; |
762 | 766 | ||
763 | 767 | ||
764 | QHBox* hdummy = new QHBox(topFrame); | 768 | QHBox* hdummy = new QHBox(topFrame); |
765 | new QLabel(i18n("Days in What's Next:"),hdummy); | 769 | new QLabel(i18n("Days in What's Next:"),hdummy); |
766 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 770 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
767 | 771 | ||
768 | topLayout->addWidget(hdummy,ii++,0); | 772 | topLayout->addWidget(hdummy,ii++,0); |
769 | 773 | ||
770 | QHBox *prioBox = new QHBox(topFrame); | 774 | QHBox *prioBox = new QHBox(topFrame); |
771 | // intervalBox->setSpacing(mSpacingHint); | 775 | // intervalBox->setSpacing(mSpacingHint); |
772 | topLayout->addWidget(prioBox,ii++,0); | 776 | topLayout->addWidget(prioBox,ii++,0); |
773 | 777 | ||
774 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); | 778 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); |
775 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 779 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
776 | if ( QApplication::desktop()->width() < 300 ) | 780 | if ( QApplication::desktop()->width() < 300 ) |
777 | mPrioSpin->setFixedWidth( 40 ); | 781 | mPrioSpin->setFixedWidth( 40 ); |
778 | 782 | ||
779 | KPrefsDialogWidBool *passwdk = | 783 | KPrefsDialogWidBool *passwdk = |
780 | 784 | ||
781 | addWidBool(i18n("Show events that are done"), | 785 | addWidBool(i18n("Show events that are done"), |
782 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 786 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
783 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 787 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
784 | passwdk = | 788 | passwdk = |
785 | addWidBool(i18n("Show parent To-Do's"), | 789 | addWidBool(i18n("Show parent To-Do's"), |
786 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 790 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
787 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 791 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
788 | 792 | ||
789 | passwdk = | 793 | passwdk = |
790 | addWidBool(i18n("Show location"), | 794 | addWidBool(i18n("Show location"), |
791 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 795 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
792 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 796 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
793 | 797 | ||
794 | 798 | ||
795 | passwdk = | 799 | passwdk = |
796 | addWidBool(i18n("Use short date in WN+Event view"), | 800 | addWidBool(i18n("Use short date in WN+Event view"), |
797 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 801 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
798 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 802 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
799 | 803 | ||
800 | 804 | ||
801 | 805 | ||
802 | 806 | ||
803 | // *********************** Todo View | 807 | // *********************** Todo View |
804 | 808 | ||
805 | topFrame = addPage(i18n("Todo View"),0,0); | 809 | topFrame = addPage(i18n("Todo View"),0,0); |
806 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 810 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
807 | 811 | ||
808 | topLayout = new QGridLayout(topFrame,4,1); | 812 | topLayout = new QGridLayout(topFrame,4,1); |
809 | topLayout->setSpacing(mSpacingHint); | 813 | topLayout->setSpacing(mSpacingHint); |
810 | topLayout->setMargin(mMarginHint); | 814 | topLayout->setMargin(mMarginHint); |
811 | ii = 0; | 815 | ii = 0; |
812 | dummy = | 816 | dummy = |
813 | addWidBool(i18n("Hide not running Todos in To-do view"), | 817 | addWidBool(i18n("Hide not running Todos in To-do view"), |
814 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 818 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
815 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 819 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
816 | 820 | ||
817 | 821 | ||
818 | KPrefsDialogWidBool *showCompletedTodo = | 822 | KPrefsDialogWidBool *showCompletedTodo = |
819 | addWidBool(i18n("To-do view shows completed Todos"), | 823 | addWidBool(i18n("To-do view shows completed Todos"), |
820 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 824 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
821 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 825 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
822 | dummy = | 826 | dummy = |
823 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 827 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
824 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 828 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
825 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 829 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
826 | 830 | ||
827 | dummy = | 831 | dummy = |
828 | addWidBool(i18n("Small To-do view uses smaller font"), | 832 | addWidBool(i18n("Small To-do view uses smaller font"), |
829 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 833 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
830 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 834 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
831 | 835 | ||
832 | 836 | ||
833 | 837 | ||
834 | dummy = | 838 | dummy = |
835 | addWidBool(i18n("Todo view uses category colors"), | 839 | addWidBool(i18n("Todo view uses category colors"), |
836 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 840 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
837 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 841 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
838 | 842 | ||
839 | 843 | ||
840 | QWidget* wid = new QWidget( topFrame ); | 844 | QWidget* wid = new QWidget( topFrame ); |
841 | // Todo run today color | 845 | // Todo run today color |
842 | KPrefsDialogWidColor *todoRunColor = | 846 | KPrefsDialogWidColor *todoRunColor = |
843 | addWidColor(i18n("Color for running todos:"), | 847 | addWidColor(i18n("Color for running todos:"), |
844 | &(KOPrefs::instance()->mTodoRunColor),wid); | 848 | &(KOPrefs::instance()->mTodoRunColor),wid); |
845 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 849 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
846 | widLayout->addWidget( todoRunColor->label() ); | 850 | widLayout->addWidget( todoRunColor->label() ); |
847 | widLayout->addWidget( todoRunColor->button() ); | 851 | widLayout->addWidget( todoRunColor->button() ); |
848 | topLayout->addWidget(wid,ii++,0); | 852 | topLayout->addWidget(wid,ii++,0); |
849 | 853 | ||
850 | wid = new QWidget( topFrame ); | 854 | wid = new QWidget( topFrame ); |
851 | // Todo due today color | 855 | // Todo due today color |
852 | KPrefsDialogWidColor *todoDueTodayColor = | 856 | KPrefsDialogWidColor *todoDueTodayColor = |
853 | addWidColor(i18n("Todo due today color:"), | 857 | addWidColor(i18n("Todo due today color:"), |
854 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 858 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
855 | widLayout = new QHBoxLayout(wid); | 859 | widLayout = new QHBoxLayout(wid); |
856 | widLayout->addWidget( todoDueTodayColor->label() ); | 860 | widLayout->addWidget( todoDueTodayColor->label() ); |
857 | widLayout->addWidget( todoDueTodayColor->button() ); | 861 | widLayout->addWidget( todoDueTodayColor->button() ); |
858 | topLayout->addWidget(wid,ii++,0); | 862 | topLayout->addWidget(wid,ii++,0); |
859 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 863 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
860 | 864 | ||
861 | // Todo overdue color | 865 | // Todo overdue color |
862 | wid = new QWidget( topFrame ); | 866 | wid = new QWidget( topFrame ); |
863 | widLayout = new QHBoxLayout(wid); | 867 | widLayout = new QHBoxLayout(wid); |
864 | KPrefsDialogWidColor *todoOverdueColor = | 868 | KPrefsDialogWidColor *todoOverdueColor = |
865 | addWidColor(i18n("Todo overdue color:"), | 869 | addWidColor(i18n("Todo overdue color:"), |
866 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 870 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
867 | widLayout->addWidget(todoOverdueColor->label()); | 871 | widLayout->addWidget(todoOverdueColor->label()); |
868 | widLayout->addWidget(todoOverdueColor->button()); | 872 | widLayout->addWidget(todoOverdueColor->button()); |
869 | topLayout->addWidget(wid,ii++,0); | 873 | topLayout->addWidget(wid,ii++,0); |
870 | 874 | ||
871 | dummy = | 875 | dummy = |
872 | addWidBool(i18n("Colors are applied to text"), | 876 | addWidBool(i18n("Colors are applied to text"), |
873 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 877 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
874 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 878 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
875 | 879 | ||
876 | 880 | ||
877 | 881 | ||
878 | topFrame = addPage(i18n("View Options"),0,0); | 882 | topFrame = addPage(i18n("View Options"),0,0); |
879 | 883 | ||
880 | topLayout = new QGridLayout(topFrame,4,1); | 884 | topLayout = new QGridLayout(topFrame,4,1); |
881 | topLayout->setSpacing(mSpacingHint); | 885 | topLayout->setSpacing(mSpacingHint); |
882 | topLayout->setMargin(mMarginHint); | 886 | topLayout->setMargin(mMarginHint); |
883 | ii = 0; | 887 | ii = 0; |
884 | 888 | ||
885 | dummy = | 889 | dummy = |
886 | addWidBool(i18n("Show Sync Events"), | 890 | addWidBool(i18n("Show Sync Events"), |
887 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 891 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
888 | topLayout->addWidget(dummy->checkBox(), ii++,0); | 892 | topLayout->addWidget(dummy->checkBox(), ii++,0); |
889 | 893 | ||
890 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | 894 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); |
891 | topLayout->addWidget(lab ,ii++,0); | 895 | topLayout->addWidget(lab ,ii++,0); |
892 | 896 | ||
893 | dummy = addWidBool(i18n("Details"), | 897 | dummy = addWidBool(i18n("Details"), |
894 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | 898 | &(KOPrefs::instance()->mEVshowDetails),topFrame); |
895 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 899 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
896 | dummy = addWidBool(i18n("Created time"), | 900 | dummy = addWidBool(i18n("Created time"), |
897 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | 901 | &(KOPrefs::instance()->mEVshowCreated),topFrame); |