summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c20
-rw-r--r--kabc/addressee.cpp1
-rw-r--r--kabc/kabc.pro2
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--libkcal/event.cpp46
-rw-r--r--libkcal/event.h2
-rw-r--r--libkcal/phoneformat.cpp104
-rw-r--r--libkcal/phoneformat.h2
-rw-r--r--libkcal/todo.cpp58
-rw-r--r--libkcal/todo.h1
-rw-r--r--libkcal/vcalformat.cpp141
-rw-r--r--libkdepim/phoneaccess.cpp69
-rw-r--r--microkde/microkde.pro2
-rw-r--r--microkde/ofileselector_p.cpp7
14 files changed, 305 insertions, 154 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index 0375fee..7310755 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -50,238 +50,238 @@ void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entr
50 *Alarm = -1; 50 *Alarm = -1;
51 *Phone = -1; 51 *Phone = -1;
52 *Recurrance= -1; 52 *Recurrance= -1;
53 *EndTime= -1; 53 *EndTime= -1;
54 *Location= -1; 54 *Location= -1;
55 for (i = 0; i < entry->EntriesNum; i++) { 55 for (i = 0; i < entry->EntriesNum; i++) {
56 switch (entry->Entries[i].EntryType) { 56 switch (entry->Entries[i].EntryType) {
57 case CAL_START_DATETIME : 57 case CAL_START_DATETIME :
58 if (*Time == -1) *Time = i; 58 if (*Time == -1) *Time = i;
59 break; 59 break;
60 case CAL_END_DATETIME : 60 case CAL_END_DATETIME :
61 if (*EndTime == -1) *EndTime = i; 61 if (*EndTime == -1) *EndTime = i;
62 break; 62 break;
63 case CAL_ALARM_DATETIME : 63 case CAL_ALARM_DATETIME :
64 case CAL_SILENT_ALARM_DATETIME: 64 case CAL_SILENT_ALARM_DATETIME:
65 if (*Alarm == -1) *Alarm = i; 65 if (*Alarm == -1) *Alarm = i;
66 break; 66 break;
67 case CAL_RECURRANCE: 67 case CAL_RECURRANCE:
68 if (*Recurrance == -1) *Recurrance = i; 68 if (*Recurrance == -1) *Recurrance = i;
69 break; 69 break;
70 case CAL_TEXT: 70 case CAL_TEXT:
71 *Text = i; 71 *Text = i;
72 break; 72 break;
73 case CAL_DESCRIPTION: 73 case CAL_DESCRIPTION:
74 if (*Text == -1) *Text = i; 74 if (*Text == -1) *Text = i;
75 break; 75 break;
76 case CAL_PHONE: 76 case CAL_PHONE:
77 if (*Phone == -1) *Phone = i; 77 if (*Phone == -1) *Phone = i;
78 break; 78 break;
79 case CAL_LOCATION: 79 case CAL_LOCATION:
80 if (*Location == -1) *Location = i; 80 if (*Location == -1) *Location = i;
81 break; 81 break;
82 default: 82 default:
83 break; 83 break;
84 } 84 }
85 } 85 }
86} 86}
87 87
88GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) 88GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version)
89{ 89{
90 int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; 90 int Text, Time, Alarm, Phone, Recurrance, EndTime, Location;
91 char buffer[2000]; 91 char buffer[2000];
92 92
93 GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); 93 GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location);
94 94
95 if (header) { 95 if (header) {
96 *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); 96 *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10);
97 *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); 97 *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10);
98 } 98 }
99 *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10); 99 *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10);
100 100
101 if (Version == Nokia_VCalendar) { 101 if (Version == Nokia_VCalendar) {
102 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 102 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
103 switch (note->Type) { 103 switch (note->Type) {
104 case GSM_CAL_REMINDER: 104 case GSM_CAL_REMINDER:
105 *Length+=sprintf(Buffer+(*Length), "Reminder%c%c",13,10); 105 *Length+=sprintf(Buffer+(*Length), "Reminder%c%c",13,10);
106 break; 106 break;
107 case GSM_CAL_MEMO: 107 case GSM_CAL_MEMO:
108 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); 108 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
109 break; 109 break;
110 case GSM_CAL_CALL: 110 case GSM_CAL_CALL:
111 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); 111 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10);
112 break; 112 break;
113 case GSM_CAL_BIRTHDAY: 113 case GSM_CAL_BIRTHDAY:
114 *Length+=sprintf(Buffer+(*Length), "Special Occasion%c%c",13,10); 114 *Length+=sprintf(Buffer+(*Length), "Birthday%c%c",13,10);
115 break; 115 break;
116 case GSM_CAL_MEETING: 116 case GSM_CAL_MEETING:
117 default: 117 default:
118 *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10); 118 *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10);
119 break; 119 break;
120 } 120 }
121 if (note->Type == GSM_CAL_CALL) { 121 if (note->Type == GSM_CAL_CALL) {
122 buffer[0] = 0; 122 buffer[0] = 0;
123 buffer[1] = 0; 123 buffer[1] = 0;
124 if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); 124 if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text);
125 if (Text != -1) { 125 if (Text != -1) {
126 if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); 126 if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1);
127 CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); 127 CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text);
128 } 128 }
129 SaveVCALText(Buffer, Length, buffer, "SUMMARY"); 129 SaveVCALText(Buffer, Length, buffer, "SUMMARY");
130 } else { 130 } else {
131 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 131 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
132 } 132 }
133 if (note->Type == GSM_CAL_MEETING && Location != -1) { 133 if (note->Type == GSM_CAL_MEETING && Location != -1) {
134 SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); 134 SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION");
135 } 135 }
136 136
137 if (Time == -1) return ERR_UNKNOWN; 137 if (Time == -1) return ERR_UNKNOWN;
138 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART"); 138 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART");
139 139
140 if (EndTime != -1) { 140 if (EndTime != -1) {
141 SaveVCALDateTime(Buffer, Length, &note->Entries[EndTime].Date, "DTEND"); 141 SaveVCALDateTime(Buffer, Length, &note->Entries[EndTime].Date, "DTEND");
142 } 142 }
143 143
144 if (Alarm != -1) { 144 if (Alarm != -1) {
145 if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { 145 if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) {
146 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM"); 146 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
147 } else { 147 } else {
148 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM"); 148 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
149 } 149 }
150 } 150 }
151 151
152 /* Birthday is known to be recurranced */ 152 /* Birthday is known to be recurranced */
153 if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { 153 if (Recurrance != -1 ) {
154 switch(note->Entries[Recurrance].Number/24) { 154 switch(note->Entries[Recurrance].Number/24) {
155 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; 155 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break;
156 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; 156 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break;
157 case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; 157 case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break;
158 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; 158 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YM1 #0%c%c",13,10); break;
159 } 159 }
160 } 160 }
161 } else if (Version == Siemens_VCalendar) { 161 } else if (Version == Siemens_VCalendar) {
162 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 162 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
163 switch (note->Type) { 163 switch (note->Type) {
164 case GSM_CAL_MEETING: 164 case GSM_CAL_MEETING:
165 *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); 165 *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10);
166 break; 166 break;
167 case GSM_CAL_CALL: 167 case GSM_CAL_CALL:
168 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); 168 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10);
169 break; 169 break;
170 case GSM_CAL_BIRTHDAY: 170 case GSM_CAL_BIRTHDAY:
171 *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); 171 *Length+=sprintf(Buffer+(*Length), "Birthday%c%c",13,10);
172 break; 172 break;
173 case GSM_CAL_MEMO: 173 case GSM_CAL_MEMO:
174 default: 174 default:
175 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); 175 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
176 break; 176 break;
177 } 177 }
178 178
179 if (Time == -1) return ERR_UNKNOWN; 179 if (Time == -1) return ERR_UNKNOWN;
180 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART"); 180 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART");
181 181
182 if (Alarm != -1) { 182 if (Alarm != -1) {
183 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM"); 183 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
184 } 184 }
185 185
186 if (Recurrance != -1) { 186 if (Recurrance != -1) {
187 switch(note->Entries[Recurrance].Number/24) { 187 switch(note->Entries[Recurrance].Number/24) {
188 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; 188 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break;
189 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; 189 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break;
190 case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; 190 case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break;
191 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; 191 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YM1%c%c",13,10);break;
192 } 192 }
193 } 193 }
194 194
195 if (note->Type == GSM_CAL_CALL) { 195 if (note->Type == GSM_CAL_CALL) {
196 buffer[0] = 0; 196 buffer[0] = 0;
197 buffer[1] = 0; 197 buffer[1] = 0;
198 if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); 198 if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text);
199 if (Text != -1) { 199 if (Text != -1) {
200 if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); 200 if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1);
201 CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); 201 CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text);
202 } 202 }
203 SaveVCALText(Buffer, Length, buffer, "SUMMARY"); 203 SaveVCALText(Buffer, Length, buffer, "SUMMARY");
204 } else { 204 } else {
205 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 205 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
206 } 206 }
207 } else if (Version == SonyEricsson_VCalendar) { 207 } else if (Version == SonyEricsson_VCalendar) {
208 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 208 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
209 switch (note->Type) { 209 switch (note->Type) {
210 case GSM_CAL_MEETING: 210 case GSM_CAL_MEETING:
211 *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); 211 *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10);
212 break; 212 break;
213 case GSM_CAL_REMINDER: 213 case GSM_CAL_REMINDER:
214 *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); 214 *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10);
215 break; 215 break;
216 case GSM_CAL_TRAVEL: 216 case GSM_CAL_TRAVEL:
217 *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); 217 *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10);
218 break; 218 break;
219 case GSM_CAL_VACATION: 219 case GSM_CAL_VACATION:
220 *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); 220 *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10);
221 break; 221 break;
222 case GSM_CAL_BIRTHDAY: 222 case GSM_CAL_BIRTHDAY:
223 *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); 223 *Length+=sprintf(Buffer+(*Length), "Birthday%c%c",13,10);
224 break; 224 break;
225 case GSM_CAL_MEMO: 225 case GSM_CAL_MEMO:
226 default: 226 default:
227 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); 227 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
228 break; 228 break;
229 } 229 }
230 230
231 if (Time == -1) return ERR_UNKNOWN; 231 if (Time == -1) return ERR_UNKNOWN;
232 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART"); 232 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART");
233 233
234 if (EndTime != -1) { 234 if (EndTime != -1) {
235 SaveVCALDateTime(Buffer, Length, &note->Entries[EndTime].Date, "DTEND"); 235 SaveVCALDateTime(Buffer, Length, &note->Entries[EndTime].Date, "DTEND");
236 } 236 }
237 237
238 if (Alarm != -1) { 238 if (Alarm != -1) {
239 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "AALARM"); 239 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "AALARM");
240 } 240 }
241 241
242 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 242 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
243 243
244 if (Location != -1) { 244 if (Location != -1) {
245 SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); 245 SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION");
246 } 246 }
247 } 247 }
248 248
249 *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); 249 *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10);
250 *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10); 250 *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10);
251 if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); 251 if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10);
252 252
253 return ERR_NONE; 253 return ERR_NONE;
254} 254}
255 255
256void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone) 256void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone)
257{ 257{
258 int i; 258 int i;
259 259
260 *Text = -1; 260 *Text = -1;
261 *EndTime= -1; 261 *EndTime= -1;
262 *Alarm = -1; 262 *Alarm = -1;
263 *Completed= -1; 263 *Completed= -1;
264 *Phone = -1; 264 *Phone = -1;
265 for (i = 0; i < entry->EntriesNum; i++) { 265 for (i = 0; i < entry->EntriesNum; i++) {
266 switch (entry->Entries[i].EntryType) { 266 switch (entry->Entries[i].EntryType) {
267 case TODO_END_DATETIME : 267 case TODO_END_DATETIME :
268 if (*EndTime == -1) *EndTime = i; 268 if (*EndTime == -1) *EndTime = i;
269 break; 269 break;
270 case TODO_ALARM_DATETIME : 270 case TODO_ALARM_DATETIME :
271 case TODO_SILENT_ALARM_DATETIME: 271 case TODO_SILENT_ALARM_DATETIME:
272 if (*Alarm == -1) *Alarm = i; 272 if (*Alarm == -1) *Alarm = i;
273 break; 273 break;
274 case TODO_TEXT: 274 case TODO_TEXT:
275 if (*Text == -1) *Text = i; 275 if (*Text == -1) *Text = i;
276 break; 276 break;
277 case TODO_COMPLETED: 277 case TODO_COMPLETED:
278 if (*Completed == -1) *Completed = i; 278 if (*Completed == -1) *Completed = i;
279 break; 279 break;
280 case TODO_PHONE: 280 case TODO_PHONE:
281 if (*Phone == -1) *Phone = i; 281 if (*Phone == -1) *Phone = i;
282 break; 282 break;
283 default: 283 default:
284 break; 284 break;
285 } 285 }
286 } 286 }
287} 287}
@@ -329,158 +329,164 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h
329 } else if (Version == SonyEricsson_VToDo) { 329 } else if (Version == SonyEricsson_VToDo) {
330 if (Text == -1) return ERR_UNKNOWN; 330 if (Text == -1) return ERR_UNKNOWN;
331 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 331 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
332 332
333 if (Completed == -1) { 333 if (Completed == -1) {
334 *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); 334 *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10);
335 } else { 335 } else {
336 *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); 336 *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10);
337 } 337 }
338 338
339 switch (note->Priority) { 339 switch (note->Priority) {
340 case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; 340 case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break;
341 case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; 341 case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break;
342 case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; 342 case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break;
343 } 343 }
344 344
345 if (Alarm != -1) { 345 if (Alarm != -1) {
346 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "AALARM"); 346 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "AALARM");
347 } 347 }
348 } 348 }
349 349
350 *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); 350 *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10);
351 *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10); 351 *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10);
352 352
353 if (header) { 353 if (header) {
354 *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); 354 *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10);
355 } 355 }
356 return ERR_NONE; 356 return ERR_NONE;
357} 357}
358 358
359GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer) 359GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)
360{ 360{
361 unsigned char Line[2000],Buff[2000]; 361 unsigned char Line[2000],Buff[2000];
362 int Level = 0; 362 int Level = 0;
363 363
364 Calendar->EntriesNum = 0; 364 Calendar->EntriesNum = 0;
365 ToDo->EntriesNum = 0; 365 ToDo->EntriesNum = 0;
366 366
367 while (1) { 367 while (1) {
368 MyGetLine(Buffer, Pos, Line, strlen(Buffer)); 368 MyGetLine(Buffer, Pos, Line, strlen(Buffer));
369 if (strlen(Line) == 0) break; 369 if (strlen(Line) == 0) break;
370 switch (Level) { 370 switch (Level) {
371 case 0: 371 case 0:
372 if (strstr(Line,"BEGIN:VEVENT")) { 372 if (strstr(Line,"BEGIN:VEVENT")) {
373 Calendar->Type = GSM_CAL_MEMO; 373 Calendar->Type = GSM_CAL_MEMO;
374 Level = 1; 374 Level = 1;
375 } 375 }
376 if (strstr(Line,"BEGIN:VTODO")) { 376 if (strstr(Line,"BEGIN:VTODO")) {
377 ToDo->Priority = GSM_Priority_Medium; 377 ToDo->Priority = GSM_Priority_Medium;
378 Level = 2; 378 Level = 2;
379 } 379 }
380 break; 380 break;
381 case 1: /* Calendar note */ 381 case 1: /* Calendar note */
382 if (strstr(Line,"END:VEVENT")) { 382 if (strstr(Line,"END:VEVENT")) {
383 if (Calendar->EntriesNum == 0) return ERR_EMPTY; 383 if (Calendar->EntriesNum == 0) return ERR_EMPTY;
384 return ERR_NONE; 384 return ERR_NONE;
385 } 385 }
386 Calendar->Type = GSM_CAL_MEETING; 386 Calendar->Type = GSM_CAL_MEETING;
387 if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER; 387 if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER;
388 if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE 388 if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE
389 if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE 389 if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE
390 if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE 390 if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE
391 if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; 391 if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO;
392 if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; 392 if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL;
393 if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY;
394 if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; 393 if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY;
394 if (strstr(Line,"CATEGORIES:Birthday")) Calendar->Type = GSM_CAL_BIRTHDAY;
395 if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; 395 if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING;
396 if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; 396 if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING;
397 if (strstr(Line,"RRULE:D1")) { 397 if (strstr(Line,"RRULE:D1")) {
398 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 398 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
399 Calendar->Entries[Calendar->EntriesNum].Number = 1*24; 399 Calendar->Entries[Calendar->EntriesNum].Number = 1*24;
400 Calendar->EntriesNum++; 400 Calendar->EntriesNum++;
401 } 401 }
402 if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { 402 if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) {
403 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 403 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
404 Calendar->Entries[Calendar->EntriesNum].Number = 7*24; 404 Calendar->Entries[Calendar->EntriesNum].Number = 7*24;
405 Calendar->EntriesNum++; 405 Calendar->EntriesNum++;
406 } 406 }
407 if (strstr(Line,"RRULE:W2")) { 407 if (strstr(Line,"RRULE:W2")) {
408 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 408 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
409 Calendar->Entries[Calendar->EntriesNum].Number = 14*24; 409 Calendar->Entries[Calendar->EntriesNum].Number = 14*24;
410 Calendar->EntriesNum++; 410 Calendar->EntriesNum++;
411 } 411 }
412 if (strstr(Line,"RRULE:MD1")) { 412 if (strstr(Line,"RRULE:MD1")) {
413 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 413 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
414 Calendar->Entries[Calendar->EntriesNum].Number = 30*24; 414 Calendar->Entries[Calendar->EntriesNum].Number = 30*24;
415 Calendar->EntriesNum++; 415 Calendar->EntriesNum++;
416 } 416 }
417 if (strstr(Line,"RRULE:YD1")) { 417 if (strstr(Line,"RRULE:YD1")) {
418 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 418 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
419 Calendar->Entries[Calendar->EntriesNum].Number = 365*24; 419 Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
420 Calendar->EntriesNum++; 420 Calendar->EntriesNum++;
421 } 421 }
422 // LR 422 // LR
423 if (strstr(Line,"RRULE:YM1")) {
424 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
425 Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
426 Calendar->EntriesNum++;
427 }
428 // LR
423 if ((ReadVCALText(Line, "SUMMARY", Buff)) ) { 429 if ((ReadVCALText(Line, "SUMMARY", Buff)) ) {
424 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; 430 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT;
425 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 431 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
426 Calendar->EntriesNum++; 432 Calendar->EntriesNum++;
427 } 433 }
428 if (ReadVCALText(Line, "DESCRIPTION", Buff)) { 434 if (ReadVCALText(Line, "DESCRIPTION", Buff)) {
429 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_DESCRIPTION; 435 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_DESCRIPTION;
430 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 436 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
431 Calendar->EntriesNum++; 437 Calendar->EntriesNum++;
432 } 438 }
433 if (ReadVCALText(Line, "LOCATION", Buff)) { 439 if (ReadVCALText(Line, "LOCATION", Buff)) {
434 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; 440 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION;
435 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 441 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
436 Calendar->EntriesNum++; 442 Calendar->EntriesNum++;
437 } 443 }
438 if (ReadVCALText(Line, "DTSTART", Buff)) { 444 if (ReadVCALText(Line, "DTSTART", Buff)) {
439 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; 445 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME;
440 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 446 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
441 Calendar->EntriesNum++; 447 Calendar->EntriesNum++;
442 } 448 }
443 if (ReadVCALText(Line, "DTEND", Buff)) { 449 if (ReadVCALText(Line, "DTEND", Buff)) {
444 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; 450 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME;
445 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 451 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
446 Calendar->EntriesNum++; 452 Calendar->EntriesNum++;
447 } 453 }
448 if (ReadVCALText(Line, "DALARM", Buff)) { 454 if (ReadVCALText(Line, "DALARM", Buff)) {
449 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; 455 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME;
450 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 456 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
451 Calendar->EntriesNum++; 457 Calendar->EntriesNum++;
452 } 458 }
453 if (ReadVCALText(Line, "AALARM", Buff)) { 459 if (ReadVCALText(Line, "AALARM", Buff)) {
454 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; 460 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME;
455 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 461 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
456 Calendar->EntriesNum++; 462 Calendar->EntriesNum++;
457 } 463 }
458 break; 464 break;
459 case 2: /* ToDo note */ 465 case 2: /* ToDo note */
460 if (strstr(Line,"END:VTODO")) { 466 if (strstr(Line,"END:VTODO")) {
461 if (ToDo->EntriesNum == 0) return ERR_EMPTY; 467 if (ToDo->EntriesNum == 0) return ERR_EMPTY;
462 return ERR_NONE; 468 return ERR_NONE;
463 } 469 }
464 if (ReadVCALText(Line, "DUE", Buff)) { 470 if (ReadVCALText(Line, "DUE", Buff)) {
465 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME; 471 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME;
466 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); 472 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
467 ToDo->EntriesNum++; 473 ToDo->EntriesNum++;
468 } 474 }
469 if (ReadVCALText(Line, "DALARM", Buff)) { 475 if (ReadVCALText(Line, "DALARM", Buff)) {
470 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; 476 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME;
471 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); 477 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
472 ToDo->EntriesNum++; 478 ToDo->EntriesNum++;
473 } 479 }
474 if (ReadVCALText(Line, "AALARM", Buff)) { 480 if (ReadVCALText(Line, "AALARM", Buff)) {
475 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; 481 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME;
476 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); 482 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
477 ToDo->EntriesNum++; 483 ToDo->EntriesNum++;
478 } 484 }
479 if (ReadVCALText(Line, "SUMMARY", Buff)) { 485 if (ReadVCALText(Line, "SUMMARY", Buff)) {
480 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; 486 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT;
481 CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); 487 CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff);
482 ToDo->EntriesNum++; 488 ToDo->EntriesNum++;
483 } 489 }
484 if (ReadVCALText(Line, "PRIORITY", Buff)) { 490 if (ReadVCALText(Line, "PRIORITY", Buff)) {
485 if (ToDoVer == SonyEricsson_VToDo) { 491 if (ToDoVer == SonyEricsson_VToDo) {
486 ToDo->Priority = GSM_Priority_Medium; 492 ToDo->Priority = GSM_Priority_Medium;
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 2564894..40877ef 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -249,128 +249,129 @@ void Addressee::computeCsum(const QString &dev)
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 l.append( t[iii] ); 259 l.append( t[iii] );
260 KABC::Address::List::Iterator addressIter; 260 KABC::Address::List::Iterator addressIter;
261 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 261 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
262 ++addressIter ) { 262 ++addressIter ) {
263 t = (*addressIter).asList(); 263 t = (*addressIter).asList();
264 t.sort(); 264 t.sort();
265 for ( iii = 0; iii < t.count(); ++iii) 265 for ( iii = 0; iii < t.count(); ++iii)
266 l.append( t[iii] ); 266 l.append( t[iii] );
267 } 267 }
268 uint cs = getCsum4List(l); 268 uint cs = getCsum4List(l);
269 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 269 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
270 setCsum( dev, QString::number (cs )); 270 setCsum( dev, QString::number (cs ));
271} 271}
272 272
273void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 273void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
274{ 274{
275 275
276 detach(); 276 detach();
277 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 277 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
278 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 278 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
279 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 279 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
280 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 280 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
281 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 281 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
282 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 282 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
283 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 283 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
284 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 284 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
285 if ( !mData->birthday.isValid() ) 285 if ( !mData->birthday.isValid() )
286 if ( ad.mData->birthday.isValid()) 286 if ( ad.mData->birthday.isValid())
287 mData->birthday = ad.mData->birthday; 287 mData->birthday = ad.mData->birthday;
288 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 288 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
289 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 289 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
290 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 290 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
291 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 291 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
292 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 292 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
293 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 293 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
294 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 294 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
295 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 295 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
296 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 296 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
297 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 297 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
298 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 298 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
299 QStringList t; 299 QStringList t;
300 QStringList tAD; 300 QStringList tAD;
301 uint iii; 301 uint iii;
302 302
303 // ********** phone numbers 303 // ********** phone numbers
304 PhoneNumber::List phoneAD = ad.phoneNumbers(); 304 PhoneNumber::List phoneAD = ad.phoneNumbers();
305 PhoneNumber::List::Iterator phoneItAD; 305 PhoneNumber::List::Iterator phoneItAD;
306 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 306 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
307 bool found = false; 307 bool found = false;
308 PhoneNumber::List::Iterator it; 308 PhoneNumber::List::Iterator it;
309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
310 if ( ( *phoneItAD ).contains( (*it) ) ) { 310 if ( ( *phoneItAD ).contains( (*it) ) ) {
311 found = true; 311 found = true;
312 (*it).setType( ( *phoneItAD ).type() ); 312 (*it).setType( ( *phoneItAD ).type() );
313 (*it).setNumber( ( *phoneItAD ).number() );
313 break; 314 break;
314 } 315 }
315 } 316 }
316 if ( isSubSet && ! found ) 317 if ( isSubSet && ! found )
317 mData->phoneNumbers.append( *phoneItAD ); 318 mData->phoneNumbers.append( *phoneItAD );
318 } 319 }
319 if ( isSubSet ) { 320 if ( isSubSet ) {
320 // ************* emails; 321 // ************* emails;
321 t = mData->emails; 322 t = mData->emails;
322 tAD = ad.mData->emails; 323 tAD = ad.mData->emails;
323 for ( iii = 0; iii < tAD.count(); ++iii) 324 for ( iii = 0; iii < tAD.count(); ++iii)
324 if ( !t.contains(tAD[iii] ) ) 325 if ( !t.contains(tAD[iii] ) )
325 mData->emails.append( tAD[iii] ); 326 mData->emails.append( tAD[iii] );
326 } 327 }
327 328
328 // ************* categories; 329 // ************* categories;
329 t = mData->categories; 330 t = mData->categories;
330 tAD = ad.mData->categories; 331 tAD = ad.mData->categories;
331 for ( iii = 0; iii < tAD.count(); ++iii) 332 for ( iii = 0; iii < tAD.count(); ++iii)
332 if ( !t.contains(tAD[iii] ) ) 333 if ( !t.contains(tAD[iii] ) )
333 mData->categories.append( tAD[iii] ); 334 mData->categories.append( tAD[iii] );
334 QStringList::ConstIterator it; 335 QStringList::ConstIterator it;
335 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 336 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
336 QString qualifiedName = (*it).left( (*it).find( ":" )); 337 QString qualifiedName = (*it).left( (*it).find( ":" ));
337 bool found = false; 338 bool found = false;
338 QStringList::ConstIterator itL; 339 QStringList::ConstIterator itL;
339 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 340 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
340 if ( (*itL).startsWith( qualifiedName ) ) { 341 if ( (*itL).startsWith( qualifiedName ) ) {
341 found = true; 342 found = true;
342 break; 343 break;
343 } 344 }
344 } 345 }
345 if ( ! found ) { 346 if ( ! found ) {
346 mData->custom.append( *it ); 347 mData->custom.append( *it );
347 } 348 }
348 } 349 }
349 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 350 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
350 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 351 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
351 if ( !mData->sound.isIntern() ) { 352 if ( !mData->sound.isIntern() ) {
352 if ( mData->sound.url().isEmpty() ) { 353 if ( mData->sound.url().isEmpty() ) {
353 mData->sound = ad.mData->sound; 354 mData->sound = ad.mData->sound;
354 } 355 }
355 } 356 }
356 if ( !mData->agent.isIntern() ) { 357 if ( !mData->agent.isIntern() ) {
357 if ( mData->agent.url().isEmpty() ) { 358 if ( mData->agent.url().isEmpty() ) {
358 mData->agent = ad.mData->agent; 359 mData->agent = ad.mData->agent;
359 } 360 }
360 } 361 }
361 { 362 {
362 Key::List::Iterator itA; 363 Key::List::Iterator itA;
363 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 364 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
364 bool found = false; 365 bool found = false;
365 Key::List::Iterator it; 366 Key::List::Iterator it;
366 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 367 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
367 if ( (*it) == (*itA)) { 368 if ( (*it) == (*itA)) {
368 found = true; 369 found = true;
369 break; 370 break;
370 371
371 } 372 }
372 } 373 }
373 if ( ! found ) { 374 if ( ! found ) {
374 mData->keys.append( *itA ); 375 mData->keys.append( *itA );
375 } 376 }
376 } 377 }
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index d690acc..17ebff8 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,220 +1,218 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3#release debug 3#release debug
4DESTDIR=../bin 4DESTDIR=../bin
5 5
6TARGET = microkabc 6TARGET = microkabc
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui .. 10INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui ..
11 11
12#LIBS += -lmicrokde -lldap 12#LIBS += -lmicrokde -lldap
13LIBS += -L$(QPEDIR)/lib 13LIBS += -L$(QPEDIR)/lib
14DEFINES += KAB_EMBEDDED DESKTOP_VERSION 14DEFINES += KAB_EMBEDDED DESKTOP_VERSION
15unix : { 15unix : {
16 16
17OBJECTS_DIR = obj/unix 17OBJECTS_DIR = obj/unix
18MOC_DIR = moc/unix 18MOC_DIR = moc/unix
19} 19}
20win32: { 20win32: {
21DEFINES += _WIN32_ 21DEFINES += _WIN32_
22OBJECTS_DIR = obj/win 22OBJECTS_DIR = obj/win
23MOC_DIR = moc/win 23MOC_DIR = moc/win
24} 24}
25INTERFACES = \ 25INTERFACES = \
26 26
27 27
28HEADERS = \ 28HEADERS = \
29 resource.h \ 29 resource.h \
30 stdaddressbook.h \ 30 stdaddressbook.h \
31 agent.h \ 31 agent.h \
32 geo.h \ 32 geo.h \
33 key.h \ 33 key.h \
34 field.h \ 34 field.h \
35 plugin.h \ 35 plugin.h \
36 address.h \ 36 address.h \
37 addresseelist.h \ 37 addresseelist.h \
38 addresseeview.h \ 38 addresseeview.h \
39formatfactory.h \ 39formatfactory.h \
40 formatplugin.h \ 40 formatplugin.h \
41 phonenumber.h \ 41 phonenumber.h \
42distributionlist.h \ 42distributionlist.h \
43distributionlistdialog.h \ 43distributionlistdialog.h \
44distributionlisteditor.h \ 44distributionlisteditor.h \
45vcardformatplugin.h \ 45vcardformatplugin.h \
46formats/vcardformatplugin2.h \ 46formats/vcardformatplugin2.h \
47 picture.h \ 47 picture.h \
48 secrecy.h \ 48 secrecy.h \
49 sound.h \ 49 sound.h \
50 addressbook.h \ 50 addressbook.h \
51 syncprefwidget.h \
52 timezone.h \ 51 timezone.h \
53 tmpaddressbook.h \ 52 tmpaddressbook.h \
54 addressee.h \ 53 addressee.h \
55 addresseedialog.h \ 54 addresseedialog.h \
56 vcardconverter.h \ 55 vcardconverter.h \
57 vcard21parser.h \ 56 vcard21parser.h \
58 vcardformatimpl.h \ 57 vcardformatimpl.h \
59 plugins/file/resourcefile.h \ 58 plugins/file/resourcefile.h \
60 plugins/file/resourcefileconfig.h \ 59 plugins/file/resourcefileconfig.h \
61 plugins/dir/resourcedir.h \ 60 plugins/dir/resourcedir.h \
62 plugins/dir/resourcedirconfig.h \ 61 plugins/dir/resourcedirconfig.h \
63 vcardparser/vcardline.h \ 62 vcardparser/vcardline.h \
64 vcardparser/vcard.h \ 63 vcardparser/vcard.h \
65 vcardparser/vcardtool.h \ 64 vcardparser/vcardtool.h \
66 vcardparser/vcardparser.h \ 65 vcardparser/vcardparser.h \
67vcard/include/VCardAdrParam.h \ 66vcard/include/VCardAdrParam.h \
68vcard/include/VCardAdrValue.h \ 67vcard/include/VCardAdrValue.h \
69vcard/include/VCardAgentParam.h \ 68vcard/include/VCardAgentParam.h \
70vcard/include/VCardContentLine.h \ 69vcard/include/VCardContentLine.h \
71vcard/include/VCardDateParam.h \ 70vcard/include/VCardDateParam.h \
72vcard/include/VCardDateValue.h \ 71vcard/include/VCardDateValue.h \
73vcard/include/VCardEmailParam.h \ 72vcard/include/VCardEmailParam.h \
74vcard/include/VCardGeoValue.h \ 73vcard/include/VCardGeoValue.h \
75vcard/include/VCardGroup.h \ 74vcard/include/VCardGroup.h \
76vcard/include/VCardImageParam.h \ 75vcard/include/VCardImageParam.h \
77vcard/include/VCardImageValue.h \ 76vcard/include/VCardImageValue.h \
78vcard/include/VCardLangValue.h \ 77vcard/include/VCardLangValue.h \
79vcard/include/VCardNValue.h \ 78vcard/include/VCardNValue.h \
80vcard/include/VCardParam.h \ 79vcard/include/VCardParam.h \
81vcard/include/VCardPhoneNumberValue.h \ 80vcard/include/VCardPhoneNumberValue.h \
82vcard/include/VCardSourceParam.h \ 81vcard/include/VCardSourceParam.h \
83vcard/include/VCardTelParam.h \ 82vcard/include/VCardTelParam.h \
84vcard/include/VCardTextParam.h \ 83vcard/include/VCardTextParam.h \
85vcard/include/VCardTextValue.h \ 84vcard/include/VCardTextValue.h \
86vcard/include/VCardTextBinParam.h \ 85vcard/include/VCardTextBinParam.h \
87vcard/include/VCardURIValue.h \ 86vcard/include/VCardURIValue.h \
88vcard/include/VCardVCard.h \ 87vcard/include/VCardVCard.h \
89vcard/include/VCardEntity.h \ 88vcard/include/VCardEntity.h \
90vcard/include/VCardValue.h \ 89vcard/include/VCardValue.h \
91vcard/include/VCardSoundValue.h \ 90vcard/include/VCardSoundValue.h \
92vcard/include/VCardAgentValue.h \ 91vcard/include/VCardAgentValue.h \
93vcard/include/VCardTelValue.h \ 92vcard/include/VCardTelValue.h \
94vcard/include/VCardTextBinValue.h \ 93vcard/include/VCardTextBinValue.h \
95vcard/include/VCardOrgValue.h \ 94vcard/include/VCardOrgValue.h \
96vcard/include/VCardUTCValue.h \ 95vcard/include/VCardUTCValue.h \
97vcard/include/VCardClassValue.h \ 96vcard/include/VCardClassValue.h \
98vcard/include/VCardFloatValue.h \ 97vcard/include/VCardFloatValue.h \
99vcard/include/VCardTextListValue.h \ 98vcard/include/VCardTextListValue.h \
100vcard/include/generated/AdrParam-generated.h \ 99vcard/include/generated/AdrParam-generated.h \
101vcard/include/generated/AdrValue-generated.h \ 100vcard/include/generated/AdrValue-generated.h \
102vcard/include/generated/AgentParam-generated.h \ 101vcard/include/generated/AgentParam-generated.h \
103vcard/include/generated/ContentLine-generated.h \ 102vcard/include/generated/ContentLine-generated.h \
104vcard/include/generated/DateParam-generated.h \ 103vcard/include/generated/DateParam-generated.h \
105vcard/include/generated/DateValue-generated.h \ 104vcard/include/generated/DateValue-generated.h \
106vcard/include/generated/EmailParam-generated.h \ 105vcard/include/generated/EmailParam-generated.h \
107vcard/include/generated/GeoValue-generated.h \ 106vcard/include/generated/GeoValue-generated.h \
108vcard/include/generated/Group-generated.h \ 107vcard/include/generated/Group-generated.h \
109vcard/include/generated/ImageParam-generated.h \ 108vcard/include/generated/ImageParam-generated.h \
110vcard/include/generated/ImageValue-generated.h \ 109vcard/include/generated/ImageValue-generated.h \
111vcard/include/generated/LangValue-generated.h \ 110vcard/include/generated/LangValue-generated.h \
112vcard/include/generated/NValue-generated.h \ 111vcard/include/generated/NValue-generated.h \
113vcard/include/generated/Param-generated.h \ 112vcard/include/generated/Param-generated.h \
114vcard/include/generated/PhoneNumberValue-generated.h \ 113vcard/include/generated/PhoneNumberValue-generated.h \
115vcard/include/generated/SourceParam-generated.h \ 114vcard/include/generated/SourceParam-generated.h \
116vcard/include/generated/TelParam-generated.h \ 115vcard/include/generated/TelParam-generated.h \
117vcard/include/generated/TextParam-generated.h \ 116vcard/include/generated/TextParam-generated.h \
118vcard/include/generated/TextNSParam-generated.h \ 117vcard/include/generated/TextNSParam-generated.h \
119vcard/include/generated/TextValue-generated.h \ 118vcard/include/generated/TextValue-generated.h \
120vcard/include/generated/TextBinParam-generated.h \ 119vcard/include/generated/TextBinParam-generated.h \
121vcard/include/generated/URIValue-generated.h \ 120vcard/include/generated/URIValue-generated.h \
122vcard/include/generated/VCard-generated.h \ 121vcard/include/generated/VCard-generated.h \
123vcard/include/generated/VCardEntity-generated.h \ 122vcard/include/generated/VCardEntity-generated.h \
124vcard/include/generated/Value-generated.h \ 123vcard/include/generated/Value-generated.h \
125vcard/include/generated/SoundValue-generated.h \ 124vcard/include/generated/SoundValue-generated.h \
126vcard/include/generated/AgentValue-generated.h \ 125vcard/include/generated/AgentValue-generated.h \
127vcard/include/generated/TelValue-generated.h \ 126vcard/include/generated/TelValue-generated.h \
128vcard/include/generated/TextBinValue-generated.h \ 127vcard/include/generated/TextBinValue-generated.h \
129vcard/include/generated/OrgValue-generated.h \ 128vcard/include/generated/OrgValue-generated.h \
130vcard/include/generated/UTCValue-generated.h \ 129vcard/include/generated/UTCValue-generated.h \
131vcard/include/generated/ClassValue-generated.h \ 130vcard/include/generated/ClassValue-generated.h \
132vcard/include/generated/FloatValue-generated.h \ 131vcard/include/generated/FloatValue-generated.h \
133vcard/include/generated/TextListValue-generated.h 132vcard/include/generated/TextListValue-generated.h
134 133
135 134
136# plugins/ldap/resourceldap.h \ 135# plugins/ldap/resourceldap.h \
137# plugins/ldap/resourceldapconfig.h \ 136# plugins/ldap/resourceldapconfig.h \
138#formats/binary/binaryformat.h \ 137#formats/binary/binaryformat.h \
139 138
140#vcard/include/VCardTextNSParam.h \ 139#vcard/include/VCardTextNSParam.h \
141 140
142SOURCES = \ 141SOURCES = \
143distributionlist.cpp \ 142distributionlist.cpp \
144distributionlistdialog.cpp \ 143distributionlistdialog.cpp \
145distributionlisteditor.cpp \ 144distributionlisteditor.cpp \
146vcardformatplugin.cpp \ 145vcardformatplugin.cpp \
147formats/vcardformatplugin2.cpp \ 146formats/vcardformatplugin2.cpp \
148formatfactory.cpp \ 147formatfactory.cpp \
149 resource.cpp \ 148 resource.cpp \
150 stdaddressbook.cpp \ 149 stdaddressbook.cpp \
151 plugin.cpp \ 150 plugin.cpp \
152 agent.cpp \ 151 agent.cpp \
153 geo.cpp \ 152 geo.cpp \
154 key.cpp \ 153 key.cpp \
155 field.cpp \ 154 field.cpp \
156 addresseeview.cpp \ 155 addresseeview.cpp \
157 address.cpp \ 156 address.cpp \
158 phonenumber.cpp \ 157 phonenumber.cpp \
159 picture.cpp \ 158 picture.cpp \
160 secrecy.cpp \ 159 secrecy.cpp \
161 sound.cpp \ 160 sound.cpp \
162 addressbook.cpp \ 161 addressbook.cpp \
163 syncprefwidget.cpp \
164 timezone.cpp \ 162 timezone.cpp \
165 tmpaddressbook.cpp \ 163 tmpaddressbook.cpp \
166 addressee.cpp \ 164 addressee.cpp \
167 addresseelist.cpp \ 165 addresseelist.cpp \
168 addresseedialog.cpp \ 166 addresseedialog.cpp \
169 vcardconverter.cpp \ 167 vcardconverter.cpp \
170 vcard21parser.cpp \ 168 vcard21parser.cpp \
171 vcardformatimpl.cpp \ 169 vcardformatimpl.cpp \
172 plugins/file/resourcefile.cpp \ 170 plugins/file/resourcefile.cpp \
173 plugins/file/resourcefileconfig.cpp \ 171 plugins/file/resourcefileconfig.cpp \
174 plugins/dir/resourcedir.cpp \ 172 plugins/dir/resourcedir.cpp \
175 plugins/dir/resourcedirconfig.cpp \ 173 plugins/dir/resourcedirconfig.cpp \
176 vcardparser/vcardline.cpp \ 174 vcardparser/vcardline.cpp \
177 vcardparser/vcard.cpp \ 175 vcardparser/vcard.cpp \
178 vcardparser/vcardtool.cpp \ 176 vcardparser/vcardtool.cpp \
179 vcardparser/vcardparser.cpp \ 177 vcardparser/vcardparser.cpp \
180vcard/AdrParam.cpp \ 178vcard/AdrParam.cpp \
181vcard/AdrValue.cpp \ 179vcard/AdrValue.cpp \
182vcard/AgentParam.cpp \ 180vcard/AgentParam.cpp \
183vcard/ContentLine.cpp \ 181vcard/ContentLine.cpp \
184vcard/DateParam.cpp \ 182vcard/DateParam.cpp \
185vcard/DateValue.cpp \ 183vcard/DateValue.cpp \
186vcard/EmailParam.cpp \ 184vcard/EmailParam.cpp \
187vcard/Entity.cpp \ 185vcard/Entity.cpp \
188vcard/Enum.cpp \ 186vcard/Enum.cpp \
189vcard/GeoValue.cpp \ 187vcard/GeoValue.cpp \
190vcard/ImageParam.cpp \ 188vcard/ImageParam.cpp \
191vcard/ImageValue.cpp \ 189vcard/ImageValue.cpp \
192vcard/LangValue.cpp \ 190vcard/LangValue.cpp \
193vcard/NValue.cpp \ 191vcard/NValue.cpp \
194vcard/Param.cpp \ 192vcard/Param.cpp \
195vcard/PhoneNumberValue.cpp \ 193vcard/PhoneNumberValue.cpp \
196vcard/RToken.cpp \ 194vcard/RToken.cpp \
197vcard/SourceParam.cpp \ 195vcard/SourceParam.cpp \
198vcard/TelParam.cpp \ 196vcard/TelParam.cpp \
199vcard/TextParam.cpp \ 197vcard/TextParam.cpp \
200vcard/TextValue.cpp \ 198vcard/TextValue.cpp \
201vcard/TextBinParam.cpp \ 199vcard/TextBinParam.cpp \
202vcard/URIValue.cpp \ 200vcard/URIValue.cpp \
203vcard/VCardv.cpp \ 201vcard/VCardv.cpp \
204vcard/VCardEntity.cpp \ 202vcard/VCardEntity.cpp \
205vcard/Value.cpp \ 203vcard/Value.cpp \
206vcard/SoundValue.cpp \ 204vcard/SoundValue.cpp \
207vcard/AgentValue.cpp \ 205vcard/AgentValue.cpp \
208vcard/TelValue.cpp \ 206vcard/TelValue.cpp \
209vcard/TextBinValue.cpp \ 207vcard/TextBinValue.cpp \
210vcard/OrgValue.cpp \ 208vcard/OrgValue.cpp \
211vcard/UTCValue.cpp \ 209vcard/UTCValue.cpp \
212vcard/ClassValue.cpp \ 210vcard/ClassValue.cpp \
213vcard/FloatValue.cpp \ 211vcard/FloatValue.cpp \
214vcard/TextListValue.cpp 212vcard/TextListValue.cpp
215 213
216 214
217# plugins/ldap/resourceldap.cpp \ 215# plugins/ldap/resourceldap.cpp \
218# plugins/ldap/resourceldapconfig.cpp \ 216# plugins/ldap/resourceldapconfig.cpp \
219 217
220#formats/binary/binaryformat.cpp \ 218#formats/binary/binaryformat.cpp \
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3e0a27d..e4a11f5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1069,174 +1069,176 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1069 } 1069 }
1070 } 1070 }
1071 } 1071 }
1072 inR = er.next(); 1072 inR = er.next();
1073 } 1073 }
1074 QPtrList<Incidence> el = local->rawIncidences(); 1074 QPtrList<Incidence> el = local->rawIncidences();
1075 inL = el.first(); 1075 inL = el.first();
1076 modulo = (el.count()/10)+1; 1076 modulo = (el.count()/10)+1;
1077 bar.setCaption (i18n("Add / remove events") ); 1077 bar.setCaption (i18n("Add / remove events") );
1078 bar.setTotalSteps ( el.count() ) ; 1078 bar.setTotalSteps ( el.count() ) ;
1079 bar.show(); 1079 bar.show();
1080 incCounter = 0; 1080 incCounter = 0;
1081 1081
1082 while ( inL ) { 1082 while ( inL ) {
1083 1083
1084 qApp->processEvents(); 1084 qApp->processEvents();
1085 if ( ! bar.isVisible() ) 1085 if ( ! bar.isVisible() )
1086 return false; 1086 return false;
1087 if ( incCounter % modulo == 0 ) 1087 if ( incCounter % modulo == 0 )
1088 bar.setProgress( incCounter ); 1088 bar.setProgress( incCounter );
1089 ++incCounter; 1089 ++incCounter;
1090 uid = inL->uid(); 1090 uid = inL->uid();
1091 bool skipIncidence = false; 1091 bool skipIncidence = false;
1092 if ( uid.left(15) == QString("last-syncEvent-") ) 1092 if ( uid.left(15) == QString("last-syncEvent-") )
1093 skipIncidence = true; 1093 skipIncidence = true;
1094 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1094 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1095 skipIncidence = true; 1095 skipIncidence = true;
1096 if ( !skipIncidence ) { 1096 if ( !skipIncidence ) {
1097 inR = remote->incidence( uid ); 1097 inR = remote->incidence( uid );
1098 if ( ! inR ) { 1098 if ( ! inR ) {
1099 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1099 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1100 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1100 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1101 checkExternSyncEvent(eventLSyncSharp, inL); 1101 checkExternSyncEvent(eventLSyncSharp, inL);
1102 local->deleteIncidence( inL ); 1102 local->deleteIncidence( inL );
1103 ++deletedEventL; 1103 ++deletedEventL;
1104 } else { 1104 } else {
1105 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1105 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1106 inL->removeID(mCurrentSyncDevice ); 1106 inL->removeID(mCurrentSyncDevice );
1107 ++addedEventR; 1107 ++addedEventR;
1108 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1108 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1109 inL->setLastModified( modifiedCalendar ); 1109 inL->setLastModified( modifiedCalendar );
1110 inR = inL->clone(); 1110 inR = inL->clone();
1111 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1111 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1112 remote->addIncidence( inR ); 1112 remote->addIncidence( inR );
1113 } 1113 }
1114 } 1114 }
1115 } else { 1115 } else {
1116 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1116 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1117 checkExternSyncEvent(eventLSyncSharp, inL); 1117 checkExternSyncEvent(eventLSyncSharp, inL);
1118 local->deleteIncidence( inL ); 1118 local->deleteIncidence( inL );
1119 ++deletedEventL; 1119 ++deletedEventL;
1120 } else { 1120 } else {
1121 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1121 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1122 ++addedEventR; 1122 ++addedEventR;
1123 inL->setLastModified( modifiedCalendar ); 1123 inL->setLastModified( modifiedCalendar );
1124 remote->addIncidence( inL->clone() ); 1124 remote->addIncidence( inL->clone() );
1125 } 1125 }
1126 } 1126 }
1127 } 1127 }
1128 } 1128 }
1129 } 1129 }
1130 inL = el.next(); 1130 inL = el.next();
1131 } 1131 }
1132 int delFut = 0; 1132 int delFut = 0;
1133 int remRem = 0;
1133 if ( mSyncManager->mWriteBackInFuture ) { 1134 if ( mSyncManager->mWriteBackInFuture ) {
1134 er = remote->rawIncidences(); 1135 er = remote->rawIncidences();
1136 remRem = er.count();
1135 inR = er.first(); 1137 inR = er.first();
1136 QDateTime dt; 1138 QDateTime dt;
1137 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1139 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1138 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1140 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1139 while ( inR ) { 1141 while ( inR ) {
1140 if ( inR->type() == "Todo" ) { 1142 if ( inR->type() == "Todo" ) {
1141 Todo * t = (Todo*)inR; 1143 Todo * t = (Todo*)inR;
1142 if ( t->hasDueDate() ) 1144 if ( t->hasDueDate() )
1143 dt = t->dtDue(); 1145 dt = t->dtDue();
1144 else 1146 else
1145 dt = cur.addSecs( 62 ); 1147 dt = cur.addSecs( 62 );
1146 } 1148 }
1147 else if (inR->type() == "Event" ) { 1149 else if (inR->type() == "Event" ) {
1148 bool ok; 1150 bool ok;
1149 dt = inR->getNextOccurence( cur, &ok ); 1151 dt = inR->getNextOccurence( cur, &ok );
1150 if ( !ok ) 1152 if ( !ok )
1151 dt = cur.addSecs( -62 ); 1153 dt = cur.addSecs( -62 );
1152 } 1154 }
1153 else 1155 else
1154 dt = inR->dtStart(); 1156 dt = inR->dtStart();
1155 if ( dt < cur || dt > end ) { 1157 if ( dt < cur || dt > end ) {
1156 remote->deleteIncidence( inR ); 1158 remote->deleteIncidence( inR );
1157 ++delFut; 1159 ++delFut;
1158 } 1160 }
1159 inR = er.next(); 1161 inR = er.next();
1160 } 1162 }
1161 } 1163 }
1162 bar.hide(); 1164 bar.hide();
1163 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1165 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1164 eventLSync->setReadOnly( false ); 1166 eventLSync->setReadOnly( false );
1165 eventLSync->setDtStart( mLastCalendarSync ); 1167 eventLSync->setDtStart( mLastCalendarSync );
1166 eventRSync->setDtStart( mLastCalendarSync ); 1168 eventRSync->setDtStart( mLastCalendarSync );
1167 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1169 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1168 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1170 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1169 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1171 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1170 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1172 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1171 eventLSync->setReadOnly( true ); 1173 eventLSync->setReadOnly( true );
1172 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1174 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1173 remote->addEvent( eventRSync ); 1175 remote->addEvent( eventRSync );
1174 QString mes; 1176 QString mes;
1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1177 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1176 QString delmess; 1178 QString delmess;
1177 if ( delFut ) { 1179 if ( delFut ) {
1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, mSyncManager->mWriteBackInFuture ); 1180 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1179 mes += delmess; 1181 mes += delmess;
1180 } 1182 }
1181 if ( mSyncManager->mShowSyncSummary ) { 1183 if ( mSyncManager->mShowSyncSummary ) {
1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1184 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1183 } 1185 }
1184 qDebug( mes ); 1186 qDebug( mes );
1185 mCalendar->checkAlarmForIncidence( 0, true ); 1187 mCalendar->checkAlarmForIncidence( 0, true );
1186 return syncOK; 1188 return syncOK;
1187} 1189}
1188 1190
1189void CalendarView::setSyncDevice( QString s ) 1191void CalendarView::setSyncDevice( QString s )
1190{ 1192{
1191 mCurrentSyncDevice= s; 1193 mCurrentSyncDevice= s;
1192} 1194}
1193void CalendarView::setSyncName( QString s ) 1195void CalendarView::setSyncName( QString s )
1194{ 1196{
1195 mCurrentSyncName= s; 1197 mCurrentSyncName= s;
1196} 1198}
1197bool CalendarView::syncCalendar(QString filename, int mode) 1199bool CalendarView::syncCalendar(QString filename, int mode)
1198{ 1200{
1199 //qDebug("syncCalendar %s ", filename.latin1()); 1201 //qDebug("syncCalendar %s ", filename.latin1());
1200 mGlobalSyncMode = SYNC_MODE_NORMAL; 1202 mGlobalSyncMode = SYNC_MODE_NORMAL;
1201 CalendarLocal* calendar = new CalendarLocal(); 1203 CalendarLocal* calendar = new CalendarLocal();
1202 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1204 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1203 FileStorage* storage = new FileStorage( calendar ); 1205 FileStorage* storage = new FileStorage( calendar );
1204 bool syncOK = false; 1206 bool syncOK = false;
1205 storage->setFileName( filename ); 1207 storage->setFileName( filename );
1206 // qDebug("loading ... "); 1208 // qDebug("loading ... ");
1207 if ( storage->load() ) { 1209 if ( storage->load() ) {
1208 getEventViewerDialog()->setSyncMode( true ); 1210 getEventViewerDialog()->setSyncMode( true );
1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1211 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1210 getEventViewerDialog()->setSyncMode( false ); 1212 getEventViewerDialog()->setSyncMode( false );
1211 if ( syncOK ) { 1213 if ( syncOK ) {
1212 if ( mSyncManager->mWriteBackFile ) 1214 if ( mSyncManager->mWriteBackFile )
1213 { 1215 {
1214 storage->setSaveFormat( new ICalFormat() ); 1216 storage->setSaveFormat( new ICalFormat() );
1215 storage->save(); 1217 storage->save();
1216 } 1218 }
1217 } 1219 }
1218 setModified( true ); 1220 setModified( true );
1219 } 1221 }
1220 delete storage; 1222 delete storage;
1221 delete calendar; 1223 delete calendar;
1222 if ( syncOK ) 1224 if ( syncOK )
1223 updateView(); 1225 updateView();
1224 return syncOK; 1226 return syncOK;
1225} 1227}
1226 1228
1227void CalendarView::syncExternal( int mode ) 1229void CalendarView::syncExternal( int mode )
1228{ 1230{
1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1231 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1230 1232
1231 qApp->processEvents(); 1233 qApp->processEvents();
1232 CalendarLocal* calendar = new CalendarLocal(); 1234 CalendarLocal* calendar = new CalendarLocal();
1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1235 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1234 bool syncOK = false; 1236 bool syncOK = false;
1235 bool loadSuccess = false; 1237 bool loadSuccess = false;
1236 PhoneFormat* phoneFormat = 0; 1238 PhoneFormat* phoneFormat = 0;
1237#ifndef DESKTOP_VERSION 1239#ifndef DESKTOP_VERSION
1238 SharpFormat* sharpFormat = 0; 1240 SharpFormat* sharpFormat = 0;
1239 if ( mode == 0 ) { // sharp 1241 if ( mode == 0 ) { // sharp
1240 sharpFormat = new SharpFormat () ; 1242 sharpFormat = new SharpFormat () ;
1241 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1243 loadSuccess = sharpFormat->load( calendar, mCalendar );
1242 1244
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index dfa265b..7256f05 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -1,122 +1,168 @@
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 <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "event.h" 25#include "event.h"
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29Event::Event() : 29Event::Event() :
30 mHasEndDate( false ), mTransparency( Opaque ) 30 mHasEndDate( false ), mTransparency( Opaque )
31{ 31{
32} 32}
33 33
34Event::Event(const Event &e) : Incidence(e) 34Event::Event(const Event &e) : Incidence(e)
35{ 35{
36 mDtEnd = e.mDtEnd; 36 mDtEnd = e.mDtEnd;
37 mHasEndDate = e.mHasEndDate; 37 mHasEndDate = e.mHasEndDate;
38 mTransparency = e.mTransparency; 38 mTransparency = e.mTransparency;
39} 39}
40 40
41Event::~Event() 41Event::~Event()
42{ 42{
43} 43}
44 44
45Incidence *Event::clone() 45Incidence *Event::clone()
46{ 46{
47 return new Event(*this); 47 return new Event(*this);
48} 48}
49 49
50bool KCal::operator==( const Event& e1, const Event& e2 ) 50bool KCal::operator==( const Event& e1, const Event& e2 )
51{ 51{
52 return operator==( (const Incidence&)e1, (const Incidence&)e2 ) && 52 return operator==( (const Incidence&)e1, (const Incidence&)e2 ) &&
53 e1.dtEnd() == e2.dtEnd() && 53 e1.dtEnd() == e2.dtEnd() &&
54 e1.hasEndDate() == e2.hasEndDate() && 54 e1.hasEndDate() == e2.hasEndDate() &&
55 e1.transparency() == e2.transparency(); 55 e1.transparency() == e2.transparency();
56} 56}
57 57
58 58
59bool Event::contains ( Event* from )
60{
61
62 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() ))
64 return false;
65 if ( from->dtStart().isValid() )
66 if (dtStart() != from->dtStart() )
67 return false;
68 if ( from->dtEnd().isValid() )
69 if ( dtEnd() != from->dtEnd() )
70 return false;
71 if ( !from->location().isEmpty() )
72 if ( !location().startsWith( from->location() ) )
73 return false;
74 if ( !from->description().isEmpty() )
75 if ( !description().startsWith( from->description() ))
76 return false;
77 if ( from->alarms().count() ) {
78 Alarm *a = from->alarms().first();
79 if ( a->enabled() ){
80 if ( !alarms().count() )
81 return false;
82 Alarm *b = alarms().first();
83 if( ! b->enabled() )
84 return false;
85 if ( ! (a->offset() == b->offset() ))
86 return false;
87 }
88 }
89 QStringList cat = categories();
90 QStringList catFrom = from->categories();
91 QString nCat;
92 int iii;
93 for ( iii = 0; iii < catFrom.count();++iii ) {
94 nCat = catFrom[iii];
95 if ( !nCat.isEmpty() )
96 if ( !cat.contains( nCat )) {
97 return false;
98 }
99 }
100 if ( from->doesRecur() )
101 if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) )
102 return false;
103 return true;
104}
59 105
60void Event::setDtEnd(const QDateTime &dtEnd) 106void Event::setDtEnd(const QDateTime &dtEnd)
61{ 107{
62 if (mReadOnly) return; 108 if (mReadOnly) return;
63 109
64 mDtEnd = getEvenTime( dtEnd ); 110 mDtEnd = getEvenTime( dtEnd );
65 111
66 setHasEndDate(true); 112 setHasEndDate(true);
67 setHasDuration(false); 113 setHasDuration(false);
68 114
69 updated(); 115 updated();
70} 116}
71 117
72QDateTime Event::dtEnd() const 118QDateTime Event::dtEnd() const
73{ 119{
74 if (hasEndDate()) return mDtEnd; 120 if (hasEndDate()) return mDtEnd;
75 if (hasDuration()) return dtStart().addSecs(duration()); 121 if (hasDuration()) return dtStart().addSecs(duration());
76 122
77 kdDebug(5800) << "Warning! Event '" << summary() 123 kdDebug(5800) << "Warning! Event '" << summary()
78 << "' does have neither end date nor duration." << endl; 124 << "' does have neither end date nor duration." << endl;
79 return dtStart(); 125 return dtStart();
80} 126}
81 127
82QString Event::dtEndTimeStr() const 128QString Event::dtEndTimeStr() const
83{ 129{
84 return KGlobal::locale()->formatTime(mDtEnd.time()); 130 return KGlobal::locale()->formatTime(mDtEnd.time());
85} 131}
86 132
87QString Event::dtEndDateStr(bool shortfmt) const 133QString Event::dtEndDateStr(bool shortfmt) const
88{ 134{
89 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); 135 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt);
90} 136}
91 137
92QString Event::dtEndStr(bool shortfmt) const 138QString Event::dtEndStr(bool shortfmt) const
93{ 139{
94 return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); 140 return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt);
95} 141}
96 142
97void Event::setHasEndDate(bool b) 143void Event::setHasEndDate(bool b)
98{ 144{
99 mHasEndDate = b; 145 mHasEndDate = b;
100} 146}
101 147
102bool Event::hasEndDate() const 148bool Event::hasEndDate() const
103{ 149{
104 return mHasEndDate; 150 return mHasEndDate;
105} 151}
106 152
107bool Event::isMultiDay() const 153bool Event::isMultiDay() const
108{ 154{
109 bool multi = !(dtStart().date() == dtEnd().date()); 155 bool multi = !(dtStart().date() == dtEnd().date());
110 return multi; 156 return multi;
111} 157}
112 158
113void Event::setTransparency(Event::Transparency transparency) 159void Event::setTransparency(Event::Transparency transparency)
114{ 160{
115 if (mReadOnly) return; 161 if (mReadOnly) return;
116 mTransparency = transparency; 162 mTransparency = transparency;
117 updated(); 163 updated();
118} 164}
119 165
120Event::Transparency Event::transparency() const 166Event::Transparency Event::transparency() const
121{ 167{
122 return mTransparency; 168 return mTransparency;
diff --git a/libkcal/event.h b/libkcal/event.h
index 2a8bd95..3bc8adc 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -10,79 +10,81 @@
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#ifndef EVENT_H 21#ifndef EVENT_H
22#define EVENT_H 22#define EVENT_H
23// 23//
24// Event component, representing a VEVENT object 24// Event component, representing a VEVENT object
25// 25//
26 26
27#include "incidence.h" 27#include "incidence.h"
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides an Event in the sense of RFC2445. 31 This class provides an Event in the sense of RFC2445.
32*/ 32*/
33class Event : public Incidence 33class Event : public Incidence
34{ 34{
35 public: 35 public:
36 enum Transparency { Opaque, Transparent }; 36 enum Transparency { Opaque, Transparent };
37 typedef ListBase<Event> List; 37 typedef ListBase<Event> List;
38 Event(); 38 Event();
39 Event(const Event &); 39 Event(const Event &);
40 ~Event(); 40 ~Event();
41 41
42 QCString type() const { return "Event"; } 42 QCString type() const { return "Event"; }
43 43
44 Incidence *clone(); 44 Incidence *clone();
45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
46 46
47 /** for setting an event's ending date/time with a QDateTime. */ 47 /** for setting an event's ending date/time with a QDateTime. */
48 void setDtEnd(const QDateTime &dtEnd); 48 void setDtEnd(const QDateTime &dtEnd);
49 /** Return the event's ending date/time as a QDateTime. */ 49 /** Return the event's ending date/time as a QDateTime. */
50 virtual QDateTime dtEnd() const; 50 virtual QDateTime dtEnd() const;
51 /** returns an event's end time as a string formatted according to the 51 /** returns an event's end time as a string formatted according to the
52 users locale settings */ 52 users locale settings */
53 QString dtEndTimeStr() const; 53 QString dtEndTimeStr() const;
54 /** returns an event's end date as a string formatted according to the 54 /** returns an event's end date as a string formatted according to the
55 users locale settings */ 55 users locale settings */
56 QString dtEndDateStr(bool shortfmt=true) const; 56 QString dtEndDateStr(bool shortfmt=true) const;
57 /** returns an event's end date and time as a string formatted according 57 /** returns an event's end date and time as a string formatted according
58 to the users locale settings */ 58 to the users locale settings */
59 QString dtEndStr(bool shortfmt=true) const; 59 QString dtEndStr(bool shortfmt=true) const;
60 void setHasEndDate(bool); 60 void setHasEndDate(bool);
61 /** Return whether the event has an end date/time. */ 61 /** Return whether the event has an end date/time. */
62 bool hasEndDate() const; 62 bool hasEndDate() const;
63 63
64 /** Return true if the event spans multiple days, otherwise return false. */ 64 /** Return true if the event spans multiple days, otherwise return false. */
65 bool isMultiDay() const; 65 bool isMultiDay() const;
66 66
67 /** set the event's time transparency level. */ 67 /** set the event's time transparency level. */
68 void setTransparency(Transparency transparency); 68 void setTransparency(Transparency transparency);
69 /** get the event's time transparency level. */ 69 /** get the event's time transparency level. */
70 Transparency transparency() const; 70 Transparency transparency() const;
71 71
72 void setDuration(int seconds); 72 void setDuration(int seconds);
73 73
74 bool contains ( Event*);
75
74 private: 76 private:
75 bool accept(Visitor &v) { return v.visit(this); } 77 bool accept(Visitor &v) { return v.visit(this); }
76 78
77 QDateTime mDtEnd; 79 QDateTime mDtEnd;
78 bool mHasEndDate; 80 bool mHasEndDate;
79 Transparency mTransparency; 81 Transparency mTransparency;
80}; 82};
81 83
82bool operator==( const Event&, const Event& ); 84bool operator==( const Event&, const Event& );
83 85
84 86
85} 87}
86 88
87 89
88#endif 90#endif
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 281434e..101db57 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -251,384 +251,370 @@ ulong PhoneFormat::getCsumEvent( Event* event )
251 attList << list.join(""); 251 attList << list.join("");
252 attList << event->categoriesStr(); 252 attList << event->categoriesStr();
253 //qDebug("csum cat %s", event->categoriesStr().latin1()); 253 //qDebug("csum cat %s", event->categoriesStr().latin1());
254 254
255 attList << event->secrecyStr(); 255 attList << event->secrecyStr();
256 return PhoneFormat::getCsum(attList ); 256 return PhoneFormat::getCsum(attList );
257} 257}
258ulong PhoneFormat::getCsum( const QStringList & attList) 258ulong PhoneFormat::getCsum( const QStringList & attList)
259{ 259{
260 int max = attList.count(); 260 int max = attList.count();
261 ulong cSum = 0; 261 ulong cSum = 0;
262 int j,k,i; 262 int j,k,i;
263 int add; 263 int add;
264 for ( i = 0; i < max ; ++i ) { 264 for ( i = 0; i < max ; ++i ) {
265 QString s = attList[i]; 265 QString s = attList[i];
266 if ( ! s.isEmpty() ){ 266 if ( ! s.isEmpty() ){
267 j = s.length(); 267 j = s.length();
268 for ( k = 0; k < j; ++k ) { 268 for ( k = 0; k < j; ++k ) {
269 int mul = k +1; 269 int mul = k +1;
270 add = s[k].unicode (); 270 add = s[k].unicode ();
271 if ( k < 16 ) 271 if ( k < 16 )
272 mul = mul * mul; 272 mul = mul * mul;
273 int ii = i+1; 273 int ii = i+1;
274 add = add * mul *ii*ii*ii; 274 add = add * mul *ii*ii*ii;
275 cSum += add; 275 cSum += add;
276 } 276 }
277 } 277 }
278 278
279 } 279 }
280 //QString dump = attList.join(","); 280 //QString dump = attList.join(",");
281 //qDebug("csum: %d %s", cSum,dump.latin1()); 281 //qDebug("csum: %d %s", cSum,dump.latin1());
282 282
283 return cSum; 283 return cSum;
284 284
285} 285}
286//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 286//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
287#include <stdlib.h> 287#include <stdlib.h>
288#define DEBUGMODE false 288#define DEBUGMODE false
289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) 289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
290{ 290{
291 291
292 QString fileName; 292 QString fileName;
293#ifdef _WIN32_ 293#ifdef _WIN32_
294 fileName = locateLocal("tmp", "phonefile.vcs"); 294 fileName = locateLocal("tmp", "phonefile.vcs");
295#else 295#else
296 fileName = "/tmp/phonefile.vcs"; 296 fileName = "/tmp/phonefile.vcs";
297#endif 297#endif
298 QString command; 298 QString command;
299 if ( ! PhoneAccess::readFromPhone( fileName )) { 299 if ( ! PhoneAccess::readFromPhone( fileName )) {
300 return false; 300 return false;
301 } 301 }
302 VCalFormat vfload; 302 VCalFormat vfload;
303 vfload.setLocalTime ( true ); 303 vfload.setLocalTime ( true );
304 qDebug("loading file ..."); 304 qDebug("loading file ...");
305 305
306 if ( ! vfload.load( calendar, fileName ) ) 306 if ( ! vfload.load( calendar, fileName ) )
307 return false; 307 return false;
308 QPtrList<Event> er = calendar->rawEvents(); 308 QPtrList<Event> er = calendar->rawEvents();
309 Event* ev = er.first(); 309 Event* ev = er.first();
310 qDebug("reading events... "); 310 qDebug("reading events... ");
311 while ( ev ) { 311 while ( ev ) {
312 QStringList cat = ev->categories(); 312 QStringList cat = ev->categories();
313 if ( cat.contains( "MeetingDEF" )) { 313 if ( cat.contains( "MeetingDEF" )) {
314 ev->setCategories( QStringList() ); 314 ev->setCategories( QStringList() );
315 } else
316 if ( cat.contains( "Birthday" )) {
317 ev->setFloats( true );
318 QDate da = ev->dtStart().date();
319 ev->setDtStart( QDateTime( da) );
320 ev->setDtEnd( QDateTime( da.addDays(1)) );
321
315 } 322 }
323 uint cSum;
324 cSum = PhoneFormat::getCsumEvent( ev );
316 int id = ev->pilotId(); 325 int id = ev->pilotId();
317 Event *event; 326 Event *event;
318 event = existingCal->event( mProfileName ,QString::number( id ) ); 327 event = existingCal->event( mProfileName ,QString::number( id ) );
319 if ( event ) { 328 if ( event ) {
320 event = (Event*)event->clone(); 329 event = (Event*)event->clone();
321 copyEvent( event, ev ); 330 copyEvent( event, ev );
322 calendar->deleteEvent( ev ); 331 calendar->deleteEvent( ev );
323 calendar->addEvent( event); 332 calendar->addEvent( event);
324 } 333 }
325 else 334 else
326 event = ev; 335 event = ev;
327 uint cSum;
328 cSum = PhoneFormat::getCsumEvent( event );
329 event->setCsum( mProfileName, QString::number( cSum )); 336 event->setCsum( mProfileName, QString::number( cSum ));
330 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 337 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
331 event->setID( mProfileName,QString::number( id ) ); 338 event->setID( mProfileName,QString::number( id ) );
332 ev = er.next(); 339 ev = er.next();
333 } 340 }
334 { 341 {
335 qDebug("reading todos... "); 342 qDebug("reading todos... ");
336 QPtrList<Todo> tr = calendar->rawTodos(); 343 QPtrList<Todo> tr = calendar->rawTodos();
337 Todo* ev = tr.first(); 344 Todo* ev = tr.first();
338 while ( ev ) { 345 while ( ev ) {
339 346
340 QStringList cat = ev->categories(); 347 QStringList cat = ev->categories();
341 if ( cat.contains( "MeetingDEF" )) { 348 if ( cat.contains( "MeetingDEF" )) {
342 ev->setCategories( QStringList() ); 349 ev->setCategories( QStringList() );
343 } 350 }
344 int id = ev->pilotId(); 351 int id = ev->pilotId();
352 uint cSum;
353 cSum = PhoneFormat::getCsumTodo( ev );
345 Todo *event; 354 Todo *event;
346 event = existingCal->todo( mProfileName ,QString::number( id ) ); 355 event = existingCal->todo( mProfileName ,QString::number( id ) );
347 if ( event ) { 356 if ( event ) {
348 //qDebug("copy todo %s ", event->summary().latin1()); 357 //qDebug("copy todo %s ", event->summary().latin1());
349 358
350 event = (Todo*)event->clone(); 359 event = (Todo*)event->clone();
351 copyTodo( event, ev ); 360 copyTodo( event, ev );
352 calendar->deleteTodo( ev ); 361 calendar->deleteTodo( ev );
353 calendar->addTodo( event); 362 calendar->addTodo( event);
354 } 363 }
355 else 364 else
356 event = ev; 365 event = ev;
357 uint cSum;
358 cSum = PhoneFormat::getCsumTodo( event );
359 event->setCsum( mProfileName, QString::number( cSum )); 366 event->setCsum( mProfileName, QString::number( cSum ));
360 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 367 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
361 event->setID( mProfileName,QString::number( id ) ); 368 event->setID( mProfileName,QString::number( id ) );
362 ev = tr.next(); 369 ev = tr.next();
363 } 370 }
364 } 371 }
365 return true; 372 return true;
366} 373}
367void PhoneFormat::copyEvent( Event* to, Event* from ) 374void PhoneFormat::copyEvent( Event* to, Event* from )
368{ 375{
369 if ( from->dtStart().isValid() ) 376 if ( from->dtStart().isValid() )
370 to->setDtStart( from->dtStart() ); 377 to->setDtStart( from->dtStart() );
371 if ( from->dtEnd().isValid() ) 378 if ( from->dtEnd().isValid() )
372 to->setDtEnd( from->dtEnd() ); 379 to->setDtEnd( from->dtEnd() );
373 if ( !from->location().isEmpty() ) 380 if ( !from->location().isEmpty() )
374 to->setLocation( from->location() ); 381 to->setLocation( from->location() );
375 if ( !from->description().isEmpty() ) 382 if ( !from->description().isEmpty() )
376 to->setDescription( from->description() ); 383 to->setDescription( from->description() );
377 if ( !from->summary().isEmpty() ) 384 if ( !from->summary().isEmpty() )
378 to->setSummary( from->summary() ); 385 to->setSummary( from->summary() );
379 386
380 if ( from->alarms().count() ) { 387 if ( from->alarms().count() ) {
381 to->clearAlarms(); 388 to->clearAlarms();
382 Alarm *a = from->alarms().first(); 389 Alarm *a = from->alarms().first();
383 Alarm *b = to->newAlarm( ); 390 Alarm *b = to->newAlarm( );
384 b->setEnabled( a->enabled() ); 391 b->setEnabled( a->enabled() );
385 if ( a->hasStartOffset() ) { 392 b->setStartOffset(Duration( a->offset() ) );
386 b->setStartOffset( a->startOffset() );
387 }
388 if ( a->hasTime() )
389 b->setTime( a->time() );
390 393
391 } 394 }
392 QStringList cat = to->categories(); 395 QStringList cat = to->categories();
393 QStringList catFrom = from->categories(); 396 QStringList catFrom = from->categories();
394 QString nCat; 397 QString nCat;
395 int iii; 398 int iii;
396 for ( iii = 0; iii < catFrom.count();++iii ) { 399 for ( iii = 0; iii < catFrom.count();++iii ) {
397 nCat = catFrom[iii]; 400 nCat = catFrom[iii];
398 if ( !nCat.isEmpty() ) 401 if ( !nCat.isEmpty() )
399 if ( !cat.contains( nCat )) { 402 if ( !cat.contains( nCat )) {
400 cat << nCat; 403 cat << nCat;
401 } 404 }
402 } 405 }
403 to->setCategories( cat ); 406 to->setCategories( cat );
404 Recurrence * r = new Recurrence( *from->recurrence(),to); 407 if ( from->doesRecur() ) {
405 to->setRecurrence( r ) ; 408 Recurrence * r = new Recurrence( *from->recurrence(),to);
409 to->setRecurrence( r ) ;
410 }
406 411
407 412
408} 413}
409void PhoneFormat::copyTodo( Todo* to, Todo* from ) 414void PhoneFormat::copyTodo( Todo* to, Todo* from )
410{ 415{
411 if ( from->dtStart().isValid() ) 416 if ( from->hasStartDate() ) {
417 to->setHasStartDate( true );
412 to->setDtStart( from->dtStart() ); 418 to->setDtStart( from->dtStart() );
413 if ( from->dtDue().isValid() ) 419 }
420 if ( from->hasDueDate() ){
421 to->setHasDueDate( true );
414 to->setDtDue( from->dtDue() ); 422 to->setDtDue( from->dtDue() );
423 }
415 if ( !from->location().isEmpty() ) 424 if ( !from->location().isEmpty() )
416 to->setLocation( from->location() ); 425 to->setLocation( from->location() );
417 if ( !from->description().isEmpty() ) 426 if ( !from->description().isEmpty() )
418 to->setDescription( from->description() ); 427 to->setDescription( from->description() );
419 if ( !from->summary().isEmpty() ) 428 if ( !from->summary().isEmpty() )
420 to->setSummary( from->summary() ); 429 to->setSummary( from->summary() );
421 430
422 if ( from->alarms().count() ) { 431 if ( from->alarms().count() ) {
423 to->clearAlarms(); 432 to->clearAlarms();
424 Alarm *a = from->alarms().first(); 433 Alarm *a = from->alarms().first();
425 Alarm *b = to->newAlarm( ); 434 Alarm *b = to->newAlarm( );
426 b->setEnabled( a->enabled() ); 435 b->setEnabled( a->enabled() );
427 if ( a->hasStartOffset() ) 436 b->setStartOffset(Duration( a->offset() ) );
428 b->setStartOffset( a->startOffset() );
429 if ( a->hasTime() )
430 b->setTime( a->time() );
431 } 437 }
432 438
433 QStringList cat = to->categories(); 439 QStringList cat = to->categories();
434 QStringList catFrom = from->categories(); 440 QStringList catFrom = from->categories();
435 QString nCat; 441 QString nCat;
436 int iii; 442 int iii;
437 for ( iii = 0; iii < catFrom.count();++iii ) { 443 for ( iii = 0; iii < catFrom.count();++iii ) {
438 nCat = catFrom[iii]; 444 nCat = catFrom[iii];
439 if ( !nCat.isEmpty() ) 445 if ( !nCat.isEmpty() )
440 if ( !cat.contains( nCat )) { 446 if ( !cat.contains( nCat )) {
441 cat << nCat; 447 cat << nCat;
442 } 448 }
443 } 449 }
444 to->setCategories( cat ); 450 to->setCategories( cat );
445 if ( from->isCompleted() ) { 451 if ( from->isCompleted() ) {
446 to->setCompleted( true ); 452 to->setCompleted( true );
447 if( from->completed().isValid() ) 453 if( from->completed().isValid() )
448 to->setCompleted( from->completed() ); 454 to->setCompleted( from->completed() );
449 } else { 455 } else {
450 // set percentcomplete only, if to->isCompleted() 456 // set percentcomplete only, if to->isCompleted()
451 if ( to->isCompleted() ) 457 if ( to->isCompleted() )
452 to->setPercentComplete(from->percentComplete()); 458 to->setPercentComplete(from->percentComplete());
453 } 459 }
454 if( to->priority() == 2 && from->priority() == 1 ) 460 if( to->priority() == 2 && from->priority() == 1 )
455 ; //skip 461 ; //skip
456 else if (to->priority() == 4 && from->priority() == 5 ) 462 else if (to->priority() == 4 && from->priority() == 5 )
457 ; 463 ;
458 else 464 else
459 to->setPriority(from->priority()); 465 to->setPriority(from->priority());
460 466
461} 467}
462#include <qcstring.h> 468#include <qcstring.h>
463 469
464void PhoneFormat::afterSave( Incidence* inc) 470void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
465{ 471{
466 uint csum; 472 inc->setID( mProfileName, id );
467 inc->removeID( mProfileName ); 473 inc->setCsum( mProfileName, csum);
468 if ( inc->type() == "Event")
469 csum = PhoneFormat::getCsumEvent( (Event*) inc );
470 else
471 csum = PhoneFormat::getCsumTodo( (Todo*) inc );
472 inc->setCsum( mProfileName, QString::number( csum ));
473
474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
475 475
476} 476}
477 477
478bool PhoneFormat::writeToPhone( Calendar * calendar) 478bool PhoneFormat::writeToPhone( Calendar * calendar)
479{ 479{
480#ifdef _WIN32_ 480#ifdef _WIN32_
481 QString fileName = locateLocal("tmp", "tempfile.vcs"); 481 QString fileName = locateLocal("tmp", "phonefile.vcs");
482#else 482#else
483 QString fileName = "/tmp/kdepimtemp.vcs"; 483 QString fileName = "/tmp/phonefile.vcs";
484#endif 484#endif
485 485
486 VCalFormat vfsave; 486 VCalFormat vfsave;
487 vfsave.setLocalTime ( true ); 487 vfsave.setLocalTime ( true );
488 QString id = calendar->timeZoneId(); 488 QString id = calendar->timeZoneId();
489 calendar->setLocalTime(); 489 calendar->setLocalTime();
490 if ( ! vfsave.save( calendar, fileName ) ) 490 if ( ! vfsave.save( calendar, fileName ) )
491 return false; 491 return false;
492 calendar->setTimeZoneId( id ); 492 calendar->setTimeZoneId( id );
493 return PhoneAccess::writeToPhone( fileName ); 493 return PhoneAccess::writeToPhone( fileName );
494} 494}
495bool PhoneFormat::save( Calendar *calendar) 495bool PhoneFormat::save( Calendar *calendar)
496{ 496{
497 QLabel status ( i18n(" Opening device ..."), 0 ); 497
498 int w = status.sizeHint().width()+20 ;
499 if ( w < 200 ) w = 230;
500 int h = status.sizeHint().height()+20 ;
501 int dw = QApplication::desktop()->width();
502 int dh = QApplication::desktop()->height();
503 status.setCaption(i18n("Writing to phone...") );
504 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
505 status.show();
506 status.raise();
507 qApp->processEvents();
508 QString message;
509 498
510 // 1 remove events which should be deleted 499 // 1 remove events which should be deleted
511 QPtrList<Event> er = calendar->rawEvents(); 500 QPtrList<Event> er = calendar->rawEvents();
512 Event* ev = er.first(); 501 Event* ev = er.first();
513 while ( ev ) { 502 while ( ev ) {
514 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 503 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
515 calendar->deleteEvent( ev ); 504 calendar->deleteEvent( ev );
516 } else { 505 } else {
517 506
518 } 507 }
519 ev = er.next(); 508 ev = er.next();
520 } 509 }
521 // 2 remove todos which should be deleted 510 // 2 remove todos which should be deleted
522 QPtrList<Todo> tl = calendar->rawTodos(); 511 QPtrList<Todo> tl = calendar->rawTodos();
523 Todo* to = tl.first(); 512 Todo* to = tl.first();
524 while ( to ) { 513 while ( to ) {
525 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 514 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
526 calendar->deleteTodo( to ); 515 calendar->deleteTodo( to );
527 } else { 516 } else {
528 if ( to->isCompleted()) { 517 if ( to->isCompleted()) {
529 calendar->deleteTodo( to ); 518 calendar->deleteTodo( to );
530 } 519 }
531 } 520 }
532 to = tl.next(); 521 to = tl.next();
533 } 522 }
534 // 3 save file 523 // 3 save file
535 if ( !writeToPhone( calendar ) ) 524 if ( !writeToPhone( calendar ) )
536 return false; 525 return false;
537 526 QLabel status ( i18n(" Opening device ..."), 0 );
527 int w = status.sizeHint().width()+20 ;
528 if ( w < 200 ) w = 230;
529 int h = status.sizeHint().height()+20 ;
530 int dw = QApplication::desktop()->width();
531 int dh = QApplication::desktop()->height();
532 status.setCaption(i18n("Writing to phone...") );
533 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
534 QString message;
535 status.show();
536 status.raise();
537 qApp->processEvents();
538 // 5 reread data 538 // 5 reread data
539 message = i18n(" Rereading all data ... "); 539 message = i18n(" Rereading all data ... ");
540 status.setText ( message ); 540 status.setText ( message );
541 qApp->processEvents(); 541 qApp->processEvents();
542 CalendarLocal* calendarTemp = new CalendarLocal(); 542 CalendarLocal* calendarTemp = new CalendarLocal();
543 calendarTemp->setTimeZoneId( calendar->timeZoneId()); 543 calendarTemp->setTimeZoneId( calendar->timeZoneId());
544 if ( ! load( calendarTemp,calendar) ){ 544 if ( ! load( calendarTemp,calendar) ){
545 qDebug("error reloading calendar "); 545 qDebug("error reloading calendar ");
546 delete calendarTemp; 546 delete calendarTemp;
547 return false; 547 return false;
548 } 548 }
549 // 6 compare data 549 // 6 compare data
550 550
551//algo 6 compare event 551//algo 6 compare event
552 er = calendar->rawEvents(); 552 er = calendar->rawEvents();
553 ev = er.first(); 553 ev = er.first();
554 message = i18n(" Comparing event # "); 554 message = i18n(" Comparing event # ");
555 QPtrList<Event> er1 = calendarTemp->rawEvents(); 555 QPtrList<Event> er1 = calendarTemp->rawEvents();
556 Event* ev1; 556 Event* ev1;
557 int procCount = 0; 557 int procCount = 0;
558 while ( ev ) { 558 while ( ev ) {
559 //qDebug("event new ID %s",ev->summary().latin1()); 559 //qDebug("event new ID %s",ev->summary().latin1());
560 status.setText ( message + QString::number ( ++procCount ) ); 560 status.setText ( message + QString::number ( ++procCount ) );
561 qApp->processEvents(); 561 qApp->processEvents();
562 uint csum;
563 csum = PhoneFormat::getCsumEvent( ev );
564 QString cSum = QString::number( csum );
565 //ev->setCsum( mProfileName, cSum );
566 //qDebug("Event cSum %s ", cSum.latin1());
567 ev1 = er1.first(); 562 ev1 = er1.first();
568 while ( ev1 ) { 563 while ( ev1 ) {
569 if ( ev1->getCsum( mProfileName ) == cSum ) { 564 if ( ev->contains( ev1 ) ) {
565 afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName));
570 er1.remove( ev1 ); 566 er1.remove( ev1 );
571 afterSave( ev );
572 ev->setID(mProfileName, ev1->getID(mProfileName) );
573 //qDebug("Event found on phone for %s ", ev->summary().latin1());
574
575 break; 567 break;
576 } 568 }
577 ev1 = er1.next(); 569 ev1 = er1.next();
578 } 570 }
579 if ( ! ev1 ) { 571 if ( ! ev1 ) {
580 // ev->removeID(mProfileName); 572 // ev->removeID(mProfileName);
581 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); 573 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
582 } 574 }
583 575
584 576
585 ev = er.next(); 577 ev = er.next();
586 } 578 }
587 //algo 6 compare todo 579 //algo 6 compare todo
588 tl = calendar->rawTodos(); 580 tl = calendar->rawTodos();
589 to = tl.first(); 581 to = tl.first();
590 procCount = 0; 582 procCount = 0;
591 QPtrList<Todo> tl1 = calendarTemp->rawTodos(); 583 QPtrList<Todo> tl1 = calendarTemp->rawTodos();
592 Todo* to1 ; 584 Todo* to1 ;
593 message = i18n(" Comparing todo # "); 585 message = i18n(" Comparing todo # ");
594 while ( to ) { 586 while ( to ) {
595 status.setText ( message + QString::number ( ++procCount ) ); 587 status.setText ( message + QString::number ( ++procCount ) );
596 qApp->processEvents(); 588 qApp->processEvents();
597 uint csum;
598 csum = PhoneFormat::getCsumTodo( to );
599 QString cSum = QString::number( csum );
600 //to->setCsum( mProfileName, cSum );
601 //qDebug("Todo cSum %s ", cSum.latin1());
602 Todo* to1 = tl1.first(); 589 Todo* to1 = tl1.first();
603 while ( to1 ) { 590 while ( to1 ) {
604 if ( to1->getCsum( mProfileName ) == cSum ) { 591 if ( to->contains( to1 ) ) {
592 afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName));
605 tl1.remove( to1 ); 593 tl1.remove( to1 );
606 afterSave( to );
607 to->setID(mProfileName, to1->getID(mProfileName) );
608 break; 594 break;
609 } 595 }
610 to1 = tl1.next(); 596 to1 = tl1.next();
611 } 597 }
612 if ( ! to1 ) { 598 if ( ! to1 ) {
613 //to->removeID(mProfileName); 599 //to->removeID(mProfileName);
614 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1()); 600 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1());
615 } 601 }
616 602
617 to = tl.next(); 603 to = tl.next();
618 } 604 }
619 delete calendarTemp; 605 delete calendarTemp;
620 return true; 606 return true;
621 607
622 608
623 609
624} 610}
625 611
626 612
627QString PhoneFormat::toString( Calendar * ) 613QString PhoneFormat::toString( Calendar * )
628{ 614{
629 return QString::null; 615 return QString::null;
630} 616}
631bool PhoneFormat::fromString( Calendar *calendar, const QString & text) 617bool PhoneFormat::fromString( Calendar *calendar, const QString & text)
632{ 618{
633 return false; 619 return false;
634} 620}
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h
index 001fd81..d11f68b 100644
--- a/libkcal/phoneformat.h
+++ b/libkcal/phoneformat.h
@@ -1,62 +1,62 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2003 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#ifndef PHONEFORMAT_H 21#ifndef PHONEFORMAT_H
22#define PHONEFORMAT_H 22#define PHONEFORMAT_H
23 23
24#include <qstring.h> 24#include <qstring.h>
25 25
26#include "scheduler.h" 26#include "scheduler.h"
27 27
28#include "vcalformat.h" 28#include "vcalformat.h"
29#include "calformat.h" 29#include "calformat.h"
30 30
31namespace KCal { 31namespace KCal {
32 32
33/** 33/**
34 This class implements the calendar format used by Phone. 34 This class implements the calendar format used by Phone.
35*/ 35*/
36 class Event; 36 class Event;
37 class Todo; 37 class Todo;
38class PhoneFormat : public QObject { 38class PhoneFormat : public QObject {
39 public: 39 public:
40 /** Create new iCalendar format. */ 40 /** Create new iCalendar format. */
41 PhoneFormat(QString profileName, QString device,QString connection, QString model); 41 PhoneFormat(QString profileName, QString device,QString connection, QString model);
42 virtual ~PhoneFormat(); 42 virtual ~PhoneFormat();
43 43
44 bool load( Calendar * ,Calendar * ); 44 bool load( Calendar * ,Calendar * );
45 bool save( Calendar * ); 45 bool save( Calendar * );
46 bool fromString( Calendar *, const QString & ); 46 bool fromString( Calendar *, const QString & );
47 QString toString( Calendar * ); 47 QString toString( Calendar * );
48 static ulong getCsum( const QStringList & ); 48 static ulong getCsum( const QStringList & );
49 static ulong getCsumTodo( Todo* to ); 49 static ulong getCsumTodo( Todo* to );
50 static ulong getCsumEvent( Event* ev ); 50 static ulong getCsumEvent( Event* ev );
51 static bool writeToPhone( Calendar * ); 51 static bool writeToPhone( Calendar * );
52 private: 52 private:
53 void copyEvent( Event* to, Event* from ); 53 void copyEvent( Event* to, Event* from );
54 void copyTodo( Todo* to, Todo* from ); 54 void copyTodo( Todo* to, Todo* from );
55 //int initDevice(GSM_StateMachine *s); 55 //int initDevice(GSM_StateMachine *s);
56 QString mProfileName; 56 QString mProfileName;
57 void afterSave( Incidence* ); 57 void afterSave( Incidence* ,const QString&,const QString&);
58}; 58};
59 59
60} 60}
61 61
62#endif 62#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 0c1e3e4..3d2de61 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -1,123 +1,181 @@
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 <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "todo.h" 25#include "todo.h"
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29Todo::Todo(): Incidence() 29Todo::Todo(): Incidence()
30{ 30{
31// mStatus = TENTATIVE; 31// mStatus = TENTATIVE;
32 32
33 mHasDueDate = false; 33 mHasDueDate = false;
34 setHasStartDate( false ); 34 setHasStartDate( false );
35 mCompleted = getEvenTime(QDateTime::currentDateTime()); 35 mCompleted = getEvenTime(QDateTime::currentDateTime());
36 mHasCompletedDate = false; 36 mHasCompletedDate = false;
37 mPercentComplete = 0; 37 mPercentComplete = 0;
38} 38}
39 39
40Todo::Todo(const Todo &t) : Incidence(t) 40Todo::Todo(const Todo &t) : Incidence(t)
41{ 41{
42 mDtDue = t.mDtDue; 42 mDtDue = t.mDtDue;
43 mHasDueDate = t.mHasDueDate; 43 mHasDueDate = t.mHasDueDate;
44 mCompleted = t.mCompleted; 44 mCompleted = t.mCompleted;
45 mHasCompletedDate = t.mHasCompletedDate; 45 mHasCompletedDate = t.mHasCompletedDate;
46 mPercentComplete = t.mPercentComplete; 46 mPercentComplete = t.mPercentComplete;
47} 47}
48 48
49Todo::~Todo() 49Todo::~Todo()
50{ 50{
51 51
52} 52}
53 53
54Incidence *Todo::clone() 54Incidence *Todo::clone()
55{ 55{
56 return new Todo(*this); 56 return new Todo(*this);
57} 57}
58 58
59bool Todo::contains ( Todo* from )
60{
59 61
62 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() ))
64 return false;
65 if ( from->hasStartDate() ) {
66 if ( !hasStartDate() )
67 return false;
68 if ( from->dtStart() != dtStart())
69 return false;
70 }
71 if ( from->hasDueDate() ){
72 if ( !hasDueDate() )
73 return false;
74 if ( from->dtDue() != dtDue())
75 return false;
76 }
77 if ( !from->location().isEmpty() )
78 if ( !location().startsWith( from->location() ) )
79 return false;
80 if ( !from->description().isEmpty() )
81 if ( !description().startsWith( from->description() ))
82 return false;
83 if ( from->alarms().count() ) {
84 Alarm *a = from->alarms().first();
85 if ( a->enabled() ){
86 if ( !alarms().count() )
87 return false;
88 Alarm *b = alarms().first();
89 if( ! b->enabled() )
90 return false;
91 if ( ! (a->offset() == b->offset() ))
92 return false;
93 }
94 }
95
96 QStringList cat = categories();
97 QStringList catFrom = from->categories();
98 QString nCat;
99 int iii;
100 for ( iii = 0; iii < catFrom.count();++iii ) {
101 nCat = catFrom[iii];
102 if ( !nCat.isEmpty() )
103 if ( !cat.contains( nCat )) {
104 return false;
105 }
106 }
107 if ( from->isCompleted() ) {
108 if ( !isCompleted() )
109 return false;
110 }
111 if( priority() != from->priority() )
112 return false;
113
114
115 return true;
116
117}
60bool KCal::operator==( const Todo& t1, const Todo& t2 ) 118bool KCal::operator==( const Todo& t1, const Todo& t2 )
61{ 119{
62 120
63 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 121 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
64 if ( ! ret ) 122 if ( ! ret )
65 return false; 123 return false;
66 if ( t1.hasDueDate() == t2.hasDueDate() ) { 124 if ( t1.hasDueDate() == t2.hasDueDate() ) {
67 if ( t1.hasDueDate() ) { 125 if ( t1.hasDueDate() ) {
68 if ( t1.doesFloat() == t2.doesFloat() ) { 126 if ( t1.doesFloat() == t2.doesFloat() ) {
69 if ( t1.doesFloat() ) { 127 if ( t1.doesFloat() ) {
70 if ( t1.dtDue().date() != t2.dtDue().date() ) 128 if ( t1.dtDue().date() != t2.dtDue().date() )
71 return false; 129 return false;
72 } else 130 } else
73 if ( t1.dtDue() != t2.dtDue() ) 131 if ( t1.dtDue() != t2.dtDue() )
74 return false; 132 return false;
75 } else 133 } else
76 return false;// float != 134 return false;// float !=
77 } 135 }
78 136
79 } else 137 } else
80 return false; 138 return false;
81 if ( t1.percentComplete() != t2.percentComplete() ) 139 if ( t1.percentComplete() != t2.percentComplete() )
82 return false; 140 return false;
83 if ( t1.isCompleted() ) { 141 if ( t1.isCompleted() ) {
84 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
85 if ( t1.hasCompletedDate() ) { 143 if ( t1.hasCompletedDate() ) {
86 if ( t1.completed() != t2.completed() ) 144 if ( t1.completed() != t2.completed() )
87 return false; 145 return false;
88 } 146 }
89 147
90 } else 148 } else
91 return false; 149 return false;
92 } 150 }
93 return true; 151 return true;
94 152
95} 153}
96 154
97void Todo::setDtDue(const QDateTime &dtDue) 155void Todo::setDtDue(const QDateTime &dtDue)
98{ 156{
99 //int diffsecs = mDtDue.secsTo(dtDue); 157 //int diffsecs = mDtDue.secsTo(dtDue);
100 158
101 /*if (mReadOnly) return; 159 /*if (mReadOnly) return;
102 const QPtrList<Alarm>& alarms = alarms(); 160 const QPtrList<Alarm>& alarms = alarms();
103 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { 161 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) {
104 if (alarm->enabled()) { 162 if (alarm->enabled()) {
105 alarm->setTime(alarm->time().addSecs(diffsecs)); 163 alarm->setTime(alarm->time().addSecs(diffsecs));
106 } 164 }
107 }*/ 165 }*/
108 mDtDue = getEvenTime(dtDue); 166 mDtDue = getEvenTime(dtDue);
109 167
110 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; 168 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl;
111 169
112 /*const QPtrList<Alarm>& alarms = alarms(); 170 /*const QPtrList<Alarm>& alarms = alarms();
113 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) 171 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next())
114 alarm->setAlarmStart(mDtDue);*/ 172 alarm->setAlarmStart(mDtDue);*/
115 173
116 updated(); 174 updated();
117} 175}
118 176
119QDateTime Todo::dtDue() const 177QDateTime Todo::dtDue() const
120{ 178{
121 return mDtDue; 179 return mDtDue;
122} 180}
123 181
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 9aa92f8..0f22c59 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -38,84 +38,85 @@ class Todo : public Incidence
38 ~Todo(); 38 ~Todo();
39 typedef ListBase<Todo> List; 39 typedef ListBase<Todo> List;
40 QCString type() const { return "Todo"; } 40 QCString type() const { return "Todo"; }
41 41
42 /** Return an exact copy of this todo. */ 42 /** Return an exact copy of this todo. */
43 Incidence *clone(); 43 Incidence *clone();
44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
45 45
46 /** for setting the todo's due date/time with a QDateTime. */ 46 /** for setting the todo's due date/time with a QDateTime. */
47 void setDtDue(const QDateTime &dtDue); 47 void setDtDue(const QDateTime &dtDue);
48 /** returns an event's Due date/time as a QDateTime. */ 48 /** returns an event's Due date/time as a QDateTime. */
49 QDateTime dtDue() const; 49 QDateTime dtDue() const;
50 /** returns an event's due time as a string formatted according to the 50 /** returns an event's due time as a string formatted according to the
51 users locale settings */ 51 users locale settings */
52 QString dtDueTimeStr() const; 52 QString dtDueTimeStr() const;
53 /** returns an event's due date as a string formatted according to the 53 /** returns an event's due date as a string formatted according to the
54 users locale settings */ 54 users locale settings */
55 QString dtDueDateStr(bool shortfmt=true) const; 55 QString dtDueDateStr(bool shortfmt=true) const;
56 /** returns an event's due date and time as a string formatted according 56 /** returns an event's due date and time as a string formatted according
57 to the users locale settings */ 57 to the users locale settings */
58 QString dtDueStr(bool shortfmt=true) const; 58 QString dtDueStr(bool shortfmt=true) const;
59 59
60 /** returns TRUE or FALSE depending on whether the todo has a due date */ 60 /** returns TRUE or FALSE depending on whether the todo has a due date */
61 bool hasDueDate() const; 61 bool hasDueDate() const;
62 /** sets the event's hasDueDate value. */ 62 /** sets the event's hasDueDate value. */
63 void setHasDueDate(bool f); 63 void setHasDueDate(bool f);
64 64
65 65
66 /** sets the event's status to the string specified. The string 66 /** sets the event's status to the string specified. The string
67 * must be a recognized value for the status field, i.e. a string 67 * must be a recognized value for the status field, i.e. a string
68 * equivalent of the possible status enumerations previously described. */ 68 * equivalent of the possible status enumerations previously described. */
69// void setStatus(const QString &statStr); 69// void setStatus(const QString &statStr);
70 /** sets the event's status to the value specified. See the enumeration 70 /** sets the event's status to the value specified. See the enumeration
71 * above for possible values. */ 71 * above for possible values. */
72// void setStatus(int); 72// void setStatus(int);
73 /** return the event's status. */ 73 /** return the event's status. */
74// int status() const; 74// int status() const;
75 /** return the event's status in string format. */ 75 /** return the event's status in string format. */
76// QString statusStr() const; 76// QString statusStr() const;
77 77
78 /** return, if this todo is completed */ 78 /** return, if this todo is completed */
79 bool isCompleted() const; 79 bool isCompleted() const;
80 /** set completed state of this todo */ 80 /** set completed state of this todo */
81 void setCompleted(bool); 81 void setCompleted(bool);
82 82
83 /** 83 /**
84 Return how many percent of the task are completed. Returns a value 84 Return how many percent of the task are completed. Returns a value
85 between 0 and 100. 85 between 0 and 100.
86 */ 86 */
87 int percentComplete() const; 87 int percentComplete() const;
88 /** 88 /**
89 Set how many percent of the task are completed. Valid values are in the 89 Set how many percent of the task are completed. Valid values are in the
90 range from 0 to 100. 90 range from 0 to 100.
91 */ 91 */
92 void setPercentComplete(int); 92 void setPercentComplete(int);
93 93
94 /** return date and time when todo was completed */ 94 /** return date and time when todo was completed */
95 QDateTime completed() const; 95 QDateTime completed() const;
96 QString completedStr() const; 96 QString completedStr() const;
97 /** set date and time of completion */ 97 /** set date and time of completion */
98 void setCompleted(const QDateTime &completed); 98 void setCompleted(const QDateTime &completed);
99 99
100 /** Return true, if todo has a date associated with completion */ 100 /** Return true, if todo has a date associated with completion */
101 bool hasCompletedDate() const; 101 bool hasCompletedDate() const;
102 bool contains ( Todo*);
102 103
103 private: 104 private:
104 bool accept(Visitor &v) { return v.visit(this); } 105 bool accept(Visitor &v) { return v.visit(this); }
105 106
106 QDateTime mDtDue; // due date of todo 107 QDateTime mDtDue; // due date of todo
107 108
108 bool mHasDueDate; // if todo has associated due date 109 bool mHasDueDate; // if todo has associated due date
109 110
110// int mStatus; // confirmed/delegated/tentative/etc 111// int mStatus; // confirmed/delegated/tentative/etc
111 112
112 QDateTime mCompleted; 113 QDateTime mCompleted;
113 bool mHasCompletedDate; 114 bool mHasCompletedDate;
114 115
115 int mPercentComplete; 116 int mPercentComplete;
116}; 117};
117 118
118 bool operator==( const Todo&, const Todo& ); 119 bool operator==( const Todo&, const Todo& );
119} 120}
120 121
121#endif 122#endif
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index a6ae1bc..df93209 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -1,157 +1,159 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brwon 3 Copyright (c) 1998 Preston Brwon
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 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 <qapplication.h> 22#include <qapplication.h>
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qclipboard.h> 27#include <qclipboard.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qfile.h> 29#include <qfile.h>
30 30
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kmessagebox.h> 33#include <kmessagebox.h>
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36 36
37#include "vcc.h" 37#include "vcc.h"
38#include "vobject.h" 38#include "vobject.h"
39 39
40#include "vcaldrag.h" 40#include "vcaldrag.h"
41#include "calendar.h" 41#include "calendar.h"
42 42
43#include "vcalformat.h" 43#include "vcalformat.h"
44 44
45using namespace KCal; 45using namespace KCal;
46 46
47VCalFormat::VCalFormat() 47VCalFormat::VCalFormat()
48{ 48{
49 mCalendar = 0; 49 mCalendar = 0;
50 useLocalTime = false; 50 useLocalTime = false;
51} 51}
52 52
53VCalFormat::~VCalFormat() 53VCalFormat::~VCalFormat()
54{ 54{
55} 55}
56 56
57void VCalFormat::setLocalTime ( bool b ) 57void VCalFormat::setLocalTime ( bool b )
58{ 58{
59 useLocalTime = b; 59 useLocalTime = b;
60} 60}
61bool VCalFormat::load(Calendar *calendar, const QString &fileName) 61bool VCalFormat::load(Calendar *calendar, const QString &fileName)
62{ 62{
63 mCalendar = calendar; 63 mCalendar = calendar;
64 clearException(); 64 clearException();
65 useLocalTime = mCalendar->isLocalTime(); 65 if ( ! useLocalTime )
66 useLocalTime = mCalendar->isLocalTime();
66 VObject *vcal = 0; 67 VObject *vcal = 0;
67 68
68 // this is not necessarily only 1 vcal. Could be many vcals, or include 69 // this is not necessarily only 1 vcal. Could be many vcals, or include
69 // a vcard... 70 // a vcard...
70 vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data())); 71 vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data()));
71 72
72 if (!vcal) { 73 if (!vcal) {
73 setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); 74 setException(new ErrorFormat(ErrorFormat::CalVersionUnknown));
74 return FALSE; 75 return FALSE;
75 } 76 }
76 77
77 // any other top-level calendar stuff should be added/initialized here 78 // any other top-level calendar stuff should be added/initialized here
78 79
79 // put all vobjects into their proper places 80 // put all vobjects into their proper places
80 populate(vcal); 81 populate(vcal);
81 82
82 // clean up from vcal API stuff 83 // clean up from vcal API stuff
83 cleanVObjects(vcal); 84 cleanVObjects(vcal);
84 cleanStrTbl(); 85 cleanStrTbl();
85 86
86 return true; 87 return true;
87} 88}
88 89
89 90
90bool VCalFormat::save(Calendar *calendar, const QString &fileName) 91bool VCalFormat::save(Calendar *calendar, const QString &fileName)
91{ 92{
92 mCalendar = calendar; 93 mCalendar = calendar;
93 useLocalTime = mCalendar->isLocalTime(); 94 if ( ! useLocalTime )
95 useLocalTime = mCalendar->isLocalTime();
94 96
95 QString tmpStr; 97 QString tmpStr;
96 VObject *vcal, *vo; 98 VObject *vcal, *vo;
97 99
98 100
99 vcal = newVObject(VCCalProp); 101 vcal = newVObject(VCCalProp);
100 102
101 // addPropValue(vcal,VCLocationProp, "0.0"); 103 // addPropValue(vcal,VCLocationProp, "0.0");
102 addPropValue(vcal,VCProdIdProp, productId()); 104 addPropValue(vcal,VCProdIdProp, productId());
103 tmpStr = mCalendar->getTimeZoneStr(); 105 tmpStr = mCalendar->getTimeZoneStr();
104 //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); 106 //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() );
105 addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); 107 addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit());
106 addPropValue(vcal,VCVersionProp, _VCAL_VERSION); 108 addPropValue(vcal,VCVersionProp, _VCAL_VERSION);
107 109
108 // TODO STUFF 110 // TODO STUFF
109 QPtrList<Todo> todoList = mCalendar->rawTodos(); 111 QPtrList<Todo> todoList = mCalendar->rawTodos();
110 QPtrListIterator<Todo> qlt(todoList); 112 QPtrListIterator<Todo> qlt(todoList);
111 for (; qlt.current(); ++qlt) { 113 for (; qlt.current(); ++qlt) {
112 vo = eventToVTodo(qlt.current()); 114 vo = eventToVTodo(qlt.current());
113 addVObjectProp(vcal, vo); 115 addVObjectProp(vcal, vo);
114 } 116 }
115 117
116 // EVENT STUFF 118 // EVENT STUFF
117 QPtrList<Event> events = mCalendar->rawEvents(); 119 QPtrList<Event> events = mCalendar->rawEvents();
118 Event *ev; 120 Event *ev;
119 for(ev=events.first();ev;ev=events.next()) { 121 for(ev=events.first();ev;ev=events.next()) {
120 vo = eventToVEvent(ev); 122 vo = eventToVEvent(ev);
121 addVObjectProp(vcal, vo); 123 addVObjectProp(vcal, vo);
122 } 124 }
123 125
124 writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); 126 writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal);
125 cleanVObjects(vcal); 127 cleanVObjects(vcal);
126 cleanStrTbl(); 128 cleanStrTbl();
127 129
128 if (QFile::exists(fileName)) { 130 if (QFile::exists(fileName)) {
129 return true; 131 return true;
130 } else { 132 } else {
131 return false; // error 133 return false; // error
132 } 134 }
133} 135}
134 136
135bool VCalFormat::fromString( Calendar *calendar, const QString &text ) 137bool VCalFormat::fromString( Calendar *calendar, const QString &text )
136{ 138{
137 // TODO: Factor out VCalFormat::fromString() 139 // TODO: Factor out VCalFormat::fromString()
138 140
139 QCString data = text.utf8(); 141 QCString data = text.utf8();
140 142
141 if ( !data.size() ) return false; 143 if ( !data.size() ) return false;
142 144
143 VObject *vcal = Parse_MIME( data.data(), data.size()); 145 VObject *vcal = Parse_MIME( data.data(), data.size());
144 if ( !vcal ) return false; 146 if ( !vcal ) return false;
145 147
146 VObjectIterator i; 148 VObjectIterator i;
147 VObject *curvo; 149 VObject *curvo;
148 initPropIterator( &i, vcal ); 150 initPropIterator( &i, vcal );
149 151
150 // we only take the first object. TODO: parse all incidences. 152 // we only take the first object. TODO: parse all incidences.
151 do { 153 do {
152 curvo = nextVObject( &i ); 154 curvo = nextVObject( &i );
153 } while ( strcmp( vObjectName( curvo ), VCEventProp ) && 155 } while ( strcmp( vObjectName( curvo ), VCEventProp ) &&
154 strcmp( vObjectName( curvo ), VCTodoProp ) ); 156 strcmp( vObjectName( curvo ), VCTodoProp ) );
155 157
156 if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { 158 if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) {
157 Event *event = VEventToEvent( curvo ); 159 Event *event = VEventToEvent( curvo );
@@ -1111,194 +1113,198 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
1111 index += 2; // advance to day(s) 1113 index += 2; // advance to day(s)
1112 while (numFromDay(tmpStr.mid(index,3)) >= 0) { 1114 while (numFromDay(tmpStr.mid(index,3)) >= 0) {
1113 int dayNum = numFromDay(tmpStr.mid(index,3)); 1115 int dayNum = numFromDay(tmpStr.mid(index,3));
1114 qba.setBit(dayNum); 1116 qba.setBit(dayNum);
1115 index += 3; // advance to next day, or possibly pos or "#" 1117 index += 3; // advance to next day, or possibly pos or "#"
1116 } 1118 }
1117 anEvent->recurrence()->addMonthlyPos(tmpPos, qba); 1119 anEvent->recurrence()->addMonthlyPos(tmpPos, qba);
1118 qba.detach(); 1120 qba.detach();
1119 qba.fill(FALSE); // clear out 1121 qba.fill(FALSE); // clear out
1120 } // while != "#" 1122 } // while != "#"
1121 } 1123 }
1122 index = last; if (tmpStr.mid(index,1) == "#") index++; 1124 index = last; if (tmpStr.mid(index,1) == "#") index++;
1123 if (tmpStr.find('T', index) != -1) { 1125 if (tmpStr.find('T', index) != -1) {
1124 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length() - 1126 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length() -
1125 index))).date(); 1127 index))).date();
1126 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyPos, rFreq, rEndDate); 1128 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyPos, rFreq, rEndDate);
1127 } else { 1129 } else {
1128 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); 1130 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt();
1129 if (rDuration == 0) 1131 if (rDuration == 0)
1130 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyPos, rFreq, -1); 1132 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyPos, rFreq, -1);
1131 else 1133 else
1132 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyPos, rFreq, rDuration); 1134 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyPos, rFreq, rDuration);
1133 } 1135 }
1134 } 1136 }
1135 1137
1136 /**************************** MONTHLY-BY-DAY ***************************/ 1138 /**************************** MONTHLY-BY-DAY ***************************/
1137 else if (tmpStr.left(2) == "MD") { 1139 else if (tmpStr.left(2) == "MD") {
1138 int index = tmpStr.find(' '); 1140 int index = tmpStr.find(' ');
1139 int last = tmpStr.findRev(' ') + 1; 1141 int last = tmpStr.findRev(' ') + 1;
1140 int rFreq = tmpStr.mid(2, (index-1)).toInt(); 1142 int rFreq = tmpStr.mid(2, (index-1)).toInt();
1141 index += 1; 1143 index += 1;
1142 short tmpDay; 1144 short tmpDay;
1143 if( index == last ) { 1145 if( index == last ) {
1144 // e.g. MD1 #0 1146 // e.g. MD1 #0
1145 tmpDay = anEvent->dtStart().date().day(); 1147 tmpDay = anEvent->dtStart().date().day();
1146 anEvent->recurrence()->addMonthlyDay(tmpDay); 1148 anEvent->recurrence()->addMonthlyDay(tmpDay);
1147 } 1149 }
1148 else { 1150 else {
1149 // e.g. MD1 3 #0 1151 // e.g. MD1 3 #0
1150 while (index < last) { 1152 while (index < last) {
1151 int index2 = tmpStr.find(' ', index); 1153 int index2 = tmpStr.find(' ', index);
1152 tmpDay = tmpStr.mid(index, (index2-index)).toShort(); 1154 tmpDay = tmpStr.mid(index, (index2-index)).toShort();
1153 index = index2-1; 1155 index = index2-1;
1154 if (tmpStr.mid(index, 1) == "-") 1156 if (tmpStr.mid(index, 1) == "-")
1155 tmpDay = 0 - tmpDay; 1157 tmpDay = 0 - tmpDay;
1156 index += 2; // advance the index; 1158 index += 2; // advance the index;
1157 anEvent->recurrence()->addMonthlyDay(tmpDay); 1159 anEvent->recurrence()->addMonthlyDay(tmpDay);
1158 } // while != # 1160 } // while != #
1159 } 1161 }
1160 index = last; if (tmpStr.mid(index,1) == "#") index++; 1162 index = last; if (tmpStr.mid(index,1) == "#") index++;
1161 if (tmpStr.find('T', index) != -1) { 1163 if (tmpStr.find('T', index) != -1) {
1162 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); 1164 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date();
1163 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyDay, rFreq, rEndDate); 1165 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyDay, rFreq, rEndDate);
1164 } else { 1166 } else {
1165 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); 1167 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt();
1166 if (rDuration == 0) 1168 if (rDuration == 0)
1167 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyDay, rFreq, -1); 1169 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyDay, rFreq, -1);
1168 else 1170 else
1169 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyDay, rFreq, rDuration); 1171 anEvent->recurrence()->setMonthly(Recurrence::rMonthlyDay, rFreq, rDuration);
1170 } 1172 }
1171 } 1173 }
1172 1174
1173 /*********************** YEARLY-BY-MONTH *******************************/ 1175 /*********************** YEARLY-BY-MONTH *******************************/
1174 else if (tmpStr.left(2) == "YM") { 1176 else if (tmpStr.left(2) == "YM") {
1175 int index = tmpStr.find(' '); 1177 // we have to set this such that recurrence accepts addYearlyNum(tmpDay);
1176 int last = tmpStr.findRev(' ') + 1; 1178 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, 1, -1);
1177 int rFreq = tmpStr.mid(2, (index-1)).toInt(); 1179 int index = tmpStr.find(' ');
1178 index += 1; 1180 int last = tmpStr.findRev(' ') + 1;
1179 short tmpMonth; 1181 int rFreq = tmpStr.mid(2, (index-1)).toInt();
1180 if( index == last ) { 1182 index += 1;
1181 // e.g. YM1 #0 1183 short tmpMonth;
1182 tmpMonth = anEvent->dtStart().date().month(); 1184 if( index == last ) {
1183 anEvent->recurrence()->addYearlyNum(tmpMonth); 1185 // e.g. YM1 #0
1184 } 1186 tmpMonth = anEvent->dtStart().date().month();
1185 else { 1187 anEvent->recurrence()->addYearlyNum(tmpMonth);
1186 // e.g. YM1 3 #0 1188 }
1187 while (index < last) { 1189 else {
1188 int index2 = tmpStr.find(' ', index); 1190 // e.g. YM1 3 #0
1189 tmpMonth = tmpStr.mid(index, (index2-index)).toShort(); 1191 while (index < last) {
1190 index = index2+1; 1192 int index2 = tmpStr.find(' ', index);
1191 anEvent->recurrence()->addYearlyNum(tmpMonth); 1193 tmpMonth = tmpStr.mid(index, (index2-index)).toShort();
1192 } // while != # 1194 index = index2+1;
1193 } 1195 anEvent->recurrence()->addYearlyNum(tmpMonth);
1194 index = last; if (tmpStr.mid(index,1) == "#") index++; 1196 } // while != #
1195 if (tmpStr.find('T', index) != -1) { 1197 }
1196 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); 1198 index = last; if (tmpStr.mid(index,1) == "#") index++;
1197 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rEndDate); 1199 if (tmpStr.find('T', index) != -1) {
1198 } else { 1200 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date();
1199 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); 1201 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rEndDate);
1200 if (rDuration == 0) 1202 } else {
1201 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, -1); 1203 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt();
1202 else 1204 if (rDuration == 0)
1203 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rDuration); 1205 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, -1);
1204 } 1206 else
1207 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rDuration);
1208 }
1205 } 1209 }
1206 1210
1207 /*********************** YEARLY-BY-DAY *********************************/ 1211 /*********************** YEARLY-BY-DAY *********************************/
1208 else if (tmpStr.left(2) == "YD") { 1212 else if (tmpStr.left(2) == "YD") {
1209 int index = tmpStr.find(' '); 1213 // we have to set this such that recurrence accepts addYearlyNum(tmpDay);
1210 int last = tmpStr.findRev(' ') + 1; 1214 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, 1, -1);
1211 int rFreq = tmpStr.mid(2, (index-1)).toInt(); 1215 int index = tmpStr.find(' ');
1212 index += 1; 1216 int last = tmpStr.findRev(' ') + 1;
1213 short tmpDay; 1217 int rFreq = tmpStr.mid(2, (index-1)).toInt();
1214 if( index == last ) { 1218 index += 1;
1215 // e.g. YD1 #0 1219 short tmpDay;
1216 tmpDay = anEvent->dtStart().date().dayOfYear(); 1220 if( index == last ) {
1217 anEvent->recurrence()->addYearlyNum(tmpDay); 1221 // e.g. YD1 #0
1218 } 1222 tmpDay = anEvent->dtStart().date().dayOfYear();
1219 else { 1223 anEvent->recurrence()->addYearlyNum(tmpDay);
1220 // e.g. YD1 123 #0 1224 }
1221 while (index < last) { 1225 else {
1222 int index2 = tmpStr.find(' ', index); 1226 // e.g. YD1 123 #0
1223 tmpDay = tmpStr.mid(index, (index2-index)).toShort(); 1227 while (index < last) {
1224 index = index2+1; 1228 int index2 = tmpStr.find(' ', index);
1225 anEvent->recurrence()->addYearlyNum(tmpDay); 1229 tmpDay = tmpStr.mid(index, (index2-index)).toShort();
1226 } // while != # 1230 index = index2+1;
1227 } 1231 anEvent->recurrence()->addYearlyNum(tmpDay);
1228 index = last; if (tmpStr.mid(index,1) == "#") index++; 1232 } // while != #
1229 if (tmpStr.find('T', index) != -1) { 1233 }
1230 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); 1234 index = last; if (tmpStr.mid(index,1) == "#") index++;
1231 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rEndDate); 1235 if (tmpStr.find('T', index) != -1) {
1232 } else { 1236 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date();
1233 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); 1237 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rEndDate);
1234 if (rDuration == 0) 1238 } else {
1235 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, -1); 1239 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt();
1236 else 1240 if (rDuration == 0)
1237 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rDuration); 1241 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, -1);
1238 } 1242 else
1243 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rDuration);
1244 }
1239 } else { 1245 } else {
1240 kdDebug(5800) << "we don't understand this type of recurrence!" << endl; 1246 kdDebug(5800) << "we don't understand this type of recurrence!" << endl;
1241 } // if 1247 } // if
1242 } // repeats 1248 } // repeats
1243 1249
1244 1250
1245 // recurrence exceptions 1251 // recurrence exceptions
1246 if ((vo = isAPropertyOf(vevent, VCExpDateProp)) != 0) { 1252 if ((vo = isAPropertyOf(vevent, VCExpDateProp)) != 0) {
1247 s = fakeCString(vObjectUStringZValue(vo)); 1253 s = fakeCString(vObjectUStringZValue(vo));
1248 QStringList exDates = QStringList::split(",",s); 1254 QStringList exDates = QStringList::split(",",s);
1249 QStringList::ConstIterator it; 1255 QStringList::ConstIterator it;
1250 for(it = exDates.begin(); it != exDates.end(); ++it ) { 1256 for(it = exDates.begin(); it != exDates.end(); ++it ) {
1251 anEvent->addExDate(ISOToQDate(*it)); 1257 anEvent->addExDate(ISOToQDate(*it));
1252 } 1258 }
1253 deleteStr(s); 1259 deleteStr(s);
1254 } 1260 }
1255 1261
1256 // summary 1262 // summary
1257 if ((vo = isAPropertyOf(vevent, VCSummaryProp))) { 1263 if ((vo = isAPropertyOf(vevent, VCSummaryProp))) {
1258 s = fakeCString(vObjectUStringZValue(vo)); 1264 s = fakeCString(vObjectUStringZValue(vo));
1259 anEvent->setSummary(QString::fromLocal8Bit(s)); 1265 anEvent->setSummary(QString::fromLocal8Bit(s));
1260 deleteStr(s); 1266 deleteStr(s);
1261 } 1267 }
1262 if ((vo = isAPropertyOf(vevent, VCLocationProp))) { 1268 if ((vo = isAPropertyOf(vevent, VCLocationProp))) {
1263 s = fakeCString(vObjectUStringZValue(vo)); 1269 s = fakeCString(vObjectUStringZValue(vo));
1264 anEvent->setLocation(QString::fromLocal8Bit(s)); 1270 anEvent->setLocation(QString::fromLocal8Bit(s));
1265 deleteStr(s); 1271 deleteStr(s);
1266 } 1272 }
1267 1273
1268 // description 1274 // description
1269 if ((vo = isAPropertyOf(vevent, VCDescriptionProp)) != 0) { 1275 if ((vo = isAPropertyOf(vevent, VCDescriptionProp)) != 0) {
1270 s = fakeCString(vObjectUStringZValue(vo)); 1276 s = fakeCString(vObjectUStringZValue(vo));
1271 if (!anEvent->description().isEmpty()) { 1277 if (!anEvent->description().isEmpty()) {
1272 anEvent->setDescription(anEvent->description() + "\n" + 1278 anEvent->setDescription(anEvent->description() + "\n" +
1273 QString::fromLocal8Bit(s)); 1279 QString::fromLocal8Bit(s));
1274 } else { 1280 } else {
1275 anEvent->setDescription(QString::fromLocal8Bit(s)); 1281 anEvent->setDescription(QString::fromLocal8Bit(s));
1276 } 1282 }
1277 deleteStr(s); 1283 deleteStr(s);
1278 } 1284 }
1279 1285
1280 // some stupid vCal exporters ignore the standard and use Description 1286 // some stupid vCal exporters ignore the standard and use Description
1281 // instead of Summary for the default field. Correct for this. 1287 // instead of Summary for the default field. Correct for this.
1282 if (anEvent->summary().isEmpty() && 1288 if (anEvent->summary().isEmpty() &&
1283 !(anEvent->description().isEmpty())) { 1289 !(anEvent->description().isEmpty())) {
1284 QString tmpStr = anEvent->description().simplifyWhiteSpace(); 1290 QString tmpStr = anEvent->description().simplifyWhiteSpace();
1285 anEvent->setDescription(""); 1291 anEvent->setDescription("");
1286 anEvent->setSummary(tmpStr); 1292 anEvent->setSummary(tmpStr);
1287 } 1293 }
1288 1294
1289#if 0 1295#if 0
1290 // status 1296 // status
1291 if ((vo = isAPropertyOf(vevent, VCStatusProp)) != 0) { 1297 if ((vo = isAPropertyOf(vevent, VCStatusProp)) != 0) {
1292 QString tmpStr(s = fakeCString(vObjectUStringZValue(vo))); 1298 QString tmpStr(s = fakeCString(vObjectUStringZValue(vo)));
1293 deleteStr(s); 1299 deleteStr(s);
1294// TODO: Define Event status 1300// TODO: Define Event status
1295// anEvent->setStatus(tmpStr); 1301// anEvent->setStatus(tmpStr);
1296 } 1302 }
1297 else 1303 else
1298// anEvent->setStatus("NEEDS ACTION"); 1304// anEvent->setStatus("NEEDS ACTION");
1299#endif 1305#endif
1300 1306
1301 // secrecy 1307 // secrecy
1302 int secrecy = Incidence::SecrecyPublic; 1308 int secrecy = Incidence::SecrecyPublic;
1303 if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { 1309 if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) {
1304 s = fakeCString(vObjectUStringZValue(vo)); 1310 s = fakeCString(vObjectUStringZValue(vo));
@@ -1475,134 +1481,135 @@ QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr)
1475 tmpDate.setYMD(year, month, day); 1481 tmpDate.setYMD(year, month, day);
1476 tmpTime.setHMS(hour, minute, second); 1482 tmpTime.setHMS(hour, minute, second);
1477 1483
1478 ASSERT(tmpDate.isValid()); 1484 ASSERT(tmpDate.isValid());
1479 ASSERT(tmpTime.isValid()); 1485 ASSERT(tmpTime.isValid());
1480 QDateTime tmpDT(tmpDate, tmpTime); 1486 QDateTime tmpDT(tmpDate, tmpTime);
1481 // correct for GMT if string is in Zulu format 1487 // correct for GMT if string is in Zulu format
1482 if (dtStr.at(dtStr.length()-1) == 'Z') 1488 if (dtStr.at(dtStr.length()-1) == 'Z')
1483 tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60); 1489 tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60);
1484 return tmpDT; 1490 return tmpDT;
1485} 1491}
1486 1492
1487QDate VCalFormat::ISOToQDate(const QString &dateStr) 1493QDate VCalFormat::ISOToQDate(const QString &dateStr)
1488{ 1494{
1489 int year, month, day; 1495 int year, month, day;
1490 1496
1491 year = dateStr.left(4).toInt(); 1497 year = dateStr.left(4).toInt();
1492 month = dateStr.mid(4,2).toInt(); 1498 month = dateStr.mid(4,2).toInt();
1493 day = dateStr.mid(6,2).toInt(); 1499 day = dateStr.mid(6,2).toInt();
1494 1500
1495 return(QDate(year, month, day)); 1501 return(QDate(year, month, day));
1496} 1502}
1497 1503
1498// take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc. 1504// take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc.
1499// and break it down from it's tree-like format into the dictionary format 1505// and break it down from it's tree-like format into the dictionary format
1500// that is used internally in the VCalFormat. 1506// that is used internally in the VCalFormat.
1501void VCalFormat::populate(VObject *vcal) 1507void VCalFormat::populate(VObject *vcal)
1502{ 1508{
1503 // this function will populate the caldict dictionary and other event 1509 // this function will populate the caldict dictionary and other event
1504 // lists. It turns vevents into Events and then inserts them. 1510 // lists. It turns vevents into Events and then inserts them.
1505 1511
1506 VObjectIterator i; 1512 VObjectIterator i;
1507 VObject *curVO, *curVOProp; 1513 VObject *curVO, *curVOProp;
1508 Event *anEvent; 1514 Event *anEvent;
1509 1515
1510 if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) { 1516 if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) {
1511 char *methodType = 0; 1517 char *methodType = 0;
1512 methodType = fakeCString(vObjectUStringZValue(curVO)); 1518 methodType = fakeCString(vObjectUStringZValue(curVO));
1513 kdDebug() << "This calendar is an iTIP transaction of type '" 1519 kdDebug() << "This calendar is an iTIP transaction of type '"
1514 << methodType << "'" << endl; 1520 << methodType << "'" << endl;
1515 delete methodType; 1521 delete methodType;
1516 } 1522 }
1517 1523
1518 // warn the user that we might have trouble reading non-known calendar. 1524 // warn the user that we might have trouble reading non-known calendar.
1519 if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != 0) { 1525 if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) != 0) {
1520 char *s = fakeCString(vObjectUStringZValue(curVO)); 1526 char *s = fakeCString(vObjectUStringZValue(curVO));
1521 if (strcmp(productId().local8Bit(), s) != 0) 1527 if (strcmp(productId().local8Bit(), s) != 0)
1522 kdDebug() << "This vCalendar file was not created by KOrganizer " 1528 kdDebug() << "This vCalendar file was not created by KOrganizer "
1523 "or any other product we support. Loading anyway..." << endl; 1529 "or any other product we support. Loading anyway..." << endl;
1524 mLoadedProductId = s; 1530 mLoadedProductId = s;
1525 deleteStr(s); 1531 deleteStr(s);
1526 } 1532 }
1527 1533
1528 // warn the user we might have trouble reading this unknown version. 1534 // warn the user we might have trouble reading this unknown version.
1529 if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { 1535 if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) {
1530 char *s = fakeCString(vObjectUStringZValue(curVO)); 1536 char *s = fakeCString(vObjectUStringZValue(curVO));
1531 if (strcmp(_VCAL_VERSION, s) != 0) 1537 if (strcmp(_VCAL_VERSION, s) != 0)
1532 kdDebug() << "This vCalendar file has version " << s 1538 kdDebug() << "This vCalendar file has version " << s
1533 << "We only support " << _VCAL_VERSION << endl; 1539 << "We only support " << _VCAL_VERSION << endl;
1534 deleteStr(s); 1540 deleteStr(s);
1535 } 1541 }
1536 1542
1537 // set the time zone 1543 // set the time zone
1538 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { 1544 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) {
1539 char *s = fakeCString(vObjectUStringZValue(curVO)); 1545 if ( vObjectUStringZValue(curVO) != 0 ) {
1540 mCalendar->setTimeZone(s); 1546 char *s = fakeCString(vObjectUStringZValue(curVO));
1541 deleteStr(s); 1547 mCalendar->setTimeZone(s);
1548 deleteStr(s);
1549 }
1542 } 1550 }
1543 1551
1544
1545 // Store all events with a relatedTo property in a list for post-processing 1552 // Store all events with a relatedTo property in a list for post-processing
1546 mEventsRelate.clear(); 1553 mEventsRelate.clear();
1547 mTodosRelate.clear(); 1554 mTodosRelate.clear();
1548 1555
1549 initPropIterator(&i, vcal); 1556 initPropIterator(&i, vcal);
1550 1557
1551 // go through all the vobjects in the vcal 1558 // go through all the vobjects in the vcal
1552 while (moreIteration(&i)) { 1559 while (moreIteration(&i)) {
1553 curVO = nextVObject(&i); 1560 curVO = nextVObject(&i);
1554 1561
1555 /************************************************************************/ 1562 /************************************************************************/
1556 1563
1557 // now, check to see that the object is an event or todo. 1564 // now, check to see that the object is an event or todo.
1558 if (strcmp(vObjectName(curVO), VCEventProp) == 0) { 1565 if (strcmp(vObjectName(curVO), VCEventProp) == 0) {
1559 1566
1560 if ((curVOProp = isAPropertyOf(curVO, XPilotStatusProp)) != 0) { 1567 if ((curVOProp = isAPropertyOf(curVO, XPilotStatusProp)) != 0) {
1561 char *s; 1568 char *s;
1562 s = fakeCString(vObjectUStringZValue(curVOProp)); 1569 s = fakeCString(vObjectUStringZValue(curVOProp));
1563 // check to see if event was deleted by the kpilot conduit 1570 // check to see if event was deleted by the kpilot conduit
1564 if (atoi(s) == Event::SYNCDEL) { 1571 if (atoi(s) == Event::SYNCDEL) {
1565 deleteStr(s); 1572 deleteStr(s);
1566 kdDebug(5800) << "skipping pilot-deleted event" << endl; 1573 kdDebug(5800) << "skipping pilot-deleted event" << endl;
1567 goto SKIP; 1574 goto SKIP;
1568 } 1575 }
1569 deleteStr(s); 1576 deleteStr(s);
1570 } 1577 }
1571 1578
1572 // this code checks to see if we are trying to read in an event 1579 // this code checks to see if we are trying to read in an event
1573 // that we already find to be in the calendar. If we find this 1580 // that we already find to be in the calendar. If we find this
1574 // to be the case, we skip the event. 1581 // to be the case, we skip the event.
1575 if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { 1582 if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) {
1576 char *s = fakeCString(vObjectUStringZValue(curVOProp)); 1583 char *s = fakeCString(vObjectUStringZValue(curVOProp));
1577 QString tmpStr(s); 1584 QString tmpStr(s);
1578 deleteStr(s); 1585 deleteStr(s);
1579 1586
1580 if (mCalendar->event(tmpStr)) { 1587 if (mCalendar->event(tmpStr)) {
1581 goto SKIP; 1588 goto SKIP;
1582 } 1589 }
1583 if (mCalendar->todo(tmpStr)) { 1590 if (mCalendar->todo(tmpStr)) {
1584 goto SKIP; 1591 goto SKIP;
1585 } 1592 }
1586 } 1593 }
1587 1594
1588 if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && 1595 if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) &&
1589 (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { 1596 (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) {
1590 kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; 1597 kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl;
1591 goto SKIP; 1598 goto SKIP;
1592 } 1599 }
1593 1600
1594 anEvent = VEventToEvent(curVO); 1601 anEvent = VEventToEvent(curVO);
1595 // we now use addEvent instead of insertEvent so that the 1602 // we now use addEvent instead of insertEvent so that the
1596 // signal/slot get connected. 1603 // signal/slot get connected.
1597 if (anEvent) { 1604 if (anEvent) {
1598 if ( !anEvent->dtStart().isValid() || !anEvent->dtEnd().isValid() ) { 1605 if ( !anEvent->dtStart().isValid() || !anEvent->dtEnd().isValid() ) {
1599 kdDebug() << "VCalFormat::populate(): Event has invalid dates." 1606 kdDebug() << "VCalFormat::populate(): Event has invalid dates."
1600 << endl; 1607 << endl;
1601 } else { 1608 } else {
1602 mCalendar->addEvent(anEvent); 1609 mCalendar->addEvent(anEvent);
1603 } 1610 }
1604 } else { 1611 } else {
1605 // some sort of error must have occurred while in translation. 1612 // some sort of error must have occurred while in translation.
1606 goto SKIP; 1613 goto SKIP;
1607 } 1614 }
1608 } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { 1615 } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) {
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index 8298aa6..e24ad9e 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -1,173 +1,216 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 4 Copyright (c) 2004 Lutz Rogowski <rogowski@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 22
23#include <qstring.h> 23#include <qstring.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qlabel.h>
28#include <qtextstream.h> 29#include <qtextstream.h>
29#include <qtextcodec.h> 30#include <qtextcodec.h>
30#include <qdir.h> 31#include <qdir.h>
31#include <kmessagebox.h> 32#include <kmessagebox.h>
32#include <stdlib.h> 33#include <stdlib.h>
33#include "phoneaccess.h" 34#include "phoneaccess.h"
34 35
35void PhoneAccess::writeConfig( QString device, QString connection, QString model ) 36void PhoneAccess::writeConfig( QString device, QString connection, QString model )
36{ 37{
37#ifdef _WIN32_ 38#ifdef _WIN32_
38 QString fileName = qApp->applicationDirPath () +"\\gammurc"; 39 QString fileName = qApp->applicationDirPath () +"\\gammurc";
39#else 40#else
40 QString fileName = QDir::homeDirPath() +"/.gammurc"; 41 QString fileName = QDir::homeDirPath() +"/.gammurc";
41#endif 42#endif
42 //qDebug("save %d ", load ); 43 //qDebug("save %d ", load );
43 QString content = "[gammu]\n";; 44 QString content = "[gammu]\n";;
44 bool write = false; 45 bool write = false;
45 bool addPort = true, addConnection = true, addModel = true; 46 bool addPort = true, addConnection = true, addModel = true;
46 QFile file( fileName ); 47 QFile file( fileName );
47 if ( QFile::exists( fileName) ) { 48 if ( QFile::exists( fileName) ) {
48 if (!file.open( IO_ReadOnly ) ) { 49 if (!file.open( IO_ReadOnly ) ) {
49 qDebug("Error: cannot open %s ", fileName.latin1() ); 50 qDebug("Error: cannot open %s ", fileName.latin1() );
50 return; 51 return;
51 } 52 }
52 QString line; 53 QString line;
53 while ( file.readLine( line, 1024 ) > 0 ) { 54 while ( file.readLine( line, 1024 ) > 0 ) {
54 //qDebug("*%s* ", line.latin1() ); 55 //qDebug("*%s* ", line.latin1() );
55 if ( line.left(7 ) == "[gammu]" ) { 56 if ( line.left(7 ) == "[gammu]" ) {
56 ; 57 ;
57 } else 58 } else
58 if ( line.left(4 ) == "port" ) { 59 if ( line.left(4 ) == "port" ) {
59 if ( line == "port = " + device+"\n" ) { 60 if ( line == "port = " + device+"\n" ) {
60 content += line ; 61 content += line ;
61 addPort = false; 62 addPort = false;
62 //qDebug("port found" ); 63 //qDebug("port found" );
63 } 64 }
64 65
65 } else if ( line.left(5 ) == "model" ) { 66 } else if ( line.left(5 ) == "model" ) {
66 if ( line == "model = " + model +"\n") { 67 if ( line == "model = " + model +"\n") {
67 content += line ; 68 content += line ;
68 addModel = false; 69 addModel = false;
69 //qDebug("model found" ); 70 //qDebug("model found" );
70 } 71 }
71 72
72 } else if ( line.left( 10 ) == "connection" ) { 73 } else if ( line.left( 10 ) == "connection" ) {
73 if ( line == "connection = " + connection +"\n") { 74 if ( line == "connection = " + connection +"\n") {
74 addConnection = false; 75 addConnection = false;
75 content += line ; 76 content += line ;
76 //qDebug("con found" ); 77 //qDebug("con found" );
77 } 78 }
78 79
79 } else { 80 } else {
80 content += line ; 81 content += line ;
81 } 82 }
82 } 83 }
83 file.close(); 84 file.close();
84 } else { 85 } else {
85 if ( ! connection.isEmpty() ) { 86 if ( ! connection.isEmpty() ) {
86 addConnection = true; 87 addConnection = true;
87 } 88 }
88 if ( ! device.isEmpty() ) { 89 if ( ! device.isEmpty() ) {
89 addPort = true; 90 addPort = true;
90 91
91 } 92 }
92 if ( ! model.isEmpty() ) { 93 if ( ! model.isEmpty() ) {
93 addModel = true; 94 addModel = true;
94 } 95 }
95 } 96 }
96 97
97 if ( addConnection ) { 98 if ( addConnection ) {
98 write = true; 99 write = true;
99 content += "connection = "; 100 content += "connection = ";
100 content += connection; 101 content += connection;
101 content += "\n"; 102 content += "\n";
102 } 103 }
103 if ( addPort ) { 104 if ( addPort ) {
104 write = true; 105 write = true;
105 content += "port = "; 106 content += "port = ";
106 content += device; 107 content += device;
107 content += "\n"; 108 content += "\n";
108 109
109 } 110 }
110 if ( addModel ) { 111 if ( addModel ) {
111 write = true; 112 write = true;
112 content += "model = "; 113 content += "model = ";
113 content += model; 114 content += model;
114 content += "\n"; 115 content += "\n";
115 } 116 }
116 if ( write ) { 117 if ( write ) {
117 if (!file.open( IO_WriteOnly ) ) { 118 if (!file.open( IO_WriteOnly ) ) {
118 qDebug("Error: cannot write file %s ", fileName.latin1() ); 119 qDebug("Error: cannot write file %s ", fileName.latin1() );
119 return; 120 return;
120 } 121 }
121 qDebug("Writing file %s ", fileName.latin1() ); 122 qDebug("Writing file %s ", fileName.latin1() );
122 QTextStream ts( &file ); 123 QTextStream ts( &file );
123 ts << content ; 124 ts << content ;
124 file.close(); 125 file.close();
125 } 126 }
126 127
127} 128}
128 129
129 130
130bool PhoneAccess::writeToPhone( QString fileName) 131bool PhoneAccess::writeToPhone( QString fileName)
131{ 132{
132 133
133#ifdef DESKTOP_VERSION 134#ifdef DESKTOP_VERSION
134#ifdef _WIN32_ 135#ifdef _WIN32_
135 QString command ="kammu --restore " + fileName ; 136 QString command ="kammu --restore " + fileName ;
136#else 137#else
137 QString command ="./kammu --restore " + fileName ; 138 QString command ="./kammu --restore " + fileName ;
138#endif 139#endif
139#else 140#else
140 QString command ="kammu --restore " + fileName ; 141 QString command ="kammu --restore " + fileName ;
141#endif 142#endif
142 int ret; 143 int ret = 1;
143 while ( (ret = system ( command.latin1())) != 0 ) { 144 while ( ret != 0 ) {
144 qDebug("Error S::command returned %d.", ret); 145 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
145 int retval = KMessageBox::warningContinueCancel(0, 146 int w = 235;
146 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 147 int h = status->sizeHint().height()+20 ;
147 if ( retval != KMessageBox::Continue ) 148 int dw = QApplication::desktop()->width();
148 return false; 149 int dh = QApplication::desktop()->height();
150 if ( dw > 310 )
151 w = 310;
152 status->setCaption(i18n("Writing to phone...") );
153 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
154 status->show();
155 status->raise();
156 status->update();
157 qApp->processEvents();
158 status->update();
159 qApp->processEvents();
160 ret = system ( command.latin1());
161 delete status;
162 qApp->processEvents();
163 if ( ret ) {
164 qDebug("Error S::command returned %d.", ret);
165 int retval = KMessageBox::warningContinueCancel(0,
166 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
167 if ( retval != KMessageBox::Continue )
168 return false;
169 }
149 } 170 }
150 return true; 171 return true;
151} 172}
152bool PhoneAccess::readFromPhone( QString fileName) 173bool PhoneAccess::readFromPhone( QString fileName)
153{ 174{
154 175
155#ifdef DESKTOP_VERSION 176#ifdef DESKTOP_VERSION
156#ifdef _WIN32_ 177#ifdef _WIN32_
157 QString command ="kammu --backup " + fileName + " -yes" ; 178 QString command ="kammu --backup " + fileName + " -yes" ;
158#else 179#else
159 QString command ="./kammu --backup " + fileName + " -yes" ; 180 QString command ="./kammu --backup " + fileName + " -yes" ;
160#endif 181#endif
161#else 182#else
162 QString command ="kammu --backup " + fileName + " -yes" ; 183 QString command ="kammu --backup " + fileName + " -yes" ;
163#endif 184#endif
164 int ret; 185 int ret;
165 while ( (ret = system ( command.latin1())) != 0 ) { 186 while ( ret != 0 ) {
166 qDebug("Error reading from phone:Command returned %d", ret); 187 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
167 int retval = KMessageBox::warningContinueCancel(0, 188 int w = 235;
168 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 189 int h = status->sizeHint().height()+20 ;
169 if ( retval != KMessageBox::Continue ) 190 int dw = QApplication::desktop()->width();
170 return false; 191 int dh = QApplication::desktop()->height();
192 if ( dw > 310 )
193 w = 310;
194 status->setCaption(i18n("Reading from phone...") );
195 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
196 status->show();
197 status->raise();
198 status->update();
199 qApp->processEvents();
200 status->update();
201 qApp->processEvents();
202 ret = system ( command.latin1() );
203 delete status;
204 qApp->processEvents();
205 if ( ret ) {
206 qDebug("Error reading from phone:Command returned %d", ret);
207 int retval = KMessageBox::warningContinueCancel(0,
208 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
209 if ( retval != KMessageBox::Continue )
210 return false;
211
212 }
171 } 213 }
214 qApp->processEvents();
172 return true; 215 return true;
173} 216}
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 71d662b..21da158 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -20,157 +20,155 @@ MOC_DIR = moc/win
20include( ../variables.pri ) 20include( ../variables.pri )
21 21
22 22
23 23
24HEADERS = \ 24HEADERS = \
25qlayoutengine_p.h \ 25qlayoutengine_p.h \
26KDGanttMinimizeSplitter.h \ 26KDGanttMinimizeSplitter.h \
27 kapplication.h \ 27 kapplication.h \
28 kaudioplayer.h \ 28 kaudioplayer.h \
29 kcalendarsystem.h \ 29 kcalendarsystem.h \
30 kcalendarsystemgregorian.h \ 30 kcalendarsystemgregorian.h \
31 kcolorbutton.h \ 31 kcolorbutton.h \
32 kcolordialog.h \ 32 kcolordialog.h \
33 kcombobox.h \ 33 kcombobox.h \
34 kconfig.h \ 34 kconfig.h \
35 kdatetbl.h \ 35 kdatetbl.h \
36 kdebug.h \ 36 kdebug.h \
37 kdialog.h \ 37 kdialog.h \
38 kdialogbase.h \ 38 kdialogbase.h \
39 keditlistbox.h \ 39 keditlistbox.h \
40 kemailsettings.h \ 40 kemailsettings.h \
41 kfiledialog.h \ 41 kfiledialog.h \
42 kfontdialog.h \ 42 kfontdialog.h \
43 kglobal.h \ 43 kglobal.h \
44 kglobalsettings.h \ 44 kglobalsettings.h \
45 kiconloader.h \ 45 kiconloader.h \
46 klineedit.h \ 46 klineedit.h \
47 klineeditdlg.h \ 47 klineeditdlg.h \
48 kmessagebox.h \ 48 kmessagebox.h \
49 knotifyclient.h \ 49 knotifyclient.h \
50 kprinter.h \ 50 kprinter.h \
51 kprocess.h \ 51 kprocess.h \
52 krestrictedline.h \ 52 krestrictedline.h \
53 krun.h \ 53 krun.h \
54 ksimpleconfig.h \ 54 ksimpleconfig.h \
55 kstaticdeleter.h \ 55 kstaticdeleter.h \
56 ksystemtray.h \ 56 ksystemtray.h \
57 ktempfile.h \ 57 ktempfile.h \
58 ktextedit.h \ 58 ktextedit.h \
59 kunload.h \ 59 kunload.h \
60 kurl.h \ 60 kurl.h \
61 kdeui/kguiitem.h \ 61 kdeui/kguiitem.h \
62 kdeui/kcmodule.h \ 62 kdeui/kcmodule.h \
63 kdeui/kbuttonbox.h \ 63 kdeui/kbuttonbox.h \
64 kdeui/klistbox.h \ 64 kdeui/klistbox.h \
65 kdeui/klistview.h \ 65 kdeui/klistview.h \
66 kdeui/kjanuswidget.h \ 66 kdeui/kjanuswidget.h \
67 kdeui/kseparator.h \ 67 kdeui/kseparator.h \
68 kdeui/knuminput.h \ 68 kdeui/knuminput.h \
69 kdeui/knumvalidator.h \ 69 kdeui/knumvalidator.h \
70 kdeui/ksqueezedtextlabel.h \ 70 kdeui/ksqueezedtextlabel.h \
71 kio/job.h \ 71 kio/job.h \
72 kio/kio/kdirwatch.h \ 72 kio/kio/kdirwatch.h \
73 kio/kio/kdirwatch_p.h \ 73 kio/kio/kdirwatch_p.h \
74 kio/kfile/kurlrequester.h \ 74 kio/kfile/kurlrequester.h \
75 kresources/resource.h \ 75 kresources/resource.h \
76 kresources/factory.h \ 76 kresources/factory.h \
77 kresources/managerimpl.h \ 77 kresources/managerimpl.h \
78 kresources/manager.h \ 78 kresources/manager.h \
79 kresources/selectdialog.h \ 79 kresources/selectdialog.h \
80 kresources/configpage.h \ 80 kresources/configpage.h \
81 kresources/configwidget.h \ 81 kresources/configwidget.h \
82 kresources/configdialog.h \ 82 kresources/configdialog.h \
83 kresources/kcmkresources.h \ 83 kresources/kcmkresources.h \
84 kresources/syncwidget.h \
85 kdecore/kmdcodec.h \ 84 kdecore/kmdcodec.h \
86 kdecore/kconfigbase.h \ 85 kdecore/kconfigbase.h \
87 kdecore/klocale.h \ 86 kdecore/klocale.h \
88 kdecore/kcatalogue.h \ 87 kdecore/kcatalogue.h \
89 kdecore/ksharedptr.h \ 88 kdecore/ksharedptr.h \
90 kdecore/kshell.h \ 89 kdecore/kshell.h \
91 kdecore/kstandarddirs.h \ 90 kdecore/kstandarddirs.h \
92 kdecore/kstringhandler.h \ 91 kdecore/kstringhandler.h \
93 kdecore/kshortcut.h \ 92 kdecore/kshortcut.h \
94 kutils/kcmultidialog.h \ 93 kutils/kcmultidialog.h \
95 kdeui/kxmlguiclient.h \ 94 kdeui/kxmlguiclient.h \
96 kdeui/kstdaction.h \ 95 kdeui/kstdaction.h \
97 kdeui/kmainwindow.h \ 96 kdeui/kmainwindow.h \
98 kdeui/ktoolbar.h \ 97 kdeui/ktoolbar.h \
99 kdeui/ktoolbarbutton.h \ 98 kdeui/ktoolbarbutton.h \
100 kdeui/ktoolbarhandler.h \ 99 kdeui/ktoolbarhandler.h \
101 kdeui/kaction.h \ 100 kdeui/kaction.h \
102 kdeui/kactionclasses.h \ 101 kdeui/kactionclasses.h \
103 kdeui/kactioncollection.h \ 102 kdeui/kactioncollection.h \
104 kdecore/kprefs.h \ 103 kdecore/kprefs.h \
105 kdecore/klibloader.h \ 104 kdecore/klibloader.h \
106 kidmanager.h 105 kidmanager.h
107 106
108 107
109# kdecore/klibloader.h \ 108# kdecore/klibloader.h \
110 109
111 110
112SOURCES = \ 111SOURCES = \
113KDGanttMinimizeSplitter.cpp \ 112KDGanttMinimizeSplitter.cpp \
114 kapplication.cpp \ 113 kapplication.cpp \
115 kcalendarsystem.cpp \ 114 kcalendarsystem.cpp \
116 kcalendarsystemgregorian.cpp \ 115 kcalendarsystemgregorian.cpp \
117 kcolorbutton.cpp \ 116 kcolorbutton.cpp \
118 kcolordialog.cpp \ 117 kcolordialog.cpp \
119 kconfig.cpp \ 118 kconfig.cpp \
120 kdatetbl.cpp \ 119 kdatetbl.cpp \
121 kdialog.cpp \ 120 kdialog.cpp \
122 kdialogbase.cpp \ 121 kdialogbase.cpp \
123 keditlistbox.cpp \ 122 keditlistbox.cpp \
124 kemailsettings.cpp \ 123 kemailsettings.cpp \
125 kfontdialog.cpp \ 124 kfontdialog.cpp \
126 kfiledialog.cpp \ 125 kfiledialog.cpp \
127 kglobal.cpp \ 126 kglobal.cpp \
128 kglobalsettings.cpp \ 127 kglobalsettings.cpp \
129 kiconloader.cpp \ 128 kiconloader.cpp \
130 kmessagebox.cpp \ 129 kmessagebox.cpp \
131 ktextedit.cpp \ 130 ktextedit.cpp \
132 kprocess.cpp \ 131 kprocess.cpp \
133 krun.cpp \ 132 krun.cpp \
134 ksystemtray.cpp \ 133 ksystemtray.cpp \
135 ktempfile.cpp \ 134 ktempfile.cpp \
136 kurl.cpp \ 135 kurl.cpp \
137 kdecore/kcatalogue.cpp \ 136 kdecore/kcatalogue.cpp \
138 kdecore/klocale.cpp \ 137 kdecore/klocale.cpp \
139 kdecore/kmdcodec.cpp \ 138 kdecore/kmdcodec.cpp \
140 kdecore/kshell.cpp \ 139 kdecore/kshell.cpp \
141 kdecore/kstandarddirs.cpp \ 140 kdecore/kstandarddirs.cpp \
142 kdecore/kstringhandler.cpp \ 141 kdecore/kstringhandler.cpp \
143 kdeui/kbuttonbox.cpp \ 142 kdeui/kbuttonbox.cpp \
144 kdeui/kcmodule.cpp \ 143 kdeui/kcmodule.cpp \
145 kdeui/kguiitem.cpp \ 144 kdeui/kguiitem.cpp \
146 kdeui/kjanuswidget.cpp \ 145 kdeui/kjanuswidget.cpp \
147 kdeui/klistbox.cpp \ 146 kdeui/klistbox.cpp \
148 kdeui/klistview.cpp \ 147 kdeui/klistview.cpp \
149 kdeui/knuminput.cpp \ 148 kdeui/knuminput.cpp \
150 kdeui/knumvalidator.cpp \ 149 kdeui/knumvalidator.cpp \
151 kdeui/kseparator.cpp \ 150 kdeui/kseparator.cpp \
152 kdeui/ksqueezedtextlabel.cpp \ 151 kdeui/ksqueezedtextlabel.cpp \
153 kio/kio/kdirwatch.cpp \ 152 kio/kio/kdirwatch.cpp \
154 kio/kfile/kurlrequester.cpp \ 153 kio/kfile/kurlrequester.cpp \
155 kresources/configpage.cpp \ 154 kresources/configpage.cpp \
156 kresources/configdialog.cpp \ 155 kresources/configdialog.cpp \
157 kresources/configwidget.cpp \ 156 kresources/configwidget.cpp \
158 kresources/factory.cpp \ 157 kresources/factory.cpp \
159 kresources/kcmkresources.cpp \ 158 kresources/kcmkresources.cpp \
160 kresources/managerimpl.cpp \ 159 kresources/managerimpl.cpp \
161 kresources/resource.cpp \ 160 kresources/resource.cpp \
162 kresources/selectdialog.cpp \ 161 kresources/selectdialog.cpp \
163 kresources/syncwidget.cpp \
164 kutils/kcmultidialog.cpp \ 162 kutils/kcmultidialog.cpp \
165 kdeui/kaction.cpp \ 163 kdeui/kaction.cpp \
166 kdeui/kactionclasses.cpp \ 164 kdeui/kactionclasses.cpp \
167 kdeui/kactioncollection.cpp \ 165 kdeui/kactioncollection.cpp \
168 kdeui/kmainwindow.cpp \ 166 kdeui/kmainwindow.cpp \
169 kdeui/ktoolbar.cpp \ 167 kdeui/ktoolbar.cpp \
170 kdeui/ktoolbarbutton.cpp \ 168 kdeui/ktoolbarbutton.cpp \
171 kdeui/ktoolbarhandler.cpp \ 169 kdeui/ktoolbarhandler.cpp \
172 kdeui/kstdaction.cpp \ 170 kdeui/kstdaction.cpp \
173 kdeui/kxmlguiclient.cpp \ 171 kdeui/kxmlguiclient.cpp \
174 kdecore/kprefs.cpp \ 172 kdecore/kprefs.cpp \
175 kdecore/klibloader.cpp \ 173 kdecore/klibloader.cpp \
176 kidmanager.cpp 174 kidmanager.cpp
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index cf6074d..fd5f965 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -1,86 +1,88 @@
1#include <qcombobox.h> 1#include <qcombobox.h>
2#include <qdir.h> 2#include <qdir.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qlistview.h> 8#include <qlistview.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qregexp.h> 11#include <qregexp.h>
12#include <qobjectlist.h> 12#include <qobjectlist.h>
13 13
14/* hacky but we need to get FileSelector::filter */ 14/* hacky but we need to get FileSelector::filter */
15#define private public 15#define private public
16#include <qpe/fileselector.h> 16#include <qpe/fileselector.h>
17#undef private 17#undef private
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/mimetype.h> 20#include <qpe/mimetype.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/storage.h> 22#include <qpe/storage.h>
23#include <kglobal.h>
24#include <klocale.h>
23 25
24#include "ofileselector_p.h" 26#include "ofileselector_p.h"
25//US#include "ofileselector.h" 27//US#include "ofileselector.h"
26 28
27#include "klocale.h" 29#include "klocale.h"
28 30
29OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 31OFileViewInterface::OFileViewInterface( OFileSelector* selector )
30 : m_selector( selector ) { 32 : m_selector( selector ) {
31} 33}
32OFileViewInterface::~OFileViewInterface() { 34OFileViewInterface::~OFileViewInterface() {
33} 35}
34QString OFileViewInterface::name()const{ 36QString OFileViewInterface::name()const{
35 return m_name; 37 return m_name;
36} 38}
37void OFileViewInterface::setName( const QString& name ) { 39void OFileViewInterface::setName( const QString& name ) {
38 m_name = name; 40 m_name = name;
39} 41}
40OFileSelector* OFileViewInterface::selector()const { 42OFileSelector* OFileViewInterface::selector()const {
41 return m_selector; 43 return m_selector;
42} 44}
43 45
44DocLnk OFileViewInterface::selectedDocument()const { 46DocLnk OFileViewInterface::selectedDocument()const {
45 return DocLnk( selectedName() ); 47 return DocLnk( selectedName() );
46} 48}
47 49
48bool OFileViewInterface::showNew()const { 50bool OFileViewInterface::showNew()const {
49 return selector()->showNew(); 51 return selector()->showNew();
50} 52}
51bool OFileViewInterface::showClose()const { 53bool OFileViewInterface::showClose()const {
52 return selector()->showClose(); 54 return selector()->showClose();
53} 55}
54MimeTypes OFileViewInterface::mimeTypes()const { 56MimeTypes OFileViewInterface::mimeTypes()const {
55 return selector()->mimeTypes(); 57 return selector()->mimeTypes();
56} 58}
57QStringList OFileViewInterface::currentMimeType()const { 59QStringList OFileViewInterface::currentMimeType()const {
58 return selector()->currentMimeType(); 60 return selector()->currentMimeType();
59} 61}
60void OFileViewInterface::activate( const QString& ) { 62void OFileViewInterface::activate( const QString& ) {
61 // not implemented here 63 // not implemented here
62} 64}
63void OFileViewInterface::ok() { 65void OFileViewInterface::ok() {
64 emit selector()->ok(); 66 emit selector()->ok();
65} 67}
66void OFileViewInterface::cancel() { 68void OFileViewInterface::cancel() {
67 emit selector()->cancel(); 69 emit selector()->cancel();
68} 70}
69void OFileViewInterface::closeMe() { 71void OFileViewInterface::closeMe() {
70 emit selector()->closeMe(); 72 emit selector()->closeMe();
71} 73}
72void OFileViewInterface::fileSelected( const QString& str) { 74void OFileViewInterface::fileSelected( const QString& str) {
73 emit selector()->fileSelected( str); 75 emit selector()->fileSelected( str);
74} 76}
75void OFileViewInterface::fileSelected( const DocLnk& lnk) { 77void OFileViewInterface::fileSelected( const DocLnk& lnk) {
76 emit selector()->fileSelected( lnk ); 78 emit selector()->fileSelected( lnk );
77} 79}
78void OFileViewInterface::setCurrentFileName( const QString& str ) { 80void OFileViewInterface::setCurrentFileName( const QString& str ) {
79 selector()->m_lneEdit->setText( str ); 81 selector()->m_lneEdit->setText( str );
80} 82}
81QString OFileViewInterface::currentFileName()const{ 83QString OFileViewInterface::currentFileName()const{
82 return selector()->m_lneEdit->text(); 84 return selector()->m_lneEdit->text();
83} 85}
84QString OFileViewInterface::startDirectory()const{ 86QString OFileViewInterface::startDirectory()const{
85 return selector()->m_startDir; 87 return selector()->m_startDir;
86} 88}
@@ -406,149 +408,150 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
406#if 0 408#if 0
407 409
408 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 410 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
409 411
410 if (!sel->isDir() ) { 412 if (!sel->isDir() ) {
411 selector()->m_lneEdit->setText( sel->text(1) ); 413 selector()->m_lneEdit->setText( sel->text(1) );
412 // if in fileselector mode we will emit selected 414 // if in fileselector mode we will emit selected
413 if ( selector()->mode() == OFileSelector::FileSelector ) { 415 if ( selector()->mode() == OFileSelector::FileSelector ) {
414 qWarning("slot Current Changed"); 416 qWarning("slot Current Changed");
415 QStringList str = QStringList::split("->", sel->text(1) ); 417 QStringList str = QStringList::split("->", sel->text(1) );
416 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 418 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
417 emit selector()->fileSelected( path ); 419 emit selector()->fileSelected( path );
418 DocLnk lnk( path ); 420 DocLnk lnk( path );
419 emit selector()->fileSelected( lnk ); 421 emit selector()->fileSelected( lnk );
420 } 422 }
421 } 423 }
422#endif 424#endif
423} 425}
424void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { 426void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
425 if (!item || ( button != Qt::LeftButton) ) 427 if (!item || ( button != Qt::LeftButton) )
426 return; 428 return;
427 429
428 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 430 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
429 if (!sel->isLocked() ) { 431 if (!sel->isLocked() ) {
430 QStringList str = QStringList::split("->", sel->text(1) ); 432 QStringList str = QStringList::split("->", sel->text(1) );
431 if (sel->isDir() ) { 433 if (sel->isDir() ) {
432 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 434 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
433 emit selector()->dirSelected( m_currentDir ); 435 emit selector()->dirSelected( m_currentDir );
434 reread( m_all ); 436 reread( m_all );
435 }else { // file 437 }else { // file
436 qWarning("slot Clicked"); 438 qWarning("slot Clicked");
437 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 439 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
438 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 440 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
439 emit selector()->fileSelected( path ); 441 emit selector()->fileSelected( path );
440 DocLnk lnk( path ); 442 DocLnk lnk( path );
441 emit selector()->fileSelected( lnk ); 443 emit selector()->fileSelected( lnk );
442 } 444 }
443 } // not locked 445 } // not locked
444} 446}
445void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { 447void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
446 MimeType type( info->absFilePath() ); 448 MimeType type( info->absFilePath() );
447 if (!compliesMime( type.id() ) ) 449 if (!compliesMime( type.id() ) )
448 return; 450 return;
449 451
450 QPixmap pix = type.pixmap(); 452 QPixmap pix = type.pixmap();
451 QString dir, name; bool locked; 453 QString dir, name; bool locked;
452 if ( pix.isNull() ) { 454 if ( pix.isNull() ) {
453 QWMatrix matrix; 455 QWMatrix matrix;
454 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 456 QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
455 matrix.scale( .4, .4 ); 457 matrix.scale( .4, .4 );
456 pix = pixer.xForm( matrix ); 458 pix = pixer.xForm( matrix );
457 } 459 }
458 dir = info->dirPath( true ); 460 dir = info->dirPath( true );
459 locked = false; 461 locked = false;
460 if ( symlink ) 462 if ( symlink )
461 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 463 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
462 else{ 464 else{
463 name = info->fileName(); 465 name = info->fileName();
464 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 466 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
465 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { 467 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) {
466 locked = true; pix = Resource::loadPixmap("locked"); 468 locked = true; pix = Resource::loadPixmap("locked");
467 } 469 }
468 } 470 }
469 (void)new OFileSelectorItem( m_view, pix, name, 471 (void)new OFileSelectorItem( m_view, pix, name,
470 info->lastModified().toString(), QString::number( info->size() ), 472 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
473 QString::number( info->size() ),
471 dir, locked ); 474 dir, locked );
472} 475}
473void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { 476void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
474 bool locked = false; QString name; QPixmap pix; 477 bool locked = false; QString name; QPixmap pix;
475 478
476 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 479 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
477 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { 480 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) {
478 locked = true; 481 locked = true;
479 if ( symlink ) 482 if ( symlink )
480 pix = Resource::loadPixmap( "symlink" ); 483 pix = Resource::loadPixmap( "symlink" );
481 else 484 else
482 pix = Resource::loadPixmap( "lockedfolder" ); 485 pix = Resource::loadPixmap( "lockedfolder" );
483 }else 486 }else
484 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); 487 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder");
485 488
486 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 489 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() :
487 info->fileName(); 490 info->fileName();
488 491
489 (void)new OFileSelectorItem( m_view, pix, name, 492 (void)new OFileSelectorItem( m_view, pix, name,
490 info->lastModified().toString(), 493 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
491 QString::number( info->size() ), 494 QString::number( info->size() ),
492 info->dirPath( true ), locked, true ); 495 info->dirPath( true ), locked, true );
493 496
494 497
495} 498}
496void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { 499void OFileViewFileListView::addSymlink( QFileInfo* , bool ) {
497 500
498} 501}
499void OFileViewFileListView::cdUP() { 502void OFileViewFileListView::cdUP() {
500 QDir dir( m_currentDir ); 503 QDir dir( m_currentDir );
501 dir.cdUp(); 504 dir.cdUp();
502 505
503 if (!dir.exists() ) 506 if (!dir.exists() )
504 m_currentDir = "/"; 507 m_currentDir = "/";
505 else 508 else
506 m_currentDir = dir.absPath(); 509 m_currentDir = dir.absPath();
507 510
508 emit selector()->dirSelected( m_currentDir ); 511 emit selector()->dirSelected( m_currentDir );
509 reread( m_all ); 512 reread( m_all );
510} 513}
511void OFileViewFileListView::cdHome() { 514void OFileViewFileListView::cdHome() {
512 m_currentDir = QDir::homeDirPath(); 515 m_currentDir = QDir::homeDirPath();
513 emit selector()->dirSelected( m_currentDir ); 516 emit selector()->dirSelected( m_currentDir );
514 reread( m_all ); 517 reread( m_all );
515} 518}
516void OFileViewFileListView::cdDoc() { 519void OFileViewFileListView::cdDoc() {
517 m_currentDir = QPEApplication::documentDir(); 520 m_currentDir = QPEApplication::documentDir();
518 emit selector()->dirSelected( m_currentDir ); 521 emit selector()->dirSelected( m_currentDir );
519 reread( m_all ); 522 reread( m_all );
520} 523}
521void OFileViewFileListView::changeDir( const QString& dir ) { 524void OFileViewFileListView::changeDir( const QString& dir ) {
522 m_currentDir = dir; 525 m_currentDir = dir;
523 emit selector()->dirSelected( m_currentDir ); 526 emit selector()->dirSelected( m_currentDir );
524 reread( m_all ); 527 reread( m_all );
525} 528}
526void OFileViewFileListView::slotFSActivated( int id ) { 529void OFileViewFileListView::slotFSActivated( int id ) {
527 changeDir ( m_dev[m_fsPop->text(id)] ); 530 changeDir ( m_dev[m_fsPop->text(id)] );
528} 531}
529 532
530/* check if the mimetype in mime 533/* check if the mimetype in mime
531 * complies with the one which is current 534 * complies with the one which is current
532 */ 535 */
533/* 536/*
534 * We've the mimetype of the file 537 * We've the mimetype of the file
535 * We need to get the stringlist of the current mimetype 538 * We need to get the stringlist of the current mimetype
536 * 539 *
537 * mime = image@slashjpeg 540 * mime = image@slashjpeg
538 * QStringList = 'image@slash*' 541 * QStringList = 'image@slash*'
539 * or QStringList = image/jpeg;image/png;application/x-ogg 542 * or QStringList = image/jpeg;image/png;application/x-ogg
540 * or QStringList = application/x-ogg;image@slash*; 543 * or QStringList = application/x-ogg;image@slash*;
541 * with all these mime filters it should get acceptes 544 * with all these mime filters it should get acceptes
542 * to do so we need to look if mime is contained inside 545 * to do so we need to look if mime is contained inside
543 * the stringlist 546 * the stringlist
544 * if it's contained return true 547 * if it's contained return true
545 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' 548 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*'
546 * is contained in the mimefilter and then we will 549 * is contained in the mimefilter and then we will
547 * look if both are equal until the '/' 550 * look if both are equal until the '/'
548 */ 551 */
549bool OFileViewFileListView::compliesMime( const QString& str) { 552bool OFileViewFileListView::compliesMime( const QString& str) {
550 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) 553 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() )
551 return true; 554 return true;
552 555
553 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { 556 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) {
554 QRegExp reg( (*it) ); 557 QRegExp reg( (*it) );