Commit 5a0928b0 authored by Volker Krause's avatar Volker Krause

Remove a bunch of duplicated and/or unused methods from Stringify

parent 98c0a6c9
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "htmlexport.h" #include "htmlexport.h"
#include "htmlexportsettings.h" #include "htmlexportsettings.h"
#include "stringify.h" #include "stringify.h"
#include "incidenceformatter.h"
#include <kcalcore/memorycalendar.h> #include <kcalcore/memorycalendar.h>
using namespace KCalCore; using namespace KCalCore;
...@@ -312,14 +313,14 @@ void HtmlExport::createEvent(QTextStream *ts, ...@@ -312,14 +313,14 @@ void HtmlExport::createEvent(QTextStream *ts,
*ts << " <td>&nbsp;</td>" << endl; *ts << " <td>&nbsp;</td>" << endl;
} else { } else {
*ts << " <td valign=\"top\">" *ts << " <td valign=\"top\">"
<< Stringify::formatTime(event->dtStart(), true, d->mCalendar->timeSpec()) << IncidenceFormatter::timeToString(event->dtStart(), true, d->mCalendar->timeSpec())
<< "</td>" << endl; << "</td>" << endl;
} }
if (event->isMultiDay(d->mCalendar->timeSpec()) && (event->dtEnd().date() != date)) { if (event->isMultiDay(d->mCalendar->timeSpec()) && (event->dtEnd().date() != date)) {
*ts << " <td>&nbsp;</td>" << endl; *ts << " <td>&nbsp;</td>" << endl;
} else { } else {
*ts << " <td valign=\"top\">" *ts << " <td valign=\"top\">"
<< Stringify::formatTime(event->dtEnd(), true, d->mCalendar->timeSpec()) << IncidenceFormatter::timeToString(event->dtEnd(), true, d->mCalendar->timeSpec())
<< "</td>" << endl; << "</td>" << endl;
} }
} else { } else {
...@@ -522,7 +523,7 @@ void HtmlExport::createTodo(QTextStream *ts, const Todo::Ptr &todo) ...@@ -522,7 +523,7 @@ void HtmlExport::createTodo(QTextStream *ts, const Todo::Ptr &todo)
} }
*ts << ">" << endl; *ts << ">" << endl;
if (todo->hasDueDate()) { if (todo->hasDueDate()) {
*ts << " " << Stringify::formatDate(todo->dtDue(true)) << endl; *ts << " " << IncidenceFormatter::dateToString(todo->dtDue(true)) << endl;
} else { } else {
*ts << " &nbsp;" << endl; *ts << " &nbsp;" << endl;
} }
......
...@@ -147,17 +147,6 @@ QString Stringify::attendeeRole(Attendee::Role role) ...@@ -147,17 +147,6 @@ QString Stringify::attendeeRole(Attendee::Role role)
} }
} }
QStringList Stringify::attendeeRoleList()
{
QStringList list;
list << attendeeRole(Attendee::ReqParticipant);
list << attendeeRole(Attendee::OptParticipant);
list << attendeeRole(Attendee::NonParticipant);
list << attendeeRole(Attendee::Chair);
return list;
}
QString Stringify::attendeeStatus(Attendee::PartStat status) QString Stringify::attendeeStatus(Attendee::PartStat status)
{ {
switch (status) { switch (status) {
...@@ -189,78 +178,6 @@ QString Stringify::attendeeStatus(Attendee::PartStat status) ...@@ -189,78 +178,6 @@ QString Stringify::attendeeStatus(Attendee::PartStat status)
} }
} }
QStringList Stringify::attendeeStatusList()
{
QStringList list;
list << attendeeStatus(Attendee::NeedsAction);
list << attendeeStatus(Attendee::Accepted);
list << attendeeStatus(Attendee::Declined);
list << attendeeStatus(Attendee::Tentative);
list << attendeeStatus(Attendee::Delegated);
list << attendeeStatus(Attendee::Completed);
list << attendeeStatus(Attendee::InProcess);
return list;
}
QString Stringify::formatTime(const KDateTime &dt, bool shortfmt, const KDateTime::Spec &spec)
{
if (spec.isValid()) {
QString timeZone;
if (spec.timeZone() != KSystemTimeZones::local()) {
timeZone = QLatin1Char(' ') + spec.timeZone().name();
}
return QLocale().toString(dt.toTimeSpec(spec).time(), shortfmt ? QLocale::ShortFormat : QLocale::LongFormat) + timeZone;
} else {
return QLocale().toString(dt.time(), shortfmt ? QLocale::ShortFormat : QLocale::LongFormat);
}
}
QString Stringify::formatDate(const KDateTime &dt, bool shortfmt, const KDateTime::Spec &spec)
{
if (spec.isValid()) {
QString timeZone;
if (spec.timeZone() != KSystemTimeZones::local()) {
timeZone = QLatin1Char(' ') + spec.timeZone().name();
}
return
QLocale().toString(dt.toTimeSpec(spec).date(),
(shortfmt ? QLocale::ShortFormat : QLocale::LongFormat)) +
timeZone;
} else {
return
QLocale().toString(dt.date(),
(shortfmt ? QLocale::ShortFormat : QLocale::LongFormat));
}
}
QString Stringify::formatDateTime(const KDateTime &dt, bool allDay,
bool shortfmt, const KDateTime::Spec &spec)
{
if (allDay) {
return formatDate(dt, shortfmt, spec);
}
if (spec.isValid()) {
QString timeZone;
if (spec.timeZone() != KSystemTimeZones::local()) {
timeZone = QLatin1Char(' ') + spec.timeZone().name();
}
return QLocale().toString(
dt.toTimeSpec(spec).dateTime(),
(shortfmt ? QLocale::ShortFormat : QLocale::LongFormat)) + timeZone;
} else {
return QLocale().toString(
dt.dateTime(),
(shortfmt ? QLocale::ShortFormat : QLocale::LongFormat));
}
}
QString Stringify::errorMessage(const Exception &exception) QString Stringify::errorMessage(const Exception &exception)
{ {
QString message; QString message;
...@@ -358,27 +275,3 @@ QString Stringify::scheduleMessageStatus(ScheduleMessage::Status status) ...@@ -358,27 +275,3 @@ QString Stringify::scheduleMessageStatus(ScheduleMessage::Status status)
return i18nc("@item unknown status", "Unknown Status: %1", int(status)); return i18nc("@item unknown status", "Unknown Status: %1", int(status));
} }
} }
QString Stringify::secrecyName(Incidence::Secrecy secrecy)
{
switch (secrecy) {
case Incidence::SecrecyPublic:
return i18nc("@item incidence access if for everyone", "Public");
case Incidence::SecrecyPrivate:
return i18nc("@item incidence access is by owner only", "Private");
case Incidence::SecrecyConfidential:
return i18nc("@item incidence access is by owner and a controlled group", "Confidential");
default:
return QString(); // to make compilers happy
}
}
QStringList Stringify::secrecyList()
{
QStringList list;
list << secrecyName(Incidence::SecrecyPublic);
list << secrecyName(Incidence::SecrecyPrivate);
list << secrecyName(Incidence::SecrecyConfidential);
return list;
}
...@@ -79,52 +79,13 @@ KCALUTILS_EXPORT QString todoCompletedDateTime(const KCalCore::Todo::Ptr &todo, ...@@ -79,52 +79,13 @@ KCALUTILS_EXPORT QString todoCompletedDateTime(const KCalCore::Todo::Ptr &todo,
bool shortfmt = false); bool shortfmt = false);
KCALUTILS_EXPORT QString attendeeRole(KCalCore::Attendee::Role role); KCALUTILS_EXPORT QString attendeeRole(KCalCore::Attendee::Role role);
KCALUTILS_EXPORT QStringList attendeeRoleList();
KCALUTILS_EXPORT QString attendeeStatus(KCalCore::Attendee::PartStat status); KCALUTILS_EXPORT QString attendeeStatus(KCalCore::Attendee::PartStat status);
KCALUTILS_EXPORT QStringList attendeeStatusList();
/**
Build a QString time representation of a KDateTime object.
@param date The date to be formatted.
@param shortfmt If true, display info in short format.
@param spec Time spec to use.
@see formatDate(), formatDateTime().
*/
KCALUTILS_EXPORT QString formatTime(const KDateTime &dt, bool shortfmt = true,
const KDateTime::Spec &spec = KDateTime::Spec());
/**
Build a QString date representation of a KDateTime object.
@param date The date to be formatted.
@param shortfmt If true, display info in short format.
@param spec Time spec to use.
@see formatDate(), formatDateTime().
*/
KCALUTILS_EXPORT QString formatDate(const KDateTime &dt, bool shortfmt = true,
const KDateTime::Spec &spec = KDateTime::Spec());
/**
Build a QString date/time representation of a KDateTime object.
@param date The date to be formatted.
@param dateOnly If true, don't print the time fields; print the date fields only.
@param shortfmt If true, display info in short format.
@param spec Time spec to use.
@see formatDate(), formatTime().
*/
KCALUTILS_EXPORT QString formatDateTime(const KDateTime &dt,
bool dateOnly = false,
bool shortfmt = true,
const KDateTime::Spec &spec = KDateTime::Spec());
/** /**
Build a translated message representing an exception Build a translated message representing an exception
*/ */
KCALUTILS_EXPORT QString errorMessage(const KCalCore::Exception &exception); KCALUTILS_EXPORT QString errorMessage(const KCalCore::Exception &exception);
KCALUTILS_EXPORT QString secrecyName(KCalCore::Incidence::Secrecy secrecy);
KCALUTILS_EXPORT QStringList secrecyList();
} // namespace Stringify } // namespace Stringify
} //namespace KCalUtils } //namespace KCalUtils
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment