author | zautrix <zautrix> | 2004-09-12 15:24:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-12 15:24:11 (UTC) |
commit | a222c2f7369eeefd19454c973c0cc48300f72bec (patch) (unidiff) | |
tree | 6f01a5922ea622add6960f3fad703e8e8f099caa /gammu | |
parent | b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (diff) | |
download | kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.zip kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.gz kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.bz2 |
many phone sync fixes
-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 4 | ||||
-rw-r--r-- | gammu/emb/gammu/gammu.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c index ddf9790..0ea8e06 100644 --- a/gammu/emb/common/service/gsmcal.c +++ b/gammu/emb/common/service/gsmcal.c | |||
@@ -461,38 +461,38 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda | |||
461 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; | 461 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; |
462 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 462 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
463 | ToDo->EntriesNum++; | 463 | ToDo->EntriesNum++; |
464 | } | 464 | } |
465 | if (ReadVCALText(Line, "AALARM", Buff)) { | 465 | if (ReadVCALText(Line, "AALARM", Buff)) { |
466 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; | 466 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; |
467 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 467 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
468 | ToDo->EntriesNum++; | 468 | ToDo->EntriesNum++; |
469 | } | 469 | } |
470 | if (ReadVCALText(Line, "SUMMARY", Buff)) { | 470 | if (ReadVCALText(Line, "SUMMARY", Buff)) { |
471 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; | 471 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; |
472 | CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); | 472 | CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); |
473 | ToDo->EntriesNum++; | 473 | ToDo->EntriesNum++; |
474 | } | 474 | } |
475 | if (ReadVCALText(Line, "PRIORITY", Buff)) { | 475 | if (ReadVCALText(Line, "PRIORITY", Buff)) { |
476 | if (ToDoVer == SonyEricsson_VToDo) { | 476 | if (ToDoVer == SonyEricsson_VToDo) { |
477 | ToDo->Priority = GSM_Priority_Low; | 477 | ToDo->Priority = GSM_Priority_Medium; |
478 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; | 478 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; |
479 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; | 479 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; |
480 | dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); | 480 | dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); |
481 | } else if (ToDoVer == Nokia_VToDo) { | 481 | } else if (ToDoVer == Nokia_VToDo) { |
482 | ToDo->Priority = GSM_Priority_Low; | 482 | ToDo->Priority = GSM_Priority_Medium; |
483 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; | 483 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; |
484 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; | 484 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; |
485 | } | 485 | } |
486 | } | 486 | } |
487 | if (strstr(Line,"PERCENT-COMPLETE:100")) { | 487 | if (strstr(Line,"PERCENT-COMPLETE:100")) { |
488 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; | 488 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; |
489 | ToDo->Entries[ToDo->EntriesNum].Number = 1; | 489 | ToDo->Entries[ToDo->EntriesNum].Number = 1; |
490 | ToDo->EntriesNum++; | 490 | ToDo->EntriesNum++; |
491 | } | 491 | } |
492 | break; | 492 | break; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; | 496 | if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; |
497 | return ERR_NONE; | 497 | return ERR_NONE; |
498 | } | 498 | } |
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index a3b93a8..997485a 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -4614,32 +4614,33 @@ static void Restore(int argc, char *argv[]) | |||
4614 | exit(0); | 4614 | exit(0); |
4615 | } | 4615 | } |
4616 | } | 4616 | } |
4617 | printmsgerr("\n"); | 4617 | printmsgerr("\n"); |
4618 | } | 4618 | } |
4619 | 4619 | ||
4620 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | 4620 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { |
4621 | if (/*answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/ true ) { | 4621 | if (/*answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/ true ) { |
4622 | GSM_GetCurrentDateTime(&date_time); | 4622 | GSM_GetCurrentDateTime(&date_time); |
4623 | 4623 | ||
4624 | error=Phone->SetDateTime(&s, &date_time); | 4624 | error=Phone->SetDateTime(&s, &date_time); |
4625 | Print_Error(error); | 4625 | Print_Error(error); |
4626 | } | 4626 | } |
4627 | } | 4627 | } |
4628 | DoRestore = false; | 4628 | DoRestore = false; |
4629 | if (Backup.Calendar[0] != NULL) { | 4629 | if (Backup.Calendar[0] != NULL) { |
4630 | DoRestore = true; | ||
4630 | /* N6110 doesn't support getting calendar status */ | 4631 | /* N6110 doesn't support getting calendar status */ |
4631 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4632 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4632 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | 4633 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { |
4633 | max = 0; | 4634 | max = 0; |
4634 | while (Backup.Calendar[max] != NULL) max++; | 4635 | while (Backup.Calendar[max] != NULL) max++; |
4635 | printmsgerr("%i entries in backup file\n",max); | 4636 | printmsgerr("%i entries in backup file\n",max); |
4636 | DoRestore = true; | 4637 | DoRestore = true; |
4637 | /* | 4638 | /* |
4638 | if (answer_yes("Restore calendar notes")) { | 4639 | if (answer_yes("Restore calendar notes")) { |
4639 | Past = answer_yes("Restore notes from the past"); | 4640 | Past = answer_yes("Restore notes from the past"); |
4640 | DoRestore = true; | 4641 | DoRestore = true; |
4641 | } | 4642 | } |
4642 | */ | 4643 | */ |
4643 | } | 4644 | } |
4644 | } | 4645 | } |
4645 | if (DoRestore) { | 4646 | if (DoRestore) { |
@@ -4665,42 +4666,46 @@ static void Restore(int argc, char *argv[]) | |||
4665 | Calendar = *Backup.Calendar[i]; | 4666 | Calendar = *Backup.Calendar[i]; |
4666 | error=Phone->AddCalendar(&s,&Calendar); | 4667 | error=Phone->AddCalendar(&s,&Calendar); |
4667 | Print_Error(error); | 4668 | Print_Error(error); |
4668 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4669 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4669 | if (gshutdown) { | 4670 | if (gshutdown) { |
4670 | GSM_Terminate(); | 4671 | GSM_Terminate(); |
4671 | exit(0); | 4672 | exit(0); |
4672 | } | 4673 | } |
4673 | } | 4674 | } |
4674 | printmsgerr("\n"); | 4675 | printmsgerr("\n"); |
4675 | } | 4676 | } |
4676 | 4677 | ||
4677 | DoRestore = false; | 4678 | DoRestore = false; |
4678 | if (Backup.ToDo[0] != NULL) { | 4679 | if (Backup.ToDo[0] != NULL) { |
4679 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | 4680 | error = Phone->GetToDoStatus(&s,&ToDoStatus); |
4680 | if (error == ERR_NONE) { | 4681 | if (error == ERR_NONE) { |
4682 | error == ERR_NOTSUPPORTED; | ||
4683 | DoRestore = true; | ||
4681 | max = 0; | 4684 | max = 0; |
4682 | while (Backup.ToDo[max]!=NULL) max++; | 4685 | while (Backup.ToDo[max]!=NULL) max++; |
4683 | printmsgerr("%i entries in backup file\n",max); | 4686 | printmsgerr("%i entries in backup file\n",max); |
4684 | 4687 | ||
4685 | /*if (answer_yes("Restore ToDo")) */DoRestore = true; | 4688 | /*if (answer_yes("Restore ToDo")) */DoRestore = true; |
4686 | } | 4689 | } |
4687 | } | 4690 | } |
4688 | if (DoRestore) { | 4691 | if (DoRestore) { |
4692 | if ( max > 0 ) { | ||
4689 | ToDo = *Backup.ToDo[0]; | 4693 | ToDo = *Backup.ToDo[0]; |
4690 | error = Phone->SetToDo(&s,&ToDo); | 4694 | error = Phone->SetToDo(&s,&ToDo); |
4695 | } | ||
4691 | } | 4696 | } |
4692 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { | 4697 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { |
4693 | printmsgerr("Deleting old ToDo: "); | 4698 | printmsgerr("Deleting old ToDo: "); |
4694 | error=Phone->DeleteAllToDo(&s); | 4699 | error=Phone->DeleteAllToDo(&s); |
4695 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4700 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4696 | while (1) { | 4701 | while (1) { |
4697 | error = Phone->GetNextToDo(&s,&ToDo,true); | 4702 | error = Phone->GetNextToDo(&s,&ToDo,true); |
4698 | if (error != ERR_NONE) break; | 4703 | if (error != ERR_NONE) break; |
4699 | error = Phone->DeleteToDo(&s,&ToDo); | 4704 | error = Phone->DeleteToDo(&s,&ToDo); |
4700 | Print_Error(error); | 4705 | Print_Error(error); |
4701 | printmsgerr("*"); | 4706 | printmsgerr("*"); |
4702 | } | 4707 | } |
4703 | printmsgerr("\n"); | 4708 | printmsgerr("\n"); |
4704 | } else { | 4709 | } else { |
4705 | printmsgerr("Done\n"); | 4710 | printmsgerr("Done\n"); |
4706 | Print_Error(error); | 4711 | Print_Error(error); |
@@ -8361,33 +8366,32 @@ int main(int argc, char *argv[]) | |||
8361 | fprintf(stderr,"Using model %s \n",tempC); | 8366 | fprintf(stderr,"Using model %s \n",tempC); |
8362 | strcpy(con->Model,tempC ); | 8367 | strcpy(con->Model,tempC ); |
8363 | } | 8368 | } |
8364 | tempC = argv[argc-2]+2; | 8369 | tempC = argv[argc-2]+2; |
8365 | if ( *tempC != 0 ) { | 8370 | if ( *tempC != 0 ) { |
8366 | fprintf(stderr,"Using device %s \n",tempC); | 8371 | fprintf(stderr,"Using device %s \n",tempC); |
8367 | con->Device = strdup(tempC); | 8372 | con->Device = strdup(tempC); |
8368 | con->DefaultDevice = false; | 8373 | con->DefaultDevice = false; |
8369 | } | 8374 | } |
8370 | tempC = argv[argc-3]+2; | 8375 | tempC = argv[argc-3]+2; |
8371 | if ( *tempC != 0 ) { | 8376 | if ( *tempC != 0 ) { |
8372 | fprintf(stderr,"Using connection %s \n",tempC); | 8377 | fprintf(stderr,"Using connection %s \n",tempC); |
8373 | con->Connection = strdup(tempC); | 8378 | con->Connection = strdup(tempC); |
8374 | con->DefaultConnection = false; | 8379 | con->DefaultConnection = false; |
8375 | } | 8380 | } |
8376 | #endif | 8381 | #endif |
8377 | argc = argc-3; | ||
8378 | 8382 | ||
8379 | 8383 | ||
8380 | /* Do we have enough parameters? */ | 8384 | /* Do we have enough parameters? */ |
8381 | if (argc == 1 + start) { | 8385 | if (argc == 1 + start) { |
8382 | HelpGeneral(); | 8386 | HelpGeneral(); |
8383 | printmsg("Too few parameters!\n"); | 8387 | printmsg("Too few parameters!\n"); |
8384 | exit(-2); | 8388 | exit(-2); |
8385 | } | 8389 | } |
8386 | 8390 | ||
8387 | /* Check used version vs. compiled */ | 8391 | /* Check used version vs. compiled */ |
8388 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { | 8392 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { |
8389 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", | 8393 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", |
8390 | GetGammuVersion(),VERSION); | 8394 | GetGammuVersion(),VERSION); |
8391 | exit(-1); | 8395 | exit(-1); |
8392 | } | 8396 | } |
8393 | 8397 | ||