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 300 Lines • ▼ Show 20 Lines | for (dl = d.constBegin(); dl != d.constEnd(); ++dl) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (!exStr.isEmpty()) { | if (!exStr.isEmpty()) { | ||||
recurStr = i18n("%1 (excluding %2)", recurStr, exStr.join(QLatin1String(","))); | recurStr = i18n("%1 (excluding %2)", recurStr, exStr.join(QLatin1String(","))); | ||||
} | } | ||||
l = recur->rDateTimes(); | |||||
QStringList rDateStr; | |||||
for (il = l.constBegin(); il != l.constEnd(); ++il) { | |||||
rDateStr << KGlobal::locale()->formatDate((*il).date(), KLocale::ShortDate); | |||||
} | |||||
d = recur->rDates(); | |||||
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(", "))); | |||||
} | |||||
return recurStr; | return recurStr; | ||||
} | } | ||||
QString IncidenceFormatter::timeToString(const KDateTime &date, | QString IncidenceFormatter::timeToString(const KDateTime &date, | ||||
bool shortfmt, | bool shortfmt, | ||||
const KDateTime::Spec &spec) | const KDateTime::Spec &spec) | ||||
{ | { | ||||
kDebug() << date; | kDebug() << date; | ||||
▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines |