-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/gammu.c | 41 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 53 |
3 files changed, 80 insertions, 16 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c index 598292c..ddf9790 100644 --- a/gammu/emb/common/service/gsmcal.c +++ b/gammu/emb/common/service/gsmcal.c | |||
@@ -1,512 +1,512 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | 2 | ||
3 | #include <string.h> | 3 | #include <string.h> |
4 | 4 | ||
5 | #include "gsmcal.h" | 5 | #include "gsmcal.h" |
6 | #include "gsmmisc.h" | 6 | #include "gsmmisc.h" |
7 | #include "../misc/coding/coding.h" | 7 | #include "../misc/coding/coding.h" |
8 | 8 | ||
9 | bool IsCalendarNoteFromThePast(GSM_CalendarEntry *note) | 9 | bool IsCalendarNoteFromThePast(GSM_CalendarEntry *note) |
10 | { | 10 | { |
11 | bool Past = true; | 11 | bool Past = true; |
12 | int i; | 12 | int i; |
13 | GSM_DateTimeDT; | 13 | GSM_DateTimeDT; |
14 | 14 | ||
15 | GSM_GetCurrentDateTime (&DT); | 15 | GSM_GetCurrentDateTime (&DT); |
16 | for (i = 0; i < note->EntriesNum; i++) { | 16 | for (i = 0; i < note->EntriesNum; i++) { |
17 | switch (note->Entries[i].EntryType) { | 17 | switch (note->Entries[i].EntryType) { |
18 | case CAL_RECURRANCE: | 18 | case CAL_RECURRANCE: |
19 | Past = false; | 19 | Past = false; |
20 | break; | 20 | break; |
21 | case CAL_START_DATETIME : | 21 | case CAL_START_DATETIME : |
22 | if (note->Entries[i].Date.Year > DT.Year) Past = false; | 22 | if (note->Entries[i].Date.Year > DT.Year) Past = false; |
23 | if (note->Entries[i].Date.Year == DT.Year && | 23 | if (note->Entries[i].Date.Year == DT.Year && |
24 | note->Entries[i].Date.Month > DT.Month) Past = false; | 24 | note->Entries[i].Date.Month > DT.Month) Past = false; |
25 | if (note->Entries[i].Date.Year == DT.Year && | 25 | if (note->Entries[i].Date.Year == DT.Year && |
26 | note->Entries[i].Date.Month == DT.Month && | 26 | note->Entries[i].Date.Month == DT.Month && |
27 | note->Entries[i].Date.Day > DT.Day) Past = false; | 27 | note->Entries[i].Date.Day > DT.Day) Past = false; |
28 | break; | 28 | break; |
29 | default: | 29 | default: |
30 | break; | 30 | break; |
31 | } | 31 | } |
32 | if (!Past) break; | 32 | if (!Past) break; |
33 | } | 33 | } |
34 | switch (note->Type) { | 34 | switch (note->Type) { |
35 | case GSM_CAL_BIRTHDAY: | 35 | case GSM_CAL_BIRTHDAY: |
36 | Past = false; | 36 | Past = false; |
37 | break; | 37 | break; |
38 | default: | 38 | default: |
39 | break; | 39 | break; |
40 | } | 40 | } |
41 | return Past; | 41 | return Past; |
42 | } | 42 | } |
43 | 43 | ||
44 | void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *Recurrance, int *EndTime, int *Location) | 44 | void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *Recurrance, int *EndTime, int *Location) |
45 | { | 45 | { |
46 | int i; | 46 | int i; |
47 | 47 | ||
48 | *Text = -1; | 48 | *Text = -1; |
49 | *Time = -1; | 49 | *Time = -1; |
50 | *Alarm = -1; | 50 | *Alarm = -1; |
51 | *Phone = -1; | 51 | *Phone = -1; |
52 | *Recurrance= -1; | 52 | *Recurrance= -1; |
53 | *EndTime= -1; | 53 | *EndTime= -1; |
54 | *Location= -1; | 54 | *Location= -1; |
55 | for (i = 0; i < entry->EntriesNum; i++) { | 55 | for (i = 0; i < entry->EntriesNum; i++) { |
56 | switch (entry->Entries[i].EntryType) { | 56 | switch (entry->Entries[i].EntryType) { |
57 | case CAL_START_DATETIME : | 57 | case CAL_START_DATETIME : |
58 | if (*Time == -1) *Time = i; | 58 | if (*Time == -1) *Time = i; |
59 | break; | 59 | break; |
60 | case CAL_END_DATETIME : | 60 | case CAL_END_DATETIME : |
61 | if (*EndTime == -1) *EndTime = i; | 61 | if (*EndTime == -1) *EndTime = i; |
62 | break; | 62 | break; |
63 | case CAL_ALARM_DATETIME : | 63 | case CAL_ALARM_DATETIME : |
64 | case CAL_SILENT_ALARM_DATETIME: | 64 | case CAL_SILENT_ALARM_DATETIME: |
65 | if (*Alarm == -1) *Alarm = i; | 65 | if (*Alarm == -1) *Alarm = i; |
66 | break; | 66 | break; |
67 | case CAL_RECURRANCE: | 67 | case CAL_RECURRANCE: |
68 | if (*Recurrance == -1) *Recurrance = i; | 68 | if (*Recurrance == -1) *Recurrance = i; |
69 | break; | 69 | break; |
70 | case CAL_TEXT: | 70 | case CAL_TEXT: |
71 | if (*Text == -1) *Text = i; | 71 | if (*Text == -1) *Text = i; |
72 | break; | 72 | break; |
73 | case CAL_PHONE: | 73 | case CAL_PHONE: |
74 | if (*Phone == -1) *Phone = i; | 74 | if (*Phone == -1) *Phone = i; |
75 | break; | 75 | break; |
76 | case CAL_LOCATION: | 76 | case CAL_LOCATION: |
77 | if (*Location == -1) *Location = i; | 77 | if (*Location == -1) *Location = i; |
78 | break; | 78 | break; |
79 | default: | 79 | default: |
80 | break; | 80 | break; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) | 85 | GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) |
86 | { | 86 | { |
87 | int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; | 87 | int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; |
88 | char buffer[2000]; | 88 | char buffer[2000]; |
89 | 89 | ||
90 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); | 90 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); |
91 | 91 | ||
92 | if (header) { | 92 | if (header) { |
93 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); | 93 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); |
94 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); | 94 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); |
95 | } | 95 | } |
96 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10); | 96 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10); |
97 | 97 | ||
98 | if (Version == Nokia_VCalendar) { | 98 | if (Version == Nokia_VCalendar) { |
99 | *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); | 99 | *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); |
100 | switch (note->Type) { | 100 | switch (note->Type) { |
101 | case GSM_CAL_REMINDER: | 101 | case GSM_CAL_REMINDER: |
102 | *Length+=sprintf(Buffer+(*Length), "Reminder%c%c",13,10); | 102 | *Length+=sprintf(Buffer+(*Length), "Reminder%c%c",13,10); |
103 | break; | 103 | break; |
104 | case GSM_CAL_MEMO: | 104 | case GSM_CAL_MEMO: |
105 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); | 105 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); |
106 | break; | 106 | break; |
107 | case GSM_CAL_CALL: | 107 | case GSM_CAL_CALL: |
108 | *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); | 108 | *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); |
109 | break; | 109 | break; |
110 | case GSM_CAL_BIRTHDAY: | 110 | case GSM_CAL_BIRTHDAY: |
111 | *Length+=sprintf(Buffer+(*Length), "Special Occasion%c%c",13,10); | 111 | *Length+=sprintf(Buffer+(*Length), "Special Occasion%c%c",13,10); |
112 | break; | 112 | break; |
113 | case GSM_CAL_MEETING: | 113 | case GSM_CAL_MEETING: |
114 | default: | 114 | default: |
115 | *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10); | 115 | *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10); |
116 | break; | 116 | break; |
117 | } | 117 | } |
118 | if (note->Type == GSM_CAL_CALL) { | 118 | if (note->Type == GSM_CAL_CALL) { |
119 | buffer[0] = 0; | 119 | buffer[0] = 0; |
120 | buffer[1] = 0; | 120 | buffer[1] = 0; |
121 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); | 121 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); |
122 | if (Text != -1) { | 122 | if (Text != -1) { |
123 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); | 123 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); |
124 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); | 124 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); |
125 | } | 125 | } |
126 | SaveVCALText(Buffer, Length, buffer, "SUMMARY"); | 126 | SaveVCALText(Buffer, Length, buffer, "SUMMARY"); |
127 | } else { | 127 | } else { |
128 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); | 128 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); |
129 | } | 129 | } |
130 | if (note->Type == GSM_CAL_MEETING && Location != -1) { | 130 | if (note->Type == GSM_CAL_MEETING && Location != -1) { |
131 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); | 131 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); |
132 | } | 132 | } |
133 | 133 | ||
134 | if (Time == -1) return ERR_UNKNOWN; | 134 | if (Time == -1) return ERR_UNKNOWN; |
135 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); | 135 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); |
136 | 136 | ||
137 | if (EndTime != -1) { | 137 | if (EndTime != -1) { |
138 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); | 138 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); |
139 | } | 139 | } |
140 | 140 | ||
141 | if (Alarm != -1) { | 141 | if (Alarm != -1) { |
142 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { | 142 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { |
143 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 143 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
144 | } else { | 144 | } else { |
145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | /* Birthday is known to be recurranced */ | 149 | /* Birthday is known to be recurranced */ |
150 | if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { | 150 | if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { |
151 | switch(note->Entries[Recurrance].Number/24) { | 151 | switch(note->Entries[Recurrance].Number/24) { |
152 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; | 152 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; |
153 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; | 153 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; |
154 | case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; | 154 | case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; |
155 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; | 155 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | } else if (Version == Siemens_VCalendar) { | 158 | } else if (Version == Siemens_VCalendar) { |
159 | *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); | 159 | *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); |
160 | switch (note->Type) { | 160 | switch (note->Type) { |
161 | case GSM_CAL_MEETING: | 161 | case GSM_CAL_MEETING: |
162 | *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); | 162 | *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); |
163 | break; | 163 | break; |
164 | case GSM_CAL_CALL: | 164 | case GSM_CAL_CALL: |
165 | *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); | 165 | *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); |
166 | break; | 166 | break; |
167 | case GSM_CAL_BIRTHDAY: | 167 | case GSM_CAL_BIRTHDAY: |
168 | *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); | 168 | *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); |
169 | break; | 169 | break; |
170 | case GSM_CAL_MEMO: | 170 | case GSM_CAL_MEMO: |
171 | default: | 171 | default: |
172 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); | 172 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); |
173 | break; | 173 | break; |
174 | } | 174 | } |
175 | 175 | ||
176 | if (Time == -1) return ERR_UNKNOWN; | 176 | if (Time == -1) return ERR_UNKNOWN; |
177 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); | 177 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); |
178 | 178 | ||
179 | if (Alarm != -1) { | 179 | if (Alarm != -1) { |
180 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 180 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
181 | } | 181 | } |
182 | 182 | ||
183 | if (Recurrance != -1) { | 183 | if (Recurrance != -1) { |
184 | switch(note->Entries[Recurrance].Number/24) { | 184 | switch(note->Entries[Recurrance].Number/24) { |
185 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; | 185 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; |
186 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; | 186 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; |
187 | case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; | 187 | case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; |
188 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; | 188 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | if (note->Type == GSM_CAL_CALL) { | 192 | if (note->Type == GSM_CAL_CALL) { |
193 | buffer[0] = 0; | 193 | buffer[0] = 0; |
194 | buffer[1] = 0; | 194 | buffer[1] = 0; |
195 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); | 195 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); |
196 | if (Text != -1) { | 196 | if (Text != -1) { |
197 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); | 197 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); |
198 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); | 198 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); |
199 | } | 199 | } |
200 | SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); | 200 | SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); |
201 | } else { | 201 | } else { |
202 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); | 202 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); |
203 | } | 203 | } |
204 | } else if (Version == SonyEricsson_VCalendar) { | 204 | } else if (Version == SonyEricsson_VCalendar) { |
205 | *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); | 205 | *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); |
206 | switch (note->Type) { | 206 | switch (note->Type) { |
207 | case GSM_CAL_MEETING: | 207 | case GSM_CAL_MEETING: |
208 | *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); | 208 | *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); |
209 | break; | 209 | break; |
210 | case GSM_CAL_REMINDER: | 210 | case GSM_CAL_REMINDER: |
211 | *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); | 211 | *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); |
212 | break; | 212 | break; |
213 | case GSM_CAL_TRAVEL: | 213 | case GSM_CAL_TRAVEL: |
214 | *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); | 214 | *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); |
215 | break; | 215 | break; |
216 | case GSM_CAL_VACATION: | 216 | case GSM_CAL_VACATION: |
217 | *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); | 217 | *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); |
218 | break; | 218 | break; |
219 | case GSM_CAL_BIRTHDAY: | 219 | case GSM_CAL_BIRTHDAY: |
220 | *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); | 220 | *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); |
221 | break; | 221 | break; |
222 | case GSM_CAL_MEMO: | 222 | case GSM_CAL_MEMO: |
223 | default: | 223 | default: |
224 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); | 224 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); |
225 | break; | 225 | break; |
226 | } | 226 | } |
227 | 227 | ||
228 | if (Time == -1) return ERR_UNKNOWN; | 228 | if (Time == -1) return ERR_UNKNOWN; |
229 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); | 229 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); |
230 | 230 | ||
231 | if (EndTime != -1) { | 231 | if (EndTime != -1) { |
232 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); | 232 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); |
233 | } | 233 | } |
234 | 234 | ||
235 | if (Alarm != -1) { | 235 | if (Alarm != -1) { |
236 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 236 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
237 | } | 237 | } |
238 | 238 | ||
239 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); | 239 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); |
240 | 240 | ||
241 | if (Location != -1) { | 241 | if (Location != -1) { |
242 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); | 242 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); | 246 | *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); |
247 | *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10); | 247 | *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10); |
248 | if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); | 248 | if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); |
249 | 249 | ||
250 | return ERR_NONE; | 250 | return ERR_NONE; |
251 | } | 251 | } |
252 | 252 | ||
253 | void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone) | 253 | void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone) |
254 | { | 254 | { |
255 | int i; | 255 | int i; |
256 | 256 | ||
257 | *Text = -1; | 257 | *Text = -1; |
258 | *EndTime= -1; | 258 | *EndTime= -1; |
259 | *Alarm = -1; | 259 | *Alarm = -1; |
260 | *Completed= -1; | 260 | *Completed= -1; |
261 | *Phone = -1; | 261 | *Phone = -1; |
262 | for (i = 0; i < entry->EntriesNum; i++) { | 262 | for (i = 0; i < entry->EntriesNum; i++) { |
263 | switch (entry->Entries[i].EntryType) { | 263 | switch (entry->Entries[i].EntryType) { |
264 | case TODO_END_DATETIME : | 264 | case TODO_END_DATETIME : |
265 | if (*EndTime == -1) *EndTime = i; | 265 | if (*EndTime == -1) *EndTime = i; |
266 | break; | 266 | break; |
267 | case TODO_ALARM_DATETIME : | 267 | case TODO_ALARM_DATETIME : |
268 | case TODO_SILENT_ALARM_DATETIME: | 268 | case TODO_SILENT_ALARM_DATETIME: |
269 | if (*Alarm == -1) *Alarm = i; | 269 | if (*Alarm == -1) *Alarm = i; |
270 | break; | 270 | break; |
271 | case TODO_TEXT: | 271 | case TODO_TEXT: |
272 | if (*Text == -1) *Text = i; | 272 | if (*Text == -1) *Text = i; |
273 | break; | 273 | break; |
274 | case TODO_COMPLETED: | 274 | case TODO_COMPLETED: |
275 | if (*Completed == -1) *Completed = i; | 275 | if (*Completed == -1) *Completed = i; |
276 | break; | 276 | break; |
277 | case TODO_PHONE: | 277 | case TODO_PHONE: |
278 | if (*Phone == -1) *Phone = i; | 278 | if (*Phone == -1) *Phone = i; |
279 | break; | 279 | break; |
280 | default: | 280 | default: |
281 | break; | 281 | break; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version) | 286 | GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version) |
287 | { | 287 | { |
288 | int Text, Alarm, Completed, EndTime, Phone; | 288 | int Text, Alarm, Completed, EndTime, Phone; |
289 | 289 | ||
290 | GSM_ToDoFindDefaultTextTimeAlarmCompleted(note, &Text, &Alarm, &Completed, &EndTime, &Phone); | 290 | GSM_ToDoFindDefaultTextTimeAlarmCompleted(note, &Text, &Alarm, &Completed, &EndTime, &Phone); |
291 | 291 | ||
292 | if (header) { | 292 | if (header) { |
293 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); | 293 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); |
294 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); | 294 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); |
295 | } | 295 | } |
296 | 296 | ||
297 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VTODO%c%c",13,10); | 297 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VTODO%c%c",13,10); |
298 | 298 | ||
299 | if (Version == Nokia_VToDo) { | 299 | if (Version == Nokia_VToDo) { |
300 | if (Text == -1) return ERR_UNKNOWN; | 300 | if (Text == -1) return ERR_UNKNOWN; |
301 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); | 301 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); |
302 | 302 | ||
303 | if (Completed == -1) { | 303 | if (Completed == -1) { |
304 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); | 304 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); |
305 | } else { | 305 | } else { |
306 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); | 306 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); |
307 | } | 307 | } |
308 | 308 | ||
309 | switch (note->Priority) { | 309 | switch (note->Priority) { |
310 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; | 310 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; |
311 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; | 311 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; |
312 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; | 312 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; |
313 | } | 313 | } |
314 | 314 | ||
315 | if (EndTime != -1) { | 315 | if (EndTime != -1) { |
316 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DUE"); | 316 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DUE"); |
317 | } | 317 | } |
318 | 318 | ||
319 | if (Alarm != -1) { | 319 | if (Alarm != -1) { |
320 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { | 320 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { |
321 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 321 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
322 | } else { | 322 | } else { |
323 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 323 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
324 | } | 324 | } |
325 | } | 325 | } |
326 | } else if (Version == SonyEricsson_VToDo) { | 326 | } else if (Version == SonyEricsson_VToDo) { |
327 | if (Text == -1) return ERR_UNKNOWN; | 327 | if (Text == -1) return ERR_UNKNOWN; |
328 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); | 328 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); |
329 | 329 | ||
330 | if (Completed == -1) { | 330 | if (Completed == -1) { |
331 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); | 331 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); |
332 | } else { | 332 | } else { |
333 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); | 333 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); |
334 | } | 334 | } |
335 | 335 | ||
336 | switch (note->Priority) { | 336 | switch (note->Priority) { |
337 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; | 337 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; |
338 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; | 338 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; |
339 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; | 339 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; |
340 | } | 340 | } |
341 | 341 | ||
342 | if (Alarm != -1) { | 342 | if (Alarm != -1) { |
343 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 343 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
347 | *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); | 347 | *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); |
348 | *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10); | 348 | *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10); |
349 | 349 | ||
350 | if (header) { | 350 | if (header) { |
351 | *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); | 351 | *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); |
352 | } | 352 | } |
353 | return ERR_NONE; | 353 | return ERR_NONE; |
354 | } | 354 | } |
355 | 355 | ||
356 | GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer) | 356 | GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer) |
357 | { | 357 | { |
358 | unsigned char Line[2000],Buff[2000]; | 358 | unsigned char Line[2000],Buff[2000]; |
359 | int Level = 0; | 359 | int Level = 0; |
360 | 360 | ||
361 | Calendar->EntriesNum = 0; | 361 | Calendar->EntriesNum = 0; |
362 | ToDo->EntriesNum = 0; | 362 | ToDo->EntriesNum = 0; |
363 | 363 | ||
364 | while (1) { | 364 | while (1) { |
365 | MyGetLine(Buffer, Pos, Line, strlen(Buffer)); | 365 | MyGetLine(Buffer, Pos, Line, strlen(Buffer)); |
366 | if (strlen(Line) == 0) break; | 366 | if (strlen(Line) == 0) break; |
367 | switch (Level) { | 367 | switch (Level) { |
368 | case 0: | 368 | case 0: |
369 | if (strstr(Line,"BEGIN:VEVENT")) { | 369 | if (strstr(Line,"BEGIN:VEVENT")) { |
370 | Calendar->Type = GSM_CAL_MEMO; | 370 | Calendar->Type = GSM_CAL_MEMO; |
371 | Level = 1; | 371 | Level = 1; |
372 | } | 372 | } |
373 | if (strstr(Line,"BEGIN:VTODO")) { | 373 | if (strstr(Line,"BEGIN:VTODO")) { |
374 | ToDo->Priority = GSM_Priority_Medium; | 374 | ToDo->Priority = GSM_Priority_Medium; |
375 | Level = 2; | 375 | Level = 2; |
376 | } | 376 | } |
377 | break; | 377 | break; |
378 | case 1: /* Calendar note */ | 378 | case 1: /* Calendar note */ |
379 | if (strstr(Line,"END:VEVENT")) { | 379 | if (strstr(Line,"END:VEVENT")) { |
380 | if (Calendar->EntriesNum == 0) return ERR_EMPTY; | 380 | if (Calendar->EntriesNum == 0) return ERR_EMPTY; |
381 | return ERR_NONE; | 381 | return ERR_NONE; |
382 | } | 382 | } |
383 | Calendar->Type = GSM_CAL_MEETING; | 383 | Calendar->Type = GSM_CAL_MEETING; |
384 | if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER; | 384 | if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER; |
385 | if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE | 385 | if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE |
386 | if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE | 386 | if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE |
387 | if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE | 387 | if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE |
388 | if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; | 388 | if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; |
389 | if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; | 389 | if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; |
390 | if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY; | 390 | if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY; |
391 | if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; | 391 | if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; |
392 | if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; | 392 | if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; |
393 | if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; | 393 | if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; |
394 | if (strstr(Line,"RRULE:D1")) { | 394 | if (strstr(Line,"RRULE:D1")) { |
395 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 395 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
396 | Calendar->Entries[Calendar->EntriesNum].Number = 1*24; | 396 | Calendar->Entries[Calendar->EntriesNum].Number = 1*24; |
397 | Calendar->EntriesNum++; | 397 | Calendar->EntriesNum++; |
398 | } | 398 | } |
399 | if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { | 399 | if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { |
400 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 400 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
401 | Calendar->Entries[Calendar->EntriesNum].Number = 7*24; | 401 | Calendar->Entries[Calendar->EntriesNum].Number = 7*24; |
402 | Calendar->EntriesNum++; | 402 | Calendar->EntriesNum++; |
403 | } | 403 | } |
404 | if (strstr(Line,"RRULE:W2")) { | 404 | if (strstr(Line,"RRULE:W2")) { |
405 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 405 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
406 | Calendar->Entries[Calendar->EntriesNum].Number = 14*24; | 406 | Calendar->Entries[Calendar->EntriesNum].Number = 14*24; |
407 | Calendar->EntriesNum++; | 407 | Calendar->EntriesNum++; |
408 | } | 408 | } |
409 | if (strstr(Line,"RRULE:MD1")) { | 409 | if (strstr(Line,"RRULE:MD1")) { |
410 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 410 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
411 | Calendar->Entries[Calendar->EntriesNum].Number = 30*24; | 411 | Calendar->Entries[Calendar->EntriesNum].Number = 30*24; |
412 | Calendar->EntriesNum++; | 412 | Calendar->EntriesNum++; |
413 | } | 413 | } |
414 | if (strstr(Line,"RRULE:YD1")) { | 414 | if (strstr(Line,"RRULE:YD1")) { |
415 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 415 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
416 | Calendar->Entries[Calendar->EntriesNum].Number = 365*24; | 416 | Calendar->Entries[Calendar->EntriesNum].Number = 365*24; |
417 | Calendar->EntriesNum++; | 417 | Calendar->EntriesNum++; |
418 | } | 418 | } |
419 | if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { | 419 | if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { |
420 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; | 420 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; |
421 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); | 421 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); |
422 | Calendar->EntriesNum++; | 422 | Calendar->EntriesNum++; |
423 | } | 423 | } |
424 | if (ReadVCALText(Line, "LOCATION", Buff)) { | 424 | if (ReadVCALText(Line, "LOCATION", Buff)) { |
425 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; | 425 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; |
426 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); | 426 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); |
427 | Calendar->EntriesNum++; | 427 | Calendar->EntriesNum++; |
428 | } | 428 | } |
429 | if (ReadVCALText(Line, "DTSTART", Buff)) { | 429 | if (ReadVCALText(Line, "DTSTART", Buff)) { |
430 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; | 430 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; |
431 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 431 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
432 | Calendar->EntriesNum++; | 432 | Calendar->EntriesNum++; |
433 | } | 433 | } |
434 | if (ReadVCALText(Line, "DTEND", Buff)) { | 434 | if (ReadVCALText(Line, "DTEND", Buff)) { |
435 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; | 435 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; |
436 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 436 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
437 | Calendar->EntriesNum++; | 437 | Calendar->EntriesNum++; |
438 | } | 438 | } |
439 | if (ReadVCALText(Line, "DALARM", Buff)) { | 439 | if (ReadVCALText(Line, "DALARM", Buff)) { |
440 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; | 440 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; |
441 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 441 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
442 | Calendar->EntriesNum++; | 442 | Calendar->EntriesNum++; |
443 | } | 443 | } |
444 | if (ReadVCALText(Line, "AALARM", Buff)) { | 444 | if (ReadVCALText(Line, "AALARM", Buff)) { |
445 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; | 445 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; |
446 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 446 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
447 | Calendar->EntriesNum++; | 447 | Calendar->EntriesNum++; |
448 | } | 448 | } |
449 | break; | 449 | break; |
450 | case 2: /* ToDo note */ | 450 | case 2: /* ToDo note */ |
451 | if (strstr(Line,"END:VTODO")) { | 451 | if (strstr(Line,"END:VTODO")) { |
452 | if (ToDo->EntriesNum == 0) return ERR_EMPTY; | 452 | if (ToDo->EntriesNum == 0) return ERR_EMPTY; |
453 | return ERR_NONE; | 453 | return ERR_NONE; |
454 | } | 454 | } |
455 | if (ReadVCALText(Line, "DUE", Buff)) { | 455 | if (ReadVCALText(Line, "DUE", Buff)) { |
456 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME; | 456 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME; |
457 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 457 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
458 | ToDo->EntriesNum++; | 458 | ToDo->EntriesNum++; |
459 | } | 459 | } |
460 | if (ReadVCALText(Line, "DALARM", Buff)) { | 460 | if (ReadVCALText(Line, "DALARM", Buff)) { |
461 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; | 461 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; |
462 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 462 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
463 | ToDo->EntriesNum++; | 463 | ToDo->EntriesNum++; |
464 | } | 464 | } |
465 | if (ReadVCALText(Line, "AALARM", Buff)) { | 465 | if (ReadVCALText(Line, "AALARM", Buff)) { |
466 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; | 466 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; |
467 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 467 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
468 | ToDo->EntriesNum++; | 468 | ToDo->EntriesNum++; |
469 | } | 469 | } |
470 | if (ReadVCALText(Line, "SUMMARY", Buff)) { | 470 | if (ReadVCALText(Line, "SUMMARY", Buff)) { |
471 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; | 471 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; |
472 | CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); | 472 | CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); |
473 | ToDo->EntriesNum++; | 473 | ToDo->EntriesNum++; |
474 | } | 474 | } |
475 | if (ReadVCALText(Line, "PRIORITY", Buff)) { | 475 | if (ReadVCALText(Line, "PRIORITY", Buff)) { |
476 | if (ToDoVer == SonyEricsson_VToDo) { | 476 | if (ToDoVer == SonyEricsson_VToDo) { |
477 | ToDo->Priority = GSM_Priority_Low; | 477 | ToDo->Priority = GSM_Priority_Low; |
478 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; | 478 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; |
479 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; | 479 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; |
480 | dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); | 480 | dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); |
481 | } else if (ToDoVer == Nokia_VToDo) { | 481 | } else if (ToDoVer == Nokia_VToDo) { |
482 | ToDo->Priority = GSM_Priority_Low; | 482 | ToDo->Priority = GSM_Priority_Low; |
483 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; | 483 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; |
484 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; | 484 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; |
485 | } | 485 | } |
486 | } | 486 | } |
487 | if (strstr(Line,"PERCENT-COMPLETE:100")) { | 487 | if (strstr(Line,"PERCENT-COMPLETE:100")) { |
488 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; | 488 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; |
489 | ToDo->Entries[ToDo->EntriesNum].Number = 1; | 489 | ToDo->Entries[ToDo->EntriesNum].Number = 1; |
490 | ToDo->EntriesNum++; | 490 | ToDo->EntriesNum++; |
491 | } | 491 | } |
492 | break; | 492 | break; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; | 496 | if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; |
497 | return ERR_NONE; | 497 | return ERR_NONE; |
498 | } | 498 | } |
499 | 499 | ||
500 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note) | 500 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note) |
501 | { | 501 | { |
502 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10); | 502 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10); |
503 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10); | 503 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10); |
504 | SaveVCALText(Buffer, Length, Note->Text, "BODY"); | 504 | SaveVCALText(Buffer, Length, Note->Text, "BODY"); |
505 | *Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10); | 505 | *Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10); |
506 | 506 | ||
507 | return ERR_NONE; | 507 | return ERR_NONE; |
508 | } | 508 | } |
509 | 509 | ||
510 | /* How should editor hadle tabs in this file? Add editor commands here. | 510 | /* How should editor hadle tabs in this file? Add editor commands here. |
511 | * vim: noexpandtab sw=8 ts=8 sts=8: | 511 | * vim: noexpandtab sw=8 ts=8 sts=8: |
512 | */ | 512 | */ |
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index 5163d81..a3b93a8 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -7732,670 +7732,697 @@ static void NokiaGetADC(int argc, char *argv[]) | |||
7732 | 7732 | ||
7733 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7733 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7734 | DCT3GetADC(argc,argv); | 7734 | DCT3GetADC(argc,argv); |
7735 | #endif | 7735 | #endif |
7736 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7736 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7737 | DCT4GetADC(argc, argv); | 7737 | DCT4GetADC(argc, argv); |
7738 | #endif | 7738 | #endif |
7739 | 7739 | ||
7740 | GSM_Terminate(); | 7740 | GSM_Terminate(); |
7741 | } | 7741 | } |
7742 | 7742 | ||
7743 | static void NokiaDisplayTest(int argc, char *argv[]) | 7743 | static void NokiaDisplayTest(int argc, char *argv[]) |
7744 | { | 7744 | { |
7745 | GSM_Init(true); | 7745 | GSM_Init(true); |
7746 | 7746 | ||
7747 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7747 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7748 | DCT3DisplayTest(argc,argv); | 7748 | DCT3DisplayTest(argc,argv); |
7749 | #endif | 7749 | #endif |
7750 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7750 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7751 | DCT4DisplayTest(argc, argv); | 7751 | DCT4DisplayTest(argc, argv); |
7752 | #endif | 7752 | #endif |
7753 | 7753 | ||
7754 | GSM_Terminate(); | 7754 | GSM_Terminate(); |
7755 | } | 7755 | } |
7756 | 7756 | ||
7757 | static void NokiaGetT9(int argc, char *argv[]) | 7757 | static void NokiaGetT9(int argc, char *argv[]) |
7758 | { | 7758 | { |
7759 | GSM_Init(true); | 7759 | GSM_Init(true); |
7760 | 7760 | ||
7761 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7761 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7762 | DCT3GetT9(argc,argv); | 7762 | DCT3GetT9(argc,argv); |
7763 | #endif | 7763 | #endif |
7764 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7764 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7765 | DCT4GetT9(argc, argv); | 7765 | DCT4GetT9(argc, argv); |
7766 | #endif | 7766 | #endif |
7767 | 7767 | ||
7768 | GSM_Terminate(); | 7768 | GSM_Terminate(); |
7769 | } | 7769 | } |
7770 | 7770 | ||
7771 | static void NokiaVibraTest(int argc, char *argv[]) | 7771 | static void NokiaVibraTest(int argc, char *argv[]) |
7772 | { | 7772 | { |
7773 | GSM_Init(true); | 7773 | GSM_Init(true); |
7774 | 7774 | ||
7775 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7775 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7776 | DCT3VibraTest(argc,argv); | 7776 | DCT3VibraTest(argc,argv); |
7777 | #endif | 7777 | #endif |
7778 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7778 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7779 | DCT4VibraTest(argc, argv); | 7779 | DCT4VibraTest(argc, argv); |
7780 | #endif | 7780 | #endif |
7781 | 7781 | ||
7782 | GSM_Terminate(); | 7782 | GSM_Terminate(); |
7783 | } | 7783 | } |
7784 | 7784 | ||
7785 | static GSM_Parameters Parameters[] = { | 7785 | static GSM_Parameters Parameters[] = { |
7786 | {"--identify", 0, 0, Identify, {H_Info,0}, ""}, | 7786 | {"--identify", 0, 0, Identify, {H_Info,0}, ""}, |
7787 | {"--version", 0, 0, Version, {H_Other,0}, ""}, | 7787 | {"--version", 0, 0, Version, {H_Other,0}, ""}, |
7788 | {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""}, | 7788 | {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""}, |
7789 | {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"}, | 7789 | {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"}, |
7790 | {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""}, | 7790 | {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""}, |
7791 | {"--listnetworks", 0, 0, ListNetworks, {H_Network,0}, ""}, | 7791 | {"--listnetworks", 0, 0, ListNetworks, {H_Network,0}, ""}, |
7792 | {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"}, | 7792 | {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"}, |
7793 | {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"}, | 7793 | {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"}, |
7794 | {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"}, | 7794 | {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"}, |
7795 | {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""}, | 7795 | {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""}, |
7796 | {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."}, | 7796 | {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."}, |
7797 | {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."}, | 7797 | {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."}, |
7798 | {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"}, | 7798 | {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"}, |
7799 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"}, | 7799 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"}, |
7800 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"}, | 7800 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"}, |
7801 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, | 7801 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, |
7802 | {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, | 7802 | {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, |
7803 | {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, | 7803 | {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, |
7804 | {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, | 7804 | {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, |
7805 | {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, | 7805 | {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, |
7806 | {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, | 7806 | {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, |
7807 | {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, | 7807 | {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, |
7808 | {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"}, | 7808 | {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"}, |
7809 | {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"}, | 7809 | {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"}, |
7810 | {"--getmemory", 2, 3, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop]"}, | 7810 | {"--getmemory", 2, 3, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop]"}, |
7811 | {"--getallmemory", 1, 1, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"}, | 7811 | {"--getallmemory", 1, 1, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"}, |
7812 | {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"}, | 7812 | {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"}, |
7813 | {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"}, | 7813 | {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"}, |
7814 | {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"}, | 7814 | {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"}, |
7815 | {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"}, | 7815 | {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"}, |
7816 | {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"}, | 7816 | {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"}, |
7817 | {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"}, | 7817 | {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"}, |
7818 | {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"}, | 7818 | {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"}, |
7819 | {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""}, | 7819 | {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""}, |
7820 | {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""}, | 7820 | {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""}, |
7821 | {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""}, | 7821 | {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""}, |
7822 | 7822 | ||
7823 | #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]" | 7823 | #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]" |
7824 | #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]" | 7824 | #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]" |
7825 | #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]" | 7825 | #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]" |
7826 | #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]" | 7826 | #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]" |
7827 | #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]" | 7827 | #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]" |
7828 | #define SMS_ANIMATION_OPTIONS"" | 7828 | #define SMS_ANIMATION_OPTIONS"" |
7829 | #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]" | 7829 | #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]" |
7830 | #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]" | 7830 | #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]" |
7831 | #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]" | 7831 | #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]" |
7832 | #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]" | 7832 | #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]" |
7833 | 7833 | ||
7834 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, | 7834 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, |
7835 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7835 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7836 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, | 7836 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, |
7837 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7837 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7838 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, | 7838 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, |
7839 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, | 7839 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, |
7840 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7840 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7841 | #ifdef GSM_ENABLE_BACKUP | 7841 | #ifdef GSM_ENABLE_BACKUP |
7842 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7842 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7843 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7843 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7844 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7844 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7845 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7845 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7846 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7846 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7847 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 7847 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7848 | #endif | 7848 | #endif |
7849 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS}, | 7849 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS}, |
7850 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, | 7850 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, |
7851 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, | 7851 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, |
7852 | 7852 | ||
7853 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, | 7853 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, |
7854 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7854 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7855 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, | 7855 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, |
7856 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7856 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7857 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, | 7857 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, |
7858 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION destination frames file1 file2... " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, | 7858 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION destination frames file1 file2... " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, |
7859 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR destination URL Title Sender " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7859 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR destination URL Title Sender " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7860 | #ifdef GSM_ENABLE_BACKUP | 7860 | #ifdef GSM_ENABLE_BACKUP |
7861 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7861 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7862 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS destination file location DATA|GPRS " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7862 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS destination file location DATA|GPRS " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7863 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7863 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7864 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7864 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7865 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7865 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7866 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 destination file SM|ME location [-nokia]" SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 7866 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 destination file SM|ME location [-nokia]" SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7867 | #endif | 7867 | #endif |
7868 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS ""SMS_PROFILE_OPTIONS}, | 7868 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS ""SMS_PROFILE_OPTIONS}, |
7869 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, | 7869 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, |
7870 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, | 7870 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, |
7871 | 7871 | ||
7872 | {"--displaysms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "... (options like in sendsms)"}, | 7872 | {"--displaysms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "... (options like in sendsms)"}, |
7873 | 7873 | ||
7874 | {"--addsmsfolder", 1, 1, AddSMSFolder, {H_SMS,0}, "name"}, | 7874 | {"--addsmsfolder", 1, 1, AddSMSFolder, {H_SMS,0}, "name"}, |
7875 | #ifdef HAVE_MYSQL_MYSQL_H | 7875 | #ifdef HAVE_MYSQL_MYSQL_H |
7876 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "MYSQL configfile"}, | 7876 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "MYSQL configfile"}, |
7877 | #endif | 7877 | #endif |
7878 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "FILES configfile"}, | 7878 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "FILES configfile"}, |
7879 | {"--sendsmsdsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Other,0}, "TEXT|WAPSETTINGS|... destination FILES|MYSQL configfile ... (options like in sendsms)"}, | 7879 | {"--sendsmsdsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Other,0}, "TEXT|WAPSETTINGS|... destination FILES|MYSQL configfile ... (options like in sendsms)"}, |
7880 | {"--getringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, | 7880 | {"--getringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, |
7881 | {"--getphoneringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, | 7881 | {"--getphoneringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, |
7882 | {"--getringtoneslist", 0, 0, GetRingtonesList, {H_Ringtone,0}, ""}, | 7882 | {"--getringtoneslist", 0, 0, GetRingtonesList, {H_Ringtone,0}, ""}, |
7883 | {"--setringtone", 1, 6, SetRingtone, {H_Ringtone,0}, "file [-location location][-scale][-name name]"}, | 7883 | {"--setringtone", 1, 6, SetRingtone, {H_Ringtone,0}, "file [-location location][-scale][-name name]"}, |
7884 | {"--nokiacomposer", 1, 1, NokiaComposer, {H_Ringtone,H_Nokia,0}, "file"}, | 7884 | {"--nokiacomposer", 1, 1, NokiaComposer, {H_Ringtone,H_Nokia,0}, "file"}, |
7885 | {"--copyringtone", 2, 3, CopyRingtone, {H_Ringtone,0}, "source destination [RTTL|BINARY]"}, | 7885 | {"--copyringtone", 2, 3, CopyRingtone, {H_Ringtone,0}, "source destination [RTTL|BINARY]"}, |
7886 | {"--getussd", 1, 1, GetUSSD, {H_Call,0}, "code"}, | 7886 | {"--getussd", 1, 1, GetUSSD, {H_Call,0}, "code"}, |
7887 | {"--dialvoice", 1, 2, DialVoice, {H_Call,0}, "number [show|hide]"}, | 7887 | {"--dialvoice", 1, 2, DialVoice, {H_Call,0}, "number [show|hide]"}, |
7888 | {"--getspeeddial", 1, 2, GetSpeedDial, {H_Call,H_Memory,0}, "start [stop]"}, | 7888 | {"--getspeeddial", 1, 2, GetSpeedDial, {H_Call,H_Memory,0}, "start [stop]"}, |
7889 | {"--cancelcall", 0, 1, CancelCall, {H_Call,0}, "[ID]"}, | 7889 | {"--cancelcall", 0, 1, CancelCall, {H_Call,0}, "[ID]"}, |
7890 | {"--answercall", 0, 1, AnswerCall, {H_Call,0}, "[ID]"}, | 7890 | {"--answercall", 0, 1, AnswerCall, {H_Call,0}, "[ID]"}, |
7891 | {"--unholdcall", 1, 1, UnholdCall, {H_Call,0}, "ID"}, | 7891 | {"--unholdcall", 1, 1, UnholdCall, {H_Call,0}, "ID"}, |
7892 | {"--holdcall", 1, 1, HoldCall, {H_Call,0}, "ID"}, | 7892 | {"--holdcall", 1, 1, HoldCall, {H_Call,0}, "ID"}, |
7893 | {"--conferencecall", 1, 1, ConferenceCall, {H_Call,0}, "ID"}, | 7893 | {"--conferencecall", 1, 1, ConferenceCall, {H_Call,0}, "ID"}, |
7894 | {"--splitcall", 1, 1, SplitCall, {H_Call,0}, "ID"}, | 7894 | {"--splitcall", 1, 1, SplitCall, {H_Call,0}, "ID"}, |
7895 | {"--switchcall", 0, 1, SwitchCall, {H_Call,0}, "[ID]"}, | 7895 | {"--switchcall", 0, 1, SwitchCall, {H_Call,0}, "[ID]"}, |
7896 | {"--transfercall", 0, 1, TransferCall, {H_Call,0}, "[ID]"}, | 7896 | {"--transfercall", 0, 1, TransferCall, {H_Call,0}, "[ID]"}, |
7897 | {"--divert", 3, 5, CallDivert, {H_Call,0}, "get|set all|busy|noans|outofreach all|voice|fax|data [number timeout]"}, | 7897 | {"--divert", 3, 5, CallDivert, {H_Call,0}, "get|set all|busy|noans|outofreach all|voice|fax|data [number timeout]"}, |
7898 | {"--canceldiverts", 0, 0, CancelAllDiverts, {H_Call,0}, ""}, | 7898 | {"--canceldiverts", 0, 0, CancelAllDiverts, {H_Call,0}, ""}, |
7899 | {"--senddtmf", 1, 1, SendDTMF, {H_Call,0}, "sequence"}, | 7899 | {"--senddtmf", 1, 1, SendDTMF, {H_Call,0}, "sequence"}, |
7900 | {"--getcalendarsettings", 0, 0, GetCalendarSettings, {H_Calendar,H_Settings,0},""}, | 7900 | {"--getcalendarsettings", 0, 0, GetCalendarSettings, {H_Calendar,H_Settings,0},""}, |
7901 | {"--getalltodo", 0, 0, GetAllToDo, {H_ToDo,0}, ""}, | 7901 | {"--getalltodo", 0, 0, GetAllToDo, {H_ToDo,0}, ""}, |
7902 | {"--listtodocategory", 1, 1, ListToDoCategory, {H_ToDo, H_Category,0}, "text|number"}, | 7902 | {"--listtodocategory", 1, 1, ListToDoCategory, {H_ToDo, H_Category,0}, "text|number"}, |
7903 | {"--gettodo", 1, 2, GetToDo, {H_ToDo,0}, "start [stop]"}, | 7903 | {"--gettodo", 1, 2, GetToDo, {H_ToDo,0}, "start [stop]"}, |
7904 | {"--deletetodo", 1, 2, DeleteToDo, {H_ToDo,0}, "start [stop]"}, | 7904 | {"--deletetodo", 1, 2, DeleteToDo, {H_ToDo,0}, "start [stop]"}, |
7905 | {"--getnote", 1, 2, GetNote, {H_Note,0}, "start [stop]"}, | 7905 | {"--getnote", 1, 2, GetNote, {H_Note,0}, "start [stop]"}, |
7906 | {"--deletecalendar", 1, 2, DeleteCalendar, {H_Calendar,0}, "start [stop]"}, | 7906 | {"--deletecalendar", 1, 2, DeleteCalendar, {H_Calendar,0}, "start [stop]"}, |
7907 | {"--getallcalendar", 0, 0, GetAllCalendar, {H_Calendar,0}, ""}, | 7907 | {"--getallcalendar", 0, 0, GetAllCalendar, {H_Calendar,0}, ""}, |
7908 | {"--getcalendar", 1, 2, GetCalendar, {H_Calendar,0}, "start [stop]"}, | 7908 | {"--getcalendar", 1, 2, GetCalendar, {H_Calendar,0}, "start [stop]"}, |
7909 | {"--getcategory", 2, 3, GetCategory, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK start [stop]"}, | 7909 | {"--getcategory", 2, 3, GetCategory, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK start [stop]"}, |
7910 | {"--getallcategory", 1, 1, GetAllCategories, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK"}, | 7910 | {"--getallcategory", 1, 1, GetAllCategories, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK"}, |
7911 | {"--reset", 1, 1, Reset, {H_Other,0}, "SOFT|HARD"}, | 7911 | {"--reset", 1, 1, Reset, {H_Other,0}, "SOFT|HARD"}, |
7912 | {"--getprofile", 1, 2, GetProfile, {H_Settings,0}, "start [stop]"}, | 7912 | {"--getprofile", 1, 2, GetProfile, {H_Settings,0}, "start [stop]"}, |
7913 | {"--getsecuritystatus", 0, 0, GetSecurityStatus, {H_Info,0}, ""}, | 7913 | {"--getsecuritystatus", 0, 0, GetSecurityStatus, {H_Info,0}, ""}, |
7914 | {"--entersecuritycode", 2, 2, EnterSecurityCode, {H_Other,0}, "PIN|PUK|PIN2|PUK2 code"}, | 7914 | {"--entersecuritycode", 2, 2, EnterSecurityCode, {H_Other,0}, "PIN|PUK|PIN2|PUK2 code"}, |
7915 | {"--deletewapbookmark", 1, 2, DeleteWAPBookmark, {H_WAP,0}, "start [stop]"}, | 7915 | {"--deletewapbookmark", 1, 2, DeleteWAPBookmark, {H_WAP,0}, "start [stop]"}, |
7916 | {"--getwapbookmark", 1, 2, GetWAPBookmark, {H_WAP,0}, "start [stop]"}, | 7916 | {"--getwapbookmark", 1, 2, GetWAPBookmark, {H_WAP,0}, "start [stop]"}, |
7917 | {"--getwapsettings", 1, 2, GetWAPMMSSettings, {H_WAP,0}, "start [stop]"}, | 7917 | {"--getwapsettings", 1, 2, GetWAPMMSSettings, {H_WAP,0}, "start [stop]"}, |
7918 | {"--getmmssettings", 1, 2, GetWAPMMSSettings, {H_MMS,0}, "start [stop]"}, | 7918 | {"--getmmssettings", 1, 2, GetWAPMMSSettings, {H_MMS,0}, "start [stop]"}, |
7919 | {"--getsyncmlsettings", 1, 2, GetSyncMLSettings, {H_WAP,0}, "start [stop]"}, | 7919 | {"--getsyncmlsettings", 1, 2, GetSyncMLSettings, {H_WAP,0}, "start [stop]"}, |
7920 | {"--getchatsettings", 1, 2, GetChatSettings, {H_WAP,0}, "start [stop]"}, | 7920 | {"--getchatsettings", 1, 2, GetChatSettings, {H_WAP,0}, "start [stop]"}, |
7921 | {"--savemmsfile", 3, 15,SaveMMSFile, {H_MMS,0}, "file [-subject text][-text text]"}, | 7921 | {"--savemmsfile", 3, 15,SaveMMSFile, {H_MMS,0}, "file [-subject text][-text text]"}, |
7922 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "STARTUP [file]"}, | 7922 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "STARTUP [file]"}, |
7923 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "CALLER location [file]"}, | 7923 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "CALLER location [file]"}, |
7924 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "OPERATOR [file]"}, | 7924 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "OPERATOR [file]"}, |
7925 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "PICTURE location [file]"}, | 7925 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "PICTURE location [file]"}, |
7926 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "TEXT"}, | 7926 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "TEXT"}, |
7927 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "DEALER"}, | 7927 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "DEALER"}, |
7928 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "STARTUP file|1|2|3"}, | 7928 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "STARTUP file|1|2|3"}, |
7929 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOURSTARTUP [fileID]"}, | 7929 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOURSTARTUP [fileID]"}, |
7930 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "WALLPAPER fileID"}, | 7930 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "WALLPAPER fileID"}, |
7931 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "CALLER location [file]"}, | 7931 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "CALLER location [file]"}, |
7932 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "OPERATOR [file [netcode]]"}, | 7932 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "OPERATOR [file [netcode]]"}, |
7933 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOUROPERATOR [fileID [netcode]]"}, | 7933 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOUROPERATOR [fileID [netcode]]"}, |
7934 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "PICTURE file location [text]"}, | 7934 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "PICTURE file location [text]"}, |
7935 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "TEXT text"}, | 7935 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "TEXT text"}, |
7936 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "DEALER text"}, | 7936 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "DEALER text"}, |
7937 | {"--copybitmap", 1, 3, CopyBitmap, {H_Logo,0}, "inputfile [outputfile [OPERATOR|PICTURE|STARTUP|CALLER]]"}, | 7937 | {"--copybitmap", 1, 3, CopyBitmap, {H_Logo,0}, "inputfile [outputfile [OPERATOR|PICTURE|STARTUP|CALLER]]"}, |
7938 | {"--presskeysequence", 1, 1, PressKeySequence, {H_Other,0}, "mMnNpPuUdD+-123456789*0#gGrRwW"}, | 7938 | {"--presskeysequence", 1, 1, PressKeySequence, {H_Other,0}, "mMnNpPuUdD+-123456789*0#gGrRwW"}, |
7939 | #if defined(WIN32) || defined(HAVE_PTHREAD) | 7939 | #if defined(WIN32) || defined(HAVE_PTHREAD) |
7940 | {"--searchphone", 0, 1, SearchPhone, {H_Other,0}, "[-debug]"}, | 7940 | {"--searchphone", 0, 1, SearchPhone, {H_Other,0}, "[-debug]"}, |
7941 | #endif | 7941 | #endif |
7942 | #ifdef GSM_ENABLE_BACKUP | 7942 | #ifdef GSM_ENABLE_BACKUP |
7943 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_Calendar,0},"CALENDAR target.vcs file location"}, | 7943 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_Calendar,0},"CALENDAR target.vcs file location"}, |
7944 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_ToDo,0}, "TODO target.vcs file location"}, | 7944 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_ToDo,0}, "TODO target.vcs file location"}, |
7945 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_Memory,0}, "VCARD10|VCARD21 target.vcf file SM|ME location"}, | 7945 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_Memory,0}, "VCARD10|VCARD21 target.vcf file SM|ME location"}, |
7946 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_WAP,0}, "BOOKMARK target.url file location"}, | 7946 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_WAP,0}, "BOOKMARK target.url file location"}, |
7947 | {"--backup", 1, 2, Backup, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file [-yes]"}, | 7947 | {"--backup", 1, 2, Backup, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file [-yes]"}, |
7948 | {"--backupsms", 1, 1, BackupSMS, {H_Backup,H_SMS,0}, "file"}, | 7948 | {"--backupsms", 1, 1, BackupSMS, {H_Backup,H_SMS,0}, "file"}, |
7949 | {"--restore", 1, 1, Restore, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, | 7949 | {"--restore", 1, 1, Restore, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, |
7950 | {"--addnew", 1, 1, AddNew, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, | 7950 | {"--addnew", 1, 1, AddNew, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, |
7951 | {"--restoresms", 1, 1, RestoreSMS, {H_Backup,H_SMS,0}, "file"}, | 7951 | {"--restoresms", 1, 1, RestoreSMS, {H_Backup,H_SMS,0}, "file"}, |
7952 | {"--addsms", 2, 2, AddSMS, {H_Backup,H_SMS,0}, "folder file"}, | 7952 | {"--addsms", 2, 2, AddSMS, {H_Backup,H_SMS,0}, "folder file"}, |
7953 | #endif | 7953 | #endif |
7954 | {"--clearall", 0, 0, ClearAll, {H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0},""}, | 7954 | {"--clearall", 0, 0, ClearAll, {H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0},""}, |
7955 | {"--networkinfo", 0, 0, NetworkInfo, {H_Network,0}, ""}, | 7955 | {"--networkinfo", 0, 0, NetworkInfo, {H_Network,0}, ""}, |
7956 | #ifdef GSM_ENABLE_AT | 7956 | #ifdef GSM_ENABLE_AT |
7957 | {"--siemenssatnetmon", 0, 0, ATSIEMENSSATNetmon, {H_Siemens,H_Network,0},""}, | 7957 | {"--siemenssatnetmon", 0, 0, ATSIEMENSSATNetmon, {H_Siemens,H_Network,0},""}, |
7958 | {"--siemensnetmonact", 1, 1, ATSIEMENSActivateNetmon, {H_Siemens,H_Network,0}, "netmon_type (1-full, 2-simple)"}, | 7958 | {"--siemensnetmonact", 1, 1, ATSIEMENSActivateNetmon, {H_Siemens,H_Network,0}, "netmon_type (1-full, 2-simple)"}, |
7959 | {"--siemensnetmonitor", 1, 1, ATSIEMENSNetmonitor, {H_Siemens,H_Network,0},"test"}, | 7959 | {"--siemensnetmonitor", 1, 1, ATSIEMENSNetmonitor, {H_Siemens,H_Network,0},"test"}, |
7960 | #endif | 7960 | #endif |
7961 | #ifdef GSM_ENABLE_NOKIA6110 | 7961 | #ifdef GSM_ENABLE_NOKIA6110 |
7962 | {"--nokiagetoperatorname", 0, 0, DCT3GetOperatorName, {H_Nokia,H_Network,0}, ""}, | 7962 | {"--nokiagetoperatorname", 0, 0, DCT3GetOperatorName, {H_Nokia,H_Network,0}, ""}, |
7963 | {"--nokiasetoperatorname", 0, 2, DCT3SetOperatorName, {H_Nokia,H_Network,0}, "[networkcode name]"}, | 7963 | {"--nokiasetoperatorname", 0, 2, DCT3SetOperatorName, {H_Nokia,H_Network,0}, "[networkcode name]"}, |
7964 | {"--nokiadisplayoutput", 0, 0, DCT3DisplayOutput, {H_Nokia,0}, ""}, | 7964 | {"--nokiadisplayoutput", 0, 0, DCT3DisplayOutput, {H_Nokia,0}, ""}, |
7965 | #endif | 7965 | #endif |
7966 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7966 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7967 | {"--nokianetmonitor", 1, 1, DCT3netmonitor, {H_Nokia,H_Network,0}, "test"}, | 7967 | {"--nokianetmonitor", 1, 1, DCT3netmonitor, {H_Nokia,H_Network,0}, "test"}, |
7968 | {"--nokianetmonitor36", 0, 0, DCT3ResetTest36, {H_Nokia,0}, ""}, | 7968 | {"--nokianetmonitor36", 0, 0, DCT3ResetTest36, {H_Nokia,0}, ""}, |
7969 | {"--nokiadebug", 1, 2, DCT3SetDebug, {H_Nokia,H_Network,0}, "filename [[v11-22][,v33-44]...]"}, | 7969 | {"--nokiadebug", 1, 2, DCT3SetDebug, {H_Nokia,H_Network,0}, "filename [[v11-22][,v33-44]...]"}, |
7970 | #endif | 7970 | #endif |
7971 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7971 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7972 | {"--nokiasetvibralevel", 1, 1, DCT4SetVibraLevel, {H_Nokia,H_Other,0}, "level"}, | 7972 | {"--nokiasetvibralevel", 1, 1, DCT4SetVibraLevel, {H_Nokia,H_Other,0}, "level"}, |
7973 | {"--nokiagetvoicerecord", 1, 1, DCT4GetVoiceRecord, {H_Nokia,H_Other,0}, "location"}, | 7973 | {"--nokiagetvoicerecord", 1, 1, DCT4GetVoiceRecord, {H_Nokia,H_Other,0}, "location"}, |
7974 | {"--nokiasetlights", 2, 2, DCT4SetLight, {H_Nokia,H_Tests,0}, "keypad|display|torch on|off"}, | 7974 | {"--nokiasetlights", 2, 2, DCT4SetLight, {H_Nokia,H_Tests,0}, "keypad|display|torch on|off"}, |
7975 | {"--nokiatuneradio", 0, 0, DCT4TuneRadio, {H_Nokia,H_FM,0}, ""}, | 7975 | {"--nokiatuneradio", 0, 0, DCT4TuneRadio, {H_Nokia,H_FM,0}, ""}, |
7976 | {"--nokiamakecamerashoot", 0, 0, DCT4MakeCameraShoot, {H_Nokia,H_Other,0}, ""}, | 7976 | {"--nokiamakecamerashoot", 0, 0, DCT4MakeCameraShoot, {H_Nokia,H_Other,0}, ""}, |
7977 | {"--nokiagetscreendump", 0, 0, DCT4GetScreenDump, {H_Nokia,H_Other,0}, ""}, | 7977 | {"--nokiagetscreendump", 0, 0, DCT4GetScreenDump, {H_Nokia,H_Other,0}, ""}, |
7978 | #endif | 7978 | #endif |
7979 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | 7979 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) |
7980 | {"--nokiavibratest", 0, 0, NokiaVibraTest, {H_Nokia,H_Tests,0}, ""}, | 7980 | {"--nokiavibratest", 0, 0, NokiaVibraTest, {H_Nokia,H_Tests,0}, ""}, |
7981 | {"--nokiagett9", 0, 0, NokiaGetT9, {H_Nokia,H_SMS,0}, ""}, | 7981 | {"--nokiagett9", 0, 0, NokiaGetT9, {H_Nokia,H_SMS,0}, ""}, |
7982 | {"--nokiadisplaytest", 1, 1, NokiaDisplayTest, {H_Nokia,H_Tests,0}, "number"}, | 7982 | {"--nokiadisplaytest", 1, 1, NokiaDisplayTest, {H_Nokia,H_Tests,0}, "number"}, |
7983 | {"--nokiagetadc", 0, 0, NokiaGetADC, {H_Nokia,H_Tests,0}, ""}, | 7983 | {"--nokiagetadc", 0, 0, NokiaGetADC, {H_Nokia,H_Tests,0}, ""}, |
7984 | {"--nokiasecuritycode", 0, 0, NokiaSecurityCode, {H_Nokia,H_Info,0}, ""}, | 7984 | {"--nokiasecuritycode", 0, 0, NokiaSecurityCode, {H_Nokia,H_Info,0}, ""}, |
7985 | {"--nokiaselftests", 0, 0, NokiaSelfTests, {H_Nokia,H_Tests,0}, ""}, | 7985 | {"--nokiaselftests", 0, 0, NokiaSelfTests, {H_Nokia,H_Tests,0}, ""}, |
7986 | {"--nokiasetphonemenus", 0, 0, NokiaSetPhoneMenus, {H_Nokia,H_Other,0}, ""}, | 7986 | {"--nokiasetphonemenus", 0, 0, NokiaSetPhoneMenus, {H_Nokia,H_Other,0}, ""}, |
7987 | #endif | 7987 | #endif |
7988 | #ifdef DEBUG | 7988 | #ifdef DEBUG |
7989 | {"--decodesniff", 2, 3, decodesniff, {H_Decode,0}, "MBUS2|IRDA file [phonemodel]"}, | 7989 | {"--decodesniff", 2, 3, decodesniff, {H_Decode,0}, "MBUS2|IRDA file [phonemodel]"}, |
7990 | {"--decodebinarydump", 1, 2, decodebinarydump, {H_Decode,0}, "file [phonemodel]"}, | 7990 | {"--decodebinarydump", 1, 2, decodebinarydump, {H_Decode,0}, "file [phonemodel]"}, |
7991 | {"--makeconverttable", 1, 1, MakeConvertTable, {H_Decode,0}, "file"}, | 7991 | {"--makeconverttable", 1, 1, MakeConvertTable, {H_Decode,0}, "file"}, |
7992 | #endif | 7992 | #endif |
7993 | {"", 0, 0, NULL } | 7993 | {"", 0, 0, NULL } |
7994 | }; | 7994 | }; |
7995 | 7995 | ||
7996 | static HelpCategoryDescriptions HelpDescriptions[] = { | 7996 | static HelpCategoryDescriptions HelpDescriptions[] = { |
7997 | {H_Call, "call", "Calls",}, | 7997 | {H_Call, "call", "Calls",}, |
7998 | {H_SMS, "sms", "SMS and EMS"}, | 7998 | {H_SMS, "sms", "SMS and EMS"}, |
7999 | {H_Memory, "memory","Memory (phonebooks and calls)"}, | 7999 | {H_Memory, "memory","Memory (phonebooks and calls)"}, |
8000 | {H_Filesystem, "filesystem","Filesystem"}, | 8000 | {H_Filesystem, "filesystem","Filesystem"}, |
8001 | {H_Logo, "logo", "Logo and pictures"}, | 8001 | {H_Logo, "logo", "Logo and pictures"}, |
8002 | {H_Ringtone, "ringtone","Ringtones"}, | 8002 | {H_Ringtone, "ringtone","Ringtones"}, |
8003 | {H_Calendar, "calendar","Calendar notes"}, | 8003 | {H_Calendar, "calendar","Calendar notes"}, |
8004 | {H_ToDo, "todo", "To do lists"}, | 8004 | {H_ToDo, "todo", "To do lists"}, |
8005 | {H_Note, "note", "Notes"}, | 8005 | {H_Note, "note", "Notes"}, |
8006 | {H_DateTime, "datetime","Date, time and alarms"}, | 8006 | {H_DateTime, "datetime","Date, time and alarms"}, |
8007 | {H_Category, "category","Categories"}, | 8007 | {H_Category, "category","Categories"}, |
8008 | #ifdef GSM_ENABLE_BACKUP | 8008 | #ifdef GSM_ENABLE_BACKUP |
8009 | {H_Backup, "backup","Backing up and restoring"}, | 8009 | {H_Backup, "backup","Backing up and restoring"}, |
8010 | #endif | 8010 | #endif |
8011 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | 8011 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) |
8012 | {H_Nokia, "nokia","Nokia specific"}, | 8012 | {H_Nokia, "nokia","Nokia specific"}, |
8013 | #endif | 8013 | #endif |
8014 | #ifdef GSM_ENABLE_AT | 8014 | #ifdef GSM_ENABLE_AT |
8015 | {H_Siemens, "siemens","Siemens specific"}, | 8015 | {H_Siemens, "siemens","Siemens specific"}, |
8016 | #endif | 8016 | #endif |
8017 | {H_Network, "network","Network"}, | 8017 | {H_Network, "network","Network"}, |
8018 | {H_WAP, "wap", "WAP settings and bookmarks"}, | 8018 | {H_WAP, "wap", "WAP settings and bookmarks"}, |
8019 | {H_MMS, "mms", "MMS and MMS settings"}, | 8019 | {H_MMS, "mms", "MMS and MMS settings"}, |
8020 | {H_Tests, "tests","Phone tests"}, | 8020 | {H_Tests, "tests","Phone tests"}, |
8021 | {H_FM, "fm", "FM radio"}, | 8021 | {H_FM, "fm", "FM radio"}, |
8022 | {H_Info, "info", "Phone information"}, | 8022 | {H_Info, "info", "Phone information"}, |
8023 | {H_Settings, "settings","Phone settings"}, | 8023 | {H_Settings, "settings","Phone settings"}, |
8024 | #ifdef DEBUG | 8024 | #ifdef DEBUG |
8025 | {H_Decode, "decode","Dumps decoding"}, | 8025 | {H_Decode, "decode","Dumps decoding"}, |
8026 | #endif | 8026 | #endif |
8027 | {H_Other, "other","Functions that don't fit elsewhere"}, | 8027 | {H_Other, "other","Functions that don't fit elsewhere"}, |
8028 | {0, NULL, NULL} | 8028 | {0, NULL, NULL} |
8029 | }; | 8029 | }; |
8030 | 8030 | ||
8031 | 8031 | ||
8032 | void HelpHeader(void) | 8032 | void HelpHeader(void) |
8033 | { | 8033 | { |
8034 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); | 8034 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); |
8035 | } | 8035 | } |
8036 | 8036 | ||
8037 | static void HelpGeneral(void) | 8037 | static void HelpGeneral(void) |
8038 | { | 8038 | { |
8039 | inti=0; | 8039 | inti=0; |
8040 | 8040 | ||
8041 | HelpHeader(); | 8041 | HelpHeader(); |
8042 | 8042 | ||
8043 | printmsg("Usage: gammu [confign] [nothing|text|textall|binary|errors] [options]\n\n"); | 8043 | printmsg("Usage: gammu [confign] [nothing|text|textall|binary|errors] [options]\n\n"); |
8044 | printmsg("First parameter optionally specifies which config section to use (by default are probed all).\n"); | 8044 | printmsg("First parameter optionally specifies which config section to use (by default are probed all).\n"); |
8045 | printmsg("Second parameter optionally controls debug level, next specify actions.\n\n"); | 8045 | printmsg("Second parameter optionally controls debug level, next specify actions.\n\n"); |
8046 | 8046 | ||
8047 | /* We might want to put here some most used commands */ | 8047 | /* We might want to put here some most used commands */ |
8048 | printmsg("For more details call help on specific topic (gammu --help topic), topics are:\n\n"); | 8048 | printmsg("For more details call help on specific topic (gammu --help topic), topics are:\n\n"); |
8049 | 8049 | ||
8050 | while (HelpDescriptions[i].category != 0) { | 8050 | while (HelpDescriptions[i].category != 0) { |
8051 | printf("%11s - %s\n", HelpDescriptions[i].option, HelpDescriptions[i].description); | 8051 | printf("%11s - %s\n", HelpDescriptions[i].option, HelpDescriptions[i].description); |
8052 | i++; | 8052 | i++; |
8053 | } | 8053 | } |
8054 | printf("\n"); | 8054 | printf("\n"); |
8055 | } | 8055 | } |
8056 | 8056 | ||
8057 | static void HelpSplit(int cols, int len, unsigned char *buff) | 8057 | static void HelpSplit(int cols, int len, unsigned char *buff) |
8058 | { | 8058 | { |
8059 | int l, len2, pos, split; | 8059 | int l, len2, pos, split; |
8060 | bool in_opt,first=true; | 8060 | bool in_opt,first=true; |
8061 | char *remain, spaces[50], buffer[500]; | 8061 | char *remain, spaces[50], buffer[500]; |
8062 | 8062 | ||
8063 | if (cols == 0) { | 8063 | if (cols == 0) { |
8064 | printf(" %s\n", buff); | 8064 | printf(" %s\n", buff); |
8065 | } else { | 8065 | } else { |
8066 | printf(" "); | 8066 | printf(" "); |
8067 | spaces[0] = 0; | 8067 | spaces[0] = 0; |
8068 | len2 = strlen(buff); | 8068 | len2 = strlen(buff); |
8069 | if (len + len2 < cols) { | 8069 | if (len + len2 < cols) { |
8070 | printf("%s\n", buff); | 8070 | printf("%s\n", buff); |
8071 | } else { | 8071 | } else { |
8072 | for(l = 0; l < len; l++) strcat(spaces, " "); | 8072 | for(l = 0; l < len; l++) strcat(spaces, " "); |
8073 | 8073 | ||
8074 | remain = buff; | 8074 | remain = buff; |
8075 | 8075 | ||
8076 | while (strlen(remain) > 0) { | 8076 | while (strlen(remain) > 0) { |
8077 | split= 0; | 8077 | split= 0; |
8078 | pos= 0; | 8078 | pos= 0; |
8079 | in_opt= false; | 8079 | in_opt= false; |
8080 | if (!first) printf(spaces); | 8080 | if (!first) printf(spaces); |
8081 | while (pos < cols - len && remain[pos] != 0) { | 8081 | while (pos < cols - len && remain[pos] != 0) { |
8082 | if (in_opt && remain[pos] == ']') { | 8082 | if (in_opt && remain[pos] == ']') { |
8083 | in_opt = false; | 8083 | in_opt = false; |
8084 | split = pos; | 8084 | split = pos; |
8085 | } else if (remain[pos] == '[') { | 8085 | } else if (remain[pos] == '[') { |
8086 | in_opt = true; | 8086 | in_opt = true; |
8087 | } else if (!in_opt && remain[pos] == ' ') { | 8087 | } else if (!in_opt && remain[pos] == ' ') { |
8088 | split = pos - 1; | 8088 | split = pos - 1; |
8089 | } | 8089 | } |
8090 | pos++; | 8090 | pos++; |
8091 | } | 8091 | } |
8092 | /* Can not be split */ | 8092 | /* Can not be split */ |
8093 | if (split == 0) { | 8093 | if (split == 0) { |
8094 | printf("%s\n", remain); | 8094 | printf("%s\n", remain); |
8095 | remain += strlen(remain); | 8095 | remain += strlen(remain); |
8096 | } else { | 8096 | } else { |
8097 | first = false; | 8097 | first = false; |
8098 | split++; | 8098 | split++; |
8099 | strncpy(buffer, remain, split); | 8099 | strncpy(buffer, remain, split); |
8100 | buffer[split] = 0; | 8100 | buffer[split] = 0; |
8101 | printf("%s\n", buffer); | 8101 | printf("%s\n", buffer); |
8102 | remain += split; | 8102 | remain += split; |
8103 | if (remain[0] == ' ') remain++; | 8103 | if (remain[0] == ' ') remain++; |
8104 | } | 8104 | } |
8105 | } | 8105 | } |
8106 | } | 8106 | } |
8107 | } | 8107 | } |
8108 | } | 8108 | } |
8109 | 8109 | ||
8110 | static void Help(int argc, char *argv[]) | 8110 | static void Help(int argc, char *argv[]) |
8111 | { | 8111 | { |
8112 | int i = 0, j = 0, k, cols; | 8112 | int i = 0, j = 0, k, cols; |
8113 | bool disp; | 8113 | bool disp; |
8114 | #ifdef TIOCGWINSZ | 8114 | #ifdef TIOCGWINSZ |
8115 | struct winsize w; | 8115 | struct winsize w; |
8116 | #endif | 8116 | #endif |
8117 | #if defined(WIN32) || defined(DJGPP) | 8117 | #if defined(WIN32) || defined(DJGPP) |
8118 | #else | 8118 | #else |
8119 | char *columns; | 8119 | char *columns; |
8120 | #endif | 8120 | #endif |
8121 | 8121 | ||
8122 | /* Just --help */ | 8122 | /* Just --help */ |
8123 | if (argc == 2) { | 8123 | if (argc == 2) { |
8124 | HelpGeneral(); | 8124 | HelpGeneral(); |
8125 | return; | 8125 | return; |
8126 | } | 8126 | } |
8127 | 8127 | ||
8128 | if (!strcmp(argv[2],"all")) { | 8128 | if (!strcmp(argv[2],"all")) { |
8129 | HelpHeader(); | 8129 | HelpHeader(); |
8130 | } else { | 8130 | } else { |
8131 | while (HelpDescriptions[i].category != 0) { | 8131 | while (HelpDescriptions[i].category != 0) { |
8132 | if (strcmp(argv[2], HelpDescriptions[i].option) == 0) break; | 8132 | if (strcmp(argv[2], HelpDescriptions[i].option) == 0) break; |
8133 | i++; | 8133 | i++; |
8134 | } | 8134 | } |
8135 | if (HelpDescriptions[i].category == 0) { | 8135 | if (HelpDescriptions[i].category == 0) { |
8136 | HelpGeneral(); | 8136 | HelpGeneral(); |
8137 | printmsg("Unknown help topic specified!\n"); | 8137 | printmsg("Unknown help topic specified!\n"); |
8138 | return; | 8138 | return; |
8139 | } | 8139 | } |
8140 | HelpHeader(); | 8140 | HelpHeader(); |
8141 | printmsg("Gammu parameters, topic: %s\n\n", HelpDescriptions[i].description); | 8141 | printmsg("Gammu parameters, topic: %s\n\n", HelpDescriptions[i].description); |
8142 | } | 8142 | } |
8143 | 8143 | ||
8144 | #if defined(WIN32) || defined(DJGPP) | 8144 | #if defined(WIN32) || defined(DJGPP) |
8145 | cols = 80; | 8145 | cols = 80; |
8146 | #else | 8146 | #else |
8147 | cols = 0; | 8147 | cols = 0; |
8148 | /* If stdout is a tty, we will wrap to columns it has */ | 8148 | /* If stdout is a tty, we will wrap to columns it has */ |
8149 | if (isatty(1)) { | 8149 | if (isatty(1)) { |
8150 | #ifdef TIOCGWINSZ | 8150 | #ifdef TIOCGWINSZ |
8151 | if (ioctl(2, TIOCGWINSZ, &w) == 0) { | 8151 | if (ioctl(2, TIOCGWINSZ, &w) == 0) { |
8152 | if (w.ws_col > 0) cols = w.ws_col; | 8152 | if (w.ws_col > 0) cols = w.ws_col; |
8153 | } | 8153 | } |
8154 | #endif | 8154 | #endif |
8155 | if (cols == 0) { | 8155 | if (cols == 0) { |
8156 | columns = getenv("COLUMNS"); | 8156 | columns = getenv("COLUMNS"); |
8157 | if (columns != NULL) { | 8157 | if (columns != NULL) { |
8158 | cols = atoi(columns); | 8158 | cols = atoi(columns); |
8159 | if (cols <= 0) cols = 0; | 8159 | if (cols <= 0) cols = 0; |
8160 | } | 8160 | } |
8161 | } | 8161 | } |
8162 | 8162 | ||
8163 | if (cols == 0) { | 8163 | if (cols == 0) { |
8164 | /* Fallback */ | 8164 | /* Fallback */ |
8165 | cols = 80; | 8165 | cols = 80; |
8166 | } | 8166 | } |
8167 | } | 8167 | } |
8168 | #endif | 8168 | #endif |
8169 | 8169 | ||
8170 | while (Parameters[j].Function != NULL) { | 8170 | while (Parameters[j].Function != NULL) { |
8171 | k = 0; | 8171 | k = 0; |
8172 | disp = false; | 8172 | disp = false; |
8173 | if (!strcmp(argv[2],"all")) { | 8173 | if (!strcmp(argv[2],"all")) { |
8174 | if (j==0) disp = true; | 8174 | if (j==0) disp = true; |
8175 | if (j!=0) { | 8175 | if (j!=0) { |
8176 | if (strcmp(Parameters[j].help,Parameters[j-1].help)) { | 8176 | if (strcmp(Parameters[j].help,Parameters[j-1].help)) { |
8177 | disp = true; | 8177 | disp = true; |
8178 | } else { | 8178 | } else { |
8179 | if (strcmp(Parameters[j].parameter,Parameters[j-1].parameter)) { | 8179 | if (strcmp(Parameters[j].parameter,Parameters[j-1].parameter)) { |
8180 | disp = true; | 8180 | disp = true; |
8181 | } | 8181 | } |
8182 | } | 8182 | } |
8183 | } | 8183 | } |
8184 | } else { | 8184 | } else { |
8185 | while (Parameters[j].help_cat[k] != 0) { | 8185 | while (Parameters[j].help_cat[k] != 0) { |
8186 | if (Parameters[j].help_cat[k] == HelpDescriptions[i].category) { | 8186 | if (Parameters[j].help_cat[k] == HelpDescriptions[i].category) { |
8187 | disp = true; | 8187 | disp = true; |
8188 | break; | 8188 | break; |
8189 | } | 8189 | } |
8190 | k++; | 8190 | k++; |
8191 | } | 8191 | } |
8192 | } | 8192 | } |
8193 | if (disp) { | 8193 | if (disp) { |
8194 | printf("%s", Parameters[j].parameter); | 8194 | printf("%s", Parameters[j].parameter); |
8195 | if (Parameters[j].help[0] == 0) { | 8195 | if (Parameters[j].help[0] == 0) { |
8196 | printf("\n"); | 8196 | printf("\n"); |
8197 | } else { | 8197 | } else { |
8198 | HelpSplit(cols - 1, strlen(Parameters[j].parameter) + 1, Parameters[j].help); | 8198 | HelpSplit(cols - 1, strlen(Parameters[j].parameter) + 1, Parameters[j].help); |
8199 | } | 8199 | } |
8200 | } | 8200 | } |
8201 | j++; | 8201 | j++; |
8202 | } | 8202 | } |
8203 | } | 8203 | } |
8204 | #if 0 | 8204 | #if 0 |
8205 | #endif // 0 | 8205 | #endif // 0 |
8206 | int main(int argc, char *argv[]) | 8206 | int main(int argc, char *argv[]) |
8207 | { | 8207 | { |
8208 | 8208 | ||
8209 | //fprintf(stderr,"HIIIIIIIIIIIII \n"); | 8209 | //fprintf(stderr,"HIIIIIIIIIIIII \n"); |
8210 | //#if 0 | 8210 | //#if 0 |
8211 | static int z ,start,i; | 8211 | static int z ,start,i; |
8212 | static intonly_config ; | 8212 | static intonly_config ; |
8213 | #if !defined(WIN32) && defined(LOCALE_PATH) | 8213 | #if !defined(WIN32) && defined(LOCALE_PATH) |
8214 | static char*locale, locale_file[201]; | 8214 | static char*locale, locale_file[201]; |
8215 | #endif | 8215 | #endif |
8216 | static char*cp; | 8216 | static char*cp; |
8217 | static boolcount_failed; | 8217 | static boolcount_failed; |
8218 | z = 0; | 8218 | z = 0; |
8219 | start=0;only_config = -1;count_failed = false; | 8219 | start=0;only_config = -1;count_failed = false; |
8220 | s.opened = false; | 8220 | s.opened = false; |
8221 | s.msg = NULL; | 8221 | s.msg = NULL; |
8222 | s.ConfigNum = 0; | 8222 | s.ConfigNum = 0; |
8223 | 8223 | ||
8224 | setlocale(LC_ALL, ""); | 8224 | setlocale(LC_ALL, ""); |
8225 | #ifdef DEBUG | 8225 | #ifdef DEBUG |
8226 | di.dl = DL_TEXTALL; | 8226 | di.dl = DL_TEXTALL; |
8227 | di.df = stdout; | 8227 | di.df = stdout; |
8228 | #endif | 8228 | #endif |
8229 | //#if 0 | 8229 | //#if 0 |
8230 | /* Any parameters? */ | 8230 | /* Any parameters? */ |
8231 | if (argc == 1) { | 8231 | if (argc == 1) { |
8232 | HelpGeneral(); | 8232 | HelpGeneral(); |
8233 | printmsg("Too few parameters!\n"); | 8233 | printmsg("Too few parameters!\n"); |
8234 | exit(1); | 8234 | exit(1); |
8235 | } | 8235 | } |
8236 | 8236 | ||
8237 | /* Help? */ | 8237 | /* Help? */ |
8238 | if (strncmp(argv[1 + start], "--help", 6) == 0) { | 8238 | if (strncmp(argv[1 + start], "--help", 6) == 0) { |
8239 | Help(argc - start, argv + start); | 8239 | Help(argc - start, argv + start); |
8240 | exit(1); | 8240 | exit(1); |
8241 | } | 8241 | } |
8242 | 8242 | ||
8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ | 8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ |
8244 | if (isdigit(argv[1][0])) { | 8244 | //if (isdigit(argv[1][0])) { |
8245 | only_config = atoi(argv[1]); | 8245 | //only_config = atoi(argv[1]); |
8246 | if (only_config >= 0) start++; else only_config = -1; | 8246 | //if (only_config >= 0) start++; else only_config = -1; |
8247 | } | 8247 | //} |
8248 | 8248 | only_config = 0;; | |
8249 | #if 0 | ||
8249 | GSM_ReadConfig(NULL, &s.Config[0], 0); | 8250 | GSM_ReadConfig(NULL, &s.Config[0], 0); |
8250 | s.ConfigNum = 1; | 8251 | s.ConfigNum = 1; |
8251 | GSM_Config *con = &s.Config[0]; | 8252 | GSM_Config *con = &s.Config[0]; |
8252 | 8253 | ||
8253 | char* tempC; | 8254 | char* tempC; |
8254 | tempC = argv[argc-1]+2; | 8255 | tempC = argv[argc-1]+2; |
8255 | if ( *tempC != 0 ) { | 8256 | if ( *tempC != 0 ) { |
8256 | fprintf(stderr,"Using model %s \n",tempC); | 8257 | fprintf(stderr,"Using model %s \n",tempC); |
8257 | strcpy(con->Model,tempC ); | 8258 | strcpy(con->Model,tempC ); |
8258 | } | 8259 | } |
8259 | tempC = argv[argc-2]+2; | 8260 | tempC = argv[argc-2]+2; |
8260 | if ( *tempC != 0 ) { | 8261 | if ( *tempC != 0 ) { |
8261 | fprintf(stderr,"Using device %s \n",tempC); | 8262 | fprintf(stderr,"Using device %s \n",tempC); |
8262 | con->Device = strdup(tempC); | 8263 | con->Device = strdup(tempC); |
8263 | con->DefaultDevice = false; | 8264 | con->DefaultDevice = false; |
8264 | } | 8265 | } |
8265 | tempC = argv[argc-3]+2; | 8266 | tempC = argv[argc-3]+2; |
8266 | if ( *tempC != 0 ) { | 8267 | if ( *tempC != 0 ) { |
8267 | fprintf(stderr,"Using connection %s \n",tempC); | 8268 | fprintf(stderr,"Using connection %s \n",tempC); |
8268 | con->Connection = strdup(tempC); | 8269 | con->Connection = strdup(tempC); |
8269 | con->DefaultConnection = false; | 8270 | con->DefaultConnection = false; |
8270 | } | 8271 | } |
8271 | argc = argc-3; | 8272 | argc = argc-3; |
8272 | #if 0 | 8273 | //#if 0 |
8273 | if ( ! mConnection.isEmpty() ) { | 8274 | if ( ! mConnection.isEmpty() ) { |
8274 | cfg->Connection = strdup(mConnection.latin1()); | 8275 | cfg->Connection = strdup(mConnection.latin1()); |
8275 | cfg->DefaultConnection = false; | 8276 | cfg->DefaultConnection = false; |
8276 | qDebug("Connection set %s ", cfg->Connection ); | 8277 | qDebug("Connection set %s ", cfg->Connection ); |
8277 | 8278 | ||
8278 | } | 8279 | } |
8279 | if ( ! mDevice.isEmpty() ) { | 8280 | if ( ! mDevice.isEmpty() ) { |
8280 | cfg->Device = strdup(mDevice.latin1()); | 8281 | cfg->Device = strdup(mDevice.latin1()); |
8281 | cfg->DefaultDevice = false; | 8282 | cfg->DefaultDevice = false; |
8282 | qDebug("Device set %s ", cfg->Device); | 8283 | qDebug("Device set %s ", cfg->Device); |
8283 | 8284 | ||
8284 | } | 8285 | } |
8285 | if ( ! mModel.isEmpty() ) { | 8286 | if ( ! mModel.isEmpty() ) { |
8286 | strcpy(cfg->Model,mModel.latin1() ); | 8287 | strcpy(cfg->Model,mModel.latin1() ); |
8287 | cfg->DefaultModel = false; | 8288 | cfg->DefaultModel = false; |
8288 | qDebug("Model set %s ",cfg->Model ); | 8289 | qDebug("Model set %s ",cfg->Model ); |
8289 | } | 8290 | } |
8290 | 8291 | ||
8291 | #endif | 8292 | #endif |
8292 | 8293 | ||
8293 | #if 0 | 8294 | |
8294 | cfg=GSM_FindGammuRC(); | 8295 | cfg=GSM_FindGammuRC(); |
8295 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 8296 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
8296 | if (cfg!=NULL) { | 8297 | if (cfg!=NULL) { |
8297 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); | 8298 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); |
8298 | if (cp) di.coding = cp; | 8299 | if (cp) di.coding = cp; |
8299 | 8300 | ||
8300 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); | 8301 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); |
8301 | if (s.Config[i].Localize) { | 8302 | if (s.Config[i].Localize) { |
8302 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | 8303 | s.msg=INI_ReadFile(s.Config[i].Localize, true); |
8303 | } else { | 8304 | } else { |
8304 | #if !defined(WIN32) && defined(LOCALE_PATH) | 8305 | #if !defined(WIN32) && defined(LOCALE_PATH) |
8305 | locale = setlocale(LC_MESSAGES, NULL); | 8306 | locale = setlocale(LC_MESSAGES, NULL); |
8306 | if (locale != NULL) { | 8307 | if (locale != NULL) { |
8307 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | 8308 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", |
8308 | LOCALE_PATH, | 8309 | LOCALE_PATH, |
8309 | tolower(locale[0]), | 8310 | tolower(locale[0]), |
8310 | tolower(locale[1])); | 8311 | tolower(locale[1])); |
8311 | s.msg = INI_ReadFile(locale_file, true); | 8312 | s.msg = INI_ReadFile(locale_file, true); |
8312 | } | 8313 | } |
8313 | #endif | 8314 | #endif |
8314 | } | 8315 | } |
8315 | } | 8316 | } |
8316 | 8317 | ||
8317 | /* Wanted user specific configuration? */ | 8318 | /* Wanted user specific configuration? */ |
8319 | |||
8318 | if (only_config != -1) { | 8320 | if (only_config != -1) { |
8319 | /* Here we get only in first for loop */ | 8321 | /* Here we get only in first for loop */ |
8320 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; | 8322 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; |
8321 | } else { | 8323 | } else { |
8322 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 8324 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
8323 | } | 8325 | } |
8324 | s.ConfigNum++; | 8326 | s.ConfigNum++; |
8325 | 8327 | ||
8326 | /* We want to use only one file descriptor for global and state machine debug output */ | 8328 | /* We want to use only one file descriptor for global and state machine debug output */ |
8327 | s.Config[i].UseGlobalDebugFile = true; | 8329 | s.Config[i].UseGlobalDebugFile = true; |
8328 | 8330 | ||
8329 | /* It makes no sense to open several debug logs... */ | 8331 | /* It makes no sense to open several debug logs... */ |
8330 | if (i != 0) { | 8332 | if (i != 0) { |
8331 | strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel); | 8333 | strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel); |
8332 | free(s.Config[i].DebugFile); | 8334 | free(s.Config[i].DebugFile); |
8333 | s.Config[i].DebugFile = strdup(s.Config[0].DebugFile); | 8335 | s.Config[i].DebugFile = strdup(s.Config[0].DebugFile); |
8334 | } else { | 8336 | } else { |
8335 | /* Just for first config */ | 8337 | /* Just for first config */ |
8336 | /* When user gave debug level on command line */ | 8338 | /* When user gave debug level on command line */ |
8337 | if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) { | 8339 | if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) { |
8338 | /* Debug level from command line will be used with phone too */ | 8340 | /* Debug level from command line will be used with phone too */ |
8339 | strcpy(s.Config[i].DebugLevel,argv[1 + start]); | 8341 | strcpy(s.Config[i].DebugLevel,argv[1 + start]); |
8340 | start++; | 8342 | start++; |
8341 | } else { | 8343 | } else { |
8342 | /* Try to set debug level from config file */ | 8344 | /* Try to set debug level from config file */ |
8343 | GSM_SetDebugLevel(s.Config[i].DebugLevel, &di); | 8345 | GSM_SetDebugLevel(s.Config[i].DebugLevel, &di); |
8344 | } | 8346 | } |
8345 | /* If user gave debug file in gammurc, we will use it */ | 8347 | /* If user gave debug file in gammurc, we will use it */ |
8346 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); | 8348 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); |
8347 | Print_Error(error); | 8349 | Print_Error(error); |
8348 | } | 8350 | } |
8349 | 8351 | ||
8350 | /* We wanted to read just user specified configuration. */ | 8352 | /* We wanted to read just user specified configuration. */ |
8351 | if (only_config != -1) {break;} | 8353 | if (only_config != -1) {break;} |
8352 | } | 8354 | } |
8355 | #if 0 | ||
8356 | GSM_Config *con = &s.Config[0]; | ||
8357 | |||
8358 | char* tempC; | ||
8359 | tempC = argv[argc-1]+2; | ||
8360 | if ( *tempC != 0 ) { | ||
8361 | fprintf(stderr,"Using model %s \n",tempC); | ||
8362 | strcpy(con->Model,tempC ); | ||
8363 | } | ||
8364 | tempC = argv[argc-2]+2; | ||
8365 | if ( *tempC != 0 ) { | ||
8366 | fprintf(stderr,"Using device %s \n",tempC); | ||
8367 | con->Device = strdup(tempC); | ||
8368 | con->DefaultDevice = false; | ||
8369 | } | ||
8370 | tempC = argv[argc-3]+2; | ||
8371 | if ( *tempC != 0 ) { | ||
8372 | fprintf(stderr,"Using connection %s \n",tempC); | ||
8373 | con->Connection = strdup(tempC); | ||
8374 | con->DefaultConnection = false; | ||
8375 | } | ||
8353 | #endif | 8376 | #endif |
8377 | argc = argc-3; | ||
8378 | |||
8379 | |||
8354 | /* Do we have enough parameters? */ | 8380 | /* Do we have enough parameters? */ |
8355 | if (argc == 1 + start) { | 8381 | if (argc == 1 + start) { |
8356 | HelpGeneral(); | 8382 | HelpGeneral(); |
8357 | printmsg("Too few parameters!\n"); | 8383 | printmsg("Too few parameters!\n"); |
8358 | exit(-2); | 8384 | exit(-2); |
8359 | } | 8385 | } |
8360 | 8386 | ||
8361 | /* Check used version vs. compiled */ | 8387 | /* Check used version vs. compiled */ |
8362 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { | 8388 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { |
8363 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", | 8389 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", |
8364 | GetGammuVersion(),VERSION); | 8390 | GetGammuVersion(),VERSION); |
8365 | exit(-1); | 8391 | exit(-1); |
8366 | } | 8392 | } |
8367 | 8393 | ||
8368 | /* Check parameters */ | 8394 | /* Check parameters */ |
8369 | while (Parameters[z].Function != NULL) { | 8395 | while (Parameters[z].Function != NULL) { |
8370 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { | 8396 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { |
8371 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { | 8397 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { |
8398 | fprintf(stderr,"Executing \n"); | ||
8372 | Parameters[z].Function(argc - start, argv + start); | 8399 | Parameters[z].Function(argc - start, argv + start); |
8373 | break; | 8400 | break; |
8374 | } else { | 8401 | } else { |
8375 | count_failed = true; | 8402 | count_failed = true; |
8376 | } | 8403 | } |
8377 | } | 8404 | } |
8378 | z++; | 8405 | z++; |
8379 | } | 8406 | } |
8380 | 8407 | ||
8381 | /* Tell user when we did nothing */ | 8408 | /* Tell user when we did nothing */ |
8382 | if (Parameters[z].Function == NULL) { | 8409 | if (Parameters[z].Function == NULL) { |
8383 | HelpGeneral(); | 8410 | HelpGeneral(); |
8384 | if (count_failed) { | 8411 | if (count_failed) { |
8385 | printmsg("Bad parameter count!\n"); | 8412 | printmsg("Bad parameter count!\n"); |
8386 | } else { | 8413 | } else { |
8387 | printmsg("Bad option!\n"); | 8414 | printmsg("Bad option!\n"); |
8388 | } | 8415 | } |
8389 | } | 8416 | } |
8390 | 8417 | ||
8391 | /* Close debug output if opened */ | 8418 | /* Close debug output if opened */ |
8392 | if (di.df!=stdout) fclose(di.df); | 8419 | if (di.df!=stdout) fclose(di.df); |
8393 | //#endif // 0 | 8420 | //#endif // 0 |
8394 | fprintf(stderr,"kammu: Success. End. \n"); | 8421 | fprintf(stderr,"kammu: Success. End. \n"); |
8395 | exit(0); | 8422 | exit(0); |
8396 | } | 8423 | } |
8397 | 8424 | ||
8398 | /* How should editor hadle tabs in this file? Add editor commands here. | 8425 | /* How should editor hadle tabs in this file? Add editor commands here. |
8399 | * vim: noexpandtab sw=8 ts=8 sts=8: | 8426 | * vim: noexpandtab sw=8 ts=8 sts=8: |
8400 | */ | 8427 | */ |
8401 | 8428 | ||
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 2ad1b5a..6df639f 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -1,583 +1,620 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
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 <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | #include <qxml.h> | 32 | #include <qxml.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | 34 | ||
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kmessagebox.h> | ||
38 | 39 | ||
39 | #include "calendar.h" | 40 | #include "calendar.h" |
40 | #include "alarm.h" | 41 | #include "alarm.h" |
41 | #include "recurrence.h" | 42 | #include "recurrence.h" |
42 | #include "calendarlocal.h" | 43 | #include "calendarlocal.h" |
43 | 44 | ||
44 | #include "phoneformat.h" | 45 | #include "phoneformat.h" |
45 | #include "syncdefines.h" | 46 | #include "syncdefines.h" |
46 | 47 | ||
47 | using namespace KCal; | 48 | using namespace KCal; |
48 | class PhoneParser : public QObject | 49 | class PhoneParser : public QObject |
49 | { | 50 | { |
50 | public: | 51 | public: |
51 | PhoneParser( ) { | 52 | PhoneParser( ) { |
52 | ; | 53 | ; |
53 | } | 54 | } |
54 | 55 | ||
55 | static QString dtToString( const QDateTime& dti, bool useTZ = false ) | 56 | static QString dtToString( const QDateTime& dti, bool useTZ = false ) |
56 | { | 57 | { |
57 | QString datestr; | 58 | QString datestr; |
58 | QString timestr; | 59 | QString timestr; |
59 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 60 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
60 | QDateTime dt; | 61 | QDateTime dt; |
61 | if (useTZ) | 62 | if (useTZ) |
62 | dt = dti.addSecs ( -(offset*60)); | 63 | dt = dti.addSecs ( -(offset*60)); |
63 | else | 64 | else |
64 | dt = dti; | 65 | dt = dti; |
65 | if(dt.date().isValid()){ | 66 | if(dt.date().isValid()){ |
66 | const QDate& date = dt.date(); | 67 | const QDate& date = dt.date(); |
67 | datestr.sprintf("%04d%02d%02d", | 68 | datestr.sprintf("%04d%02d%02d", |
68 | date.year(), date.month(), date.day()); | 69 | date.year(), date.month(), date.day()); |
69 | } | 70 | } |
70 | if(dt.time().isValid()){ | 71 | if(dt.time().isValid()){ |
71 | const QTime& time = dt.time(); | 72 | const QTime& time = dt.time(); |
72 | timestr.sprintf("T%02d%02d%02d", | 73 | timestr.sprintf("T%02d%02d%02d", |
73 | time.hour(), time.minute(), time.second()); | 74 | time.hour(), time.minute(), time.second()); |
74 | } | 75 | } |
75 | return datestr + timestr; | 76 | return datestr + timestr; |
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||
79 | }; | 80 | }; |
80 | 81 | ||
81 | 82 | ||
82 | 83 | ||
83 | PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, QString model ) | 84 | PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, QString model ) |
84 | { | 85 | { |
85 | mProfileName = profileName; | 86 | mProfileName = profileName; |
86 | mDevice = device; | 87 | mDevice = device; |
87 | mConnection = connection; | 88 | mConnection = connection; |
88 | mModel = model; | 89 | mModel = model; |
89 | } | 90 | } |
90 | 91 | ||
91 | PhoneFormat::~PhoneFormat() | 92 | PhoneFormat::~PhoneFormat() |
92 | { | 93 | { |
93 | } | 94 | } |
94 | #if 0 | 95 | #if 0 |
95 | int PhoneFormat::initDevice(GSM_StateMachine *s) | 96 | int PhoneFormat::initDevice(GSM_StateMachine *s) |
96 | { | 97 | { |
97 | GSM_ReadConfig(NULL, &s->Config[0], 0); | 98 | GSM_ReadConfig(NULL, &s->Config[0], 0); |
98 | s->ConfigNum = 1; | 99 | s->ConfigNum = 1; |
99 | GSM_Config *cfg = &s->Config[0]; | 100 | GSM_Config *cfg = &s->Config[0]; |
100 | if ( ! mConnection.isEmpty() ) { | 101 | if ( ! mConnection.isEmpty() ) { |
101 | cfg->Connection = strdup(mConnection.latin1()); | 102 | cfg->Connection = strdup(mConnection.latin1()); |
102 | cfg->DefaultConnection = false; | 103 | cfg->DefaultConnection = false; |
103 | qDebug("Connection set %s ", cfg->Connection ); | 104 | qDebug("Connection set %s ", cfg->Connection ); |
104 | 105 | ||
105 | } | 106 | } |
106 | if ( ! mDevice.isEmpty() ) { | 107 | if ( ! mDevice.isEmpty() ) { |
107 | cfg->Device = strdup(mDevice.latin1()); | 108 | cfg->Device = strdup(mDevice.latin1()); |
108 | cfg->DefaultDevice = false; | 109 | cfg->DefaultDevice = false; |
109 | qDebug("Device set %s ", cfg->Device); | 110 | qDebug("Device set %s ", cfg->Device); |
110 | 111 | ||
111 | } | 112 | } |
112 | if ( ! mModel.isEmpty() ) { | 113 | if ( ! mModel.isEmpty() ) { |
113 | strcpy(cfg->Model,mModel.latin1() ); | 114 | strcpy(cfg->Model,mModel.latin1() ); |
114 | cfg->DefaultModel = false; | 115 | cfg->DefaultModel = false; |
115 | qDebug("Model set %s ",cfg->Model ); | 116 | qDebug("Model set %s ",cfg->Model ); |
116 | } | 117 | } |
117 | int error=GSM_InitConnection(s,3); | 118 | int error=GSM_InitConnection(s,3); |
118 | return error; | 119 | return error; |
119 | } | 120 | } |
120 | #endif | 121 | #endif |
121 | ulong PhoneFormat::getCsumTodo( Todo* todo ) | 122 | ulong PhoneFormat::getCsumTodo( Todo* todo ) |
122 | { | 123 | { |
123 | QStringList attList; | 124 | QStringList attList; |
124 | if ( todo->hasDueDate() ) | 125 | if ( todo->hasDueDate() ) |
125 | attList << PhoneParser::dtToString ( todo->dtDue() ); | 126 | attList << PhoneParser::dtToString ( todo->dtDue() ); |
126 | attList << todo->summary(); | 127 | attList << todo->summary(); |
127 | QString completedString = "no"; | 128 | QString completedString = "no"; |
128 | if ( todo->isCompleted() ) | 129 | if ( todo->isCompleted() ) |
129 | completedString = "yes"; | 130 | completedString = "yes"; |
130 | attList << completedString; | 131 | attList << completedString; |
131 | attList << QString::number( todo->priority() ); | 132 | attList << QString::number( todo->priority() ); |
132 | QString alarmString = "na"; | 133 | QString alarmString = "na"; |
133 | Alarm *alarm; | 134 | Alarm *alarm; |
134 | if ( todo->alarms().count() > 0 ) { | 135 | if ( todo->alarms().count() > 0 ) { |
135 | alarm = todo->alarms().first(); | 136 | alarm = todo->alarms().first(); |
136 | if ( alarm->enabled() ) { | 137 | if ( alarm->enabled() ) { |
137 | alarmString = QString::number(alarm->startOffset().asSeconds() ); | 138 | alarmString = QString::number(alarm->startOffset().asSeconds() ); |
138 | } | 139 | } |
139 | } | 140 | } |
140 | attList << alarmString; | 141 | attList << alarmString; |
141 | attList << todo->categoriesStr(); | 142 | attList << todo->categoriesStr(); |
142 | attList << todo->secrecyStr(); | 143 | attList << todo->secrecyStr(); |
143 | return PhoneFormat::getCsum(attList ); | 144 | return PhoneFormat::getCsum(attList ); |
144 | 145 | ||
145 | } | 146 | } |
146 | ulong PhoneFormat::getCsumEvent( Event* event ) | 147 | ulong PhoneFormat::getCsumEvent( Event* event ) |
147 | { | 148 | { |
148 | QStringList attList; | 149 | QStringList attList; |
149 | attList << PhoneParser::dtToString ( event->dtStart() ); | 150 | attList << PhoneParser::dtToString ( event->dtStart() ); |
150 | attList << PhoneParser::dtToString ( event->dtEnd() ); | 151 | attList << PhoneParser::dtToString ( event->dtEnd() ); |
151 | attList << event->summary(); | 152 | attList << event->summary(); |
152 | attList << event->location(); | 153 | attList << event->location(); |
153 | QString alarmString = "na"; | 154 | QString alarmString = "na"; |
154 | Alarm *alarm; | 155 | Alarm *alarm; |
155 | if ( event->alarms().count() > 0 ) { | 156 | if ( event->alarms().count() > 0 ) { |
156 | alarm = event->alarms().first(); | 157 | alarm = event->alarms().first(); |
157 | if ( alarm->enabled() ) { | 158 | if ( alarm->enabled() ) { |
158 | alarmString = QString::number( alarm->startOffset().asSeconds() ); | 159 | alarmString = QString::number( alarm->startOffset().asSeconds() ); |
159 | } | 160 | } |
160 | } | 161 | } |
161 | attList << alarmString; | 162 | attList << alarmString; |
162 | Recurrence* rec = event->recurrence(); | 163 | Recurrence* rec = event->recurrence(); |
163 | QStringList list; | 164 | QStringList list; |
164 | bool writeEndDate = false; | 165 | bool writeEndDate = false; |
165 | switch ( rec->doesRecur() ) | 166 | switch ( rec->doesRecur() ) |
166 | { | 167 | { |
167 | case Recurrence::rDaily: // 0 | 168 | case Recurrence::rDaily: // 0 |
168 | list.append( "0" ); | 169 | list.append( "0" ); |
169 | list.append( QString::number( rec->frequency() ));//12 | 170 | list.append( QString::number( rec->frequency() ));//12 |
170 | list.append( "0" ); | 171 | list.append( "0" ); |
171 | list.append( "0" ); | 172 | list.append( "0" ); |
172 | writeEndDate = true; | 173 | writeEndDate = true; |
173 | break; | 174 | break; |
174 | case Recurrence::rWeekly:// 1 | 175 | case Recurrence::rWeekly:// 1 |
175 | list.append( "1" ); | 176 | list.append( "1" ); |
176 | list.append( QString::number( rec->frequency()) );//12 | 177 | list.append( QString::number( rec->frequency()) );//12 |
177 | list.append( "0" ); | 178 | list.append( "0" ); |
178 | { | 179 | { |
179 | int days = 0; | 180 | int days = 0; |
180 | QBitArray weekDays = rec->days(); | 181 | QBitArray weekDays = rec->days(); |
181 | int i; | 182 | int i; |
182 | for( i = 1; i <= 7; ++i ) { | 183 | for( i = 1; i <= 7; ++i ) { |
183 | if ( weekDays[i-1] ) { | 184 | if ( weekDays[i-1] ) { |
184 | days += 1 << (i-1); | 185 | days += 1 << (i-1); |
185 | } | 186 | } |
186 | } | 187 | } |
187 | list.append( QString::number( days ) ); | 188 | list.append( QString::number( days ) ); |
188 | } | 189 | } |
189 | //pending weekdays | 190 | //pending weekdays |
190 | writeEndDate = true; | 191 | writeEndDate = true; |
191 | 192 | ||
192 | break; | 193 | break; |
193 | case Recurrence::rMonthlyPos:// 2 | 194 | case Recurrence::rMonthlyPos:// 2 |
194 | list.append( "2" ); | 195 | list.append( "2" ); |
195 | list.append( QString::number( rec->frequency()) );//12 | 196 | list.append( QString::number( rec->frequency()) );//12 |
196 | 197 | ||
197 | writeEndDate = true; | 198 | writeEndDate = true; |
198 | { | 199 | { |
199 | int count = 1; | 200 | int count = 1; |
200 | QPtrList<Recurrence::rMonthPos> rmp; | 201 | QPtrList<Recurrence::rMonthPos> rmp; |
201 | rmp = rec->monthPositions(); | 202 | rmp = rec->monthPositions(); |
202 | if ( rmp.first()->negative ) | 203 | if ( rmp.first()->negative ) |
203 | count = 5 - rmp.first()->rPos - 1; | 204 | count = 5 - rmp.first()->rPos - 1; |
204 | else | 205 | else |
205 | count = rmp.first()->rPos - 1; | 206 | count = rmp.first()->rPos - 1; |
206 | list.append( QString::number( count ) ); | 207 | list.append( QString::number( count ) ); |
207 | 208 | ||
208 | } | 209 | } |
209 | 210 | ||
210 | list.append( "0" ); | 211 | list.append( "0" ); |
211 | break; | 212 | break; |
212 | case Recurrence::rMonthlyDay:// 3 | 213 | case Recurrence::rMonthlyDay:// 3 |
213 | list.append( "3" ); | 214 | list.append( "3" ); |
214 | list.append( QString::number( rec->frequency()) );//12 | 215 | list.append( QString::number( rec->frequency()) );//12 |
215 | list.append( "0" ); | 216 | list.append( "0" ); |
216 | list.append( "0" ); | 217 | list.append( "0" ); |
217 | writeEndDate = true; | 218 | writeEndDate = true; |
218 | break; | 219 | break; |
219 | case Recurrence::rYearlyMonth://4 | 220 | case Recurrence::rYearlyMonth://4 |
220 | list.append( "4" ); | 221 | list.append( "4" ); |
221 | list.append( QString::number( rec->frequency()) );//12 | 222 | list.append( QString::number( rec->frequency()) );//12 |
222 | list.append( "0" ); | 223 | list.append( "0" ); |
223 | list.append( "0" ); | 224 | list.append( "0" ); |
224 | writeEndDate = true; | 225 | writeEndDate = true; |
225 | break; | 226 | break; |
226 | 227 | ||
227 | default: | 228 | default: |
228 | list.append( "255" ); | 229 | list.append( "255" ); |
229 | list.append( QString() ); | 230 | list.append( QString() ); |
230 | list.append( "0" ); | 231 | list.append( "0" ); |
231 | list.append( QString() ); | 232 | list.append( QString() ); |
232 | list.append( "0" ); | 233 | list.append( "0" ); |
233 | list.append( "20991231T000000" ); | 234 | list.append( "20991231T000000" ); |
234 | break; | 235 | break; |
235 | } | 236 | } |
236 | if ( writeEndDate ) { | 237 | if ( writeEndDate ) { |
237 | 238 | ||
238 | if ( rec->endDate().isValid() ) { // 15 + 16 | 239 | if ( rec->endDate().isValid() ) { // 15 + 16 |
239 | list.append( "1" ); | 240 | list.append( "1" ); |
240 | list.append( PhoneParser::dtToString( rec->endDate()) ); | 241 | list.append( PhoneParser::dtToString( rec->endDate()) ); |
241 | } else { | 242 | } else { |
242 | list.append( "0" ); | 243 | list.append( "0" ); |
243 | list.append( "20991231T000000" ); | 244 | list.append( "20991231T000000" ); |
244 | } | 245 | } |
245 | 246 | ||
246 | } | 247 | } |
247 | attList << list.join(""); | 248 | attList << list.join(""); |
248 | attList << event->categoriesStr(); | 249 | attList << event->categoriesStr(); |
250 | //qDebug("csum cat %s", event->categoriesStr().latin1()); | ||
251 | |||
249 | attList << event->secrecyStr(); | 252 | attList << event->secrecyStr(); |
250 | return PhoneFormat::getCsum(attList ); | 253 | return PhoneFormat::getCsum(attList ); |
251 | } | 254 | } |
252 | ulong PhoneFormat::getCsum( const QStringList & attList) | 255 | ulong PhoneFormat::getCsum( const QStringList & attList) |
253 | { | 256 | { |
254 | int max = attList.count() -1; | 257 | int max = attList.count() -1; |
255 | ulong cSum = 0; | 258 | ulong cSum = 0; |
256 | int j,k,i; | 259 | int j,k,i; |
257 | int add; | 260 | int add; |
258 | for ( i = 1; i < max ; ++i ) { | 261 | for ( i = 1; i < max ; ++i ) { |
259 | QString s = attList[i]; | 262 | QString s = attList[i]; |
260 | if ( ! s.isEmpty() ){ | 263 | if ( ! s.isEmpty() ){ |
261 | j = s.length(); | 264 | j = s.length(); |
262 | for ( k = 0; k < j; ++k ) { | 265 | for ( k = 0; k < j; ++k ) { |
263 | int mul = k +1; | 266 | int mul = k +1; |
264 | add = s[k].unicode (); | 267 | add = s[k].unicode (); |
265 | if ( k < 16 ) | 268 | if ( k < 16 ) |
266 | mul = mul * mul; | 269 | mul = mul * mul; |
267 | add = add * mul *i*i*i; | 270 | add = add * mul *i*i*i; |
268 | cSum += add; | 271 | cSum += add; |
269 | } | 272 | } |
270 | } | 273 | } |
271 | } | 274 | } |
275 | //QString dump = attList.join(","); | ||
276 | //qDebug("csum: %s", dump.latin1()); | ||
277 | |||
272 | return cSum; | 278 | return cSum; |
273 | 279 | ||
274 | } | 280 | } |
275 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); | 281 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); |
276 | #include <stdlib.h> | 282 | #include <stdlib.h> |
277 | #define DEBUGMODE false | 283 | #define DEBUGMODE false |
278 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | 284 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) |
279 | { | 285 | { |
280 | 286 | ||
281 | QString fileName; | 287 | QString fileName; |
282 | #ifdef _WIN32_ | 288 | #ifdef _WIN32_ |
283 | fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; | 289 | fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; |
284 | #else | 290 | #else |
285 | fileName = "/tmp/kdepimtemp.vcs"; | 291 | fileName = "/tmp/kdepimtemp.vcs"; |
286 | #endif | 292 | #endif |
287 | QString command ="./kammu --backup " + fileName + " -yes -C" + | 293 | QString command ="./kammu --backup " + fileName + " -yes -C" + |
288 | mConnection +" -D" + mDevice +" -M" + mModel; | 294 | mConnection +" -D" + mDevice +" -M" + mModel; |
289 | int ret = system ( command.latin1() ); | 295 | int ret = system ( command.latin1() ); |
290 | if ( ret != 0 ) | 296 | if ( ret != 0 ) { |
297 | qDebug("Error::command returned %d", ret); | ||
291 | return false; | 298 | return false; |
299 | } | ||
300 | qDebug("Command returned %d", ret); | ||
292 | VCalFormat vfload; | 301 | VCalFormat vfload; |
293 | vfload.setLocalTime ( true ); | 302 | vfload.setLocalTime ( true ); |
303 | qDebug("loading file ..."); | ||
304 | |||
294 | if ( ! vfload.load( calendar, fileName ) ) | 305 | if ( ! vfload.load( calendar, fileName ) ) |
295 | return false; | 306 | return false; |
296 | QPtrList<Event> er = calendar->rawEvents(); | 307 | QPtrList<Event> er = calendar->rawEvents(); |
297 | Event* ev = er.first(); | 308 | Event* ev = er.first(); |
309 | qDebug("reading events... "); | ||
298 | while ( ev ) { | 310 | while ( ev ) { |
311 | QStringList cat = ev->categories(); | ||
312 | if ( cat.contains( "MeetingDEF" )) { | ||
313 | ev->setCategories( QStringList() ); | ||
314 | } | ||
299 | int id = ev->pilotId(); | 315 | int id = ev->pilotId(); |
300 | Event *event; | 316 | Event *event; |
301 | event = existingCal->event( mProfileName ,QString::number( id ) ); | 317 | event = existingCal->event( mProfileName ,QString::number( id ) ); |
302 | if ( event ) { | 318 | if ( event ) { |
303 | event = (Event*)event->clone(); | 319 | event = (Event*)event->clone(); |
304 | copyEvent( event, ev ); | 320 | copyEvent( event, ev ); |
305 | calendar->deleteEvent( ev ); | 321 | calendar->deleteEvent( ev ); |
306 | calendar->addEvent( event); | 322 | calendar->addEvent( event); |
307 | } | 323 | } |
308 | else | 324 | else |
309 | event = ev; | 325 | event = ev; |
310 | uint cSum; | 326 | uint cSum; |
311 | cSum = PhoneFormat::getCsumEvent( event ); | 327 | cSum = PhoneFormat::getCsumEvent( event ); |
312 | event->setCsum( mProfileName, QString::number( cSum )); | 328 | event->setCsum( mProfileName, QString::number( cSum )); |
313 | event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 329 | event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
314 | event->setID( mProfileName,QString::number( id ) ); | 330 | event->setID( mProfileName,QString::number( id ) ); |
315 | ev = er.next(); | 331 | ev = er.next(); |
316 | } | 332 | } |
317 | { | 333 | { |
334 | qDebug("reading todos... "); | ||
318 | QPtrList<Todo> tr = calendar->rawTodos(); | 335 | QPtrList<Todo> tr = calendar->rawTodos(); |
319 | Todo* ev = tr.first(); | 336 | Todo* ev = tr.first(); |
320 | while ( ev ) { | 337 | while ( ev ) { |
321 | 338 | ||
322 | QStringList cat = ev->categories(); | 339 | QStringList cat = ev->categories(); |
323 | if ( cat.contains( "MeetingDEF" )) { | 340 | if ( cat.contains( "MeetingDEF" )) { |
324 | ev->setCategories( QStringList() ); | 341 | ev->setCategories( QStringList() ); |
325 | } | 342 | } |
326 | int id = ev->pilotId(); | 343 | int id = ev->pilotId(); |
327 | Todo *event; | 344 | Todo *event; |
328 | event = existingCal->todo( mProfileName ,QString::number( id ) ); | 345 | event = existingCal->todo( mProfileName ,QString::number( id ) ); |
329 | if ( event ) { | 346 | if ( event ) { |
330 | event = (Todo*)event->clone(); | 347 | event = (Todo*)event->clone(); |
331 | copyTodo( event, ev ); | 348 | copyTodo( event, ev ); |
332 | calendar->deleteTodo( ev ); | 349 | calendar->deleteTodo( ev ); |
333 | calendar->addTodo( event); | 350 | calendar->addTodo( event); |
334 | } | 351 | } |
335 | else | 352 | else |
336 | event = ev; | 353 | event = ev; |
337 | uint cSum; | 354 | uint cSum; |
338 | cSum = PhoneFormat::getCsumTodo( event ); | 355 | cSum = PhoneFormat::getCsumTodo( event ); |
339 | event->setCsum( mProfileName, QString::number( cSum )); | 356 | event->setCsum( mProfileName, QString::number( cSum )); |
340 | event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 357 | event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
341 | event->setID( mProfileName,QString::number( id ) ); | 358 | event->setID( mProfileName,QString::number( id ) ); |
342 | ev = tr.next(); | 359 | ev = tr.next(); |
343 | } | 360 | } |
344 | } | 361 | } |
345 | return true; | 362 | return true; |
346 | } | 363 | } |
347 | void PhoneFormat::copyEvent( Event* to, Event* from ) | 364 | void PhoneFormat::copyEvent( Event* to, Event* from ) |
348 | { | 365 | { |
349 | if ( from->dtStart().isValid() ) | 366 | if ( from->dtStart().isValid() ) |
350 | to->setDtStart( from->dtStart() ); | 367 | to->setDtStart( from->dtStart() ); |
351 | if ( from->dtEnd().isValid() ) | 368 | if ( from->dtEnd().isValid() ) |
352 | to->setDtEnd( from->dtEnd() ); | 369 | to->setDtEnd( from->dtEnd() ); |
353 | if ( !from->location().isEmpty() ) | 370 | if ( !from->location().isEmpty() ) |
354 | to->setLocation( from->location() ); | 371 | to->setLocation( from->location() ); |
355 | if ( !from->description().isEmpty() ) | 372 | if ( !from->description().isEmpty() ) |
356 | to->setDescription( from->description() ); | 373 | to->setDescription( from->description() ); |
357 | if ( !from->summary().isEmpty() ) | 374 | if ( !from->summary().isEmpty() ) |
358 | to->setSummary( from->summary() ); | 375 | to->setSummary( from->summary() ); |
359 | 376 | ||
360 | QPtrListIterator<Alarm> it( from->alarms() ); | 377 | QPtrListIterator<Alarm> it( from->alarms() ); |
361 | to->clearAlarms(); | 378 | to->clearAlarms(); |
362 | const Alarm *a; | 379 | const Alarm *a; |
363 | while( (a = it.current()) ) { | 380 | while( (a = it.current()) ) { |
364 | Alarm *b = new Alarm( *a ); | 381 | Alarm *b = new Alarm( *a ); |
365 | b->setParent( to ); | 382 | b->setParent( to ); |
366 | to->addAlarm( b ); | 383 | to->addAlarm( b ); |
367 | ++it; | 384 | ++it; |
368 | } | 385 | } |
369 | QStringList cat = to->categories(); | 386 | QStringList cat = to->categories(); |
370 | QStringList catFrom = from->categories(); | 387 | QStringList catFrom = from->categories(); |
371 | QString nCat; | 388 | QString nCat; |
372 | int iii; | 389 | int iii; |
373 | for ( iii = 0; iii < catFrom.count();++iii ) { | 390 | for ( iii = 0; iii < catFrom.count();++iii ) { |
374 | nCat = catFrom[iii]; | 391 | nCat = catFrom[iii]; |
375 | if ( !nCat.isEmpty() ) | 392 | if ( !nCat.isEmpty() ) |
376 | if ( !cat.contains( nCat )) { | 393 | if ( !cat.contains( nCat )) { |
377 | cat << nCat; | 394 | cat << nCat; |
378 | } | 395 | } |
379 | } | 396 | } |
380 | to->setCategories( cat ); | 397 | to->setCategories( cat ); |
381 | Recurrence * r = new Recurrence( *from->recurrence(),to); | 398 | Recurrence * r = new Recurrence( *from->recurrence(),to); |
382 | to->setRecurrence( r ) ; | 399 | to->setRecurrence( r ) ; |
383 | 400 | ||
384 | 401 | ||
385 | } | 402 | } |
386 | void PhoneFormat::copyTodo( Todo* to, Todo* from ) | 403 | void PhoneFormat::copyTodo( Todo* to, Todo* from ) |
387 | { | 404 | { |
388 | if ( from->dtStart().isValid() ) | 405 | if ( from->dtStart().isValid() ) |
389 | to->setDtStart( from->dtStart() ); | 406 | to->setDtStart( from->dtStart() ); |
390 | if ( from->dtDue().isValid() ) | 407 | if ( from->dtDue().isValid() ) |
391 | to->setDtDue( from->dtDue() ); | 408 | to->setDtDue( from->dtDue() ); |
392 | if ( !from->location().isEmpty() ) | 409 | if ( !from->location().isEmpty() ) |
393 | to->setLocation( from->location() ); | 410 | to->setLocation( from->location() ); |
394 | if ( !from->description().isEmpty() ) | 411 | if ( !from->description().isEmpty() ) |
395 | to->setDescription( from->description() ); | 412 | to->setDescription( from->description() ); |
396 | if ( !from->summary().isEmpty() ) | 413 | if ( !from->summary().isEmpty() ) |
397 | to->setSummary( from->summary() ); | 414 | to->setSummary( from->summary() ); |
398 | 415 | ||
399 | QPtrListIterator<Alarm> it( from->alarms() ); | 416 | QPtrListIterator<Alarm> it( from->alarms() ); |
400 | to->clearAlarms(); | 417 | to->clearAlarms(); |
401 | const Alarm *a; | 418 | const Alarm *a; |
402 | while( (a = it.current()) ) { | 419 | while( (a = it.current()) ) { |
403 | Alarm *b = new Alarm( *a ); | 420 | Alarm *b = new Alarm( *a ); |
404 | b->setParent( to ); | 421 | b->setParent( to ); |
405 | to->addAlarm( b ); | 422 | to->addAlarm( b ); |
406 | ++it; | 423 | ++it; |
407 | } | 424 | } |
408 | QStringList cat = to->categories(); | 425 | QStringList cat = to->categories(); |
409 | QStringList catFrom = from->categories(); | 426 | QStringList catFrom = from->categories(); |
410 | QString nCat; | 427 | QString nCat; |
411 | int iii; | 428 | int iii; |
412 | for ( iii = 0; iii < catFrom.count();++iii ) { | 429 | for ( iii = 0; iii < catFrom.count();++iii ) { |
413 | nCat = catFrom[iii]; | 430 | nCat = catFrom[iii]; |
414 | if ( !nCat.isEmpty() ) | 431 | if ( !nCat.isEmpty() ) |
415 | if ( !cat.contains( nCat )) { | 432 | if ( !cat.contains( nCat )) { |
416 | cat << nCat; | 433 | cat << nCat; |
417 | } | 434 | } |
418 | } | 435 | } |
419 | to->setCategories( cat ); | 436 | to->setCategories( cat ); |
420 | if ( from->isCompleted() ) { | 437 | if ( from->isCompleted() ) { |
421 | to->setCompleted( true ); | 438 | to->setCompleted( true ); |
422 | if( from->completed().isValid() ) | 439 | if( from->completed().isValid() ) |
423 | to->setCompleted( from->completed() ); | 440 | to->setCompleted( from->completed() ); |
424 | } else { | 441 | } else { |
425 | // set percentcomplete only, if to->isCompleted() | 442 | // set percentcomplete only, if to->isCompleted() |
426 | if ( to->isCompleted() ) | 443 | if ( to->isCompleted() ) |
427 | to->setPercentComplete(from->percentComplete()); | 444 | to->setPercentComplete(from->percentComplete()); |
428 | } | 445 | } |
429 | to->setPriority(from->priority()); | 446 | to->setPriority(from->priority()); |
430 | 447 | ||
431 | } | 448 | } |
432 | #include <qcstring.h> | 449 | #include <qcstring.h> |
433 | 450 | ||
434 | void PhoneFormat::afterSave( Incidence* inc) | 451 | void PhoneFormat::afterSave( Incidence* inc) |
435 | { | 452 | { |
436 | uint csum; | 453 | uint csum; |
437 | inc->removeID( mProfileName ); | 454 | inc->removeID( mProfileName ); |
438 | if ( inc->type() == "Event") | 455 | if ( inc->type() == "Event") |
439 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); | 456 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); |
440 | else | 457 | else |
441 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); | 458 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); |
442 | inc->setCsum( mProfileName, QString::number( csum )); | 459 | inc->setCsum( mProfileName, QString::number( csum )); |
443 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 460 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
444 | 461 | ||
445 | } | 462 | } |
446 | bool PhoneFormat::save( Calendar *calendar) | 463 | bool PhoneFormat::save( Calendar *calendar) |
447 | { | 464 | { |
448 | QLabel status ( i18n(" Opening device ..."), 0 ); | 465 | QLabel status ( i18n(" Opening device ..."), 0 ); |
449 | int w = status.sizeHint().width()+20 ; | 466 | int w = status.sizeHint().width()+20 ; |
450 | if ( w < 200 ) w = 230; | 467 | if ( w < 200 ) w = 230; |
451 | int h = status.sizeHint().height()+20 ; | 468 | int h = status.sizeHint().height()+20 ; |
452 | int dw = QApplication::desktop()->width(); | 469 | int dw = QApplication::desktop()->width(); |
453 | int dh = QApplication::desktop()->height(); | 470 | int dh = QApplication::desktop()->height(); |
454 | status.setCaption(i18n("Writing to phone...") ); | 471 | status.setCaption(i18n("Writing to phone...") ); |
455 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 472 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
456 | status.show(); | 473 | status.show(); |
457 | status.raise(); | 474 | status.raise(); |
458 | qApp->processEvents(); | 475 | qApp->processEvents(); |
459 | QString message; | 476 | QString message; |
460 | #ifdef _WIN32_ | 477 | #ifdef _WIN32_ |
461 | QString fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; | 478 | QString fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; |
462 | #else | 479 | #else |
463 | QString fileName = "/tmp/kdepimtemp.vcs"; | 480 | QString fileName = "/tmp/kdepimtemp.vcs"; |
464 | #endif | 481 | #endif |
465 | 482 | ||
466 | // 1 remove events which should be deleted | 483 | // 1 remove events which should be deleted |
467 | QPtrList<Event> er = calendar->rawEvents(); | 484 | QPtrList<Event> er = calendar->rawEvents(); |
468 | Event* ev = er.first(); | 485 | Event* ev = er.first(); |
469 | while ( ev ) { | 486 | while ( ev ) { |
470 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 487 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
471 | calendar->deleteEvent( ev ); | 488 | calendar->deleteEvent( ev ); |
472 | } else { | 489 | } else { |
473 | 490 | ||
474 | } | 491 | } |
475 | ev = er.next(); | 492 | ev = er.next(); |
476 | } | 493 | } |
477 | // 2 remove todos which should be deleted | 494 | // 2 remove todos which should be deleted |
478 | QPtrList<Todo> tl = calendar->rawTodos(); | 495 | QPtrList<Todo> tl = calendar->rawTodos(); |
479 | Todo* to = tl.first(); | 496 | Todo* to = tl.first(); |
480 | while ( to ) { | 497 | while ( to ) { |
481 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 498 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
482 | calendar->deleteTodo( to ); | 499 | calendar->deleteTodo( to ); |
483 | } | 500 | } |
484 | to = tl.next(); | 501 | to = tl.next(); |
485 | } | 502 | } |
486 | // 3 save file | 503 | // 3 save file |
487 | VCalFormat vfsave; | 504 | VCalFormat vfsave; |
488 | vfsave.setLocalTime ( true ); | 505 | vfsave.setLocalTime ( true ); |
489 | if ( ! vfsave.save( calendar, fileName ) ) | 506 | if ( ! vfsave.save( calendar, fileName ) ) |
490 | return false; | 507 | return false; |
491 | // 4 call kammu | 508 | // 4 call kammu |
492 | QString command ="./kammu --restore " + fileName + " -C" + | 509 | QString command ="./kammu --restore " + fileName + " -C" + |
493 | mConnection +" -D" + mDevice +" -M" + mModel;; | 510 | mConnection +" -D" + mDevice +" -M" + mModel; |
494 | int ret = system ( command.latin1() ); | 511 | int ret; |
495 | if ( ret != 0 ) | 512 | while ( (ret = system ( command.latin1())) != 0 ) { |
513 | qDebug("Error S::command returned %d. asking users", ret); | ||
514 | int retval = KMessageBox::warningContinueCancel(0, | ||
515 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel")); | ||
516 | if ( retval != KMessageBox::Continue ) | ||
517 | return false; | ||
518 | } | ||
519 | if ( ret != 0 ) { | ||
520 | qDebug("Error S::command returned %d", ret); | ||
496 | return false; | 521 | return false; |
522 | } | ||
497 | // 5 reread data | 523 | // 5 reread data |
498 | message = i18n(" Rereading all data ... "); | 524 | message = i18n(" Rereading all data ... "); |
499 | status.setText ( message ); | 525 | status.setText ( message ); |
500 | qApp->processEvents(); | 526 | qApp->processEvents(); |
501 | CalendarLocal* calendarTemp = new CalendarLocal(); | 527 | CalendarLocal* calendarTemp = new CalendarLocal(); |
502 | calendarTemp->setTimeZoneId( calendar->timeZoneId()); | 528 | calendarTemp->setTimeZoneId( calendar->timeZoneId()); |
503 | if ( ! load( calendarTemp,calendar) ){ | 529 | if ( ! load( calendarTemp,calendar) ){ |
504 | qDebug("error reloading calendar "); | 530 | qDebug("error reloading calendar "); |
505 | delete calendarTemp; | 531 | delete calendarTemp; |
506 | return false; | 532 | return false; |
507 | } | 533 | } |
508 | // 6 compare data | 534 | // 6 compare data |
509 | 535 | ||
510 | //algo 6 compare event | 536 | //algo 6 compare event |
511 | er = calendar->rawEvents(); | 537 | er = calendar->rawEvents(); |
512 | ev = er.first(); | 538 | ev = er.first(); |
513 | message = i18n(" Comparing event # "); | 539 | message = i18n(" Comparing event # "); |
514 | QPtrList<Event> er1 = calendarTemp->rawEvents(); | 540 | QPtrList<Event> er1 = calendarTemp->rawEvents(); |
515 | Event* ev1; | 541 | Event* ev1; |
516 | int procCount = 0; | 542 | int procCount = 0; |
517 | while ( ev ) { | 543 | while ( ev ) { |
518 | qDebug("event new ID "); | 544 | //qDebug("event new ID %s",ev->summary().latin1()); |
519 | status.setText ( message + QString::number ( ++procCount ) ); | 545 | status.setText ( message + QString::number ( ++procCount ) ); |
520 | qApp->processEvents(); | 546 | qApp->processEvents(); |
521 | QString cSum = ev->getCsum(mProfileName); | 547 | uint csum; |
548 | csum = PhoneFormat::getCsumEvent( ev ); | ||
549 | QString cSum = QString::number( csum ); | ||
550 | ev->setCsum( mProfileName, cSum ); | ||
551 | //qDebug("Event cSum %s ", cSum.latin1()); | ||
522 | ev1 = er1.first(); | 552 | ev1 = er1.first(); |
523 | while ( ev1 ) { | 553 | while ( ev1 ) { |
524 | if ( ev1->getCsum( mProfileName ) == cSum ) { | 554 | if ( ev1->getCsum( mProfileName ) == cSum ) { |
525 | er1.remove( ev1 ); | 555 | er1.remove( ev1 ); |
526 | afterSave( ev ); | 556 | afterSave( ev ); |
527 | ev->setID(mProfileName, ev1->getID(mProfileName) ); | 557 | ev->setID(mProfileName, ev1->getID(mProfileName) ); |
558 | //qDebug("Event found on phone for %s ", ev->summary().latin1()); | ||
559 | |||
528 | break; | 560 | break; |
529 | } | 561 | } |
530 | ev1 = er1.next(); | 562 | ev1 = er1.next(); |
531 | } | 563 | } |
532 | if ( ! ev1 ) { | 564 | if ( ! ev1 ) { |
533 | ev->removeID(mProfileName); | 565 | ev->removeID(mProfileName); |
534 | qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); | 566 | qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); |
535 | } | 567 | } |
536 | 568 | ||
537 | 569 | ||
538 | ev = er.next(); | 570 | ev = er.next(); |
539 | } | 571 | } |
540 | //algo 6 compare todo | 572 | //algo 6 compare todo |
573 | tl = calendar->rawTodos(); | ||
541 | to = tl.first(); | 574 | to = tl.first(); |
542 | procCount = 0; | 575 | procCount = 0; |
543 | QPtrList<Todo> tl1 = calendarTemp->rawTodos(); | 576 | QPtrList<Todo> tl1 = calendarTemp->rawTodos(); |
544 | Todo* to1 ; | 577 | Todo* to1 ; |
545 | message = i18n(" Comparing todo # "); | 578 | message = i18n(" Comparing todo # "); |
546 | while ( to ) { | 579 | while ( to ) { |
547 | qDebug("todo2 %d ", procCount); | 580 | qDebug("todo2 %d ", procCount); |
548 | status.setText ( message + QString::number ( ++procCount ) ); | 581 | status.setText ( message + QString::number ( ++procCount ) ); |
549 | qApp->processEvents(); | 582 | qApp->processEvents(); |
550 | QString cSum = to->getCsum(mProfileName); | 583 | uint csum; |
584 | csum = PhoneFormat::getCsumTodo( to ); | ||
585 | QString cSum = QString::number( csum ); | ||
586 | to->setCsum( mProfileName, cSum ); | ||
587 | qDebug("Todo cSum %s ", cSum.latin1()); | ||
551 | Todo* to1 = tl1.first(); | 588 | Todo* to1 = tl1.first(); |
552 | while ( to1 ) { | 589 | while ( to1 ) { |
553 | if ( to1->getCsum( mProfileName ) == cSum ) { | 590 | if ( to1->getCsum( mProfileName ) == cSum ) { |
554 | tl1.remove( to1 ); | 591 | tl1.remove( to1 ); |
555 | afterSave( to ); | 592 | afterSave( to ); |
556 | to->setID(mProfileName, to1->getID(mProfileName) ); | 593 | to->setID(mProfileName, to1->getID(mProfileName) ); |
557 | break; | 594 | break; |
558 | } | 595 | } |
559 | to1 = tl1.next(); | 596 | to1 = tl1.next(); |
560 | } | 597 | } |
561 | if ( ! to1 ) { | 598 | if ( ! to1 ) { |
562 | to->removeID(mProfileName); | 599 | to->removeID(mProfileName); |
563 | 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()); |
564 | } | 601 | } |
565 | 602 | ||
566 | to = tl.next(); | 603 | to = tl.next(); |
567 | } | 604 | } |
568 | delete calendarTemp; | 605 | delete calendarTemp; |
569 | return true; | 606 | return true; |
570 | 607 | ||
571 | 608 | ||
572 | 609 | ||
573 | } | 610 | } |
574 | 611 | ||
575 | 612 | ||
576 | QString PhoneFormat::toString( Calendar * ) | 613 | QString PhoneFormat::toString( Calendar * ) |
577 | { | 614 | { |
578 | return QString::null; | 615 | return QString::null; |
579 | } | 616 | } |
580 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) | 617 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) |
581 | { | 618 | { |
582 | return false; | 619 | return false; |
583 | } | 620 | } |