-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/gammu.c | 41 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 53 |
3 files changed, 80 insertions, 16 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c index 598292c..ddf9790 100644 --- a/gammu/emb/common/service/gsmcal.c +++ b/gammu/emb/common/service/gsmcal.c | |||
@@ -144,3 +144,3 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
144 | } else { | 144 | } else { |
145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
146 | } | 146 | } |
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index 5163d81..a3b93a8 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -8243,7 +8243,8 @@ int main(int argc, char *argv[]) | |||
8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ | 8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ |
8244 | if (isdigit(argv[1][0])) { | 8244 | //if (isdigit(argv[1][0])) { |
8245 | only_config = atoi(argv[1]); | 8245 | //only_config = atoi(argv[1]); |
8246 | if (only_config >= 0) start++; else only_config = -1; | 8246 | //if (only_config >= 0) start++; else only_config = -1; |
8247 | } | 8247 | //} |
8248 | 8248 | only_config = 0;; | |
8249 | #if 0 | ||
8249 | GSM_ReadConfig(NULL, &s.Config[0], 0); | 8250 | GSM_ReadConfig(NULL, &s.Config[0], 0); |
@@ -8271,3 +8272,3 @@ int main(int argc, char *argv[]) | |||
8271 | argc = argc-3; | 8272 | argc = argc-3; |
8272 | #if 0 | 8273 | //#if 0 |
8273 | if ( ! mConnection.isEmpty() ) { | 8274 | if ( ! mConnection.isEmpty() ) { |
@@ -8292,3 +8293,3 @@ int main(int argc, char *argv[]) | |||
8292 | 8293 | ||
8293 | #if 0 | 8294 | |
8294 | cfg=GSM_FindGammuRC(); | 8295 | cfg=GSM_FindGammuRC(); |
@@ -8317,2 +8318,3 @@ int main(int argc, char *argv[]) | |||
8317 | /* Wanted user specific configuration? */ | 8318 | /* Wanted user specific configuration? */ |
8319 | |||
8318 | if (only_config != -1) { | 8320 | if (only_config != -1) { |
@@ -8352,3 +8354,27 @@ int main(int argc, char *argv[]) | |||
8352 | } | 8354 | } |
8355 | #if 0 | ||
8356 | GSM_Config *con = &s.Config[0]; | ||
8357 | |||
8358 | char* tempC; | ||
8359 | tempC = argv[argc-1]+2; | ||
8360 | if ( *tempC != 0 ) { | ||
8361 | fprintf(stderr,"Using model %s \n",tempC); | ||
8362 | strcpy(con->Model,tempC ); | ||
8363 | } | ||
8364 | tempC = argv[argc-2]+2; | ||
8365 | if ( *tempC != 0 ) { | ||
8366 | fprintf(stderr,"Using device %s \n",tempC); | ||
8367 | con->Device = strdup(tempC); | ||
8368 | con->DefaultDevice = false; | ||
8369 | } | ||
8370 | tempC = argv[argc-3]+2; | ||
8371 | if ( *tempC != 0 ) { | ||
8372 | fprintf(stderr,"Using connection %s \n",tempC); | ||
8373 | con->Connection = strdup(tempC); | ||
8374 | con->DefaultConnection = false; | ||
8375 | } | ||
8353 | #endif | 8376 | #endif |
8377 | argc = argc-3; | ||
8378 | |||
8379 | |||
8354 | /* Do we have enough parameters? */ | 8380 | /* Do we have enough parameters? */ |
@@ -8371,2 +8397,3 @@ int main(int argc, char *argv[]) | |||
8371 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { | 8397 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { |
8398 | fprintf(stderr,"Executing \n"); | ||
8372 | Parameters[z].Function(argc - start, argv + start); | 8399 | Parameters[z].Function(argc - start, argv + start); |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 2ad1b5a..6df639f 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -37,2 +37,3 @@ | |||
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kmessagebox.h> | ||
38 | 39 | ||
@@ -248,2 +249,4 @@ ulong PhoneFormat::getCsumEvent( Event* event ) | |||
248 | attList << event->categoriesStr(); | 249 | attList << event->categoriesStr(); |
250 | //qDebug("csum cat %s", event->categoriesStr().latin1()); | ||
251 | |||
249 | attList << event->secrecyStr(); | 252 | attList << event->secrecyStr(); |
@@ -271,2 +274,5 @@ ulong PhoneFormat::getCsum( const QStringList & attList) | |||
271 | } | 274 | } |
275 | //QString dump = attList.join(","); | ||
276 | //qDebug("csum: %s", dump.latin1()); | ||
277 | |||
272 | return cSum; | 278 | return cSum; |
@@ -289,6 +295,11 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
289 | int ret = system ( command.latin1() ); | 295 | int ret = system ( command.latin1() ); |
290 | if ( ret != 0 ) | 296 | if ( ret != 0 ) { |
297 | qDebug("Error::command returned %d", ret); | ||
291 | return false; | 298 | return false; |
299 | } | ||
300 | qDebug("Command returned %d", ret); | ||
292 | VCalFormat vfload; | 301 | VCalFormat vfload; |
293 | vfload.setLocalTime ( true ); | 302 | vfload.setLocalTime ( true ); |
303 | qDebug("loading file ..."); | ||
304 | |||
294 | if ( ! vfload.load( calendar, fileName ) ) | 305 | if ( ! vfload.load( calendar, fileName ) ) |
@@ -297,3 +308,8 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
297 | Event* ev = er.first(); | 308 | Event* ev = er.first(); |
309 | qDebug("reading events... "); | ||
298 | while ( ev ) { | 310 | while ( ev ) { |
311 | QStringList cat = ev->categories(); | ||
312 | if ( cat.contains( "MeetingDEF" )) { | ||
313 | ev->setCategories( QStringList() ); | ||
314 | } | ||
299 | int id = ev->pilotId(); | 315 | int id = ev->pilotId(); |
@@ -317,2 +333,3 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
317 | { | 333 | { |
334 | qDebug("reading todos... "); | ||
318 | QPtrList<Todo> tr = calendar->rawTodos(); | 335 | QPtrList<Todo> tr = calendar->rawTodos(); |
@@ -484,3 +501,3 @@ bool PhoneFormat::save( Calendar *calendar) | |||
484 | to = tl.next(); | 501 | to = tl.next(); |
485 | } | 502 | } |
486 | // 3 save file | 503 | // 3 save file |
@@ -492,6 +509,15 @@ bool PhoneFormat::save( Calendar *calendar) | |||
492 | QString command ="./kammu --restore " + fileName + " -C" + | 509 | QString command ="./kammu --restore " + fileName + " -C" + |
493 | mConnection +" -D" + mDevice +" -M" + mModel;; | 510 | mConnection +" -D" + mDevice +" -M" + mModel; |
494 | int ret = system ( command.latin1() ); | 511 | int ret; |
495 | if ( ret != 0 ) | 512 | while ( (ret = system ( command.latin1())) != 0 ) { |
513 | qDebug("Error S::command returned %d. asking users", ret); | ||
514 | int retval = KMessageBox::warningContinueCancel(0, | ||
515 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel")); | ||
516 | if ( retval != KMessageBox::Continue ) | ||
517 | return false; | ||
518 | } | ||
519 | if ( ret != 0 ) { | ||
520 | qDebug("Error S::command returned %d", ret); | ||
496 | return false; | 521 | return false; |
522 | } | ||
497 | // 5 reread data | 523 | // 5 reread data |
@@ -517,6 +543,10 @@ bool PhoneFormat::save( Calendar *calendar) | |||
517 | while ( ev ) { | 543 | while ( ev ) { |
518 | qDebug("event new ID "); | 544 | //qDebug("event new ID %s",ev->summary().latin1()); |
519 | status.setText ( message + QString::number ( ++procCount ) ); | 545 | status.setText ( message + QString::number ( ++procCount ) ); |
520 | qApp->processEvents(); | 546 | qApp->processEvents(); |
521 | QString cSum = ev->getCsum(mProfileName); | 547 | uint csum; |
548 | csum = PhoneFormat::getCsumEvent( ev ); | ||
549 | QString cSum = QString::number( csum ); | ||
550 | ev->setCsum( mProfileName, cSum ); | ||
551 | //qDebug("Event cSum %s ", cSum.latin1()); | ||
522 | ev1 = er1.first(); | 552 | ev1 = er1.first(); |
@@ -527,2 +557,4 @@ bool PhoneFormat::save( Calendar *calendar) | |||
527 | ev->setID(mProfileName, ev1->getID(mProfileName) ); | 557 | ev->setID(mProfileName, ev1->getID(mProfileName) ); |
558 | //qDebug("Event found on phone for %s ", ev->summary().latin1()); | ||
559 | |||
528 | break; | 560 | break; |
@@ -540,2 +572,3 @@ bool PhoneFormat::save( Calendar *calendar) | |||
540 | //algo 6 compare todo | 572 | //algo 6 compare todo |
573 | tl = calendar->rawTodos(); | ||
541 | to = tl.first(); | 574 | to = tl.first(); |
@@ -549,3 +582,7 @@ bool PhoneFormat::save( Calendar *calendar) | |||
549 | qApp->processEvents(); | 582 | qApp->processEvents(); |
550 | QString cSum = to->getCsum(mProfileName); | 583 | uint csum; |
584 | csum = PhoneFormat::getCsumTodo( to ); | ||
585 | QString cSum = QString::number( csum ); | ||
586 | to->setCsum( mProfileName, cSum ); | ||
587 | qDebug("Todo cSum %s ", cSum.latin1()); | ||
551 | Todo* to1 = tl1.first(); | 588 | Todo* to1 = tl1.first(); |