summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-08-20 23:53:07 (UTC)
committer zautrix <zautrix>2004-08-20 23:53:07 (UTC)
commitab07441b413dff6d478e2c3a39b823b4269931c5 (patch) (side-by-side diff)
tree5de6576a6c0e20e4af2db7baa5019aa983e2195a /libkcal
parentbc33238f8038a03e04f25ea608c53e784616fee6 (diff)
downloadkdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.zip
kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.gz
kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.bz2
Sync fixes and fix of config loading bug
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp44
-rw-r--r--libkcal/vcalformat.cpp19
-rw-r--r--libkcal/vcalformat.h5
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
@@ -443,16 +443,21 @@ public:
r->addYearlyNum( startDate.month() );
}
} else {
event->recurrence()->unsetRecurs();
}
- 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;
if ( event->alarms().count() > 0 )
alarm = event->alarms().first();
else {
alarm = new Alarm( event );
@@ -529,13 +534,13 @@ public:
QString getCategory( GSM_CalendarEntry* Note)
{
QString CATEGORY;
switch (Note->Type) {
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;
case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break;
case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break;
case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break;
case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break;
@@ -1067,19 +1072,46 @@ bool PhoneFormat::save( Calendar *calendar)
int max, i;
procCount = 0;
message = i18n(" Writing event # ");
if (Backup.Calendar[0] != NULL) {
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 );
}
}
//algo 4 writing todo
procCount = 0;
message = i18n(" Writing todo # ");
if (Backup.ToDo[0] != NULL) {
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 9307f12..0ebd7d1 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -26,12 +26,13 @@
#include <qregexp.h>
#include <qclipboard.h>
#include <qdialog.h>
#include <qfile.h>
#include <kdebug.h>
+#include <kglobal.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <klocale.h>
#include "vcc.h"
#include "vobject.h"
@@ -43,12 +44,13 @@
using namespace KCal;
VCalFormat::VCalFormat()
{
mCalendar = 0;
+ useLocalTime = false;
}
VCalFormat::~VCalFormat()
{
}
@@ -163,30 +165,38 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text )
deleteVObject( vcal );
return true;
}
-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 );
char *buf = writeMemVObject( 0, 0, vevent );
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 );
char *buf = writeMemVObject( 0, 0, vevent );
QString result( buf );
cleanVObject( vevent );
+ useLocalTime = useL;
return result;
}
QString VCalFormat::toString( Calendar *calendar )
{
// TODO: Factor out VCalFormat::asString()
@@ -1431,15 +1441,14 @@ QString VCalFormat::qDateToISO(const QDate &qd)
QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu)
{
QString tmpStr;
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(),
tmpDT.date().day(), tmpDT.time().hour(),
tmpDT.time().minute(), tmpDT.time().second());
} else {
tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d",
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index 7b9ca26..848be78 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -59,14 +59,14 @@ class VCalFormat : public CalFormat {
*/
bool fromString( Calendar *, const QString & );
/**
Return calendar information as string.
*/
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:
/** translates a VObject of the TODO type into a Event */
Todo *VTodoToEvent(VObject *vtodo);
/** translates a VObject into a Event and returns a pointer to it. */
Event *VEventToEvent(VObject *vevent);
@@ -97,12 +97,13 @@ class VCalFormat : public CalFormat {
Attendee::PartStat readStatus(const char *s) const;
QCString writeStatus(Attendee::PartStat status) const;
private:
Calendar *mCalendar;
+ bool useLocalTime;
QPtrList<Event> mEventsRelate; // events with relations
QPtrList<Todo> mTodosRelate; // todos with relations
};
}