summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-07 22:42:31 (UTC)
committer zautrix <zautrix>2005-07-07 22:42:31 (UTC)
commit9635c9a7b8f5c19a1784079d4b67cb3ca600fc33 (patch) (unidiff)
tree55a23c20f4092409a1dd2c34cecf6bdb7341a04b
parent876816e6582299d527610e847d259d2be6de403c (diff)
downloadkdepimpi-9635c9a7b8f5c19a1784079d4b67cb3ca600fc33.zip
kdepimpi-9635c9a7b8f5c19a1784079d4b67cb3ca600fc33.tar.gz
kdepimpi-9635c9a7b8f5c19a1784079d4b67cb3ca600fc33.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 2582931..68d1bc6 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2622,301 +2622,300 @@ void CalendarView::writeFilterSettings(KConfig *config)
2622 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2622 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2623} 2623}
2624 2624
2625 2625
2626void CalendarView::goToday() 2626void CalendarView::goToday()
2627{ 2627{
2628 if ( mViewManager->currentView()->isMonthView() ) 2628 if ( mViewManager->currentView()->isMonthView() )
2629 mNavigator->selectTodayMonth(); 2629 mNavigator->selectTodayMonth();
2630 else 2630 else
2631 mNavigator->selectToday(); 2631 mNavigator->selectToday();
2632} 2632}
2633 2633
2634void CalendarView::goNext() 2634void CalendarView::goNext()
2635{ 2635{
2636 mNavigator->selectNext(); 2636 mNavigator->selectNext();
2637} 2637}
2638 2638
2639void CalendarView::goPrevious() 2639void CalendarView::goPrevious()
2640{ 2640{
2641 mNavigator->selectPrevious(); 2641 mNavigator->selectPrevious();
2642} 2642}
2643void CalendarView::goNextMonth() 2643void CalendarView::goNextMonth()
2644{ 2644{
2645 mNavigator->selectNextMonth(); 2645 mNavigator->selectNextMonth();
2646} 2646}
2647 2647
2648void CalendarView::goPreviousMonth() 2648void CalendarView::goPreviousMonth()
2649{ 2649{
2650 mNavigator->selectPreviousMonth(); 2650 mNavigator->selectPreviousMonth();
2651} 2651}
2652 2652
2653void CalendarView::updateConfig() 2653void CalendarView::updateConfig()
2654{ 2654{
2655 if ( KOPrefs::instance()->mUseAppColors ) 2655 if ( KOPrefs::instance()->mUseAppColors )
2656 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2656 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2657 emit configChanged(); 2657 emit configChanged();
2658 mTodoList->updateConfig(); 2658 mTodoList->updateConfig();
2659 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2659 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2660 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2660 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2661 // To make the "fill window" configurations work 2661 // To make the "fill window" configurations work
2662 //mViewManager->raiseCurrentView(); 2662 //mViewManager->raiseCurrentView();
2663} 2663}
2664 2664
2665 2665
2666void CalendarView::eventChanged(Event *event) 2666void CalendarView::eventChanged(Event *event)
2667{ 2667{
2668 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2668 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2669 //updateUnmanagedViews(); 2669 //updateUnmanagedViews();
2670} 2670}
2671 2671
2672void CalendarView::eventAdded(Event *event) 2672void CalendarView::eventAdded(Event *event)
2673{ 2673{
2674 changeEventDisplay(event,KOGlobals::EVENTADDED); 2674 changeEventDisplay(event,KOGlobals::EVENTADDED);
2675} 2675}
2676 2676
2677void CalendarView::eventToBeDeleted(Event *) 2677void CalendarView::eventToBeDeleted(Event *)
2678{ 2678{
2679 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2679 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2680} 2680}
2681 2681
2682void CalendarView::eventDeleted() 2682void CalendarView::eventDeleted()
2683{ 2683{
2684 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2684 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2685} 2685}
2686void CalendarView::changeTodoDisplay(Todo *which, int action) 2686void CalendarView::changeTodoDisplay(Todo *which, int action)
2687{ 2687{
2688 changeIncidenceDisplay((Incidence *)which, action); 2688 changeIncidenceDisplay((Incidence *)which, action);
2689 mDateNavigator->updateView(); //LR 2689 mDateNavigator->updateView(); //LR
2690 //mDialogManager->updateSearchDialog(); 2690 //mDialogManager->updateSearchDialog();
2691 2691
2692 if (which) { 2692 if (which) {
2693 mViewManager->updateWNview(); 2693 mViewManager->updateWNview();
2694 //mTodoList->updateView(); 2694 //mTodoList->updateView();
2695 } 2695 }
2696 2696
2697} 2697}
2698 2698
2699void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2699void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2700{ 2700{
2701 updateUnmanagedViews(); 2701 updateUnmanagedViews();
2702 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2702 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2703 if ( action == KOGlobals::EVENTDELETED ) { //delete 2703 if ( action == KOGlobals::EVENTDELETED ) { //delete
2704 mCalendar->checkAlarmForIncidence( 0, true ); 2704 mCalendar->checkAlarmForIncidence( 0, true );
2705 if ( mEventViewerDialog ) 2705 if ( mEventViewerDialog )
2706 mEventViewerDialog->hide(); 2706 mEventViewerDialog->hide();
2707 } 2707 }
2708 else 2708 else
2709 mCalendar->checkAlarmForIncidence( which , false ); 2709 mCalendar->checkAlarmForIncidence( which , false );
2710} 2710}
2711 2711
2712// most of the changeEventDisplays() right now just call the view's 2712// most of the changeEventDisplays() right now just call the view's
2713// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2713// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2714void CalendarView::changeEventDisplay(Event *which, int action) 2714void CalendarView::changeEventDisplay(Event *which, int action)
2715{ 2715{
2716 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2716 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2717 changeIncidenceDisplay((Incidence *)which, action); 2717 changeIncidenceDisplay((Incidence *)which, action);
2718 static bool clearallviews = false; 2718 static bool clearallviews = false;
2719 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2719 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2720 if ( clearallviews ) { 2720 if ( clearallviews ) {
2721 clearAllViews(); 2721 clearAllViews();
2722 clearallviews = false; 2722 clearallviews = false;
2723 } 2723 }
2724 return; 2724 return;
2725 } 2725 }
2726 clearallviews = true; 2726 clearallviews = true;
2727 mDateNavigator->updateView(); 2727 mDateNavigator->updateView();
2728 //mDialogManager->updateSearchDialog(); 2728 //mDialogManager->updateSearchDialog();
2729 if (which) { 2729 if (which) {
2730 // If there is an event view visible update the display 2730 // If there is an event view visible update the display
2731 mViewManager->currentView()->changeEventDisplay(which,action); 2731 mViewManager->currentView()->changeEventDisplay(which,action);
2732 // TODO: check, if update needed 2732 // TODO: check, if update needed
2733 // if (which->getTodoStatus()) { 2733 // if (which->getTodoStatus()) {
2734 mTodoList->updateView(); 2734 mTodoList->updateView();
2735 if ( action != KOGlobals::EVENTDELETED ) { 2735 if ( action != KOGlobals::EVENTDELETED ) {
2736 mConflictingEvent = which ; 2736 mConflictingEvent = which ;
2737 QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); 2737 QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) );
2738 } 2738 }
2739 // } 2739 // }
2740 } else { 2740 } else {
2741 mViewManager->currentView()->updateView(); 2741 mViewManager->currentView()->updateView();
2742 } 2742 }
2743} 2743}
2744void CalendarView::checkConflictForEvent() 2744void CalendarView::checkConflictForEvent()
2745{ 2745{
2746 2746
2747 if (!KOPrefs::instance()->mConfirm) 2747 if (!KOPrefs::instance()->mConfirm)
2748 return; 2748 return;
2749 if ( ! mConflictingEvent ) return; 2749 if ( ! mConflictingEvent ) return;
2750 if ( mConflictingEvent->doesFloat() ) { 2750 if ( mConflictingEvent->isHoliday() || mConflictingEvent->isBirthday() || mConflictingEvent->isAnniversary() ) {
2751 mConflictingEvent = 0; 2751 mConflictingEvent = 0;
2752 return; 2752 return;
2753 } 2753 }
2754 QPtrList<Event> testlist = mCalendar->events(); 2754 QPtrList<Event> testlist = mCalendar->events();
2755 Event * test = testlist.first(); 2755 Event * test = testlist.first();
2756 QDateTime conflict; 2756 QDateTime conflict;
2757 QDateTime retVal; 2757 QDateTime retVal;
2758 bool found = false; 2758 bool found = false;
2759 Event * cE = 0; 2759 Event * cE = 0;
2760 QDateTime current = QDateTime::currentDateTime(); 2760 QDateTime current = QDateTime::currentDateTime();
2761 while ( test ) { 2761 while ( test ) {
2762 if ( !test->doesFloat() ) { 2762 if ( !test->doesFloat() ) {
2763 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) { 2763 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
2764 if ( ! found ) { 2764 if ( ! found ) {
2765 conflict = retVal; 2765 conflict = retVal;
2766 cE = test; 2766 cE = test;
2767 } else { 2767 } else {
2768 if ( retVal < conflict ) { 2768 if ( retVal < conflict ) {
2769 conflict = retVal; 2769 conflict = retVal;
2770 cE = test; 2770 cE = test;
2771 } 2771 }
2772 } 2772 }
2773 found = true; 2773 found = true;
2774 } 2774 }
2775 } 2775 }
2776 test = testlist.next(); 2776 test = testlist.next();
2777 } 2777 }
2778 if ( found ) { 2778 if ( found ) {
2779 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; 2779 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ;
2780 qApp->processEvents(); 2780 qApp->processEvents();
2781 int km = KMessageBox::warningContinueCancel(this,mess, 2781 int km = KMessageBox::warningContinueCancel(this,mess,
2782 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); 2782 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
2783 if ( km != KMessageBox::Continue ) 2783 if ( km != KMessageBox::Continue )
2784 return; 2784 return;
2785 2785
2786 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 2786 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
2787 mViewManager->showDayView(); 2787 mViewManager->showDayView();
2788 mNavigator->slotDaySelect( conflict.date() ); 2788 mNavigator->slotDaySelect( conflict.date() );
2789 int hour = conflict.time().hour(); 2789 int hour = conflict.time().hour();
2790 mViewManager->agendaView()->setStartHour( hour ); 2790 mViewManager->agendaView()->setStartHour( hour );
2791 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 2791 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
2792 return;
2793 } 2792 }
2794 2793 mConflictingEvent = 0;
2795 return; 2794 return;
2796 2795
2797} 2796}
2798 2797
2799void CalendarView::updateTodoViews() 2798void CalendarView::updateTodoViews()
2800{ 2799{
2801 mTodoList->updateView(); 2800 mTodoList->updateView();
2802 mViewManager->currentView()->updateView(); 2801 mViewManager->currentView()->updateView();
2803 2802
2804} 2803}
2805 2804
2806 2805
2807 2806
2808void CalendarView::clearAllViews() 2807void CalendarView::clearAllViews()
2809{ 2808{
2810 mTodoList->clearList(); 2809 mTodoList->clearList();
2811 mViewManager->clearAllViews(); 2810 mViewManager->clearAllViews();
2812 SearchDialog * sd = mDialogManager->getSearchDialog(); 2811 SearchDialog * sd = mDialogManager->getSearchDialog();
2813 if ( sd ) { 2812 if ( sd ) {
2814 KOListView* kol = sd->listview(); 2813 KOListView* kol = sd->listview();
2815 if ( kol ) 2814 if ( kol )
2816 kol->clearList(); 2815 kol->clearList();
2817 } 2816 }
2818} 2817}
2819void CalendarView::updateView() 2818void CalendarView::updateView()
2820{ 2819{
2821 static bool clearallviews = false; 2820 static bool clearallviews = false;
2822 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2821 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2823 if ( clearallviews ) { 2822 if ( clearallviews ) {
2824 clearAllViews(); 2823 clearAllViews();
2825 clearallviews = false; 2824 clearallviews = false;
2826 } 2825 }
2827 return; 2826 return;
2828 } 2827 }
2829 clearallviews = true; 2828 clearallviews = true;
2830 DateList tmpList = mNavigator->selectedDates(); 2829 DateList tmpList = mNavigator->selectedDates();
2831 2830
2832 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2831 if ( KOPrefs::instance()->mHideNonStartedTodos )
2833 mTodoList->updateView(); 2832 mTodoList->updateView();
2834 // We assume that the navigator only selects consecutive days. 2833 // We assume that the navigator only selects consecutive days.
2835 updateView( tmpList.first(), tmpList.last() ); 2834 updateView( tmpList.first(), tmpList.last() );
2836} 2835}
2837 2836
2838void CalendarView::updateUnmanagedViews() 2837void CalendarView::updateUnmanagedViews()
2839{ 2838{
2840 mDateNavigator->updateDayMatrix(); 2839 mDateNavigator->updateDayMatrix();
2841} 2840}
2842 2841
2843int CalendarView::msgItemDelete(const QString name) 2842int CalendarView::msgItemDelete(const QString name)
2844{ 2843{
2845 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2844 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2846 i18n("This item will be\npermanently deleted."), 2845 i18n("This item will be\npermanently deleted."),
2847 i18n("KO/Pi Confirmation"),i18n("Delete")); 2846 i18n("KO/Pi Confirmation"),i18n("Delete"));
2848} 2847}
2849 2848
2850 2849
2851void CalendarView::edit_cut() 2850void CalendarView::edit_cut()
2852{ 2851{
2853 Event *anEvent=0; 2852 Event *anEvent=0;
2854 2853
2855 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2854 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2856 2855
2857 if (mViewManager->currentView()->isEventView()) { 2856 if (mViewManager->currentView()->isEventView()) {
2858 if ( incidence && incidence->typeID() == eventID ) { 2857 if ( incidence && incidence->typeID() == eventID ) {
2859 anEvent = static_cast<Event *>(incidence); 2858 anEvent = static_cast<Event *>(incidence);
2860 } 2859 }
2861 } 2860 }
2862 2861
2863 if (!anEvent) { 2862 if (!anEvent) {
2864 KNotifyClient::beep(); 2863 KNotifyClient::beep();
2865 return; 2864 return;
2866 } 2865 }
2867 DndFactory factory( mCalendar ); 2866 DndFactory factory( mCalendar );
2868 factory.cutIncidence(anEvent); 2867 factory.cutIncidence(anEvent);
2869 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2868 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2870} 2869}
2871 2870
2872void CalendarView::edit_copy() 2871void CalendarView::edit_copy()
2873{ 2872{
2874 Event *anEvent=0; 2873 Event *anEvent=0;
2875 2874
2876 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2875 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2877 2876
2878 if (mViewManager->currentView()->isEventView()) { 2877 if (mViewManager->currentView()->isEventView()) {
2879 if ( incidence && incidence->typeID() == eventID ) { 2878 if ( incidence && incidence->typeID() == eventID ) {
2880 anEvent = static_cast<Event *>(incidence); 2879 anEvent = static_cast<Event *>(incidence);
2881 } 2880 }
2882 } 2881 }
2883 2882
2884 if (!anEvent) { 2883 if (!anEvent) {
2885 KNotifyClient::beep(); 2884 KNotifyClient::beep();
2886 return; 2885 return;
2887 } 2886 }
2888 DndFactory factory( mCalendar ); 2887 DndFactory factory( mCalendar );
2889 factory.copyIncidence(anEvent); 2888 factory.copyIncidence(anEvent);
2890} 2889}
2891 2890
2892void CalendarView::edit_paste() 2891void CalendarView::edit_paste()
2893{ 2892{
2894 QDate date = mNavigator->selectedDates().first(); 2893 QDate date = mNavigator->selectedDates().first();
2895 2894
2896 DndFactory factory( mCalendar ); 2895 DndFactory factory( mCalendar );
2897 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2896 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2898 2897
2899 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2898 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2900} 2899}
2901void CalendarView::edit_global_options() 2900void CalendarView::edit_global_options()
2902{ 2901{
2903 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2902 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2904 emit save(); 2903 emit save();
2905 emit saveStopTimer(); 2904 emit saveStopTimer();
2906 mDialogManager->showGlobalOptionsDialog(); 2905 mDialogManager->showGlobalOptionsDialog();
2907 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2906 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2908 emit saveStopTimer(); 2907 emit saveStopTimer();
2909 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2908 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2910 i18n("Timezone settings"),i18n("Reload"))) { 2909 i18n("Timezone settings"),i18n("Reload"))) {
2911 qDebug("KO: TZ reload cancelled "); 2910 qDebug("KO: TZ reload cancelled ");
2912 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2911 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2913 return; 2912 return;
2914 } 2913 }
2915 qDebug("KO: Timezone change "); 2914 qDebug("KO: Timezone change ");
2916 loadCalendars(); 2915 loadCalendars();
2917 setModified(true); 2916 setModified(true);
2918 } 2917 }
2919 else 2918 else
2920 qDebug("KO: No tz change "); 2919 qDebug("KO: No tz change ");
2921} 2920}
2922void CalendarView::edit_options() 2921void CalendarView::edit_options()