-rw-r--r-- | libkcal/phoneformat.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 1a9ccbc..7e1c9cd 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -1,1170 +1,1154 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 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 | 38 | ||
39 | #include "calendar.h" | 39 | #include "calendar.h" |
40 | #include "alarm.h" | 40 | #include "alarm.h" |
41 | #include "recurrence.h" | 41 | #include "recurrence.h" |
42 | #include "calendarlocal.h" | 42 | #include "calendarlocal.h" |
43 | 43 | ||
44 | #include "phoneformat.h" | 44 | #include "phoneformat.h" |
45 | #include "syncdefines.h" | 45 | #include "syncdefines.h" |
46 | 46 | ||
47 | using namespace KCal; | 47 | using namespace KCal; |
48 | 48 | ||
49 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY | ||
50 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ||
51 | |||
52 | //ARSD silentalarm = 0 | ||
53 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly | ||
54 | // 12 RFRQ | ||
55 | // 13 RPOS pos = 4. monday in month | ||
56 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun | ||
57 | // 15 REND 0 = no end/ 1 = end | ||
58 | // 16 REDT rec end dt | ||
59 | //ALSD | ||
60 | //ALED | ||
61 | //MDAY | ||
62 | |||
63 | class PhoneParser : public QObject | 49 | class PhoneParser : public QObject |
64 | { | 50 | { |
65 | public: | 51 | public: |
66 | PhoneParser( Calendar *calendar, QString profileName ) : mCalendar( calendar ), mProfileName ( profileName ) { | 52 | PhoneParser( Calendar *calendar, QString profileName ) : mCalendar( calendar ), mProfileName ( profileName ) { |
67 | ; | 53 | ; |
68 | } | 54 | } |
69 | bool readTodo( Calendar *existingCalendar,GSM_ToDoEntry *ToDo, GSM_StateMachine* s) | 55 | bool readTodo( Calendar *existingCalendar,GSM_ToDoEntry *ToDo, GSM_StateMachine* s) |
70 | { | 56 | { |
71 | 57 | ||
72 | int id = ToDo->Location; | 58 | int id = ToDo->Location; |
73 | Todo *todo; | 59 | Todo *todo; |
74 | todo = existingCalendar->todo( mProfileName ,QString::number( id ) ); | 60 | todo = existingCalendar->todo( mProfileName ,QString::number( id ) ); |
75 | if (todo ) | 61 | if (todo ) |
76 | todo = (Todo *)todo->clone(); | 62 | todo = (Todo *)todo->clone(); |
77 | else | 63 | else |
78 | todo = new Todo; | 64 | todo = new Todo; |
79 | todo->setID( mProfileName,QString::number( id ) ); | 65 | todo->setID( mProfileName,QString::number( id ) ); |
80 | todo->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); | 66 | todo->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); |
81 | int priority; | 67 | int priority; |
82 | switch (ToDo->Priority) { | 68 | switch (ToDo->Priority) { |
83 | case GSM_Priority_Low : priority = 1; break; | 69 | case GSM_Priority_Low : priority = 1; break; |
84 | case GSM_Priority_Medium : priority = 3; break; | 70 | case GSM_Priority_Medium : priority = 3; break; |
85 | case GSM_Priority_High : priority = 5; break; | 71 | case GSM_Priority_High : priority = 5; break; |
86 | default :priority = 3 ;break; | 72 | default :priority = 3 ;break; |
87 | } | 73 | } |
88 | todo->setPriority( priority ); | 74 | todo->setPriority( priority ); |
89 | GSM_Phone_Functions*Phone; | 75 | GSM_Phone_Functions*Phone; |
90 | Phone=s->Phone.Functions; | 76 | Phone=s->Phone.Functions; |
91 | int j; | 77 | int j; |
92 | GSM_DateTime* dtp; | 78 | GSM_DateTime* dtp; |
93 | bool alarm = false; | 79 | bool alarm = false; |
94 | QDateTime alarmDt; | 80 | QDateTime alarmDt; |
95 | GSM_Category Category; | 81 | GSM_Category Category; |
96 | int error; | 82 | int error; |
97 | QString completedString = "no"; | 83 | QString completedString = "no"; |
98 | for (j=0;j<ToDo->EntriesNum;j++) { | 84 | for (j=0;j<ToDo->EntriesNum;j++) { |
99 | 85 | ||
100 | //qDebug(" for todo %d",ToDo->Location ); | 86 | //qDebug(" for todo %d",ToDo->Location ); |
101 | switch (ToDo->Entries[j].EntryType) { | 87 | switch (ToDo->Entries[j].EntryType) { |
102 | case TODO_END_DATETIME: | 88 | case TODO_END_DATETIME: |
103 | dtp = &ToDo->Entries[j].Date ; | 89 | dtp = &ToDo->Entries[j].Date ; |
104 | todo->setDtDue (fromGSM ( dtp )); | 90 | todo->setDtDue (fromGSM ( dtp )); |
105 | break; | 91 | break; |
106 | case TODO_COMPLETED: | 92 | case TODO_COMPLETED: |
107 | if ( ToDo->Entries[j].Number == 1 ) { | 93 | if ( ToDo->Entries[j].Number == 1 ) { |
108 | todo->setCompleted( true ); | 94 | todo->setCompleted( true ); |
109 | completedString = "yes"; | 95 | completedString = "yes"; |
110 | } | 96 | } |
111 | else { | 97 | else { |
112 | todo->setCompleted( false ); | 98 | todo->setCompleted( false ); |
113 | } | 99 | } |
114 | break; | 100 | break; |
115 | case TODO_ALARM_DATETIME: | 101 | case TODO_ALARM_DATETIME: |
116 | dtp = &ToDo->Entries[j].Date ; | 102 | dtp = &ToDo->Entries[j].Date ; |
117 | alarm = true; | 103 | alarm = true; |
118 | alarmDt = fromGSM ( dtp ); | 104 | alarmDt = fromGSM ( dtp ); |
119 | break; | 105 | break; |
120 | case TODO_SILENT_ALARM_DATETIME: | 106 | case TODO_SILENT_ALARM_DATETIME: |
121 | dtp = &ToDo->Entries[j].Date ; | 107 | dtp = &ToDo->Entries[j].Date ; |
122 | alarm = true; | 108 | alarm = true; |
123 | alarmDt = fromGSM ( dtp ); | 109 | alarmDt = fromGSM ( dtp ); |
124 | break; | 110 | break; |
125 | case TODO_TEXT: | 111 | case TODO_TEXT: |
126 | //qDebug(" text *%s* ", (const char*) DecodeUnicodeConsole(ToDo->Entries[j].Text )); | 112 | //qDebug(" text *%s* ", (const char*) DecodeUnicodeConsole(ToDo->Entries[j].Text )); |
127 | todo->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole(ToDo->Entries[j].Text ))); | 113 | todo->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole(ToDo->Entries[j].Text ))); |
128 | break; | 114 | break; |
129 | case TODO_PRIVATE: | 115 | case TODO_PRIVATE: |
130 | if ( ToDo->Entries[j].Number == 1 ) | 116 | if ( ToDo->Entries[j].Number == 1 ) |
131 | todo->setSecrecy( Incidence::SecrecyPrivate ); | 117 | todo->setSecrecy( Incidence::SecrecyPrivate ); |
132 | else | 118 | else |
133 | todo->setSecrecy( Incidence::SecrecyPublic ); | 119 | todo->setSecrecy( Incidence::SecrecyPublic ); |
134 | break; | 120 | break; |
135 | case TODO_CATEGORY: | 121 | case TODO_CATEGORY: |
136 | Category.Location = ToDo->Entries[j].Number; | 122 | Category.Location = ToDo->Entries[j].Number; |
137 | Category.Type = Category_ToDo; | 123 | Category.Type = Category_ToDo; |
138 | error=Phone->GetCategory(s, &Category); | 124 | error=Phone->GetCategory(s, &Category); |
139 | if (error == ERR_NONE) { | 125 | if (error == ERR_NONE) { |
140 | QStringList cat = todo->categories(); | 126 | QStringList cat = todo->categories(); |
141 | QString nCat = QString ( (const char*)Category.Name ); | 127 | QString nCat = QString ( (const char*)Category.Name ); |
142 | if ( !nCat.isEmpty() ) | 128 | if ( !nCat.isEmpty() ) |
143 | if ( !cat.contains( nCat )) { | 129 | if ( !cat.contains( nCat )) { |
144 | cat << nCat; | 130 | cat << nCat; |
145 | todo->setCategories( cat ); | 131 | todo->setCategories( cat ); |
146 | } | 132 | } |
147 | } | 133 | } |
148 | break; | 134 | break; |
149 | case TODO_CONTACTID: | 135 | case TODO_CONTACTID: |
150 | #if 0 | 136 | #if 0 |
151 | // not supported | 137 | // not supported |
152 | entry.Location = ToDo->Entries[j].Number; | 138 | entry.Location = ToDo->Entries[j].Number; |
153 | entry.MemoryType = MEM_ME; | 139 | entry.MemoryType = MEM_ME; |
154 | error=Phone->GetMemory(s, &entry); | 140 | error=Phone->GetMemory(s, &entry); |
155 | if (error == ERR_NONE) { | 141 | if (error == ERR_NONE) { |
156 | name = GSM_PhonebookGetEntryName(&entry); | 142 | name = GSM_PhonebookGetEntryName(&entry); |
157 | if (name != NULL) { | 143 | if (name != NULL) { |
158 | printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number); | 144 | printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number); |
159 | } else { | 145 | } else { |
160 | printmsg("Contact ID : %d\n",ToDo->Entries[j].Number); | 146 | printmsg("Contact ID : %d\n",ToDo->Entries[j].Number); |
161 | } | 147 | } |
162 | } else { | 148 | } else { |
163 | printmsg("Contact : %d\n",ToDo->Entries[j].Number); | 149 | printmsg("Contact : %d\n",ToDo->Entries[j].Number); |
164 | } | 150 | } |
165 | #endif | 151 | #endif |
166 | break; | 152 | break; |
167 | case TODO_PHONE: | 153 | case TODO_PHONE: |
168 | #if 0 | 154 | #if 0 |
169 | // not supported | 155 | // not supported |
170 | printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); | 156 | printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); |
171 | #endif | 157 | #endif |
172 | break; | 158 | break; |
173 | } | 159 | } |
174 | } | 160 | } |
175 | QString alarmString = ""; | 161 | QString alarmString = ""; |
176 | // strange 0 semms to mean: alarm enabled | ||
177 | if ( alarm ) { | 162 | if ( alarm ) { |
178 | Alarm *alarm; | 163 | Alarm *alarm; |
179 | if ( todo->alarms().count() > 0 ) | 164 | if ( todo->alarms().count() > 0 ) |
180 | alarm = todo->alarms().first(); | 165 | alarm = todo->alarms().first(); |
181 | else { | 166 | else { |
182 | alarm = new Alarm( todo ); | 167 | alarm = new Alarm( todo ); |
183 | todo->addAlarm( alarm ); | 168 | todo->addAlarm( alarm ); |
184 | } | 169 | } |
185 | alarm->setType( Alarm::Audio ); | 170 | alarm->setType( Alarm::Audio ); |
186 | alarm->setEnabled( true ); | 171 | alarm->setEnabled( true ); |
187 | int alarmOffset = alarmDt.secsTo( todo->dtStart() ); | 172 | int alarmOffset = alarmDt.secsTo( todo->dtStart() ); |
188 | alarm->setStartOffset( alarmOffset ); | 173 | alarm->setStartOffset( alarmOffset ); |
189 | alarmString = QString::number( alarmOffset ); | 174 | alarmString = QString::number( alarmOffset ); |
190 | } | 175 | } |
191 | // csum ***************************************** | 176 | // csum ***************************************** |
192 | QStringList attList; | 177 | QStringList attList; |
193 | uint cSum; | 178 | uint cSum; |
194 | if ( todo->hasDueDate() ) | 179 | if ( todo->hasDueDate() ) |
195 | attList << dtToString ( todo->dtDue() ); | 180 | attList << dtToString ( todo->dtDue() ); |
196 | attList << QString::number( id ); | 181 | attList << QString::number( id ); |
197 | attList << todo->summary(); | 182 | attList << todo->summary(); |
198 | attList << completedString; | 183 | attList << completedString; |
199 | attList << QString::number( todo->priority() ); | 184 | attList << QString::number( todo->priority() ); |
200 | attList << alarmString; | 185 | attList << alarmString; |
201 | attList << todo->categoriesStr(); | 186 | attList << todo->categoriesStr(); |
202 | attList << todo->secrecyStr(); | 187 | attList << todo->secrecyStr(); |
203 | cSum = PhoneFormat::getCsum(attList ); | 188 | cSum = PhoneFormat::getCsum(attList ); |
204 | todo->setCsum( mProfileName, QString::number( cSum )); | 189 | todo->setCsum( mProfileName, QString::number( cSum )); |
205 | mCalendar->addTodo( todo); | 190 | mCalendar->addTodo( todo); |
206 | 191 | ||
207 | return true; | 192 | return true; |
208 | } | 193 | } |
209 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) | 194 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) |
210 | { | 195 | { |
211 | 196 | ||
212 | int id = Note->Location; | 197 | int id = Note->Location; |
213 | Event *event; | 198 | Event *event; |
214 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); | 199 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); |
215 | if ( event ) | 200 | if ( event ) |
216 | event = (Event*)event->clone(); | 201 | event = (Event*)event->clone(); |
217 | else | 202 | else |
218 | event = new Event; | 203 | event = new Event; |
219 | event->setID( mProfileName,QString::number( id ) ); | 204 | event->setID( mProfileName,QString::number( id ) ); |
220 | event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); | 205 | event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); |
221 | 206 | ||
222 | 207 | ||
223 | int i = 0; | 208 | int i = 0; |
224 | bool repeating = false; | 209 | bool repeating = false; |
225 | int repeat_dayofweek = -1; | 210 | int repeat_dayofweek = -1; |
226 | int repeat_day = -1; | 211 | int repeat_day = -1; |
227 | int repeat_weekofmonth = -1; | 212 | int repeat_weekofmonth = -1; |
228 | int repeat_month = -1; | 213 | int repeat_month = -1; |
229 | int repeat_frequency = -1; | 214 | int repeat_frequency = -1; |
230 | int rec_type = -1; | 215 | int rec_type = -1; |
231 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | 216 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; |
232 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | 217 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; |
233 | GSM_DateTime* dtp; | 218 | GSM_DateTime* dtp; |
234 | bool alarm = false; | 219 | bool alarm = false; |
235 | QDateTime alarmDt; | 220 | QDateTime alarmDt; |
236 | repeat_startdate.Day= 0; | 221 | repeat_startdate.Day= 0; |
237 | repeat_stopdate.Day = 0; | 222 | repeat_stopdate.Day = 0; |
238 | for (i=0;i<Note->EntriesNum;i++) { | 223 | for (i=0;i<Note->EntriesNum;i++) { |
239 | 224 | ||
240 | //qDebug(" for ev"); | 225 | //qDebug(" for ev"); |
241 | switch (Note->Entries[i].EntryType) { | 226 | switch (Note->Entries[i].EntryType) { |
242 | case CAL_START_DATETIME: | 227 | case CAL_START_DATETIME: |
243 | dtp = &Note->Entries[i].Date ; | 228 | dtp = &Note->Entries[i].Date ; |
244 | if ( dtp->Hour > 24 ) { | 229 | if ( dtp->Hour > 24 ) { |
245 | event->setFloats( true ); | 230 | event->setFloats( true ); |
246 | event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); | 231 | event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); |
247 | } else { | 232 | } else { |
248 | event->setDtStart (fromGSM ( dtp )); | 233 | event->setDtStart (fromGSM ( dtp )); |
249 | 234 | ||
250 | } | 235 | } |
251 | break; | 236 | break; |
252 | case CAL_END_DATETIME: | 237 | case CAL_END_DATETIME: |
253 | dtp = &Note->Entries[i].Date ; | 238 | dtp = &Note->Entries[i].Date ; |
254 | if ( dtp->Hour > 24 ) { | 239 | if ( dtp->Hour > 24 ) { |
255 | event->setFloats( true ); | 240 | event->setFloats( true ); |
256 | event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); | 241 | event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); |
257 | } else { | 242 | } else { |
258 | event->setDtEnd (fromGSM ( dtp )); | 243 | event->setDtEnd (fromGSM ( dtp )); |
259 | } | 244 | } |
260 | break; | 245 | break; |
261 | case CAL_ALARM_DATETIME: | 246 | case CAL_ALARM_DATETIME: |
262 | dtp = &Note->Entries[i].Date ; | 247 | dtp = &Note->Entries[i].Date ; |
263 | alarm = true; | 248 | alarm = true; |
264 | alarmDt = fromGSM ( dtp ); | 249 | alarmDt = fromGSM ( dtp ); |
265 | break; | 250 | break; |
266 | case CAL_SILENT_ALARM_DATETIME: | 251 | case CAL_SILENT_ALARM_DATETIME: |
267 | dtp = &Note->Entries[i].Date ; | 252 | dtp = &Note->Entries[i].Date ; |
268 | alarm = true; | 253 | alarm = true; |
269 | alarmDt = fromGSM ( dtp ); | 254 | alarmDt = fromGSM ( dtp ); |
270 | break; | 255 | break; |
271 | case CAL_RECURRANCE: | 256 | case CAL_RECURRANCE: |
272 | rec_type = Note->Entries[i].Number; | 257 | rec_type = Note->Entries[i].Number; |
273 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); | 258 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); |
274 | break; | 259 | break; |
275 | case CAL_TEXT: | 260 | case CAL_TEXT: |
276 | //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); | 261 | //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); |
277 | event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); | 262 | event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); |
278 | break; | 263 | break; |
279 | case CAL_LOCATION: | 264 | case CAL_LOCATION: |
280 | event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); | 265 | event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); |
281 | break; | 266 | break; |
282 | case CAL_PHONE: | 267 | case CAL_PHONE: |
283 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | 268 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); |
284 | break; | 269 | break; |
285 | case CAL_PRIVATE: | 270 | case CAL_PRIVATE: |
286 | if ( Note->Entries[i].Number == 1 ) | 271 | if ( Note->Entries[i].Number == 1 ) |
287 | event->setSecrecy( Incidence::SecrecyPrivate ); | 272 | event->setSecrecy( Incidence::SecrecyPrivate ); |
288 | else | 273 | else |
289 | event->setSecrecy( Incidence::SecrecyPublic ); | 274 | event->setSecrecy( Incidence::SecrecyPublic ); |
290 | 275 | ||
291 | break; | 276 | break; |
292 | case CAL_CONTACTID: | 277 | case CAL_CONTACTID: |
293 | #if 0 | 278 | #if 0 |
294 | entry.Location = Note->Entries[i].Number; | 279 | entry.Location = Note->Entries[i].Number; |
295 | entry.MemoryType = MEM_ME; | 280 | entry.MemoryType = MEM_ME; |
296 | error=Phone->GetMemory(&s, &entry); | 281 | error=Phone->GetMemory(&s, &entry); |
297 | if (error == ERR_NONE) { | 282 | if (error == ERR_NONE) { |
298 | name = GSM_PhonebookGetEntryName(&entry); | 283 | name = GSM_PhonebookGetEntryName(&entry); |
299 | if (name != NULL) { | 284 | if (name != NULL) { |
300 | //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); | 285 | //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); |
301 | } else { | 286 | } else { |
302 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); | 287 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); |
303 | } | 288 | } |
304 | } else { | 289 | } else { |
305 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); | 290 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); |
306 | } | 291 | } |
307 | #endif | 292 | #endif |
308 | break; | 293 | break; |
309 | case CAL_REPEAT_DAYOFWEEK: | 294 | case CAL_REPEAT_DAYOFWEEK: |
310 | repeat_dayofweek = Note->Entries[i].Number; | 295 | repeat_dayofweek = Note->Entries[i].Number; |
311 | repeating = true; | 296 | repeating = true; |
312 | break; | 297 | break; |
313 | case CAL_REPEAT_DAY: | 298 | case CAL_REPEAT_DAY: |
314 | repeat_day = Note->Entries[i].Number; | 299 | repeat_day = Note->Entries[i].Number; |
315 | repeating = true; | 300 | repeating = true; |
316 | break; | 301 | break; |
317 | case CAL_REPEAT_WEEKOFMONTH: | 302 | case CAL_REPEAT_WEEKOFMONTH: |
318 | repeat_weekofmonth = Note->Entries[i].Number; | 303 | repeat_weekofmonth = Note->Entries[i].Number; |
319 | repeating = true; | 304 | repeating = true; |
320 | break; | 305 | break; |
321 | case CAL_REPEAT_MONTH: | 306 | case CAL_REPEAT_MONTH: |
322 | repeat_month = Note->Entries[i].Number; | 307 | repeat_month = Note->Entries[i].Number; |
323 | repeating = true; | 308 | repeating = true; |
324 | break; | 309 | break; |
325 | case CAL_REPEAT_FREQUENCY: | 310 | case CAL_REPEAT_FREQUENCY: |
326 | repeat_frequency = Note->Entries[i].Number; | 311 | repeat_frequency = Note->Entries[i].Number; |
327 | repeating = true; | 312 | repeating = true; |
328 | break; | 313 | break; |
329 | case CAL_REPEAT_STARTDATE: | 314 | case CAL_REPEAT_STARTDATE: |
330 | repeat_startdate = Note->Entries[i].Date; | 315 | repeat_startdate = Note->Entries[i].Date; |
331 | repeating = true; | 316 | repeating = true; |
332 | break; | 317 | break; |
333 | case CAL_REPEAT_STOPDATE: | 318 | case CAL_REPEAT_STOPDATE: |
334 | repeat_stopdate = Note->Entries[i].Date; | 319 | repeat_stopdate = Note->Entries[i].Date; |
335 | repeating = true; | 320 | repeating = true; |
336 | break; | 321 | break; |
337 | } | 322 | } |
338 | } | 323 | } |
339 | #if 0 | 324 | #if 0 |
340 | event->setDescription( attList[4] ); | 325 | event->setDescription( attList[4] ); |
341 | bool repeating = false; | 326 | bool repeating = false; |
342 | int repeat_dayofweek = -1; | 327 | int repeat_dayofweek = -1; |
343 | int repeat_day = -1; | 328 | int repeat_day = -1; |
344 | int repeat_weekofmonth = -1; | 329 | int repeat_weekofmonth = -1; |
345 | int repeat_month = -1; | 330 | int repeat_month = -1; |
346 | int repeat_frequency = -1; | 331 | int repeat_frequency = -1; |
347 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | 332 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; |
348 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | 333 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; |
349 | 334 | ||
350 | #endif | 335 | #endif |
351 | 336 | ||
352 | QString recurString = "no"; | 337 | QString recurString = "no"; |
353 | if ( repeating ) { | 338 | if ( repeating ) { |
354 | recurString = "y"; | 339 | recurString = "y"; |
355 | if ( repeat_dayofweek >= 0 ) | 340 | if ( repeat_dayofweek >= 0 ) |
356 | recurString += "dow" + QString::number (repeat_dayofweek); | 341 | recurString += "dow" + QString::number (repeat_dayofweek); |
357 | if ( repeat_day >= 0 ) | 342 | if ( repeat_day >= 0 ) |
358 | recurString += "d" + QString::number (repeat_day); | 343 | recurString += "d" + QString::number (repeat_day); |
359 | if ( repeat_weekofmonth >= 0 ) | 344 | if ( repeat_weekofmonth >= 0 ) |
360 | recurString += "w" + QString::number (repeat_weekofmonth); | 345 | recurString += "w" + QString::number (repeat_weekofmonth); |
361 | if ( repeat_month >= 0 ) | 346 | if ( repeat_month >= 0 ) |
362 | recurString += "m" + QString::number ( repeat_month ); | 347 | recurString += "m" + QString::number ( repeat_month ); |
363 | if ( repeat_frequency >= 0 ) | 348 | if ( repeat_frequency >= 0 ) |
364 | recurString += "f" + QString::number (repeat_frequency ); | 349 | recurString += "f" + QString::number (repeat_frequency ); |
365 | 350 | ||
366 | int rtype = 0; | 351 | int rtype = 0; |
367 | // qDebug("recurs "); | 352 | // qDebug("recurs "); |
368 | QDate startDate, endDate; | 353 | QDate startDate, endDate; |
369 | if ( repeat_startdate.Day > 0 ) | 354 | if ( repeat_startdate.Day > 0 ) |
370 | startDate = datefromGSM ( &repeat_startdate ); | 355 | startDate = datefromGSM ( &repeat_startdate ); |
371 | else | 356 | else |
372 | startDate = event->dtStart().date(); | 357 | startDate = event->dtStart().date(); |
373 | int freq = repeat_frequency; | 358 | int freq = repeat_frequency; |
374 | bool hasEndDate = false; | 359 | bool hasEndDate = false; |
375 | if ( repeat_stopdate.Day > 0 ) { | 360 | if ( repeat_stopdate.Day > 0 ) { |
376 | endDate = datefromGSM ( &repeat_stopdate ); | 361 | endDate = datefromGSM ( &repeat_stopdate ); |
377 | hasEndDate = true; | 362 | hasEndDate = true; |
378 | } | 363 | } |
379 | 364 | ||
380 | uint weekDaysNum = repeat_dayofweek ; | 365 | uint weekDaysNum = repeat_dayofweek ; |
381 | 366 | ||
382 | QBitArray weekDays( 7 ); | 367 | QBitArray weekDays( 7 ); |
383 | int i; | 368 | int i; |
384 | int bb = 1; | 369 | int bb = 1; |
385 | for( i = 1; i <= 7; ++i ) { | 370 | for( i = 1; i <= 7; ++i ) { |
386 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); | 371 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); |
387 | bb = 2 << (i-1); | 372 | bb = 2 << (i-1); |
388 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); | 373 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); |
389 | } | 374 | } |
390 | // qDebug("next "); | 375 | // qDebug("next "); |
391 | int pos = 0; | 376 | int pos = 0; |
392 | Recurrence *r = event->recurrence(); | 377 | Recurrence *r = event->recurrence(); |
393 | /* | 378 | /* |
394 | 0 daily; | 379 | 0 daily; |
395 | 1 weekly;x | 380 | 1 weekly;x |
396 | 2 monthpos;x | 381 | 2 monthpos;x |
397 | 3 monthlyday; | 382 | 3 monthlyday; |
398 | 4 rYearlyMont | 383 | 4 rYearlyMont |
399 | bool repeating = false; | 384 | bool repeating = false; |
400 | int repeat_dayofweek = -1; | 385 | int repeat_dayofweek = -1; |
401 | int repeat_day = -1; | 386 | int repeat_day = -1; |
402 | int repeat_weekofmonth = -1; | 387 | int repeat_weekofmonth = -1; |
403 | int repeat_month = -1; | 388 | int repeat_month = -1; |
404 | int repeat_frequency = -1; | 389 | int repeat_frequency = -1; |
405 | */ | 390 | */ |
406 | int dayOfWeek = startDate.dayOfWeek(); | 391 | int dayOfWeek = startDate.dayOfWeek(); |
407 | if ( repeat_weekofmonth >= 0 ) { | 392 | if ( repeat_weekofmonth >= 0 ) { |
408 | rtype = 2; | 393 | rtype = 2; |
409 | pos = repeat_weekofmonth; | 394 | pos = repeat_weekofmonth; |
410 | if ( repeat_dayofweek >= 0 ) | 395 | if ( repeat_dayofweek >= 0 ) |
411 | dayOfWeek = repeat_dayofweek; | 396 | dayOfWeek = repeat_dayofweek; |
412 | } else if ( repeat_dayofweek >= 0 ) { | 397 | } else if ( repeat_dayofweek >= 0 ) { |
413 | rtype = 1; | 398 | rtype = 1; |
414 | } if ( repeat_dayofweek >= 0 ) { | 399 | } if ( repeat_dayofweek >= 0 ) { |
415 | rtype = 1; | 400 | rtype = 1; |
416 | } | 401 | } |
417 | 402 | ||
418 | if ( rtype == 0 ) { | 403 | if ( rtype == 0 ) { |
419 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 404 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
420 | else r->setDaily( freq, -1 ); | 405 | else r->setDaily( freq, -1 ); |
421 | } else if ( rtype == 1 ) { | 406 | } else if ( rtype == 1 ) { |
422 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 407 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
423 | else r->setWeekly( freq, weekDays, -1 ); | 408 | else r->setWeekly( freq, weekDays, -1 ); |
424 | } else if ( rtype == 3 ) { | 409 | } else if ( rtype == 3 ) { |
425 | if ( hasEndDate ) | 410 | if ( hasEndDate ) |
426 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 411 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
427 | else | 412 | else |
428 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); | 413 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); |
429 | r->addMonthlyDay( startDate.day() ); | 414 | r->addMonthlyDay( startDate.day() ); |
430 | } else if ( rtype == 2 ) { | 415 | } else if ( rtype == 2 ) { |
431 | if ( hasEndDate ) | 416 | if ( hasEndDate ) |
432 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 417 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
433 | else | 418 | else |
434 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 419 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
435 | QBitArray days( 7 ); | 420 | QBitArray days( 7 ); |
436 | days.fill( false ); | 421 | days.fill( false ); |
437 | days.setBit( dayOfWeek - 1 ); | 422 | days.setBit( dayOfWeek - 1 ); |
438 | r->addMonthlyPos( pos, days ); | 423 | r->addMonthlyPos( pos, days ); |
439 | } else if ( rtype == 4 ) { | 424 | } else if ( rtype == 4 ) { |
440 | if ( hasEndDate ) | 425 | if ( hasEndDate ) |
441 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 426 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
442 | else | 427 | else |
443 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 428 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
444 | r->addYearlyNum( startDate.month() ); | 429 | r->addYearlyNum( startDate.month() ); |
445 | } | 430 | } |
446 | } else { | 431 | } else { |
447 | event->recurrence()->unsetRecurs(); | 432 | event->recurrence()->unsetRecurs(); |
448 | } | 433 | } |
449 | 434 | ||
450 | QStringList categoryList; | 435 | QStringList categoryList; |
451 | categoryList << getCategory( Note ); | 436 | categoryList << getCategory( Note ); |
452 | event->setCategories( categoryList ); | 437 | event->setCategories( categoryList ); |
453 | QString alarmString = ""; | 438 | QString alarmString = ""; |
454 | // strange 0 semms to mean: alarm enabled | 439 | // strange 0 semms to mean: alarm enabled |
455 | if ( alarm ) { | 440 | if ( alarm ) { |
456 | Alarm *alarm; | 441 | Alarm *alarm; |
457 | if ( event->alarms().count() > 0 ) | 442 | if ( event->alarms().count() > 0 ) |
458 | alarm = event->alarms().first(); | 443 | alarm = event->alarms().first(); |
459 | else { | 444 | else { |
460 | alarm = new Alarm( event ); | 445 | alarm = new Alarm( event ); |
461 | event->addAlarm( alarm ); | 446 | event->addAlarm( alarm ); |
462 | } | 447 | } |
463 | alarm->setType( Alarm::Audio ); | 448 | alarm->setType( Alarm::Audio ); |
464 | alarm->setEnabled( true ); | 449 | alarm->setEnabled( true ); |
465 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); | 450 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); |
466 | alarm->setStartOffset( alarmOffset ); | 451 | alarm->setStartOffset( alarmOffset ); |
467 | alarmString = QString::number( alarmOffset ); | 452 | alarmString = QString::number( alarmOffset ); |
468 | } | 453 | } |
469 | // csum ***************************************** | 454 | // csum ***************************************** |
470 | QStringList attList; | 455 | QStringList attList; |
471 | uint cSum; | 456 | uint cSum; |
472 | attList << dtToString ( event->dtStart() ); | 457 | attList << dtToString ( event->dtStart() ); |
473 | attList << dtToString ( event->dtEnd() ); | 458 | attList << dtToString ( event->dtEnd() ); |
474 | attList << QString::number( id ); | 459 | attList << QString::number( id ); |
475 | attList << event->summary(); | 460 | attList << event->summary(); |
476 | attList << event->location(); | 461 | attList << event->location(); |
477 | attList << alarmString; | 462 | attList << alarmString; |
478 | attList << recurString; | 463 | attList << recurString; |
479 | attList << event->categoriesStr(); | 464 | attList << event->categoriesStr(); |
480 | attList << event->secrecyStr(); | 465 | attList << event->secrecyStr(); |
481 | cSum = PhoneFormat::getCsum(attList ); | 466 | cSum = PhoneFormat::getCsum(attList ); |
482 | event->setCsum( mProfileName, QString::number( cSum )); | 467 | event->setCsum( mProfileName, QString::number( cSum )); |
483 | mCalendar->addEvent( event); | 468 | mCalendar->addEvent( event); |
484 | 469 | ||
485 | return true; | 470 | return true; |
486 | } | 471 | } |
487 | 472 | ||
488 | 473 | ||
489 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { | 474 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { |
490 | QDateTime dt; | 475 | QDateTime dt; |
491 | int y,m,t,h,min,sec; | 476 | int y,m,t,h,min,sec; |
492 | y = dtp->Year; | 477 | y = dtp->Year; |
493 | m = dtp->Month; | 478 | m = dtp->Month; |
494 | t = dtp->Day; | 479 | t = dtp->Day; |
495 | h = dtp->Hour; | 480 | h = dtp->Hour; |
496 | min = dtp->Minute; | 481 | min = dtp->Minute; |
497 | sec = dtp->Second; | 482 | sec = dtp->Second; |
498 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); | 483 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); |
499 | // dtp->Timezone: offset in hours | 484 | // dtp->Timezone: offset in hours |
500 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 485 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
501 | if ( useTz ) | 486 | if ( useTz ) |
502 | dt = dt.addSecs ( offset*60); | 487 | dt = dt.addSecs ( offset*60); |
503 | return dt; | 488 | return dt; |
504 | 489 | ||
505 | } | 490 | } |
506 | 491 | ||
507 | QString dtToString( const QDateTime& dti, bool useTZ = false ) | 492 | QString dtToString( const QDateTime& dti, bool useTZ = false ) |
508 | { | 493 | { |
509 | QString datestr; | 494 | QString datestr; |
510 | QString timestr; | 495 | QString timestr; |
511 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 496 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
512 | QDateTime dt; | 497 | QDateTime dt; |
513 | if (useTZ) | 498 | if (useTZ) |
514 | dt = dti.addSecs ( -(offset*60)); | 499 | dt = dti.addSecs ( -(offset*60)); |
515 | else | 500 | else |
516 | dt = dti; | 501 | dt = dti; |
517 | if(dt.date().isValid()){ | 502 | if(dt.date().isValid()){ |
518 | const QDate& date = dt.date(); | 503 | const QDate& date = dt.date(); |
519 | datestr.sprintf("%04d%02d%02d", | 504 | datestr.sprintf("%04d%02d%02d", |
520 | date.year(), date.month(), date.day()); | 505 | date.year(), date.month(), date.day()); |
521 | } | 506 | } |
522 | if(dt.time().isValid()){ | 507 | if(dt.time().isValid()){ |
523 | const QTime& time = dt.time(); | 508 | const QTime& time = dt.time(); |
524 | timestr.sprintf("T%02d%02d%02d", | 509 | timestr.sprintf("T%02d%02d%02d", |
525 | time.hour(), time.minute(), time.second()); | 510 | time.hour(), time.minute(), time.second()); |
526 | } | 511 | } |
527 | return datestr + timestr; | 512 | return datestr + timestr; |
528 | } | 513 | } |
529 | QDate datefromGSM ( GSM_DateTime*dtp ) { | 514 | QDate datefromGSM ( GSM_DateTime*dtp ) { |
530 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); | 515 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); |
531 | } | 516 | } |
532 | QString getCategory( GSM_CalendarEntry*Note) | 517 | QString getCategory( GSM_CalendarEntry*Note) |
533 | { | 518 | { |
534 | QString CATEGORY; | 519 | QString CATEGORY; |
535 | switch (Note->Type) { | 520 | switch (Note->Type) { |
536 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; | 521 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; |
537 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; | 522 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; |
538 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; | 523 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; |
539 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; | 524 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; |
540 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; | 525 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; |
541 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; | 526 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; |
542 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; | 527 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; |
543 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; | 528 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; |
544 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; | 529 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; |
545 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; | 530 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; |
546 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; | 531 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; |
547 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; | 532 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; |
548 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; | 533 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; |
549 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; | 534 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; |
550 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; | 535 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; |
551 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; | 536 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; |
552 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; | 537 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; |
553 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; | 538 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; |
554 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; | 539 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; |
555 | case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; | 540 | case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; |
556 | case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; | 541 | case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; |
557 | case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; | 542 | case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; |
558 | case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; | 543 | case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; |
559 | case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; | 544 | case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; |
560 | case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; | 545 | case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; |
561 | case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; | 546 | case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; |
562 | case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; | 547 | case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; |
563 | case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; | 548 | case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; |
564 | default : CATEGORY = QString(""); | 549 | default : CATEGORY = QString(""); |
565 | } | 550 | } |
566 | 551 | ||
567 | return CATEGORY; | 552 | return CATEGORY; |
568 | } | 553 | } |
569 | 554 | ||
570 | protected: | 555 | protected: |
571 | private: | 556 | private: |
572 | Calendar *mCalendar; | 557 | Calendar *mCalendar; |
573 | QString mProfileName ; | 558 | QString mProfileName ; |
574 | }; | 559 | }; |
575 | 560 | ||
576 | 561 | ||
577 | PhoneFormat::PhoneFormat() | 562 | PhoneFormat::PhoneFormat() |
578 | { | 563 | { |
579 | ; | 564 | ; |
580 | } | 565 | } |
581 | 566 | ||
582 | PhoneFormat::~PhoneFormat() | 567 | PhoneFormat::~PhoneFormat() |
583 | { | 568 | { |
584 | } | 569 | } |
585 | ulong PhoneFormat::getCsum( const QStringList & attList) | 570 | ulong PhoneFormat::getCsum( const QStringList & attList) |
586 | { | 571 | { |
587 | int max = attList.count() -1; | 572 | int max = attList.count() -1; |
588 | ulong cSum = 0; | 573 | ulong cSum = 0; |
589 | int j,k,i; | 574 | int j,k,i; |
590 | int add; | 575 | int add; |
591 | for ( i = 1; i < max ; ++i ) { | 576 | for ( i = 1; i < max ; ++i ) { |
592 | QString s = attList[i]; | 577 | QString s = attList[i]; |
593 | if ( ! s.isEmpty() ){ | 578 | if ( ! s.isEmpty() ){ |
594 | j = s.length(); | 579 | j = s.length(); |
595 | for ( k = 0; k < j; ++k ) { | 580 | for ( k = 0; k < j; ++k ) { |
596 | int mul = k +1; | 581 | int mul = k +1; |
597 | add = s[k].unicode (); | 582 | add = s[k].unicode (); |
598 | if ( k < 16 ) | 583 | if ( k < 16 ) |
599 | mul = mul * mul; | 584 | mul = mul * mul; |
600 | add = add * mul *i*i*i; | 585 | add = add * mul *i*i*i; |
601 | cSum += add; | 586 | cSum += add; |
602 | } | 587 | } |
603 | } | 588 | } |
604 | } | 589 | } |
605 | return cSum; | 590 | return cSum; |
606 | 591 | ||
607 | } | 592 | } |
608 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); | 593 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); |
609 | #include <stdlib.h> | 594 | #include <stdlib.h> |
610 | #define DEBUGMODE false | 595 | #define DEBUGMODE false |
611 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profileName, QString device,QString connection, QString model ) | 596 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profileName, QString device,QString connection, QString model ) |
612 | { | 597 | { |
613 | mProfileName = profileName; | 598 | mProfileName = profileName; |
614 | GSM_StateMachines; | 599 | GSM_StateMachines; |
615 | qDebug(" load "); | 600 | qDebug(" load "); |
616 | s.opened = false; | 601 | s.opened = false; |
617 | s.msg = NULL; | 602 | s.msg = NULL; |
618 | s.ConfigNum = 0; | 603 | s.ConfigNum = 0; |
619 | #if 0 | 604 | #if 0 |
620 | static char*cp; | 605 | static char*cp; |
621 | static INI_Section *cfg = NULL; | 606 | static INI_Section *cfg = NULL; |
622 | cfg=GSM_FindGammuRC(); | 607 | cfg=GSM_FindGammuRC(); |
623 | int i; | 608 | int i; |
624 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 609 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
625 | if (cfg!=NULL) { | 610 | if (cfg!=NULL) { |
626 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); | 611 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); |
627 | if (cp) di.coding = cp; | 612 | if (cp) di.coding = cp; |
628 | 613 | ||
629 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); | 614 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); |
630 | if (s.Config[i].Localize) { | 615 | if (s.Config[i].Localize) { |
631 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | 616 | s.msg=INI_ReadFile(s.Config[i].Localize, true); |
632 | } else { | 617 | } else { |
633 | #if !defined(WIN32) && defined(LOCALE_PATH) | 618 | #if !defined(WIN32) && defined(LOCALE_PATH) |
634 | locale = setlocale(LC_MESSAGES, NULL); | 619 | locale = setlocale(LC_MESSAGES, NULL); |
635 | if (locale != NULL) { | 620 | if (locale != NULL) { |
636 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | 621 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", |
637 | LOCALE_PATH, | 622 | LOCALE_PATH, |
638 | tolower(locale[0]), | 623 | tolower(locale[0]), |
639 | tolower(locale[1])); | 624 | tolower(locale[1])); |
640 | s.msg = INI_ReadFile(locale_file, true); | 625 | s.msg = INI_ReadFile(locale_file, true); |
641 | } | 626 | } |
642 | #endif | 627 | #endif |
643 | } | 628 | } |
644 | } | 629 | } |
645 | 630 | ||
646 | /* Wanted user specific configuration? */ | 631 | /* Wanted user specific configuration? */ |
647 | 632 | ||
648 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 633 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
649 | 634 | ||
650 | s.ConfigNum++; | 635 | s.ConfigNum++; |
651 | 636 | ||
652 | /* We want to use only one file descriptor for global and state machine debug output */ | 637 | /* We want to use only one file descriptor for global and state machine debug output */ |
653 | s.Config[i].UseGlobalDebugFile = true; | 638 | s.Config[i].UseGlobalDebugFile = true; |
654 | 639 | ||
655 | 640 | ||
656 | 641 | ||
657 | /* We wanted to read just user specified configuration. */ | 642 | /* We wanted to read just user specified configuration. */ |
658 | {break;} | 643 | {break;} |
659 | } | 644 | } |
660 | 645 | ||
661 | #endif | 646 | #endif |
662 | setlocale(LC_ALL, ""); | 647 | setlocale(LC_ALL, ""); |
663 | GSM_ReadConfig(NULL, &s.Config[0], 0); | 648 | GSM_ReadConfig(NULL, &s.Config[0], 0); |
664 | s.ConfigNum = 1; | 649 | s.ConfigNum = 1; |
665 | GSM_Config *cfg = &s.Config[0]; | 650 | GSM_Config *cfg = &s.Config[0]; |
666 | di.coding = "utf8"; | ||
667 | if ( ! connection.isEmpty() ) { | 651 | if ( ! connection.isEmpty() ) { |
668 | cfg->Connection = strdup(connection.latin1()); | 652 | cfg->Connection = strdup(connection.latin1()); |
669 | cfg->DefaultConnection = false; | 653 | cfg->DefaultConnection = false; |
670 | qDebug("Connection set %s ", cfg->Connection ); | 654 | qDebug("Connection set %s ", cfg->Connection ); |
671 | 655 | ||
672 | } | 656 | } |
673 | if ( ! device.isEmpty() ) { | 657 | if ( ! device.isEmpty() ) { |
674 | cfg->Device = strdup(device.latin1()); | 658 | cfg->Device = strdup(device.latin1()); |
675 | cfg->DefaultDevice = false; | 659 | cfg->DefaultDevice = false; |
676 | qDebug("Device set %s ", cfg->Device); | 660 | qDebug("Device set %s ", cfg->Device); |
677 | 661 | ||
678 | } | 662 | } |
679 | if ( ! model.isEmpty() ) { | 663 | if ( ! model.isEmpty() ) { |
680 | strcpy(cfg->Model,model.latin1() ); | 664 | strcpy(cfg->Model,model.latin1() ); |
681 | cfg->DefaultModel = false; | 665 | cfg->DefaultModel = false; |
682 | qDebug("Model set %s ",cfg->Model ); | 666 | qDebug("Model set %s ",cfg->Model ); |
683 | 667 | ||
684 | 668 | ||
685 | } | 669 | } |
686 | int error=GSM_InitConnection(&s,3); | 670 | int error=GSM_InitConnection(&s,3); |
687 | qDebug(" init %d %d", error, ERR_NONE); | 671 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); |
688 | if ( error != ERR_NONE ) | 672 | if ( error != ERR_NONE ) |
689 | return false; | 673 | return false; |
690 | // fromString2Cal( calendar, existngCal, &s, "Event" ); | ||
691 | GSM_Phone_Functions*Phone; | 674 | GSM_Phone_Functions*Phone; |
692 | GSM_CalendarEntrynote; | 675 | GSM_CalendarEntrynote; |
693 | bool start = true; | 676 | bool start = true; |
694 | Phone=s.Phone.Functions; | 677 | Phone=s.Phone.Functions; |
695 | bool gshutdown = false; | 678 | bool gshutdown = false; |
696 | PhoneParser handler( calendar, profileName ); | 679 | PhoneParser handler( calendar, profileName ); |
697 | int ccc = 0; | 680 | int ccc = 0; |
698 | while (!gshutdown && ccc++ < 3) { | 681 | qDebug("Debug: only 10 calender items are downloaded "); |
682 | while (!gshutdown && ccc++ < 10) { | ||
699 | 683 | ||
700 | qDebug("readEvent %d ", ccc); | 684 | qDebug("readEvent %d ", ccc); |
701 | error=Phone->GetNextCalendar(&s,¬e,start); | 685 | error=Phone->GetNextCalendar(&s,¬e,start); |
702 | if (error == ERR_EMPTY) break; | 686 | if (error == ERR_EMPTY) break; |
703 | start = false; | 687 | start = false; |
704 | handler.readEvent( existingCal, ¬e ); | 688 | handler.readEvent( existingCal, ¬e ); |
705 | } | 689 | } |
706 | 690 | ||
707 | start = true; | 691 | start = true; |
708 | GSM_ToDoEntry ToDo; | 692 | GSM_ToDoEntry ToDo; |
709 | ccc = 0; | 693 | ccc = 0; |
710 | while (!gshutdown) { | 694 | while (!gshutdown) { |
711 | error = Phone->GetNextToDo(&s, &ToDo, start); | 695 | error = Phone->GetNextToDo(&s, &ToDo, start); |
712 | if (error == ERR_EMPTY) break; | 696 | if (error == ERR_EMPTY) break; |
713 | start = false; | 697 | start = false; |
714 | qDebug("readTodo %d ", ++ccc); | 698 | qDebug("ReadTodo %d ", ++ccc); |
715 | handler.readTodo( existingCal, &ToDo, &s); | 699 | handler.readTodo( existingCal, &ToDo, &s); |
716 | 700 | ||
717 | } | 701 | } |
718 | 702 | ||
719 | error=GSM_TerminateConnection(&s); | 703 | error=GSM_TerminateConnection(&s); |
720 | 704 | ||
721 | return true; | 705 | return true; |
722 | } | 706 | } |
723 | 707 | ||
724 | bool PhoneFormat::save( Calendar *calendar) | 708 | bool PhoneFormat::save( Calendar *calendar) |
725 | { | 709 | { |
726 | #if 0 | 710 | #if 0 |
727 | QLabel status ( i18n("Processing/adding events ..."), 0 ); | 711 | QLabel status ( i18n("Processing/adding events ..."), 0 ); |
728 | int w = status.sizeHint().width()+20 ; | 712 | int w = status.sizeHint().width()+20 ; |
729 | if ( w < 200 ) w = 200; | 713 | if ( w < 200 ) w = 200; |
730 | int h = status.sizeHint().height()+20 ; | 714 | int h = status.sizeHint().height()+20 ; |
731 | int dw = QApplication::desktop()->width(); | 715 | int dw = QApplication::desktop()->width(); |
732 | int dh = QApplication::desktop()->height(); | 716 | int dh = QApplication::desktop()->height(); |
733 | status.setCaption(i18n("Writing DTM Data") ); | 717 | status.setCaption(i18n("Writing DTM Data") ); |
734 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 718 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
735 | status.show(); | 719 | status.show(); |
736 | status.raise(); | 720 | status.raise(); |
737 | qApp->processEvents(); | 721 | qApp->processEvents(); |
738 | bool debug = DEBUGMODE; | 722 | bool debug = DEBUGMODE; |
739 | QString codec = "utf8"; | 723 | QString codec = "utf8"; |
740 | QString answer; | 724 | QString answer; |
741 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; | 725 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; |
742 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; | 726 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; |
743 | QString command; | 727 | QString command; |
744 | QPtrList<Event> er = calendar->rawEvents(); | 728 | QPtrList<Event> er = calendar->rawEvents(); |
745 | Event* ev = er.first(); | 729 | Event* ev = er.first(); |
746 | QString fileName = "/tmp/kopitempout"; | 730 | QString fileName = "/tmp/kopitempout"; |
747 | int i = 0; | 731 | int i = 0; |
748 | QString changeString = ePrefix; | 732 | QString changeString = ePrefix; |
749 | QString deleteString = ePrefix; | 733 | QString deleteString = ePrefix; |
750 | bool deleteEnt = false; | 734 | bool deleteEnt = false; |
751 | bool changeEnt = false; | 735 | bool changeEnt = false; |
752 | QString message = i18n("Processing event # "); | 736 | QString message = i18n("Processing event # "); |
753 | int procCount = 0; | 737 | int procCount = 0; |
754 | while ( ev ) { | 738 | while ( ev ) { |
755 | //qDebug("i %d ", ++i); | 739 | //qDebug("i %d ", ++i); |
756 | if ( true /*ev->zaurusStat() != -2*/ ) { | 740 | if ( true /*ev->zaurusStat() != -2*/ ) { |
757 | status.setText ( message + QString::number ( ++procCount ) ); | 741 | status.setText ( message + QString::number ( ++procCount ) ); |
758 | qApp->processEvents(); | 742 | qApp->processEvents(); |
759 | QString eString = getEventString( ev ); | 743 | QString eString = getEventString( ev ); |
760 | if (/* ev->zaurusStat() == -3 */ true) { // delete | 744 | if (/* ev->zaurusStat() == -3 */ true) { // delete |
761 | // deleting empty strings does not work. | 745 | // deleting empty strings does not work. |
762 | // we write first and x and then delete the record with the x | 746 | // we write first and x and then delete the record with the x |
763 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 747 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
764 | changeString += eString + "\n"; | 748 | changeString += eString + "\n"; |
765 | deleteString += eString + "\n"; | 749 | deleteString += eString + "\n"; |
766 | deleteEnt = true; | 750 | deleteEnt = true; |
767 | changeEnt = true; | 751 | changeEnt = true; |
768 | } | 752 | } |
769 | else if ( /*ev->zaurusId() == -1*/true ) { // add new | 753 | else if ( /*ev->zaurusId() == -1*/true ) { // add new |
770 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 754 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
771 | system ( command.utf8() ); | 755 | system ( command.utf8() ); |
772 | QFile file( fileName ); | 756 | QFile file( fileName ); |
773 | if (!file.open( IO_ReadOnly ) ) { | 757 | if (!file.open( IO_ReadOnly ) ) { |
774 | return false; | 758 | return false; |
775 | 759 | ||
776 | } | 760 | } |
777 | QTextStream ts( &file ); | 761 | QTextStream ts( &file ); |
778 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 762 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
779 | answer = ts.read(); | 763 | answer = ts.read(); |
780 | file.close(); | 764 | file.close(); |
781 | //qDebug("answer \n%s ", answer.latin1()); | 765 | //qDebug("answer \n%s ", answer.latin1()); |
782 | getNumFromRecord( answer, ev ) ; | 766 | getNumFromRecord( answer, ev ) ; |
783 | 767 | ||
784 | } | 768 | } |
785 | else { // change existing | 769 | else { // change existing |
786 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); | 770 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); |
787 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 771 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
788 | changeString += eString + "\n"; | 772 | changeString += eString + "\n"; |
789 | changeEnt = true; | 773 | changeEnt = true; |
790 | 774 | ||
791 | } | 775 | } |
792 | } | 776 | } |
793 | ev = er.next(); | 777 | ev = er.next(); |
794 | } | 778 | } |
795 | status.setText ( i18n("Changing events ...") ); | 779 | status.setText ( i18n("Changing events ...") ); |
796 | qApp->processEvents(); | 780 | qApp->processEvents(); |
797 | //qDebug("changing... "); | 781 | //qDebug("changing... "); |
798 | if ( changeEnt ) { | 782 | if ( changeEnt ) { |
799 | QFile file( fileName ); | 783 | QFile file( fileName ); |
800 | if (!file.open( IO_WriteOnly ) ) { | 784 | if (!file.open( IO_WriteOnly ) ) { |
801 | return false; | 785 | return false; |
802 | 786 | ||
803 | } | 787 | } |
804 | QTextStream ts( &file ); | 788 | QTextStream ts( &file ); |
805 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 789 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
806 | ts << changeString ; | 790 | ts << changeString ; |
807 | file.close(); | 791 | file.close(); |
808 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; | 792 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; |
809 | system ( command.latin1() ); | 793 | system ( command.latin1() ); |
810 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 794 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
811 | 795 | ||
812 | } | 796 | } |
813 | status.setText ( i18n("Deleting events ...") ); | 797 | status.setText ( i18n("Deleting events ...") ); |
814 | qApp->processEvents(); | 798 | qApp->processEvents(); |
815 | //qDebug("deleting... "); | 799 | //qDebug("deleting... "); |
816 | if ( deleteEnt ) { | 800 | if ( deleteEnt ) { |
817 | QFile file( fileName ); | 801 | QFile file( fileName ); |
818 | if (!file.open( IO_WriteOnly ) ) { | 802 | if (!file.open( IO_WriteOnly ) ) { |
819 | return false; | 803 | return false; |
820 | 804 | ||
821 | } | 805 | } |
822 | QTextStream ts( &file ); | 806 | QTextStream ts( &file ); |
823 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 807 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
824 | ts << deleteString; | 808 | ts << deleteString; |
825 | file.close(); | 809 | file.close(); |
826 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; | 810 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; |
827 | system ( command.latin1() ); | 811 | system ( command.latin1() ); |
828 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 812 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
829 | } | 813 | } |
830 | 814 | ||
831 | 815 | ||
832 | changeString = tPrefix; | 816 | changeString = tPrefix; |
833 | deleteString = tPrefix; | 817 | deleteString = tPrefix; |
834 | status.setText ( i18n("Processing todos ...") ); | 818 | status.setText ( i18n("Processing todos ...") ); |
835 | qApp->processEvents(); | 819 | qApp->processEvents(); |
836 | QPtrList<Todo> tl = calendar->rawTodos(); | 820 | QPtrList<Todo> tl = calendar->rawTodos(); |
837 | Todo* to = tl.first(); | 821 | Todo* to = tl.first(); |
838 | i = 0; | 822 | i = 0; |
839 | message = i18n("Processing todo # "); | 823 | message = i18n("Processing todo # "); |
840 | procCount = 0; | 824 | procCount = 0; |
841 | while ( to ) { | 825 | while ( to ) { |
842 | if ( true /*to->zaurusStat() != -2 */) { | 826 | if ( true /*to->zaurusStat() != -2 */) { |
843 | status.setText ( message + QString::number ( ++procCount ) ); | 827 | status.setText ( message + QString::number ( ++procCount ) ); |
844 | qApp->processEvents(); | 828 | qApp->processEvents(); |
845 | QString eString = getTodoString( to ); | 829 | QString eString = getTodoString( to ); |
846 | if ( /*to->zaurusStat() == -3*/true ) { // delete | 830 | if ( /*to->zaurusStat() == -3*/true ) { // delete |
847 | // deleting empty strings does not work. | 831 | // deleting empty strings does not work. |
848 | // we write first and x and then delete the record with the x | 832 | // we write first and x and then delete the record with the x |
849 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 833 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
850 | changeString += eString + "\n"; | 834 | changeString += eString + "\n"; |
851 | deleteString += eString + "\n"; | 835 | deleteString += eString + "\n"; |
852 | deleteEnt = true; | 836 | deleteEnt = true; |
853 | changeEnt = true; | 837 | changeEnt = true; |
854 | } | 838 | } |
855 | else if ( true /*to->zaurusId() == -1*/ ) { // add new | 839 | else if ( true /*to->zaurusId() == -1*/ ) { // add new |
856 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; | 840 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; |
857 | system ( command.utf8() ); | 841 | system ( command.utf8() ); |
858 | QFile file( fileName ); | 842 | QFile file( fileName ); |
859 | if (!file.open( IO_ReadOnly ) ) { | 843 | if (!file.open( IO_ReadOnly ) ) { |
860 | return false; | 844 | return false; |
861 | 845 | ||
862 | } | 846 | } |
863 | QTextStream ts( &file ); | 847 | QTextStream ts( &file ); |
864 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 848 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
865 | answer = ts.read(); | 849 | answer = ts.read(); |
866 | file.close(); | 850 | file.close(); |
867 | //qDebug("answer \n%s ", answer.latin1()); | 851 | //qDebug("answer \n%s ", answer.latin1()); |
868 | getNumFromRecord( answer, to ) ; | 852 | getNumFromRecord( answer, to ) ; |
869 | 853 | ||
870 | } | 854 | } |
871 | else { // change existing | 855 | else { // change existing |
872 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); | 856 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); |
873 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 857 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
874 | changeString += eString + "\n"; | 858 | changeString += eString + "\n"; |
875 | changeEnt = true; | 859 | changeEnt = true; |
876 | 860 | ||
877 | } | 861 | } |
878 | } | 862 | } |
879 | 863 | ||
880 | to = tl.next(); | 864 | to = tl.next(); |
881 | } | 865 | } |
882 | status.setText ( i18n("Changing todos ...") ); | 866 | status.setText ( i18n("Changing todos ...") ); |
883 | qApp->processEvents(); | 867 | qApp->processEvents(); |
884 | //qDebug("changing... "); | 868 | //qDebug("changing... "); |
885 | if ( changeEnt ) { | 869 | if ( changeEnt ) { |
886 | QFile file( fileName ); | 870 | QFile file( fileName ); |
887 | if (!file.open( IO_WriteOnly ) ) { | 871 | if (!file.open( IO_WriteOnly ) ) { |
888 | return false; | 872 | return false; |
889 | 873 | ||
890 | } | 874 | } |
891 | QTextStream ts( &file ); | 875 | QTextStream ts( &file ); |
892 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 876 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
893 | ts << changeString ; | 877 | ts << changeString ; |
894 | file.close(); | 878 | file.close(); |
895 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; | 879 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; |
896 | system ( command.latin1() ); | 880 | system ( command.latin1() ); |
897 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 881 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
898 | 882 | ||
899 | } | 883 | } |
900 | status.setText ( i18n("Deleting todos ...") ); | 884 | status.setText ( i18n("Deleting todos ...") ); |
901 | qApp->processEvents(); | 885 | qApp->processEvents(); |
902 | //qDebug("deleting... "); | 886 | //qDebug("deleting... "); |
903 | if ( deleteEnt ) { | 887 | if ( deleteEnt ) { |
904 | QFile file( fileName ); | 888 | QFile file( fileName ); |
905 | if (!file.open( IO_WriteOnly ) ) { | 889 | if (!file.open( IO_WriteOnly ) ) { |
906 | return false; | 890 | return false; |
907 | 891 | ||
908 | } | 892 | } |
909 | QTextStream ts( &file ); | 893 | QTextStream ts( &file ); |
910 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 894 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
911 | ts << deleteString; | 895 | ts << deleteString; |
912 | file.close(); | 896 | file.close(); |
913 | command = "db2file todo -d -c " + codec+ " < "+ fileName; | 897 | command = "db2file todo -d -c " + codec+ " < "+ fileName; |
914 | system ( command.latin1() ); | 898 | system ( command.latin1() ); |
915 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 899 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
916 | } | 900 | } |
917 | #endif | 901 | #endif |
918 | return true; | 902 | return true; |
919 | } | 903 | } |
920 | QString PhoneFormat::dtToGSM( const QDateTime& dti, bool useTZ ) | 904 | QString PhoneFormat::dtToGSM( const QDateTime& dti, bool useTZ ) |
921 | { | 905 | { |
922 | QString datestr; | 906 | QString datestr; |
923 | QString timestr; | 907 | QString timestr; |
924 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 908 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
925 | QDateTime dt; | 909 | QDateTime dt; |
926 | if (useTZ) | 910 | if (useTZ) |
927 | dt = dti.addSecs ( -(offset*60)); | 911 | dt = dti.addSecs ( -(offset*60)); |
928 | else | 912 | else |
929 | dt = dti; | 913 | dt = dti; |
930 | if(dt.date().isValid()){ | 914 | if(dt.date().isValid()){ |
931 | const QDate& date = dt.date(); | 915 | const QDate& date = dt.date(); |
932 | datestr.sprintf("%04d%02d%02d", | 916 | datestr.sprintf("%04d%02d%02d", |
933 | date.year(), date.month(), date.day()); | 917 | date.year(), date.month(), date.day()); |
934 | } | 918 | } |
935 | if(dt.time().isValid()){ | 919 | if(dt.time().isValid()){ |
936 | const QTime& time = dt.time(); | 920 | const QTime& time = dt.time(); |
937 | timestr.sprintf("T%02d%02d%02d", | 921 | timestr.sprintf("T%02d%02d%02d", |
938 | time.hour(), time.minute(), time.second()); | 922 | time.hour(), time.minute(), time.second()); |
939 | } | 923 | } |
940 | return datestr + timestr; | 924 | return datestr + timestr; |
941 | } | 925 | } |
942 | QString PhoneFormat::getEventString( Event* event ) | 926 | QString PhoneFormat::getEventString( Event* event ) |
943 | { | 927 | { |
944 | #if 0 | 928 | #if 0 |
945 | QStringList list; | 929 | QStringList list; |
946 | list.append( QString::number(event->zaurusId() ) ); | 930 | list.append( QString::number(event->zaurusId() ) ); |
947 | list.append( event->categories().join(",") ); | 931 | list.append( event->categories().join(",") ); |
948 | if ( !event->summary().isEmpty() ) | 932 | if ( !event->summary().isEmpty() ) |
949 | list.append( event->summary() ); | 933 | list.append( event->summary() ); |
950 | else | 934 | else |
951 | list.append("" ); | 935 | list.append("" ); |
952 | if ( !event->location().isEmpty() ) | 936 | if ( !event->location().isEmpty() ) |
953 | list.append( event->location() ); | 937 | list.append( event->location() ); |
954 | else | 938 | else |
955 | list.append("" ); | 939 | list.append("" ); |
956 | if ( !event->description().isEmpty() ) | 940 | if ( !event->description().isEmpty() ) |
957 | list.append( event->description() ); | 941 | list.append( event->description() ); |
958 | else | 942 | else |
959 | list.append( "" ); | 943 | list.append( "" ); |
960 | if ( event->doesFloat () ) { | 944 | if ( event->doesFloat () ) { |
961 | list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false )); | 945 | list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false )); |
962 | list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6 | 946 | list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6 |
963 | list.append( "1" ); | 947 | list.append( "1" ); |
964 | 948 | ||
965 | } | 949 | } |
966 | else { | 950 | else { |
967 | list.append( dtToString( event->dtStart()) ); | 951 | list.append( dtToString( event->dtStart()) ); |
968 | list.append( dtToString( event->dtEnd()) ); //6 | 952 | list.append( dtToString( event->dtEnd()) ); //6 |
969 | list.append( "0" ); | 953 | list.append( "0" ); |
970 | } | 954 | } |
971 | bool noAlarm = true; | 955 | bool noAlarm = true; |
972 | if ( event->alarms().count() > 0 ) { | 956 | if ( event->alarms().count() > 0 ) { |
973 | Alarm * al = event->alarms().first(); | 957 | Alarm * al = event->alarms().first(); |
974 | if ( al->enabled() ) { | 958 | if ( al->enabled() ) { |
975 | noAlarm = false; | 959 | noAlarm = false; |
976 | list.append( "0" ); // yes, 0 == alarm | 960 | list.append( "0" ); // yes, 0 == alarm |
977 | list.append( QString::number( al->startOffset().asSeconds()/(-60) ) ); | 961 | list.append( QString::number( al->startOffset().asSeconds()/(-60) ) ); |
978 | if ( al->type() == Alarm::Audio ) | 962 | if ( al->type() == Alarm::Audio ) |
979 | list.append( "1" ); // type audio | 963 | list.append( "1" ); // type audio |
980 | else | 964 | else |
981 | list.append( "0" ); // type silent | 965 | list.append( "0" ); // type silent |
982 | } | 966 | } |
983 | } | 967 | } |
984 | if ( noAlarm ) { | 968 | if ( noAlarm ) { |
985 | list.append( "1" ); // yes, 1 == no alarm | 969 | list.append( "1" ); // yes, 1 == no alarm |
986 | list.append( "0" ); // no alarm offset | 970 | list.append( "0" ); // no alarm offset |
987 | list.append( "1" ); // type | 971 | list.append( "1" ); // type |
988 | } | 972 | } |
989 | // next is: 11 | 973 | // next is: 11 |
990 | // next is: 11-16 are recurrence | 974 | // next is: 11-16 are recurrence |
991 | Recurrence* rec = event->recurrence(); | 975 | Recurrence* rec = event->recurrence(); |
992 | 976 | ||
993 | bool writeEndDate = false; | 977 | bool writeEndDate = false; |
994 | switch ( rec->doesRecur() ) | 978 | switch ( rec->doesRecur() ) |
995 | { | 979 | { |
996 | case Recurrence::rDaily: // 0 | 980 | case Recurrence::rDaily: // 0 |
997 | list.append( "0" ); | 981 | list.append( "0" ); |
998 | list.append( QString::number( rec->frequency() ));//12 | 982 | list.append( QString::number( rec->frequency() ));//12 |
999 | list.append( "0" ); | 983 | list.append( "0" ); |
1000 | list.append( "0" ); | 984 | list.append( "0" ); |
1001 | writeEndDate = true; | 985 | writeEndDate = true; |
1002 | break; | 986 | break; |
1003 | case Recurrence::rWeekly:// 1 | 987 | case Recurrence::rWeekly:// 1 |
1004 | list.append( "1" ); | 988 | list.append( "1" ); |
1005 | list.append( QString::number( rec->frequency()) );//12 | 989 | list.append( QString::number( rec->frequency()) );//12 |
1006 | list.append( "0" ); | 990 | list.append( "0" ); |
1007 | { | 991 | { |
1008 | int days = 0; | 992 | int days = 0; |
1009 | QBitArray weekDays = rec->days(); | 993 | QBitArray weekDays = rec->days(); |
1010 | int i; | 994 | int i; |
1011 | for( i = 1; i <= 7; ++i ) { | 995 | for( i = 1; i <= 7; ++i ) { |
1012 | if ( weekDays[i-1] ) { | 996 | if ( weekDays[i-1] ) { |
1013 | days += 1 << (i-1); | 997 | days += 1 << (i-1); |
1014 | } | 998 | } |
1015 | } | 999 | } |
1016 | list.append( QString::number( days ) ); | 1000 | list.append( QString::number( days ) ); |
1017 | } | 1001 | } |
1018 | //pending weekdays | 1002 | //pending weekdays |
1019 | writeEndDate = true; | 1003 | writeEndDate = true; |
1020 | 1004 | ||
1021 | break; | 1005 | break; |
1022 | case Recurrence::rMonthlyPos:// 2 | 1006 | case Recurrence::rMonthlyPos:// 2 |
1023 | list.append( "2" ); | 1007 | list.append( "2" ); |
1024 | list.append( QString::number( rec->frequency()) );//12 | 1008 | list.append( QString::number( rec->frequency()) );//12 |
1025 | 1009 | ||
1026 | writeEndDate = true; | 1010 | writeEndDate = true; |
1027 | { | 1011 | { |
1028 | int count = 1; | 1012 | int count = 1; |
1029 | QPtrList<Recurrence::rMonthPos> rmp; | 1013 | QPtrList<Recurrence::rMonthPos> rmp; |
1030 | rmp = rec->monthPositions(); | 1014 | rmp = rec->monthPositions(); |
1031 | if ( rmp.first()->negative ) | 1015 | if ( rmp.first()->negative ) |
1032 | count = 5 - rmp.first()->rPos - 1; | 1016 | count = 5 - rmp.first()->rPos - 1; |
1033 | else | 1017 | else |
1034 | count = rmp.first()->rPos - 1; | 1018 | count = rmp.first()->rPos - 1; |
1035 | list.append( QString::number( count ) ); | 1019 | list.append( QString::number( count ) ); |
1036 | 1020 | ||
1037 | } | 1021 | } |
1038 | 1022 | ||
1039 | list.append( "0" ); | 1023 | list.append( "0" ); |
1040 | break; | 1024 | break; |
1041 | case Recurrence::rMonthlyDay:// 3 | 1025 | case Recurrence::rMonthlyDay:// 3 |
1042 | list.append( "3" ); | 1026 | list.append( "3" ); |
1043 | list.append( QString::number( rec->frequency()) );//12 | 1027 | list.append( QString::number( rec->frequency()) );//12 |
1044 | list.append( "0" ); | 1028 | list.append( "0" ); |
1045 | list.append( "0" ); | 1029 | list.append( "0" ); |
1046 | writeEndDate = true; | 1030 | writeEndDate = true; |
1047 | break; | 1031 | break; |
1048 | case Recurrence::rYearlyMonth://4 | 1032 | case Recurrence::rYearlyMonth://4 |
1049 | list.append( "4" ); | 1033 | list.append( "4" ); |
1050 | list.append( QString::number( rec->frequency()) );//12 | 1034 | list.append( QString::number( rec->frequency()) );//12 |
1051 | list.append( "0" ); | 1035 | list.append( "0" ); |
1052 | list.append( "0" ); | 1036 | list.append( "0" ); |
1053 | writeEndDate = true; | 1037 | writeEndDate = true; |
1054 | break; | 1038 | break; |
1055 | 1039 | ||
1056 | default: | 1040 | default: |
1057 | list.append( "255" ); | 1041 | list.append( "255" ); |
1058 | list.append( QString() ); | 1042 | list.append( QString() ); |
1059 | list.append( "0" ); | 1043 | list.append( "0" ); |
1060 | list.append( QString() ); | 1044 | list.append( QString() ); |
1061 | list.append( "0" ); | 1045 | list.append( "0" ); |
1062 | list.append( "20991231T000000" ); | 1046 | list.append( "20991231T000000" ); |
1063 | break; | 1047 | break; |
1064 | } | 1048 | } |
1065 | if ( writeEndDate ) { | 1049 | if ( writeEndDate ) { |
1066 | 1050 | ||
1067 | if ( rec->endDate().isValid() ) { // 15 + 16 | 1051 | if ( rec->endDate().isValid() ) { // 15 + 16 |
1068 | list.append( "1" ); | 1052 | list.append( "1" ); |
1069 | list.append( dtToString( rec->endDate()) ); | 1053 | list.append( dtToString( rec->endDate()) ); |
1070 | } else { | 1054 | } else { |
1071 | list.append( "0" ); | 1055 | list.append( "0" ); |
1072 | list.append( "20991231T000000" ); | 1056 | list.append( "20991231T000000" ); |
1073 | } | 1057 | } |
1074 | 1058 | ||
1075 | } | 1059 | } |
1076 | if ( event->doesFloat () ) { | 1060 | if ( event->doesFloat () ) { |
1077 | list.append( dtToString( event->dtStart(), false ).left( 8 )); | 1061 | list.append( dtToString( event->dtStart(), false ).left( 8 )); |
1078 | list.append( dtToString( event->dtEnd(), false ).left( 8 )); //6 | 1062 | list.append( dtToString( event->dtEnd(), false ).left( 8 )); //6 |
1079 | 1063 | ||
1080 | } | 1064 | } |
1081 | else { | 1065 | else { |
1082 | list.append( QString() ); | 1066 | list.append( QString() ); |
1083 | list.append( QString() ); | 1067 | list.append( QString() ); |
1084 | 1068 | ||
1085 | } | 1069 | } |
1086 | if (event->dtStart().date() == event->dtEnd().date() ) | 1070 | if (event->dtStart().date() == event->dtEnd().date() ) |
1087 | list.append( "0" ); | 1071 | list.append( "0" ); |
1088 | else | 1072 | else |
1089 | list.append( "1" ); | 1073 | list.append( "1" ); |
1090 | 1074 | ||
1091 | 1075 | ||
1092 | for(QStringList::Iterator it=list.begin(); | 1076 | for(QStringList::Iterator it=list.begin(); |
1093 | it!=list.end(); ++it){ | 1077 | it!=list.end(); ++it){ |
1094 | QString& s = (*it); | 1078 | QString& s = (*it); |
1095 | s.replace(QRegExp("\""), "\"\""); | 1079 | s.replace(QRegExp("\""), "\"\""); |
1096 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | 1080 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ |
1097 | s.prepend('\"'); | 1081 | s.prepend('\"'); |
1098 | s.append('\"'); | 1082 | s.append('\"'); |
1099 | } else if(s.isEmpty() && !s.isNull()){ | 1083 | } else if(s.isEmpty() && !s.isNull()){ |
1100 | s = "\"\""; | 1084 | s = "\"\""; |
1101 | } | 1085 | } |
1102 | } | 1086 | } |
1103 | return list.join(","); | 1087 | return list.join(","); |
1104 | #endif | 1088 | #endif |
1105 | return QString(); | 1089 | return QString(); |
1106 | 1090 | ||
1107 | } | 1091 | } |
1108 | QString PhoneFormat::getTodoString( Todo* todo ) | 1092 | QString PhoneFormat::getTodoString( Todo* todo ) |
1109 | { | 1093 | { |
1110 | #if 0 | 1094 | #if 0 |
1111 | QStringList list; | 1095 | QStringList list; |
1112 | list.append( QString::number( todo->zaurusId() ) ); | 1096 | list.append( QString::number( todo->zaurusId() ) ); |
1113 | list.append( todo->categories().join(",") ); | 1097 | list.append( todo->categories().join(",") ); |
1114 | 1098 | ||
1115 | if ( todo->hasStartDate() ) { | 1099 | if ( todo->hasStartDate() ) { |
1116 | list.append( dtToString( todo->dtStart()) ); | 1100 | list.append( dtToString( todo->dtStart()) ); |
1117 | } else | 1101 | } else |
1118 | list.append( QString() ); | 1102 | list.append( QString() ); |
1119 | 1103 | ||
1120 | if ( todo->hasDueDate() ) { | 1104 | if ( todo->hasDueDate() ) { |
1121 | QTime tim; | 1105 | QTime tim; |
1122 | if ( todo->doesFloat()) { | 1106 | if ( todo->doesFloat()) { |
1123 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; | 1107 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; |
1124 | } else { | 1108 | } else { |
1125 | list.append( dtToString(todo->dtDue() ) ); | 1109 | list.append( dtToString(todo->dtDue() ) ); |
1126 | } | 1110 | } |
1127 | } else | 1111 | } else |
1128 | list.append( QString() ); | 1112 | list.append( QString() ); |
1129 | 1113 | ||
1130 | if ( todo->isCompleted() ) { | 1114 | if ( todo->isCompleted() ) { |
1131 | list.append( dtToString( todo->completed()) ); | 1115 | list.append( dtToString( todo->completed()) ); |
1132 | list.append( "0" ); // yes 0 == completed | 1116 | list.append( "0" ); // yes 0 == completed |
1133 | } else { | 1117 | } else { |
1134 | list.append( dtToString( todo->completed()) ); | 1118 | list.append( dtToString( todo->completed()) ); |
1135 | list.append( "1" ); | 1119 | list.append( "1" ); |
1136 | } | 1120 | } |
1137 | list.append( QString::number( todo->priority() )); | 1121 | list.append( QString::number( todo->priority() )); |
1138 | if( ! todo->summary().isEmpty() ) | 1122 | if( ! todo->summary().isEmpty() ) |
1139 | list.append( todo->summary() ); | 1123 | list.append( todo->summary() ); |
1140 | else | 1124 | else |
1141 | list.append( "" ); | 1125 | list.append( "" ); |
1142 | if (! todo->description().isEmpty() ) | 1126 | if (! todo->description().isEmpty() ) |
1143 | list.append( todo->description() ); | 1127 | list.append( todo->description() ); |
1144 | else | 1128 | else |
1145 | list.append( "" ); | 1129 | list.append( "" ); |
1146 | for(QStringList::Iterator it=list.begin(); | 1130 | for(QStringList::Iterator it=list.begin(); |
1147 | it!=list.end(); ++it){ | 1131 | it!=list.end(); ++it){ |
1148 | QString& s = (*it); | 1132 | QString& s = (*it); |
1149 | s.replace(QRegExp("\""), "\"\""); | 1133 | s.replace(QRegExp("\""), "\"\""); |
1150 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | 1134 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ |
1151 | s.prepend('\"'); | 1135 | s.prepend('\"'); |
1152 | s.append('\"'); | 1136 | s.append('\"'); |
1153 | } else if(s.isEmpty() && !s.isNull()){ | 1137 | } else if(s.isEmpty() && !s.isNull()){ |
1154 | s = "\"\""; | 1138 | s = "\"\""; |
1155 | } | 1139 | } |
1156 | } | 1140 | } |
1157 | return list.join(","); | 1141 | return list.join(","); |
1158 | #endif | 1142 | #endif |
1159 | return QString(); | 1143 | return QString(); |
1160 | } | 1144 | } |
1161 | 1145 | ||
1162 | 1146 | ||
1163 | QString PhoneFormat::toString( Calendar * ) | 1147 | QString PhoneFormat::toString( Calendar * ) |
1164 | { | 1148 | { |
1165 | return QString::null; | 1149 | return QString::null; |
1166 | } | 1150 | } |
1167 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) | 1151 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) |
1168 | { | 1152 | { |
1169 | return false; | 1153 | return false; |
1170 | } | 1154 | } |