-rw-r--r-- | libkcal/phoneformat.cpp | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 6276498..1769b37 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -441,20 +441,25 @@ public: | |||
441 | else | 441 | else |
442 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 442 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
443 | r->addYearlyNum( startDate.month() ); | 443 | r->addYearlyNum( startDate.month() ); |
444 | } | 444 | } |
445 | } else { | 445 | } else { |
446 | event->recurrence()->unsetRecurs(); | 446 | event->recurrence()->unsetRecurs(); |
447 | } | 447 | } |
448 | 448 | ||
449 | QStringList categoryList; | 449 | QStringList cat = event->categories(); |
450 | categoryList << getCategory( Note ); | 450 | QString nCat = getCategory( Note ); |
451 | event->setCategories( categoryList ); | 451 | |
452 | // strange 0 semms to mean: alarm enabled | 452 | if ( !nCat.isEmpty() ) |
453 | if ( !cat.contains( nCat )) { | ||
454 | cat << nCat; | ||
455 | event->setCategories( cat ); | ||
456 | } | ||
457 | |||
453 | if ( alarm ) { | 458 | if ( alarm ) { |
454 | Alarm *alarm; | 459 | Alarm *alarm; |
455 | if ( event->alarms().count() > 0 ) | 460 | if ( event->alarms().count() > 0 ) |
456 | alarm = event->alarms().first(); | 461 | alarm = event->alarms().first(); |
457 | else { | 462 | else { |
458 | alarm = new Alarm( event ); | 463 | alarm = new Alarm( event ); |
459 | event->addAlarm( alarm ); | 464 | event->addAlarm( alarm ); |
460 | } | 465 | } |
@@ -527,17 +532,17 @@ public: | |||
527 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); | 532 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); |
528 | } | 533 | } |
529 | QString getCategory( GSM_CalendarEntry*Note) | 534 | QString getCategory( GSM_CalendarEntry*Note) |
530 | { | 535 | { |
531 | QString CATEGORY; | 536 | QString CATEGORY; |
532 | switch (Note->Type) { | 537 | switch (Note->Type) { |
533 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; | 538 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; |
534 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; | 539 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; |
535 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; | 540 | //case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; |
536 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; | 541 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; |
537 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; | 542 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; |
538 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; | 543 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; |
539 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; | 544 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; |
540 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; | 545 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; |
541 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; | 546 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; |
542 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; | 547 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; |
543 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; | 548 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; |
@@ -1065,23 +1070,50 @@ bool PhoneFormat::save( Calendar *calendar) | |||
1065 | qDebug("Read file result %d ",error ); | 1070 | qDebug("Read file result %d ",error ); |
1066 | //algo 4 writing event | 1071 | //algo 4 writing event |
1067 | int max, i; | 1072 | int max, i; |
1068 | procCount = 0; | 1073 | procCount = 0; |
1069 | message = i18n(" Writing event # "); | 1074 | message = i18n(" Writing event # "); |
1070 | if (Backup.Calendar[0] != NULL) { | 1075 | if (Backup.Calendar[0] != NULL) { |
1071 | max = 0; | 1076 | max = 0; |
1072 | while (Backup.Calendar[max]!=NULL) max++; | 1077 | while (Backup.Calendar[max]!=NULL) max++; |
1078 | |||
1079 | GSM_DateTime*dtp; | ||
1080 | |||
1073 | for (i=0;i<max;i++) { | 1081 | for (i=0;i<max;i++) { |
1074 | status.setText ( message + QString::number ( ++procCount ) ); | 1082 | status.setText ( message + QString::number ( ++procCount ) ); |
1075 | qApp->processEvents(); | 1083 | qApp->processEvents(); |
1076 | Note = *Backup.Calendar[i]; | 1084 | Note = *Backup.Calendar[i]; |
1085 | |||
1086 | #if 0 | ||
1087 | int j; | ||
1088 | for (j=0;j<Note.EntriesNum;j++) { | ||
1089 | //qDebug(" for ev"); | ||
1090 | switch (Note.Entries[j].EntryType) { | ||
1091 | case CAL_START_DATETIME: | ||
1092 | //Note->Entries[i].Date.Hour = 5; | ||
1093 | dtp = &Note.Entries[j].Date; | ||
1094 | qDebug("start event %d %d %d - %d %d %d", dtp->Year, dtp->Month, dtp->Day, dtp->Hour, dtp->Minute, dtp->Second ); | ||
1095 | break; | ||
1096 | case CAL_END_DATETIME: | ||
1097 | dtp = &Note.Entries[j].Date; | ||
1098 | qDebug("end event %d %d %d - %d %d %d", dtp->Year, dtp->Month, dtp->Day, dtp->Hour, dtp->Minute, dtp->Second ); | ||
1099 | break; | ||
1100 | } | ||
1101 | } | ||
1102 | int type = Note.Type; | ||
1103 | qDebug(" event type %d - %d %d - %d %d %d",type, GSM_CAL_CALL , GSM_CAL_MEETING ,GSM_CAL_BIRTHDAY, GSM_CAL_MEMO ,GSM_CAL_ALARM ); | ||
1104 | #endif | ||
1105 | |||
1106 | Note.Type = GSM_CAL_MEETING; | ||
1107 | // pending: fix in gammu GSM_ReadBackupFile the type settings | ||
1108 | int loc = Note.Location; | ||
1077 | Note.Location = 0; | 1109 | Note.Location = 0; |
1078 | error=Phone->AddCalendar(&s,&Note); | 1110 | error=Phone->AddCalendar(&s,&Note); |
1079 | qDebug("add event %d %d", error, Note.Location ); | 1111 | qDebug("add event %d %d %d", error, Note.Location, loc ); |
1080 | } | 1112 | } |
1081 | } | 1113 | } |
1082 | //algo 4 writing todo | 1114 | //algo 4 writing todo |
1083 | procCount = 0; | 1115 | procCount = 0; |
1084 | message = i18n(" Writing todo # "); | 1116 | message = i18n(" Writing todo # "); |
1085 | if (Backup.ToDo[0] != NULL) { | 1117 | if (Backup.ToDo[0] != NULL) { |
1086 | max = 0; | 1118 | max = 0; |
1087 | while (Backup.ToDo[max]!=NULL) max++; | 1119 | while (Backup.ToDo[max]!=NULL) max++; |