42 #include <KLocalizedString> 44 #include <KSystemTimeZone> 47 using namespace Stringify;
53 return i18nc(
"@item incidence type is event",
"event");
55 return i18nc(
"@item incidence type is to-do/task",
"to-do");
57 return i18nc(
"@item incidence type is journal",
"journal");
59 return i18nc(
"@item incidence type is freebusy",
"free/busy");
68 return KGlobal::locale()->formatDateTime(todo->completed().dateTime(),
69 (shortfmt ? KLocale::ShortDate :
77 return i18nc(
"@item incidence access if for everyone",
"Public");
79 return i18nc(
"@item incidence access is by owner only",
"Private");
81 return i18nc(
"@item incidence access is by owner and a controlled group",
"Confidential");
101 return i18nc(
"@item event is tentative",
"Tentative");
103 return i18nc(
"@item event is definite",
"Confirmed");
105 return i18nc(
"@item to-do is complete",
"Completed");
107 return i18nc(
"@item to-do needs action",
"Needs-Action");
109 return i18nc(
"@item event orto-do is canceled; journal is removed",
"Canceled");
111 return i18nc(
"@item to-do is in process",
"In-Process");
113 return i18nc(
"@item journal is in draft form",
"Draft");
115 return i18nc(
"@item journal is in final form",
"Final");
123 QString Stringify::incidenceStatus(
const Incidence::Ptr &incidence)
126 return incidence->customStatus();
128 return incidenceStatus(incidence->status());
136 return i18nc(
"@item chairperson",
"Chair");
140 return i18nc(
"@item participation is required",
"Participant");
143 return i18nc(
"@item participation is optional",
"Optional Participant");
146 return i18nc(
"@item non-participant copied for information",
"Observer");
151 QStringList Stringify::attendeeRoleList()
167 return i18nc(
"@item event, to-do or journal needs action",
"Needs Action");
170 return i18nc(
"@item event, to-do or journal accepted",
"Accepted");
173 return i18nc(
"@item event, to-do or journal declined",
"Declined");
176 return i18nc(
"@item event or to-do tentatively accepted",
"Tentative");
179 return i18nc(
"@item event or to-do delegated",
"Delegated");
182 return i18nc(
"@item to-do completed",
"Completed");
185 return i18nc(
"@item to-do in process of being completed",
"In Process");
188 return i18nc(
"@item event or to-do status unknown",
"Unknown");
193 QStringList Stringify::attendeeStatusList()
209 if (spec.isValid()) {
212 if (spec.timeZone() != KSystemTimeZones::local()) {
213 timeZone = QLatin1Char(
' ') + spec.timeZone().name();
216 return KGlobal::locale()->formatTime(dt.toTimeSpec(spec).time(), !shortfmt) + timeZone;
218 return KGlobal::locale()->formatTime(dt.time(), !shortfmt);
224 if (spec.isValid()) {
227 if (spec.timeZone() != KSystemTimeZones::local()) {
228 timeZone = QLatin1Char(
' ') + spec.timeZone().name();
232 KGlobal::locale()->formatDate(dt.toTimeSpec(spec).date(),
233 (shortfmt ? KLocale::ShortDate : KLocale::LongDate)) +
237 KGlobal::locale()->formatDate(dt.date(),
238 (shortfmt ? KLocale::ShortDate : KLocale::LongDate));
243 bool shortfmt,
const KDateTime::Spec &spec)
249 if (spec.isValid()) {
251 if (spec.timeZone() != KSystemTimeZones::local()) {
252 timeZone = QLatin1Char(
' ') + spec.timeZone().name();
255 return KGlobal::locale()->formatDateTime(
256 dt.toTimeSpec(spec).dateTime(),
257 (shortfmt ? KLocale::ShortDate : KLocale::LongDate)) + timeZone;
259 return KGlobal::locale()->formatDateTime(
261 (shortfmt ? KLocale::ShortDate : KLocale::LongDate));
269 switch (exception.
code()) {
271 message = i18nc(
"@item",
"Load Error");
274 message = i18nc(
"@item",
"Save Error");
277 message = i18nc(
"@item",
"Parse Error in libical");
280 message = i18nc(
"@item",
"Parse Error in the kcalcore library");
283 message = i18nc(
"@item",
"No calendar component found.");
286 message = i18nc(
"@item",
"Expected iCalendar, got vCalendar format");
289 message = i18nc(
"@item",
"iCalendar Version 2.0 detected.");
292 message = i18nc(
"@item",
"Expected iCalendar, got unknown format");
295 message = i18nc(
"@item",
"Restriction violation");
298 message = i18nc(
"@item",
"No writable resource found");
300 case Exception::SaveErrorOpenFile:
301 Q_ASSERT(exception.
arguments().count() == 1);
302 message = i18nc(
"@item",
"Error saving to '%1'.", exception.
arguments()[0]);
304 case Exception::SaveErrorSaveFile:
305 Q_ASSERT(exception.
arguments().count() == 1);
306 message = i18nc(
"@item",
"Could not save '%1'", exception.
arguments()[0]);
308 case Exception::LibICalError:
309 message = i18nc(
"@item",
"libical error");
311 case Exception::VersionPropertyMissing:
312 message = i18nc(
"@item",
"No VERSION property found");
314 case Exception::ExpectedCalVersion2:
315 message = i18nc(
"@item",
"Expected iCalendar, got vCalendar format");
317 case Exception::ExpectedCalVersion2Unknown:
318 message = i18nc(
"@item",
"Expected iCalendar, got unknown format");
320 case Exception::ParseErrorNotIncidence:
321 message = i18nc(
"@item",
"object is not a freebusy, event, todo or journal");
323 case Exception::ParseErrorEmptyMessage:
324 message = i18nc(
"@item",
"messageText is empty, unable to parse into a ScheduleMessage");
326 case Exception::ParseErrorUnableToParse:
327 message = i18nc(
"@item",
"icalparser is unable to parse messageText into a ScheduleMessage");
329 case Exception::ParseErrorMethodProperty:
330 message = i18nc(
"@item",
"message does not contain ICAL_METHOD_PROPERTY");
345 return i18nc(
"@item this is a new scheduling message",
346 "New Scheduling Message");
348 return i18nc(
"@item this is an update to an existing scheduling message",
349 "Updated Scheduling Message");
351 return i18nc(
"@item obsolete status",
"Obsolete");
353 return i18nc(
"@item this is a request for a new scheduling message",
354 "New Scheduling Message Request");
356 return i18nc(
"@item this is a request for an update to an existing scheduling message",
357 "Updated Scheduling Message Request");
359 return i18nc(
"@item unknown status",
"Unknown Status: %1",
int(status));
367 return i18nc(
"@item incidence access if for everyone",
"Public");
369 return i18nc(
"@item incidence access is by owner only",
"Private");
371 return i18nc(
"@item incidence access is by owner and a controlled group",
"Confidential");
377 QStringList Stringify::secrecyList()
KCALUTILS_EXPORT QString formatDate(const KDateTime &dt, bool shortfmt=true, const KDateTime::Spec &spec=KDateTime::Spec())
Build a QString date representation of a KDateTime object.
KCALUTILS_EXPORT QString formatDateTime(const KDateTime &dt, bool dateOnly=false, bool shortfmt=true, const KDateTime::Spec &spec=KDateTime::Spec())
Build a QString date/time representation of a KDateTime object.
QSharedPointer< Incidence > Ptr
KCALUTILS_EXPORT QStringList incidenceSecrecyList()
Returns a list of all available Secrecy types as a list of translated strings.
virtual ErrorCode code() const
virtual QStringList arguments() const
This file is part of the API for handling calendar data and provides static functions for formatting ...
KCALUTILS_EXPORT QString errorMessage(const KCalCore::Exception &exception)
Build a translated message representing an exception.
KCALUTILS_EXPORT QString incidenceSecrecy(KCalCore::Incidence::Secrecy secrecy)
Returns the incidence Secrecy as translated string.
KCALUTILS_EXPORT QString todoCompletedDateTime(const KCalCore::Todo::Ptr &todo, bool shortfmt=false)
Returns string containing the date/time when the to-do was completed, formatted according to the user...
KCALUTILS_EXPORT QString formatTime(const KDateTime &dt, bool shortfmt=true, const KDateTime::Spec &spec=KDateTime::Spec())
Build a QString time representation of a KDateTime object.
QSharedPointer< Todo > Ptr