39 using namespace KCalCore;
43 #include <KSystemTimeZone>
45 using namespace KCalUtils;
46 using namespace Stringify;
48 QString Stringify::incidenceType( Incidence::IncidenceType type )
51 case Incidence::TypeEvent:
52 return i18nc(
"@item incidence type is event",
"event" );
53 case Incidence::TypeTodo:
54 return i18nc(
"@item incidence type is to-do/task",
"to-do" );
55 case Incidence::TypeJournal:
56 return i18nc(
"@item incidence type is journal",
"journal" );
57 case Incidence::TypeFreeBusy:
58 return i18nc(
"@item incidence type is freebusy",
"free/busy" );
67 return KGlobal::locale()->formatDateTime( todo->completed().dateTime(),
68 ( shortfmt ? KLocale::ShortDate :
69 KLocale::LongDate ) );
75 case Incidence::SecrecyPublic:
76 return i18nc(
"@item incidence access if for everyone",
"Public" );
77 case Incidence::SecrecyPrivate:
78 return i18nc(
"@item incidence access is by owner only",
"Private" );
79 case Incidence::SecrecyConfidential:
80 return i18nc(
"@item incidence access is by owner and a controlled group",
"Confidential" );
96 QString Stringify::incidenceStatus( Incidence::Status status )
99 case Incidence::StatusTentative:
100 return i18nc(
"@item event is tentative",
"Tentative" );
101 case Incidence::StatusConfirmed:
102 return i18nc(
"@item event is definite",
"Confirmed" );
103 case Incidence::StatusCompleted:
104 return i18nc(
"@item to-do is complete",
"Completed" );
105 case Incidence::StatusNeedsAction:
106 return i18nc(
"@item to-do needs action",
"Needs-Action" );
107 case Incidence::StatusCanceled:
108 return i18nc(
"@item event orto-do is canceled; journal is removed",
"Canceled" );
109 case Incidence::StatusInProcess:
110 return i18nc(
"@item to-do is in process",
"In-Process" );
111 case Incidence::StatusDraft:
112 return i18nc(
"@item journal is in draft form",
"Draft" );
113 case Incidence::StatusFinal:
114 return i18nc(
"@item journal is in final form",
"Final" );
115 case Incidence::StatusX:
116 case Incidence::StatusNone:
122 QString Stringify::incidenceStatus(
const Incidence::Ptr &incidence )
124 if ( incidence->status() == Incidence::StatusX ) {
125 return incidence->customStatus();
127 return incidenceStatus( incidence->status() );
135 return i18nc(
"@item chairperson",
"Chair" );
139 return i18nc(
"@item participation is required",
"Participant" );
142 return i18nc(
"@item participation is optional",
"Optional Participant" );
145 return i18nc(
"@item non-participant copied for information",
"Observer" );
150 QStringList Stringify::attendeeRoleList()
166 return i18nc(
"@item event, to-do or journal needs action",
"Needs Action" );
169 return i18nc(
"@item event, to-do or journal accepted",
"Accepted" );
172 return i18nc(
"@item event, to-do or journal declined",
"Declined" );
175 return i18nc(
"@item event or to-do tentatively accepted",
"Tentative" );
178 return i18nc(
"@item event or to-do delegated",
"Delegated" );
181 return i18nc(
"@item to-do completed",
"Completed" );
184 return i18nc(
"@item to-do in process of being completed",
"In Process" );
187 return i18nc(
"@item event or to-do status unknown",
"Unknown" );
192 QStringList Stringify::attendeeStatusList()
208 if ( spec.isValid() ) {
211 if ( spec.timeZone() != KSystemTimeZones::local() ) {
212 timeZone =
' ' + spec.timeZone().name();
215 return KGlobal::locale()->formatTime( dt.toTimeSpec( spec ).time(), !shortfmt ) + timeZone;
217 return KGlobal::locale()->formatTime( dt.time(), !shortfmt );
223 if ( spec.isValid() ) {
226 if ( spec.timeZone() != KSystemTimeZones::local() ) {
227 timeZone =
' ' + spec.timeZone().name();
231 KGlobal::locale()->formatDate( dt.toTimeSpec( spec ).date(),
232 ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) ) +
236 KGlobal::locale()->formatDate( dt.date(),
237 ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
242 bool shortfmt,
const KDateTime::Spec &spec )
248 if ( spec.isValid() ) {
250 if ( spec.timeZone() != KSystemTimeZones::local() ) {
251 timeZone =
' ' + spec.timeZone().name();
254 return KGlobal::locale()->formatDateTime(
255 dt.toTimeSpec( spec ).dateTime(),
256 ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) ) + timeZone;
258 return KGlobal::locale()->formatDateTime(
260 ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
266 QString message =
"";
268 switch ( exception.
code() ) {
270 message = i18nc(
"@item",
"Load Error" );
273 message = i18nc(
"@item",
"Save Error" );
276 message = i18nc(
"@item",
"Parse Error in libical" );
279 message = i18nc(
"@item",
"Parse Error in the kcalcore library" );
282 message = i18nc(
"@item",
"No calendar component found." );
285 message = i18nc(
"@item",
"Expected iCalendar, got vCalendar format" );
288 message = i18nc(
"@item",
"iCalendar Version 2.0 detected." );
291 message = i18nc(
"@item",
"Expected iCalendar, got unknown format" );
294 message = i18nc(
"@item",
"Restriction violation" );
297 message = i18nc(
"@item",
"No writable resource found" );
300 Q_ASSERT( exception.
arguments().count() == 1 );
301 message = i18nc(
"@item",
"Error saving to '%1'.", exception.
arguments()[0] );
304 Q_ASSERT( exception.
arguments().count() == 1 );
305 message = i18nc(
"@item",
"Could not save '%1'", exception.
arguments()[0] );
308 message = i18nc(
"@item",
"libical error" );
311 message = i18nc(
"@item",
"No VERSION property found" );
314 message = i18nc(
"@item",
"Expected iCalendar, got vCalendar format" );
317 message = i18nc(
"@item",
"Expected iCalendar, got unknown format" );
320 message = i18nc(
"@item",
"object is not a freebusy, event, todo or journal" );
323 message = i18nc(
"@item",
"messageText is empty, unable to parse into a ScheduleMessage" );
326 message = i18nc(
"@item",
"icalparser is unable to parse messageText into a ScheduleMessage" );
329 message = i18nc(
"@item",
"message does not contain ICAL_METHOD_PROPERTY" );
344 return i18nc(
"@item this is a new scheduling message",
345 "New Scheduling Message" );
347 return i18nc(
"@item this is an update to an existing scheduling message",
348 "Updated Scheduling Message" );
350 return i18nc(
"@item obsolete status",
"Obsolete" );
352 return i18nc(
"@item this is a request for a new scheduling message",
353 "New Scheduling Message Request" );
355 return i18nc(
"@item this is a request for an update to an existing scheduling message",
356 "Updated Scheduling Message Request" );
358 return i18nc(
"@item unknown status",
"Unknown Status: %1",
int( status ) );
362 QString Stringify::secrecyName( Incidence::Secrecy secrecy )
365 case Incidence::SecrecyPublic:
366 return i18nc(
"@item incidence access if for everyone",
"Public" );
367 case Incidence::SecrecyPrivate:
368 return i18nc(
"@item incidence access is by owner only",
"Private" );
369 case Incidence::SecrecyConfidential:
370 return i18nc(
"@item incidence access is by owner and a controlled group",
"Confidential" );
376 QStringList Stringify::secrecyList()
379 list << secrecyName( Incidence::SecrecyPublic );
380 list << secrecyName( Incidence::SecrecyPrivate );
381 list << secrecyName( Incidence::SecrecyConfidential );