aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2017-04-10 21:39:57 +0200
committerVolker Krause <[email protected]>2017-04-10 21:39:57 +0200
commit5a0928b03ab934ab6a36fb37168131489043f6e5 (patch)
treed2368132f8569b9965f004aa5ec288df2d932f8b
parent98c0a6c9cc2db34f55dc00be18b9637abf24c585 (diff)
Remove a bunch of duplicated and/or unused methods from Stringify
-rw-r--r--src/htmlexport.cpp7
-rw-r--r--src/stringify.cpp107
-rw-r--r--src/stringify.h39
3 files changed, 4 insertions, 149 deletions
diff --git a/src/htmlexport.cpp b/src/htmlexport.cpp
index d97e577..4c4b9bd 100644
--- a/src/htmlexport.cpp
+++ b/src/htmlexport.cpp
@@ -22,6 +22,7 @@
#include "htmlexport.h"
#include "htmlexportsettings.h"
#include "stringify.h"
+#include "incidenceformatter.h"
#include <kcalcore/memorycalendar.h>
using namespace KCalCore;
@@ -312,14 +313,14 @@ void HtmlExport::createEvent(QTextStream *ts,
*ts << " <td>&nbsp;</td>" << endl;
} else {
*ts << " <td valign=\"top\">"
- << Stringify::formatTime(event->dtStart(), true, d->mCalendar->timeSpec())
+ << IncidenceFormatter::timeToString(event->dtStart(), true, d->mCalendar->timeSpec())
<< "</td>" << endl;
}
if (event->isMultiDay(d->mCalendar->timeSpec()) && (event->dtEnd().date() != date)) {
*ts << " <td>&nbsp;</td>" << endl;
} else {
*ts << " <td valign=\"top\">"
- << Stringify::formatTime(event->dtEnd(), true, d->mCalendar->timeSpec())
+ << IncidenceFormatter::timeToString(event->dtEnd(), true, d->mCalendar->timeSpec())
<< "</td>" << endl;
}
} else {
@@ -522,7 +523,7 @@ void HtmlExport::createTodo(QTextStream *ts, const Todo::Ptr &todo)
}
*ts << ">" << endl;
if (todo->hasDueDate()) {
- *ts << " " << Stringify::formatDate(todo->dtDue(true)) << endl;
+ *ts << " " << IncidenceFormatter::dateToString(todo->dtDue(true)) << endl;
} else {
*ts << " &nbsp;" << endl;
}
diff --git a/src/stringify.cpp b/src/stringify.cpp
index 48987e7..ebe6a3d 100644
--- a/src/stringify.cpp
+++ b/src/stringify.cpp
@@ -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)
{
switch (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 message;
@@ -358,27 +275,3 @@ QString Stringify::scheduleMessageStatus(ScheduleMessage::Status 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;
-}
diff --git a/src/stringify.h b/src/stringify.h
index bca0a07..0970423 100644
--- a/src/stringify.h
+++ b/src/stringify.h
@@ -79,52 +79,13 @@ KCALUTILS_EXPORT QString todoCompletedDateTime(const KCalCore::Todo::Ptr &todo,
bool shortfmt = false);
KCALUTILS_EXPORT QString attendeeRole(KCalCore::Attendee::Role role);
-KCALUTILS_EXPORT QStringList attendeeRoleList();
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
*/
KCALUTILS_EXPORT QString errorMessage(const KCalCore::Exception &exception);
-KCALUTILS_EXPORT QString secrecyName(KCalCore::Incidence::Secrecy secrecy);
-
-KCALUTILS_EXPORT QStringList secrecyList();
-
} // namespace Stringify
} //namespace KCalUtils