summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkcal/vcalformat.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 309c699..a6ae1bc 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -53,27 +53,25 @@ VCalFormat::VCalFormat()
VCalFormat::~VCalFormat()
{
}
void VCalFormat::setLocalTime ( bool b )
{
useLocalTime = b;
}
bool VCalFormat::load(Calendar *calendar, const QString &fileName)
{
mCalendar = calendar;
clearException();
-
- kdDebug(5800) << "VCalFormat::load() " << fileName << endl;
-
+ useLocalTime = mCalendar->isLocalTime();
VObject *vcal = 0;
// this is not necessarily only 1 vcal. Could be many vcals, or include
// a vcard...
vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data()));
if (!vcal) {
setException(new ErrorFormat(ErrorFormat::CalVersionUnknown));
return FALSE;
}
// any other top-level calendar stuff should be added/initialized here
@@ -83,29 +81,29 @@ bool VCalFormat::load(Calendar *calendar, const QString &fileName)
// clean up from vcal API stuff
cleanVObjects(vcal);
cleanStrTbl();
return true;
}
bool VCalFormat::save(Calendar *calendar, const QString &fileName)
{
mCalendar = calendar;
+ useLocalTime = mCalendar->isLocalTime();
QString tmpStr;
VObject *vcal, *vo;
- kdDebug(5800) << "VCalFormat::save(): " << fileName << endl;
vcal = newVObject(VCCalProp);
// addPropValue(vcal,VCLocationProp, "0.0");
addPropValue(vcal,VCProdIdProp, productId());
tmpStr = mCalendar->getTimeZoneStr();
//qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() );
addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit());
addPropValue(vcal,VCVersionProp, _VCAL_VERSION);
// TODO STUFF
QPtrList<Todo> todoList = mCalendar->rawTodos();
@@ -119,28 +117,26 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName)
QPtrList<Event> events = mCalendar->rawEvents();
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
vo = eventToVEvent(ev);
addVObjectProp(vcal, vo);
}
writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal);
cleanVObjects(vcal);
cleanStrTbl();
if (QFile::exists(fileName)) {
- kdDebug(5800) << "No error" << endl;
return true;
} else {
- kdDebug(5800) << "Error" << endl;
return false; // error
}
}
bool VCalFormat::fromString( Calendar *calendar, const QString &text )
{
// TODO: Factor out VCalFormat::fromString()
QCString data = text.utf8();
if ( !data.size() ) return false;
@@ -152,25 +148,25 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text )
initPropIterator( &i, vcal );
// we only take the first object. TODO: parse all incidences.
do {
curvo = nextVObject( &i );
} while ( strcmp( vObjectName( curvo ), VCEventProp ) &&
strcmp( vObjectName( curvo ), VCTodoProp ) );
if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) {
Event *event = VEventToEvent( curvo );
calendar->addEvent( event );
} else {
- kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl;
+ qDebug("VCalFormat::fromString(): Unknown object type. ");
deleteVObject( vcal );
return false;
}
deleteVObject( vcal );
return true;
}
QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLocal)
{