summaryrefslogtreecommitdiffabout
path: root/libkcal/icalformat.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/icalformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/icalformat.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 3a2aac6..d9fe40b 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -291,170 +291,170 @@ QString ICalFormat::createScheduleMessage(IncidenceBase *incidence,
}
ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal,
const QString &messageText )
{
setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
clearException();
if (messageText.isEmpty()) return 0;
icalcomponent *message;
message = icalparser_parse_string(messageText.local8Bit());
if (!message) return 0;
icalproperty *m = icalcomponent_get_first_property(message,
ICAL_METHOD_PROPERTY);
if (!m) return 0;
icalcomponent *c;
IncidenceBase *incidence = 0;
c = icalcomponent_get_first_component(message,ICAL_VEVENT_COMPONENT);
if (c) {
incidence = mImpl->readEvent(c);
}
if (!incidence) {
c = icalcomponent_get_first_component(message,ICAL_VTODO_COMPONENT);
if (c) {
incidence = mImpl->readTodo(c);
}
}
if (!incidence) {
c = icalcomponent_get_first_component(message,ICAL_VFREEBUSY_COMPONENT);
if (c) {
incidence = mImpl->readFreeBusy(c);
}
}
if (!incidence) {
kdDebug() << "ICalFormat:parseScheduleMessage: object is not a freebusy, event or todo" << endl;
return 0;
}
kdDebug(5800) << "ICalFormat::parseScheduleMessage() getting method..." << endl;
icalproperty_method icalmethod = icalproperty_get_method(m);
Scheduler::Method method;
switch (icalmethod) {
case ICAL_METHOD_PUBLISH:
method = Scheduler::Publish;
break;
case ICAL_METHOD_REQUEST:
method = Scheduler::Request;
break;
case ICAL_METHOD_REFRESH:
method = Scheduler::Refresh;
break;
case ICAL_METHOD_CANCEL:
method = Scheduler::Cancel;
break;
case ICAL_METHOD_ADD:
method = Scheduler::Add;
break;
case ICAL_METHOD_REPLY:
method = Scheduler::Reply;
break;
case ICAL_METHOD_COUNTER:
method = Scheduler::Counter;
break;
case ICAL_METHOD_DECLINECOUNTER:
method = Scheduler::Declinecounter;
break;
default:
method = Scheduler::NoMethod;
kdDebug(5800) << "ICalFormat::parseScheduleMessage(): Unknow method" << endl;
break;
}
if (!icalrestriction_check(message)) {
setException(new ErrorFormat(ErrorFormat::Restriction,
Scheduler::translatedMethodName(method) + ": " +
mImpl->extractErrorProperty(c)));
return 0;
}
icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal);
Incidence *existingIncidence = cal->event(incidence->uid());
if (existingIncidence) {
// TODO: check, if cast is required, or if it can be done by virtual funcs.
- if (existingIncidence->type() == "Todo") {
+ if (existingIncidence->typeID() == todoID ) {
Todo *todo = static_cast<Todo *>(existingIncidence);
icalcomponent_add_component(calendarComponent,
mImpl->writeTodo(todo));
}
- if (existingIncidence->type() == "Event") {
+ if (existingIncidence->typeID() == eventID ) {
Event *event = static_cast<Event *>(existingIncidence);
icalcomponent_add_component(calendarComponent,
mImpl->writeEvent(event));
}
} else {
calendarComponent = 0;
}
qDebug("icalclassify commented out ");
ScheduleMessage::Status status;
#if 0
icalclass result = icalclassify(message,calendarComponent,(char *)"");
switch (result) {
case ICAL_PUBLISH_NEW_CLASS:
status = ScheduleMessage::PublishNew;
break;
case ICAL_OBSOLETE_CLASS:
status = ScheduleMessage::Obsolete;
break;
case ICAL_REQUEST_NEW_CLASS:
status = ScheduleMessage::RequestNew;
break;
case ICAL_REQUEST_UPDATE_CLASS:
status = ScheduleMessage::RequestUpdate;
break;
case ICAL_UNKNOWN_CLASS:
default:
status = ScheduleMessage::Unknown;
break;
}
#endif
status = ScheduleMessage::RequestUpdate;
return new ScheduleMessage(incidence,method,status);
}
void ICalFormat::setTimeZone( const QString &id, bool utc )
{
mTimeZoneId = id;
mUtc = utc;
tzOffsetMin = KGlobal::locale()->timezoneOffset(mTimeZoneId);
//qDebug("ICalFormat::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), tzOffsetMin);
}
QString ICalFormat::timeZoneId() const
{
return mTimeZoneId;
}
bool ICalFormat::utc() const
{
return mUtc;
}
int ICalFormat::timeOffset()
{
return tzOffsetMin;
}
const char *ICalFormat::tzString()
{
const char* ret = (const char* ) mTzString;
return ret;
}