KCalendarCore::VCalFormat Class

class KCalendarCore::VCalFormat

vCalendar format implementation. More...

Header: #include <KCalendarCore/VCalFormat>
CMake: find_package(KF6 REQUIRED COMPONENTS CalendarCore)
target_link_libraries(mytarget PRIVATE KF6::CalendarCore)
Inherits: KCalendarCore::CalFormat

Public Functions

VCalFormat()
virtual ~VCalFormat() override

Reimplemented Public Functions

virtual bool fromRawString(const KCalendarCore::Calendar::Ptr &calendar, const QByteArray &string) override
virtual bool load(const KCalendarCore::Calendar::Ptr &calendar, const QString &fileName) override
virtual bool save(const KCalendarCore::Calendar::Ptr &calendar, const QString &fileName) override
virtual QString toString(const KCalendarCore::Calendar::Ptr &calendar) override

Protected Functions

QDate ISOToQDate(const QString &dtStr)
QDateTime ISOToQDateTime(const QString &dtStr)
KCalendarCore::Event::Ptr VEventToEvent(VObject *vevent)
KCalendarCore::Todo::Ptr VTodoToEvent(VObject *vtodo)
int numFromDay(const QString &day)
QString parseDst(QByteArray &timezone) const
QString parseTZ(const QByteArray &timezone) const
bool parseTZOffsetISO8601(const QString &s, int &result)
void populate(VObject *vcal)
QString qDateTimeToISO(const QDateTime &date, bool zulu = true)
QString qDateToISO(const QDate &date)
KCalendarCore::Attendee::PartStat readStatus(const char *s) const
QByteArray writeStatus(KCalendarCore::Attendee::PartStat status) const

Detailed Description

This class implements the vCalendar format. It provides methods for loading/saving/converting vCalendar format data into the internal representation as Calendar and Incidences.

Member Function Documentation

VCalFormat::VCalFormat()

Constructor a new vCalendar Format object.

[override virtual noexcept] VCalFormat::~VCalFormat()

Destructor.

[protected] QDate VCalFormat::ISOToQDate(const QString &dtStr)

Takes a string in the YYYYMMDD format and returns a valid QDate.

dtStr is a QString containing the date to convert. If this value is invalid, then QDateTime() is returned.

[protected] QDateTime VCalFormat::ISOToQDateTime(const QString &dtStr)

Takes a string in YYYYMMDDTHHMMSS format and returns a valid QDateTime.

dtStr is a QString containing the date to convert. If this value is invalid, then QDateTime() is returned.

[protected] KCalendarCore::Event::Ptr VCalFormat::VEventToEvent(VObject *vevent)

Translates a VObject into a Event and returns a pointer to it.

vevent is a pointer to a valid VObject object.

[protected] KCalendarCore::Todo::Ptr VCalFormat::VTodoToEvent(VObject *vtodo)

Translates a VObject of the TODO type into an Event.

vtodo is a pointer to a valid VObject object.

[override virtual] bool VCalFormat::fromRawString(const KCalendarCore::Calendar::Ptr &calendar, const QByteArray &string)

Reimplements: CalFormat::fromRawString(const KCalendarCore::Calendar::Ptr &calendar, const QByteArray &string).

[override virtual] bool VCalFormat::load(const KCalendarCore::Calendar::Ptr &calendar, const QString &fileName)

Reimplements: CalFormat::load(const KCalendarCore::Calendar::Ptr &calendar, const QString &fileName).

[protected] int VCalFormat::numFromDay(const QString &day)

Converts a two letter representation of the day (i.e. MO, TU, WE, etc) and returns a number 0-6 corresponding to that ordinal day of the week.

day is the QString containing the two letter day representation.

[protected] QString VCalFormat::parseDst(QByteArray &timezone) const

Parse DAYLIGHT tag from timezone.

[protected] QString VCalFormat::parseTZ(const QByteArray &timezone) const

Parse TZ tag from timezone.

[protected] bool VCalFormat::parseTZOffsetISO8601(const QString &s, int &result)

Parse one of the myriad of ISO8601 timezone offset formats, e.g.

  • hh : mm
  • hh mm
  • hh

s string to be parsed.

result timezone offset in seconds, if parse succeeded.

Returns Whether the parse succeeded or not.

[protected] void VCalFormat::populate(VObject *vcal)

Takes a vCalendar tree of VObjects, and puts all of them that have the "event" property into the dictionary, todos in the todo-list, etc.

vcal points to the vCalendar tree of VObjects

[protected] QString VCalFormat::qDateTimeToISO(const QDateTime &date, bool zulu = true)

Takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS.

date is the date to format.

zulu if true, then shift the date to UTC.

[protected] QString VCalFormat::qDateToISO(const QDate &date)

Takes a QDate and returns a string in the format YYYYMMDDTHHMMSS.

date is the date to format.

[protected] KCalendarCore::Attendee::PartStat VCalFormat::readStatus(const char *s) const

Converts a status string into an Attendee::PartStat.

s is a null-terminated character string containing the status to convert.

Returns a valid Attendee::PartStat. If the string provided is empty, null, or the contents are unrecognized, then Attendee::NeedsAction is returned.

[override virtual] bool VCalFormat::save(const KCalendarCore::Calendar::Ptr &calendar, const QString &fileName)

Reimplements: CalFormat::save(const KCalendarCore::Calendar::Ptr &calendar, const QString &fileName).

[override virtual] QString VCalFormat::toString(const KCalendarCore::Calendar::Ptr &calendar)

Reimplements: CalFormat::toString(const KCalendarCore::Calendar::Ptr &calendar).

[protected] QByteArray VCalFormat::writeStatus(KCalendarCore::Attendee::PartStat status) const

Converts an Attendee::PartStat into a QByteArray string.

status is the Attendee::PartStat to convert.

Returns a QByteArray containing the status string.