author | zautrix <zautrix> | 2005-04-10 08:53:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-10 08:53:14 (UTC) |
commit | 79b12b680f6a0653bcff84c8ef83b23803246b7d (patch) (unidiff) | |
tree | 05e4c6d7ac0446eacb7dff6ca466f656b3152793 | |
parent | 54f5fe5e6f4909109edf915513c02f7af3e7bb2d (diff) | |
download | kdepimpi-79b12b680f6a0653bcff84c8ef83b23803246b7d.zip kdepimpi-79b12b680f6a0653bcff84c8ef83b23803246b7d.tar.gz kdepimpi-79b12b680f6a0653bcff84c8ef83b23803246b7d.tar.bz2 |
fixes
-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 2 | ||||
-rw-r--r-- | libkcal/calformat.cpp | 20 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 12 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 7 | ||||
-rw-r--r-- | libkcal/todo.cpp | 38 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 16 | ||||
-rw-r--r-- | microkde/kglobalsettings.cpp | 3 |
8 files changed, 56 insertions, 60 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8512a07..c530037 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2876,278 +2876,266 @@ void CalendarView::editJournal( Journal *jour ) | |||
2876 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2876 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2877 | } | 2877 | } |
2878 | void CalendarView::editTodo( Todo *todo ) | 2878 | void CalendarView::editTodo( Todo *todo ) |
2879 | { | 2879 | { |
2880 | if ( !todo ) return; | 2880 | if ( !todo ) return; |
2881 | 2881 | ||
2882 | if ( todo->isReadOnly() ) { | 2882 | if ( todo->isReadOnly() ) { |
2883 | showTodo( todo ); | 2883 | showTodo( todo ); |
2884 | return; | 2884 | return; |
2885 | } | 2885 | } |
2886 | showTodoEditor(); | 2886 | showTodoEditor(); |
2887 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2887 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2888 | mTodoEditor->exec(); | 2888 | mTodoEditor->exec(); |
2889 | setActiveWindow(); | 2889 | setActiveWindow(); |
2890 | 2890 | ||
2891 | } | 2891 | } |
2892 | 2892 | ||
2893 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2893 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2894 | { | 2894 | { |
2895 | if ( !mEventViewerDialog ) { | 2895 | if ( !mEventViewerDialog ) { |
2896 | mEventViewerDialog = new KOEventViewerDialog(0); | 2896 | mEventViewerDialog = new KOEventViewerDialog(0); |
2897 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2897 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2898 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2898 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2899 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2899 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2900 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2900 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2901 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2901 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2902 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2902 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2903 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 2903 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
2904 | this, SLOT( slotViewerClosed() ) ); | 2904 | this, SLOT( slotViewerClosed() ) ); |
2905 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 2905 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
2906 | this, SLOT( todoChanged(Todo *) ) ); | 2906 | this, SLOT( todoChanged(Todo *) ) ); |
2907 | mEventViewerDialog->resize( 640, 480 ); | 2907 | mEventViewerDialog->resize( 640, 480 ); |
2908 | 2908 | ||
2909 | } | 2909 | } |
2910 | return mEventViewerDialog; | 2910 | return mEventViewerDialog; |
2911 | } | 2911 | } |
2912 | void CalendarView::showEvent(Event *event) | 2912 | void CalendarView::showEvent(Event *event) |
2913 | { | 2913 | { |
2914 | getEventViewerDialog()->setEvent(event); | 2914 | getEventViewerDialog()->setEvent(event); |
2915 | getEventViewerDialog()->showMe(); | 2915 | getEventViewerDialog()->showMe(); |
2916 | } | 2916 | } |
2917 | 2917 | ||
2918 | void CalendarView::showTodo(Todo *event) | 2918 | void CalendarView::showTodo(Todo *event) |
2919 | { | 2919 | { |
2920 | getEventViewerDialog()->setTodo(event); | 2920 | getEventViewerDialog()->setTodo(event); |
2921 | getEventViewerDialog()->showMe(); | 2921 | getEventViewerDialog()->showMe(); |
2922 | } | 2922 | } |
2923 | void CalendarView::showJournal( Journal *jour ) | 2923 | void CalendarView::showJournal( Journal *jour ) |
2924 | { | 2924 | { |
2925 | getEventViewerDialog()->setJournal(jour); | 2925 | getEventViewerDialog()->setJournal(jour); |
2926 | getEventViewerDialog()->showMe(); | 2926 | getEventViewerDialog()->showMe(); |
2927 | 2927 | ||
2928 | } | 2928 | } |
2929 | // void CalendarView::todoModified (Todo *event, int changed) | 2929 | // void CalendarView::todoModified (Todo *event, int changed) |
2930 | // { | 2930 | // { |
2931 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2931 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2932 | // // kdDebug() << "Todo modified and open" << endl; | 2932 | // // kdDebug() << "Todo modified and open" << endl; |
2933 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2933 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2934 | // // temp->modified (changed); | 2934 | // // temp->modified (changed); |
2935 | 2935 | ||
2936 | // // } | 2936 | // // } |
2937 | 2937 | ||
2938 | // mViewManager->updateView(); | 2938 | // mViewManager->updateView(); |
2939 | // } | 2939 | // } |
2940 | 2940 | ||
2941 | void CalendarView::appointment_show() | 2941 | void CalendarView::appointment_show() |
2942 | { | 2942 | { |
2943 | Event *anEvent = 0; | 2943 | Event *anEvent = 0; |
2944 | 2944 | ||
2945 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2945 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2946 | 2946 | ||
2947 | if (mViewManager->currentView()->isEventView()) { | 2947 | if (mViewManager->currentView()->isEventView()) { |
2948 | if ( incidence && incidence->type() == "Event" ) { | 2948 | if ( incidence && incidence->type() == "Event" ) { |
2949 | anEvent = static_cast<Event *>(incidence); | 2949 | anEvent = static_cast<Event *>(incidence); |
2950 | } | 2950 | } |
2951 | } | 2951 | } |
2952 | 2952 | ||
2953 | if (!anEvent) { | 2953 | if (!anEvent) { |
2954 | KNotifyClient::beep(); | 2954 | KNotifyClient::beep(); |
2955 | return; | 2955 | return; |
2956 | } | 2956 | } |
2957 | 2957 | ||
2958 | showEvent(anEvent); | 2958 | showEvent(anEvent); |
2959 | } | 2959 | } |
2960 | 2960 | ||
2961 | void CalendarView::appointment_edit() | 2961 | void CalendarView::appointment_edit() |
2962 | { | 2962 | { |
2963 | Event *anEvent = 0; | 2963 | Event *anEvent = 0; |
2964 | 2964 | ||
2965 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2965 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2966 | 2966 | ||
2967 | if (mViewManager->currentView()->isEventView()) { | 2967 | if (mViewManager->currentView()->isEventView()) { |
2968 | if ( incidence && incidence->type() == "Event" ) { | 2968 | if ( incidence && incidence->type() == "Event" ) { |
2969 | anEvent = static_cast<Event *>(incidence); | 2969 | anEvent = static_cast<Event *>(incidence); |
2970 | } | 2970 | } |
2971 | } | 2971 | } |
2972 | 2972 | ||
2973 | if (!anEvent) { | 2973 | if (!anEvent) { |
2974 | KNotifyClient::beep(); | 2974 | KNotifyClient::beep(); |
2975 | return; | 2975 | return; |
2976 | } | 2976 | } |
2977 | 2977 | ||
2978 | editEvent(anEvent); | 2978 | editEvent(anEvent); |
2979 | } | 2979 | } |
2980 | 2980 | ||
2981 | void CalendarView::appointment_delete() | 2981 | void CalendarView::appointment_delete() |
2982 | { | 2982 | { |
2983 | Event *anEvent = 0; | 2983 | Event *anEvent = 0; |
2984 | 2984 | ||
2985 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2985 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2986 | 2986 | ||
2987 | if (mViewManager->currentView()->isEventView()) { | 2987 | if (mViewManager->currentView()->isEventView()) { |
2988 | if ( incidence && incidence->type() == "Event" ) { | 2988 | if ( incidence && incidence->type() == "Event" ) { |
2989 | anEvent = static_cast<Event *>(incidence); | 2989 | anEvent = static_cast<Event *>(incidence); |
2990 | } | 2990 | } |
2991 | } | 2991 | } |
2992 | 2992 | ||
2993 | if (!anEvent) { | 2993 | if (!anEvent) { |
2994 | KNotifyClient::beep(); | 2994 | KNotifyClient::beep(); |
2995 | return; | 2995 | return; |
2996 | } | 2996 | } |
2997 | 2997 | ||
2998 | deleteEvent(anEvent); | 2998 | deleteEvent(anEvent); |
2999 | } | 2999 | } |
3000 | 3000 | ||
3001 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3001 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3002 | { | 3002 | { |
3003 | if (!sub) return; | 3003 | if (!sub) return; |
3004 | if (!parent) return; | 3004 | if ( sub->relatedTo() == parent ) |
3005 | if ( sub->relatedTo() ) | 3005 | return; |
3006 | sub->relatedTo()->removeRelation(sub); | ||
3007 | sub->setRelatedTo(parent); | 3006 | sub->setRelatedTo(parent); |
3008 | sub->setRelatedToUid(parent->uid()); | ||
3009 | parent->addRelation(sub); | ||
3010 | sub->updated(); | 3007 | sub->updated(); |
3011 | parent->updated(); | ||
3012 | setModified(true); | 3008 | setModified(true); |
3013 | updateView(); | 3009 | updateView(); |
3014 | } | 3010 | } |
3015 | void CalendarView::todo_unsub(Todo *anTodo ) | 3011 | void CalendarView::todo_unsub(Todo *anTodo ) |
3016 | { | 3012 | { |
3017 | // Todo *anTodo = selectedTodo(); | 3013 | todo_resub( 0, anTodo ); |
3018 | if (!anTodo) return; | ||
3019 | if (!anTodo->relatedTo()) return; | ||
3020 | anTodo->relatedTo()->removeRelation(anTodo); | ||
3021 | anTodo->setRelatedTo(0); | ||
3022 | anTodo->updated(); | ||
3023 | anTodo->setRelatedToUid(""); | ||
3024 | setModified(true); | ||
3025 | updateView(); | ||
3026 | } | 3014 | } |
3027 | 3015 | ||
3028 | void CalendarView::deleteTodo(Todo *todo) | 3016 | void CalendarView::deleteTodo(Todo *todo) |
3029 | { | 3017 | { |
3030 | if (!todo) { | 3018 | if (!todo) { |
3031 | KNotifyClient::beep(); | 3019 | KNotifyClient::beep(); |
3032 | return; | 3020 | return; |
3033 | } | 3021 | } |
3034 | if (KOPrefs::instance()->mConfirm) { | 3022 | if (KOPrefs::instance()->mConfirm) { |
3035 | QString text = todo->summary().left(20); | 3023 | QString text = todo->summary().left(20); |
3036 | if (!todo->relations().isEmpty()) { | 3024 | if (!todo->relations().isEmpty()) { |
3037 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3025 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3038 | 3026 | ||
3039 | } | 3027 | } |
3040 | switch (msgItemDelete(text)) { | 3028 | switch (msgItemDelete(text)) { |
3041 | case KMessageBox::Continue: // OK | 3029 | case KMessageBox::Continue: // OK |
3042 | bool deleteT = false; | 3030 | bool deleteT = false; |
3043 | if (!todo->relations().isEmpty()) { | 3031 | if (!todo->relations().isEmpty()) { |
3044 | deleteT = removeCompletedSubTodos( todo ); | 3032 | deleteT = removeCompletedSubTodos( todo ); |
3045 | } | 3033 | } |
3046 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3034 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3047 | if ( !deleteT ) { | 3035 | if ( !deleteT ) { |
3048 | checkExternalId( todo ); | 3036 | checkExternalId( todo ); |
3049 | calendar()->deleteTodo(todo); | 3037 | calendar()->deleteTodo(todo); |
3050 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3038 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3051 | updateView(); | 3039 | updateView(); |
3052 | } | 3040 | } |
3053 | break; | 3041 | break; |
3054 | } // switch | 3042 | } // switch |
3055 | } else { | 3043 | } else { |
3056 | checkExternalId( todo ); | 3044 | checkExternalId( todo ); |
3057 | mCalendar->deleteTodo(todo); | 3045 | mCalendar->deleteTodo(todo); |
3058 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3046 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3059 | updateView(); | 3047 | updateView(); |
3060 | } | 3048 | } |
3061 | 3049 | ||
3062 | emit updateSearchDialog(); | 3050 | emit updateSearchDialog(); |
3063 | } | 3051 | } |
3064 | void CalendarView::deleteJournal(Journal *jour) | 3052 | void CalendarView::deleteJournal(Journal *jour) |
3065 | { | 3053 | { |
3066 | if (!jour) { | 3054 | if (!jour) { |
3067 | KNotifyClient::beep(); | 3055 | KNotifyClient::beep(); |
3068 | return; | 3056 | return; |
3069 | } | 3057 | } |
3070 | if (KOPrefs::instance()->mConfirm) { | 3058 | if (KOPrefs::instance()->mConfirm) { |
3071 | switch (msgItemDelete( jour->description().left(20))) { | 3059 | switch (msgItemDelete( jour->description().left(20))) { |
3072 | case KMessageBox::Continue: // OK | 3060 | case KMessageBox::Continue: // OK |
3073 | calendar()->deleteJournal(jour); | 3061 | calendar()->deleteJournal(jour); |
3074 | updateView(); | 3062 | updateView(); |
3075 | break; | 3063 | break; |
3076 | } // switch | 3064 | } // switch |
3077 | } else { | 3065 | } else { |
3078 | calendar()->deleteJournal(jour);; | 3066 | calendar()->deleteJournal(jour);; |
3079 | updateView(); | 3067 | updateView(); |
3080 | } | 3068 | } |
3081 | emit updateSearchDialog(); | 3069 | emit updateSearchDialog(); |
3082 | } | 3070 | } |
3083 | 3071 | ||
3084 | void CalendarView::deleteEvent(Event *anEvent) | 3072 | void CalendarView::deleteEvent(Event *anEvent) |
3085 | { | 3073 | { |
3086 | if (!anEvent) { | 3074 | if (!anEvent) { |
3087 | KNotifyClient::beep(); | 3075 | KNotifyClient::beep(); |
3088 | return; | 3076 | return; |
3089 | } | 3077 | } |
3090 | 3078 | ||
3091 | if (anEvent->recurrence()->doesRecur()) { | 3079 | if (anEvent->recurrence()->doesRecur()) { |
3092 | QDate itemDate = mViewManager->currentSelectionDate(); | 3080 | QDate itemDate = mViewManager->currentSelectionDate(); |
3093 | int km; | 3081 | int km; |
3094 | if (!itemDate.isValid()) { | 3082 | if (!itemDate.isValid()) { |
3095 | //kdDebug() << "Date Not Valid" << endl; | 3083 | //kdDebug() << "Date Not Valid" << endl; |
3096 | if (KOPrefs::instance()->mConfirm) { | 3084 | if (KOPrefs::instance()->mConfirm) { |
3097 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3085 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3098 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3086 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3099 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3087 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3100 | if ( km == KMessageBox::Continue ) | 3088 | if ( km == KMessageBox::Continue ) |
3101 | km = KMessageBox::No; // No = all below | 3089 | km = KMessageBox::No; // No = all below |
3102 | } else | 3090 | } else |
3103 | km = KMessageBox::No; | 3091 | km = KMessageBox::No; |
3104 | } else { | 3092 | } else { |
3105 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + | 3093 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + |
3106 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3094 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3107 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3095 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3108 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3096 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3109 | i18n("All")); | 3097 | i18n("All")); |
3110 | } | 3098 | } |
3111 | switch(km) { | 3099 | switch(km) { |
3112 | 3100 | ||
3113 | case KMessageBox::No: // Continue // all | 3101 | case KMessageBox::No: // Continue // all |
3114 | //qDebug("KMessageBox::No "); | 3102 | //qDebug("KMessageBox::No "); |
3115 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3103 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3116 | schedule(Scheduler::Cancel,anEvent); | 3104 | schedule(Scheduler::Cancel,anEvent); |
3117 | 3105 | ||
3118 | checkExternalId( anEvent); | 3106 | checkExternalId( anEvent); |
3119 | mCalendar->deleteEvent(anEvent); | 3107 | mCalendar->deleteEvent(anEvent); |
3120 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3108 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3121 | break; | 3109 | break; |
3122 | 3110 | ||
3123 | // Disabled because it does not work | 3111 | // Disabled because it does not work |
3124 | //#if 0 | 3112 | //#if 0 |
3125 | case KMessageBox::Yes: // just this one | 3113 | case KMessageBox::Yes: // just this one |
3126 | //QDate qd = mNavigator->selectedDates().first(); | 3114 | //QDate qd = mNavigator->selectedDates().first(); |
3127 | //if (!qd.isValid()) { | 3115 | //if (!qd.isValid()) { |
3128 | // kdDebug() << "no date selected, or invalid date" << endl; | 3116 | // kdDebug() << "no date selected, or invalid date" << endl; |
3129 | // KNotifyClient::beep(); | 3117 | // KNotifyClient::beep(); |
3130 | // return; | 3118 | // return; |
3131 | //} | 3119 | //} |
3132 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3120 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3133 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3121 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3134 | anEvent->addExDate(itemDate); | 3122 | anEvent->addExDate(itemDate); |
3135 | int duration = anEvent->recurrence()->duration(); | 3123 | int duration = anEvent->recurrence()->duration(); |
3136 | if ( duration > 0 ) { | 3124 | if ( duration > 0 ) { |
3137 | anEvent->recurrence()->setDuration( duration - 1 ); | 3125 | anEvent->recurrence()->setDuration( duration - 1 ); |
3138 | } | 3126 | } |
3139 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3127 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3140 | } | 3128 | } |
3141 | break; | 3129 | break; |
3142 | //#endif | 3130 | //#endif |
3143 | } // switch | 3131 | } // switch |
3144 | } else { | 3132 | } else { |
3145 | if (KOPrefs::instance()->mConfirm) { | 3133 | if (KOPrefs::instance()->mConfirm) { |
3146 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3134 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3147 | i18n("\nAre you sure you want\nto delete this event?"), | 3135 | i18n("\nAre you sure you want\nto delete this event?"), |
3148 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3136 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3149 | case KMessageBox::Continue: // OK | 3137 | case KMessageBox::Continue: // OK |
3150 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3138 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3151 | schedule(Scheduler::Cancel,anEvent); | 3139 | schedule(Scheduler::Cancel,anEvent); |
3152 | checkExternalId( anEvent); | 3140 | checkExternalId( anEvent); |
3153 | mCalendar->deleteEvent(anEvent); | 3141 | mCalendar->deleteEvent(anEvent); |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index dcfee5d..406cd48 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -1,169 +1,169 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <time.h> | 23 | #include <time.h> |
24 | 24 | ||
25 | #include <kdebug.h> | 25 | #include <kdebug.h> |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | #include "exceptions.h" | 29 | #include "exceptions.h" |
30 | #include "calfilter.h" | 30 | #include "calfilter.h" |
31 | 31 | ||
32 | #include "calendar.h" | 32 | #include "calendar.h" |
33 | #include "syncdefines.h" | 33 | #include "syncdefines.h" |
34 | 34 | ||
35 | using namespace KCal; | 35 | using namespace KCal; |
36 | 36 | ||
37 | Calendar::Calendar() | 37 | Calendar::Calendar() |
38 | { | 38 | { |
39 | 39 | ||
40 | init(); | 40 | init(); |
41 | setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") ); | 41 | setTimeZoneId( " 00:00 Europe/London(UTC)" ); |
42 | } | 42 | } |
43 | 43 | ||
44 | Calendar::Calendar( const QString &timeZoneId ) | 44 | Calendar::Calendar( const QString &timeZoneId ) |
45 | { | 45 | { |
46 | 46 | ||
47 | init(); | 47 | init(); |
48 | setTimeZoneId(timeZoneId); | 48 | setTimeZoneId(timeZoneId); |
49 | } | 49 | } |
50 | 50 | ||
51 | void Calendar::init() | 51 | void Calendar::init() |
52 | { | 52 | { |
53 | mObserver = 0; | 53 | mObserver = 0; |
54 | mNewObserver = false; | 54 | mNewObserver = false; |
55 | mUndoIncidence = 0; | 55 | mUndoIncidence = 0; |
56 | mModified = false; | 56 | mModified = false; |
57 | 57 | ||
58 | // Setup default filter, which does nothing | 58 | // Setup default filter, which does nothing |
59 | mDefaultFilter = new CalFilter; | 59 | mDefaultFilter = new CalFilter; |
60 | mFilter = mDefaultFilter; | 60 | mFilter = mDefaultFilter; |
61 | mFilter->setEnabled(false); | 61 | mFilter->setEnabled(false); |
62 | 62 | ||
63 | // initialize random numbers. This is a hack, and not | 63 | // initialize random numbers. This is a hack, and not |
64 | // even that good of one at that. | 64 | // even that good of one at that. |
65 | // srandom(time(0)); | 65 | // srandom(time(0)); |
66 | 66 | ||
67 | // user information... | 67 | // user information... |
68 | setOwner(i18n("Unknown Name")); | 68 | setOwner(i18n("Unknown Name")); |
69 | setEmail(i18n("unknown@nowhere")); | 69 | setEmail(i18n("unknown@nowhere")); |
70 | 70 | ||
71 | #if 0 | 71 | #if 0 |
72 | tmpStr = KOPrefs::instance()->mTimeZone; | 72 | tmpStr = KOPrefs::instance()->mTimeZone; |
73 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; | 73 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; |
74 | int dstSetting = KOPrefs::instance()->mDaylightSavings; | 74 | int dstSetting = KOPrefs::instance()->mDaylightSavings; |
75 | extern long int timezone; | 75 | extern long int timezone; |
76 | struct tm *now; | 76 | struct tm *now; |
77 | time_t curtime; | 77 | time_t curtime; |
78 | curtime = time(0); | 78 | curtime = time(0); |
79 | now = localtime(&curtime); | 79 | now = localtime(&curtime); |
80 | int hourOff = - ((timezone / 60) / 60); | 80 | int hourOff = - ((timezone / 60) / 60); |
81 | if (now->tm_isdst) | 81 | if (now->tm_isdst) |
82 | hourOff += 1; | 82 | hourOff += 1; |
83 | QString tzStr; | 83 | QString tzStr; |
84 | tzStr.sprintf("%.2d%.2d", | 84 | tzStr.sprintf("%.2d%.2d", |
85 | hourOff, | 85 | hourOff, |
86 | abs((timezone / 60) % 60)); | 86 | abs((timezone / 60) % 60)); |
87 | 87 | ||
88 | // if no time zone was in the config file, write what we just discovered. | 88 | // if no time zone was in the config file, write what we just discovered. |
89 | if (tmpStr.isEmpty()) { | 89 | if (tmpStr.isEmpty()) { |
90 | // KOPrefs::instance()->mTimeZone = tzStr; | 90 | // KOPrefs::instance()->mTimeZone = tzStr; |
91 | } else { | 91 | } else { |
92 | tzStr = tmpStr; | 92 | tzStr = tmpStr; |
93 | } | 93 | } |
94 | 94 | ||
95 | // if daylight savings has changed since last load time, we need | 95 | // if daylight savings has changed since last load time, we need |
96 | // to rewrite these settings to the config file. | 96 | // to rewrite these settings to the config file. |
97 | if ((now->tm_isdst && !dstSetting) || | 97 | if ((now->tm_isdst && !dstSetting) || |
98 | (!now->tm_isdst && dstSetting)) { | 98 | (!now->tm_isdst && dstSetting)) { |
99 | KOPrefs::instance()->mTimeZone = tzStr; | 99 | KOPrefs::instance()->mTimeZone = tzStr; |
100 | KOPrefs::instance()->mDaylightSavings = now->tm_isdst; | 100 | KOPrefs::instance()->mDaylightSavings = now->tm_isdst; |
101 | } | 101 | } |
102 | 102 | ||
103 | setTimeZone(tzStr); | 103 | setTimeZone(tzStr); |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | // KOPrefs::instance()->writeConfig(); | 106 | // KOPrefs::instance()->writeConfig(); |
107 | } | 107 | } |
108 | 108 | ||
109 | Calendar::~Calendar() | 109 | Calendar::~Calendar() |
110 | { | 110 | { |
111 | delete mDefaultFilter; | 111 | delete mDefaultFilter; |
112 | if ( mUndoIncidence ) | 112 | if ( mUndoIncidence ) |
113 | delete mUndoIncidence; | 113 | delete mUndoIncidence; |
114 | } | 114 | } |
115 | 115 | ||
116 | const QString &Calendar::getOwner() const | 116 | const QString &Calendar::getOwner() const |
117 | { | 117 | { |
118 | return mOwner; | 118 | return mOwner; |
119 | } | 119 | } |
120 | 120 | ||
121 | bool Calendar::undoDeleteIncidence() | 121 | bool Calendar::undoDeleteIncidence() |
122 | { | 122 | { |
123 | if (!mUndoIncidence) | 123 | if (!mUndoIncidence) |
124 | return false; | 124 | return false; |
125 | addIncidence(mUndoIncidence); | 125 | addIncidence(mUndoIncidence); |
126 | mUndoIncidence = 0; | 126 | mUndoIncidence = 0; |
127 | return true; | 127 | return true; |
128 | } | 128 | } |
129 | void Calendar::setOwner(const QString &os) | 129 | void Calendar::setOwner(const QString &os) |
130 | { | 130 | { |
131 | int i; | 131 | int i; |
132 | mOwner = os; | 132 | mOwner = os; |
133 | i = mOwner.find(','); | 133 | i = mOwner.find(','); |
134 | if (i != -1) | 134 | if (i != -1) |
135 | mOwner = mOwner.left(i); | 135 | mOwner = mOwner.left(i); |
136 | 136 | ||
137 | setModified( true ); | 137 | setModified( true ); |
138 | } | 138 | } |
139 | 139 | ||
140 | void Calendar::setTimeZone(const QString & tz) | 140 | void Calendar::setTimeZone(const QString & tz) |
141 | { | 141 | { |
142 | bool neg = FALSE; | 142 | bool neg = FALSE; |
143 | int hours, minutes; | 143 | int hours, minutes; |
144 | QString tmpStr(tz); | 144 | QString tmpStr(tz); |
145 | 145 | ||
146 | if (tmpStr.left(1) == "-") | 146 | if (tmpStr.left(1) == "-") |
147 | neg = TRUE; | 147 | neg = TRUE; |
148 | if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") | 148 | if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") |
149 | tmpStr.remove(0, 1); | 149 | tmpStr.remove(0, 1); |
150 | hours = tmpStr.left(2).toInt(); | 150 | hours = tmpStr.left(2).toInt(); |
151 | if (tmpStr.length() > 2) | 151 | if (tmpStr.length() > 2) |
152 | minutes = tmpStr.right(2).toInt(); | 152 | minutes = tmpStr.right(2).toInt(); |
153 | else | 153 | else |
154 | minutes = 0; | 154 | minutes = 0; |
155 | mTimeZone = (60*hours+minutes); | 155 | mTimeZone = (60*hours+minutes); |
156 | if (neg) | 156 | if (neg) |
157 | mTimeZone = -mTimeZone; | 157 | mTimeZone = -mTimeZone; |
158 | mLocalTime = false; | 158 | mLocalTime = false; |
159 | 159 | ||
160 | setModified( true ); | 160 | setModified( true ); |
161 | } | 161 | } |
162 | 162 | ||
163 | QString Calendar::getTimeZoneStr() const | 163 | QString Calendar::getTimeZoneStr() const |
164 | { | 164 | { |
165 | if (mLocalTime) | 165 | if (mLocalTime) |
166 | return ""; | 166 | return ""; |
167 | QString tmpStr; | 167 | QString tmpStr; |
168 | int hours = abs(mTimeZone / 60); | 168 | int hours = abs(mTimeZone / 60); |
169 | int minutes = abs(mTimeZone % 60); | 169 | int minutes = abs(mTimeZone % 60); |
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp index 8a3d069..359f65f 100644 --- a/libkcal/calformat.cpp +++ b/libkcal/calformat.cpp | |||
@@ -1,98 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <klocale.h> | 21 | #include <klocale.h> |
22 | #include <kdebug.h> | 22 | #include <kdebug.h> |
23 | #include <kapplication.h> | 23 | #include <kapplication.h> |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | using namespace KCal; | 27 | using namespace KCal; |
28 | 28 | ||
29 | QString CalFormat::mApplication = QString::fromLatin1("libkcal"); | 29 | QString CalFormat::mApplication = QString::fromLatin1("libkcal-pi"); |
30 | QString CalFormat::mProductId = QString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.1//EN"); | 30 | QString CalFormat::mProductId = QString::fromLatin1("-//KDE-Pim//Platform-independent 2.1.0"); |
31 | 31 | ||
32 | // An array containing the PRODID strings indexed against the calendar file format version used. | 32 | // An array containing the PRODID strings indexed against the calendar file format version used. |
33 | // Every time the calendar file format is changed, add an entry/entries to this list. | 33 | // Every time the calendar file format is changed, add an entry/entries to this list. |
34 | struct CalVersion { | 34 | struct CalVersion { |
35 | int version; | 35 | int version; |
36 | QString prodId; | 36 | QString prodId; |
37 | }; | 37 | }; |
38 | static CalVersion prodIds[] = { | 38 | static CalVersion prodIds[] = { |
39 | { 220, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 2.2//EN") }, | 39 | { 220, QString::fromLatin1("-//KDE-Pim//Pi 2.2//EN") }, |
40 | { 300, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.0//EN") }, | 40 | { 300, QString::fromLatin1("-//KDE-Pim//Pi 3.0//EN") }, |
41 | { 310, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.1//EN") }, | 41 | { 310, QString::fromLatin1("-//KDE-Pim//Pi 3.1//EN") }, |
42 | { 0 , QString() } | 42 | { 0 , QString() } |
43 | }; | 43 | }; |
44 | 44 | ||
45 | 45 | ||
46 | CalFormat::CalFormat() | 46 | CalFormat::CalFormat() |
47 | { | 47 | { |
48 | mException = 0; | 48 | mException = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | CalFormat::~CalFormat() | 51 | CalFormat::~CalFormat() |
52 | { | 52 | { |
53 | delete mException; | 53 | delete mException; |
54 | } | 54 | } |
55 | 55 | ||
56 | void CalFormat::clearException() | 56 | void CalFormat::clearException() |
57 | { | 57 | { |
58 | delete mException; | 58 | delete mException; |
59 | mException = 0; | 59 | mException = 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | void CalFormat::setException(ErrorFormat *exception) | 62 | void CalFormat::setException(ErrorFormat *exception) |
63 | { | 63 | { |
64 | delete mException; | 64 | delete mException; |
65 | mException = exception; | 65 | mException = exception; |
66 | } | 66 | } |
67 | 67 | ||
68 | ErrorFormat *CalFormat::exception() | 68 | ErrorFormat *CalFormat::exception() |
69 | { | 69 | { |
70 | return mException; | 70 | return mException; |
71 | } | 71 | } |
72 | 72 | ||
73 | void CalFormat::setApplication(const QString& application, const QString& productID) | 73 | void CalFormat::setApplication(const QString& application, const QString& productID) |
74 | { | 74 | { |
75 | mApplication = application; | 75 | mApplication = application; |
76 | mProductId = productID; | 76 | mProductId = productID; |
77 | } | 77 | } |
78 | 78 | ||
79 | QString CalFormat::createUniqueId() | 79 | QString CalFormat::createUniqueId() |
80 | { | 80 | { |
81 | int hashTime = QTime::currentTime().hour() + | 81 | return QString("%1-%2-%3") |
82 | QTime::currentTime().minute() + QTime::currentTime().second() + | 82 | .arg("kopi") |
83 | QTime::currentTime().msec(); | ||
84 | QString uidStr = QString("%1-%2.%3") | ||
85 | .arg(mApplication) | ||
86 | .arg(KApplication::random()) | 83 | .arg(KApplication::random()) |
87 | .arg(hashTime); | 84 | .arg(QTime::currentTime().msec()+1); |
88 | return uidStr; | ||
89 | } | 85 | } |
90 | 86 | ||
91 | int CalFormat::calendarVersion(const char* prodId) | 87 | int CalFormat::calendarVersion(const char* prodId) |
92 | { | 88 | { |
93 | for (const CalVersion* cv = prodIds; cv->version; ++cv) { | 89 | for (const CalVersion* cv = prodIds; cv->version; ++cv) { |
94 | if (!strcmp(prodId, cv->prodId.local8Bit())) | 90 | if (!strcmp(prodId, cv->prodId.local8Bit())) |
95 | return cv->version; | 91 | return cv->version; |
96 | } | 92 | } |
97 | return 0; | 93 | return 0; |
98 | } | 94 | } |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index eae41aa..fe7413f 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -241,259 +241,259 @@ icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) | |||
241 | 241 | ||
242 | // start time | 242 | // start time |
243 | if (journal->dtStart().isValid()) { | 243 | if (journal->dtStart().isValid()) { |
244 | icaltimetype start; | 244 | icaltimetype start; |
245 | if (journal->doesFloat()) { | 245 | if (journal->doesFloat()) { |
246 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; | 246 | // kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl; |
247 | start = writeICalDate(journal->dtStart().date()); | 247 | start = writeICalDate(journal->dtStart().date()); |
248 | } else { | 248 | } else { |
249 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; | 249 | // kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl; |
250 | start = writeICalDateTime(journal->dtStart()); | 250 | start = writeICalDateTime(journal->dtStart()); |
251 | } | 251 | } |
252 | icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); | 252 | icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); |
253 | } | 253 | } |
254 | 254 | ||
255 | return vjournal; | 255 | return vjournal; |
256 | } | 256 | } |
257 | 257 | ||
258 | void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | 258 | void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) |
259 | { | 259 | { |
260 | // pilot sync stuff | 260 | // pilot sync stuff |
261 | // TODO: move this application-specific code to kpilot | 261 | // TODO: move this application-specific code to kpilot |
262 | if (incidence->pilotId()) { | 262 | if (incidence->pilotId()) { |
263 | incidence->setNonKDECustomProperty("X-PILOTID", QString::number(incidence->pilotId())); | 263 | incidence->setNonKDECustomProperty("X-PILOTID", QString::number(incidence->pilotId())); |
264 | incidence->setNonKDECustomProperty("X-PILOTSTAT", QString::number(incidence->syncStatus())); | 264 | incidence->setNonKDECustomProperty("X-PILOTSTAT", QString::number(incidence->syncStatus())); |
265 | } | 265 | } |
266 | if ( !incidence->IDStr().isEmpty()) { | 266 | if ( !incidence->IDStr().isEmpty()) { |
267 | incidence->setNonKDECustomProperty("X-KOPIEXTID",incidence->IDStr() ); | 267 | incidence->setNonKDECustomProperty("X-KOPIEXTID",incidence->IDStr() ); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | writeIncidenceBase(parent,incidence); | 271 | writeIncidenceBase(parent,incidence); |
272 | if (incidence->cancelled()) { | 272 | if (incidence->cancelled()) { |
273 | icalcomponent_add_property(parent,icalproperty_new_status(ICAL_STATUS_CANCELLED)); | 273 | icalcomponent_add_property(parent,icalproperty_new_status(ICAL_STATUS_CANCELLED)); |
274 | } | 274 | } |
275 | 275 | ||
276 | // creation date | 276 | // creation date |
277 | icalcomponent_add_property(parent,icalproperty_new_created( | 277 | icalcomponent_add_property(parent,icalproperty_new_created( |
278 | writeICalDateTime(incidence->created()))); | 278 | writeICalDateTime(incidence->created()))); |
279 | 279 | ||
280 | // unique id | 280 | // unique id |
281 | icalcomponent_add_property(parent,icalproperty_new_uid( | 281 | icalcomponent_add_property(parent,icalproperty_new_uid( |
282 | incidence->uid().utf8())); | 282 | incidence->uid().utf8())); |
283 | 283 | ||
284 | // revision | 284 | // revision |
285 | icalcomponent_add_property(parent,icalproperty_new_sequence( | 285 | icalcomponent_add_property(parent,icalproperty_new_sequence( |
286 | incidence->revision())); | 286 | incidence->revision())); |
287 | 287 | ||
288 | // last modification date | 288 | // last modification date |
289 | icalcomponent_add_property(parent,icalproperty_new_lastmodified( | 289 | icalcomponent_add_property(parent,icalproperty_new_lastmodified( |
290 | writeICalDateTime(incidence->lastModified()))); | 290 | writeICalDateTime(incidence->lastModified()))); |
291 | 291 | ||
292 | // description | 292 | // description |
293 | if (!incidence->description().isEmpty()) { | 293 | if (!incidence->description().isEmpty()) { |
294 | icalcomponent_add_property(parent,icalproperty_new_description( | 294 | icalcomponent_add_property(parent,icalproperty_new_description( |
295 | incidence->description().utf8())); | 295 | incidence->description().utf8())); |
296 | } | 296 | } |
297 | 297 | ||
298 | // summary | 298 | // summary |
299 | if (!incidence->summary().isEmpty()) { | 299 | if (!incidence->summary().isEmpty()) { |
300 | icalcomponent_add_property(parent,icalproperty_new_summary( | 300 | icalcomponent_add_property(parent,icalproperty_new_summary( |
301 | incidence->summary().utf8())); | 301 | incidence->summary().utf8())); |
302 | } | 302 | } |
303 | 303 | ||
304 | // location | 304 | // location |
305 | if (!incidence->location().isEmpty()) { | 305 | if (!incidence->location().isEmpty()) { |
306 | icalcomponent_add_property(parent,icalproperty_new_location( | 306 | icalcomponent_add_property(parent,icalproperty_new_location( |
307 | incidence->location().utf8())); | 307 | incidence->location().utf8())); |
308 | } | 308 | } |
309 | 309 | ||
310 | // TODO: | 310 | // TODO: |
311 | // status | 311 | // status |
312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); | 312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); |
313 | 313 | ||
314 | // secrecy | 314 | // secrecy |
315 | enum icalproperty_class classInt; | 315 | enum icalproperty_class classInt; |
316 | switch (incidence->secrecy()) { | 316 | switch (incidence->secrecy()) { |
317 | case Incidence::SecrecyPublic: | 317 | case Incidence::SecrecyPublic: |
318 | classInt = ICAL_CLASS_PUBLIC; | 318 | classInt = ICAL_CLASS_PUBLIC; |
319 | break; | 319 | break; |
320 | case Incidence::SecrecyConfidential: | 320 | case Incidence::SecrecyConfidential: |
321 | classInt = ICAL_CLASS_CONFIDENTIAL; | 321 | classInt = ICAL_CLASS_CONFIDENTIAL; |
322 | break; | 322 | break; |
323 | case Incidence::SecrecyPrivate: | 323 | case Incidence::SecrecyPrivate: |
324 | classInt =ICAL_CLASS_PRIVATE ; | 324 | classInt =ICAL_CLASS_PRIVATE ; |
325 | default: | 325 | default: |
326 | classInt =ICAL_CLASS_PRIVATE ; | 326 | classInt =ICAL_CLASS_PRIVATE ; |
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); | 329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); |
330 | 330 | ||
331 | // priority | 331 | // priority |
332 | icalcomponent_add_property(parent,icalproperty_new_priority( | 332 | icalcomponent_add_property(parent,icalproperty_new_priority( |
333 | incidence->priority())); | 333 | incidence->priority())); |
334 | 334 | ||
335 | // categories | 335 | // categories |
336 | QStringList categories = incidence->categories(); | 336 | QStringList categories = incidence->categories(); |
337 | QStringList::Iterator it; | 337 | QStringList::Iterator it; |
338 | for(it = categories.begin(); it != categories.end(); ++it ) { | 338 | for(it = categories.begin(); it != categories.end(); ++it ) { |
339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); | 339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); |
340 | } | 340 | } |
341 | // TODO: Ensure correct concatenation of categories properties. | 341 | // TODO: Ensure correct concatenation of categories properties. |
342 | 342 | ||
343 | /* | 343 | /* |
344 | // categories | 344 | // categories |
345 | tmpStrList = incidence->getCategories(); | 345 | tmpStrList = incidence->getCategories(); |
346 | tmpStr = ""; | 346 | tmpStr = ""; |
347 | QString catStr; | 347 | QString catStr; |
348 | for ( QStringList::Iterator it = tmpStrList.begin(); | 348 | for ( QStringList::Iterator it = tmpStrList.begin(); |
349 | it != tmpStrList.end(); | 349 | it != tmpStrList.end(); |
350 | ++it ) { | 350 | ++it ) { |
351 | catStr = *it; | 351 | catStr = *it; |
352 | if (catStr[0] == ' ') | 352 | if (catStr[0] == ' ') |
353 | tmpStr += catStr.mid(1); | 353 | tmpStr += catStr.mid(1); |
354 | else | 354 | else |
355 | tmpStr += catStr; | 355 | tmpStr += catStr; |
356 | // this must be a ';' character as the vCalendar specification requires! | 356 | // this must be a ';' character as the vCalendar specification requires! |
357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
358 | // read in. | 358 | // read in. |
359 | tmpStr += ";"; | 359 | tmpStr += ";"; |
360 | } | 360 | } |
361 | if (!tmpStr.isEmpty()) { | 361 | if (!tmpStr.isEmpty()) { |
362 | tmpStr.truncate(tmpStr.length()-1); | 362 | tmpStr.truncate(tmpStr.length()-1); |
363 | icalcomponent_add_property(parent,icalproperty_new_categories( | 363 | icalcomponent_add_property(parent,icalproperty_new_categories( |
364 | writeText(incidence->getCategories().join(";")))); | 364 | writeText(incidence->getCategories().join(";")))); |
365 | } | 365 | } |
366 | */ | 366 | */ |
367 | 367 | ||
368 | // related event | 368 | // related event |
369 | if (incidence->relatedTo()) { | 369 | if (!incidence->relatedToUid().isEmpty()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedTo()->uid().utf8())); | 371 | incidence->relatedToUid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | Recurrence *recur = incidence->recurrence(); |
376 | if (recur->doesRecur()) { | 376 | if (recur->doesRecur()) { |
377 | 377 | ||
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | 378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); |
379 | } | 379 | } |
380 | 380 | ||
381 | // recurrence excpetion dates | 381 | // recurrence excpetion dates |
382 | DateList dateList = incidence->exDates(); | 382 | DateList dateList = incidence->exDates(); |
383 | DateList::ConstIterator exIt; | 383 | DateList::ConstIterator exIt; |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | 384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { |
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | 385 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
386 | writeICalDate(*exIt))); | 386 | writeICalDate(*exIt))); |
387 | } | 387 | } |
388 | 388 | ||
389 | // attachments | 389 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 390 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 392 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 393 | ||
394 | // alarms | 394 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 395 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 396 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 398 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 400 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | if( incidence->hasRecurrenceID() ) { | 403 | if( incidence->hasRecurrenceID() ) { |
404 | icalcomponent_add_property(parent, | 404 | icalcomponent_add_property(parent, |
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | 405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); |
406 | } | 406 | } |
407 | // duration | 407 | // duration |
408 | 408 | ||
409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
410 | 410 | ||
411 | if (incidence->hasDuration()) { | 411 | if (incidence->hasDuration()) { |
412 | icaldurationtype duration; | 412 | icaldurationtype duration; |
413 | duration = writeICalDuration(incidence->duration()); | 413 | duration = writeICalDuration(incidence->duration()); |
414 | icalcomponent_add_property(parent,icalproperty_new_duration(duration)); | 414 | icalcomponent_add_property(parent,icalproperty_new_duration(duration)); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
419 | { | 419 | { |
420 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( | 420 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( |
421 | writeICalDateTime(QDateTime::currentDateTime()))); | 421 | writeICalDateTime(QDateTime::currentDateTime()))); |
422 | 422 | ||
423 | // organizer stuff | 423 | // organizer stuff |
424 | icalcomponent_add_property(parent,icalproperty_new_organizer( | 424 | icalcomponent_add_property(parent,icalproperty_new_organizer( |
425 | ("MAILTO:" + incidenceBase->organizer()).utf8())); | 425 | ("MAILTO:" + incidenceBase->organizer()).utf8())); |
426 | 426 | ||
427 | // attendees | 427 | // attendees |
428 | if (incidenceBase->attendeeCount() != 0) { | 428 | if (incidenceBase->attendeeCount() != 0) { |
429 | QPtrList<Attendee> al = incidenceBase->attendees(); | 429 | QPtrList<Attendee> al = incidenceBase->attendees(); |
430 | QPtrListIterator<Attendee> ai(al); | 430 | QPtrListIterator<Attendee> ai(al); |
431 | for (; ai.current(); ++ai) { | 431 | for (; ai.current(); ++ai) { |
432 | icalcomponent_add_property(parent,writeAttendee(ai.current())); | 432 | icalcomponent_add_property(parent,writeAttendee(ai.current())); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | // custom properties | 436 | // custom properties |
437 | writeCustomProperties(parent, incidenceBase); | 437 | writeCustomProperties(parent, incidenceBase); |
438 | } | 438 | } |
439 | 439 | ||
440 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) | 440 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) |
441 | { | 441 | { |
442 | QMap<QCString, QString> custom = properties->customProperties(); | 442 | QMap<QCString, QString> custom = properties->customProperties(); |
443 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { | 443 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { |
444 | icalproperty *p = icalproperty_new_x(c.data().utf8()); | 444 | icalproperty *p = icalproperty_new_x(c.data().utf8()); |
445 | icalproperty_set_x_name(p,c.key()); | 445 | icalproperty_set_x_name(p,c.key()); |
446 | icalcomponent_add_property(parent,p); | 446 | icalcomponent_add_property(parent,p); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) | 450 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) |
451 | { | 451 | { |
452 | icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); | 452 | icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8()); |
453 | 453 | ||
454 | if (!attendee->name().isEmpty()) { | 454 | if (!attendee->name().isEmpty()) { |
455 | icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8())); | 455 | icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8())); |
456 | } | 456 | } |
457 | 457 | ||
458 | 458 | ||
459 | icalproperty_add_parameter(p,icalparameter_new_rsvp( | 459 | icalproperty_add_parameter(p,icalparameter_new_rsvp( |
460 | attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); | 460 | attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); |
461 | 461 | ||
462 | icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; | 462 | icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; |
463 | switch (attendee->status()) { | 463 | switch (attendee->status()) { |
464 | default: | 464 | default: |
465 | case Attendee::NeedsAction: | 465 | case Attendee::NeedsAction: |
466 | status = ICAL_PARTSTAT_NEEDSACTION; | 466 | status = ICAL_PARTSTAT_NEEDSACTION; |
467 | break; | 467 | break; |
468 | case Attendee::Accepted: | 468 | case Attendee::Accepted: |
469 | status = ICAL_PARTSTAT_ACCEPTED; | 469 | status = ICAL_PARTSTAT_ACCEPTED; |
470 | break; | 470 | break; |
471 | case Attendee::Declined: | 471 | case Attendee::Declined: |
472 | status = ICAL_PARTSTAT_DECLINED; | 472 | status = ICAL_PARTSTAT_DECLINED; |
473 | break; | 473 | break; |
474 | case Attendee::Tentative: | 474 | case Attendee::Tentative: |
475 | status = ICAL_PARTSTAT_TENTATIVE; | 475 | status = ICAL_PARTSTAT_TENTATIVE; |
476 | break; | 476 | break; |
477 | case Attendee::Delegated: | 477 | case Attendee::Delegated: |
478 | status = ICAL_PARTSTAT_DELEGATED; | 478 | status = ICAL_PARTSTAT_DELEGATED; |
479 | break; | 479 | break; |
480 | case Attendee::Completed: | 480 | case Attendee::Completed: |
481 | status = ICAL_PARTSTAT_COMPLETED; | 481 | status = ICAL_PARTSTAT_COMPLETED; |
482 | break; | 482 | break; |
483 | case Attendee::InProcess: | 483 | case Attendee::InProcess: |
484 | status = ICAL_PARTSTAT_INPROCESS; | 484 | status = ICAL_PARTSTAT_INPROCESS; |
485 | break; | 485 | break; |
486 | } | 486 | } |
487 | icalproperty_add_parameter(p,icalparameter_new_partstat(status)); | 487 | icalproperty_add_parameter(p,icalparameter_new_partstat(status)); |
488 | 488 | ||
489 | icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; | 489 | icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; |
490 | switch (attendee->role()) { | 490 | switch (attendee->role()) { |
491 | case Attendee::Chair: | 491 | case Attendee::Chair: |
492 | role = ICAL_ROLE_CHAIR; | 492 | role = ICAL_ROLE_CHAIR; |
493 | break; | 493 | break; |
494 | default: | 494 | default: |
495 | case Attendee::ReqParticipant: | 495 | case Attendee::ReqParticipant: |
496 | role = ICAL_ROLE_REQPARTICIPANT; | 496 | role = ICAL_ROLE_REQPARTICIPANT; |
497 | break; | 497 | break; |
498 | case Attendee::OptParticipant: | 498 | case Attendee::OptParticipant: |
499 | role = ICAL_ROLE_OPTPARTICIPANT; | 499 | role = ICAL_ROLE_OPTPARTICIPANT; |
@@ -1911,255 +1911,259 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) | |||
1911 | "We only support %2.") | 1911 | "We only support %2.") |
1912 | .arg(s).arg(_VCAL_VERSION), | 1912 | .arg(s).arg(_VCAL_VERSION), |
1913 | i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); | 1913 | i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); |
1914 | deleteStr(s); | 1914 | deleteStr(s); |
1915 | } | 1915 | } |
1916 | #endif | 1916 | #endif |
1917 | 1917 | ||
1918 | // custom properties | 1918 | // custom properties |
1919 | readCustomProperties(calendar, cal); | 1919 | readCustomProperties(calendar, cal); |
1920 | 1920 | ||
1921 | // TODO: set time zone | 1921 | // TODO: set time zone |
1922 | #if 0 | 1922 | #if 0 |
1923 | // set the time zone | 1923 | // set the time zone |
1924 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { | 1924 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { |
1925 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1925 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1926 | cal->setTimeZone(s); | 1926 | cal->setTimeZone(s); |
1927 | deleteStr(s); | 1927 | deleteStr(s); |
1928 | } | 1928 | } |
1929 | #endif | 1929 | #endif |
1930 | 1930 | ||
1931 | // Store all events with a relatedTo property in a list for post-processing | 1931 | // Store all events with a relatedTo property in a list for post-processing |
1932 | mEventsRelate.clear(); | 1932 | mEventsRelate.clear(); |
1933 | mTodosRelate.clear(); | 1933 | mTodosRelate.clear(); |
1934 | // TODO: make sure that only actually added ecvens go to this lists. | 1934 | // TODO: make sure that only actually added ecvens go to this lists. |
1935 | 1935 | ||
1936 | icalcomponent *c; | 1936 | icalcomponent *c; |
1937 | 1937 | ||
1938 | // Iterate through all todos | 1938 | // Iterate through all todos |
1939 | c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); | 1939 | c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); |
1940 | while (c) { | 1940 | while (c) { |
1941 | // kdDebug(5800) << "----Todo found" << endl; | 1941 | // kdDebug(5800) << "----Todo found" << endl; |
1942 | Todo *todo = readTodo(c); | 1942 | Todo *todo = readTodo(c); |
1943 | if (!cal->todo(todo->uid())) cal->addTodo(todo); | 1943 | if (!cal->todo(todo->uid())) cal->addTodo(todo); |
1944 | c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); | 1944 | c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | // Iterate through all events | 1947 | // Iterate through all events |
1948 | c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); | 1948 | c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); |
1949 | while (c) { | 1949 | while (c) { |
1950 | // kdDebug(5800) << "----Event found" << endl; | 1950 | // kdDebug(5800) << "----Event found" << endl; |
1951 | Event *event = readEvent(c); | 1951 | Event *event = readEvent(c); |
1952 | if (!cal->event(event->uid())) cal->addEvent(event); | 1952 | if (!cal->event(event->uid())) cal->addEvent(event); |
1953 | c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); | 1953 | c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); |
1954 | } | 1954 | } |
1955 | 1955 | ||
1956 | // Iterate through all journals | 1956 | // Iterate through all journals |
1957 | c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); | 1957 | c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); |
1958 | while (c) { | 1958 | while (c) { |
1959 | // kdDebug(5800) << "----Journal found" << endl; | 1959 | // kdDebug(5800) << "----Journal found" << endl; |
1960 | Journal *journal = readJournal(c); | 1960 | Journal *journal = readJournal(c); |
1961 | if (!cal->journal(journal->uid())) cal->addJournal(journal); | 1961 | if (!cal->journal(journal->uid())) cal->addJournal(journal); |
1962 | c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); | 1962 | c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); |
1963 | } | 1963 | } |
1964 | 1964 | ||
1965 | #if 0 | 1965 | #if 0 |
1966 | initPropIterator(&i, vcal); | 1966 | initPropIterator(&i, vcal); |
1967 | 1967 | ||
1968 | // go through all the vobjects in the vcal | 1968 | // go through all the vobjects in the vcal |
1969 | while (moreIteration(&i)) { | 1969 | while (moreIteration(&i)) { |
1970 | curVO = nextVObject(&i); | 1970 | curVO = nextVObject(&i); |
1971 | 1971 | ||
1972 | /************************************************************************/ | 1972 | /************************************************************************/ |
1973 | 1973 | ||
1974 | // now, check to see that the object is an event or todo. | 1974 | // now, check to see that the object is an event or todo. |
1975 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { | 1975 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { |
1976 | 1976 | ||
1977 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { | 1977 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { |
1978 | char *s; | 1978 | char *s; |
1979 | s = fakeCString(vObjectUStringZValue(curVOProp)); | 1979 | s = fakeCString(vObjectUStringZValue(curVOProp)); |
1980 | // check to see if event was deleted by the kpilot conduit | 1980 | // check to see if event was deleted by the kpilot conduit |
1981 | if (atoi(s) == Event::SYNCDEL) { | 1981 | if (atoi(s) == Event::SYNCDEL) { |
1982 | deleteStr(s); | 1982 | deleteStr(s); |
1983 | goto SKIP; | 1983 | goto SKIP; |
1984 | } | 1984 | } |
1985 | deleteStr(s); | 1985 | deleteStr(s); |
1986 | } | 1986 | } |
1987 | 1987 | ||
1988 | // this code checks to see if we are trying to read in an event | 1988 | // this code checks to see if we are trying to read in an event |
1989 | // that we already find to be in the calendar. If we find this | 1989 | // that we already find to be in the calendar. If we find this |
1990 | // to be the case, we skip the event. | 1990 | // to be the case, we skip the event. |
1991 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { | 1991 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { |
1992 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); | 1992 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); |
1993 | QString tmpStr(s); | 1993 | QString tmpStr(s); |
1994 | deleteStr(s); | 1994 | deleteStr(s); |
1995 | 1995 | ||
1996 | if (cal->event(tmpStr)) { | 1996 | if (cal->event(tmpStr)) { |
1997 | goto SKIP; | 1997 | goto SKIP; |
1998 | } | 1998 | } |
1999 | if (cal->todo(tmpStr)) { | 1999 | if (cal->todo(tmpStr)) { |
2000 | goto SKIP; | 2000 | goto SKIP; |
2001 | } | 2001 | } |
2002 | } | 2002 | } |
2003 | 2003 | ||
2004 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && | 2004 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && |
2005 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { | 2005 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { |
2006 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; | 2006 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; |
2007 | goto SKIP; | 2007 | goto SKIP; |
2008 | } | 2008 | } |
2009 | 2009 | ||
2010 | anEvent = VEventToEvent(curVO); | 2010 | anEvent = VEventToEvent(curVO); |
2011 | // we now use addEvent instead of insertEvent so that the | 2011 | // we now use addEvent instead of insertEvent so that the |
2012 | // signal/slot get connected. | 2012 | // signal/slot get connected. |
2013 | if (anEvent) | 2013 | if (anEvent) |
2014 | cal->addEvent(anEvent); | 2014 | cal->addEvent(anEvent); |
2015 | else { | 2015 | else { |
2016 | // some sort of error must have occurred while in translation. | 2016 | // some sort of error must have occurred while in translation. |
2017 | goto SKIP; | 2017 | goto SKIP; |
2018 | } | 2018 | } |
2019 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { | 2019 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { |
2020 | anEvent = VTodoToEvent(curVO); | 2020 | anEvent = VTodoToEvent(curVO); |
2021 | cal->addTodo(anEvent); | 2021 | cal->addTodo(anEvent); |
2022 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || | 2022 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || |
2023 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || | 2023 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || |
2024 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { | 2024 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { |
2025 | // do nothing, we know these properties and we want to skip them. | 2025 | // do nothing, we know these properties and we want to skip them. |
2026 | // we have either already processed them or are ignoring them. | 2026 | // we have either already processed them or are ignoring them. |
2027 | ; | 2027 | ; |
2028 | } else { | 2028 | } else { |
2029 | ; | 2029 | ; |
2030 | } | 2030 | } |
2031 | SKIP: | 2031 | SKIP: |
2032 | ; | 2032 | ; |
2033 | } // while | 2033 | } // while |
2034 | #endif | 2034 | #endif |
2035 | 2035 | ||
2036 | // Post-Process list of events with relations, put Event objects in relation | 2036 | // Post-Process list of events with relations, put Event objects in relation |
2037 | Event *ev; | 2037 | Event *ev; |
2038 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { | 2038 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { |
2039 | ev->setRelatedTo(cal->event(ev->relatedToUid())); | 2039 | Incidence * inc = cal->event(ev->relatedToUid()); |
2040 | if ( inc ) | ||
2041 | ev->setRelatedTo( inc ); | ||
2040 | } | 2042 | } |
2041 | Todo *todo; | 2043 | Todo *todo; |
2042 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { | 2044 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { |
2043 | todo->setRelatedTo(cal->todo(todo->relatedToUid())); | 2045 | Incidence * inc = cal->todo(todo->relatedToUid()); |
2046 | if ( inc ) | ||
2047 | todo->setRelatedTo( inc ); | ||
2044 | } | 2048 | } |
2045 | 2049 | ||
2046 | return true; | 2050 | return true; |
2047 | } | 2051 | } |
2048 | 2052 | ||
2049 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) | 2053 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) |
2050 | { | 2054 | { |
2051 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " | 2055 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " |
2052 | // << icalcomponent_as_ical_string(c) << endl; | 2056 | // << icalcomponent_as_ical_string(c) << endl; |
2053 | 2057 | ||
2054 | QString errorMessage; | 2058 | QString errorMessage; |
2055 | 2059 | ||
2056 | icalproperty *error; | 2060 | icalproperty *error; |
2057 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); | 2061 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); |
2058 | while(error) { | 2062 | while(error) { |
2059 | errorMessage += icalproperty_get_xlicerror(error); | 2063 | errorMessage += icalproperty_get_xlicerror(error); |
2060 | errorMessage += "\n"; | 2064 | errorMessage += "\n"; |
2061 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); | 2065 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); |
2062 | } | 2066 | } |
2063 | 2067 | ||
2064 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; | 2068 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; |
2065 | 2069 | ||
2066 | return errorMessage; | 2070 | return errorMessage; |
2067 | } | 2071 | } |
2068 | 2072 | ||
2069 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) | 2073 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) |
2070 | { | 2074 | { |
2071 | int i; | 2075 | int i; |
2072 | 2076 | ||
2073 | 2077 | ||
2074 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2078 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2075 | int index = 0; | 2079 | int index = 0; |
2076 | QString out = " By Day: "; | 2080 | QString out = " By Day: "; |
2077 | while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2081 | while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2078 | out.append(QString::number(i) + " "); | 2082 | out.append(QString::number(i) + " "); |
2079 | } | 2083 | } |
2080 | } | 2084 | } |
2081 | if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2085 | if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2082 | int index = 0; | 2086 | int index = 0; |
2083 | QString out = " By Month Day: "; | 2087 | QString out = " By Month Day: "; |
2084 | while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2088 | while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2085 | out.append(QString::number(i) + " "); | 2089 | out.append(QString::number(i) + " "); |
2086 | } | 2090 | } |
2087 | } | 2091 | } |
2088 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2092 | if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2089 | int index = 0; | 2093 | int index = 0; |
2090 | QString out = " By Year Day: "; | 2094 | QString out = " By Year Day: "; |
2091 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2095 | while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2092 | out.append(QString::number(i) + " "); | 2096 | out.append(QString::number(i) + " "); |
2093 | } | 2097 | } |
2094 | } | 2098 | } |
2095 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2099 | if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2096 | int index = 0; | 2100 | int index = 0; |
2097 | QString out = " By Month: "; | 2101 | QString out = " By Month: "; |
2098 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2102 | while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2099 | out.append(QString::number(i) + " "); | 2103 | out.append(QString::number(i) + " "); |
2100 | } | 2104 | } |
2101 | } | 2105 | } |
2102 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2106 | if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2103 | int index = 0; | 2107 | int index = 0; |
2104 | QString out = " By Set Pos: "; | 2108 | QString out = " By Set Pos: "; |
2105 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { | 2109 | while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { |
2106 | out.append(QString::number(i) + " "); | 2110 | out.append(QString::number(i) + " "); |
2107 | } | 2111 | } |
2108 | } | 2112 | } |
2109 | } | 2113 | } |
2110 | 2114 | ||
2111 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, | 2115 | icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, |
2112 | Scheduler::Method method) | 2116 | Scheduler::Method method) |
2113 | { | 2117 | { |
2114 | icalcomponent *message = createCalendarComponent(); | 2118 | icalcomponent *message = createCalendarComponent(); |
2115 | 2119 | ||
2116 | icalproperty_method icalmethod = ICAL_METHOD_NONE; | 2120 | icalproperty_method icalmethod = ICAL_METHOD_NONE; |
2117 | 2121 | ||
2118 | switch (method) { | 2122 | switch (method) { |
2119 | case Scheduler::Publish: | 2123 | case Scheduler::Publish: |
2120 | icalmethod = ICAL_METHOD_PUBLISH; | 2124 | icalmethod = ICAL_METHOD_PUBLISH; |
2121 | break; | 2125 | break; |
2122 | case Scheduler::Request: | 2126 | case Scheduler::Request: |
2123 | icalmethod = ICAL_METHOD_REQUEST; | 2127 | icalmethod = ICAL_METHOD_REQUEST; |
2124 | break; | 2128 | break; |
2125 | case Scheduler::Refresh: | 2129 | case Scheduler::Refresh: |
2126 | icalmethod = ICAL_METHOD_REFRESH; | 2130 | icalmethod = ICAL_METHOD_REFRESH; |
2127 | break; | 2131 | break; |
2128 | case Scheduler::Cancel: | 2132 | case Scheduler::Cancel: |
2129 | icalmethod = ICAL_METHOD_CANCEL; | 2133 | icalmethod = ICAL_METHOD_CANCEL; |
2130 | break; | 2134 | break; |
2131 | case Scheduler::Add: | 2135 | case Scheduler::Add: |
2132 | icalmethod = ICAL_METHOD_ADD; | 2136 | icalmethod = ICAL_METHOD_ADD; |
2133 | break; | 2137 | break; |
2134 | case Scheduler::Reply: | 2138 | case Scheduler::Reply: |
2135 | icalmethod = ICAL_METHOD_REPLY; | 2139 | icalmethod = ICAL_METHOD_REPLY; |
2136 | break; | 2140 | break; |
2137 | case Scheduler::Counter: | 2141 | case Scheduler::Counter: |
2138 | icalmethod = ICAL_METHOD_COUNTER; | 2142 | icalmethod = ICAL_METHOD_COUNTER; |
2139 | break; | 2143 | break; |
2140 | case Scheduler::Declinecounter: | 2144 | case Scheduler::Declinecounter: |
2141 | icalmethod = ICAL_METHOD_DECLINECOUNTER; | 2145 | icalmethod = ICAL_METHOD_DECLINECOUNTER; |
2142 | break; | 2146 | break; |
2143 | default: | 2147 | default: |
2144 | 2148 | ||
2145 | return message; | 2149 | return message; |
2146 | } | 2150 | } |
2147 | 2151 | ||
2148 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); | 2152 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); |
2149 | 2153 | ||
2150 | // TODO: check, if dynamic cast is required | 2154 | // TODO: check, if dynamic cast is required |
2151 | if(incidence->type() == "Todo") { | 2155 | if(incidence->type() == "Todo") { |
2152 | Todo *todo = static_cast<Todo *>(incidence); | 2156 | Todo *todo = static_cast<Todo *>(incidence); |
2153 | icalcomponent_add_component(message,writeTodo(todo)); | 2157 | icalcomponent_add_component(message,writeTodo(todo)); |
2154 | } | 2158 | } |
2155 | if(incidence->type() == "Event") { | 2159 | if(incidence->type() == "Event") { |
2156 | Event *event = static_cast<Event *>(incidence); | 2160 | Event *event = static_cast<Event *>(incidence); |
2157 | icalcomponent_add_component(message,writeEvent(event)); | 2161 | icalcomponent_add_component(message,writeEvent(event)); |
2158 | } | 2162 | } |
2159 | if(incidence->type() == "FreeBusy") { | 2163 | if(incidence->type() == "FreeBusy") { |
2160 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); | 2164 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); |
2161 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); | 2165 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); |
2162 | } | 2166 | } |
2163 | 2167 | ||
2164 | return message; | 2168 | return message; |
2165 | } | 2169 | } |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index a312ba5..6bca12c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -265,257 +265,262 @@ void Incidence::recreate() | |||
265 | } | 265 | } |
266 | 266 | ||
267 | void Incidence::setReadOnly( bool readOnly ) | 267 | void Incidence::setReadOnly( bool readOnly ) |
268 | { | 268 | { |
269 | IncidenceBase::setReadOnly( readOnly ); | 269 | IncidenceBase::setReadOnly( readOnly ); |
270 | recurrence()->setRecurReadOnly( readOnly); | 270 | recurrence()->setRecurReadOnly( readOnly); |
271 | } | 271 | } |
272 | 272 | ||
273 | void Incidence::setCreated(QDateTime created) | 273 | void Incidence::setCreated(QDateTime created) |
274 | { | 274 | { |
275 | if (mReadOnly) return; | 275 | if (mReadOnly) return; |
276 | mCreated = getEvenTime(created); | 276 | mCreated = getEvenTime(created); |
277 | } | 277 | } |
278 | 278 | ||
279 | QDateTime Incidence::created() const | 279 | QDateTime Incidence::created() const |
280 | { | 280 | { |
281 | return mCreated; | 281 | return mCreated; |
282 | } | 282 | } |
283 | 283 | ||
284 | void Incidence::setRevision(int rev) | 284 | void Incidence::setRevision(int rev) |
285 | { | 285 | { |
286 | if (mReadOnly) return; | 286 | if (mReadOnly) return; |
287 | mRevision = rev; | 287 | mRevision = rev; |
288 | 288 | ||
289 | updated(); | 289 | updated(); |
290 | } | 290 | } |
291 | 291 | ||
292 | int Incidence::revision() const | 292 | int Incidence::revision() const |
293 | { | 293 | { |
294 | return mRevision; | 294 | return mRevision; |
295 | } | 295 | } |
296 | 296 | ||
297 | void Incidence::setDtStart(const QDateTime &dtStart) | 297 | void Incidence::setDtStart(const QDateTime &dtStart) |
298 | { | 298 | { |
299 | 299 | ||
300 | QDateTime dt = getEvenTime(dtStart); | 300 | QDateTime dt = getEvenTime(dtStart); |
301 | recurrence()->setRecurStart( dt); | 301 | recurrence()->setRecurStart( dt); |
302 | IncidenceBase::setDtStart( dt ); | 302 | IncidenceBase::setDtStart( dt ); |
303 | } | 303 | } |
304 | 304 | ||
305 | void Incidence::setDescription(const QString &description) | 305 | void Incidence::setDescription(const QString &description) |
306 | { | 306 | { |
307 | if (mReadOnly) return; | 307 | if (mReadOnly) return; |
308 | mDescription = description; | 308 | mDescription = description; |
309 | updated(); | 309 | updated(); |
310 | } | 310 | } |
311 | 311 | ||
312 | QString Incidence::description() const | 312 | QString Incidence::description() const |
313 | { | 313 | { |
314 | return mDescription; | 314 | return mDescription; |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void Incidence::setSummary(const QString &summary) | 318 | void Incidence::setSummary(const QString &summary) |
319 | { | 319 | { |
320 | if (mReadOnly) return; | 320 | if (mReadOnly) return; |
321 | mSummary = summary; | 321 | mSummary = summary; |
322 | updated(); | 322 | updated(); |
323 | } | 323 | } |
324 | 324 | ||
325 | QString Incidence::summary() const | 325 | QString Incidence::summary() const |
326 | { | 326 | { |
327 | return mSummary; | 327 | return mSummary; |
328 | } | 328 | } |
329 | void Incidence::checkCategories() | 329 | void Incidence::checkCategories() |
330 | { | 330 | { |
331 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 331 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
332 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 332 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
333 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 333 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
334 | } | 334 | } |
335 | 335 | ||
336 | void Incidence::setCategories(const QStringList &categories) | 336 | void Incidence::setCategories(const QStringList &categories) |
337 | { | 337 | { |
338 | if (mReadOnly) return; | 338 | if (mReadOnly) return; |
339 | mCategories = categories; | 339 | mCategories = categories; |
340 | checkCategories(); | 340 | checkCategories(); |
341 | updated(); | 341 | updated(); |
342 | } | 342 | } |
343 | 343 | ||
344 | // TODO: remove setCategories(QString) function | 344 | // TODO: remove setCategories(QString) function |
345 | void Incidence::setCategories(const QString &catStr) | 345 | void Incidence::setCategories(const QString &catStr) |
346 | { | 346 | { |
347 | if (mReadOnly) return; | 347 | if (mReadOnly) return; |
348 | mCategories.clear(); | 348 | mCategories.clear(); |
349 | 349 | ||
350 | if (catStr.isEmpty()) return; | 350 | if (catStr.isEmpty()) return; |
351 | 351 | ||
352 | mCategories = QStringList::split(",",catStr); | 352 | mCategories = QStringList::split(",",catStr); |
353 | 353 | ||
354 | QStringList::Iterator it; | 354 | QStringList::Iterator it; |
355 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 355 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
356 | *it = (*it).stripWhiteSpace(); | 356 | *it = (*it).stripWhiteSpace(); |
357 | } | 357 | } |
358 | checkCategories(); | 358 | checkCategories(); |
359 | updated(); | 359 | updated(); |
360 | } | 360 | } |
361 | 361 | ||
362 | QStringList Incidence::categories() const | 362 | QStringList Incidence::categories() const |
363 | { | 363 | { |
364 | return mCategories; | 364 | return mCategories; |
365 | } | 365 | } |
366 | 366 | ||
367 | QString Incidence::categoriesStr() | 367 | QString Incidence::categoriesStr() |
368 | { | 368 | { |
369 | return mCategories.join(","); | 369 | return mCategories.join(","); |
370 | } | 370 | } |
371 | 371 | ||
372 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 372 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
373 | { | 373 | { |
374 | if (mReadOnly) return; | 374 | if (mReadOnly) return; |
375 | mRelatedToUid = relatedToUid; | 375 | mRelatedToUid = relatedToUid; |
376 | } | 376 | } |
377 | 377 | ||
378 | QString Incidence::relatedToUid() const | 378 | QString Incidence::relatedToUid() const |
379 | { | 379 | { |
380 | return mRelatedToUid; | 380 | return mRelatedToUid; |
381 | } | 381 | } |
382 | 382 | ||
383 | void Incidence::setRelatedTo(Incidence *relatedTo) | 383 | void Incidence::setRelatedTo(Incidence *relatedTo) |
384 | { | 384 | { |
385 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 385 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
386 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 386 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
387 | if (mReadOnly || mRelatedTo == relatedTo) return; | 387 | if (mReadOnly || mRelatedTo == relatedTo) return; |
388 | if(mRelatedTo) { | 388 | if(mRelatedTo) { |
389 | // updated(); | 389 | // updated(); |
390 | mRelatedTo->removeRelation(this); | 390 | mRelatedTo->removeRelation(this); |
391 | } | 391 | } |
392 | mRelatedTo = relatedTo; | 392 | mRelatedTo = relatedTo; |
393 | if (mRelatedTo) mRelatedTo->addRelation(this); | 393 | if (mRelatedTo) { |
394 | mRelatedTo->addRelation(this); | ||
395 | mRelatedToUid = mRelatedTo->uid(); | ||
396 | } else { | ||
397 | mRelatedToUid = ""; | ||
398 | } | ||
394 | } | 399 | } |
395 | 400 | ||
396 | Incidence *Incidence::relatedTo() const | 401 | Incidence *Incidence::relatedTo() const |
397 | { | 402 | { |
398 | return mRelatedTo; | 403 | return mRelatedTo; |
399 | } | 404 | } |
400 | 405 | ||
401 | QPtrList<Incidence> Incidence::relations() const | 406 | QPtrList<Incidence> Incidence::relations() const |
402 | { | 407 | { |
403 | return mRelations; | 408 | return mRelations; |
404 | } | 409 | } |
405 | 410 | ||
406 | void Incidence::addRelation(Incidence *event) | 411 | void Incidence::addRelation(Incidence *event) |
407 | { | 412 | { |
408 | if( mRelations.findRef( event ) == -1 ) { | 413 | if( mRelations.findRef( event ) == -1 ) { |
409 | mRelations.append(event); | 414 | mRelations.append(event); |
410 | //updated(); | 415 | //updated(); |
411 | } | 416 | } |
412 | } | 417 | } |
413 | 418 | ||
414 | void Incidence::removeRelation(Incidence *event) | 419 | void Incidence::removeRelation(Incidence *event) |
415 | { | 420 | { |
416 | 421 | ||
417 | mRelations.removeRef(event); | 422 | mRelations.removeRef(event); |
418 | 423 | ||
419 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 424 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
420 | } | 425 | } |
421 | 426 | ||
422 | bool Incidence::recursOn(const QDate &qd) const | 427 | bool Incidence::recursOn(const QDate &qd) const |
423 | { | 428 | { |
424 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 429 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
425 | else return false; | 430 | else return false; |
426 | } | 431 | } |
427 | 432 | ||
428 | void Incidence::setExDates(const DateList &exDates) | 433 | void Incidence::setExDates(const DateList &exDates) |
429 | { | 434 | { |
430 | if (mReadOnly) return; | 435 | if (mReadOnly) return; |
431 | mExDates = exDates; | 436 | mExDates = exDates; |
432 | 437 | ||
433 | recurrence()->setRecurExDatesCount(mExDates.count()); | 438 | recurrence()->setRecurExDatesCount(mExDates.count()); |
434 | 439 | ||
435 | updated(); | 440 | updated(); |
436 | } | 441 | } |
437 | 442 | ||
438 | void Incidence::addExDate(const QDate &date) | 443 | void Incidence::addExDate(const QDate &date) |
439 | { | 444 | { |
440 | if (mReadOnly) return; | 445 | if (mReadOnly) return; |
441 | mExDates.append(date); | 446 | mExDates.append(date); |
442 | 447 | ||
443 | recurrence()->setRecurExDatesCount(mExDates.count()); | 448 | recurrence()->setRecurExDatesCount(mExDates.count()); |
444 | 449 | ||
445 | updated(); | 450 | updated(); |
446 | } | 451 | } |
447 | 452 | ||
448 | DateList Incidence::exDates() const | 453 | DateList Incidence::exDates() const |
449 | { | 454 | { |
450 | return mExDates; | 455 | return mExDates; |
451 | } | 456 | } |
452 | 457 | ||
453 | bool Incidence::isException(const QDate &date) const | 458 | bool Incidence::isException(const QDate &date) const |
454 | { | 459 | { |
455 | DateList::ConstIterator it; | 460 | DateList::ConstIterator it; |
456 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { | 461 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { |
457 | if ( (*it) == date ) { | 462 | if ( (*it) == date ) { |
458 | return true; | 463 | return true; |
459 | } | 464 | } |
460 | } | 465 | } |
461 | 466 | ||
462 | return false; | 467 | return false; |
463 | } | 468 | } |
464 | 469 | ||
465 | void Incidence::addAttachment(Attachment *attachment) | 470 | void Incidence::addAttachment(Attachment *attachment) |
466 | { | 471 | { |
467 | if (mReadOnly || !attachment) return; | 472 | if (mReadOnly || !attachment) return; |
468 | mAttachments.append(attachment); | 473 | mAttachments.append(attachment); |
469 | updated(); | 474 | updated(); |
470 | } | 475 | } |
471 | 476 | ||
472 | void Incidence::deleteAttachment(Attachment *attachment) | 477 | void Incidence::deleteAttachment(Attachment *attachment) |
473 | { | 478 | { |
474 | mAttachments.removeRef(attachment); | 479 | mAttachments.removeRef(attachment); |
475 | } | 480 | } |
476 | 481 | ||
477 | void Incidence::deleteAttachments(const QString& mime) | 482 | void Incidence::deleteAttachments(const QString& mime) |
478 | { | 483 | { |
479 | Attachment *at = mAttachments.first(); | 484 | Attachment *at = mAttachments.first(); |
480 | while (at) { | 485 | while (at) { |
481 | if (at->mimeType() == mime) | 486 | if (at->mimeType() == mime) |
482 | mAttachments.remove(); | 487 | mAttachments.remove(); |
483 | else | 488 | else |
484 | at = mAttachments.next(); | 489 | at = mAttachments.next(); |
485 | } | 490 | } |
486 | } | 491 | } |
487 | 492 | ||
488 | QPtrList<Attachment> Incidence::attachments() const | 493 | QPtrList<Attachment> Incidence::attachments() const |
489 | { | 494 | { |
490 | return mAttachments; | 495 | return mAttachments; |
491 | } | 496 | } |
492 | 497 | ||
493 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const | 498 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const |
494 | { | 499 | { |
495 | QPtrList<Attachment> attachments; | 500 | QPtrList<Attachment> attachments; |
496 | QPtrListIterator<Attachment> it( mAttachments ); | 501 | QPtrListIterator<Attachment> it( mAttachments ); |
497 | Attachment *at; | 502 | Attachment *at; |
498 | while ( (at = it.current()) ) { | 503 | while ( (at = it.current()) ) { |
499 | if (at->mimeType() == mime) | 504 | if (at->mimeType() == mime) |
500 | attachments.append(at); | 505 | attachments.append(at); |
501 | ++it; | 506 | ++it; |
502 | } | 507 | } |
503 | 508 | ||
504 | return attachments; | 509 | return attachments; |
505 | } | 510 | } |
506 | 511 | ||
507 | void Incidence::setResources(const QStringList &resources) | 512 | void Incidence::setResources(const QStringList &resources) |
508 | { | 513 | { |
509 | if (mReadOnly) return; | 514 | if (mReadOnly) return; |
510 | mResources = resources; | 515 | mResources = resources; |
511 | updated(); | 516 | updated(); |
512 | } | 517 | } |
513 | 518 | ||
514 | QStringList Incidence::resources() const | 519 | QStringList Incidence::resources() const |
515 | { | 520 | { |
516 | return mResources; | 521 | return mResources; |
517 | } | 522 | } |
518 | 523 | ||
519 | 524 | ||
520 | void Incidence::setPriority(int priority) | 525 | void Incidence::setPriority(int priority) |
521 | { | 526 | { |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 8794f7a..7906046 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,233 +1,231 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <kglobalsettings.h> | 22 | #include <kglobalsettings.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | 26 | ||
27 | #include "calendarlocal.h" | ||
28 | #include "icalformat.h" | ||
27 | #include "todo.h" | 29 | #include "todo.h" |
28 | 30 | ||
29 | using namespace KCal; | 31 | using namespace KCal; |
30 | 32 | ||
31 | Todo::Todo(): Incidence() | 33 | Todo::Todo(): Incidence() |
32 | { | 34 | { |
33 | // mStatus = TENTATIVE; | 35 | // mStatus = TENTATIVE; |
34 | 36 | ||
35 | mHasDueDate = false; | 37 | mHasDueDate = false; |
36 | setHasStartDate( false ); | 38 | setHasStartDate( false ); |
37 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 39 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
38 | mHasCompletedDate = false; | 40 | mHasCompletedDate = false; |
39 | mPercentComplete = 0; | 41 | mPercentComplete = 0; |
40 | mRunning = false; | 42 | mRunning = false; |
41 | mRunSaveTimer = 0; | 43 | mRunSaveTimer = 0; |
42 | } | 44 | } |
43 | 45 | ||
44 | Todo::Todo(const Todo &t) : Incidence(t) | 46 | Todo::Todo(const Todo &t) : Incidence(t) |
45 | { | 47 | { |
46 | mDtDue = t.mDtDue; | 48 | mDtDue = t.mDtDue; |
47 | mHasDueDate = t.mHasDueDate; | 49 | mHasDueDate = t.mHasDueDate; |
48 | mCompleted = t.mCompleted; | 50 | mCompleted = t.mCompleted; |
49 | mHasCompletedDate = t.mHasCompletedDate; | 51 | mHasCompletedDate = t.mHasCompletedDate; |
50 | mPercentComplete = t.mPercentComplete; | 52 | mPercentComplete = t.mPercentComplete; |
51 | mRunning = false; | 53 | mRunning = false; |
52 | mRunSaveTimer = 0; | 54 | mRunSaveTimer = 0; |
53 | } | 55 | } |
54 | 56 | ||
55 | Todo::~Todo() | 57 | Todo::~Todo() |
56 | { | 58 | { |
57 | setRunning( false ); | 59 | setRunning( false ); |
60 | qDebug("Todo::~Todo() "); | ||
58 | } | 61 | } |
59 | 62 | ||
60 | void Todo::setRunning( bool run ) | 63 | void Todo::setRunning( bool run ) |
61 | { | 64 | { |
62 | if ( run == mRunning ) | 65 | if ( run == mRunning ) |
63 | return; | 66 | return; |
64 | if ( !mRunSaveTimer ) { | 67 | if ( !mRunSaveTimer ) { |
65 | mRunSaveTimer = new QTimer ( this ); | 68 | mRunSaveTimer = new QTimer ( this ); |
66 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 69 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
67 | } | 70 | } |
68 | mRunning = run; | 71 | mRunning = run; |
69 | if ( mRunning ) { | 72 | if ( mRunning ) { |
70 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 73 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
71 | mRunStart = QDateTime::currentDateTime(); | 74 | mRunStart = QDateTime::currentDateTime(); |
72 | } else { | 75 | } else { |
73 | mRunSaveTimer->stop(); | 76 | mRunSaveTimer->stop(); |
74 | saveRunningInfoToFile(); | 77 | saveRunningInfoToFile(); |
75 | } | 78 | } |
76 | } | 79 | } |
77 | 80 | ||
78 | void Todo::saveRunningInfoToFile() | 81 | void Todo::saveRunningInfoToFile() |
79 | { | 82 | { |
80 | qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 83 | qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
81 | 84 | ||
82 | QString dir = KGlobalSettings::timeTrackerDir(); | 85 | QString dir = KGlobalSettings::timeTrackerDir(); |
83 | qDebug("%s ", dir.latin1()); | 86 | qDebug("%s ", dir.latin1()); |
84 | QString file = "%1-%2-%3-%4-%5-%6-%7.tt"; | 87 | QString file = "%1%2%3-%4%5%6-%7%8%9-"; |
85 | 88 | int runtime = mRunStart.secsTo( QDateTime::currentDateTime() ); | |
86 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ).arg( mRunStart.time().msec(), 3 ); | 89 | runtime = (runtime / 60) +1; |
90 | int h = runtime / 60; | ||
91 | int m = runtime % 60; | ||
92 | int d = h / 24; | ||
93 | h = h % 24; | ||
94 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ).arg( d,3 ).arg( h,2 ).arg( m,2 ); | ||
87 | file.replace ( QRegExp (" "), "0" ); | 95 | file.replace ( QRegExp (" "), "0" ); |
88 | file = dir +"/" +file; | 96 | file = dir +"/" +file + uid()+".ics"; |
89 | qDebug("%s ", file.latin1()); | 97 | qDebug("File %s ",file.latin1() ); |
90 | QStringList dataList; | 98 | CalendarLocal cal; |
91 | 99 | cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); | |
92 | //Summary | 100 | cal.addIncidence( clone() ); |
93 | //Category | 101 | ICalFormat format; |
94 | //CategoryColor | 102 | format.save( &cal, file ); |
95 | //StartRuntime | ||
96 | //Runtime | ||
97 | //Due | ||
98 | //Start | ||
99 | //Prio | ||
100 | //Erledigt | ||
101 | //Uid | ||
102 | //Parents uids | ||
103 | 103 | ||
104 | |||
105 | |||
106 | } | 104 | } |
107 | 105 | ||
108 | int Todo::runTime() | 106 | int Todo::runTime() |
109 | { | 107 | { |
110 | if ( !mRunning ) | 108 | if ( !mRunning ) |
111 | return 0; | 109 | return 0; |
112 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 110 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
113 | } | 111 | } |
114 | bool Todo::hasRunningSub() | 112 | bool Todo::hasRunningSub() |
115 | { | 113 | { |
116 | if ( mRunning ) | 114 | if ( mRunning ) |
117 | return true; | 115 | return true; |
118 | Incidence *aTodo; | 116 | Incidence *aTodo; |
119 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 117 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
120 | if ( ((Todo*)aTodo)->hasRunningSub() ) | 118 | if ( ((Todo*)aTodo)->hasRunningSub() ) |
121 | return true; | 119 | return true; |
122 | } | 120 | } |
123 | return false; | 121 | return false; |
124 | } | 122 | } |
125 | Incidence *Todo::clone() | 123 | Incidence *Todo::clone() |
126 | { | 124 | { |
127 | return new Todo(*this); | 125 | return new Todo(*this); |
128 | } | 126 | } |
129 | 127 | ||
130 | bool Todo::contains ( Todo* from ) | 128 | bool Todo::contains ( Todo* from ) |
131 | { | 129 | { |
132 | 130 | ||
133 | if ( !from->summary().isEmpty() ) | 131 | if ( !from->summary().isEmpty() ) |
134 | if ( !summary().startsWith( from->summary() )) | 132 | if ( !summary().startsWith( from->summary() )) |
135 | return false; | 133 | return false; |
136 | if ( from->hasStartDate() ) { | 134 | if ( from->hasStartDate() ) { |
137 | if ( !hasStartDate() ) | 135 | if ( !hasStartDate() ) |
138 | return false; | 136 | return false; |
139 | if ( from->dtStart() != dtStart()) | 137 | if ( from->dtStart() != dtStart()) |
140 | return false; | 138 | return false; |
141 | } | 139 | } |
142 | if ( from->hasDueDate() ){ | 140 | if ( from->hasDueDate() ){ |
143 | if ( !hasDueDate() ) | 141 | if ( !hasDueDate() ) |
144 | return false; | 142 | return false; |
145 | if ( from->dtDue() != dtDue()) | 143 | if ( from->dtDue() != dtDue()) |
146 | return false; | 144 | return false; |
147 | } | 145 | } |
148 | if ( !from->location().isEmpty() ) | 146 | if ( !from->location().isEmpty() ) |
149 | if ( !location().startsWith( from->location() ) ) | 147 | if ( !location().startsWith( from->location() ) ) |
150 | return false; | 148 | return false; |
151 | if ( !from->description().isEmpty() ) | 149 | if ( !from->description().isEmpty() ) |
152 | if ( !description().startsWith( from->description() )) | 150 | if ( !description().startsWith( from->description() )) |
153 | return false; | 151 | return false; |
154 | if ( from->alarms().count() ) { | 152 | if ( from->alarms().count() ) { |
155 | Alarm *a = from->alarms().first(); | 153 | Alarm *a = from->alarms().first(); |
156 | if ( a->enabled() ){ | 154 | if ( a->enabled() ){ |
157 | if ( !alarms().count() ) | 155 | if ( !alarms().count() ) |
158 | return false; | 156 | return false; |
159 | Alarm *b = alarms().first(); | 157 | Alarm *b = alarms().first(); |
160 | if( ! b->enabled() ) | 158 | if( ! b->enabled() ) |
161 | return false; | 159 | return false; |
162 | if ( ! (a->offset() == b->offset() )) | 160 | if ( ! (a->offset() == b->offset() )) |
163 | return false; | 161 | return false; |
164 | } | 162 | } |
165 | } | 163 | } |
166 | 164 | ||
167 | QStringList cat = categories(); | 165 | QStringList cat = categories(); |
168 | QStringList catFrom = from->categories(); | 166 | QStringList catFrom = from->categories(); |
169 | QString nCat; | 167 | QString nCat; |
170 | unsigned int iii; | 168 | unsigned int iii; |
171 | for ( iii = 0; iii < catFrom.count();++iii ) { | 169 | for ( iii = 0; iii < catFrom.count();++iii ) { |
172 | nCat = catFrom[iii]; | 170 | nCat = catFrom[iii]; |
173 | if ( !nCat.isEmpty() ) | 171 | if ( !nCat.isEmpty() ) |
174 | if ( !cat.contains( nCat )) { | 172 | if ( !cat.contains( nCat )) { |
175 | return false; | 173 | return false; |
176 | } | 174 | } |
177 | } | 175 | } |
178 | if ( from->isCompleted() ) { | 176 | if ( from->isCompleted() ) { |
179 | if ( !isCompleted() ) | 177 | if ( !isCompleted() ) |
180 | return false; | 178 | return false; |
181 | } | 179 | } |
182 | if( priority() != from->priority() ) | 180 | if( priority() != from->priority() ) |
183 | return false; | 181 | return false; |
184 | 182 | ||
185 | 183 | ||
186 | return true; | 184 | return true; |
187 | 185 | ||
188 | } | 186 | } |
189 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 187 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
190 | { | 188 | { |
191 | 189 | ||
192 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 190 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
193 | if ( ! ret ) | 191 | if ( ! ret ) |
194 | return false; | 192 | return false; |
195 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 193 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
196 | if ( t1.hasDueDate() ) { | 194 | if ( t1.hasDueDate() ) { |
197 | if ( t1.doesFloat() == t2.doesFloat() ) { | 195 | if ( t1.doesFloat() == t2.doesFloat() ) { |
198 | if ( t1.doesFloat() ) { | 196 | if ( t1.doesFloat() ) { |
199 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 197 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
200 | return false; | 198 | return false; |
201 | } else | 199 | } else |
202 | if ( t1.dtDue() != t2.dtDue() ) | 200 | if ( t1.dtDue() != t2.dtDue() ) |
203 | return false; | 201 | return false; |
204 | } else | 202 | } else |
205 | return false;// float != | 203 | return false;// float != |
206 | } | 204 | } |
207 | 205 | ||
208 | } else | 206 | } else |
209 | return false; | 207 | return false; |
210 | if ( t1.percentComplete() != t2.percentComplete() ) | 208 | if ( t1.percentComplete() != t2.percentComplete() ) |
211 | return false; | 209 | return false; |
212 | if ( t1.isCompleted() ) { | 210 | if ( t1.isCompleted() ) { |
213 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { | 211 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { |
214 | if ( t1.hasCompletedDate() ) { | 212 | if ( t1.hasCompletedDate() ) { |
215 | if ( t1.completed() != t2.completed() ) | 213 | if ( t1.completed() != t2.completed() ) |
216 | return false; | 214 | return false; |
217 | } | 215 | } |
218 | 216 | ||
219 | } else | 217 | } else |
220 | return false; | 218 | return false; |
221 | } | 219 | } |
222 | return true; | 220 | return true; |
223 | 221 | ||
224 | } | 222 | } |
225 | 223 | ||
226 | void Todo::setDtDue(const QDateTime &dtDue) | 224 | void Todo::setDtDue(const QDateTime &dtDue) |
227 | { | 225 | { |
228 | //int diffsecs = mDtDue.secsTo(dtDue); | 226 | //int diffsecs = mDtDue.secsTo(dtDue); |
229 | 227 | ||
230 | /*if (mReadOnly) return; | 228 | /*if (mReadOnly) return; |
231 | const QPtrList<Alarm>& alarms = alarms(); | 229 | const QPtrList<Alarm>& alarms = alarms(); |
232 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { | 230 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { |
233 | if (alarm->enabled()) { | 231 | if (alarm->enabled()) { |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 62a31ae..8efc1ea 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -201,259 +201,259 @@ QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal | |||
201 | QString VCalFormat::toString( Calendar *calendar ) | 201 | QString VCalFormat::toString( Calendar *calendar ) |
202 | { | 202 | { |
203 | // TODO: Factor out VCalFormat::asString() | 203 | // TODO: Factor out VCalFormat::asString() |
204 | 204 | ||
205 | VObject *vcal = newVObject(VCCalProp); | 205 | VObject *vcal = newVObject(VCCalProp); |
206 | 206 | ||
207 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); | 207 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); |
208 | QString tmpStr = mCalendar->getTimeZoneStr(); | 208 | QString tmpStr = mCalendar->getTimeZoneStr(); |
209 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); | 209 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); |
210 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); | 210 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); |
211 | 211 | ||
212 | // TODO: Use all data. | 212 | // TODO: Use all data. |
213 | QPtrList<Event> events = calendar->events(); | 213 | QPtrList<Event> events = calendar->events(); |
214 | Event *event = events.first(); | 214 | Event *event = events.first(); |
215 | if ( !event ) return QString::null; | 215 | if ( !event ) return QString::null; |
216 | 216 | ||
217 | VObject *vevent = eventToVEvent( event ); | 217 | VObject *vevent = eventToVEvent( event ); |
218 | 218 | ||
219 | addVObjectProp( vcal, vevent ); | 219 | addVObjectProp( vcal, vevent ); |
220 | 220 | ||
221 | char *buf = writeMemVObject( 0, 0, vcal ); | 221 | char *buf = writeMemVObject( 0, 0, vcal ); |
222 | 222 | ||
223 | QString result( buf ); | 223 | QString result( buf ); |
224 | 224 | ||
225 | cleanVObject( vcal ); | 225 | cleanVObject( vcal ); |
226 | 226 | ||
227 | return result; | 227 | return result; |
228 | } | 228 | } |
229 | 229 | ||
230 | VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | 230 | VObject *VCalFormat::eventToVTodo(const Todo *anEvent) |
231 | { | 231 | { |
232 | VObject *vtodo; | 232 | VObject *vtodo; |
233 | QString tmpStr; | 233 | QString tmpStr; |
234 | 234 | ||
235 | 235 | ||
236 | vtodo = newVObject(VCTodoProp); | 236 | vtodo = newVObject(VCTodoProp); |
237 | 237 | ||
238 | // due date | 238 | // due date |
239 | if (anEvent->hasDueDate()) { | 239 | if (anEvent->hasDueDate()) { |
240 | tmpStr = qDateTimeToISO(anEvent->dtDue(), | 240 | tmpStr = qDateTimeToISO(anEvent->dtDue(), |
241 | !anEvent->doesFloat()); | 241 | !anEvent->doesFloat()); |
242 | addPropValue(vtodo, VCDueProp, tmpStr.local8Bit()); | 242 | addPropValue(vtodo, VCDueProp, tmpStr.local8Bit()); |
243 | } | 243 | } |
244 | 244 | ||
245 | // start date | 245 | // start date |
246 | if (anEvent->hasStartDate()) { | 246 | if (anEvent->hasStartDate()) { |
247 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 247 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
248 | !anEvent->doesFloat()); | 248 | !anEvent->doesFloat()); |
249 | addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit()); | 249 | addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit()); |
250 | } | 250 | } |
251 | 251 | ||
252 | // creation date | 252 | // creation date |
253 | tmpStr = qDateTimeToISO(anEvent->created()); | 253 | tmpStr = qDateTimeToISO(anEvent->created()); |
254 | addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit()); | 254 | addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit()); |
255 | 255 | ||
256 | // unique id | 256 | // unique id |
257 | addPropValue(vtodo, VCUniqueStringProp, | 257 | addPropValue(vtodo, VCUniqueStringProp, |
258 | anEvent->uid().local8Bit()); | 258 | anEvent->uid().local8Bit()); |
259 | 259 | ||
260 | // revision | 260 | // revision |
261 | tmpStr.sprintf("%i", anEvent->revision()); | 261 | tmpStr.sprintf("%i", anEvent->revision()); |
262 | addPropValue(vtodo, VCSequenceProp, tmpStr.local8Bit()); | 262 | addPropValue(vtodo, VCSequenceProp, tmpStr.local8Bit()); |
263 | 263 | ||
264 | // last modification date | 264 | // last modification date |
265 | tmpStr = qDateTimeToISO(anEvent->lastModified()); | 265 | tmpStr = qDateTimeToISO(anEvent->lastModified()); |
266 | addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit()); | 266 | addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit()); |
267 | 267 | ||
268 | // organizer stuff | 268 | // organizer stuff |
269 | tmpStr = "MAILTO:" + anEvent->organizer(); | 269 | tmpStr = "MAILTO:" + anEvent->organizer(); |
270 | addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); | 270 | addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); |
271 | 271 | ||
272 | // attendees | 272 | // attendees |
273 | if (anEvent->attendeeCount() != 0) { | 273 | if (anEvent->attendeeCount() != 0) { |
274 | QPtrList<Attendee> al = anEvent->attendees(); | 274 | QPtrList<Attendee> al = anEvent->attendees(); |
275 | QPtrListIterator<Attendee> ai(al); | 275 | QPtrListIterator<Attendee> ai(al); |
276 | Attendee *curAttendee; | 276 | Attendee *curAttendee; |
277 | 277 | ||
278 | for (; ai.current(); ++ai) { | 278 | for (; ai.current(); ++ai) { |
279 | curAttendee = ai.current(); | 279 | curAttendee = ai.current(); |
280 | if (!curAttendee->email().isEmpty() && | 280 | if (!curAttendee->email().isEmpty() && |
281 | !curAttendee->name().isEmpty()) | 281 | !curAttendee->name().isEmpty()) |
282 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + | 282 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + |
283 | curAttendee->email() + ">"; | 283 | curAttendee->email() + ">"; |
284 | else if (curAttendee->name().isEmpty()) | 284 | else if (curAttendee->name().isEmpty()) |
285 | tmpStr = "MAILTO: " + curAttendee->email(); | 285 | tmpStr = "MAILTO: " + curAttendee->email(); |
286 | else if (curAttendee->email().isEmpty()) | 286 | else if (curAttendee->email().isEmpty()) |
287 | tmpStr = "MAILTO: " + curAttendee->name(); | 287 | tmpStr = "MAILTO: " + curAttendee->name(); |
288 | else if (curAttendee->name().isEmpty() && | 288 | else if (curAttendee->name().isEmpty() && |
289 | curAttendee->email().isEmpty()) | 289 | curAttendee->email().isEmpty()) |
290 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; | 290 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; |
291 | VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit()); | 291 | VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit()); |
292 | addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); | 292 | addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); |
293 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); | 293 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); |
294 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); | 294 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | // description BL: | 298 | // description BL: |
299 | if (!anEvent->description().isEmpty()) { | 299 | if (!anEvent->description().isEmpty()) { |
300 | VObject *d = addPropValue(vtodo, VCDescriptionProp, | 300 | VObject *d = addPropValue(vtodo, VCDescriptionProp, |
301 | anEvent->description().local8Bit()); | 301 | anEvent->description().local8Bit()); |
302 | if (anEvent->description().find('\n') != -1) | 302 | if (anEvent->description().find('\n') != -1) |
303 | addProp(d, VCQuotedPrintableProp); | 303 | addProp(d, VCQuotedPrintableProp); |
304 | } | 304 | } |
305 | 305 | ||
306 | // summary | 306 | // summary |
307 | if (!anEvent->summary().isEmpty()) | 307 | if (!anEvent->summary().isEmpty()) |
308 | addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit()); | 308 | addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit()); |
309 | 309 | ||
310 | if (!anEvent->location().isEmpty()) | 310 | if (!anEvent->location().isEmpty()) |
311 | addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); | 311 | addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); |
312 | 312 | ||
313 | // completed | 313 | // completed |
314 | // status | 314 | // status |
315 | // backward compatibility, KOrganizer used to interpret only these two values | 315 | // backward compatibility, KOrganizer used to interpret only these two values |
316 | addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : | 316 | addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : |
317 | "NEEDS_ACTION"); | 317 | "NEEDS_ACTION"); |
318 | // completion date | 318 | // completion date |
319 | if (anEvent->hasCompletedDate()) { | 319 | if (anEvent->hasCompletedDate()) { |
320 | tmpStr = qDateTimeToISO(anEvent->completed()); | 320 | tmpStr = qDateTimeToISO(anEvent->completed()); |
321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); | 321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); |
322 | } | 322 | } |
323 | 323 | ||
324 | // priority | 324 | // priority |
325 | tmpStr.sprintf("%i",anEvent->priority()); | 325 | tmpStr.sprintf("%i",anEvent->priority()); |
326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); | 326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); |
327 | 327 | ||
328 | // related event | 328 | // related event |
329 | if (anEvent->relatedTo()) { | 329 | if (anEvent->relatedToUid()) { |
330 | addPropValue(vtodo, VCRelatedToProp, | 330 | addPropValue(vtodo, VCRelatedToProp, |
331 | anEvent->relatedTo()->uid().local8Bit()); | 331 | anEvent->relatedToUid().local8Bit()); |
332 | } | 332 | } |
333 | 333 | ||
334 | // categories | 334 | // categories |
335 | QStringList tmpStrList = anEvent->categories(); | 335 | QStringList tmpStrList = anEvent->categories(); |
336 | tmpStr = ""; | 336 | tmpStr = ""; |
337 | QString catStr; | 337 | QString catStr; |
338 | for ( QStringList::Iterator it = tmpStrList.begin(); | 338 | for ( QStringList::Iterator it = tmpStrList.begin(); |
339 | it != tmpStrList.end(); | 339 | it != tmpStrList.end(); |
340 | ++it ) { | 340 | ++it ) { |
341 | catStr = *it; | 341 | catStr = *it; |
342 | if (catStr[0] == ' ') | 342 | if (catStr[0] == ' ') |
343 | tmpStr += catStr.mid(1); | 343 | tmpStr += catStr.mid(1); |
344 | else | 344 | else |
345 | tmpStr += catStr; | 345 | tmpStr += catStr; |
346 | // this must be a ';' character as the vCalendar specification requires! | 346 | // this must be a ';' character as the vCalendar specification requires! |
347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
348 | // read in. | 348 | // read in. |
349 | tmpStr += ";"; | 349 | tmpStr += ";"; |
350 | } | 350 | } |
351 | if (!tmpStr.isEmpty()) { | 351 | if (!tmpStr.isEmpty()) { |
352 | tmpStr.truncate(tmpStr.length()-1); | 352 | tmpStr.truncate(tmpStr.length()-1); |
353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); | 353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); |
354 | } | 354 | } |
355 | 355 | ||
356 | // alarm stuff | 356 | // alarm stuff |
357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; | 357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; |
358 | QPtrList<Alarm> alarms = anEvent->alarms(); | 358 | QPtrList<Alarm> alarms = anEvent->alarms(); |
359 | Alarm* alarm; | 359 | Alarm* alarm; |
360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
361 | if (alarm->enabled()) { | 361 | if (alarm->enabled()) { |
362 | VObject *a; | 362 | VObject *a; |
363 | tmpStr = qDateTimeToISO(alarm->time()); | 363 | tmpStr = qDateTimeToISO(alarm->time()); |
364 | if (alarm->type() == Alarm::Audio) { | 364 | if (alarm->type() == Alarm::Audio) { |
365 | a = addProp(vtodo, VCAAlarmProp); | 365 | a = addProp(vtodo, VCAAlarmProp); |
366 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 366 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
367 | addPropValue(a, VCRepeatCountProp, "1"); | 367 | addPropValue(a, VCRepeatCountProp, "1"); |
368 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); | 368 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); |
369 | } | 369 | } |
370 | else if (alarm->type() == Alarm::Procedure) { | 370 | else if (alarm->type() == Alarm::Procedure) { |
371 | a = addProp(vtodo, VCPAlarmProp); | 371 | a = addProp(vtodo, VCPAlarmProp); |
372 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 372 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
373 | addPropValue(a, VCRepeatCountProp, "1"); | 373 | addPropValue(a, VCRepeatCountProp, "1"); |
374 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); | 374 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); |
375 | } else { | 375 | } else { |
376 | a = addProp(vtodo, VCDAlarmProp); | 376 | a = addProp(vtodo, VCDAlarmProp); |
377 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 377 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
378 | addPropValue(a, VCRepeatCountProp, "1"); | 378 | addPropValue(a, VCRepeatCountProp, "1"); |
379 | addPropValue(a, VCDisplayStringProp, "beep!"); | 379 | addPropValue(a, VCDisplayStringProp, "beep!"); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | if (anEvent->pilotId()) { | 384 | if (anEvent->pilotId()) { |
385 | // pilot sync stuff | 385 | // pilot sync stuff |
386 | tmpStr.sprintf("%i",anEvent->pilotId()); | 386 | tmpStr.sprintf("%i",anEvent->pilotId()); |
387 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); | 387 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); |
388 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 388 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); | 389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); |
390 | } | 390 | } |
391 | 391 | ||
392 | return vtodo; | 392 | return vtodo; |
393 | } | 393 | } |
394 | 394 | ||
395 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) | 395 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) |
396 | { | 396 | { |
397 | VObject *vevent; | 397 | VObject *vevent; |
398 | QString tmpStr; | 398 | QString tmpStr; |
399 | 399 | ||
400 | vevent = newVObject(VCEventProp); | 400 | vevent = newVObject(VCEventProp); |
401 | 401 | ||
402 | // start and end time | 402 | // start and end time |
403 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 403 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
404 | !anEvent->doesFloat()); | 404 | !anEvent->doesFloat()); |
405 | addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit()); | 405 | addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit()); |
406 | 406 | ||
407 | // events that have time associated but take up no time should | 407 | // events that have time associated but take up no time should |
408 | // not have both DTSTART and DTEND. | 408 | // not have both DTSTART and DTEND. |
409 | if (anEvent->dtStart() != anEvent->dtEnd()) { | 409 | if (anEvent->dtStart() != anEvent->dtEnd()) { |
410 | tmpStr = qDateTimeToISO(anEvent->dtEnd(), | 410 | tmpStr = qDateTimeToISO(anEvent->dtEnd(), |
411 | !anEvent->doesFloat()); | 411 | !anEvent->doesFloat()); |
412 | addPropValue(vevent, VCDTendProp, tmpStr.local8Bit()); | 412 | addPropValue(vevent, VCDTendProp, tmpStr.local8Bit()); |
413 | } | 413 | } |
414 | 414 | ||
415 | // creation date | 415 | // creation date |
416 | tmpStr = qDateTimeToISO(anEvent->created()); | 416 | tmpStr = qDateTimeToISO(anEvent->created()); |
417 | addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit()); | 417 | addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit()); |
418 | 418 | ||
419 | // unique id | 419 | // unique id |
420 | addPropValue(vevent, VCUniqueStringProp, | 420 | addPropValue(vevent, VCUniqueStringProp, |
421 | anEvent->uid().local8Bit()); | 421 | anEvent->uid().local8Bit()); |
422 | 422 | ||
423 | // revision | 423 | // revision |
424 | tmpStr.sprintf("%i", anEvent->revision()); | 424 | tmpStr.sprintf("%i", anEvent->revision()); |
425 | addPropValue(vevent, VCSequenceProp, tmpStr.local8Bit()); | 425 | addPropValue(vevent, VCSequenceProp, tmpStr.local8Bit()); |
426 | 426 | ||
427 | // last modification date | 427 | // last modification date |
428 | tmpStr = qDateTimeToISO(anEvent->lastModified()); | 428 | tmpStr = qDateTimeToISO(anEvent->lastModified()); |
429 | addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit()); | 429 | addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit()); |
430 | 430 | ||
431 | // attendee and organizer stuff | 431 | // attendee and organizer stuff |
432 | tmpStr = "MAILTO:" + anEvent->organizer(); | 432 | tmpStr = "MAILTO:" + anEvent->organizer(); |
433 | addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); | 433 | addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); |
434 | 434 | ||
435 | if (anEvent->attendeeCount() != 0) { | 435 | if (anEvent->attendeeCount() != 0) { |
436 | QPtrList<Attendee> al = anEvent->attendees(); | 436 | QPtrList<Attendee> al = anEvent->attendees(); |
437 | QPtrListIterator<Attendee> ai(al); | 437 | QPtrListIterator<Attendee> ai(al); |
438 | Attendee *curAttendee; | 438 | Attendee *curAttendee; |
439 | 439 | ||
440 | // TODO: Put this functionality into Attendee class | 440 | // TODO: Put this functionality into Attendee class |
441 | for (; ai.current(); ++ai) { | 441 | for (; ai.current(); ++ai) { |
442 | curAttendee = ai.current(); | 442 | curAttendee = ai.current(); |
443 | if (!curAttendee->email().isEmpty() && | 443 | if (!curAttendee->email().isEmpty() && |
444 | !curAttendee->name().isEmpty()) | 444 | !curAttendee->name().isEmpty()) |
445 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + | 445 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + |
446 | curAttendee->email() + ">"; | 446 | curAttendee->email() + ">"; |
447 | else if (curAttendee->name().isEmpty()) | 447 | else if (curAttendee->name().isEmpty()) |
448 | tmpStr = "MAILTO: " + curAttendee->email(); | 448 | tmpStr = "MAILTO: " + curAttendee->email(); |
449 | else if (curAttendee->email().isEmpty()) | 449 | else if (curAttendee->email().isEmpty()) |
450 | tmpStr = "MAILTO: " + curAttendee->name(); | 450 | tmpStr = "MAILTO: " + curAttendee->name(); |
451 | else if (curAttendee->name().isEmpty() && | 451 | else if (curAttendee->name().isEmpty() && |
452 | curAttendee->email().isEmpty()) | 452 | curAttendee->email().isEmpty()) |
453 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; | 453 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; |
454 | VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); | 454 | VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); |
455 | addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); | 455 | addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); |
456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); | 456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); |
457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); | 457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); |
458 | } | 458 | } |
459 | } | 459 | } |
@@ -547,259 +547,259 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
547 | } else { | 547 | } else { |
548 | tmpStr += qDateTimeToISO(anEvent->recurrence()->endDate(), FALSE); | 548 | tmpStr += qDateTimeToISO(anEvent->recurrence()->endDate(), FALSE); |
549 | } | 549 | } |
550 | addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); | 550 | addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); |
551 | 551 | ||
552 | } // event repeats | 552 | } // event repeats |
553 | 553 | ||
554 | // exceptions to recurrence | 554 | // exceptions to recurrence |
555 | DateList dateList = anEvent->exDates(); | 555 | DateList dateList = anEvent->exDates(); |
556 | DateList::ConstIterator it; | 556 | DateList::ConstIterator it; |
557 | QString tmpStr2; | 557 | QString tmpStr2; |
558 | 558 | ||
559 | for (it = dateList.begin(); it != dateList.end(); ++it) { | 559 | for (it = dateList.begin(); it != dateList.end(); ++it) { |
560 | tmpStr = qDateToISO(*it) + ";"; | 560 | tmpStr = qDateToISO(*it) + ";"; |
561 | tmpStr2 += tmpStr; | 561 | tmpStr2 += tmpStr; |
562 | } | 562 | } |
563 | if (!tmpStr2.isEmpty()) { | 563 | if (!tmpStr2.isEmpty()) { |
564 | tmpStr2.truncate(tmpStr2.length()-1); | 564 | tmpStr2.truncate(tmpStr2.length()-1); |
565 | addPropValue(vevent, VCExpDateProp, tmpStr2.local8Bit()); | 565 | addPropValue(vevent, VCExpDateProp, tmpStr2.local8Bit()); |
566 | } | 566 | } |
567 | 567 | ||
568 | // description | 568 | // description |
569 | if (!anEvent->description().isEmpty()) { | 569 | if (!anEvent->description().isEmpty()) { |
570 | VObject *d = addPropValue(vevent, VCDescriptionProp, | 570 | VObject *d = addPropValue(vevent, VCDescriptionProp, |
571 | anEvent->description().local8Bit()); | 571 | anEvent->description().local8Bit()); |
572 | if (anEvent->description().find('\n') != -1) | 572 | if (anEvent->description().find('\n') != -1) |
573 | addProp(d, VCQuotedPrintableProp); | 573 | addProp(d, VCQuotedPrintableProp); |
574 | } | 574 | } |
575 | 575 | ||
576 | // summary | 576 | // summary |
577 | if (!anEvent->summary().isEmpty()) | 577 | if (!anEvent->summary().isEmpty()) |
578 | addPropValue(vevent, VCSummaryProp, anEvent->summary().local8Bit()); | 578 | addPropValue(vevent, VCSummaryProp, anEvent->summary().local8Bit()); |
579 | 579 | ||
580 | if (!anEvent->location().isEmpty()) | 580 | if (!anEvent->location().isEmpty()) |
581 | addPropValue(vevent, VCLocationProp, anEvent->location().local8Bit()); | 581 | addPropValue(vevent, VCLocationProp, anEvent->location().local8Bit()); |
582 | 582 | ||
583 | // status | 583 | // status |
584 | // TODO: define Event status | 584 | // TODO: define Event status |
585 | // addPropValue(vevent, VCStatusProp, anEvent->statusStr().local8Bit()); | 585 | // addPropValue(vevent, VCStatusProp, anEvent->statusStr().local8Bit()); |
586 | 586 | ||
587 | // secrecy | 587 | // secrecy |
588 | const char *text = 0; | 588 | const char *text = 0; |
589 | switch (anEvent->secrecy()) { | 589 | switch (anEvent->secrecy()) { |
590 | case Incidence::SecrecyPublic: | 590 | case Incidence::SecrecyPublic: |
591 | text = "PUBLIC"; | 591 | text = "PUBLIC"; |
592 | break; | 592 | break; |
593 | case Incidence::SecrecyPrivate: | 593 | case Incidence::SecrecyPrivate: |
594 | text = "PRIVATE"; | 594 | text = "PRIVATE"; |
595 | break; | 595 | break; |
596 | case Incidence::SecrecyConfidential: | 596 | case Incidence::SecrecyConfidential: |
597 | text = "CONFIDENTIAL"; | 597 | text = "CONFIDENTIAL"; |
598 | break; | 598 | break; |
599 | } | 599 | } |
600 | if (text) { | 600 | if (text) { |
601 | addPropValue(vevent, VCClassProp, text); | 601 | addPropValue(vevent, VCClassProp, text); |
602 | } | 602 | } |
603 | 603 | ||
604 | // categories | 604 | // categories |
605 | QStringList tmpStrList = anEvent->categories(); | 605 | QStringList tmpStrList = anEvent->categories(); |
606 | tmpStr = ""; | 606 | tmpStr = ""; |
607 | QString catStr; | 607 | QString catStr; |
608 | for ( QStringList::Iterator it = tmpStrList.begin(); | 608 | for ( QStringList::Iterator it = tmpStrList.begin(); |
609 | it != tmpStrList.end(); | 609 | it != tmpStrList.end(); |
610 | ++it ) { | 610 | ++it ) { |
611 | catStr = *it; | 611 | catStr = *it; |
612 | if (catStr[0] == ' ') | 612 | if (catStr[0] == ' ') |
613 | tmpStr += catStr.mid(1); | 613 | tmpStr += catStr.mid(1); |
614 | else | 614 | else |
615 | tmpStr += catStr; | 615 | tmpStr += catStr; |
616 | // this must be a ';' character as the vCalendar specification requires! | 616 | // this must be a ';' character as the vCalendar specification requires! |
617 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 617 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
618 | // read in. | 618 | // read in. |
619 | tmpStr += ";"; | 619 | tmpStr += ";"; |
620 | } | 620 | } |
621 | if (!tmpStr.isEmpty()) { | 621 | if (!tmpStr.isEmpty()) { |
622 | tmpStr.truncate(tmpStr.length()-1); | 622 | tmpStr.truncate(tmpStr.length()-1); |
623 | addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit()); | 623 | addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit()); |
624 | } | 624 | } |
625 | 625 | ||
626 | // attachments | 626 | // attachments |
627 | // TODO: handle binary attachments! | 627 | // TODO: handle binary attachments! |
628 | QPtrList<Attachment> attachments = anEvent->attachments(); | 628 | QPtrList<Attachment> attachments = anEvent->attachments(); |
629 | for ( Attachment *at = attachments.first(); at; at = attachments.next() ) | 629 | for ( Attachment *at = attachments.first(); at; at = attachments.next() ) |
630 | addPropValue(vevent, VCAttachProp, at->uri().local8Bit()); | 630 | addPropValue(vevent, VCAttachProp, at->uri().local8Bit()); |
631 | 631 | ||
632 | // resources | 632 | // resources |
633 | tmpStrList = anEvent->resources(); | 633 | tmpStrList = anEvent->resources(); |
634 | tmpStr = tmpStrList.join(";"); | 634 | tmpStr = tmpStrList.join(";"); |
635 | if (!tmpStr.isEmpty()) | 635 | if (!tmpStr.isEmpty()) |
636 | addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit()); | 636 | addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit()); |
637 | 637 | ||
638 | // alarm stuff | 638 | // alarm stuff |
639 | QPtrList<Alarm> alarms = anEvent->alarms(); | 639 | QPtrList<Alarm> alarms = anEvent->alarms(); |
640 | Alarm* alarm; | 640 | Alarm* alarm; |
641 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 641 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
642 | if (alarm->enabled()) { | 642 | if (alarm->enabled()) { |
643 | VObject *a ; | 643 | VObject *a ; |
644 | tmpStr = qDateTimeToISO(alarm->time()); | 644 | tmpStr = qDateTimeToISO(alarm->time()); |
645 | if (alarm->type() == Alarm::Audio) { | 645 | if (alarm->type() == Alarm::Audio) { |
646 | a = addProp(vevent, VCAAlarmProp); | 646 | a = addProp(vevent, VCAAlarmProp); |
647 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 647 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
648 | addPropValue(a, VCRepeatCountProp, "1"); | 648 | addPropValue(a, VCRepeatCountProp, "1"); |
649 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); | 649 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); |
650 | } | 650 | } |
651 | if (alarm->type() == Alarm::Procedure) { | 651 | if (alarm->type() == Alarm::Procedure) { |
652 | a = addProp(vevent, VCPAlarmProp); | 652 | a = addProp(vevent, VCPAlarmProp); |
653 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 653 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
654 | addPropValue(a, VCRepeatCountProp, "1"); | 654 | addPropValue(a, VCRepeatCountProp, "1"); |
655 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); | 655 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); |
656 | } else { | 656 | } else { |
657 | a = addProp(vevent, VCDAlarmProp); | 657 | a = addProp(vevent, VCDAlarmProp); |
658 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 658 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
659 | addPropValue(a, VCRepeatCountProp, "1"); | 659 | addPropValue(a, VCRepeatCountProp, "1"); |
660 | addPropValue(a, VCDisplayStringProp, "beep!"); | 660 | addPropValue(a, VCDisplayStringProp, "beep!"); |
661 | 661 | ||
662 | } | 662 | } |
663 | } | 663 | } |
664 | } | 664 | } |
665 | 665 | ||
666 | // priority | 666 | // priority |
667 | tmpStr.sprintf("%i",anEvent->priority()); | 667 | tmpStr.sprintf("%i",anEvent->priority()); |
668 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); | 668 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); |
669 | 669 | ||
670 | // transparency | 670 | // transparency |
671 | tmpStr.sprintf("%i",anEvent->transparency()); | 671 | tmpStr.sprintf("%i",anEvent->transparency()); |
672 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); | 672 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); |
673 | 673 | ||
674 | // related event | 674 | // related event |
675 | if (anEvent->relatedTo()) { | 675 | if (anEvent->relatedToUid()) { |
676 | addPropValue(vevent, VCRelatedToProp, | 676 | addPropValue(vevent, VCRelatedToProp, |
677 | anEvent->relatedTo()->uid().local8Bit()); | 677 | anEvent->relatedToUid().local8Bit()); |
678 | } | 678 | } |
679 | 679 | ||
680 | if (anEvent->pilotId()) { | 680 | if (anEvent->pilotId()) { |
681 | // pilot sync stuff | 681 | // pilot sync stuff |
682 | tmpStr.sprintf("%i",anEvent->pilotId()); | 682 | tmpStr.sprintf("%i",anEvent->pilotId()); |
683 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); | 683 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); |
684 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 684 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
685 | addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit()); | 685 | addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit()); |
686 | } | 686 | } |
687 | 687 | ||
688 | return vevent; | 688 | return vevent; |
689 | } | 689 | } |
690 | 690 | ||
691 | Todo *VCalFormat::VTodoToEvent(VObject *vtodo) | 691 | Todo *VCalFormat::VTodoToEvent(VObject *vtodo) |
692 | { | 692 | { |
693 | VObject *vo; | 693 | VObject *vo; |
694 | VObjectIterator voi; | 694 | VObjectIterator voi; |
695 | char *s; | 695 | char *s; |
696 | 696 | ||
697 | Todo *anEvent = new Todo; | 697 | Todo *anEvent = new Todo; |
698 | 698 | ||
699 | // creation date | 699 | // creation date |
700 | if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) { | 700 | if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) { |
701 | anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); | 701 | anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); |
702 | deleteStr(s); | 702 | deleteStr(s); |
703 | } | 703 | } |
704 | 704 | ||
705 | // unique id | 705 | // unique id |
706 | vo = isAPropertyOf(vtodo, VCUniqueStringProp); | 706 | vo = isAPropertyOf(vtodo, VCUniqueStringProp); |
707 | // while the UID property is preferred, it is not required. We'll use the | 707 | // while the UID property is preferred, it is not required. We'll use the |
708 | // default Event UID if none is given. | 708 | // default Event UID if none is given. |
709 | if (vo) { | 709 | if (vo) { |
710 | anEvent->setUid(s = fakeCString(vObjectUStringZValue(vo))); | 710 | anEvent->setUid(s = fakeCString(vObjectUStringZValue(vo))); |
711 | deleteStr(s); | 711 | deleteStr(s); |
712 | } | 712 | } |
713 | 713 | ||
714 | // last modification date | 714 | // last modification date |
715 | if ((vo = isAPropertyOf(vtodo, VCLastModifiedProp)) != 0) { | 715 | if ((vo = isAPropertyOf(vtodo, VCLastModifiedProp)) != 0) { |
716 | anEvent->setLastModified(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); | 716 | anEvent->setLastModified(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); |
717 | deleteStr(s); | 717 | deleteStr(s); |
718 | } | 718 | } |
719 | else | 719 | else |
720 | anEvent->setLastModified(QDateTime(QDate::currentDate(), | 720 | anEvent->setLastModified(QDateTime(QDate::currentDate(), |
721 | QTime::currentTime())); | 721 | QTime::currentTime())); |
722 | 722 | ||
723 | // organizer | 723 | // organizer |
724 | // if our extension property for the event's ORGANIZER exists, add it. | 724 | // if our extension property for the event's ORGANIZER exists, add it. |
725 | if ((vo = isAPropertyOf(vtodo, ICOrganizerProp)) != 0) { | 725 | if ((vo = isAPropertyOf(vtodo, ICOrganizerProp)) != 0) { |
726 | anEvent->setOrganizer(s = fakeCString(vObjectUStringZValue(vo))); | 726 | anEvent->setOrganizer(s = fakeCString(vObjectUStringZValue(vo))); |
727 | deleteStr(s); | 727 | deleteStr(s); |
728 | } else { | 728 | } else { |
729 | anEvent->setOrganizer(mCalendar->getEmail()); | 729 | anEvent->setOrganizer(mCalendar->getEmail()); |
730 | } | 730 | } |
731 | 731 | ||
732 | // attendees. | 732 | // attendees. |
733 | initPropIterator(&voi, vtodo); | 733 | initPropIterator(&voi, vtodo); |
734 | while (moreIteration(&voi)) { | 734 | while (moreIteration(&voi)) { |
735 | vo = nextVObject(&voi); | 735 | vo = nextVObject(&voi); |
736 | if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { | 736 | if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { |
737 | Attendee *a; | 737 | Attendee *a; |
738 | VObject *vp; | 738 | VObject *vp; |
739 | s = fakeCString(vObjectUStringZValue(vo)); | 739 | s = fakeCString(vObjectUStringZValue(vo)); |
740 | QString tmpStr = QString::fromLocal8Bit(s); | 740 | QString tmpStr = QString::fromLocal8Bit(s); |
741 | deleteStr(s); | 741 | deleteStr(s); |
742 | tmpStr = tmpStr.simplifyWhiteSpace(); | 742 | tmpStr = tmpStr.simplifyWhiteSpace(); |
743 | int emailPos1, emailPos2; | 743 | int emailPos1, emailPos2; |
744 | if ((emailPos1 = tmpStr.find('<')) > 0) { | 744 | if ((emailPos1 = tmpStr.find('<')) > 0) { |
745 | // both email address and name | 745 | // both email address and name |
746 | emailPos2 = tmpStr.findRev('>'); | 746 | emailPos2 = tmpStr.findRev('>'); |
747 | a = new Attendee(tmpStr.left(emailPos1 - 1), | 747 | a = new Attendee(tmpStr.left(emailPos1 - 1), |
748 | tmpStr.mid(emailPos1 + 1, | 748 | tmpStr.mid(emailPos1 + 1, |
749 | emailPos2 - (emailPos1 + 1))); | 749 | emailPos2 - (emailPos1 + 1))); |
750 | } else if (tmpStr.find('@') > 0) { | 750 | } else if (tmpStr.find('@') > 0) { |
751 | // just an email address | 751 | // just an email address |
752 | a = new Attendee(0, tmpStr); | 752 | a = new Attendee(0, tmpStr); |
753 | } else { | 753 | } else { |
754 | // just a name | 754 | // just a name |
755 | // QString email = tmpStr.replace( QRegExp(" "), "." ); | 755 | // QString email = tmpStr.replace( QRegExp(" "), "." ); |
756 | a = new Attendee(tmpStr,0); | 756 | a = new Attendee(tmpStr,0); |
757 | } | 757 | } |
758 | // is there a Role property? | 758 | // is there a Role property? |
759 | if ((vp = isAPropertyOf(vo, VCRoleProp)) != 0) | 759 | if ((vp = isAPropertyOf(vo, VCRoleProp)) != 0) |
760 | a->setRole(readRole(vObjectStringZValue(vp))); | 760 | a->setRole(readRole(vObjectStringZValue(vp))); |
761 | // is there an RSVP property? | 761 | // is there an RSVP property? |
762 | if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0) | 762 | if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0) |
763 | a->setRSVP(vObjectStringZValue(vp)); | 763 | a->setRSVP(vObjectStringZValue(vp)); |
764 | // is there a status property? | 764 | // is there a status property? |
765 | if ((vp = isAPropertyOf(vo, VCStatusProp)) != 0) | 765 | if ((vp = isAPropertyOf(vo, VCStatusProp)) != 0) |
766 | a->setStatus(readStatus(vObjectStringZValue(vp))); | 766 | a->setStatus(readStatus(vObjectStringZValue(vp))); |
767 | // add the attendee | 767 | // add the attendee |
768 | anEvent->addAttendee(a); | 768 | anEvent->addAttendee(a); |
769 | } | 769 | } |
770 | } | 770 | } |
771 | 771 | ||
772 | // description for todo | 772 | // description for todo |
773 | if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != 0) { | 773 | if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != 0) { |
774 | s = fakeCString(vObjectUStringZValue(vo)); | 774 | s = fakeCString(vObjectUStringZValue(vo)); |
775 | anEvent->setDescription(QString::fromLocal8Bit(s)); | 775 | anEvent->setDescription(QString::fromLocal8Bit(s)); |
776 | deleteStr(s); | 776 | deleteStr(s); |
777 | } | 777 | } |
778 | 778 | ||
779 | // summary | 779 | // summary |
780 | if ((vo = isAPropertyOf(vtodo, VCSummaryProp))) { | 780 | if ((vo = isAPropertyOf(vtodo, VCSummaryProp))) { |
781 | s = fakeCString(vObjectUStringZValue(vo)); | 781 | s = fakeCString(vObjectUStringZValue(vo)); |
782 | anEvent->setSummary(QString::fromLocal8Bit(s)); | 782 | anEvent->setSummary(QString::fromLocal8Bit(s)); |
783 | deleteStr(s); | 783 | deleteStr(s); |
784 | } | 784 | } |
785 | if ((vo = isAPropertyOf(vtodo, VCLocationProp))) { | 785 | if ((vo = isAPropertyOf(vtodo, VCLocationProp))) { |
786 | s = fakeCString(vObjectUStringZValue(vo)); | 786 | s = fakeCString(vObjectUStringZValue(vo)); |
787 | anEvent->setLocation(QString::fromLocal8Bit(s)); | 787 | anEvent->setLocation(QString::fromLocal8Bit(s)); |
788 | deleteStr(s); | 788 | deleteStr(s); |
789 | } | 789 | } |
790 | 790 | ||
791 | 791 | ||
792 | // completed | 792 | // completed |
793 | // was: status | 793 | // was: status |
794 | if ((vo = isAPropertyOf(vtodo, VCStatusProp)) != 0) { | 794 | if ((vo = isAPropertyOf(vtodo, VCStatusProp)) != 0) { |
795 | s = fakeCString(vObjectUStringZValue(vo)); | 795 | s = fakeCString(vObjectUStringZValue(vo)); |
796 | if (strcmp(s,"COMPLETED") == 0) { | 796 | if (strcmp(s,"COMPLETED") == 0) { |
797 | anEvent->setCompleted(true); | 797 | anEvent->setCompleted(true); |
798 | } else { | 798 | } else { |
799 | anEvent->setCompleted(false); | 799 | anEvent->setCompleted(false); |
800 | } | 800 | } |
801 | deleteStr(s); | 801 | deleteStr(s); |
802 | } | 802 | } |
803 | else | 803 | else |
804 | anEvent->setCompleted(false); | 804 | anEvent->setCompleted(false); |
805 | 805 | ||
@@ -1479,233 +1479,237 @@ QDate VCalFormat::ISOToQDate(const QString &dateStr) | |||
1479 | // that is used internally in the VCalFormat. | 1479 | // that is used internally in the VCalFormat. |
1480 | void VCalFormat::populate(VObject *vcal) | 1480 | void VCalFormat::populate(VObject *vcal) |
1481 | { | 1481 | { |
1482 | // this function will populate the caldict dictionary and other event | 1482 | // this function will populate the caldict dictionary and other event |
1483 | // lists. It turns vevents into Events and then inserts them. | 1483 | // lists. It turns vevents into Events and then inserts them. |
1484 | 1484 | ||
1485 | VObjectIterator i; | 1485 | VObjectIterator i; |
1486 | VObject *curVO, *curVOProp; | 1486 | VObject *curVO, *curVOProp; |
1487 | Event *anEvent; | 1487 | Event *anEvent; |
1488 | 1488 | ||
1489 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { | 1489 | if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { |
1490 | char *methodType = 0; | 1490 | char *methodType = 0; |
1491 | methodType = fakeCString(vObjectUStringZValue(curVO)); | 1491 | methodType = fakeCString(vObjectUStringZValue(curVO)); |
1492 | kdDebug() << "This calendar is an iTIP transaction of type '" | 1492 | kdDebug() << "This calendar is an iTIP transaction of type '" |
1493 | << methodType << "'" << endl; | 1493 | << methodType << "'" << endl; |
1494 | delete methodType; | 1494 | delete methodType; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | // warn the user that we might have trouble reading non-known calendar. | 1497 | // warn the user that we might have trouble reading non-known calendar. |
1498 | if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != 0) { | 1498 | if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != 0) { |
1499 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1499 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1500 | if (strcmp(productId().local8Bit(), s) != 0) | 1500 | if (strcmp(productId().local8Bit(), s) != 0) |
1501 | kdDebug() << "This vCalendar file was not created by KOrganizer " | 1501 | kdDebug() << "This vCalendar file was not created by KOrganizer " |
1502 | "or any other product we support. Loading anyway..." << endl; | 1502 | "or any other product we support. Loading anyway..." << endl; |
1503 | mLoadedProductId = s; | 1503 | mLoadedProductId = s; |
1504 | deleteStr(s); | 1504 | deleteStr(s); |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | // warn the user we might have trouble reading this unknown version. | 1507 | // warn the user we might have trouble reading this unknown version. |
1508 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { | 1508 | if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { |
1509 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1509 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1510 | if (strcmp(_VCAL_VERSION, s) != 0) | 1510 | if (strcmp(_VCAL_VERSION, s) != 0) |
1511 | kdDebug() << "This vCalendar file has version " << s | 1511 | kdDebug() << "This vCalendar file has version " << s |
1512 | << "We only support " << _VCAL_VERSION << endl; | 1512 | << "We only support " << _VCAL_VERSION << endl; |
1513 | deleteStr(s); | 1513 | deleteStr(s); |
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | // set the time zone | 1516 | // set the time zone |
1517 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { | 1517 | if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { |
1518 | if ( vObjectUStringZValue(curVO) != 0 ) { | 1518 | if ( vObjectUStringZValue(curVO) != 0 ) { |
1519 | char *s = fakeCString(vObjectUStringZValue(curVO)); | 1519 | char *s = fakeCString(vObjectUStringZValue(curVO)); |
1520 | mCalendar->setTimeZone(s); | 1520 | mCalendar->setTimeZone(s); |
1521 | deleteStr(s); | 1521 | deleteStr(s); |
1522 | } | 1522 | } |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | // Store all events with a relatedTo property in a list for post-processing | 1525 | // Store all events with a relatedTo property in a list for post-processing |
1526 | mEventsRelate.clear(); | 1526 | mEventsRelate.clear(); |
1527 | mTodosRelate.clear(); | 1527 | mTodosRelate.clear(); |
1528 | 1528 | ||
1529 | initPropIterator(&i, vcal); | 1529 | initPropIterator(&i, vcal); |
1530 | 1530 | ||
1531 | // go through all the vobjects in the vcal | 1531 | // go through all the vobjects in the vcal |
1532 | while (moreIteration(&i)) { | 1532 | while (moreIteration(&i)) { |
1533 | curVO = nextVObject(&i); | 1533 | curVO = nextVObject(&i); |
1534 | 1534 | ||
1535 | /************************************************************************/ | 1535 | /************************************************************************/ |
1536 | 1536 | ||
1537 | // now, check to see that the object is an event or todo. | 1537 | // now, check to see that the object is an event or todo. |
1538 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { | 1538 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { |
1539 | 1539 | ||
1540 | if ((curVOProp = isAPropertyOf(curVO, XPilotStatusProp)) != 0) { | 1540 | if ((curVOProp = isAPropertyOf(curVO, XPilotStatusProp)) != 0) { |
1541 | char *s; | 1541 | char *s; |
1542 | s = fakeCString(vObjectUStringZValue(curVOProp)); | 1542 | s = fakeCString(vObjectUStringZValue(curVOProp)); |
1543 | // check to see if event was deleted by the kpilot conduit | 1543 | // check to see if event was deleted by the kpilot conduit |
1544 | if (atoi(s) == Event::SYNCDEL) { | 1544 | if (atoi(s) == Event::SYNCDEL) { |
1545 | deleteStr(s); | 1545 | deleteStr(s); |
1546 | kdDebug(5800) << "skipping pilot-deleted event" << endl; | 1546 | kdDebug(5800) << "skipping pilot-deleted event" << endl; |
1547 | goto SKIP; | 1547 | goto SKIP; |
1548 | } | 1548 | } |
1549 | deleteStr(s); | 1549 | deleteStr(s); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | // this code checks to see if we are trying to read in an event | 1552 | // this code checks to see if we are trying to read in an event |
1553 | // that we already find to be in the calendar. If we find this | 1553 | // that we already find to be in the calendar. If we find this |
1554 | // to be the case, we skip the event. | 1554 | // to be the case, we skip the event. |
1555 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { | 1555 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { |
1556 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); | 1556 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); |
1557 | QString tmpStr(s); | 1557 | QString tmpStr(s); |
1558 | deleteStr(s); | 1558 | deleteStr(s); |
1559 | 1559 | ||
1560 | if (mCalendar->event(tmpStr)) { | 1560 | if (mCalendar->event(tmpStr)) { |
1561 | goto SKIP; | 1561 | goto SKIP; |
1562 | } | 1562 | } |
1563 | if (mCalendar->todo(tmpStr)) { | 1563 | if (mCalendar->todo(tmpStr)) { |
1564 | goto SKIP; | 1564 | goto SKIP; |
1565 | } | 1565 | } |
1566 | } | 1566 | } |
1567 | 1567 | ||
1568 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && | 1568 | if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && |
1569 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { | 1569 | (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { |
1570 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; | 1570 | kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; |
1571 | goto SKIP; | 1571 | goto SKIP; |
1572 | } | 1572 | } |
1573 | 1573 | ||
1574 | anEvent = VEventToEvent(curVO); | 1574 | anEvent = VEventToEvent(curVO); |
1575 | // we now use addEvent instead of insertEvent so that the | 1575 | // we now use addEvent instead of insertEvent so that the |
1576 | // signal/slot get connected. | 1576 | // signal/slot get connected. |
1577 | if (anEvent) { | 1577 | if (anEvent) { |
1578 | if ( !anEvent->dtStart().isValid() || !anEvent->dtEnd().isValid() ) { | 1578 | if ( !anEvent->dtStart().isValid() || !anEvent->dtEnd().isValid() ) { |
1579 | kdDebug() << "VCalFormat::populate(): Event has invalid dates." | 1579 | kdDebug() << "VCalFormat::populate(): Event has invalid dates." |
1580 | << endl; | 1580 | << endl; |
1581 | } else { | 1581 | } else { |
1582 | mCalendar->addEvent(anEvent); | 1582 | mCalendar->addEvent(anEvent); |
1583 | } | 1583 | } |
1584 | } else { | 1584 | } else { |
1585 | // some sort of error must have occurred while in translation. | 1585 | // some sort of error must have occurred while in translation. |
1586 | goto SKIP; | 1586 | goto SKIP; |
1587 | } | 1587 | } |
1588 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { | 1588 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { |
1589 | Todo *aTodo = VTodoToEvent(curVO); | 1589 | Todo *aTodo = VTodoToEvent(curVO); |
1590 | mCalendar->addTodo(aTodo); | 1590 | mCalendar->addTodo(aTodo); |
1591 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || | 1591 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || |
1592 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || | 1592 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || |
1593 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { | 1593 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { |
1594 | // do nothing, we know these properties and we want to skip them. | 1594 | // do nothing, we know these properties and we want to skip them. |
1595 | // we have either already processed them or are ignoring them. | 1595 | // we have either already processed them or are ignoring them. |
1596 | ; | 1596 | ; |
1597 | } else { | 1597 | } else { |
1598 | kdDebug(5800) << "Ignoring unknown vObject \"" << vObjectName(curVO) << "\"" << endl; | 1598 | kdDebug(5800) << "Ignoring unknown vObject \"" << vObjectName(curVO) << "\"" << endl; |
1599 | } | 1599 | } |
1600 | SKIP: | 1600 | SKIP: |
1601 | ; | 1601 | ; |
1602 | } // while | 1602 | } // while |
1603 | 1603 | ||
1604 | // Post-Process list of events with relations, put Event objects in relation | 1604 | // Post-Process list of events with relations, put Event objects in relation |
1605 | Event *ev; | 1605 | Event *ev; |
1606 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { | 1606 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { |
1607 | ev->setRelatedTo(mCalendar->event(ev->relatedToUid())); | 1607 | Incidence * inc = mCalendar->event(ev->relatedToUid()); |
1608 | if ( inc ) | ||
1609 | ev->setRelatedTo( inc ); | ||
1608 | } | 1610 | } |
1609 | Todo *todo; | 1611 | Todo *todo; |
1610 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { | 1612 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { |
1611 | todo->setRelatedTo(mCalendar->todo(todo->relatedToUid())); | 1613 | Incidence * inc = mCalendar->todo(todo->relatedToUid()); |
1614 | if ( inc ) | ||
1615 | todo->setRelatedTo( inc ); | ||
1612 | } | 1616 | } |
1613 | } | 1617 | } |
1614 | 1618 | ||
1615 | const char *VCalFormat::dayFromNum(int day) | 1619 | const char *VCalFormat::dayFromNum(int day) |
1616 | { | 1620 | { |
1617 | const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " }; | 1621 | const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " }; |
1618 | 1622 | ||
1619 | return days[day]; | 1623 | return days[day]; |
1620 | } | 1624 | } |
1621 | 1625 | ||
1622 | int VCalFormat::numFromDay(const QString &day) | 1626 | int VCalFormat::numFromDay(const QString &day) |
1623 | { | 1627 | { |
1624 | if (day == "MO ") return 0; | 1628 | if (day == "MO ") return 0; |
1625 | if (day == "TU ") return 1; | 1629 | if (day == "TU ") return 1; |
1626 | if (day == "WE ") return 2; | 1630 | if (day == "WE ") return 2; |
1627 | if (day == "TH ") return 3; | 1631 | if (day == "TH ") return 3; |
1628 | if (day == "FR ") return 4; | 1632 | if (day == "FR ") return 4; |
1629 | if (day == "SA ") return 5; | 1633 | if (day == "SA ") return 5; |
1630 | if (day == "SU ") return 6; | 1634 | if (day == "SU ") return 6; |
1631 | 1635 | ||
1632 | return -1; // something bad happened. :) | 1636 | return -1; // something bad happened. :) |
1633 | } | 1637 | } |
1634 | Attendee::Role VCalFormat::readRole(const char *s) const | 1638 | Attendee::Role VCalFormat::readRole(const char *s) const |
1635 | { | 1639 | { |
1636 | QString statStr = s; | 1640 | QString statStr = s; |
1637 | statStr = statStr.upper(); | 1641 | statStr = statStr.upper(); |
1638 | Attendee::Role role = Attendee::ReqParticipant; | 1642 | Attendee::Role role = Attendee::ReqParticipant; |
1639 | 1643 | ||
1640 | if ( statStr == "OWNER") | 1644 | if ( statStr == "OWNER") |
1641 | role = Attendee::Chair; | 1645 | role = Attendee::Chair; |
1642 | // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; | 1646 | // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; |
1643 | 1647 | ||
1644 | return role; | 1648 | return role; |
1645 | } | 1649 | } |
1646 | 1650 | ||
1647 | QCString VCalFormat::writeRole(Attendee::Role role) const | 1651 | QCString VCalFormat::writeRole(Attendee::Role role) const |
1648 | { | 1652 | { |
1649 | if ( role == Attendee::Chair ) | 1653 | if ( role == Attendee::Chair ) |
1650 | return "OWNER"; | 1654 | return "OWNER"; |
1651 | return "ATTENDEE"; | 1655 | return "ATTENDEE"; |
1652 | } | 1656 | } |
1653 | Attendee::PartStat VCalFormat::readStatus(const char *s) const | 1657 | Attendee::PartStat VCalFormat::readStatus(const char *s) const |
1654 | { | 1658 | { |
1655 | QString statStr = s; | 1659 | QString statStr = s; |
1656 | statStr = statStr.upper(); | 1660 | statStr = statStr.upper(); |
1657 | Attendee::PartStat status; | 1661 | Attendee::PartStat status; |
1658 | 1662 | ||
1659 | if (statStr == "X-ACTION") | 1663 | if (statStr == "X-ACTION") |
1660 | status = Attendee::NeedsAction; | 1664 | status = Attendee::NeedsAction; |
1661 | else if (statStr == "NEEDS ACTION") | 1665 | else if (statStr == "NEEDS ACTION") |
1662 | status = Attendee::NeedsAction; | 1666 | status = Attendee::NeedsAction; |
1663 | else if (statStr== "ACCEPTED") | 1667 | else if (statStr== "ACCEPTED") |
1664 | status = Attendee::Accepted; | 1668 | status = Attendee::Accepted; |
1665 | else if (statStr== "SENT") | 1669 | else if (statStr== "SENT") |
1666 | status = Attendee::NeedsAction; | 1670 | status = Attendee::NeedsAction; |
1667 | else if (statStr== "TENTATIVE") | 1671 | else if (statStr== "TENTATIVE") |
1668 | status = Attendee::Tentative; | 1672 | status = Attendee::Tentative; |
1669 | else if (statStr== "CONFIRMED") | 1673 | else if (statStr== "CONFIRMED") |
1670 | status = Attendee::Accepted; | 1674 | status = Attendee::Accepted; |
1671 | else if (statStr== "DECLINED") | 1675 | else if (statStr== "DECLINED") |
1672 | status = Attendee::Declined; | 1676 | status = Attendee::Declined; |
1673 | else if (statStr== "COMPLETED") | 1677 | else if (statStr== "COMPLETED") |
1674 | status = Attendee::Completed; | 1678 | status = Attendee::Completed; |
1675 | else if (statStr== "DELEGATED") | 1679 | else if (statStr== "DELEGATED") |
1676 | status = Attendee::Delegated; | 1680 | status = Attendee::Delegated; |
1677 | else { | 1681 | else { |
1678 | kdDebug(5800) << "error setting attendee mStatus, unknown mStatus!" << endl; | 1682 | kdDebug(5800) << "error setting attendee mStatus, unknown mStatus!" << endl; |
1679 | status = Attendee::NeedsAction; | 1683 | status = Attendee::NeedsAction; |
1680 | } | 1684 | } |
1681 | 1685 | ||
1682 | return status; | 1686 | return status; |
1683 | } | 1687 | } |
1684 | 1688 | ||
1685 | QCString VCalFormat::writeStatus(Attendee::PartStat status) const | 1689 | QCString VCalFormat::writeStatus(Attendee::PartStat status) const |
1686 | { | 1690 | { |
1687 | switch(status) { | 1691 | switch(status) { |
1688 | default: | 1692 | default: |
1689 | case Attendee::NeedsAction: | 1693 | case Attendee::NeedsAction: |
1690 | return "NEEDS ACTION"; | 1694 | return "NEEDS ACTION"; |
1691 | break; | 1695 | break; |
1692 | case Attendee::Accepted: | 1696 | case Attendee::Accepted: |
1693 | return "ACCEPTED"; | 1697 | return "ACCEPTED"; |
1694 | break; | 1698 | break; |
1695 | case Attendee::Declined: | 1699 | case Attendee::Declined: |
1696 | return "DECLINED"; | 1700 | return "DECLINED"; |
1697 | break; | 1701 | break; |
1698 | case Attendee::Tentative: | 1702 | case Attendee::Tentative: |
1699 | return "TENTATIVE"; | 1703 | return "TENTATIVE"; |
1700 | break; | 1704 | break; |
1701 | case Attendee::Delegated: | 1705 | case Attendee::Delegated: |
1702 | return "DELEGATED"; | 1706 | return "DELEGATED"; |
1703 | break; | 1707 | break; |
1704 | case Attendee::Completed: | 1708 | case Attendee::Completed: |
1705 | return "COMPLETED"; | 1709 | return "COMPLETED"; |
1706 | break; | 1710 | break; |
1707 | case Attendee::InProcess: | 1711 | case Attendee::InProcess: |
1708 | return "NEEDS ACTION"; | 1712 | return "NEEDS ACTION"; |
1709 | break; | 1713 | break; |
1710 | } | 1714 | } |
1711 | } | 1715 | } |
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index e54b0d9..b65ce66 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -1,76 +1,77 @@ | |||
1 | #include "kglobalsettings.h" | 1 | #include "kglobalsettings.h" |
2 | #include "kconfig.h" | 2 | #include "kconfig.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | #include "kconfigbase.h" | 4 | #include "kconfigbase.h" |
5 | 5 | ||
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | QFont KGlobalSettings::generalFont() | 8 | QFont KGlobalSettings::generalFont() |
9 | { | 9 | { |
10 | int size = 12; | 10 | int size = 12; |
11 | if (QApplication::desktop()->width() < 480 ) { | 11 | if (QApplication::desktop()->width() < 480 ) { |
12 | size = 10; | 12 | size = 10; |
13 | } | 13 | } |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | else | 15 | else |
16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
17 | size = 18; | 17 | size = 18; |
18 | #endif | 18 | #endif |
19 | QFont f = QApplication::font(); | 19 | QFont f = QApplication::font(); |
20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); | 20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); |
21 | f.setPointSize( size ); | 21 | f.setPointSize( size ); |
22 | return f; | 22 | return f; |
23 | } | 23 | } |
24 | QFont KGlobalSettings::generalMaxFont() | 24 | QFont KGlobalSettings::generalMaxFont() |
25 | { | 25 | { |
26 | int size = 12; | 26 | int size = 12; |
27 | if (QApplication::desktop()->width() < 480 ) { | 27 | if (QApplication::desktop()->width() < 480 ) { |
28 | size = 10; | 28 | size = 10; |
29 | } | 29 | } |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | else | 31 | else |
32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
33 | size = 18; | 33 | size = 18; |
34 | #endif | 34 | #endif |
35 | QFont f = QApplication::font(); | 35 | QFont f = QApplication::font(); |
36 | if ( f.pointSize() > size ) | 36 | if ( f.pointSize() > size ) |
37 | f.setPointSize( size ); | 37 | f.setPointSize( size ); |
38 | return f; | 38 | return f; |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KGlobalSettings::timeTrackerDir() | 41 | QString KGlobalSettings::timeTrackerDir() |
42 | { | 42 | { |
43 | static QString dir; | 43 | static QString dir; |
44 | if ( dir.isEmpty() ) { | 44 | if ( dir.isEmpty() ) { |
45 | dir = locateLocal( "data", "timetracker" ); | 45 | dir = locateLocal( "data", "timetrackerdir/d.ttl" ); |
46 | dir = dir.left ( dir.length() - 5); | ||
46 | } | 47 | } |
47 | return dir; | 48 | return dir; |
48 | } | 49 | } |
49 | 50 | ||
50 | QFont KGlobalSettings::toolBarFont() | 51 | QFont KGlobalSettings::toolBarFont() |
51 | { | 52 | { |
52 | return QApplication::font(); | 53 | return QApplication::font(); |
53 | } | 54 | } |
54 | 55 | ||
55 | QColor KGlobalSettings::toolBarHighlightColor() | 56 | QColor KGlobalSettings::toolBarHighlightColor() |
56 | { | 57 | { |
57 | return QColor( "black" ); | 58 | return QColor( "black" ); |
58 | } | 59 | } |
59 | 60 | ||
60 | QRect KGlobalSettings::desktopGeometry( QWidget * ) | 61 | QRect KGlobalSettings::desktopGeometry( QWidget * ) |
61 | { | 62 | { |
62 | return QApplication::desktop()->rect(); | 63 | return QApplication::desktop()->rect(); |
63 | } | 64 | } |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Returns whether KDE runs in single (default) or double click | 67 | * Returns whether KDE runs in single (default) or double click |
67 | * mode. | 68 | * mode. |
68 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 69 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
69 | * @return true if single click mode, or false if double click mode. | 70 | * @return true if single click mode, or false if double click mode. |
70 | **/ | 71 | **/ |
71 | bool KGlobalSettings::singleClick() | 72 | bool KGlobalSettings::singleClick() |
72 | { | 73 | { |
73 | KConfig *c = KGlobal::config(); | 74 | KConfig *c = KGlobal::config(); |
74 | KConfigGroupSaver cgs( c, "KDE" ); | 75 | KConfigGroupSaver cgs( c, "KDE" ); |
75 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | 76 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); |
76 | } | 77 | } |