author | zautrix <zautrix> | 2004-09-12 09:56:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-12 09:56:56 (UTC) |
commit | 31fab1d7e531b492d1075964ddcbebe7a563a41a (patch) (unidiff) | |
tree | 91fe6d49f28003106cba1adc9aed816a9019888d /libkcal | |
parent | 8d822fd4d97fbb38ab2c4f3f3f64f175ef143cff (diff) | |
download | kdepimpi-31fab1d7e531b492d1075964ddcbebe7a563a41a.zip kdepimpi-31fab1d7e531b492d1075964ddcbebe7a563a41a.tar.gz kdepimpi-31fab1d7e531b492d1075964ddcbebe7a563a41a.tar.bz2 |
Kammu fixes
-rw-r--r-- | libkcal/phoneformat.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 0bc9125..2ad1b5a 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -271,33 +271,34 @@ ulong PhoneFormat::getCsum( const QStringList & attList) | |||
271 | } | 271 | } |
272 | return cSum; | 272 | return cSum; |
273 | 273 | ||
274 | } | 274 | } |
275 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); | 275 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); |
276 | #include <stdlib.h> | 276 | #include <stdlib.h> |
277 | #define DEBUGMODE false | 277 | #define DEBUGMODE false |
278 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | 278 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) |
279 | { | 279 | { |
280 | 280 | ||
281 | QString fileName; | 281 | QString fileName; |
282 | #ifdef _WIN32_ | 282 | #ifdef _WIN32_ |
283 | fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; | 283 | fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; |
284 | #else | 284 | #else |
285 | fileName = "/tmp/kdepimtemp.vcs"; | 285 | fileName = "/tmp/kdepimtemp.vcs"; |
286 | #endif | 286 | #endif |
287 | QString command ="./kammu --backup " + fileName + " -yes"; | 287 | QString command ="./kammu --backup " + fileName + " -yes -C" + |
288 | mConnection +" -D" + mDevice +" -M" + mModel; | ||
288 | int ret = system ( command.latin1() ); | 289 | int ret = system ( command.latin1() ); |
289 | if ( ret != 0 ) | 290 | if ( ret != 0 ) |
290 | return false; | 291 | return false; |
291 | VCalFormat vfload; | 292 | VCalFormat vfload; |
292 | vfload.setLocalTime ( true ); | 293 | vfload.setLocalTime ( true ); |
293 | if ( ! vfload.load( calendar, fileName ) ) | 294 | if ( ! vfload.load( calendar, fileName ) ) |
294 | return false; | 295 | return false; |
295 | QPtrList<Event> er = calendar->rawEvents(); | 296 | QPtrList<Event> er = calendar->rawEvents(); |
296 | Event* ev = er.first(); | 297 | Event* ev = er.first(); |
297 | while ( ev ) { | 298 | while ( ev ) { |
298 | int id = ev->pilotId(); | 299 | int id = ev->pilotId(); |
299 | Event *event; | 300 | Event *event; |
300 | event = existingCal->event( mProfileName ,QString::number( id ) ); | 301 | event = existingCal->event( mProfileName ,QString::number( id ) ); |
301 | if ( event ) { | 302 | if ( event ) { |
302 | event = (Event*)event->clone(); | 303 | event = (Event*)event->clone(); |
303 | copyEvent( event, ev ); | 304 | copyEvent( event, ev ); |
@@ -475,33 +476,34 @@ bool PhoneFormat::save( Calendar *calendar) | |||
475 | } | 476 | } |
476 | // 2 remove todos which should be deleted | 477 | // 2 remove todos which should be deleted |
477 | QPtrList<Todo> tl = calendar->rawTodos(); | 478 | QPtrList<Todo> tl = calendar->rawTodos(); |
478 | Todo* to = tl.first(); | 479 | Todo* to = tl.first(); |
479 | while ( to ) { | 480 | while ( to ) { |
480 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 481 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
481 | calendar->deleteTodo( to ); | 482 | calendar->deleteTodo( to ); |
482 | } | 483 | } |
483 | to = tl.next(); | 484 | to = tl.next(); |
484 | } | 485 | } |
485 | // 3 save file | 486 | // 3 save file |
486 | VCalFormat vfsave; | 487 | VCalFormat vfsave; |
487 | vfsave.setLocalTime ( true ); | 488 | vfsave.setLocalTime ( true ); |
488 | if ( ! vfsave.save( calendar, fileName ) ) | 489 | if ( ! vfsave.save( calendar, fileName ) ) |
489 | return false; | 490 | return false; |
490 | // 4 call kammu | 491 | // 4 call kammu |
491 | QString command ="./kammu --restore " + fileName ; | 492 | QString command ="./kammu --restore " + fileName + " -C" + |
493 | mConnection +" -D" + mDevice +" -M" + mModel;; | ||
492 | int ret = system ( command.latin1() ); | 494 | int ret = system ( command.latin1() ); |
493 | if ( ret != 0 ) | 495 | if ( ret != 0 ) |
494 | return false; | 496 | return false; |
495 | // 5 reread data | 497 | // 5 reread data |
496 | message = i18n(" Rereading all data ... "); | 498 | message = i18n(" Rereading all data ... "); |
497 | status.setText ( message ); | 499 | status.setText ( message ); |
498 | qApp->processEvents(); | 500 | qApp->processEvents(); |
499 | CalendarLocal* calendarTemp = new CalendarLocal(); | 501 | CalendarLocal* calendarTemp = new CalendarLocal(); |
500 | calendarTemp->setTimeZoneId( calendar->timeZoneId()); | 502 | calendarTemp->setTimeZoneId( calendar->timeZoneId()); |
501 | if ( ! load( calendarTemp,calendar) ){ | 503 | if ( ! load( calendarTemp,calendar) ){ |
502 | qDebug("error reloading calendar "); | 504 | qDebug("error reloading calendar "); |
503 | delete calendarTemp; | 505 | delete calendarTemp; |
504 | return false; | 506 | return false; |
505 | } | 507 | } |
506 | // 6 compare data | 508 | // 6 compare data |
507 | 509 | ||