39using namespace KCalCore;
42#include <KLocalizedString>
44#include <KSystemTimeZone>
46using namespace KCalUtils;
47using namespace Stringify;
52 case Incidence::TypeEvent:
53 return i18nc(
"@item incidence type is event",
"event");
54 case Incidence::TypeTodo:
55 return i18nc(
"@item incidence type is to-do/task",
"to-do");
56 case Incidence::TypeJournal:
57 return i18nc(
"@item incidence type is journal",
"journal");
58 case Incidence::TypeFreeBusy:
59 return i18nc(
"@item incidence type is freebusy",
"free/busy");
68 return KGlobal::locale()->formatDateTime(todo->completed().dateTime(),
69 (shortfmt ? KLocale::ShortDate :
76 case Incidence::SecrecyPublic:
77 return i18nc(
"@item incidence access if for everyone",
"Public");
78 case Incidence::SecrecyPrivate:
79 return i18nc(
"@item incidence access is by owner only",
"Private");
80 case Incidence::SecrecyConfidential:
81 return i18nc(
"@item incidence access is by owner and a controlled group",
"Confidential");
100 case Incidence::StatusTentative:
101 return i18nc(
"@item event is tentative",
"Tentative");
102 case Incidence::StatusConfirmed:
103 return i18nc(
"@item event is definite",
"Confirmed");
104 case Incidence::StatusCompleted:
105 return i18nc(
"@item to-do is complete",
"Completed");
106 case Incidence::StatusNeedsAction:
107 return i18nc(
"@item to-do needs action",
"Needs-Action");
108 case Incidence::StatusCanceled:
109 return i18nc(
"@item event orto-do is canceled; journal is removed",
"Canceled");
110 case Incidence::StatusInProcess:
111 return i18nc(
"@item to-do is in process",
"In-Process");
112 case Incidence::StatusDraft:
113 return i18nc(
"@item journal is in draft form",
"Draft");
114 case Incidence::StatusFinal:
115 return i18nc(
"@item journal is in final form",
"Final");
116 case Incidence::StatusX:
117 case Incidence::StatusNone:
123QString Stringify::incidenceStatus(
const Incidence::Ptr &incidence)
125 if (incidence->status() == Incidence::StatusX) {
126 return incidence->customStatus();
128 return incidenceStatus(incidence->status());
135 case Attendee::Chair:
136 return i18nc(
"@item chairperson",
"Chair");
139 case Attendee::ReqParticipant:
140 return i18nc(
"@item participation is required",
"Participant");
142 case Attendee::OptParticipant:
143 return i18nc(
"@item participation is optional",
"Optional Participant");
145 case Attendee::NonParticipant:
146 return i18nc(
"@item non-participant copied for information",
"Observer");
151QStringList Stringify::attendeeRoleList()
154 list << attendeeRole(Attendee::ReqParticipant);
155 list << attendeeRole(Attendee::OptParticipant);
156 list << attendeeRole(Attendee::NonParticipant);
157 list << attendeeRole(Attendee::Chair);
166 case Attendee::NeedsAction:
167 return i18nc(
"@item event, to-do or journal needs action",
"Needs Action");
169 case Attendee::Accepted:
170 return i18nc(
"@item event, to-do or journal accepted",
"Accepted");
172 case Attendee::Declined:
173 return i18nc(
"@item event, to-do or journal declined",
"Declined");
175 case Attendee::Tentative:
176 return i18nc(
"@item event or to-do tentatively accepted",
"Tentative");
178 case Attendee::Delegated:
179 return i18nc(
"@item event or to-do delegated",
"Delegated");
181 case Attendee::Completed:
182 return i18nc(
"@item to-do completed",
"Completed");
184 case Attendee::InProcess:
185 return i18nc(
"@item to-do in process of being completed",
"In Process");
188 return i18nc(
"@item event or to-do status unknown",
"Unknown");
193QStringList Stringify::attendeeStatusList()
196 list << attendeeStatus(Attendee::NeedsAction);
197 list << attendeeStatus(Attendee::Accepted);
198 list << attendeeStatus(Attendee::Declined);
199 list << attendeeStatus(Attendee::Tentative);
200 list << attendeeStatus(Attendee::Delegated);
201 list << attendeeStatus(Attendee::Completed);
202 list << attendeeStatus(Attendee::InProcess);
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()) {
270 case Exception::LoadError:
271 message = i18nc(
"@item",
"Load Error");
273 case Exception::SaveError:
274 message = i18nc(
"@item",
"Save Error");
276 case Exception::ParseErrorIcal:
277 message = i18nc(
"@item",
"Parse Error in libical");
279 case Exception::ParseErrorKcal:
280 message = i18nc(
"@item",
"Parse Error in the kcalcore library");
282 case Exception::NoCalendar:
283 message = i18nc(
"@item",
"No calendar component found.");
285 case Exception::CalVersion1:
286 message = i18nc(
"@item",
"Expected iCalendar, got vCalendar format");
288 case Exception::CalVersion2:
289 message = i18nc(
"@item",
"iCalendar Version 2.0 detected.");
291 case Exception::CalVersionUnknown:
292 message = i18nc(
"@item",
"Expected iCalendar, got unknown format");
294 case Exception::Restriction:
295 message = i18nc(
"@item",
"Restriction violation");
297 case Exception::NoWritableFound:
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");
332 case Exception::UserCancel:
344 case ScheduleMessage::PublishNew:
345 return i18nc(
"@item this is a new scheduling message",
346 "New Scheduling Message");
347 case ScheduleMessage::PublishUpdate:
348 return i18nc(
"@item this is an update to an existing scheduling message",
349 "Updated Scheduling Message");
350 case ScheduleMessage::Obsolete:
351 return i18nc(
"@item obsolete status",
"Obsolete");
352 case ScheduleMessage::RequestNew:
353 return i18nc(
"@item this is a request for a new scheduling message",
354 "New Scheduling Message Request");
355 case ScheduleMessage::RequestUpdate:
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));
366 case Incidence::SecrecyPublic:
367 return i18nc(
"@item incidence access if for everyone",
"Public");
368 case Incidence::SecrecyPrivate:
369 return i18nc(
"@item incidence access is by owner only",
"Private");
370 case Incidence::SecrecyConfidential:
371 return i18nc(
"@item incidence access is by owner and a controlled group",
"Confidential");
377QStringList Stringify::secrecyList()
380 list << secrecyName(Incidence::SecrecyPublic);
381 list << secrecyName(Incidence::SecrecyPrivate);
382 list << secrecyName(Incidence::SecrecyConfidential);
virtual QStringList arguments() const
virtual ErrorCode code() const
QSharedPointer< Incidence > Ptr
QSharedPointer< Todo > Ptr
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.
KCALUTILS_EXPORT QString errorMessage(const KCalCore::Exception &exception)
Build a translated message representing an exception.
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 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 incidenceSecrecy(KCalCore::Incidence::Secrecy secrecy)
Returns the incidence Secrecy as translated string.
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.
KCALUTILS_EXPORT QStringList incidenceSecrecyList()
Returns a list of all available Secrecy types as a list of translated strings.
This file is part of the API for handling calendar data and provides static functions for formatting ...