Changeset View
Changeset View
Standalone View
Standalone View
kcalutils/incidenceformatter.cpp
Show First 20 Lines • Show All 4,084 Lines • ▼ Show 20 Lines | QString IncidenceFormatter::recurrenceString(const Incidence::Ptr &incidence) | ||||
const KCalendarSystem *calSys = KGlobal::locale()->calendar(); | const KCalendarSystem *calSys = KGlobal::locale()->calendar(); | ||||
Recurrence *recur = incidence->recurrence(); | Recurrence *recur = incidence->recurrence(); | ||||
QString txt, recurStr; | QString txt, recurStr; | ||||
static QString noRecurrence = i18n("No recurrence"); | static QString noRecurrence = i18n("No recurrence"); | ||||
switch (recur->recurrenceType()) { | switch (recur->recurrenceType()) { | ||||
case Recurrence::rNone: | case Recurrence::rNone: | ||||
return noRecurrence; | break; | ||||
case Recurrence::rMinutely: | case Recurrence::rMinutely: | ||||
if (recur->duration() != -1) { | if (recur->duration() != -1) { | ||||
recurStr = i18np("Recurs every minute until %2", | recurStr = i18np("Recurs every minute until %2", | ||||
"Recurs every %1 minutes until %2", | "Recurs every %1 minutes until %2", | ||||
recur->frequency(), recurEnd(incidence)); | recur->frequency(), recurEnd(incidence)); | ||||
if (recur->duration() > 0) { | if (recur->duration() > 0) { | ||||
recurStr += i18nc("number of occurrences", | recurStr += i18nc("number of occurrences", | ||||
▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | QString IncidenceFormatter::recurrenceString(const Incidence::Ptr &incidence) | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
if (recurStr.isEmpty()) { | if (recurStr.isEmpty()) { | ||||
recurStr = i18n("Incidence recurs"); | recurStr = i18n("Incidence recurs"); | ||||
} | } | ||||
{ | |||||
DateTimeList l = recur->rDateTimes(); | |||||
DateList d = recur->rDates(); | |||||
DateTimeList::ConstIterator il; | |||||
DateList::ConstIterator dl; | |||||
QStringList rDateStr; | |||||
for (il = l.constBegin(); il != l.constEnd(); ++il) { | |||||
rDateStr << KGlobal::locale()->formatDate((*il).date(), KLocale::ShortDate); | |||||
} | |||||
for (dl = d.constBegin(); dl != d.constEnd(); ++dl) { | |||||
rDateStr << KGlobal::locale()->formatDate((*dl), KLocale::ShortDate); | |||||
} | |||||
if (!rDateStr.isEmpty()) { | |||||
recurStr = i18n("%1 on %2", recurStr, rDateStr.join(QLatin1String(", "))); | |||||
} | |||||
} | |||||
// Now, append the EXDATEs | // Now, append the EXDATEs | ||||
DateTimeList l = recur->exDateTimes(); | DateTimeList l = recur->exDateTimes(); | ||||
DateTimeList::ConstIterator il; | DateTimeList::ConstIterator il; | ||||
QStringList exStr; | QStringList exStr; | ||||
for (il = l.constBegin(); il != l.constEnd(); ++il) { | for (il = l.constBegin(); il != l.constEnd(); ++il) { | ||||
switch (recur->recurrenceType()) { | switch (recur->recurrenceType()) { | ||||
case Recurrence::rMinutely: | case Recurrence::rMinutely: | ||||
exStr << i18n("minute %1", (*il).time().minute()); | exStr << i18n("minute %1", (*il).time().minute()); | ||||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |