author | zautrix <zautrix> | 2005-07-27 23:40:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-27 23:40:19 (UTC) |
commit | 27ffa2e08ebb38e71f613af3a214750442418e2c (patch) (unidiff) | |
tree | de2bb4c541ab8795ee3739526e82ca8f4e952c09 | |
parent | 0e38cffd7ba745f237c659e1c48080fcb25b126c (diff) | |
download | kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.zip kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.tar.gz kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.tar.bz2 |
fixcxcx
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 1 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 17 | ||||
-rw-r--r-- | libkcal/icalformat.h | 3 | ||||
-rw-r--r-- | libkcal/todo.cpp | 7 |
5 files changed, 24 insertions, 10 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index eea9a4d..4aeb20c 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1096,33 +1096,37 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) | |||
1096 | return; | 1096 | return; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1102 | { | 1102 | { |
1103 | mMonthView->setPopupCell( this ); | 1103 | mMonthView->setPopupCell( this ); |
1104 | if ( !item ) { | 1104 | if ( !item ) { |
1105 | mMonthView->showContextMenu( 0 ); | 1105 | mMonthView->showContextMenu( 0 ); |
1106 | return; | 1106 | return; |
1107 | } | 1107 | } |
1108 | //selection( item ); | 1108 | //selection( item ); |
1109 | //qApp->processEvents(); | 1109 | //qApp->processEvents(); |
1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1111 | Incidence *incidence = eventItem->incidence(); | 1111 | Incidence *incidence = eventItem->incidence(); |
1112 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1112 | if ( incidence ) { |
1113 | mMonthView->showContextMenu( incidence ); | ||
1114 | selection( item ); | ||
1115 | doHighLight( incidence ); | ||
1116 | } | ||
1113 | } | 1117 | } |
1114 | 1118 | ||
1115 | void MonthViewCell::selection( QListBoxItem *item ) | 1119 | void MonthViewCell::selection( QListBoxItem *item ) |
1116 | { | 1120 | { |
1117 | if ( !item ) { | 1121 | if ( !item ) { |
1118 | emit highlightIncidence( 0 , this, 0 ); | 1122 | emit highlightIncidence( 0 , this, 0 ); |
1119 | return; | 1123 | return; |
1120 | } | 1124 | } |
1121 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); | 1125 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); |
1122 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); | 1126 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); |
1123 | mMonthView->setSelectedCell( this ); | 1127 | mMonthView->setSelectedCell( this ); |
1124 | } | 1128 | } |
1125 | 1129 | ||
1126 | void MonthViewCell::deHighLight() | 1130 | void MonthViewCell::deHighLight() |
1127 | { | 1131 | { |
1128 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1132 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e37a7ad..eef8327 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -52,32 +52,33 @@ CalendarLocal::CalendarLocal() | |||
52 | } | 52 | } |
53 | 53 | ||
54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) | 54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) |
55 | : Calendar(timeZoneId) | 55 | : Calendar(timeZoneId) |
56 | { | 56 | { |
57 | init(); | 57 | init(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void CalendarLocal::init() | 60 | void CalendarLocal::init() |
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | registerObserver( 0 ); | ||
68 | if ( mDeleteIncidencesOnClose ) | 69 | if ( mDeleteIncidencesOnClose ) |
69 | close(); | 70 | close(); |
70 | } | 71 | } |
71 | bool CalendarLocal::mergeCalendarFile( QString name ) | 72 | bool CalendarLocal::mergeCalendarFile( QString name ) |
72 | { | 73 | { |
73 | CalendarLocal calendar( timeZoneId() ); | 74 | CalendarLocal calendar( timeZoneId() ); |
74 | calendar.setDefaultCalendar( 1 ); | 75 | calendar.setDefaultCalendar( 1 ); |
75 | if ( calendar.load( name ) ) { | 76 | if ( calendar.load( name ) ) { |
76 | mergeCalendar( &calendar ); | 77 | mergeCalendar( &calendar ); |
77 | return true; | 78 | return true; |
78 | } | 79 | } |
79 | return false; | 80 | return false; |
80 | } | 81 | } |
81 | 82 | ||
82 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) | 83 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) |
83 | { | 84 | { |
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 5877406..6f3a799 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp | |||
@@ -37,34 +37,35 @@ extern "C" { | |||
37 | #include <icalss.h> | 37 | #include <icalss.h> |
38 | #include <icalparser.h> | 38 | #include <icalparser.h> |
39 | #include <icalrestriction.h> | 39 | #include <icalrestriction.h> |
40 | } | 40 | } |
41 | 41 | ||
42 | #include "calendar.h" | 42 | #include "calendar.h" |
43 | #include "calendarlocal.h" | 43 | #include "calendarlocal.h" |
44 | #include "journal.h" | 44 | #include "journal.h" |
45 | 45 | ||
46 | #include "icalformat.h" | 46 | #include "icalformat.h" |
47 | #include "icalformatimpl.h" | 47 | #include "icalformatimpl.h" |
48 | 48 | ||
49 | #define _ICAL_VERSION "2.0" | 49 | #define _ICAL_VERSION "2.0" |
50 | 50 | ||
51 | using namespace KCal; | 51 | using namespace KCal; |
52 | 52 | ||
53 | ICalFormat::ICalFormat( ) | 53 | ICalFormat::ICalFormat( bool pe ) |
54 | { | 54 | { |
55 | mProcessEvents = pe; | ||
55 | mImpl = new ICalFormatImpl( this ); | 56 | mImpl = new ICalFormatImpl( this ); |
56 | tzOffsetMin = 0; | 57 | tzOffsetMin = 0; |
57 | //qDebug("new ICalFormat() "); | 58 | //qDebug("new ICalFormat() "); |
58 | } | 59 | } |
59 | 60 | ||
60 | ICalFormat::~ICalFormat() | 61 | ICalFormat::~ICalFormat() |
61 | { | 62 | { |
62 | delete mImpl; | 63 | delete mImpl; |
63 | //qDebug("delete ICalFormat "); | 64 | //qDebug("delete ICalFormat "); |
64 | } | 65 | } |
65 | 66 | ||
66 | bool ICalFormat::load( Calendar *calendar, const QString &fileName) | 67 | bool ICalFormat::load( Calendar *calendar, const QString &fileName) |
67 | { | 68 | { |
68 | 69 | ||
69 | clearException(); | 70 | clearException(); |
70 | 71 | ||
@@ -176,57 +177,63 @@ Incidence *ICalFormat::fromString( const QString &text ) | |||
176 | QString ICalFormat::toString( Calendar *cal ) | 177 | QString ICalFormat::toString( Calendar *cal ) |
177 | { | 178 | { |
178 | 179 | ||
179 | setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); | 180 | setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); |
180 | 181 | ||
181 | icalcomponent *calendar = mImpl->createCalendarComponent(cal); | 182 | icalcomponent *calendar = mImpl->createCalendarComponent(cal); |
182 | 183 | ||
183 | icalcomponent *component; | 184 | icalcomponent *component; |
184 | 185 | ||
185 | // todos | 186 | // todos |
186 | QPtrList<Todo> todoList = cal->rawTodos(); | 187 | QPtrList<Todo> todoList = cal->rawTodos(); |
187 | QPtrListIterator<Todo> qlt(todoList); | 188 | QPtrListIterator<Todo> qlt(todoList); |
188 | for (; qlt.current(); ++qlt) { | 189 | for (; qlt.current(); ++qlt) { |
189 | component = mImpl->writeTodo(qlt.current()); | 190 | component = mImpl->writeTodo(qlt.current()); |
190 | icalcomponent_add_component(calendar,component); | 191 | icalcomponent_add_component(calendar,component); |
191 | //qDebug(" todos "); | 192 | //qDebug(" todos "); |
192 | qApp->processEvents(); | 193 | if ( mProcessEvents ) { |
194 | //qDebug("mProcessEvents "); | ||
195 | qApp->processEvents(); | ||
196 | } | ||
193 | } | 197 | } |
194 | // events | 198 | // events |
195 | QPtrList<Event> events = cal->rawEvents(); | 199 | QPtrList<Event> events = cal->rawEvents(); |
196 | Event *ev; | 200 | Event *ev; |
197 | for(ev=events.first();ev;ev=events.next()) { | 201 | for(ev=events.first();ev;ev=events.next()) { |
198 | component = mImpl->writeEvent(ev); | 202 | component = mImpl->writeEvent(ev); |
199 | icalcomponent_add_component(calendar,component); | 203 | icalcomponent_add_component(calendar,component); |
200 | //qDebug("events "); | 204 | //qDebug("events "); |
201 | qApp->processEvents(); | 205 | if ( mProcessEvents ) |
206 | qApp->processEvents(); | ||
202 | } | 207 | } |
203 | 208 | ||
204 | // journals | 209 | // journals |
205 | QPtrList<Journal> journals = cal->journals(); | 210 | QPtrList<Journal> journals = cal->journals(); |
206 | Journal *j; | 211 | Journal *j; |
207 | for(j=journals.first();j;j=journals.next()) { | 212 | for(j=journals.first();j;j=journals.next()) { |
208 | component = mImpl->writeJournal(j); | 213 | component = mImpl->writeJournal(j); |
209 | icalcomponent_add_component(calendar,component); | 214 | icalcomponent_add_component(calendar,component); |
210 | //qDebug("journals "); | 215 | //qDebug("journals "); |
211 | qApp->processEvents(); | 216 | if ( mProcessEvents ) |
217 | qApp->processEvents(); | ||
212 | } | 218 | } |
213 | const char *text; | 219 | const char *text; |
214 | QString ret =""; | 220 | QString ret =""; |
215 | text = icalcomponent_as_ical_string( calendar ); | 221 | text = icalcomponent_as_ical_string( calendar ); |
216 | qApp->processEvents(); | 222 | if ( mProcessEvents ) |
223 | qApp->processEvents(); | ||
217 | 224 | ||
218 | // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n"; | 225 | // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n"; |
219 | 226 | ||
220 | 227 | ||
221 | if ( text ) { | 228 | if ( text ) { |
222 | ret = QString ( text ); | 229 | ret = QString ( text ); |
223 | } | 230 | } |
224 | icalcomponent_free( calendar ); | 231 | icalcomponent_free( calendar ); |
225 | 232 | ||
226 | if (!text) { | 233 | if (!text) { |
227 | setException(new ErrorFormat(ErrorFormat::SaveError, | 234 | setException(new ErrorFormat(ErrorFormat::SaveError, |
228 | i18n("libical error"))); | 235 | i18n("libical error"))); |
229 | icalmemory_free_ring(); | 236 | icalmemory_free_ring(); |
230 | return QString::null; | 237 | return QString::null; |
231 | } | 238 | } |
232 | icalmemory_free_ring(); | 239 | icalmemory_free_ring(); |
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h index 485ab6e..a770dbb 100644 --- a/libkcal/icalformat.h +++ b/libkcal/icalformat.h | |||
@@ -27,33 +27,33 @@ | |||
27 | #include "calformat.h" | 27 | #include "calformat.h" |
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | 30 | ||
31 | class ICalFormatImpl; | 31 | class ICalFormatImpl; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | This class implements the iCalendar format. It provides methods for | 34 | This class implements the iCalendar format. It provides methods for |
35 | loading/saving/converting iCalendar format data into the internal KOrganizer | 35 | loading/saving/converting iCalendar format data into the internal KOrganizer |
36 | representation as Calendar and Events. | 36 | representation as Calendar and Events. |
37 | 37 | ||
38 | @short iCalendar format implementation | 38 | @short iCalendar format implementation |
39 | */ | 39 | */ |
40 | class ICalFormat : public CalFormat { | 40 | class ICalFormat : public CalFormat { |
41 | public: | 41 | public: |
42 | /** Create new iCalendar format. */ | 42 | /** Create new iCalendar format. */ |
43 | ICalFormat( ); | 43 | ICalFormat( bool pe = true); |
44 | virtual ~ICalFormat(); | 44 | virtual ~ICalFormat(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | Loads a calendar on disk in iCalendar format into calendar. | 47 | Loads a calendar on disk in iCalendar format into calendar. |
48 | Returns true if successful, else returns false. Provides more error | 48 | Returns true if successful, else returns false. Provides more error |
49 | information by exception(). | 49 | information by exception(). |
50 | @param calendar Calendar object to be filled. | 50 | @param calendar Calendar object to be filled. |
51 | @param fileName The name of the calendar file on disk. | 51 | @param fileName The name of the calendar file on disk. |
52 | */ | 52 | */ |
53 | bool load( Calendar *, const QString &fileName ); | 53 | bool load( Calendar *, const QString &fileName ); |
54 | /** | 54 | /** |
55 | Writes out the calendar to disk in iCalendar format. Returns true if | 55 | Writes out the calendar to disk in iCalendar format. Returns true if |
56 | successful and false on error. | 56 | successful and false on error. |
57 | 57 | ||
58 | @param calendar The Calendar object to be written. | 58 | @param calendar The Calendar object to be written. |
59 | @param fileName The name of the calendar file on disk. | 59 | @param fileName The name of the calendar file on disk. |
@@ -90,26 +90,27 @@ class ICalFormat : public CalFormat { | |||
90 | */ | 90 | */ |
91 | //bool fromString ( Recurrence *, const QString& ); | 91 | //bool fromString ( Recurrence *, const QString& ); |
92 | 92 | ||
93 | /** Create a scheduling message for event \a e using method \m */ | 93 | /** Create a scheduling message for event \a e using method \m */ |
94 | QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m); | 94 | QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m); |
95 | /** Parse scheduling message provided as string \s */ | 95 | /** Parse scheduling message provided as string \s */ |
96 | ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s); | 96 | ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s); |
97 | 97 | ||
98 | /** Set id of used time zone and whether this time zone is UTC or not. */ | 98 | /** Set id of used time zone and whether this time zone is UTC or not. */ |
99 | void setTimeZone( const QString &id, bool utc ); | 99 | void setTimeZone( const QString &id, bool utc ); |
100 | QString timeZoneId() const; | 100 | QString timeZoneId() const; |
101 | int timeOffset(); | 101 | int timeOffset(); |
102 | const char * tzString(); | 102 | const char * tzString(); |
103 | bool utc() const; | 103 | bool utc() const; |
104 | 104 | ||
105 | private: | 105 | private: |
106 | bool mProcessEvents; | ||
106 | ICalFormatImpl *mImpl; | 107 | ICalFormatImpl *mImpl; |
107 | QString mTimeZoneId; | 108 | QString mTimeZoneId; |
108 | QCString mTzString; | 109 | QCString mTzString; |
109 | int tzOffsetMin; | 110 | int tzOffsetMin; |
110 | bool mUtc; | 111 | bool mUtc; |
111 | }; | 112 | }; |
112 | 113 | ||
113 | } | 114 | } |
114 | 115 | ||
115 | #endif | 116 | #endif |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 4ada2d8..7bf756a 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -53,33 +53,34 @@ Todo::Todo(const Todo &t) : QObject(),Incidence(t) | |||
53 | mPercentComplete = t.mPercentComplete; | 53 | mPercentComplete = t.mPercentComplete; |
54 | mRunning = false; | 54 | mRunning = false; |
55 | mRunSaveTimer = 0; | 55 | mRunSaveTimer = 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | Todo::~Todo() | 58 | Todo::~Todo() |
59 | { | 59 | { |
60 | setRunning( false ); | 60 | setRunning( false ); |
61 | //qDebug("Todo::~Todo() "); | 61 | //qDebug("Todo::~Todo() "); |
62 | } | 62 | } |
63 | 63 | ||
64 | void Todo::setRunningFalse( QString s ) | 64 | void Todo::setRunningFalse( QString s ) |
65 | { | 65 | { |
66 | if ( ! mRunning ) | 66 | if ( ! mRunning ) |
67 | return; | 67 | return; |
68 | mRunning = false; | 68 | mRunning = false; |
69 | mRunSaveTimer->stop(); | 69 | if ( mRunSaveTimer ) |
70 | mRunSaveTimer->stop(); | ||
70 | saveRunningInfoToFile( s ); | 71 | saveRunningInfoToFile( s ); |
71 | } | 72 | } |
72 | void Todo::stopRunning() | 73 | void Todo::stopRunning() |
73 | { | 74 | { |
74 | if ( !mRunning ) | 75 | if ( !mRunning ) |
75 | return; | 76 | return; |
76 | if ( mRunSaveTimer ) | 77 | if ( mRunSaveTimer ) |
77 | mRunSaveTimer->stop(); | 78 | mRunSaveTimer->stop(); |
78 | mRunning = false; | 79 | mRunning = false; |
79 | } | 80 | } |
80 | void Todo::setRunning( bool run ) | 81 | void Todo::setRunning( bool run ) |
81 | { | 82 | { |
82 | if ( run == mRunning ) | 83 | if ( run == mRunning ) |
83 | return; | 84 | return; |
84 | //qDebug("Todo::setRunning %d ", run); | 85 | //qDebug("Todo::setRunning %d ", run); |
85 | if ( !mRunSaveTimer ) { | 86 | if ( !mRunSaveTimer ) { |
@@ -126,61 +127,61 @@ void Todo::saveRunningInfoToFile( QString comment ) | |||
126 | cal.setLocalTime(); | 127 | cal.setLocalTime(); |
127 | Todo * to = (Todo*) clone(); | 128 | Todo * to = (Todo*) clone(); |
128 | to->setFloats( false ); | 129 | to->setFloats( false ); |
129 | to->setDtStart( mRunStart ); | 130 | to->setDtStart( mRunStart ); |
130 | to->setHasStartDate( true ); | 131 | to->setHasStartDate( true ); |
131 | to->setDtDue( mRunEnd ); | 132 | to->setDtDue( mRunEnd ); |
132 | to->setHasDueDate( true ); | 133 | to->setHasDueDate( true ); |
133 | to->setUid( file ); | 134 | to->setUid( file ); |
134 | if ( !comment.isEmpty() ) { | 135 | if ( !comment.isEmpty() ) { |
135 | QString des = to->description(); | 136 | QString des = to->description(); |
136 | if ( des.isEmpty () ) | 137 | if ( des.isEmpty () ) |
137 | to->setDescription( "TT-Note: " + comment ); | 138 | to->setDescription( "TT-Note: " + comment ); |
138 | else | 139 | else |
139 | to->setDescription( "TT-Note: " + comment +"\n" + des ); | 140 | to->setDescription( "TT-Note: " + comment +"\n" + des ); |
140 | } | 141 | } |
141 | cal.addIncidence( to ); | 142 | cal.addIncidence( to ); |
142 | ICalFormat format; | 143 | ICalFormat format( false ); |
143 | file = dir +"/" +file +".ics"; | 144 | file = dir +"/" +file +".ics"; |
144 | format.save( &cal, file ); | 145 | format.save( &cal, file ); |
145 | saveParents(); | 146 | saveParents(); |
146 | 147 | ||
147 | } | 148 | } |
148 | void Todo::saveParents() | 149 | void Todo::saveParents() |
149 | { | 150 | { |
150 | if (!relatedTo() ) | 151 | if (!relatedTo() ) |
151 | return; | 152 | return; |
152 | Incidence * inc = relatedTo(); | 153 | Incidence * inc = relatedTo(); |
153 | if ( inc->typeID() != todoID ) | 154 | if ( inc->typeID() != todoID ) |
154 | return; | 155 | return; |
155 | Todo* to = (Todo*)inc; | 156 | Todo* to = (Todo*)inc; |
156 | bool saveTodo = false; | 157 | bool saveTodo = false; |
157 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; | 158 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; |
158 | QFileInfo fi ( file ); | 159 | QFileInfo fi ( file ); |
159 | if ( fi.exists() ) { | 160 | if ( fi.exists() ) { |
160 | if ( fi.lastModified () < to->lastModified ()) | 161 | if ( fi.lastModified () < to->lastModified ()) |
161 | saveTodo = true; | 162 | saveTodo = true; |
162 | } else { | 163 | } else { |
163 | saveTodo = true; | 164 | saveTodo = true; |
164 | } | 165 | } |
165 | if ( saveTodo ) { | 166 | if ( saveTodo ) { |
166 | CalendarLocal cal; | 167 | CalendarLocal cal; |
167 | cal.setLocalTime(); | 168 | cal.setLocalTime(); |
168 | Todo * par = (Todo *) to->clone(); | 169 | Todo * par = (Todo *) to->clone(); |
169 | cal.addIncidence( par ); | 170 | cal.addIncidence( par ); |
170 | ICalFormat format; | 171 | ICalFormat format( false ); |
171 | format.save( &cal, file ); | 172 | format.save( &cal, file ); |
172 | } | 173 | } |
173 | to->saveParents(); | 174 | to->saveParents(); |
174 | } | 175 | } |
175 | 176 | ||
176 | int Todo::runTime() | 177 | int Todo::runTime() |
177 | { | 178 | { |
178 | if ( !mRunning ) | 179 | if ( !mRunning ) |
179 | return 0; | 180 | return 0; |
180 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 181 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
181 | } | 182 | } |
182 | bool Todo::hasRunningSub() | 183 | bool Todo::hasRunningSub() |
183 | { | 184 | { |
184 | if ( mRunning ) | 185 | if ( mRunning ) |
185 | return true; | 186 | return true; |
186 | Incidence *aTodo; | 187 | Incidence *aTodo; |