summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp14
-rw-r--r--korganizer/kolistview.cpp4
-rw-r--r--korganizer/koprefs.cpp3
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/searchdialog.cpp4
5 files changed, 24 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 4b3f806..558fc55 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2478,384 +2478,393 @@ void CalendarView::readFilterSettings(KConfig *config)
2478 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2478 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2479 2479
2480 mFilters.clear(); 2480 mFilters.clear();
2481 2481
2482 config->setGroup("General"); 2482 config->setGroup("General");
2483 QStringList filterList = config->readListEntry("CalendarFilters"); 2483 QStringList filterList = config->readListEntry("CalendarFilters");
2484 2484
2485 QStringList::ConstIterator it = filterList.begin(); 2485 QStringList::ConstIterator it = filterList.begin();
2486 QStringList::ConstIterator end = filterList.end(); 2486 QStringList::ConstIterator end = filterList.end();
2487 while(it != end) { 2487 while(it != end) {
2488 // kdDebug() << " filter: " << (*it) << endl; 2488 // kdDebug() << " filter: " << (*it) << endl;
2489 2489
2490 CalFilter *filter; 2490 CalFilter *filter;
2491 filter = new CalFilter(*it); 2491 filter = new CalFilter(*it);
2492 config->setGroup("Filter_" + (*it).utf8()); 2492 config->setGroup("Filter_" + (*it).utf8());
2493 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2493 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2494 filter->setCriteria(config->readNumEntry("Criteria",0)); 2494 filter->setCriteria(config->readNumEntry("Criteria",0));
2495 filter->setCategoryList(config->readListEntry("CategoryList")); 2495 filter->setCategoryList(config->readListEntry("CategoryList"));
2496 mFilters.append(filter); 2496 mFilters.append(filter);
2497 2497
2498 ++it; 2498 ++it;
2499 } 2499 }
2500 2500
2501 if (mFilters.count() == 0) { 2501 if (mFilters.count() == 0) {
2502 CalFilter *filter = new CalFilter(i18n("Default")); 2502 CalFilter *filter = new CalFilter(i18n("Default"));
2503 mFilters.append(filter); 2503 mFilters.append(filter);
2504 } 2504 }
2505 mFilterView->updateFilters(); 2505 mFilterView->updateFilters();
2506 config->setGroup("FilterView"); 2506 config->setGroup("FilterView");
2507 2507
2508 mFilterView->blockSignals(true); 2508 mFilterView->blockSignals(true);
2509 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2509 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2510 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2510 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2511 mFilterView->blockSignals(false); 2511 mFilterView->blockSignals(false);
2512 // We do it manually to avoid it being done twice by the above calls 2512 // We do it manually to avoid it being done twice by the above calls
2513 updateFilter(); 2513 updateFilter();
2514} 2514}
2515 2515
2516void CalendarView::writeFilterSettings(KConfig *config) 2516void CalendarView::writeFilterSettings(KConfig *config)
2517{ 2517{
2518 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2518 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2519 2519
2520 QStringList filterList; 2520 QStringList filterList;
2521 2521
2522 CalFilter *filter = mFilters.first(); 2522 CalFilter *filter = mFilters.first();
2523 while(filter) { 2523 while(filter) {
2524 // kdDebug() << " fn: " << filter->name() << endl; 2524 // kdDebug() << " fn: " << filter->name() << endl;
2525 filterList << filter->name(); 2525 filterList << filter->name();
2526 config->setGroup("Filter_" + filter->name().utf8()); 2526 config->setGroup("Filter_" + filter->name().utf8());
2527 config->writeEntry("Criteria",filter->criteria()); 2527 config->writeEntry("Criteria",filter->criteria());
2528 config->writeEntry("CategoryList",filter->categoryList()); 2528 config->writeEntry("CategoryList",filter->categoryList());
2529 filter = mFilters.next(); 2529 filter = mFilters.next();
2530 } 2530 }
2531 config->setGroup("General"); 2531 config->setGroup("General");
2532 config->writeEntry("CalendarFilters",filterList); 2532 config->writeEntry("CalendarFilters",filterList);
2533 2533
2534 config->setGroup("FilterView"); 2534 config->setGroup("FilterView");
2535 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2535 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2536 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2536 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2537} 2537}
2538 2538
2539 2539
2540void CalendarView::goToday() 2540void CalendarView::goToday()
2541{ 2541{
2542 if ( mViewManager->currentView()->isMonthView() ) 2542 if ( mViewManager->currentView()->isMonthView() )
2543 mNavigator->selectTodayMonth(); 2543 mNavigator->selectTodayMonth();
2544 else 2544 else
2545 mNavigator->selectToday(); 2545 mNavigator->selectToday();
2546} 2546}
2547 2547
2548void CalendarView::goNext() 2548void CalendarView::goNext()
2549{ 2549{
2550 mNavigator->selectNext(); 2550 mNavigator->selectNext();
2551} 2551}
2552 2552
2553void CalendarView::goPrevious() 2553void CalendarView::goPrevious()
2554{ 2554{
2555 mNavigator->selectPrevious(); 2555 mNavigator->selectPrevious();
2556} 2556}
2557void CalendarView::goNextMonth() 2557void CalendarView::goNextMonth()
2558{ 2558{
2559 mNavigator->selectNextMonth(); 2559 mNavigator->selectNextMonth();
2560} 2560}
2561 2561
2562void CalendarView::goPreviousMonth() 2562void CalendarView::goPreviousMonth()
2563{ 2563{
2564 mNavigator->selectPreviousMonth(); 2564 mNavigator->selectPreviousMonth();
2565} 2565}
2566 2566
2567void CalendarView::updateConfig() 2567void CalendarView::updateConfig()
2568{ 2568{
2569 if ( KOPrefs::instance()->mUseAppColors ) 2569 if ( KOPrefs::instance()->mUseAppColors )
2570 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2570 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2571 emit configChanged(); 2571 emit configChanged();
2572 mTodoList->updateConfig(); 2572 mTodoList->updateConfig();
2573 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2573 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2574 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2574 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2575 // To make the "fill window" configurations work 2575 // To make the "fill window" configurations work
2576 //mViewManager->raiseCurrentView(); 2576 //mViewManager->raiseCurrentView();
2577} 2577}
2578 2578
2579 2579
2580void CalendarView::eventChanged(Event *event) 2580void CalendarView::eventChanged(Event *event)
2581{ 2581{
2582 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2582 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2583 //updateUnmanagedViews(); 2583 //updateUnmanagedViews();
2584} 2584}
2585 2585
2586void CalendarView::eventAdded(Event *event) 2586void CalendarView::eventAdded(Event *event)
2587{ 2587{
2588 changeEventDisplay(event,KOGlobals::EVENTADDED); 2588 changeEventDisplay(event,KOGlobals::EVENTADDED);
2589} 2589}
2590 2590
2591void CalendarView::eventToBeDeleted(Event *) 2591void CalendarView::eventToBeDeleted(Event *)
2592{ 2592{
2593 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2593 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2594} 2594}
2595 2595
2596void CalendarView::eventDeleted() 2596void CalendarView::eventDeleted()
2597{ 2597{
2598 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2598 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2599} 2599}
2600void CalendarView::changeTodoDisplay(Todo *which, int action) 2600void CalendarView::changeTodoDisplay(Todo *which, int action)
2601{ 2601{
2602 changeIncidenceDisplay((Incidence *)which, action); 2602 changeIncidenceDisplay((Incidence *)which, action);
2603 mDateNavigator->updateView(); //LR 2603 mDateNavigator->updateView(); //LR
2604 //mDialogManager->updateSearchDialog(); 2604 //mDialogManager->updateSearchDialog();
2605 2605
2606 if (which) { 2606 if (which) {
2607 mViewManager->updateWNview(); 2607 mViewManager->updateWNview();
2608 //mTodoList->updateView(); 2608 //mTodoList->updateView();
2609 } 2609 }
2610 2610
2611} 2611}
2612 2612
2613void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2613void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2614{ 2614{
2615 updateUnmanagedViews(); 2615 updateUnmanagedViews();
2616 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2616 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2617 if ( action == KOGlobals::EVENTDELETED ) { //delete 2617 if ( action == KOGlobals::EVENTDELETED ) { //delete
2618 mCalendar->checkAlarmForIncidence( 0, true ); 2618 mCalendar->checkAlarmForIncidence( 0, true );
2619 if ( mEventViewerDialog ) 2619 if ( mEventViewerDialog )
2620 mEventViewerDialog->hide(); 2620 mEventViewerDialog->hide();
2621 } 2621 }
2622 else 2622 else
2623 mCalendar->checkAlarmForIncidence( which , false ); 2623 mCalendar->checkAlarmForIncidence( which , false );
2624} 2624}
2625 2625
2626// most of the changeEventDisplays() right now just call the view's 2626// most of the changeEventDisplays() right now just call the view's
2627// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2627// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2628void CalendarView::changeEventDisplay(Event *which, int action) 2628void CalendarView::changeEventDisplay(Event *which, int action)
2629{ 2629{
2630 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2630 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2631 changeIncidenceDisplay((Incidence *)which, action); 2631 changeIncidenceDisplay((Incidence *)which, action);
2632 mDateNavigator->updateView(); 2632 mDateNavigator->updateView();
2633 //mDialogManager->updateSearchDialog(); 2633 //mDialogManager->updateSearchDialog();
2634 2634
2635 if (which) { 2635 if (which) {
2636 // If there is an event view visible update the display 2636 // If there is an event view visible update the display
2637 mViewManager->currentView()->changeEventDisplay(which,action); 2637 mViewManager->currentView()->changeEventDisplay(which,action);
2638 // TODO: check, if update needed 2638 // TODO: check, if update needed
2639 // if (which->getTodoStatus()) { 2639 // if (which->getTodoStatus()) {
2640 mTodoList->updateView(); 2640 mTodoList->updateView();
2641 // } 2641 // }
2642 } else { 2642 } else {
2643 mViewManager->currentView()->updateView(); 2643 mViewManager->currentView()->updateView();
2644 } 2644 }
2645} 2645}
2646 2646
2647 2647
2648void CalendarView::updateTodoViews() 2648void CalendarView::updateTodoViews()
2649{ 2649{
2650 mTodoList->updateView(); 2650 mTodoList->updateView();
2651 mViewManager->currentView()->updateView(); 2651 mViewManager->currentView()->updateView();
2652 2652
2653} 2653}
2654 2654
2655 2655
2656 2656
2657void CalendarView::clearAllViews() 2657void CalendarView::clearAllViews()
2658{ 2658{
2659 mTodoList->clearList(); 2659 mTodoList->clearList();
2660 mViewManager->clearAllViews(); 2660 mViewManager->clearAllViews();
2661 SearchDialog * sd = mDialogManager->getSearchDialog(); 2661 SearchDialog * sd = mDialogManager->getSearchDialog();
2662 if ( sd ) { 2662 if ( sd ) {
2663 KOListView* kol = sd->listview(); 2663 KOListView* kol = sd->listview();
2664 if ( kol ) 2664 if ( kol )
2665 kol->clearList(); 2665 kol->clearList();
2666 } 2666 }
2667} 2667}
2668void CalendarView::updateView() 2668void CalendarView::updateView()
2669{ 2669{
2670 static bool clearallviews = false;
2671 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2672 if ( clearallviews ) {
2673 clearAllViews();
2674 clearallviews = false;
2675 }
2676 return;
2677 }
2678 clearallviews = true;
2670 DateList tmpList = mNavigator->selectedDates(); 2679 DateList tmpList = mNavigator->selectedDates();
2671 2680
2672 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2681 if ( KOPrefs::instance()->mHideNonStartedTodos )
2673 mTodoList->updateView(); 2682 mTodoList->updateView();
2674 // We assume that the navigator only selects consecutive days. 2683 // We assume that the navigator only selects consecutive days.
2675 updateView( tmpList.first(), tmpList.last() ); 2684 updateView( tmpList.first(), tmpList.last() );
2676} 2685}
2677 2686
2678void CalendarView::updateUnmanagedViews() 2687void CalendarView::updateUnmanagedViews()
2679{ 2688{
2680 mDateNavigator->updateDayMatrix(); 2689 mDateNavigator->updateDayMatrix();
2681} 2690}
2682 2691
2683int CalendarView::msgItemDelete(const QString name) 2692int CalendarView::msgItemDelete(const QString name)
2684{ 2693{
2685 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2694 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2686 i18n("This item will be\npermanently deleted."), 2695 i18n("This item will be\npermanently deleted."),
2687 i18n("KO/Pi Confirmation"),i18n("Delete")); 2696 i18n("KO/Pi Confirmation"),i18n("Delete"));
2688} 2697}
2689 2698
2690 2699
2691void CalendarView::edit_cut() 2700void CalendarView::edit_cut()
2692{ 2701{
2693 Event *anEvent=0; 2702 Event *anEvent=0;
2694 2703
2695 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2704 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2696 2705
2697 if (mViewManager->currentView()->isEventView()) { 2706 if (mViewManager->currentView()->isEventView()) {
2698 if ( incidence && incidence->typeID() == eventID ) { 2707 if ( incidence && incidence->typeID() == eventID ) {
2699 anEvent = static_cast<Event *>(incidence); 2708 anEvent = static_cast<Event *>(incidence);
2700 } 2709 }
2701 } 2710 }
2702 2711
2703 if (!anEvent) { 2712 if (!anEvent) {
2704 KNotifyClient::beep(); 2713 KNotifyClient::beep();
2705 return; 2714 return;
2706 } 2715 }
2707 DndFactory factory( mCalendar ); 2716 DndFactory factory( mCalendar );
2708 factory.cutIncidence(anEvent); 2717 factory.cutIncidence(anEvent);
2709 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2718 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2710} 2719}
2711 2720
2712void CalendarView::edit_copy() 2721void CalendarView::edit_copy()
2713{ 2722{
2714 Event *anEvent=0; 2723 Event *anEvent=0;
2715 2724
2716 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2725 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2717 2726
2718 if (mViewManager->currentView()->isEventView()) { 2727 if (mViewManager->currentView()->isEventView()) {
2719 if ( incidence && incidence->typeID() == eventID ) { 2728 if ( incidence && incidence->typeID() == eventID ) {
2720 anEvent = static_cast<Event *>(incidence); 2729 anEvent = static_cast<Event *>(incidence);
2721 } 2730 }
2722 } 2731 }
2723 2732
2724 if (!anEvent) { 2733 if (!anEvent) {
2725 KNotifyClient::beep(); 2734 KNotifyClient::beep();
2726 return; 2735 return;
2727 } 2736 }
2728 DndFactory factory( mCalendar ); 2737 DndFactory factory( mCalendar );
2729 factory.copyIncidence(anEvent); 2738 factory.copyIncidence(anEvent);
2730} 2739}
2731 2740
2732void CalendarView::edit_paste() 2741void CalendarView::edit_paste()
2733{ 2742{
2734 QDate date = mNavigator->selectedDates().first(); 2743 QDate date = mNavigator->selectedDates().first();
2735 2744
2736 DndFactory factory( mCalendar ); 2745 DndFactory factory( mCalendar );
2737 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2746 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2738 2747
2739 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2748 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2740} 2749}
2741void CalendarView::edit_global_options() 2750void CalendarView::edit_global_options()
2742{ 2751{
2743 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2752 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2744 emit save(); 2753 emit save();
2745 emit saveStopTimer(); 2754 emit saveStopTimer();
2746 mDialogManager->showGlobalOptionsDialog(); 2755 mDialogManager->showGlobalOptionsDialog();
2747 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2756 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2748 emit saveStopTimer(); 2757 emit saveStopTimer();
2749 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!"), 2758 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!"),
2750 i18n("Timezone settings"),i18n("Reload"))) { 2759 i18n("Timezone settings"),i18n("Reload"))) {
2751 qDebug("KO: TZ reload cancelled "); 2760 qDebug("KO: TZ reload cancelled ");
2752 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2761 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2753 return; 2762 return;
2754 } 2763 }
2755 qDebug("KO: Timezone change "); 2764 qDebug("KO: Timezone change ");
2756 loadCalendars(); 2765 loadCalendars();
2757 setModified(true); 2766 setModified(true);
2758 } 2767 }
2759 else 2768 else
2760 qDebug("KO: No tz change "); 2769 qDebug("KO: No tz change ");
2761} 2770}
2762void CalendarView::edit_options() 2771void CalendarView::edit_options()
2763{ 2772{
2764 mDialogManager->showOptionsDialog(); 2773 mDialogManager->showOptionsDialog();
2765} 2774}
2766 2775
2767 2776
2768void CalendarView::slotSelectPickerDate( QDate d) 2777void CalendarView::slotSelectPickerDate( QDate d)
2769{ 2778{
2770 mDateFrame->hide(); 2779 mDateFrame->hide();
2771 if ( mDatePickerMode == 1 ) { 2780 if ( mDatePickerMode == 1 ) {
2772 mNavigator->slotDaySelect( d ); 2781 mNavigator->slotDaySelect( d );
2773 } else if ( mDatePickerMode == 2 ) { 2782 } else if ( mDatePickerMode == 2 ) {
2774 if ( mMoveIncidence->typeID() == todoID ) { 2783 if ( mMoveIncidence->typeID() == todoID ) {
2775 Todo * to = (Todo *) mMoveIncidence; 2784 Todo * to = (Todo *) mMoveIncidence;
2776 QTime tim; 2785 QTime tim;
2777 int len = 0; 2786 int len = 0;
2778 if ( to->hasStartDate() && to->hasDueDate() ) 2787 if ( to->hasStartDate() && to->hasDueDate() )
2779 len = to->dtStart().secsTo( to->dtDue()); 2788 len = to->dtStart().secsTo( to->dtDue());
2780 if ( to->hasDueDate() ) 2789 if ( to->hasDueDate() )
2781 tim = to->dtDue().time(); 2790 tim = to->dtDue().time();
2782 else { 2791 else {
2783 tim = QTime ( 0,0,0 ); 2792 tim = QTime ( 0,0,0 );
2784 to->setFloats( true ); 2793 to->setFloats( true );
2785 to->setHasDueDate( true ); 2794 to->setHasDueDate( true );
2786 } 2795 }
2787 QDateTime dt ( d,tim ); 2796 QDateTime dt ( d,tim );
2788 to->setDtDue( dt ); 2797 to->setDtDue( dt );
2789 2798
2790 if ( to->hasStartDate() ) { 2799 if ( to->hasStartDate() ) {
2791 if ( len>0 ) 2800 if ( len>0 )
2792 to->setDtStart(to->dtDue().addSecs( -len )); 2801 to->setDtStart(to->dtDue().addSecs( -len ));
2793 else 2802 else
2794 if (to->dtStart() > to->dtDue() ) 2803 if (to->dtStart() > to->dtDue() )
2795 to->setDtStart(to->dtDue().addDays( -3 )); 2804 to->setDtStart(to->dtDue().addDays( -3 ));
2796 } 2805 }
2797 2806
2798 todoChanged( to ); 2807 todoChanged( to );
2799 } else { 2808 } else {
2800 if ( mMoveIncidence->doesRecur() ) { 2809 if ( mMoveIncidence->doesRecur() ) {
2801#if 0 2810#if 0
2802 // PENDING implement this 2811 // PENDING implement this
2803 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2812 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2804 mCalendar()->addIncidence( newInc ); 2813 mCalendar()->addIncidence( newInc );
2805 if ( mMoveIncidence->typeID() == todoID ) 2814 if ( mMoveIncidence->typeID() == todoID )
2806 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2815 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2807 else 2816 else
2808 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2817 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2809 mMoveIncidence = newInc; 2818 mMoveIncidence = newInc;
2810 2819
2811#endif 2820#endif
2812 } 2821 }
2813 QTime tim = mMoveIncidence->dtStart().time(); 2822 QTime tim = mMoveIncidence->dtStart().time();
2814 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2823 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2815 QDateTime dt ( d,tim ); 2824 QDateTime dt ( d,tim );
2816 mMoveIncidence->setDtStart( dt ); 2825 mMoveIncidence->setDtStart( dt );
2817 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2826 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2818 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2827 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2819 } 2828 }
2820 2829
2821 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2830 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2822 } 2831 }
2823} 2832}
2824 2833
2825void CalendarView::removeCategories() 2834void CalendarView::removeCategories()
2826{ 2835{
2827 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2836 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2828 QStringList catList = KOPrefs::instance()->mCustomCategories; 2837 QStringList catList = KOPrefs::instance()->mCustomCategories;
2829 QStringList catIncList; 2838 QStringList catIncList;
2830 QStringList newCatList; 2839 QStringList newCatList;
2831 Incidence* inc = incList.first(); 2840 Incidence* inc = incList.first();
2832 uint i; 2841 uint i;
2833 while ( inc ) { 2842 while ( inc ) {
2834 newCatList.clear(); 2843 newCatList.clear();
2835 catIncList = inc->categories() ; 2844 catIncList = inc->categories() ;
2836 for( i = 0; i< catIncList.count(); ++i ) { 2845 for( i = 0; i< catIncList.count(); ++i ) {
2837 if ( catList.contains (catIncList[i])) 2846 if ( catList.contains (catIncList[i]))
2838 newCatList.append( catIncList[i] ); 2847 newCatList.append( catIncList[i] );
2839 } 2848 }
2840 newCatList.sort(); 2849 newCatList.sort();
2841 inc->setCategories( newCatList.join(",") ); 2850 inc->setCategories( newCatList.join(",") );
2842 inc = incList.next(); 2851 inc = incList.next();
2843 } 2852 }
2844} 2853}
2845 2854
2846int CalendarView::addCategories() 2855int CalendarView::addCategories()
2847{ 2856{
2848 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2857 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2849 QStringList catList = KOPrefs::instance()->mCustomCategories; 2858 QStringList catList = KOPrefs::instance()->mCustomCategories;
2850 QStringList catIncList; 2859 QStringList catIncList;
2851 Incidence* inc = incList.first(); 2860 Incidence* inc = incList.first();
2852 uint i; 2861 uint i;
2853 int count = 0; 2862 int count = 0;
2854 while ( inc ) { 2863 while ( inc ) {
2855 catIncList = inc->categories() ; 2864 catIncList = inc->categories() ;
2856 for( i = 0; i< catIncList.count(); ++i ) { 2865 for( i = 0; i< catIncList.count(); ++i ) {
2857 if ( !catList.contains (catIncList[i])) { 2866 if ( !catList.contains (catIncList[i])) {
2858 catList.append( catIncList[i] ); 2867 catList.append( catIncList[i] );
2859 //qDebug("add cat %s ", catIncList[i].latin1()); 2868 //qDebug("add cat %s ", catIncList[i].latin1());
2860 ++count; 2869 ++count;
2861 } 2870 }
@@ -4222,384 +4231,389 @@ void CalendarView::takeOverEvent()
4222void CalendarView::takeOverCalendar() 4231void CalendarView::takeOverCalendar()
4223{ 4232{
4224 // TODO: Create Calendar::allIncidences() function and use it here 4233 // TODO: Create Calendar::allIncidences() function and use it here
4225 4234
4226 clearAllViews(); 4235 clearAllViews();
4227 QPtrList<Event> events = mCalendar->events(); 4236 QPtrList<Event> events = mCalendar->events();
4228 for(uint i=0; i<events.count(); ++i) { 4237 for(uint i=0; i<events.count(); ++i) {
4229 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4238 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4230 events.at(i)->recreate(); 4239 events.at(i)->recreate();
4231 events.at(i)->setReadOnly(false); 4240 events.at(i)->setReadOnly(false);
4232 } 4241 }
4233 4242
4234 QPtrList<Todo> todos = mCalendar->todos(); 4243 QPtrList<Todo> todos = mCalendar->todos();
4235 for(uint i=0; i<todos.count(); ++i) { 4244 for(uint i=0; i<todos.count(); ++i) {
4236 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4245 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4237 todos.at(i)->recreate(); 4246 todos.at(i)->recreate();
4238 todos.at(i)->setReadOnly(false); 4247 todos.at(i)->setReadOnly(false);
4239 } 4248 }
4240 4249
4241 QPtrList<Journal> journals = mCalendar->journals(); 4250 QPtrList<Journal> journals = mCalendar->journals();
4242 for(uint i=0; i<journals.count(); ++i) { 4251 for(uint i=0; i<journals.count(); ++i) {
4243 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4252 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4244 journals.at(i)->recreate(); 4253 journals.at(i)->recreate();
4245 journals.at(i)->setReadOnly(false); 4254 journals.at(i)->setReadOnly(false);
4246 } 4255 }
4247 4256
4248 updateView(); 4257 updateView();
4249} 4258}
4250 4259
4251void CalendarView::showIntro() 4260void CalendarView::showIntro()
4252{ 4261{
4253 kdDebug() << "To be implemented." << endl; 4262 kdDebug() << "To be implemented." << endl;
4254} 4263}
4255 4264
4256QWidgetStack *CalendarView::viewStack() 4265QWidgetStack *CalendarView::viewStack()
4257{ 4266{
4258 return mRightFrame; 4267 return mRightFrame;
4259} 4268}
4260 4269
4261QWidget *CalendarView::leftFrame() 4270QWidget *CalendarView::leftFrame()
4262{ 4271{
4263 return ( QWidget *)mLeftFrame; 4272 return ( QWidget *)mLeftFrame;
4264} 4273}
4265 4274
4266DateNavigator *CalendarView::dateNavigator() 4275DateNavigator *CalendarView::dateNavigator()
4267{ 4276{
4268 return mNavigator; 4277 return mNavigator;
4269} 4278}
4270 4279
4271KDateNavigator* CalendarView::dateNavigatorWidget() 4280KDateNavigator* CalendarView::dateNavigatorWidget()
4272{ 4281{
4273 return mDateNavigator->navigatorView(); 4282 return mDateNavigator->navigatorView();
4274} 4283}
4275void CalendarView::toggleDateNavigatorWidget() 4284void CalendarView::toggleDateNavigatorWidget()
4276{ 4285{
4277 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4286 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4278 4287
4279 if (!KOPrefs::instance()->mShowDateNavigator ) 4288 if (!KOPrefs::instance()->mShowDateNavigator )
4280 mDateNavigator->hide(); 4289 mDateNavigator->hide();
4281 else 4290 else
4282 mDateNavigator->show(); 4291 mDateNavigator->show();
4283} 4292}
4284void CalendarView::addView(KOrg::BaseView *view) 4293void CalendarView::addView(KOrg::BaseView *view)
4285{ 4294{
4286 mViewManager->addView(view); 4295 mViewManager->addView(view);
4287} 4296}
4288 4297
4289void CalendarView::showView(KOrg::BaseView *view) 4298void CalendarView::showView(KOrg::BaseView *view)
4290{ 4299{
4291 mViewManager->showView(view, mLeftFrame->isVisible()); 4300 mViewManager->showView(view, mLeftFrame->isVisible());
4292} 4301}
4293 4302
4294Incidence *CalendarView::currentSelection() 4303Incidence *CalendarView::currentSelection()
4295{ 4304{
4296 return mViewManager->currentSelection(); 4305 return mViewManager->currentSelection();
4297} 4306}
4298void CalendarView::toggleAllDaySize() 4307void CalendarView::toggleAllDaySize()
4299{ 4308{
4300 /* 4309 /*
4301 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4310 if ( KOPrefs::instance()->mAllDaySize > 47 )
4302 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4311 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4303 else 4312 else
4304 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4313 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4305 */ 4314 */
4306 viewManager()->agendaView()->toggleAllDay(); 4315 viewManager()->agendaView()->toggleAllDay();
4307} 4316}
4308void CalendarView::toggleExpand() 4317void CalendarView::toggleExpand()
4309{ 4318{
4310 // if ( mLeftFrame->isHidden() ) { 4319 // if ( mLeftFrame->isHidden() ) {
4311 // mLeftFrame->show(); 4320 // mLeftFrame->show();
4312 // emit calendarViewExpanded( false ); 4321 // emit calendarViewExpanded( false );
4313 // } else { 4322 // } else {
4314 // mLeftFrame->hide(); 4323 // mLeftFrame->hide();
4315 // emit calendarViewExpanded( true ); 4324 // emit calendarViewExpanded( true );
4316 // } 4325 // }
4317 //qDebug(" CalendarView::toggleExpand()"); 4326 //qDebug(" CalendarView::toggleExpand()");
4318 globalFlagBlockAgenda = 1; 4327 globalFlagBlockAgenda = 1;
4319 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4328 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4320 globalFlagBlockAgenda = 5; 4329 globalFlagBlockAgenda = 5;
4321 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4330 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4322 //mViewManager->showView( 0, true ); 4331 //mViewManager->showView( 0, true );
4323} 4332}
4324 4333
4325void CalendarView::calendarModified( bool modified, Calendar * ) 4334void CalendarView::calendarModified( bool modified, Calendar * )
4326{ 4335{
4327 setModified( modified ); 4336 setModified( modified );
4328} 4337}
4329 4338
4330Todo *CalendarView::selectedTodo() 4339Todo *CalendarView::selectedTodo()
4331{ 4340{
4332 Incidence *incidence = currentSelection(); 4341 Incidence *incidence = currentSelection();
4333 if ( incidence && incidence->typeID() == todoID ) { 4342 if ( incidence && incidence->typeID() == todoID ) {
4334 return static_cast<Todo *>( incidence ); 4343 return static_cast<Todo *>( incidence );
4335 } 4344 }
4336 4345
4337 incidence = mTodoList->selectedIncidences().first(); 4346 incidence = mTodoList->selectedIncidences().first();
4338 if ( incidence && incidence->typeID() == todoID ) { 4347 if ( incidence && incidence->typeID() == todoID ) {
4339 return static_cast<Todo *>( incidence ); 4348 return static_cast<Todo *>( incidence );
4340 } 4349 }
4341 4350
4342 return 0; 4351 return 0;
4343} 4352}
4344 4353
4345void CalendarView::showIncidence() 4354void CalendarView::showIncidence()
4346{ 4355{
4347 mViewerCallerIsSearchDialog = false; 4356 mViewerCallerIsSearchDialog = false;
4348 Incidence *incidence = currentSelection(); 4357 Incidence *incidence = currentSelection();
4349 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4358 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4350 if ( incidence ) { 4359 if ( incidence ) {
4351 ShowIncidenceVisitor v; 4360 ShowIncidenceVisitor v;
4352 v.act( incidence, this ); 4361 v.act( incidence, this );
4353 } 4362 }
4354} 4363}
4355void CalendarView::editIncidenceDescription() 4364void CalendarView::editIncidenceDescription()
4356{ 4365{
4357 mFlagEditDescription = true; 4366 mFlagEditDescription = true;
4358 editIncidence(); 4367 editIncidence();
4359 mFlagEditDescription = false; 4368 mFlagEditDescription = false;
4360} 4369}
4361void CalendarView::editIncidence() 4370void CalendarView::editIncidence()
4362{ 4371{
4363 // qDebug("editIncidence() "); 4372 // qDebug("editIncidence() ");
4364 Incidence *incidence = currentSelection(); 4373 Incidence *incidence = currentSelection();
4365 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4374 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4366 if ( incidence ) { 4375 if ( incidence ) {
4367 EditIncidenceVisitor v; 4376 EditIncidenceVisitor v;
4368 v.act( incidence, this ); 4377 v.act( incidence, this );
4369 } 4378 }
4370} 4379}
4371 4380
4372void CalendarView::deleteIncidence() 4381void CalendarView::deleteIncidence()
4373{ 4382{
4374 Incidence *incidence = currentSelection(); 4383 Incidence *incidence = currentSelection();
4375 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4384 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4376 if ( incidence ) { 4385 if ( incidence ) {
4377 deleteIncidence(incidence); 4386 deleteIncidence(incidence);
4378 } 4387 }
4379} 4388}
4380void CalendarView::showIncidence(QString uid) 4389void CalendarView::showIncidence(QString uid)
4381{ 4390{
4382 Incidence *inc = mCalendar->incidence( uid ); 4391 Incidence *inc = mCalendar->incidence( uid );
4383 if ( inc ) 4392 if ( inc )
4384 showIncidence( inc ); 4393 showIncidence( inc );
4385} 4394}
4386void CalendarView::showIncidence(Incidence *incidence) 4395void CalendarView::showIncidence(Incidence *incidence)
4387{ 4396{
4388 mViewerCallerIsSearchDialog = false; 4397 mViewerCallerIsSearchDialog = false;
4389 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4398 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4390 if ( sender() && mDialogManager->getSearchDialog() ) { 4399 if ( sender() && mDialogManager->getSearchDialog() ) {
4391 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4400 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4392 mViewerCallerIsSearchDialog = true; 4401 mViewerCallerIsSearchDialog = true;
4393 } 4402 }
4394 } 4403 }
4395 if ( incidence ) { 4404 if ( incidence ) {
4396 ShowIncidenceVisitor v; 4405 ShowIncidenceVisitor v;
4397 v.act( incidence, this ); 4406 v.act( incidence, this );
4398 } 4407 }
4399} 4408}
4400 4409
4401void CalendarView::editIncidence(Incidence *incidence) 4410void CalendarView::editIncidence(Incidence *incidence)
4402{ 4411{
4403 if ( incidence ) { 4412 if ( incidence ) {
4404 4413
4405 EditIncidenceVisitor v; 4414 EditIncidenceVisitor v;
4406 v.act( incidence, this ); 4415 v.act( incidence, this );
4407 4416
4408 } 4417 }
4409} 4418}
4410 4419
4411void CalendarView::deleteIncidence(Incidence *incidence) 4420void CalendarView::deleteIncidence(Incidence *incidence)
4412{ 4421{
4413 //qDebug(" CalendarView::deleteIncidence "); 4422 //qDebug(" CalendarView::deleteIncidence ");
4423 if ( incidence == 0 ) {
4424 updateView();
4425 emit updateSearchDialog();
4426 return;
4427 }
4414 if ( incidence ) { 4428 if ( incidence ) {
4415 DeleteIncidenceVisitor v; 4429 DeleteIncidenceVisitor v;
4416 v.act( incidence, this ); 4430 v.act( incidence, this );
4417 } 4431 }
4418} 4432}
4419 4433
4420 4434
4421void CalendarView::lookForOutgoingMessages() 4435void CalendarView::lookForOutgoingMessages()
4422{ 4436{
4423 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4437 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4424 ogd->loadMessages(); 4438 ogd->loadMessages();
4425} 4439}
4426 4440
4427void CalendarView::lookForIncomingMessages() 4441void CalendarView::lookForIncomingMessages()
4428{ 4442{
4429 IncomingDialog *icd = mDialogManager->incomingDialog(); 4443 IncomingDialog *icd = mDialogManager->incomingDialog();
4430 icd->retrieve(); 4444 icd->retrieve();
4431} 4445}
4432 4446
4433bool CalendarView::removeCompletedSubTodos( Todo* t ) 4447bool CalendarView::removeCompletedSubTodos( Todo* t )
4434{ 4448{
4435 bool deleteTodo = true; 4449 bool deleteTodo = true;
4436 QPtrList<Incidence> subTodos; 4450 QPtrList<Incidence> subTodos;
4437 Incidence *aTodo; 4451 Incidence *aTodo;
4438 subTodos = t->relations(); 4452 subTodos = t->relations();
4439 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4453 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4440 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4454 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4441 deleteTodo = false; 4455 deleteTodo = false;
4442 } 4456 }
4443 if ( deleteTodo ) { 4457 if ( deleteTodo ) {
4444 if ( t->isCompleted() && !t->doesRecur()) { 4458 if ( t->isCompleted() && !t->doesRecur()) {
4445 checkExternalId( t ); 4459 checkExternalId( t );
4446 mCalendar->deleteTodo( t ); 4460 mCalendar->deleteTodo( t );
4447 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4461 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4448 } 4462 }
4449 else 4463 else
4450 deleteTodo = false; 4464 deleteTodo = false;
4451 } 4465 }
4452 return deleteTodo; 4466 return deleteTodo;
4453 4467
4454} 4468}
4455void CalendarView::purgeCompleted() 4469void CalendarView::purgeCompleted()
4456{ 4470{
4457 int result = KMessageBox::warningContinueCancel(this, 4471 int result = KMessageBox::warningContinueCancel(this,
4458 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4472 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4459 4473
4460 if (result == KMessageBox::Continue) { 4474 if (result == KMessageBox::Continue) {
4461 4475
4462 QPtrList<Todo> todoCal; 4476 QPtrList<Todo> todoCal;
4463 QPtrList<Todo> rootTodos; 4477 QPtrList<Todo> rootTodos;
4464 //QPtrList<Incidence> rel; 4478 //QPtrList<Incidence> rel;
4465 Todo *aTodo; 4479 Todo *aTodo;
4466 todoCal = calendar()->todos(); 4480 todoCal = calendar()->todos();
4467 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4481 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4468 if ( !aTodo->relatedTo() ) 4482 if ( !aTodo->relatedTo() )
4469 rootTodos.append( aTodo ); 4483 rootTodos.append( aTodo );
4470 } 4484 }
4471 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4485 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4472 removeCompletedSubTodos( aTodo ); 4486 removeCompletedSubTodos( aTodo );
4473 } 4487 }
4474 4488
4475 updateView(); 4489 updateView();
4476 } 4490 }
4477} 4491}
4478 4492
4479void CalendarView::slotCalendarChanged() 4493void CalendarView::slotCalendarChanged()
4480{ 4494{
4481 ; 4495 ;
4482} 4496}
4483 4497
4484void CalendarView::keyPressEvent ( QKeyEvent *e) 4498void CalendarView::keyPressEvent ( QKeyEvent *e)
4485{ 4499{
4486 //qDebug(" alendarView::keyPressEvent "); 4500 //qDebug(" alendarView::keyPressEvent ");
4487 e->ignore(); 4501 e->ignore();
4488} 4502}
4489 4503
4490 4504
4491bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4505bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4492{ 4506{
4493 4507
4494 if ( manager != mSyncManager) 4508 if ( manager != mSyncManager)
4495 qDebug("KO: Internal error-1. SyncManager mismatch "); 4509 qDebug("KO: Internal error-1. SyncManager mismatch ");
4496 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4510 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4497 qDebug("KO: SyncKDE request detected!"); 4511 qDebug("KO: SyncKDE request detected!");
4498 } 4512 }
4499 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4513 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4500 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4514 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4501 return syncCalendar( filename, mode ); 4515 return syncCalendar( filename, mode );
4502} 4516}
4503bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4517bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4504{ 4518{
4505 //mSyncManager = manager; 4519 //mSyncManager = manager;
4506 if ( manager != mSyncManager) 4520 if ( manager != mSyncManager)
4507 qDebug("KO: Internal error-2. SyncManager mismatch "); 4521 qDebug("KO: Internal error-2. SyncManager mismatch ");
4508 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4522 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4509 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4523 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4510 if ( resource == "sharp" ) 4524 if ( resource == "sharp" )
4511 syncExternal( 0 ); 4525 syncExternal( 0 );
4512 if ( resource == "phone" ) 4526 if ( resource == "phone" )
4513 syncExternal( 1 ); 4527 syncExternal( 1 );
4514 // pending setmodified 4528 // pending setmodified
4515 return true; 4529 return true;
4516} 4530}
4517void CalendarView::setSyncManager(KSyncManager* manager) 4531void CalendarView::setSyncManager(KSyncManager* manager)
4518{ 4532{
4519 mSyncManager = manager; 4533 mSyncManager = manager;
4520} 4534}
4521 4535
4522void CalendarView::removeSyncInfo( QString syncProfile) 4536void CalendarView::removeSyncInfo( QString syncProfile)
4523{ 4537{
4524 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4538 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4525 mCalendar->removeSyncInfo( syncProfile ); 4539 mCalendar->removeSyncInfo( syncProfile );
4526 4540
4527} 4541}
4528 4542
4529void CalendarView::undo_delete() 4543void CalendarView::undo_delete()
4530{ 4544{
4531 //qDebug("undo_delete() "); 4545 //qDebug("undo_delete() ");
4532 Incidence* undo = mCalendar->undoIncidence(); 4546 Incidence* undo = mCalendar->undoIncidence();
4533 if ( !undo ) { 4547 if ( !undo ) {
4534 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4548 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4535 i18n("KO/Pi")); 4549 i18n("KO/Pi"));
4536 return; 4550 return;
4537 } 4551 }
4538 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4552 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4539 i18n("\nAre you sure you want\nto restore this?"), 4553 i18n("\nAre you sure you want\nto restore this?"),
4540 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4554 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4541 mCalendar->undoDeleteIncidence(); 4555 mCalendar->undoDeleteIncidence();
4542 updateView(); 4556 updateView();
4543 } 4557 }
4544} 4558}
4545 4559
4546void CalendarView::slotViewerClosed() 4560void CalendarView::slotViewerClosed()
4547{ 4561{
4548 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4562 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4549} 4563}
4550 4564
4551void CalendarView::resetFocus() 4565void CalendarView::resetFocus()
4552{ 4566{
4553 if ( mViewerCallerIsSearchDialog ) { 4567 if ( mViewerCallerIsSearchDialog ) {
4554 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4568 if ( mDialogManager->getSearchDialog()->isVisible() ){
4555 mDialogManager->getSearchDialog()->raise(); 4569 mDialogManager->getSearchDialog()->raise();
4556 mDialogManager->getSearchDialog()->setActiveWindow(); 4570 mDialogManager->getSearchDialog()->setActiveWindow();
4557 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4571 mDialogManager->getSearchDialog()->listview()->resetFocus();
4558 } else 4572 } else
4559 mViewerCallerIsSearchDialog = false; 4573 mViewerCallerIsSearchDialog = false;
4560 } 4574 }
4561 if ( !mViewerCallerIsSearchDialog ) { 4575 if ( !mViewerCallerIsSearchDialog ) {
4562 //mViewManager->currentView()->setFocus(); 4576 //mViewManager->currentView()->setFocus();
4563 //qDebug("sssssssssssssssset focus "); 4577 //qDebug("sssssssssssssssset focus ");
4564 topLevelWidget()->raise(); 4578 topLevelWidget()->raise();
4565 setActiveWindow(); 4579 setActiveWindow();
4566 //setFocus(); 4580 //setFocus();
4567 } 4581 }
4568 mViewerCallerIsSearchDialog = false; 4582 mViewerCallerIsSearchDialog = false;
4569} 4583}
4570 4584
4571void CalendarView::showNextAlarms() 4585void CalendarView::showNextAlarms()
4572{ 4586{
4573 QString message; 4587 QString message;
4574 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4588 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4575 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4589 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4576 QString sum = mCalendar->nextSummary(); 4590 QString sum = mCalendar->nextSummary();
4577 QDateTime nextA = mNextAlarmDateTime; 4591 QDateTime nextA = mNextAlarmDateTime;
4578 QDateTime cur = QDateTime::currentDateTime(); 4592 QDateTime cur = QDateTime::currentDateTime();
4579 int secs = cur.secsTo( nextA ); 4593 int secs = cur.secsTo( nextA );
4580 int min = secs /60; 4594 int min = secs /60;
4581 int hours = min /60; 4595 int hours = min /60;
4582 min = min % 60; 4596 min = min % 60;
4583 int days = hours /24; 4597 int days = hours /24;
4584 hours = hours % 24; 4598 hours = hours % 24;
4585 4599
4586 //message = i18n("The next alarm is in:\n"); 4600 //message = i18n("The next alarm is in:\n");
4587 if ( days > 1 ) 4601 if ( days > 1 )
4588 message += i18n("%1 days\n").arg( days ); 4602 message += i18n("%1 days\n").arg( days );
4589 else if ( days == 1 ) 4603 else if ( days == 1 )
4590 message += i18n("1 day\n"); 4604 message += i18n("1 day\n");
4591 if ( hours > 1 ) 4605 if ( hours > 1 )
4592 message += i18n("%1 hours\n").arg( hours ); 4606 message += i18n("%1 hours\n").arg( hours );
4593 else if ( hours == 1 ) 4607 else if ( hours == 1 )
4594 message += i18n("1 hour\n"); 4608 message += i18n("1 hour\n");
4595 if ( min > 1 ) 4609 if ( min > 1 )
4596 message += i18n("%1 minutes\n").arg( min ); 4610 message += i18n("%1 minutes\n").arg( min );
4597 else if ( min == 1 ) 4611 else if ( min == 1 )
4598 message += i18n("1 minute\n"); 4612 message += i18n("1 minute\n");
4599 if ( message.isEmpty() ) 4613 if ( message.isEmpty() )
4600 message = i18n("The next alarm is in\nless than one minute!"); 4614 message = i18n("The next alarm is in\nless than one minute!");
4601 else 4615 else
4602 message = i18n("The next alarm is in:\n") + message; 4616 message = i18n("The next alarm is in:\n") + message;
4603 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4617 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4604 } else { 4618 } else {
4605 message = i18n("There is no next alarm."); 4619 message = i18n("There is no next alarm.");
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 25e599d..5690bdb 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -676,397 +676,399 @@ void KOListView::saveDescriptionToFile()
676void KOListView::saveToFileVCS() 676void KOListView::saveToFileVCS()
677{ 677{
678 writeToFile( false ); 678 writeToFile( false );
679} 679}
680void KOListView::saveToFile() 680void KOListView::saveToFile()
681{ 681{
682 writeToFile( true ); 682 writeToFile( true );
683} 683}
684QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) 684QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
685{ 685{
686 QPtrList<Incidence> delSel ; 686 QPtrList<Incidence> delSel ;
687 bool addSubTodos = false; 687 bool addSubTodos = false;
688 bool askSubTodos = true; 688 bool askSubTodos = true;
689 QListViewItem *item = mListView->firstChild (); 689 QListViewItem *item = mListView->firstChild ();
690 while ( item ) { 690 while ( item ) {
691 if ( item->isSelected() ) { 691 if ( item->isSelected() ) {
692 Incidence* inc = ((KOListViewItem *)item)->data(); 692 Incidence* inc = ((KOListViewItem *)item)->data();
693 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { 693 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) {
694 if ( (inc->typeID() == todoID && includeTodos) || 694 if ( (inc->typeID() == todoID && includeTodos) ||
695 (inc->typeID() == eventID && includeEvents) || 695 (inc->typeID() == eventID && includeEvents) ||
696 (inc->typeID() == journalID && includeJournals) ) { 696 (inc->typeID() == journalID && includeJournals) ) {
697 if ( inc->typeID() == todoID && onlyDueTodos ) { 697 if ( inc->typeID() == todoID && onlyDueTodos ) {
698 if ( ((Todo*)inc)->hasDueDate() ) 698 if ( ((Todo*)inc)->hasDueDate() )
699 delSel.append( inc ); 699 delSel.append( inc );
700 } else 700 } else
701 delSel.append( inc ); 701 delSel.append( inc );
702 702
703 } 703 }
704 } 704 }
705 if ( inc->typeID() == todoID ) { 705 if ( inc->typeID() == todoID ) {
706 Todo * todo = (Todo*) inc; 706 Todo * todo = (Todo*) inc;
707 if ( todo->relations().count() ) { 707 if ( todo->relations().count() ) {
708 if ( askSubTodos ) { 708 if ( askSubTodos ) {
709 int result = KMessageBox::warningYesNoCancel(this, 709 int result = KMessageBox::warningYesNoCancel(this,
710 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), 710 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"),
711 i18n("Todo has subtodos"), 711 i18n("Todo has subtodos"),
712 i18n("Yes"), 712 i18n("Yes"),
713 i18n("No")); 713 i18n("No"));
714 if ( result == KMessageBox::Cancel ) { 714 if ( result == KMessageBox::Cancel ) {
715 delSel.clear(); 715 delSel.clear();
716 return delSel; 716 return delSel;
717 } 717 }
718 if (result == KMessageBox::Yes) 718 if (result == KMessageBox::Yes)
719 addSubTodos = true; 719 addSubTodos = true;
720 askSubTodos = false; 720 askSubTodos = false;
721 } 721 }
722 if ( addSubTodos ) { 722 if ( addSubTodos ) {
723 QPtrList<Incidence> tempSel ; 723 QPtrList<Incidence> tempSel ;
724 inc->addRelationsToList( &tempSel ); 724 inc->addRelationsToList( &tempSel );
725 Incidence* tempinc = tempSel.first(); 725 Incidence* tempinc = tempSel.first();
726 while ( tempinc ) { 726 while ( tempinc ) {
727 if ( delSel.findRef( tempinc ) == -1 ) { 727 if ( delSel.findRef( tempinc ) == -1 ) {
728 if ( tempinc->typeID() == todoID && onlyDueTodos ) { 728 if ( tempinc->typeID() == todoID && onlyDueTodos ) {
729 if ( ((Todo*)tempinc)->hasDueDate() ) 729 if ( ((Todo*)tempinc)->hasDueDate() )
730 delSel.append( tempinc ); 730 delSel.append( tempinc );
731 } else 731 } else
732 delSel.append( tempinc ); 732 delSel.append( tempinc );
733 } 733 }
734 tempinc = tempSel.next(); 734 tempinc = tempSel.next();
735 } 735 }
736 } 736 }
737 } 737 }
738 } 738 }
739 } 739 }
740 item = item->nextSibling(); 740 item = item->nextSibling();
741 } 741 }
742 return delSel; 742 return delSel;
743} 743}
744 744
745void KOListView::writeToFile( bool iCal ) 745void KOListView::writeToFile( bool iCal )
746{ 746{
747 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 747 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
748 if ( !iCal ) { 748 if ( !iCal ) {
749 bool journal = false; 749 bool journal = false;
750 Incidence *incidence = delSel.first(); 750 Incidence *incidence = delSel.first();
751 while ( incidence ) { 751 while ( incidence ) {
752 if ( incidence->typeID() == journalID ) { 752 if ( incidence->typeID() == journalID ) {
753 journal = true; 753 journal = true;
754 break; 754 break;
755 } 755 }
756 incidence = delSel.next(); 756 incidence = delSel.next();
757 } 757 }
758 if ( journal ) { 758 if ( journal ) {
759 int result = KMessageBox::warningContinueCancel(this, 759 int result = KMessageBox::warningContinueCancel(this,
760 i18n("The journal entries can not be\nexported to a vCalendar file."), 760 i18n("The journal entries can not be\nexported to a vCalendar file."),
761 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 761 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
762 true); 762 true);
763 if (result != KMessageBox::Continue) return; 763 if (result != KMessageBox::Continue) return;
764 } 764 }
765 } 765 }
766 if ( delSel.count() ) { 766 if ( delSel.count() ) {
767 QString fn = KOPrefs::instance()->mLastSaveFile; 767 QString fn = KOPrefs::instance()->mLastSaveFile;
768 QString extension; 768 QString extension;
769 if ( iCal ) { 769 if ( iCal ) {
770 if ( fn.right( 4 ).lower() == ".vcs" ) { 770 if ( fn.right( 4 ).lower() == ".vcs" ) {
771 fn = fn.left( fn.length() -3) + "ics"; 771 fn = fn.left( fn.length() -3) + "ics";
772 } 772 }
773 } else { 773 } else {
774 if ( fn.right( 4 ).lower() == ".ics" ) { 774 if ( fn.right( 4 ).lower() == ".ics" ) {
775 fn = fn.left( fn.length() -3) + "vcs"; 775 fn = fn.left( fn.length() -3) + "vcs";
776 } 776 }
777 } 777 }
778 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 778 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
779 779
780 if ( fn == "" ) 780 if ( fn == "" )
781 return; 781 return;
782 QFileInfo info; 782 QFileInfo info;
783 info.setFile( fn ); 783 info.setFile( fn );
784 QString mes; 784 QString mes;
785 bool createbup = true; 785 bool createbup = true;
786 if ( info. exists() ) { 786 if ( info. exists() ) {
787 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 787 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
788 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 788 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
789 i18n("Overwrite!"), i18n("Cancel"), 0, 789 i18n("Overwrite!"), i18n("Cancel"), 0,
790 0, 1 ); 790 0, 1 );
791 if ( result != 0 ) { 791 if ( result != 0 ) {
792 createbup = false; 792 createbup = false;
793 } 793 }
794 } 794 }
795 if ( createbup ) { 795 if ( createbup ) {
796 CalendarLocal cal; 796 CalendarLocal cal;
797 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 797 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
798 Incidence *incidence = delSel.first(); 798 Incidence *incidence = delSel.first();
799 while ( incidence ) { 799 while ( incidence ) {
800 cal.addIncidence( incidence->clone() ); 800 cal.addIncidence( incidence->clone() );
801 incidence = delSel.next(); 801 incidence = delSel.next();
802 } 802 }
803 if ( iCal ) { 803 if ( iCal ) {
804 ICalFormat format; 804 ICalFormat format;
805 format.save( &cal, fn ); 805 format.save( &cal, fn );
806 } else { 806 } else {
807 807
808 VCalFormat format; 808 VCalFormat format;
809 format.save( &cal, fn ); 809 format.save( &cal, fn );
810 } 810 }
811 mes = i18n("KO/Pi:Saved %1").arg(fn ); 811 mes = i18n("KO/Pi:Saved %1").arg(fn );
812 KOPrefs::instance()->mLastSaveFile = fn; 812 KOPrefs::instance()->mLastSaveFile = fn;
813 topLevelWidget()->setCaption(mes); 813 topLevelWidget()->setCaption(mes);
814 } 814 }
815 } 815 }
816 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 816 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
817} 817}
818void KOListView::hideAll() 818void KOListView::hideAll()
819{ 819{
820 QPtrList<QListViewItem> delSel ; 820 QPtrList<QListViewItem> delSel ;
821 QListViewItem *item = mListView->firstChild (); 821 QListViewItem *item = mListView->firstChild ();
822 while ( item ) { 822 while ( item ) {
823 if ( item->isSelected() ) { 823 if ( item->isSelected() ) {
824 delSel.append(item); 824 delSel.append(item);
825 } 825 }
826 item = item->nextSibling(); 826 item = item->nextSibling();
827 } 827 }
828 item = delSel.first() ; 828 item = delSel.first() ;
829 while ( item ) { 829 while ( item ) {
830 QListViewItem * del = item; 830 QListViewItem * del = item;
831 item = delSel.next(); 831 item = delSel.next();
832 delete del; 832 delete del;
833 } 833 }
834} 834}
835void KOListView::printList() 835void KOListView::printList()
836{ 836{
837 mListView->printList(); 837 mListView->printList();
838} 838}
839void KOListView::deleteAll() 839void KOListView::deleteAll()
840{ 840{
841 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; 841 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
842 if ( delSel.count() ) { 842 if ( delSel.count() ) {
843 int icount = delSel.count(); 843 int icount = delSel.count();
844 Incidence *incidence = delSel.first(); 844 Incidence *incidence = delSel.first();
845 Incidence *toDelete; 845 Incidence *toDelete;
846 KOPrefs *p = KOPrefs::instance(); 846 KOPrefs *p = KOPrefs::instance();
847 bool confirm = p->mConfirm; 847 bool confirm = p->mConfirm;
848 QString mess; 848 QString mess;
849 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 849 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
850 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 850 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
851 p->mConfirm = false; 851 p->mConfirm = false;
852 int delCounter = 0; 852 int delCounter = 0;
853 QDialog dia ( this, "p-dialog", true ); 853 QDialog dia ( this, "p-dialog", true );
854 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 854 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
855 QVBoxLayout lay( &dia ); 855 QVBoxLayout lay( &dia );
856 lay.setMargin(7); 856 lay.setMargin(7);
857 lay.setSpacing(7); 857 lay.setSpacing(7);
858 lay.addWidget( &lab); 858 lay.addWidget( &lab);
859 QProgressBar bar( icount, &dia ); 859 QProgressBar bar( icount, &dia );
860 lay.addWidget( &bar); 860 lay.addWidget( &bar);
861 int w = 220; 861 int w = 220;
862 int h = 50; 862 int h = 50;
863 int dw = QApplication::desktop()->width(); 863 int dw = QApplication::desktop()->width();
864 int dh = QApplication::desktop()->height(); 864 int dh = QApplication::desktop()->height();
865 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 865 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
866 //dia.resize( 240,50 ); 866 //dia.resize( 240,50 );
867 dia.show(); 867 dia.show();
868 868 KOPrefs::instance()->mGlobalUpdateDisabled = true;
869 while ( incidence ) { 869 while ( incidence ) {
870 bar.setProgress( delCounter ); 870 bar.setProgress( delCounter );
871 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 871 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
872 dia.setCaption( mess ); 872 dia.setCaption( mess );
873 qApp->processEvents(); 873 qApp->processEvents();
874 toDelete = (incidence); 874 toDelete = (incidence);
875 incidence = delSel.next(); 875 incidence = delSel.next();
876 emit deleteIncidenceSignal(toDelete ); 876 emit deleteIncidenceSignal(toDelete );
877 if ( dia.result() != 0 ) 877 if ( dia.result() != 0 )
878 break; 878 break;
879 879
880 } 880 }
881 KOPrefs::instance()->mGlobalUpdateDisabled = false;
882 emit deleteIncidenceSignal( 0 );
881 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 883 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
882 topLevelWidget ()->setCaption( mess ); 884 topLevelWidget ()->setCaption( mess );
883 p->mConfirm = confirm; 885 p->mConfirm = confirm;
884 } 886 }
885 } 887 }
886 888
887 889
888} 890}
889int KOListView::maxDatesHint() 891int KOListView::maxDatesHint()
890{ 892{
891 return 0; 893 return 0;
892} 894}
893 895
894int KOListView::currentDateCount() 896int KOListView::currentDateCount()
895{ 897{
896 return 0; 898 return 0;
897} 899}
898 900
899QPtrList<Incidence> KOListView::selectedIncidences() 901QPtrList<Incidence> KOListView::selectedIncidences()
900{ 902{
901 QPtrList<Incidence> eventList; 903 QPtrList<Incidence> eventList;
902 QListViewItem *item = mListView->firstChild (); 904 QListViewItem *item = mListView->firstChild ();
903 while ( item ) { 905 while ( item ) {
904 if ( item->isSelected() ) { 906 if ( item->isSelected() ) {
905 eventList.append(((KOListViewItem *)item)->data()); 907 eventList.append(((KOListViewItem *)item)->data());
906 } 908 }
907 909
908 item = item->nextSibling(); 910 item = item->nextSibling();
909 } 911 }
910 912
911 // // QListViewItem *item = mListView->selectedItem(); 913 // // QListViewItem *item = mListView->selectedItem();
912 //if (item) eventList.append(((KOListViewItem *)item)->data()); 914 //if (item) eventList.append(((KOListViewItem *)item)->data());
913 915
914 return eventList; 916 return eventList;
915} 917}
916 918
917DateList KOListView::selectedDates() 919DateList KOListView::selectedDates()
918{ 920{
919 DateList eventList; 921 DateList eventList;
920 return eventList; 922 return eventList;
921} 923}
922 924
923void KOListView::showDates(bool show) 925void KOListView::showDates(bool show)
924{ 926{
925 // Shouldn't we set it to a value greater 0? When showDates is called with 927 // Shouldn't we set it to a value greater 0? When showDates is called with
926 // show == true at first, then the columnwidths are set to zero. 928 // show == true at first, then the columnwidths are set to zero.
927 static int oldColWidth1 = 0; 929 static int oldColWidth1 = 0;
928 static int oldColWidth3 = 0; 930 static int oldColWidth3 = 0;
929 931
930 if (!show) { 932 if (!show) {
931 oldColWidth1 = mListView->columnWidth(1); 933 oldColWidth1 = mListView->columnWidth(1);
932 oldColWidth3 = mListView->columnWidth(3); 934 oldColWidth3 = mListView->columnWidth(3);
933 mListView->setColumnWidth(1, 0); 935 mListView->setColumnWidth(1, 0);
934 mListView->setColumnWidth(3, 0); 936 mListView->setColumnWidth(3, 0);
935 } else { 937 } else {
936 mListView->setColumnWidth(1, oldColWidth1); 938 mListView->setColumnWidth(1, oldColWidth1);
937 mListView->setColumnWidth(3, oldColWidth3); 939 mListView->setColumnWidth(3, oldColWidth3);
938 } 940 }
939 mListView->repaint(); 941 mListView->repaint();
940} 942}
941 943
942void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 944void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
943 const QDate &td) 945 const QDate &td)
944{ 946{
945#ifndef KORG_NOPRINTER 947#ifndef KORG_NOPRINTER
946 calPrinter->preview(CalPrinter::Day, fd, td); 948 calPrinter->preview(CalPrinter::Day, fd, td);
947#endif 949#endif
948} 950}
949 951
950void KOListView::showDates() 952void KOListView::showDates()
951{ 953{
952 showDates(true); 954 showDates(true);
953} 955}
954 956
955void KOListView::hideDates() 957void KOListView::hideDates()
956{ 958{
957 showDates(false); 959 showDates(false);
958} 960}
959 961
960void KOListView::resetFocus() 962void KOListView::resetFocus()
961{ 963{
962 topLevelWidget()->setActiveWindow(); 964 topLevelWidget()->setActiveWindow();
963 topLevelWidget()->raise(); 965 topLevelWidget()->raise();
964 mListView->setFocus(); 966 mListView->setFocus();
965} 967}
966void KOListView::updateView() 968void KOListView::updateView()
967{ 969{
968 mListView->setFocus(); 970 mListView->setFocus();
969 if ( mListView->firstChild () ) 971 if ( mListView->firstChild () )
970 mListView->setCurrentItem( mListView->firstChild () ); 972 mListView->setCurrentItem( mListView->firstChild () );
971} 973}
972void KOListView::updateConfig() 974void KOListView::updateConfig()
973{ 975{
974 976
975 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 977 mListView->setFont ( KOPrefs::instance()->mListViewFont );
976 updateView(); 978 updateView();
977 979
978} 980}
979void KOListView::setStartDate(const QDate &start) 981void KOListView::setStartDate(const QDate &start)
980{ 982{
981 mStartDate = start; 983 mStartDate = start;
982} 984}
983 985
984void KOListView::showDates(const QDate &start, const QDate &end) 986void KOListView::showDates(const QDate &start, const QDate &end)
985{ 987{
986 clear(); 988 clear();
987 mStartDate = start; 989 mStartDate = start;
988 QDate date = start; 990 QDate date = start;
989 while( date <= end ) { 991 while( date <= end ) {
990 addEvents(calendar()->events(date)); 992 addEvents(calendar()->events(date));
991 addTodos(calendar()->todos(date)); 993 addTodos(calendar()->todos(date));
992 addJournals( calendar()->journals4Date(date) ); 994 addJournals( calendar()->journals4Date(date) );
993 date = date.addDays( 1 ); 995 date = date.addDays( 1 );
994 } 996 }
995 emit incidenceSelected( 0 ); 997 emit incidenceSelected( 0 );
996 updateView(); 998 updateView();
997 999
998} 1000}
999 1001
1000void KOListView::addEvents(QPtrList<Event> eventList) 1002void KOListView::addEvents(QPtrList<Event> eventList)
1001{ 1003{
1002 1004
1003 Event *ev; 1005 Event *ev;
1004 for(ev = eventList.first(); ev; ev = eventList.next()) { 1006 for(ev = eventList.first(); ev; ev = eventList.next()) {
1005 addIncidence(ev); 1007 addIncidence(ev);
1006 } 1008 }
1007 if ( !mListView->currentItem() ){ 1009 if ( !mListView->currentItem() ){
1008 updateView(); 1010 updateView();
1009 } 1011 }
1010} 1012}
1011 1013
1012void KOListView::addTodos(QPtrList<Todo> eventList) 1014void KOListView::addTodos(QPtrList<Todo> eventList)
1013{ 1015{
1014 Todo *ev; 1016 Todo *ev;
1015 for(ev = eventList.first(); ev; ev = eventList.next()) { 1017 for(ev = eventList.first(); ev; ev = eventList.next()) {
1016 addIncidence(ev); 1018 addIncidence(ev);
1017 } 1019 }
1018 if ( !mListView->currentItem() ){ 1020 if ( !mListView->currentItem() ){
1019 updateView(); 1021 updateView();
1020 } 1022 }
1021} 1023}
1022void KOListView::addJournals(QPtrList<Journal> eventList) 1024void KOListView::addJournals(QPtrList<Journal> eventList)
1023{ 1025{
1024 Journal *ev; 1026 Journal *ev;
1025 for(ev = eventList.first(); ev; ev = eventList.next()) { 1027 for(ev = eventList.first(); ev; ev = eventList.next()) {
1026 addIncidence(ev); 1028 addIncidence(ev);
1027 } 1029 }
1028 if ( !mListView->currentItem() ){ 1030 if ( !mListView->currentItem() ){
1029 updateView(); 1031 updateView();
1030 } 1032 }
1031} 1033}
1032 1034
1033void KOListView::showCompletedTodos() 1035void KOListView::showCompletedTodos()
1034{ 1036{
1035 mForceShowCompletedTodos = true; 1037 mForceShowCompletedTodos = true;
1036} 1038}
1037void KOListView::addIncidence(Incidence *incidence) 1039void KOListView::addIncidence(Incidence *incidence)
1038{ 1040{
1039 if ( mUidDict.find( incidence->uid() ) ) return; 1041 if ( mUidDict.find( incidence->uid() ) ) return;
1040 1042
1041 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 1043 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
1042 if ( incidence->typeID() == todoID ) { 1044 if ( incidence->typeID() == todoID ) {
1043 if ( ! mForceShowCompletedTodos ) { 1045 if ( ! mForceShowCompletedTodos ) {
1044 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) 1046 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() )
1045 return; 1047 return;
1046 } 1048 }
1047 } 1049 }
1048 mUidDict.insert( incidence->uid(), incidence ); 1050 mUidDict.insert( incidence->uid(), incidence );
1049 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 1051 KOListViewItem *item = new KOListViewItem( incidence, mListView );
1050 ListItemVisitor v(item, mStartDate ); 1052 ListItemVisitor v(item, mStartDate );
1051 if (incidence->accept(v)) { 1053 if (incidence->accept(v)) {
1052 return; 1054 return;
1053 } 1055 }
1054 else delete item; 1056 else delete item;
1055} 1057}
1056 1058
1057void KOListView::showEvents(QPtrList<Event> eventList) 1059void KOListView::showEvents(QPtrList<Event> eventList)
1058{ 1060{
1059 clear(); 1061 clear();
1060 1062
1061 addEvents(eventList); 1063 addEvents(eventList);
1062 1064
1063 // After new creation of list view no events are selected. 1065 // After new creation of list view no events are selected.
1064 emit incidenceSelected( 0 ); 1066 emit incidenceSelected( 0 );
1065} 1067}
1066int KOListView::count() 1068int KOListView::count()
1067{ 1069{
1068 return mListView->childCount(); 1070 return mListView->childCount();
1069} 1071}
1070 1072
1071void KOListView::changeEventDisplay(Event *event, int action) 1073void KOListView::changeEventDisplay(Event *event, int action)
1072{ 1074{
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 138028d..a63297e 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,514 +1,515 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mGlobalUpdateDisabled = false;
56 mCategoryColors.setAutoDelete(true); 57 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 58 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 59 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 60 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 61 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 62 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 63 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 64 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 65 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 QColor defaultTodoRunColor = QColor(99,194,30); 66 QColor defaultTodoRunColor = QColor(99,194,30);
66 KPrefs::setCurrentGroup("General"); 67 KPrefs::setCurrentGroup("General");
67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 68 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 69 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 70 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
70 addItemBool("ShowIconSearch",&mShowIconSearch,true); 71 addItemBool("ShowIconSearch",&mShowIconSearch,true);
71 addItemBool("ShowIconList",&mShowIconList,true); 72 addItemBool("ShowIconList",&mShowIconList,true);
72 addItemBool("ShowIconDay1",&mShowIconDay1,true); 73 addItemBool("ShowIconDay1",&mShowIconDay1,true);
73 addItemBool("ShowIconDay5",&mShowIconDay5,true); 74 addItemBool("ShowIconDay5",&mShowIconDay5,true);
74 addItemBool("ShowIconDay6",&mShowIconDay6,true); 75 addItemBool("ShowIconDay6",&mShowIconDay6,true);
75 addItemBool("ShowIconDay7",&mShowIconDay7,true); 76 addItemBool("ShowIconDay7",&mShowIconDay7,true);
76 addItemBool("ShowIconMonth",&mShowIconMonth,true); 77 addItemBool("ShowIconMonth",&mShowIconMonth,true);
77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 78 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 79 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
79 addItemBool("ShowIconBack",&mShowIconBack,true); 80 addItemBool("ShowIconBack",&mShowIconBack,true);
80 addItemBool("ShowIconToday",&mShowIconToday,true); 81 addItemBool("ShowIconToday",&mShowIconToday,true);
81 addItemBool("ShowIconForward",&mShowIconForward,true); 82 addItemBool("ShowIconForward",&mShowIconForward,true);
82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 83 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 84 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); 85 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 86 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
86 addItemBool("ShowIconNext",&mShowIconNext,true); 87 addItemBool("ShowIconNext",&mShowIconNext,true);
87 addItemBool("ShowIconJournal",&mShowIconJournal,true); 88 addItemBool("ShowIconJournal",&mShowIconJournal,true);
88 addItemBool("ShowIconStretch",&mShowIconStretch,true); 89 addItemBool("ShowIconStretch",&mShowIconStretch,true);
89 addItemBool("ShowIconFilter",&mShowIconFilter,false); 90 addItemBool("ShowIconFilter",&mShowIconFilter,false);
90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); 91 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true);
91 92
92 bool addIcons = false; 93 bool addIcons = false;
93#ifdef DESKTOP_VERSION 94#ifdef DESKTOP_VERSION
94 addIcons = true; 95 addIcons = true;
95#endif 96#endif
96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); 97 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons);
97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); 98 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons);
98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); 99 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons);
99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); 100 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons);
100 101
101 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 102 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
102 103
103 addItemBool("AskForQuit",&mAskForQuit,false); 104 addItemBool("AskForQuit",&mAskForQuit,false);
104 105
105#ifndef DESKTOP_VERSION 106#ifndef DESKTOP_VERSION
106 addItemBool("ShowFullMenu",&mShowFullMenu,false); 107 addItemBool("ShowFullMenu",&mShowFullMenu,false);
107#else 108#else
108 addItemBool("ShowFullMenu",&mShowFullMenu,true); 109 addItemBool("ShowFullMenu",&mShowFullMenu,true);
109#endif 110#endif
110 addItemBool("ToolBarHor",&mToolBarHor, true ); 111 addItemBool("ToolBarHor",&mToolBarHor, true );
111 addItemBool("ToolBarUp",&mToolBarUp, false ); 112 addItemBool("ToolBarUp",&mToolBarUp, false );
112 addItemBool("ToolBarHorV",&mToolBarHorV, true ); 113 addItemBool("ToolBarHorV",&mToolBarHorV, true );
113 addItemBool("ToolBarUpV",&mToolBarUpV, false ); 114 addItemBool("ToolBarUpV",&mToolBarUpV, false );
114 addItemBool("ToolBarHorN",&mToolBarHorN, true ); 115 addItemBool("ToolBarHorN",&mToolBarHorN, true );
115 addItemBool("ToolBarUpN",&mToolBarUpN, false ); 116 addItemBool("ToolBarUpN",&mToolBarUpN, false );
116 addItemBool("ToolBarHorF",&mToolBarHorF, true ); 117 addItemBool("ToolBarHorF",&mToolBarHorF, true );
117 addItemBool("ToolBarUpF",&mToolBarUpF, false ); 118 addItemBool("ToolBarUpF",&mToolBarUpF, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 119 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 120 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 121 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 122
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 123 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); 124 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true);
124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 125 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 126 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 127 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
127 addItemInt("AllDay Size",&mAllDaySize,28); 128 addItemInt("AllDay Size",&mAllDaySize,28);
128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 129 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 130 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
130 131
131 addItemStringList("LocationDefaults",&mLocationDefaults ); 132 addItemStringList("LocationDefaults",&mLocationDefaults );
132 addItemStringList("EventSummary User",&mEventSummaryUser); 133 addItemStringList("EventSummary User",&mEventSummaryUser);
133 addItemStringList("TodoSummary User",&mTodoSummaryUser); 134 addItemStringList("TodoSummary User",&mTodoSummaryUser);
134 addItemStringList("JournalSummary User",&mJournalSummaryUser); 135 addItemStringList("JournalSummary User",&mJournalSummaryUser);
135 136
136 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 137 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
137 addItemBool("Enable Project View",&mEnableProjectView,false); 138 addItemBool("Enable Project View",&mEnableProjectView,false);
138 addItemBool("Auto Save",&mAutoSave,false); 139 addItemBool("Auto Save",&mAutoSave,false);
139 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 140 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
140 addItemBool("Confirm Deletes",&mConfirm,true); 141 addItemBool("Confirm Deletes",&mConfirm,true);
141 addItemString("Archive File",&mArchiveFile); 142 addItemString("Archive File",&mArchiveFile);
142 addItemString("Html Export File",&mHtmlExportFile, 143 addItemString("Html Export File",&mHtmlExportFile,
143 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 144 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
144 addItemBool("Html With Save",&mHtmlWithSave,false); 145 addItemBool("Html With Save",&mHtmlWithSave,false);
145 146
146 KPrefs::setCurrentGroup("Personal Settings"); 147 KPrefs::setCurrentGroup("Personal Settings");
147 148
148 addItemInt("Mail Client",&mMailClient,MailClientKMail); 149 addItemInt("Mail Client",&mMailClient,MailClientKMail);
149 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 150 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
150 addItemBool("Bcc",&mBcc,false); 151 addItemBool("Bcc",&mBcc,false);
151 152
152 KPrefs::setCurrentGroup("Time & Date"); 153 KPrefs::setCurrentGroup("Time & Date");
153 154
154 155
155 addItemInt("Default Start Time",&mStartTime,10); 156 addItemInt("Default Start Time",&mStartTime,10);
156 addItemInt("Default Duration",&mDefaultDuration,2); 157 addItemInt("Default Duration",&mDefaultDuration,2);
157 addItemInt("Default Alarm Time",&mAlarmTime,3); 158 addItemInt("Default Alarm Time",&mAlarmTime,3);
158 KPrefs::setCurrentGroup("AlarmSettings"); 159 KPrefs::setCurrentGroup("AlarmSettings");
159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 160 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 161 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 162 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 163 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
163 164
164 165
165 KPrefs::setCurrentGroup("Calendar"); 166 KPrefs::setCurrentGroup("Calendar");
166 167
167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 168 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
168 169
169 KPrefs::setCurrentGroup("Fonts"); 170 KPrefs::setCurrentGroup("Fonts");
170 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 171 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
171 QFont fon = KGlobalSettings::generalFont(); 172 QFont fon = KGlobalSettings::generalFont();
172 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 173 addItemFont("TimeBar Font",&mTimeBarFont,fon );
173 addItemFont("MonthView Font",&mMonthViewFont,fon); 174 addItemFont("MonthView Font",&mMonthViewFont,fon);
174 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 175 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
175 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 176 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
176 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 177 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
177 addItemFont("TodoView Font",&mTodoViewFont,fon); 178 addItemFont("TodoView Font",&mTodoViewFont,fon);
178 addItemFont("ListView Font",&mListViewFont,fon); 179 addItemFont("ListView Font",&mListViewFont,fon);
179 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 180 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
180 addItemFont("EditBox Font",&mEditBoxFont,fon); 181 addItemFont("EditBox Font",&mEditBoxFont,fon);
181 addItemFont("JournalView Font",&mJornalViewFont,fon); 182 addItemFont("JournalView Font",&mJornalViewFont,fon);
182 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 183 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
183 addItemFont("EventView Font",&mEventViewFont,fon); 184 addItemFont("EventView Font",&mEventViewFont,fon);
184 185
185 KPrefs::setCurrentGroup("RemoteSyncing"); 186 KPrefs::setCurrentGroup("RemoteSyncing");
186 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 187 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
187 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 188 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
188 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 189 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
189 addItemInt("LastSyncTime",&mLastSyncTime,0); 190 addItemInt("LastSyncTime",&mLastSyncTime,0);
190 191
191#ifdef _WIN32_ 192#ifdef _WIN32_
192 QString hdp= locateLocal("data","korganizer")+"\\\\"; 193 QString hdp= locateLocal("data","korganizer")+"\\\\";
193#else 194#else
194 QString hdp= locateLocal("data","korganizer")+"/"; 195 QString hdp= locateLocal("data","korganizer")+"/";
195#endif 196#endif
196 197
197 KPrefs::setCurrentGroup("LoadSaveFileNames"); 198 KPrefs::setCurrentGroup("LoadSaveFileNames");
198 199
199 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 200 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
200 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 201 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
201 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 202 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
202 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 203 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
203 204
204 205
205 KPrefs::setCurrentGroup("Locale"); 206 KPrefs::setCurrentGroup("Locale");
206 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 207 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
207 208
208 209
209 KPrefs::setCurrentGroup("Colors"); 210 KPrefs::setCurrentGroup("Colors");
210 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 211 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
211 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 212 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
212 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 213 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
213 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 214 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
214 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 215 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
215 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 216 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
216 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 217 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
217 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 218 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
218 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 219 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
219 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 220 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
220 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 221 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
221 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 222 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
222 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 223 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
223 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 224 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
224 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 225 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
225 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 226 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
226 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 227 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
227 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 228 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
228 addItemBool("UseAppColors",&mUseAppColors,false); 229 addItemBool("UseAppColors",&mUseAppColors,false);
229 230
230 231
231 232
232 KPrefs::setCurrentGroup("Views"); 233 KPrefs::setCurrentGroup("Views");
233 addItemBool("Block Popup Menu",&mBlockPopupMenu,false); 234 addItemBool("Block Popup Menu",&mBlockPopupMenu,false);
234 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 235 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
235 addItemInt("Hour Size",&mHourSize,8); 236 addItemInt("Hour Size",&mHourSize,8);
236 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 237 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
237 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 238 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
238 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 239 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
239 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 240 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
240 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 241 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
241 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 242 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
242 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); 243 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
243#ifdef DESKTOP_VERION 244#ifdef DESKTOP_VERION
244 addItemBool("Enable ToolTips",&mEnableToolTips,true); 245 addItemBool("Enable ToolTips",&mEnableToolTips,true);
245#else 246#else
246 addItemBool("Enable ToolTips",&mEnableToolTips,false); 247 addItemBool("Enable ToolTips",&mEnableToolTips,false);
247#endif 248#endif
248 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 249 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
249 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 250 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
250 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 251 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
251 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 252 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
252 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 253 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
253 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 254 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
254 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 255 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
255 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 256 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
256 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 257 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
257 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 258 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
258 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 259 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
259 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 260 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
260 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 261 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
261 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 262 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
262 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 263 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
263 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 264 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
264 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 265 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
265 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 266 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
266 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 267 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
267 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 268 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
268#ifdef DESKTOP_VERSION 269#ifdef DESKTOP_VERSION
269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
270#else 271#else
271 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 272 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
272#endif 273#endif
273 addItemInt("Day Begins",&mDayBegins,7); 274 addItemInt("Day Begins",&mDayBegins,7);
274 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 275 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
275 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 276 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
276 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 277 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
277 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 278 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
278 279
279 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 280 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
280 addItemBool("Full View Month",&mFullViewMonth,true); 281 addItemBool("Full View Month",&mFullViewMonth,true);
281 addItemBool("Full View Todo",&mFullViewTodo,true); 282 addItemBool("Full View Todo",&mFullViewTodo,true);
282 addItemBool("Quick Todo",&mEnableQuickTodo,false); 283 addItemBool("Quick Todo",&mEnableQuickTodo,false);
283 284
284 addItemInt("Next X Days",&mNextXDays,3); 285 addItemInt("Next X Days",&mNextXDays,3);
285 286
286 KPrefs::setCurrentGroup("Printer"); 287 KPrefs::setCurrentGroup("Printer");
287 288
288 KPrefs::setCurrentGroup("Layout"); 289 KPrefs::setCurrentGroup("Layout");
289 290
290 addItemBool("CompactDialogs",&mCompactDialogs,false); 291 addItemBool("CompactDialogs",&mCompactDialogs,false);
291 addItemBool("VerticalScreen",&mVerticalScreen,true); 292 addItemBool("VerticalScreen",&mVerticalScreen,true);
292 293
293 KPrefs::setCurrentGroup("KOrganizer Plugins"); 294 KPrefs::setCurrentGroup("KOrganizer Plugins");
294 295
295 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 296 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
296 297
297 KPrefs::setCurrentGroup("Group Scheduling"); 298 KPrefs::setCurrentGroup("Group Scheduling");
298 299
299 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 300 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
300 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 301 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
301 addItemStringList("AdditionalMails",&mAdditionalMails,""); 302 addItemStringList("AdditionalMails",&mAdditionalMails,"");
302 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 303 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
303 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 304 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
304 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 305 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
305 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 306 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
306 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 307 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
307 308
308 KPrefs::setCurrentGroup( "Editors" ); 309 KPrefs::setCurrentGroup( "Editors" );
309 310
310 addItemStringList( "EventTemplates", &mEventTemplates ); 311 addItemStringList( "EventTemplates", &mEventTemplates );
311 addItemStringList( "TodoTemplates", &mTodoTemplates ); 312 addItemStringList( "TodoTemplates", &mTodoTemplates );
312 313
313 addItemInt("DestinationPolicy",&mDestination,standardDestination); 314 addItemInt("DestinationPolicy",&mDestination,standardDestination);
314 315
315 KPrefs::setCurrentGroup( "ViewOptions" ); 316 KPrefs::setCurrentGroup( "ViewOptions" );
316 addItemBool("EVshowDetails",&mEVshowDetails,true); 317 addItemBool("EVshowDetails",&mEVshowDetails,true);
317 addItemBool("EVshowCreated",&mEVshowCreated,true); 318 addItemBool("EVshowCreated",&mEVshowCreated,true);
318 addItemBool("EVshowChanged",&mEVshowChanged,true); 319 addItemBool("EVshowChanged",&mEVshowChanged,true);
319 addItemBool("WTshowDetails",&mWTshowDetails,false); 320 addItemBool("WTshowDetails",&mWTshowDetails,false);
320 addItemBool("WTshowCreated",&mWTshowCreated,false); 321 addItemBool("WTshowCreated",&mWTshowCreated,false);
321 addItemBool("WTshowChanged",&mWTshowChanged,false); 322 addItemBool("WTshowChanged",&mWTshowChanged,false);
322 mCalendars.setAutoDelete( true ); 323 mCalendars.setAutoDelete( true );
323} 324}
324 325
325 326
326KOPrefs::~KOPrefs() 327KOPrefs::~KOPrefs()
327{ 328{
328 if (mInstance == this) 329 if (mInstance == this)
329 mInstance = insd.setObject(0); 330 mInstance = insd.setObject(0);
330 mCalendars.setAutoDelete( true ); 331 mCalendars.setAutoDelete( true );
331 mCalendars.clear(); 332 mCalendars.clear();
332 //qDebug("KOPrefs::~KOPrefs() "); 333 //qDebug("KOPrefs::~KOPrefs() ");
333} 334}
334 335
335 336
336KOPrefs *KOPrefs::instance() 337KOPrefs *KOPrefs::instance()
337{ 338{
338 if (!mInstance) { 339 if (!mInstance) {
339 mInstance = insd.setObject(new KOPrefs()); 340 mInstance = insd.setObject(new KOPrefs());
340 mInstance->readConfig(); 341 mInstance->readConfig();
341 } 342 }
342 343
343 return mInstance; 344 return mInstance;
344} 345}
345 346
346void KOPrefs::usrSetDefaults() 347void KOPrefs::usrSetDefaults()
347{ 348{
348 349
349} 350}
350 351
351void KOPrefs::fillMailDefaults() 352void KOPrefs::fillMailDefaults()
352{ 353{
353 if (mName.isEmpty()) mName = i18n("Anonymous"); 354 if (mName.isEmpty()) mName = i18n("Anonymous");
354 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 355 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
355} 356}
356 357
357void KOPrefs::setTimeZoneIdDefault() 358void KOPrefs::setTimeZoneIdDefault()
358{ 359{
359 ; 360 ;
360} 361}
361 362
362void KOPrefs::setAllDefaults() 363void KOPrefs::setAllDefaults()
363{ 364{
364 setCategoryDefaults(); 365 setCategoryDefaults();
365 mEventSummaryUser = getDefaultList() ; 366 mEventSummaryUser = getDefaultList() ;
366 mTodoSummaryUser = getDefaultList() ; 367 mTodoSummaryUser = getDefaultList() ;
367 mJournalSummaryUser = getDefaultList() ; 368 mJournalSummaryUser = getDefaultList() ;
368 mLocationDefaults = getLocationDefaultList(); 369 mLocationDefaults = getLocationDefaultList();
369} 370}
370 371
371void KOPrefs::setCategoryDefaults() 372void KOPrefs::setCategoryDefaults()
372{ 373{
373 mCustomCategories.clear(); 374 mCustomCategories.clear();
374 mCustomCategories = getDefaultList(); 375 mCustomCategories = getDefaultList();
375 376
376 QStringList::Iterator it; 377 QStringList::Iterator it;
377 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 378 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
378 setCategoryColor(*it,mDefaultCategoryColor); 379 setCategoryColor(*it,mDefaultCategoryColor);
379 } 380 }
380} 381}
381QStringList KOPrefs::getLocationDefaultList() 382QStringList KOPrefs::getLocationDefaultList()
382{ 383{
383 QStringList retval ; 384 QStringList retval ;
384 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 385 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
385 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 386 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
386 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 387 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
387 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 388 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
388 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 389 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
389 390
390 retval.sort(); 391 retval.sort();
391 return retval; 392 return retval;
392} 393}
393QStringList KOPrefs::getDefaultList() 394QStringList KOPrefs::getDefaultList()
394{ 395{
395 QStringList retval ; 396 QStringList retval ;
396 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") 397 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer")
397 << i18n("Break") 398 << i18n("Break")
398 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") 399 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts")
399 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") 400 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts")
400 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") 401 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal")
401 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") 402 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping")
402 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") 403 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")
403 << i18n("Vacation") ; 404 << i18n("Vacation") ;
404 retval.sort(); 405 retval.sort();
405 //qDebug("cat %s ", retval.join("-").latin1()); 406 //qDebug("cat %s ", retval.join("-").latin1());
406 return retval; 407 return retval;
407} 408}
408// << 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") 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")
409void KOPrefs::usrReadConfig() 410void KOPrefs::usrReadConfig()
410{ 411{
411 config()->setGroup("General"); 412 config()->setGroup("General");
412 413
413 //qDebug("KOPrefs::usrReadConfig() "); 414 //qDebug("KOPrefs::usrReadConfig() ");
414 mCustomCategories = config()->readListEntry("Custom Categories"); 415 mCustomCategories = config()->readListEntry("Custom Categories");
415 mOldLoadedLanguage = mOldLanguage ; 416 mOldLoadedLanguage = mOldLanguage ;
416 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 417 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
417 if (mLocationDefaults.isEmpty()) { 418 if (mLocationDefaults.isEmpty()) {
418 mLocationDefaults = getLocationDefaultList(); 419 mLocationDefaults = getLocationDefaultList();
419 } 420 }
420 421
421 if (mEventSummaryUser.isEmpty()) { 422 if (mEventSummaryUser.isEmpty()) {
422 mEventSummaryUser = getDefaultList() ; 423 mEventSummaryUser = getDefaultList() ;
423 } 424 }
424 if (mTodoSummaryUser.isEmpty()) { 425 if (mTodoSummaryUser.isEmpty()) {
425 mTodoSummaryUser = getDefaultList() ; 426 mTodoSummaryUser = getDefaultList() ;
426 } 427 }
427 428
428 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 429 if (mCustomCategories.isEmpty()) setCategoryDefaults();
429 430
430 config()->setGroup("Personal Settings"); 431 config()->setGroup("Personal Settings");
431 mName = config()->readEntry("user_name",""); 432 mName = config()->readEntry("user_name","");
432 mEmail = config()->readEntry("user_email",""); 433 mEmail = config()->readEntry("user_email","");
433 fillMailDefaults(); 434 fillMailDefaults();
434 435
435 config()->setGroup("Category Colors"); 436 config()->setGroup("Category Colors");
436 QStringList::Iterator it; 437 QStringList::Iterator it;
437 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 438 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
438 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 439 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
439 440
440 } 441 }
441 KConfig fc (locateLocal("config","kopicalendarrc")); 442 KConfig fc (locateLocal("config","kopicalendarrc"));
442 fc.setGroup("CC"); 443 fc.setGroup("CC");
443 int numCals = fc.readNumEntry("NumberCalendars",0 ); 444 int numCals = fc.readNumEntry("NumberCalendars",0 );
444 mNextAvailableCalendar = 1; 445 mNextAvailableCalendar = 1;
445 if ( numCals == 0 ) { 446 if ( numCals == 0 ) {
446 KopiCalendarFile *kkf = getNewCalendar(); 447 KopiCalendarFile *kkf = getNewCalendar();
447 kkf->isStandard = true; 448 kkf->isStandard = true;
448 kkf->mName = i18n("Standard"); 449 kkf->mName = i18n("Standard");
449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 450 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
450 } 451 }
451 while ( mNextAvailableCalendar <= numCals ) { 452 while ( mNextAvailableCalendar <= numCals ) {
452 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 453 //qDebug("Read cal #%d ", mNextAvailableCalendar );
453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 454 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
454 KopiCalendarFile *kkf = getNewCalendar(); 455 KopiCalendarFile *kkf = getNewCalendar();
455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 456 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 457 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
457 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); 458 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false );
458 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 459 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
459 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 460 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
460 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 461 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
461 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); 462 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
462 kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName); 463 kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName);
463 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 464 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
464 if ( kkf->mCalNumber == 1 ) { 465 if ( kkf->mCalNumber == 1 ) {
465 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 466 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
466 } 467 }
467 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 468 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
468 if ( kkf->mName == i18n("Birthdays") ) { 469 if ( kkf->mName == i18n("Birthdays") ) {
469 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 470 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
470 } 471 }
471 if ( kkf->isRelative ) 472 if ( kkf->isRelative )
472 kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName; 473 kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName;
473 } 474 }
474 475
475 KPimPrefs::usrReadConfig(); 476 KPimPrefs::usrReadConfig();
476} 477}
477 478
478KopiCalendarFile * KOPrefs::getCalendar( int num ) 479KopiCalendarFile * KOPrefs::getCalendar( int num )
479{ 480{
480 return mDefCalColors[num-1]; 481 return mDefCalColors[num-1];
481} 482}
482 483
483KopiCalendarFile * KOPrefs::getNewCalendar() 484KopiCalendarFile * KOPrefs::getNewCalendar()
484{ 485{
485 KopiCalendarFile * kkf = new KopiCalendarFile(); 486 KopiCalendarFile * kkf = new KopiCalendarFile();
486 kkf->mCalNumber = mNextAvailableCalendar; 487 kkf->mCalNumber = mNextAvailableCalendar;
487 mDefCalColors.resize( mNextAvailableCalendar ); 488 mDefCalColors.resize( mNextAvailableCalendar );
488 mDefCalColors[mNextAvailableCalendar-1] = kkf; 489 mDefCalColors[mNextAvailableCalendar-1] = kkf;
489 ++mNextAvailableCalendar; 490 ++mNextAvailableCalendar;
490 kkf->mDefaultColor = mEventColor; 491 kkf->mDefaultColor = mEventColor;
491 kkf->mName = i18n("New Calendar"); 492 kkf->mName = i18n("New Calendar");
492 mCalendars.append( kkf ); 493 mCalendars.append( kkf );
493 return kkf; 494 return kkf;
494} 495}
495void KOPrefs::deleteCalendar( int num ) 496void KOPrefs::deleteCalendar( int num )
496{ 497{
497 KopiCalendarFile * kkf = mCalendars.first(); 498 KopiCalendarFile * kkf = mCalendars.first();
498 while ( kkf ) { 499 while ( kkf ) {
499 if ( kkf->mCalNumber == num ) { 500 if ( kkf->mCalNumber == num ) {
500 qDebug("KOPrefs::deleteCalendar %d ", num ); 501 qDebug("KOPrefs::deleteCalendar %d ", num );
501 mCalendars.remove( kkf ); 502 mCalendars.remove( kkf );
502 delete kkf; 503 delete kkf;
503 return; 504 return;
504 } 505 }
505 kkf = mCalendars.next(); 506 kkf = mCalendars.next();
506 } 507 }
507} 508}
508int KOPrefs::getCalendarID( const QString & name ) 509int KOPrefs::getCalendarID( const QString & name )
509{ 510{
510 KopiCalendarFile * kkf = mCalendars.first(); 511 KopiCalendarFile * kkf = mCalendars.first();
511 while ( kkf ) { 512 while ( kkf ) {
512 if ( name == kkf->mName) 513 if ( name == kkf->mName)
513 return kkf->mCalNumber; 514 return kkf->mCalNumber;
514 kkf = mCalendars.next(); 515 kkf = mCalendars.next();
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 0779e27..392360d 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -156,207 +156,208 @@ class KOPrefs : public KPimPrefs
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 QColor mAppColor1; 186 QColor mAppColor1;
187 QColor mAppColor2; 187 QColor mAppColor2;
188 bool mUseAppColors; 188 bool mUseAppColors;
189 189
190 int mDayBegins; 190 int mDayBegins;
191 int mHourSize; 191 int mHourSize;
192 int mAllDaySize; 192 int mAllDaySize;
193 bool mShowFullMenu; 193 bool mShowFullMenu;
194 bool mDailyRecur; 194 bool mDailyRecur;
195 bool mWeeklyRecur; 195 bool mWeeklyRecur;
196 bool mMonthDailyRecur; 196 bool mMonthDailyRecur;
197 bool mMonthWeeklyRecur; 197 bool mMonthWeeklyRecur;
198 bool mMonthShowIcons; 198 bool mMonthShowIcons;
199 bool mMonthShowTimes; 199 bool mMonthShowTimes;
200 bool mMonthShowShort; 200 bool mMonthShowShort;
201 bool mEnableToolTips; 201 bool mEnableToolTips;
202 bool mEnableMonthScroll; 202 bool mEnableMonthScroll;
203 bool mFullViewMonth; 203 bool mFullViewMonth;
204 bool mMonthViewUsesCategoryColor; 204 bool mMonthViewUsesCategoryColor;
205 bool mFullViewTodo; 205 bool mFullViewTodo;
206 bool mShowCompletedTodo; 206 bool mShowCompletedTodo;
207 bool mMarcusBainsEnabled; 207 bool mMarcusBainsEnabled;
208 int mNextXDays; 208 int mNextXDays;
209 int mWhatsNextDays; 209 int mWhatsNextDays;
210 int mWhatsNextPrios; 210 int mWhatsNextPrios;
211 bool mEnableQuickTodo; 211 bool mEnableQuickTodo;
212 212
213 bool mCompactDialogs; 213 bool mCompactDialogs;
214 bool mVerticalScreen; 214 bool mVerticalScreen;
215 215
216 bool mShowIconNewTodo; 216 bool mShowIconNewTodo;
217 bool mShowIconNewEvent; 217 bool mShowIconNewEvent;
218 bool mShowIconSearch; 218 bool mShowIconSearch;
219 bool mShowIconList; 219 bool mShowIconList;
220 bool mShowIconDay1; 220 bool mShowIconDay1;
221 bool mShowIconDay5; 221 bool mShowIconDay5;
222 bool mShowIconDay6; 222 bool mShowIconDay6;
223 bool mShowIconDay7; 223 bool mShowIconDay7;
224 bool mShowIconMonth; 224 bool mShowIconMonth;
225 bool mShowIconTodoview; 225 bool mShowIconTodoview;
226 bool mShowIconBackFast; 226 bool mShowIconBackFast;
227 bool mShowIconBack; 227 bool mShowIconBack;
228 bool mShowIconToday; 228 bool mShowIconToday;
229 bool mShowIconForward; 229 bool mShowIconForward;
230 bool mShowIconForwardFast; 230 bool mShowIconForwardFast;
231 bool mShowIconWhatsThis; 231 bool mShowIconWhatsThis;
232 bool mShowIconWeekNum; 232 bool mShowIconWeekNum;
233 bool mShowIconNextDays; 233 bool mShowIconNextDays;
234 bool mShowIconNext; 234 bool mShowIconNext;
235 bool mShowIconJournal; 235 bool mShowIconJournal;
236 bool mShowIconFilter; 236 bool mShowIconFilter;
237 bool mShowIconOnetoolbar; 237 bool mShowIconOnetoolbar;
238 bool mShowIconNavigator; 238 bool mShowIconNavigator;
239 bool mShowIconAllday; 239 bool mShowIconAllday;
240 bool mShowIconFilterview; 240 bool mShowIconFilterview;
241 bool mShowIconToggleFull; 241 bool mShowIconToggleFull;
242 242
243 bool mShowIconStretch; 243 bool mShowIconStretch;
244 244
245 bool mToolBarHor; 245 bool mToolBarHor;
246 bool mToolBarUp; 246 bool mToolBarUp;
247 bool mToolBarHorV; 247 bool mToolBarHorV;
248 bool mToolBarUpV; 248 bool mToolBarUpV;
249 bool mToolBarHorN; 249 bool mToolBarHorN;
250 bool mToolBarUpN; 250 bool mToolBarUpN;
251 bool mToolBarHorF; 251 bool mToolBarHorF;
252 bool mToolBarUpF; 252 bool mToolBarUpF;
253 bool mToolBarMiniIcons; 253 bool mToolBarMiniIcons;
254 254
255 bool mAskForQuit; 255 bool mAskForQuit;
256 bool mUsePassWd; 256 bool mUsePassWd;
257 bool mShowSyncEvents; 257 bool mShowSyncEvents;
258 bool mShowTodoInAgenda; 258 bool mShowTodoInAgenda;
259 bool mShowCompletedTodoInAgenda; 259 bool mShowCompletedTodoInAgenda;
260 bool mShowTimeInAgenda; 260 bool mShowTimeInAgenda;
261 bool mHideNonStartedTodos; 261 bool mHideNonStartedTodos;
262 262
263 bool mBlockPopupMenu; 263 bool mBlockPopupMenu;
264 264
265 int mLastSyncTime; 265 int mLastSyncTime;
266 void setCategoryColor(QString cat,const QColor & color); 266 void setCategoryColor(QString cat,const QColor & color);
267 QColor *categoryColor(QString cat); 267 QColor *categoryColor(QString cat);
268 268
269 QString mArchiveFile; 269 QString mArchiveFile;
270 QString mHtmlExportFile; 270 QString mHtmlExportFile;
271 bool mHtmlWithSave; 271 bool mHtmlWithSave;
272 272
273 QStringList mSelectedPlugins; 273 QStringList mSelectedPlugins;
274 274
275 QString mLastImportFile; 275 QString mLastImportFile;
276 QString mLastVcalFile; 276 QString mLastVcalFile;
277 QString mLastSaveFile; 277 QString mLastSaveFile;
278 QString mLastLoadFile; 278 QString mLastLoadFile;
279 279
280 280
281 QString mDefaultAlarmFile; 281 QString mDefaultAlarmFile;
282 int mIMIPScheduler; 282 int mIMIPScheduler;
283 int mIMIPSend; 283 int mIMIPSend;
284 QStringList mAdditionalMails; 284 QStringList mAdditionalMails;
285 int mIMIPAutoRefresh; 285 int mIMIPAutoRefresh;
286 int mIMIPAutoInsertReply; 286 int mIMIPAutoInsertReply;
287 int mIMIPAutoInsertRequest; 287 int mIMIPAutoInsertRequest;
288 int mIMIPAutoFreeBusy; 288 int mIMIPAutoFreeBusy;
289 int mIMIPAutoFreeBusyReply; 289 int mIMIPAutoFreeBusyReply;
290 290
291 QStringList mTodoTemplates; 291 QStringList mTodoTemplates;
292 QStringList mEventTemplates; 292 QStringList mEventTemplates;
293 293
294 int mDestination; 294 int mDestination;
295 295
296 296
297 bool mEditOnDoubleClick; 297 bool mEditOnDoubleClick;
298 bool mViewChangeHoldFullscreen; 298 bool mViewChangeHoldFullscreen;
299 bool mViewChangeHoldNonFullscreen; 299 bool mViewChangeHoldNonFullscreen;
300 bool mCenterOnCurrentTime; 300 bool mCenterOnCurrentTime;
301 bool mSetTimeToDayStartAt; 301 bool mSetTimeToDayStartAt;
302 bool mHighlightCurrentDay; 302 bool mHighlightCurrentDay;
303 bool mUseHighlightLightColor; 303 bool mUseHighlightLightColor;
304 bool mListViewMonthTimespan; 304 bool mListViewMonthTimespan;
305 bool mWNViewShowsParents; 305 bool mWNViewShowsParents;
306 bool mWNViewShowsPast; 306 bool mWNViewShowsPast;
307 bool mWNViewShowLocation; 307 bool mWNViewShowLocation;
308 bool mTodoViewShowsPercentage; 308 bool mTodoViewShowsPercentage;
309 bool mTodoViewUsesCatColors; 309 bool mTodoViewUsesCatColors;
310 bool mMonthViewUsesBigFont; 310 bool mMonthViewUsesBigFont;
311 bool mTodoViewUsesSmallFont; 311 bool mTodoViewUsesSmallFont;
312 bool mTodoViewUsesForegroundColor; 312 bool mTodoViewUsesForegroundColor;
313 bool mMonthViewUsesForegroundColor; 313 bool mMonthViewUsesForegroundColor;
314 314
315 bool mHightlightDateTimeEdit; 315 bool mHightlightDateTimeEdit;
316 bool mShortDateInViewer; 316 bool mShortDateInViewer;
317 317
318 bool mShowDateNavigator; 318 bool mShowDateNavigator;
319 319
320 QStringList mLocationDefaults; 320 QStringList mLocationDefaults;
321 QStringList mEventSummaryUser; 321 QStringList mEventSummaryUser;
322 QStringList mTodoSummaryUser; 322 QStringList mTodoSummaryUser;
323 QStringList mJournalSummaryUser; 323 QStringList mJournalSummaryUser;
324 324
325 bool mUseInternalAlarmNotification; 325 bool mUseInternalAlarmNotification;
326 int mAlarmPlayBeeps; 326 int mAlarmPlayBeeps;
327 int mAlarmSuspendTime; 327 int mAlarmSuspendTime;
328 int mAlarmSuspendCount; 328 int mAlarmSuspendCount;
329 int mAlarmBeepInterval; 329 int mAlarmBeepInterval;
330 int mOldLanguage; 330 int mOldLanguage;
331 int mOldLoadedLanguage; 331 int mOldLoadedLanguage;
332 332
333 333
334 QString mActiveSyncPort; 334 QString mActiveSyncPort;
335 QString mActiveSyncIP; 335 QString mActiveSyncIP;
336 336
337 // settings for eventviewer 337 // settings for eventviewer
338 bool mEVshowDetails; 338 bool mEVshowDetails;
339 bool mEVshowCreated; 339 bool mEVshowCreated;
340 bool mEVshowChanged; 340 bool mEVshowChanged;
341 bool mWTshowDetails; 341 bool mWTshowDetails;
342 bool mWTshowCreated; 342 bool mWTshowCreated;
343 bool mWTshowChanged; 343 bool mWTshowChanged;
344 344
345 int mCurrentDisplayedView; 345 int mCurrentDisplayedView;
346 QPtrList<KopiCalendarFile> mCalendars; 346 QPtrList<KopiCalendarFile> mCalendars;
347 int mNextAvailableCalendar; 347 int mNextAvailableCalendar;
348 bool mGlobalUpdateDisabled;
348 349
349 private: 350 private:
350 QDict<QColor> mCategoryColors; 351 QDict<QColor> mCategoryColors;
351 QArray<KopiCalendarFile*> mDefCalColors; 352 QArray<KopiCalendarFile*> mDefCalColors;
352 QColor mDefaultCategoryColor; 353 QColor mDefaultCategoryColor;
353 354
354 QFont mDefaultTimeBarFont; 355 QFont mDefaultTimeBarFont;
355 QFont mDefaultViewFont; 356 QFont mDefaultViewFont;
356 QFont mDefaultMonthViewFont; 357 QFont mDefaultMonthViewFont;
357 358
358 QString mName; 359 QString mName;
359 QString mEmail; 360 QString mEmail;
360}; 361};
361 362
362#endif 363#endif
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 2e32ac2..9cfdc35 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -65,384 +65,388 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
65 //OkButton->setDefault( true ); 65 //OkButton->setDefault( true );
66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); 66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
67 subLayout->addWidget(OkButton); 67 subLayout->addWidget(OkButton);
68 searchEdit = new KLineEdit(topFrame); 68 searchEdit = new KLineEdit(topFrame);
69 subLayout->addWidget(searchEdit); 69 subLayout->addWidget(searchEdit);
70 70
71 mAddItems = new QRadioButton( "+ ", topFrame ); 71 mAddItems = new QRadioButton( "+ ", topFrame );
72 mSubItems = new QRadioButton( "- ", topFrame ); 72 mSubItems = new QRadioButton( "- ", topFrame );
73 mRefineItems = new QRadioButton( "< ", topFrame ); 73 mRefineItems = new QRadioButton( "< ", topFrame );
74 subLayout->addWidget( mAddItems ); 74 subLayout->addWidget( mAddItems );
75 subLayout->addWidget( mSubItems ); 75 subLayout->addWidget( mSubItems );
76 subLayout->addWidget( mRefineItems ); 76 subLayout->addWidget( mRefineItems );
77 QFont fo ( mAddItems->font() ); 77 QFont fo ( mAddItems->font() );
78 fo.setBold( true ); 78 fo.setBold( true );
79 fo.setPointSize( fo.pointSize() + 2 ); 79 fo.setPointSize( fo.pointSize() + 2 );
80 mAddItems->setFont( fo ); 80 mAddItems->setFont( fo );
81 mSubItems->setFont( fo ); 81 mSubItems->setFont( fo );
82 mRefineItems->setFont( fo ); 82 mRefineItems->setFont( fo );
83 connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); 83 connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool )));
84 connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); 84 connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool )));
85 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); 85 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool )));
86 86
87 QPushButton *togButton = new QPushButton( "", topFrame ); 87 QPushButton *togButton = new QPushButton( "", topFrame );
88 subLayout->addWidget(togButton); 88 subLayout->addWidget(togButton);
89 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); 89 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes()));
90 togButton->setPixmap(SmallIcon("1updownarrow")); 90 togButton->setPixmap(SmallIcon("1updownarrow"));
91 togButton->setMinimumWidth( togButton->sizeHint().height() ); 91 togButton->setMinimumWidth( togButton->sizeHint().height() );
92 92
93 searchEdit->setText("*"); // Find all events by default 93 searchEdit->setText("*"); // Find all events by default
94 searchEdit->setFocus(); 94 searchEdit->setFocus();
95 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 95 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
96 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 96 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
97 // Subjects to search 97 // Subjects to search
98 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 98 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
99 // topFrame); 99 // topFrame);
100 100
101 incidenceGroup = new QHBox( topFrame ); 101 incidenceGroup = new QHBox( topFrame );
102 layout->addWidget(incidenceGroup); 102 layout->addWidget(incidenceGroup);
103 103
104 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 104 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
105 //mSearchEvent->setChecked(true); 105 //mSearchEvent->setChecked(true);
106 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 106 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
107 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 107 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
108 108
109 subjectGroup = new QHBox( topFrame ); 109 subjectGroup = new QHBox( topFrame );
110 layout->addWidget(subjectGroup); 110 layout->addWidget(subjectGroup);
111 111
112 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); 112 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
113 mSummaryCheck->setChecked(true); 113 mSummaryCheck->setChecked(true);
114 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); 114 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
115 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 115 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
116 116
117 attendeeGroup = new QHBox( topFrame ); 117 attendeeGroup = new QHBox( topFrame );
118 layout->addWidget(attendeeGroup ); 118 layout->addWidget(attendeeGroup );
119 new QLabel( i18n("Attendee:"),attendeeGroup ); 119 new QLabel( i18n("Attendee:"),attendeeGroup );
120 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 120 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
121 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 121 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
122 // Date range 122 // Date range
123 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 123 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
124 // topFrame); 124 // topFrame);
125 // layout->addWidget(rangeGroup); 125 // layout->addWidget(rangeGroup);
126 126
127 QWidget *rangeWidget = new QWidget(topFrame); 127 QWidget *rangeWidget = new QWidget(topFrame);
128 int space = KDialog::spacingHint(); 128 int space = KDialog::spacingHint();
129 if ( QApplication::desktop()->width() <= 240 ) space = 1; 129 if ( QApplication::desktop()->width() <= 240 ) space = 1;
130 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space); 130 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space);
131 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 131 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
132 mStartDate = new KDateEdit(rangeWidget); 132 mStartDate = new KDateEdit(rangeWidget);
133 rangeLayout->addWidget(mStartDate); 133 rangeLayout->addWidget(mStartDate);
134 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 134 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
135 mEndDate = new KDateEdit(rangeWidget); 135 mEndDate = new KDateEdit(rangeWidget);
136 mEndDate->setDate(QDate::currentDate().addDays(365)); 136 mEndDate->setDate(QDate::currentDate().addDays(365));
137 rangeLayout->addWidget(mEndDate); 137 rangeLayout->addWidget(mEndDate);
138 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 138 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
139 rangeLayout->addWidget( (QWidget*)wt ); 139 rangeLayout->addWidget( (QWidget*)wt );
140 layout->addWidget(rangeWidget); 140 layout->addWidget(rangeWidget);
141 // Results list view 141 // Results list view
142 listView = new KOListView(mCalendar,topFrame); 142 listView = new KOListView(mCalendar,topFrame);
143 layout->addWidget(listView); 143 layout->addWidget(listView);
144 listView->showCompletedTodos(); 144 listView->showCompletedTodos();
145 //layout->setStretchFactor( listView, 333 ); 145 //layout->setStretchFactor( listView, 333 );
146 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); 146 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
147 //listView->setMaximumHeight( 50 ); 147 //listView->setMaximumHeight( 50 );
148 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 148 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
149 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 149 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
150 150
151 setCaption( i18n("KO/Pi Find: ")); 151 setCaption( i18n("KO/Pi Find: "));
152#ifdef DESKTOP_VERSION 152#ifdef DESKTOP_VERSION
153 OkButton = new QPushButton( i18n("Close"), this ); 153 OkButton = new QPushButton( i18n("Close"), this );
154 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 154 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
155#endif 155#endif
156} 156}
157 157
158SearchDialog::~SearchDialog() 158SearchDialog::~SearchDialog()
159{ 159{
160 160
161} 161}
162void SearchDialog::slot_add( bool b ) 162void SearchDialog::slot_add( bool b )
163{ 163{
164 if ( b ) { 164 if ( b ) {
165 if ( mSubItems->isOn() ) mSubItems->toggle(); 165 if ( mSubItems->isOn() ) mSubItems->toggle();
166 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 166 if ( mRefineItems->isOn() ) mRefineItems->toggle();
167 setCaption( i18n("Matching items will be added to list")); 167 setCaption( i18n("Matching items will be added to list"));
168 } else 168 } else
169 setCaption( i18n("List will be cleared before search")); 169 setCaption( i18n("List will be cleared before search"));
170} 170}
171void SearchDialog::slot_sub( bool b) 171void SearchDialog::slot_sub( bool b)
172{ 172{
173 if ( b ) { 173 if ( b ) {
174 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 174 if ( mRefineItems->isOn() ) mRefineItems->toggle();
175 if ( mAddItems->isOn() ) mAddItems->toggle(); 175 if ( mAddItems->isOn() ) mAddItems->toggle();
176 setCaption( i18n("Matching items will be removed from list")); 176 setCaption( i18n("Matching items will be removed from list"));
177 } else 177 } else
178 setCaption( i18n("List will be cleared before search")); 178 setCaption( i18n("List will be cleared before search"));
179} 179}
180void SearchDialog::slot_refine( bool b) 180void SearchDialog::slot_refine( bool b)
181{ 181{
182 if ( b ) { 182 if ( b ) {
183 if ( mSubItems->isOn() ) mSubItems->toggle(); 183 if ( mSubItems->isOn() ) mSubItems->toggle();
184 if ( mAddItems->isOn() ) mAddItems->toggle(); 184 if ( mAddItems->isOn() ) mAddItems->toggle();
185 setCaption( i18n("Search on displayed list only")); 185 setCaption( i18n("Search on displayed list only"));
186 } else 186 } else
187 setCaption( i18n("List will be cleared before search")); 187 setCaption( i18n("List will be cleared before search"));
188} 188}
189void SearchDialog::toggleCheckboxes() 189void SearchDialog::toggleCheckboxes()
190{ 190{
191 if ( incidenceGroup->isVisible() ) { 191 if ( incidenceGroup->isVisible() ) {
192 incidenceGroup->hide() ; 192 incidenceGroup->hide() ;
193 subjectGroup->hide() ; 193 subjectGroup->hide() ;
194 attendeeGroup->hide() ; 194 attendeeGroup->hide() ;
195 } else { 195 } else {
196 incidenceGroup->show() ; 196 incidenceGroup->show() ;
197 subjectGroup->show() ; 197 subjectGroup->show() ;
198 attendeeGroup->show() ; 198 attendeeGroup->show() ;
199 } 199 }
200} 200}
201void SearchDialog::raiseAndSelect() 201void SearchDialog::raiseAndSelect()
202{ 202{
203 203
204 static int currentState = 0; 204 static int currentState = 0;
205 205
206 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) 206 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() )
207 currentState = 0; 207 currentState = 0;
208 int newState = 0; 208 int newState = 0;
209 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 209 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
210 newState = VIEW_J_VIEW; 210 newState = VIEW_J_VIEW;
211 } 211 }
212 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 212 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
213 newState = VIEW_T_VIEW; 213 newState = VIEW_T_VIEW;
214 } 214 }
215 else { 215 else {
216 newState = VIEW_A_VIEW; 216 newState = VIEW_A_VIEW;
217 } 217 }
218 if ( newState != currentState ) { 218 if ( newState != currentState ) {
219 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 219 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
220 if ( ! mSearchJournal->isChecked() ) { 220 if ( ! mSearchJournal->isChecked() ) {
221 mSearchJournal->setChecked( true ); 221 mSearchJournal->setChecked( true );
222 mSearchTodo->setChecked( false ); 222 mSearchTodo->setChecked( false );
223 mSearchEvent->setChecked( false ); 223 mSearchEvent->setChecked( false );
224 mSummaryCheck->setChecked( true ); 224 mSummaryCheck->setChecked( true );
225 mDescriptionCheck->setChecked( true ); 225 mDescriptionCheck->setChecked( true );
226 226
227 } 227 }
228 } 228 }
229 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 229 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
230 if ( ! mSearchTodo->isChecked() ) { 230 if ( ! mSearchTodo->isChecked() ) {
231 mSearchTodo->setChecked( true ); 231 mSearchTodo->setChecked( true );
232 mSearchJournal->setChecked( false ); 232 mSearchJournal->setChecked( false );
233 mSearchEvent->setChecked( false ); 233 mSearchEvent->setChecked( false );
234 } 234 }
235 } 235 }
236 else { 236 else {
237 if ( ! mSearchEvent->isChecked() ) { 237 if ( ! mSearchEvent->isChecked() ) {
238 mSearchEvent->setChecked( true ); 238 mSearchEvent->setChecked( true );
239 mSearchJournal->setChecked( false ); 239 mSearchJournal->setChecked( false );
240 mSearchTodo->setChecked( false ); 240 mSearchTodo->setChecked( false );
241 } 241 }
242 } 242 }
243 } 243 }
244 currentState = newState; 244 currentState = newState;
245 raise(); 245 raise();
246} 246}
247void SearchDialog::setFocusToList() 247void SearchDialog::setFocusToList()
248{ 248{
249 listView->resetFocus(); 249 listView->resetFocus();
250} 250}
251void SearchDialog::accept() 251void SearchDialog::accept()
252{ 252{
253 doSearch(); 253 doSearch();
254} 254}
255void SearchDialog::updateList() 255void SearchDialog::updateList()
256{ 256{
257 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
258 listView->clear();
259 return;
260 }
257 //listView->updateList(); 261 //listView->updateList();
258 if ( isVisible() ) { 262 if ( isVisible() ) {
259 updateView(); 263 updateView();
260 //qDebug("SearchDialog::updated "); 264 //qDebug("SearchDialog::updated ");
261 } 265 }
262 else { 266 else {
263 listView->clear(); 267 listView->clear();
264 //qDebug("SearchDialog::cleared "); 268 //qDebug("SearchDialog::cleared ");
265 269
266 } 270 }
267} 271}
268void SearchDialog::searchTextChanged( const QString &_text ) 272void SearchDialog::searchTextChanged( const QString &_text )
269{ 273{
270#if 0 274#if 0
271 enableButton( KDialogBase::User1, !_text.isEmpty() ); 275 enableButton( KDialogBase::User1, !_text.isEmpty() );
272#endif 276#endif
273} 277}
274 278
275void SearchDialog::doSearch() 279void SearchDialog::doSearch()
276{ 280{
277 QRegExp re; 281 QRegExp re;
278 re.setWildcard(true); // most people understand these better. 282 re.setWildcard(true); // most people understand these better.
279 re.setCaseSensitive(false); 283 re.setCaseSensitive(false);
280 QString st = searchEdit->text(); 284 QString st = searchEdit->text();
281 if ( st.right(1) != "*") 285 if ( st.right(1) != "*")
282 st += "*"; 286 st += "*";
283 re.setPattern(st); 287 re.setPattern(st);
284 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { 288 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) {
285 KMessageBox::sorry(this, 289 KMessageBox::sorry(this,
286 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); 290 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals"));
287 return; 291 return;
288 } 292 }
289 if (!re.isValid() ) { 293 if (!re.isValid() ) {
290 KMessageBox::sorry(this, 294 KMessageBox::sorry(this,
291 i18n("Invalid search expression,\ncannot perform " 295 i18n("Invalid search expression,\ncannot perform "
292 "the search.\nPlease enter a search expression\n" 296 "the search.\nPlease enter a search expression\n"
293 "using the wildcard characters\n '*' and '?'" 297 "using the wildcard characters\n '*' and '?'"
294 "where needed.")); 298 "where needed."));
295 return; 299 return;
296 } 300 }
297 search(re); 301 search(re);
298 listView->setStartDate( mStartDate->date() ); 302 listView->setStartDate( mStartDate->date() );
299 listView->showEvents(mMatchedEvents); 303 listView->showEvents(mMatchedEvents);
300 listView->addTodos(mMatchedTodos); 304 listView->addTodos(mMatchedTodos);
301 listView->addJournals(mMatchedJournals); 305 listView->addJournals(mMatchedJournals);
302 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 306 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
303 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 307 setCaption(i18n("No items found. Use '*' and '?' where needed."));
304 } else { 308 } else {
305 QString mess; 309 QString mess;
306 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 310 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
307 setCaption( i18n("KO/Pi Find: ") + mess); 311 setCaption( i18n("KO/Pi Find: ") + mess);
308 312
309 } 313 }
310 searchEdit->setFocus(); 314 searchEdit->setFocus();
311} 315}
312void SearchDialog::updateConfig() 316void SearchDialog::updateConfig()
313{ 317{
314 listView->updateConfig(); 318 listView->updateConfig();
315} 319}
316void SearchDialog::updateView() 320void SearchDialog::updateView()
317{ 321{
318 //qDebug("SearchDialog::updateView() %d ", isVisible()); 322 //qDebug("SearchDialog::updateView() %d ", isVisible());
319 QRegExp re; 323 QRegExp re;
320 re.setWildcard(true); // most people understand these better. 324 re.setWildcard(true); // most people understand these better.
321 re.setCaseSensitive(false); 325 re.setCaseSensitive(false);
322 QString st = searchEdit->text(); 326 QString st = searchEdit->text();
323 if ( st.right(1) != "*") 327 if ( st.right(1) != "*")
324 st += "*"; 328 st += "*";
325 re.setPattern(st); 329 re.setPattern(st);
326 mMatchedEvents.clear(); 330 mMatchedEvents.clear();
327 mMatchedTodos.clear(); 331 mMatchedTodos.clear();
328 mMatchedJournals.clear(); 332 mMatchedJournals.clear();
329 if (re.isValid()) { 333 if (re.isValid()) {
330 search(re); 334 search(re);
331 } 335 }
332 listView->setStartDate( mStartDate->date() ); 336 listView->setStartDate( mStartDate->date() );
333 listView->showEvents(mMatchedEvents); 337 listView->showEvents(mMatchedEvents);
334 listView->addTodos(mMatchedTodos); 338 listView->addTodos(mMatchedTodos);
335 listView->addJournals(mMatchedJournals); 339 listView->addJournals(mMatchedJournals);
336} 340}
337 341
338void SearchDialog::search(const QRegExp &re) 342void SearchDialog::search(const QRegExp &re)
339{ 343{
340 QPtrList<Event> events; 344 QPtrList<Event> events;
341 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 345 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
342 if ( mRefineItems->isChecked() ) events = mMatchedEvents; 346 if ( mRefineItems->isChecked() ) events = mMatchedEvents;
343 mMatchedEvents.clear(); 347 mMatchedEvents.clear();
344 } 348 }
345 if ( mSearchEvent->isChecked() ) { 349 if ( mSearchEvent->isChecked() ) {
346 if ( !mRefineItems->isChecked() ) 350 if ( !mRefineItems->isChecked() )
347 events = mCalendar->events( mStartDate->date(), 351 events = mCalendar->events( mStartDate->date(),
348 mEndDate->date(), 352 mEndDate->date(),
349 false /*mInclusiveCheck->isChecked()*/ ); 353 false /*mInclusiveCheck->isChecked()*/ );
350 354
351 355
352 Event *ev; 356 Event *ev;
353 for(ev=events.first();ev;ev=events.next()) { 357 for(ev=events.first();ev;ev=events.next()) {
354 if (mSummaryCheck->isChecked()) { 358 if (mSummaryCheck->isChecked()) {
355#if QT_VERSION >= 0x030000 359#if QT_VERSION >= 0x030000
356 if (re.search(ev->summary()) != -1) 360 if (re.search(ev->summary()) != -1)
357#else 361#else
358 if (re.match(ev->summary()) != -1) 362 if (re.match(ev->summary()) != -1)
359#endif 363#endif
360 { 364 {
361 if ( mSubItems->isChecked() ) 365 if ( mSubItems->isChecked() )
362 mMatchedEvents.remove(ev); 366 mMatchedEvents.remove(ev);
363 else { 367 else {
364 if ( !mMatchedEvents.contains( ev ) ) 368 if ( !mMatchedEvents.contains( ev ) )
365 mMatchedEvents.append(ev); 369 mMatchedEvents.append(ev);
366 } 370 }
367 continue; 371 continue;
368 } 372 }
369#if QT_VERSION >= 0x030000 373#if QT_VERSION >= 0x030000
370 if (re.search(ev->location()) != -1) 374 if (re.search(ev->location()) != -1)
371#else 375#else
372 if (re.match(ev->location()) != -1) 376 if (re.match(ev->location()) != -1)
373#endif 377#endif
374 { 378 {
375 if ( mSubItems->isChecked() ) 379 if ( mSubItems->isChecked() )
376 mMatchedEvents.remove(ev); 380 mMatchedEvents.remove(ev);
377 else{ 381 else{
378 if ( !mMatchedEvents.contains( ev ) ) 382 if ( !mMatchedEvents.contains( ev ) )
379 mMatchedEvents.append(ev); 383 mMatchedEvents.append(ev);
380 } 384 }
381 continue; 385 continue;
382 } 386 }
383 } 387 }
384 if (mDescriptionCheck->isChecked()) { 388 if (mDescriptionCheck->isChecked()) {
385#if QT_VERSION >= 0x030000 389#if QT_VERSION >= 0x030000
386 if (re.search(ev->description()) != -1) 390 if (re.search(ev->description()) != -1)
387#else 391#else
388 if (re.match(ev->description()) != -1) 392 if (re.match(ev->description()) != -1)
389#endif 393#endif
390 { 394 {
391 if ( mSubItems->isChecked() ) 395 if ( mSubItems->isChecked() )
392 mMatchedEvents.remove(ev); 396 mMatchedEvents.remove(ev);
393 else{ 397 else{
394 if ( !mMatchedEvents.contains( ev ) ) 398 if ( !mMatchedEvents.contains( ev ) )
395 mMatchedEvents.append(ev); 399 mMatchedEvents.append(ev);
396 } 400 }
397 continue; 401 continue;
398 } 402 }
399 } 403 }
400 if (mCategoryCheck->isChecked()) { 404 if (mCategoryCheck->isChecked()) {
401#if QT_VERSION >= 0x030000 405#if QT_VERSION >= 0x030000
402 if (re.search(ev->categoriesStr()) != -1) 406 if (re.search(ev->categoriesStr()) != -1)
403#else 407#else
404 if (re.match(ev->categoriesStr()) != -1) 408 if (re.match(ev->categoriesStr()) != -1)
405#endif 409#endif
406 { 410 {
407 411
408 if ( mSubItems->isChecked() ) 412 if ( mSubItems->isChecked() )
409 mMatchedEvents.remove(ev); 413 mMatchedEvents.remove(ev);
410 else{ 414 else{
411 if ( !mMatchedEvents.contains( ev ) ) 415 if ( !mMatchedEvents.contains( ev ) )
412 mMatchedEvents.append(ev); 416 mMatchedEvents.append(ev);
413 } 417 }
414 continue; 418 continue;
415 } 419 }
416 } 420 }
417 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 421 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
418 QPtrList<Attendee> tmpAList = ev->attendees(); 422 QPtrList<Attendee> tmpAList = ev->attendees();
419 Attendee *a; 423 Attendee *a;
420 for (a = tmpAList.first(); a; a = tmpAList.next()) { 424 for (a = tmpAList.first(); a; a = tmpAList.next()) {
421 if (mSearchAName->isChecked()) { 425 if (mSearchAName->isChecked()) {
422#if QT_VERSION >= 0x030000 426#if QT_VERSION >= 0x030000
423 if (re.search(a->name()) != -1) 427 if (re.search(a->name()) != -1)
424#else 428#else
425 if (re.match(a->name()) != -1) 429 if (re.match(a->name()) != -1)
426#endif 430#endif
427 { 431 {
428 if ( mSubItems->isChecked() ) 432 if ( mSubItems->isChecked() )
429 mMatchedEvents.remove(ev); 433 mMatchedEvents.remove(ev);
430 else{ 434 else{
431 if ( !mMatchedEvents.contains( ev ) ) 435 if ( !mMatchedEvents.contains( ev ) )
432 mMatchedEvents.append(ev); 436 mMatchedEvents.append(ev);
433 } 437 }
434 break; 438 break;
435 } 439 }
436 } 440 }
437 if (mSearchAEmail->isChecked()) { 441 if (mSearchAEmail->isChecked()) {
438#if QT_VERSION >= 0x030000 442#if QT_VERSION >= 0x030000
439 if (re.search(a->email()) != -1) 443 if (re.search(a->email()) != -1)
440#else 444#else
441 if (re.match(a->email()) != -1) 445 if (re.match(a->email()) != -1)
442#endif 446#endif
443 { 447 {
444 if ( mSubItems->isChecked() ) 448 if ( mSubItems->isChecked() )
445 mMatchedEvents.remove(ev); 449 mMatchedEvents.remove(ev);
446 else{ 450 else{
447 if ( !mMatchedEvents.contains( ev ) ) 451 if ( !mMatchedEvents.contains( ev ) )
448 mMatchedEvents.append(ev); 452 mMatchedEvents.append(ev);