-rw-r--r-- | libkcal/phoneformat.cpp | 44 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 19 | ||||
-rw-r--r-- | libkcal/vcalformat.h | 5 |
3 files changed, 55 insertions, 13 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 6276498..1769b37 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -447,8 +447,13 @@ public: } - QStringList categoryList; - categoryList << getCategory( Note ); - event->setCategories( categoryList ); - // strange 0 semms to mean: alarm enabled + QStringList cat = event->categories(); + QString nCat = getCategory( Note ); + + if ( !nCat.isEmpty() ) + if ( !cat.contains( nCat )) { + cat << nCat; + event->setCategories( cat ); + } + if ( alarm ) { Alarm *alarm; @@ -533,5 +538,5 @@ public: case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; case GSM_CAL_CALL : CATEGORY = QString("Call"); break; - case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; + //case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; @@ -1071,11 +1076,38 @@ bool PhoneFormat::save( Calendar *calendar) max = 0; while (Backup.Calendar[max]!=NULL) max++; + + GSM_DateTime* dtp; + for (i=0;i<max;i++) { status.setText ( message + QString::number ( ++procCount ) ); qApp->processEvents(); Note = *Backup.Calendar[i]; + +#if 0 + int j; + for (j=0;j<Note.EntriesNum;j++) { + //qDebug(" for ev"); + switch (Note.Entries[j].EntryType) { + case CAL_START_DATETIME: + //Note->Entries[i].Date.Hour = 5; + dtp = &Note.Entries[j].Date; + qDebug("start event %d %d %d - %d %d %d", dtp->Year, dtp->Month, dtp->Day, dtp->Hour, dtp->Minute, dtp->Second ); + break; + case CAL_END_DATETIME: + dtp = &Note.Entries[j].Date; + qDebug("end event %d %d %d - %d %d %d", dtp->Year, dtp->Month, dtp->Day, dtp->Hour, dtp->Minute, dtp->Second ); + break; + } + } + int type = Note.Type; + 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 ); +#endif + + Note.Type = GSM_CAL_MEETING; + // pending: fix in gammu GSM_ReadBackupFile the type settings + int loc = Note.Location; Note.Location = 0; error=Phone->AddCalendar(&s,&Note); - qDebug("add event %d %d", error, Note.Location ); + qDebug("add event %d %d %d", error, Note.Location, loc ); } } diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 9307f12..0ebd7d1 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp @@ -30,4 +30,5 @@ #include <kdebug.h> +#include <kglobal.h> #include <kmessagebox.h> #include <kiconloader.h> @@ -47,4 +48,5 @@ VCalFormat::VCalFormat() { mCalendar = 0; + useLocalTime = false; } @@ -167,7 +169,10 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text ) } -QString VCalFormat::eventToString( Event * event, Calendar *calendar) +QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLocal) { + if ( !event ) return QString::null; + bool useL = useLocalTime; + useLocalTime = useLocal; mCalendar = calendar; VObject *vevent = eventToVEvent( event ); @@ -175,9 +180,13 @@ QString VCalFormat::eventToString( Event * event, Calendar *calendar) QString result( buf ); cleanVObject( vevent ); + useLocalTime = useL; return result; } -QString VCalFormat::todoToString( Todo * todo, Calendar *calendar ) +QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal ) { + if ( !todo ) return QString::null; + bool useL = useLocalTime; + useLocalTime = useLocal; mCalendar = calendar; VObject *vevent = eventToVTodo( todo ); @@ -185,4 +194,5 @@ QString VCalFormat::todoToString( Todo * todo, Calendar *calendar ) QString result( buf ); cleanVObject( vevent ); + useLocalTime = useL; return result; } @@ -1435,7 +1445,6 @@ QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) ASSERT(qdt.date().isValid()); ASSERT(qdt.time().isValid()); - if (zulu) { - QDateTime tmpDT(qdt); - tmpDT = tmpDT.addSecs(60*(-mCalendar->getTimeZone())); // correct to GMT. + if (zulu && !useLocalTime ) { + QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", tmpDT.date().year(), tmpDT.date().month(), diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index 7b9ca26..848be78 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h @@ -63,6 +63,6 @@ class VCalFormat : public CalFormat { */ QString toString( Calendar * ); - QString eventToString( Event *, Calendar *calendar ); - QString todoToString( Todo * ,Calendar *calendar ); + QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true ); + QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true ); protected: @@ -101,4 +101,5 @@ class VCalFormat : public CalFormat { private: Calendar *mCalendar; + bool useLocalTime; QPtrList<Event> mEventsRelate; // events with relations |