summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-20 23:53:07 (UTC)
committer zautrix <zautrix>2004-08-20 23:53:07 (UTC)
commitab07441b413dff6d478e2c3a39b823b4269931c5 (patch) (unidiff)
tree5de6576a6c0e20e4af2db7baa5019aa983e2195a
parentbc33238f8038a03e04f25ea608c53e784616fee6 (diff)
downloadkdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.zip
kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.gz
kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.bz2
Sync fixes and fix of config loading bug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp118
-rw-r--r--libkcal/phoneformat.cpp44
-rw-r--r--libkcal/vcalformat.cpp19
-rw-r--r--libkcal/vcalformat.h5
4 files changed, 115 insertions, 71 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 0db8e6d..dd978bf 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -381,96 +381,98 @@ QStringList KOPrefs::getDefaultList()
381 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 381 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
382 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 382 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
383 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 383 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
384 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 384 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
385 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 385 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
386 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 386 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
387 retval.sort(); 387 retval.sort();
388 return retval; 388 return retval;
389} 389}
390 390
391void KOPrefs::usrReadConfig() 391void KOPrefs::usrReadConfig()
392{ 392{
393 mLocaleDict = 0; 393 mLocaleDict = 0;
394 // pending LR fix translation 394 // pending LR fix translation
395 // qDebug("KOPrefs::usrReadConfig() fix translation "); 395 // qDebug("KOPrefs::usrReadConfig() fix translation ");
396 if ( mPreferredLanguage == 1 ) { 396 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) {
397 mLocaleDict = new QDict<QString>; 397 if ( mPreferredLanguage == 1 ) {
398 int i = 0;
399 QString fw ( germanwords[i] [0]);
400 while ( !fw.isEmpty() ) {
401 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
402 ++i;
403 fw = germanwords[i] [0];
404 }
405
406 setLocaleDict( mLocaleDict );
407 } else {
408 QString fileName ;
409 if ( mPreferredLanguage == 3 )
410 fileName = MainWindow::resourcePath()+"usertranslation.txt";
411 else if ( mPreferredLanguage == 2 )
412 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
413 else return;
414 QFile file( fileName );
415 if (file.open( IO_ReadOnly ) ) {
416 QTextStream ts( &file );
417 ts.setCodec( QTextCodec::codecForLocale() );
418 QString text = ts.read();
419 file.close();
420 text.replace( QRegExp("\\\\n"), "\n" );
421 QString line;
422 QString we;
423 QString wt;
424 int br = 0;
425 int nbr;
426 nbr = text.find ( "},", br );
427 line = text.mid( br, nbr - br );
428 br = nbr+1;
429 int se, ee, st, et;
430 mLocaleDict = new QDict<QString>; 398 mLocaleDict = new QDict<QString>;
431 QString end = "{ \"\",\"\" }"; 399 int i = 0;
432 while ( (line != end) && (br > 1) ) { 400 QString fw ( germanwords[i] [0]);
433 //qDebug("%d *%s* ", br, line.latin1()); 401 while ( !fw.isEmpty() ) {
434 se = line.find("\"")+1; 402 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
435 et = line.findRev("\"",-1); 403 ++i;
436 ee = line.find("\",\""); 404 fw = germanwords[i] [0];
437 st = ee+3;
438 we = line.mid( se, ee-se );
439 wt = line.mid( st, et-st );
440 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
441 mLocaleDict->insert( we, new QString (wt) );
442 nbr = text.find ( "}", br );
443 line = text.mid( br, nbr - br );
444 br = nbr+1;
445 } 405 }
446 //qDebug("end *%s* ", end.latin1()); 406
447
448 setLocaleDict( mLocaleDict ); 407 setLocaleDict( mLocaleDict );
449 } else { 408 } else {
450 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 409 QString fileName ;
451 } 410 if ( mPreferredLanguage == 3 )
411 fileName = MainWindow::resourcePath()+"usertranslation.txt";
412 else if ( mPreferredLanguage == 2 )
413 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
414 QFile file( fileName );
415 if (file.open( IO_ReadOnly ) ) {
416 QTextStream ts( &file );
417 ts.setEncoding( QTextStream::Latin1 );
418 //ts.setCodec( QTextCodec::latin1 );
419 QString text = ts.read();
420 file.close();
421 text.replace( QRegExp("\\\\n"), "\n" );
422 QString line;
423 QString we;
424 QString wt;
425 int br = 0;
426 int nbr;
427 nbr = text.find ( "},", br );
428 line = text.mid( br, nbr - br );
429 br = nbr+1;
430 int se, ee, st, et;
431 mLocaleDict = new QDict<QString>;
432 QString end = "{ \"\",\"\" }";
433 while ( (line != end) && (br > 1) ) {
434 //qDebug("%d *%s* ", br, line.latin1());
435 se = line.find("\"")+1;
436 et = line.findRev("\"",-1);
437 ee = line.find("\",\"");
438 st = ee+3;
439 we = line.mid( se, ee-se );
440 wt = line.mid( st, et-st );
441 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
442 mLocaleDict->insert( we, new QString (wt) );
443 nbr = text.find ( "}", br );
444 line = text.mid( br, nbr - br );
445 br = nbr+1;
446 }
447 //qDebug("end *%s* ", end.latin1());
448
449 setLocaleDict( mLocaleDict );
450 } else {
451 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
452 }
452 453
453} 454 }
455 }
454 config()->setGroup("General"); 456 config()->setGroup("General");
455 457
456 mCustomCategories = config()->readListEntry("Custom Categories"); 458 mCustomCategories = config()->readListEntry("Custom Categories");
457 if ( KOPrefs::instance()->mLanguageChanged ) { 459 if ( KOPrefs::instance()->mLanguageChanged ) {
458 mLocationDefaults.clear(); 460 mLocationDefaults.clear();
459 mEventSummaryUser.clear(); 461 mEventSummaryUser.clear();
460 mTodoSummaryUser.clear(); 462 mTodoSummaryUser.clear();
461 } 463 }
462 if (mLocationDefaults.isEmpty()) { 464 if (mLocationDefaults.isEmpty()) {
463 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach") 465 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
464 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden") 466 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
465 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 467 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
466 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 468 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
467 mLocationDefaults.sort(); 469 mLocationDefaults.sort();
468 } 470 }
469 471
470 if (mEventSummaryUser.isEmpty()) { 472 if (mEventSummaryUser.isEmpty()) {
471 mEventSummaryUser = getDefaultList() ; 473 mEventSummaryUser = getDefaultList() ;
472 } 474 }
473 if (mTodoSummaryUser.isEmpty()) { 475 if (mTodoSummaryUser.isEmpty()) {
474 mTodoSummaryUser = getDefaultList() ; 476 mTodoSummaryUser = getDefaultList() ;
475 } 477 }
476 478
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 6276498..1769b37 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -437,28 +437,33 @@ public:
437 r->addMonthlyPos( pos, days ); 437 r->addMonthlyPos( pos, days );
438 } else if ( rtype == 4 ) { 438 } else if ( rtype == 4 ) {
439 if ( hasEndDate ) 439 if ( hasEndDate )
440 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 440 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
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 }
461 alarm->setType( Alarm::Audio ); 466 alarm->setType( Alarm::Audio );
462 alarm->setEnabled( true ); 467 alarm->setEnabled( true );
463 int alarmOffset = alarmDt.secsTo( event->dtStart() ); 468 int alarmOffset = alarmDt.secsTo( event->dtStart() );
464 alarm->setStartOffset( -alarmOffset ); 469 alarm->setStartOffset( -alarmOffset );
@@ -523,25 +528,25 @@ public:
523 } 528 }
524 return datestr + timestr; 529 return datestr + timestr;
525 } 530 }
526 QDate datefromGSM ( GSM_DateTime*dtp ) { 531 QDate datefromGSM ( GSM_DateTime*dtp ) {
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;
544 case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; 549 case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break;
545 case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; 550 case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break;
546 case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; 551 case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break;
547 case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; 552 case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break;
@@ -1061,31 +1066,58 @@ bool PhoneFormat::save( Calendar *calendar)
1061 status.setText ( message ); 1066 status.setText ( message );
1062 qApp->processEvents(); 1067 qApp->processEvents();
1063 GSM_Backup Backup; 1068 GSM_Backup Backup;
1064 error=GSM_ReadBackupFile( (char*) fileName.latin1() ,&Backup); 1069 error=GSM_ReadBackupFile( (char*) fileName.latin1() ,&Backup);
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++;
1088 for (i=0;i<max;i++) { 1120 for (i=0;i<max;i++) {
1089 status.setText ( message + QString::number ( ++procCount ) ); 1121 status.setText ( message + QString::number ( ++procCount ) );
1090 qApp->processEvents(); 1122 qApp->processEvents();
1091 ToDoEntry = *Backup.ToDo[i]; 1123 ToDoEntry = *Backup.ToDo[i];
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 9307f12..0ebd7d1 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -20,41 +20,43 @@
20*/ 20*/
21 21
22#include <qapplication.h> 22#include <qapplication.h>
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qclipboard.h> 27#include <qclipboard.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qfile.h> 29#include <qfile.h>
30 30
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h>
32#include <kmessagebox.h> 33#include <kmessagebox.h>
33#include <kiconloader.h> 34#include <kiconloader.h>
34#include <klocale.h> 35#include <klocale.h>
35 36
36#include "vcc.h" 37#include "vcc.h"
37#include "vobject.h" 38#include "vobject.h"
38 39
39#include "vcaldrag.h" 40#include "vcaldrag.h"
40#include "calendar.h" 41#include "calendar.h"
41 42
42#include "vcalformat.h" 43#include "vcalformat.h"
43 44
44using namespace KCal; 45using namespace KCal;
45 46
46VCalFormat::VCalFormat() 47VCalFormat::VCalFormat()
47{ 48{
48 mCalendar = 0; 49 mCalendar = 0;
50 useLocalTime = false;
49} 51}
50 52
51VCalFormat::~VCalFormat() 53VCalFormat::~VCalFormat()
52{ 54{
53} 55}
54 56
55bool VCalFormat::load(Calendar *calendar, const QString &fileName) 57bool VCalFormat::load(Calendar *calendar, const QString &fileName)
56{ 58{
57 mCalendar = calendar; 59 mCalendar = calendar;
58 60
59 clearException(); 61 clearException();
60 62
@@ -157,42 +159,50 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text )
157 calendar->addEvent( event ); 159 calendar->addEvent( event );
158 } else { 160 } else {
159 kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl; 161 kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl;
160 deleteVObject( vcal ); 162 deleteVObject( vcal );
161 return false; 163 return false;
162 } 164 }
163 165
164 deleteVObject( vcal ); 166 deleteVObject( vcal );
165 167
166 return true; 168 return true;
167} 169}
168 170
169QString VCalFormat::eventToString( Event * event, Calendar *calendar) 171QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLocal)
170{ 172{
173
171 if ( !event ) return QString::null; 174 if ( !event ) return QString::null;
175 bool useL = useLocalTime;
176 useLocalTime = useLocal;
172 mCalendar = calendar; 177 mCalendar = calendar;
173 VObject *vevent = eventToVEvent( event ); 178 VObject *vevent = eventToVEvent( event );
174 char *buf = writeMemVObject( 0, 0, vevent ); 179 char *buf = writeMemVObject( 0, 0, vevent );
175 QString result( buf ); 180 QString result( buf );
176 cleanVObject( vevent ); 181 cleanVObject( vevent );
182 useLocalTime = useL;
177 return result; 183 return result;
178} 184}
179QString VCalFormat::todoToString( Todo * todo, Calendar *calendar ) 185QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal )
180{ 186{
187
181 if ( !todo ) return QString::null; 188 if ( !todo ) return QString::null;
189 bool useL = useLocalTime;
190 useLocalTime = useLocal;
182 mCalendar = calendar; 191 mCalendar = calendar;
183 VObject *vevent = eventToVTodo( todo ); 192 VObject *vevent = eventToVTodo( todo );
184 char *buf = writeMemVObject( 0, 0, vevent ); 193 char *buf = writeMemVObject( 0, 0, vevent );
185 QString result( buf ); 194 QString result( buf );
186 cleanVObject( vevent ); 195 cleanVObject( vevent );
196 useLocalTime = useL;
187 return result; 197 return result;
188} 198}
189 199
190QString VCalFormat::toString( Calendar *calendar ) 200QString VCalFormat::toString( Calendar *calendar )
191{ 201{
192 // TODO: Factor out VCalFormat::asString() 202 // TODO: Factor out VCalFormat::asString()
193 203
194 VObject *vcal = newVObject(VCCalProp); 204 VObject *vcal = newVObject(VCCalProp);
195 205
196 addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); 206 addPropValue( vcal, VCProdIdProp, CalFormat::productId() );
197 QString tmpStr = mCalendar->getTimeZoneStr(); 207 QString tmpStr = mCalendar->getTimeZoneStr();
198 addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); 208 addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() );
@@ -1425,27 +1435,26 @@ QString VCalFormat::qDateToISO(const QDate &qd)
1425 tmpStr.sprintf("%.2d%.2d%.2d", 1435 tmpStr.sprintf("%.2d%.2d%.2d",
1426 qd.year(), qd.month(), qd.day()); 1436 qd.year(), qd.month(), qd.day());
1427 return tmpStr; 1437 return tmpStr;
1428 1438
1429} 1439}
1430 1440
1431QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) 1441QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu)
1432{ 1442{
1433 QString tmpStr; 1443 QString tmpStr;
1434 1444
1435 ASSERT(qdt.date().isValid()); 1445 ASSERT(qdt.date().isValid());
1436 ASSERT(qdt.time().isValid()); 1446 ASSERT(qdt.time().isValid());
1437 if (zulu) { 1447 if (zulu && !useLocalTime ) {
1438 QDateTime tmpDT(qdt); 1448 QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60);
1439 tmpDT = tmpDT.addSecs(60*(-mCalendar->getTimeZone())); // correct to GMT.
1440 tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", 1449 tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ",
1441 tmpDT.date().year(), tmpDT.date().month(), 1450 tmpDT.date().year(), tmpDT.date().month(),
1442 tmpDT.date().day(), tmpDT.time().hour(), 1451 tmpDT.date().day(), tmpDT.time().hour(),
1443 tmpDT.time().minute(), tmpDT.time().second()); 1452 tmpDT.time().minute(), tmpDT.time().second());
1444 } else { 1453 } else {
1445 tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", 1454 tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d",
1446 qdt.date().year(), qdt.date().month(), 1455 qdt.date().year(), qdt.date().month(),
1447 qdt.date().day(), qdt.time().hour(), 1456 qdt.date().day(), qdt.time().hour(),
1448 qdt.time().minute(), qdt.time().second()); 1457 qdt.time().minute(), qdt.time().second());
1449 } 1458 }
1450 return tmpStr; 1459 return tmpStr;
1451} 1460}
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index 7b9ca26..848be78 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -53,26 +53,26 @@ class VCalFormat : public CalFormat {
53 * @param fileName the name of the file 53 * @param fileName the name of the file
54 */ 54 */
55 bool save(Calendar *,const QString &fileName); 55 bool save(Calendar *,const QString &fileName);
56 56
57 /** 57 /**
58 Parse string and populate calendar with that information. 58 Parse string and populate calendar with that information.
59 */ 59 */
60 bool fromString( Calendar *, const QString & ); 60 bool fromString( Calendar *, const QString & );
61 /** 61 /**
62 Return calendar information as string. 62 Return calendar information as string.
63 */ 63 */
64 QString toString( Calendar * ); 64 QString toString( Calendar * );
65 QString eventToString( Event *, Calendar *calendar ); 65 QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true );
66 QString todoToString( Todo * ,Calendar *calendar ); 66 QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true );
67 67
68 protected: 68 protected:
69 /** translates a VObject of the TODO type into a Event */ 69 /** translates a VObject of the TODO type into a Event */
70 Todo *VTodoToEvent(VObject *vtodo); 70 Todo *VTodoToEvent(VObject *vtodo);
71 /** translates a VObject into a Event and returns a pointer to it. */ 71 /** translates a VObject into a Event and returns a pointer to it. */
72 Event *VEventToEvent(VObject *vevent); 72 Event *VEventToEvent(VObject *vevent);
73 /** translate a Event into a VTodo-type VObject and return pointer */ 73 /** translate a Event into a VTodo-type VObject and return pointer */
74 VObject *eventToVTodo(const Todo *anEvent); 74 VObject *eventToVTodo(const Todo *anEvent);
75 /** translate a Event into a VObject and returns a pointer to it. */ 75 /** translate a Event into a VObject and returns a pointer to it. */
76 VObject* eventToVEvent(const Event *anEvent); 76 VObject* eventToVEvent(const Event *anEvent);
77 77
78 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ 78 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */
@@ -91,20 +91,21 @@ class VCalFormat : public CalFormat {
91 91
92 /** takes a number 0 - 6 and returns the two letter string of that day, 92 /** takes a number 0 - 6 and returns the two letter string of that day,
93 * i.e. MO, TU, WE, etc. */ 93 * i.e. MO, TU, WE, etc. */
94 const char *dayFromNum(int day); 94 const char *dayFromNum(int day);
95 /** the reverse of the above function. */ 95 /** the reverse of the above function. */
96 int numFromDay(const QString &day); 96 int numFromDay(const QString &day);
97 97
98 Attendee::PartStat readStatus(const char *s) const; 98 Attendee::PartStat readStatus(const char *s) const;
99 QCString writeStatus(Attendee::PartStat status) const; 99 QCString writeStatus(Attendee::PartStat status) const;
100 100
101 private: 101 private:
102 Calendar *mCalendar; 102 Calendar *mCalendar;
103 bool useLocalTime;
103 104
104 QPtrList<Event> mEventsRelate; // events with relations 105 QPtrList<Event> mEventsRelate; // events with relations
105 QPtrList<Todo> mTodosRelate; // todos with relations 106 QPtrList<Todo> mTodosRelate; // todos with relations
106}; 107};
107 108
108} 109}
109 110
110#endif 111#endif