-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 44 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 19 | ||||
-rw-r--r-- | libkcal/vcalformat.h | 5 |
4 files changed, 61 insertions, 17 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 0db8e6d..dd978bf 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -395,2 +395,3 @@ void KOPrefs::usrReadConfig() // qDebug("KOPrefs::usrReadConfig() fix translation "); + if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { if ( mPreferredLanguage == 1 ) { @@ -412,3 +413,2 @@ void KOPrefs::usrReadConfig() fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; - else return; QFile file( fileName ); @@ -416,3 +416,4 @@ void KOPrefs::usrReadConfig() QTextStream ts( &file ); - ts.setCodec( QTextCodec::codecForLocale() ); + ts.setEncoding( QTextStream::Latin1 ); + //ts.setCodec( QTextCodec::latin1 ); QString text = ts.read(); @@ -453,2 +454,3 @@ void KOPrefs::usrReadConfig() } + } config()->setGroup("General"); @@ -462,4 +464,4 @@ void KOPrefs::usrReadConfig() if (mLocationDefaults.isEmpty()) { - mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach") - << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden") + mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") + << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 6276498..1769b37 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -448,6 +448,11 @@ 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 ) { @@ -534,3 +539,3 @@ public: 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; @@ -1072,2 +1077,5 @@ bool PhoneFormat::save( Calendar *calendar) while (Backup.Calendar[max]!=NULL) max++; + + GSM_DateTime* dtp; + for (i=0;i<max;i++) { @@ -1076,5 +1084,29 @@ bool PhoneFormat::save( Calendar *calendar) 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 @@ -31,2 +31,3 @@ #include <kdebug.h> +#include <kglobal.h> #include <kmessagebox.h> @@ -48,2 +49,3 @@ VCalFormat::VCalFormat() mCalendar = 0; + useLocalTime = false; } @@ -168,5 +170,8 @@ 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; @@ -176,7 +181,11 @@ QString VCalFormat::eventToString( Event * event, Calendar *calendar) 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; @@ -186,2 +195,3 @@ QString VCalFormat::todoToString( Todo * todo, Calendar *calendar ) cleanVObject( vevent ); + useLocalTime = useL; return result; @@ -1436,5 +1446,4 @@ QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) 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", diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index 7b9ca26..848be78 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h @@ -64,4 +64,4 @@ 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 ); @@ -102,2 +102,3 @@ class VCalFormat : public CalFormat { Calendar *mCalendar; + bool useLocalTime; |