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
@@ -90,158 +90,158 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
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 }
@@ -369,78 +369,84 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
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++;
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 2564894..40877ef 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -289,48 +289,49 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
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( ":" ));
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index d690acc..17ebff8 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -27,49 +27,48 @@ INTERFACES = \
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 \
@@ -139,49 +138,48 @@ vcard/include/generated/TextListValue-generated.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 \
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3e0a27d..e4a11f5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1109,94 +1109,96 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
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);
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index dfa265b..7256f05 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -35,48 +35,94 @@ Event::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
diff --git a/libkcal/event.h b/libkcal/event.h
index 2a8bd95..3bc8adc 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -50,39 +50,41 @@ class Event : public Incidence
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
@@ -291,341 +291,327 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
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)
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h
index 001fd81..d11f68b 100644
--- a/libkcal/phoneformat.h
+++ b/libkcal/phoneformat.h
@@ -33,30 +33,30 @@ namespace KCal {
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
@@ -35,49 +35,107 @@ Todo::Todo(): Incidence()
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() ) {
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 9aa92f8..0f22c59 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -78,44 +78,45 @@ class Todo : public Incidence
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
@@ -41,77 +41,79 @@
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();
@@ -1151,114 +1153,118 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
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));
@@ -1515,54 +1521,55 @@ void VCalFormat::populate(VObject *vcal)
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 }
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index 8298aa6..e24ad9e 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -4,48 +4,49 @@
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 }
@@ -118,56 +119,98 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model
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
@@ -60,49 +60,48 @@ KDGanttMinimizeSplitter.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
@@ -139,38 +138,37 @@ KDGanttMinimizeSplitter.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,46 +1,48 @@
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}
@@ -446,69 +448,70 @@ void 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 );