summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index c39413e..3555dc6 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -102,394 +102,390 @@ int PhoneFormat::initDevice(GSM_StateMachine *s)
102 cfg->Connection = strdup(mConnection.latin1()); 102 cfg->Connection = strdup(mConnection.latin1());
103 cfg->DefaultConnection = false; 103 cfg->DefaultConnection = false;
104 qDebug("Connection set %s ", cfg->Connection ); 104 qDebug("Connection set %s ", cfg->Connection );
105 105
106 } 106 }
107 if ( ! mDevice.isEmpty() ) { 107 if ( ! mDevice.isEmpty() ) {
108 cfg->Device = strdup(mDevice.latin1()); 108 cfg->Device = strdup(mDevice.latin1());
109 cfg->DefaultDevice = false; 109 cfg->DefaultDevice = false;
110 qDebug("Device set %s ", cfg->Device); 110 qDebug("Device set %s ", cfg->Device);
111 111
112 } 112 }
113 if ( ! mModel.isEmpty() ) { 113 if ( ! mModel.isEmpty() ) {
114 strcpy(cfg->Model,mModel.latin1() ); 114 strcpy(cfg->Model,mModel.latin1() );
115 cfg->DefaultModel = false; 115 cfg->DefaultModel = false;
116 qDebug("Model set %s ",cfg->Model ); 116 qDebug("Model set %s ",cfg->Model );
117 } 117 }
118 int error=GSM_InitConnection(s,3); 118 int error=GSM_InitConnection(s,3);
119 return error; 119 return error;
120} 120}
121#endif 121#endif
122ulong PhoneFormat::getCsumTodo( Todo* todo ) 122ulong PhoneFormat::getCsumTodo( Todo* todo )
123{ 123{
124 QStringList attList; 124 QStringList attList;
125 if ( todo->hasDueDate() ) 125 if ( todo->hasDueDate() )
126 attList << PhoneParser::dtToString ( todo->dtDue() ); 126 attList << PhoneParser::dtToString ( todo->dtDue() );
127 attList << todo->summary(); 127 attList << todo->summary();
128 QString completedString = "no"; 128 QString completedString = "no";
129 if ( todo->isCompleted() ) 129 if ( todo->isCompleted() )
130 completedString = "yes"; 130 completedString = "yes";
131 attList << completedString; 131 attList << completedString;
132 int prio = todo->priority(); 132 int prio = todo->priority();
133 if( prio == 2 ) prio = 1; 133 if( prio == 2 ) prio = 1;
134 if (prio == 4 ) prio = 5 ; 134 if (prio == 4 ) prio = 5 ;
135 attList << QString::number( prio ); 135 attList << QString::number( prio );
136 QString alarmString = "na"; 136 QString alarmString = "na";
137 Alarm *alarm; 137 Alarm *alarm;
138 if ( todo->alarms().count() > 0 ) { 138 if ( todo->alarms().count() > 0 ) {
139 alarm = todo->alarms().first(); 139 alarm = todo->alarms().first();
140 if ( alarm->enabled() ) { 140 if ( alarm->enabled() ) {
141 alarmString = QString::number(alarm->offset() ); 141 alarmString = QString::number(alarm->offset() );
142 } 142 }
143 } 143 }
144 attList << alarmString; 144 attList << alarmString;
145 attList << todo->categoriesStr(); 145 attList << todo->categoriesStr();
146 attList << todo->secrecyStr(); 146 attList << todo->secrecyStr();
147 return PhoneFormat::getCsum(attList ); 147 return PhoneFormat::getCsum(attList );
148 148
149} 149}
150ulong PhoneFormat::getCsumEvent( Event* event ) 150ulong PhoneFormat::getCsumEvent( Event* event )
151{ 151{
152 QStringList attList; 152 QStringList attList;
153 attList << PhoneParser::dtToString ( event->dtStart() ); 153 attList << PhoneParser::dtToString ( event->dtStart() );
154 attList << PhoneParser::dtToString ( event->dtEnd() ); 154 attList << PhoneParser::dtToString ( event->dtEnd() );
155 attList << event->summary(); 155 attList << event->summary();
156 attList << event->location(); 156 attList << event->location();
157 QString alarmString = "na"; 157 QString alarmString = "na";
158 Alarm *alarm; 158 Alarm *alarm;
159 if ( event->alarms().count() > 0 ) { 159 if ( event->alarms().count() > 0 ) {
160 alarm = event->alarms().first(); 160 alarm = event->alarms().first();
161 if ( alarm->enabled() ) { 161 if ( alarm->enabled() ) {
162 alarmString = QString::number( alarm->offset() ); 162 alarmString = QString::number( alarm->offset() );
163 } 163 }
164 } 164 }
165 attList << alarmString; 165 attList << alarmString;
166 Recurrence* rec = event->recurrence(); 166 Recurrence* rec = event->recurrence();
167 QStringList list; 167 QStringList list;
168 bool writeEndDate = false; 168 bool writeEndDate = false;
169 switch ( rec->doesRecur() ) 169 switch ( rec->doesRecur() )
170 { 170 {
171 case Recurrence::rDaily: // 0 171 case Recurrence::rDaily: // 0
172 list.append( "0" ); 172 list.append( "0" );
173 list.append( QString::number( rec->frequency() ));//12 173 list.append( QString::number( rec->frequency() ));//12
174 list.append( "0" ); 174 list.append( "0" );
175 list.append( "0" ); 175 list.append( "0" );
176 writeEndDate = true; 176 writeEndDate = true;
177 break; 177 break;
178 case Recurrence::rWeekly:// 1 178 case Recurrence::rWeekly:// 1
179 list.append( "1" ); 179 list.append( "1" );
180 list.append( QString::number( rec->frequency()) );//12 180 list.append( QString::number( rec->frequency()) );//12
181 list.append( "0" ); 181 list.append( "0" );
182 { 182 {
183 int days = 0; 183 int days = 0;
184 QBitArray weekDays = rec->days(); 184 QBitArray weekDays = rec->days();
185 int i; 185 int i;
186 for( i = 1; i <= 7; ++i ) { 186 for( i = 1; i <= 7; ++i ) {
187 if ( weekDays[i-1] ) { 187 if ( weekDays[i-1] ) {
188 days += 1 << (i-1); 188 days += 1 << (i-1);
189 } 189 }
190 } 190 }
191 list.append( QString::number( days ) ); 191 list.append( QString::number( days ) );
192 } 192 }
193 //pending weekdays 193 //pending weekdays
194 writeEndDate = true; 194 writeEndDate = true;
195 195
196 break; 196 break;
197 case Recurrence::rMonthlyPos:// 2 197 case Recurrence::rMonthlyPos:// 2
198 list.append( "2" ); 198 list.append( "2" );
199 list.append( QString::number( rec->frequency()) );//12 199 list.append( QString::number( rec->frequency()) );//12
200 200
201 writeEndDate = true; 201 writeEndDate = true;
202 { 202 {
203 int count = 1; 203 int count = 1;
204 QPtrList<Recurrence::rMonthPos> rmp; 204 QPtrList<Recurrence::rMonthPos> rmp;
205 rmp = rec->monthPositions(); 205 rmp = rec->monthPositions();
206 if ( rmp.first()->negative ) 206 if ( rmp.first()->negative )
207 count = 5 - rmp.first()->rPos - 1; 207 count = 5 - rmp.first()->rPos - 1;
208 else 208 else
209 count = rmp.first()->rPos - 1; 209 count = rmp.first()->rPos - 1;
210 list.append( QString::number( count ) ); 210 list.append( QString::number( count ) );
211 211
212 } 212 }
213 213
214 list.append( "0" ); 214 list.append( "0" );
215 break; 215 break;
216 case Recurrence::rMonthlyDay:// 3 216 case Recurrence::rMonthlyDay:// 3
217 list.append( "3" ); 217 list.append( "3" );
218 list.append( QString::number( rec->frequency()) );//12 218 list.append( QString::number( rec->frequency()) );//12
219 list.append( "0" ); 219 list.append( "0" );
220 list.append( "0" ); 220 list.append( "0" );
221 writeEndDate = true; 221 writeEndDate = true;
222 break; 222 break;
223 case Recurrence::rYearlyMonth://4 223 case Recurrence::rYearlyMonth://4
224 list.append( "4" ); 224 list.append( "4" );
225 list.append( QString::number( rec->frequency()) );//12 225 list.append( QString::number( rec->frequency()) );//12
226 list.append( "0" ); 226 list.append( "0" );
227 list.append( "0" ); 227 list.append( "0" );
228 writeEndDate = true; 228 writeEndDate = true;
229 break; 229 break;
230 230
231 default: 231 default:
232 list.append( "255" ); 232 list.append( "255" );
233 list.append( QString() ); 233 list.append( QString() );
234 list.append( "0" ); 234 list.append( "0" );
235 list.append( QString() ); 235 list.append( QString() );
236 list.append( "0" ); 236 list.append( "0" );
237 list.append( "20991231T000000" ); 237 list.append( "20991231T000000" );
238 break; 238 break;
239 } 239 }
240 if ( writeEndDate ) { 240 if ( writeEndDate ) {
241 241
242 if ( rec->endDate().isValid() ) { // 15 + 16 242 if ( rec->endDate().isValid() ) { // 15 + 16
243 list.append( "1" ); 243 list.append( "1" );
244 list.append( PhoneParser::dtToString( rec->endDate()) ); 244 list.append( PhoneParser::dtToString( rec->endDate()) );
245 } else { 245 } else {
246 list.append( "0" ); 246 list.append( "0" );
247 list.append( "20991231T000000" ); 247 list.append( "20991231T000000" );
248 } 248 }
249 249
250 } 250 }
251 attList << list.join(""); 251 attList << list.join("");
252 attList << event->categoriesStr(); 252 attList << event->categoriesStr();
253 //qDebug("csum cat %s", event->categoriesStr().latin1()); 253 //qDebug("csum cat %s", event->categoriesStr().latin1());
254 254
255 attList << event->secrecyStr(); 255 attList << event->secrecyStr();
256 return PhoneFormat::getCsum(attList ); 256 return PhoneFormat::getCsum(attList );
257} 257}
258ulong PhoneFormat::getCsum( const QStringList & attList) 258ulong PhoneFormat::getCsum( const QStringList & attList)
259{ 259{
260 int max = attList.count(); 260 int max = attList.count();
261 ulong cSum = 0; 261 ulong cSum = 0;
262 int j,k,i; 262 int j,k,i;
263 int add; 263 int add;
264 for ( i = 0; i < max ; ++i ) { 264 for ( i = 0; i < max ; ++i ) {
265 QString s = attList[i]; 265 QString s = attList[i];
266 if ( ! s.isEmpty() ){ 266 if ( ! s.isEmpty() ){
267 j = s.length(); 267 j = s.length();
268 for ( k = 0; k < j; ++k ) { 268 for ( k = 0; k < j; ++k ) {
269 int mul = k +1; 269 int mul = k +1;
270 add = s[k].unicode (); 270 add = s[k].unicode ();
271 if ( k < 16 ) 271 if ( k < 16 )
272 mul = mul * mul; 272 mul = mul * mul;
273 int ii = i+1; 273 int ii = i+1;
274 add = add * mul *ii*ii*ii; 274 add = add * mul *ii*ii*ii;
275 cSum += add; 275 cSum += add;
276 } 276 }
277 } 277 }
278 278
279 } 279 }
280 //QString dump = attList.join(","); 280 //QString dump = attList.join(",");
281 //qDebug("csum: %d %s", cSum,dump.latin1()); 281 //qDebug("csum: %d %s", cSum,dump.latin1());
282 282
283 return cSum; 283 return cSum;
284 284
285} 285}
286//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 286//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
287#include <stdlib.h> 287#include <stdlib.h>
288#define DEBUGMODE false 288#define DEBUGMODE false
289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) 289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
290{ 290{
291 291
292 QString fileName; 292 QString fileName;
293#ifdef _WIN32_ 293#ifdef _WIN32_
294 fileName = locateLocal("tmp", "tempfile.vcs"); 294 fileName = locateLocal("tmp", "phonefile.vcs");
295#else 295#else
296 fileName = "/tmp/kdepimtemp.vcs"; 296 fileName = "/tmp/phonefile.vcs";
297#endif 297#endif
298#ifdef DESKTOP_VERSION 298 QString command;
299 QString command ="./kammu --backup " + fileName + " -yes" ; 299 int ret = PhoneAccess::readFromPhone( fileName );
300#else
301 QString command ="kammu --backup " + fileName + " -yes" ;
302#endif
303 int ret = system ( command.latin1() );
304 if ( ret != 0 ) { 300 if ( ret != 0 ) {
305 qDebug("Error::command returned %d", ret); 301 qDebug("Error::command returned %d", ret);
306 return false; 302 return false;
307 } 303 }
308 VCalFormat vfload; 304 VCalFormat vfload;
309 vfload.setLocalTime ( true ); 305 vfload.setLocalTime ( true );
310 qDebug("loading file ..."); 306 qDebug("loading file ...");
311 307
312 if ( ! vfload.load( calendar, fileName ) ) 308 if ( ! vfload.load( calendar, fileName ) )
313 return false; 309 return false;
314 QPtrList<Event> er = calendar->rawEvents(); 310 QPtrList<Event> er = calendar->rawEvents();
315 Event* ev = er.first(); 311 Event* ev = er.first();
316 qDebug("reading events... "); 312 qDebug("reading events... ");
317 while ( ev ) { 313 while ( ev ) {
318 QStringList cat = ev->categories(); 314 QStringList cat = ev->categories();
319 if ( cat.contains( "MeetingDEF" )) { 315 if ( cat.contains( "MeetingDEF" )) {
320 ev->setCategories( QStringList() ); 316 ev->setCategories( QStringList() );
321 } 317 }
322 int id = ev->pilotId(); 318 int id = ev->pilotId();
323 Event *event; 319 Event *event;
324 event = existingCal->event( mProfileName ,QString::number( id ) ); 320 event = existingCal->event( mProfileName ,QString::number( id ) );
325 if ( event ) { 321 if ( event ) {
326 event = (Event*)event->clone(); 322 event = (Event*)event->clone();
327 copyEvent( event, ev ); 323 copyEvent( event, ev );
328 calendar->deleteEvent( ev ); 324 calendar->deleteEvent( ev );
329 calendar->addEvent( event); 325 calendar->addEvent( event);
330 } 326 }
331 else 327 else
332 event = ev; 328 event = ev;
333 uint cSum; 329 uint cSum;
334 cSum = PhoneFormat::getCsumEvent( event ); 330 cSum = PhoneFormat::getCsumEvent( event );
335 event->setCsum( mProfileName, QString::number( cSum )); 331 event->setCsum( mProfileName, QString::number( cSum ));
336 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 332 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
337 event->setID( mProfileName,QString::number( id ) ); 333 event->setID( mProfileName,QString::number( id ) );
338 ev = er.next(); 334 ev = er.next();
339 } 335 }
340 { 336 {
341 qDebug("reading todos... "); 337 qDebug("reading todos... ");
342 QPtrList<Todo> tr = calendar->rawTodos(); 338 QPtrList<Todo> tr = calendar->rawTodos();
343 Todo* ev = tr.first(); 339 Todo* ev = tr.first();
344 while ( ev ) { 340 while ( ev ) {
345 341
346 QStringList cat = ev->categories(); 342 QStringList cat = ev->categories();
347 if ( cat.contains( "MeetingDEF" )) { 343 if ( cat.contains( "MeetingDEF" )) {
348 ev->setCategories( QStringList() ); 344 ev->setCategories( QStringList() );
349 } 345 }
350 int id = ev->pilotId(); 346 int id = ev->pilotId();
351 Todo *event; 347 Todo *event;
352 event = existingCal->todo( mProfileName ,QString::number( id ) ); 348 event = existingCal->todo( mProfileName ,QString::number( id ) );
353 if ( event ) { 349 if ( event ) {
354 //qDebug("copy todo %s ", event->summary().latin1()); 350 //qDebug("copy todo %s ", event->summary().latin1());
355 351
356 event = (Todo*)event->clone(); 352 event = (Todo*)event->clone();
357 copyTodo( event, ev ); 353 copyTodo( event, ev );
358 calendar->deleteTodo( ev ); 354 calendar->deleteTodo( ev );
359 calendar->addTodo( event); 355 calendar->addTodo( event);
360 } 356 }
361 else 357 else
362 event = ev; 358 event = ev;
363 uint cSum; 359 uint cSum;
364 cSum = PhoneFormat::getCsumTodo( event ); 360 cSum = PhoneFormat::getCsumTodo( event );
365 event->setCsum( mProfileName, QString::number( cSum )); 361 event->setCsum( mProfileName, QString::number( cSum ));
366 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 362 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
367 event->setID( mProfileName,QString::number( id ) ); 363 event->setID( mProfileName,QString::number( id ) );
368 ev = tr.next(); 364 ev = tr.next();
369 } 365 }
370 } 366 }
371 return true; 367 return true;
372} 368}
373void PhoneFormat::copyEvent( Event* to, Event* from ) 369void PhoneFormat::copyEvent( Event* to, Event* from )
374{ 370{
375 if ( from->dtStart().isValid() ) 371 if ( from->dtStart().isValid() )
376 to->setDtStart( from->dtStart() ); 372 to->setDtStart( from->dtStart() );
377 if ( from->dtEnd().isValid() ) 373 if ( from->dtEnd().isValid() )
378 to->setDtEnd( from->dtEnd() ); 374 to->setDtEnd( from->dtEnd() );
379 if ( !from->location().isEmpty() ) 375 if ( !from->location().isEmpty() )
380 to->setLocation( from->location() ); 376 to->setLocation( from->location() );
381 if ( !from->description().isEmpty() ) 377 if ( !from->description().isEmpty() )
382 to->setDescription( from->description() ); 378 to->setDescription( from->description() );
383 if ( !from->summary().isEmpty() ) 379 if ( !from->summary().isEmpty() )
384 to->setSummary( from->summary() ); 380 to->setSummary( from->summary() );
385 381
386 if ( from->alarms().count() ) { 382 if ( from->alarms().count() ) {
387 to->clearAlarms(); 383 to->clearAlarms();
388 Alarm *a = from->alarms().first(); 384 Alarm *a = from->alarms().first();
389 Alarm *b = to->newAlarm( ); 385 Alarm *b = to->newAlarm( );
390 b->setEnabled( a->enabled() ); 386 b->setEnabled( a->enabled() );
391 if ( a->hasStartOffset() ) { 387 if ( a->hasStartOffset() ) {
392 b->setStartOffset( a->startOffset() ); 388 b->setStartOffset( a->startOffset() );
393 } 389 }
394 if ( a->hasTime() ) 390 if ( a->hasTime() )
395 b->setTime( a->time() ); 391 b->setTime( a->time() );
396 392
397 } 393 }
398 QStringList cat = to->categories(); 394 QStringList cat = to->categories();
399 QStringList catFrom = from->categories(); 395 QStringList catFrom = from->categories();
400 QString nCat; 396 QString nCat;
401 int iii; 397 int iii;
402 for ( iii = 0; iii < catFrom.count();++iii ) { 398 for ( iii = 0; iii < catFrom.count();++iii ) {
403 nCat = catFrom[iii]; 399 nCat = catFrom[iii];
404 if ( !nCat.isEmpty() ) 400 if ( !nCat.isEmpty() )
405 if ( !cat.contains( nCat )) { 401 if ( !cat.contains( nCat )) {
406 cat << nCat; 402 cat << nCat;
407 } 403 }
408 } 404 }
409 to->setCategories( cat ); 405 to->setCategories( cat );
410 Recurrence * r = new Recurrence( *from->recurrence(),to); 406 Recurrence * r = new Recurrence( *from->recurrence(),to);
411 to->setRecurrence( r ) ; 407 to->setRecurrence( r ) ;
412 408
413 409
414} 410}
415void PhoneFormat::copyTodo( Todo* to, Todo* from ) 411void PhoneFormat::copyTodo( Todo* to, Todo* from )
416{ 412{
417 if ( from->dtStart().isValid() ) 413 if ( from->dtStart().isValid() )
418 to->setDtStart( from->dtStart() ); 414 to->setDtStart( from->dtStart() );
419 if ( from->dtDue().isValid() ) 415 if ( from->dtDue().isValid() )
420 to->setDtDue( from->dtDue() ); 416 to->setDtDue( from->dtDue() );
421 if ( !from->location().isEmpty() ) 417 if ( !from->location().isEmpty() )
422 to->setLocation( from->location() ); 418 to->setLocation( from->location() );
423 if ( !from->description().isEmpty() ) 419 if ( !from->description().isEmpty() )
424 to->setDescription( from->description() ); 420 to->setDescription( from->description() );
425 if ( !from->summary().isEmpty() ) 421 if ( !from->summary().isEmpty() )
426 to->setSummary( from->summary() ); 422 to->setSummary( from->summary() );
427 423
428 if ( from->alarms().count() ) { 424 if ( from->alarms().count() ) {
429 to->clearAlarms(); 425 to->clearAlarms();
430 Alarm *a = from->alarms().first(); 426 Alarm *a = from->alarms().first();
431 Alarm *b = to->newAlarm( ); 427 Alarm *b = to->newAlarm( );
432 b->setEnabled( a->enabled() ); 428 b->setEnabled( a->enabled() );
433 if ( a->hasStartOffset() ) 429 if ( a->hasStartOffset() )
434 b->setStartOffset( a->startOffset() ); 430 b->setStartOffset( a->startOffset() );
435 if ( a->hasTime() ) 431 if ( a->hasTime() )
436 b->setTime( a->time() ); 432 b->setTime( a->time() );
437 } 433 }
438 434
439 QStringList cat = to->categories(); 435 QStringList cat = to->categories();
440 QStringList catFrom = from->categories(); 436 QStringList catFrom = from->categories();
441 QString nCat; 437 QString nCat;
442 int iii; 438 int iii;
443 for ( iii = 0; iii < catFrom.count();++iii ) { 439 for ( iii = 0; iii < catFrom.count();++iii ) {
444 nCat = catFrom[iii]; 440 nCat = catFrom[iii];
445 if ( !nCat.isEmpty() ) 441 if ( !nCat.isEmpty() )
446 if ( !cat.contains( nCat )) { 442 if ( !cat.contains( nCat )) {
447 cat << nCat; 443 cat << nCat;
448 } 444 }
449 } 445 }
450 to->setCategories( cat ); 446 to->setCategories( cat );
451 if ( from->isCompleted() ) { 447 if ( from->isCompleted() ) {
452 to->setCompleted( true ); 448 to->setCompleted( true );
453 if( from->completed().isValid() ) 449 if( from->completed().isValid() )
454 to->setCompleted( from->completed() ); 450 to->setCompleted( from->completed() );
455 } else { 451 } else {
456 // set percentcomplete only, if to->isCompleted() 452 // set percentcomplete only, if to->isCompleted()
457 if ( to->isCompleted() ) 453 if ( to->isCompleted() )
458 to->setPercentComplete(from->percentComplete()); 454 to->setPercentComplete(from->percentComplete());
459 } 455 }
460 if( to->priority() == 2 && from->priority() == 1 ) 456 if( to->priority() == 2 && from->priority() == 1 )
461 ; //skip 457 ; //skip
462 else if (to->priority() == 4 && from->priority() == 5 ) 458 else if (to->priority() == 4 && from->priority() == 5 )
463 ; 459 ;
464 else 460 else
465 to->setPriority(from->priority()); 461 to->setPriority(from->priority());
466 462
467} 463}
468#include <qcstring.h> 464#include <qcstring.h>
469 465
470void PhoneFormat::afterSave( Incidence* inc) 466void PhoneFormat::afterSave( Incidence* inc)
471{ 467{
472 uint csum; 468 uint csum;
473 inc->removeID( mProfileName ); 469 inc->removeID( mProfileName );
474 if ( inc->type() == "Event") 470 if ( inc->type() == "Event")
475 csum = PhoneFormat::getCsumEvent( (Event*) inc ); 471 csum = PhoneFormat::getCsumEvent( (Event*) inc );
476 else 472 else
477 csum = PhoneFormat::getCsumTodo( (Todo*) inc ); 473 csum = PhoneFormat::getCsumTodo( (Todo*) inc );
478 inc->setCsum( mProfileName, QString::number( csum )); 474 inc->setCsum( mProfileName, QString::number( csum ));
479 475
480 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 476 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
481 477
482} 478}
483 479
484bool PhoneFormat::writeToPhone( Calendar * calendar) 480bool PhoneFormat::writeToPhone( Calendar * calendar)
485{ 481{
486#ifdef _WIN32_ 482#ifdef _WIN32_
487 QString fileName = locateLocal("tmp", "tempfile.vcs"); 483 QString fileName = locateLocal("tmp", "tempfile.vcs");
488#else 484#else
489 QString fileName = "/tmp/kdepimtemp.vcs"; 485 QString fileName = "/tmp/kdepimtemp.vcs";
490#endif 486#endif
491 487
492 VCalFormat vfsave; 488 VCalFormat vfsave;
493 vfsave.setLocalTime ( true ); 489 vfsave.setLocalTime ( true );
494 if ( ! vfsave.save( calendar, fileName ) ) 490 if ( ! vfsave.save( calendar, fileName ) )
495 return false; 491 return false;