[PATCH 20/23] kcalendarsystem: Simplify weekday naming a lot.
Jon Severinsson
jon at severinsson.net
Fri Oct 12 15:13:55 UTC 2012
Weekday names depend on *lanuage*, not calendar system. The usual ki18nc
can handle it just fine, so consolidate it all to a single function.
---
kdecore/date/kcalendarsystem.cpp | 32 ---------
kdecore/date/kcalendarsystem.h | 7 +-
kdecore/date/kcalendarsystemcoptic.cpp | 77 ----------------------
kdecore/date/kcalendarsystemcoptic_p.h | 3 -
kdecore/date/kcalendarsystemcopticprivate_p.h | 1 -
kdecore/date/kcalendarsystemethiopian.cpp | 75 ---------------------
kdecore/date/kcalendarsystemethiopian_p.h | 3 -
kdecore/date/kcalendarsystemgregorian.cpp | 73 --------------------
kdecore/date/kcalendarsystemgregorian_p.h | 3 -
kdecore/date/kcalendarsystemgregorianprivate_p.h | 1 -
kdecore/date/kcalendarsystemhebrew.cpp | 77 ----------------------
kdecore/date/kcalendarsystemhebrew_p.h | 3 -
kdecore/date/kcalendarsystemindiannational.cpp | 74 ---------------------
kdecore/date/kcalendarsystemindiannational_p.h | 3 -
kdecore/date/kcalendarsystemislamiccivil.cpp | 74 ---------------------
kdecore/date/kcalendarsystemislamiccivil_p.h | 3 -
kdecore/date/kcalendarsystemjalali.cpp | 74 ---------------------
kdecore/date/kcalendarsystemjalali_p.h | 3 -
kdecore/date/kcalendarsystemjapanese.cpp | 10 ---
kdecore/date/kcalendarsystemjapanese_p.h | 3 -
kdecore/date/kcalendarsystemjulian.cpp | 74 ---------------------
kdecore/date/kcalendarsystemjulian_p.h | 3 -
kdecore/date/kcalendarsystemminguo.cpp | 10 ---
kdecore/date/kcalendarsystemminguo_p.h | 3 -
kdecore/date/kcalendarsystemprivate_p.h | 1 -
kdecore/date/kcalendarsystemqdate.cpp | 74 ---------------------
kdecore/date/kcalendarsystemqdate_p.h | 3 -
kdecore/date/kcalendarsystemweek.cpp | 63 ++++++++++++++++++
kdecore/tests/kcalendartest.cpp | 45 -------------
kdecore/tests/kcalendartest.h | 2 -
30 filer ändrade, 68 tillägg(+), 809 borttagningar(-)
diff --git a/kdecore/date/kcalendarsystem.cpp b/kdecore/date/kcalendarsystem.cpp
index 69f1494..13a656c 100644
--- a/kdecore/date/kcalendarsystem.cpp
+++ b/kdecore/date/kcalendarsystem.cpp
@@ -1201,38 +1201,6 @@ QString KCalendarSystem::monthName(const QDate &date, MonthNameFormat format) co
return QString();
}
-QString KCalendarSystem::weekDayName(int weekDay, KCalendarSystem::WeekDayNameFormat format) const
-{
- Q_D(const KCalendarSystem);
-
- if (weekDay < 1 || weekDay > 7) {
- return QString();
- }
-
- if (format == KCalendarSystem::NarrowDayName) {
- return d->weekDayName(weekDay, KLocale::NarrowName);
- }
-
- if (format == KCalendarSystem::ShortDayName) {
- return d->weekDayName(weekDay, KLocale::ShortName);
- }
-
- if (format == KCalendarSystem::ShortDayName) {
- return d->weekDayName(weekDay, KLocale::ShortName);
- }
-
- return d->weekDayName(weekDay, KLocale::LongName);
-}
-
-QString KCalendarSystem::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- if (isValid(date)) {
- return weekDayName(dayOfWeek(date), format);
- }
-
- return QString();
-}
-
QString KCalendarSystem::yearString(const QDate &date, StringFormat format) const
{
if (format == ShortFormat) {
diff --git a/kdecore/date/kcalendarsystem.h b/kdecore/date/kcalendarsystem.h
index 1635a68..3bac854 100644
--- a/kdecore/date/kcalendarsystem.h
+++ b/kdecore/date/kcalendarsystem.h
@@ -673,7 +673,7 @@ public:
* @param format specifies whether the short month name or long month name should be used
* @return day name, empty string if any error
*/
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const = 0;
+ QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
/**
* Gets specific calendar type week day name.
@@ -682,7 +682,10 @@ public:
* @param format specifies whether the short month name or long month name should be used
* @return day name, empty string if any error
*/
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
+ inline QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const
+ {
+ return isValid(date) ? weekDayName(dayOfWeek(date), format) : QString();
+ }
/**
* @deprecated use formatDate(QDate, KLocale::DateTimeComponent, KLocale::DateTimeComponentFormat)
diff --git a/kdecore/date/kcalendarsystemcoptic.cpp b/kdecore/date/kcalendarsystemcoptic.cpp
index 707802c..d06b5a9 100644
--- a/kdecore/date/kcalendarsystemcoptic.cpp
+++ b/kdecore/date/kcalendarsystemcoptic.cpp
@@ -310,72 +310,6 @@ QString KCalendarSystemCopticPrivate::monthName(int month, int year, KLocale::Da
}
}
-// Names taken from from the Sahidic dialect transliterations used in Dershowitz & Reingold which went out of use in the 11th centuary
-// Boharic or Arabic transliterations would be preferred but none could be found
-QString KCalendarSystemCopticPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Coptic weekday 1 - KLocale::NarrowName", "P").toString(locale());
- case 2:
- return ki18nc("Coptic weekday 2 - KLocale::NarrowName", "P").toString(locale());
- case 3:
- return ki18nc("Coptic weekday 3 - KLocale::NarrowName", "P").toString(locale());
- case 4:
- return ki18nc("Coptic weekday 4 - KLocale::NarrowName", "P").toString(locale());
- case 5:
- return ki18nc("Coptic weekday 5 - KLocale::NarrowName", "P").toString(locale());
- case 6:
- return ki18nc("Coptic weekday 6 - KLocale::NarrowName", "P").toString(locale());
- case 7:
- return ki18nc("Coptic weekday 7 - KLocale::NarrowName", "T").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Coptic weekday 1 - KLocale::ShortName", "Pes").toString(locale());
- case 2:
- return ki18nc("Coptic weekday 2 - KLocale::ShortName", "Psh").toString(locale());
- case 3:
- return ki18nc("Coptic weekday 3 - KLocale::ShortName", "Pef").toString(locale());
- case 4:
- return ki18nc("Coptic weekday 4 - KLocale::ShortName", "Pti").toString(locale());
- case 5:
- return ki18nc("Coptic weekday 5 - KLocale::ShortName", "Pso").toString(locale());
- case 6:
- return ki18nc("Coptic weekday 6 - KLocale::ShortName", "Psa").toString(locale());
- case 7:
- return ki18nc("Coptic weekday 7 - KLocale::ShortName", "Tky").toString(locale());
- default:
- return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Coptic weekday 1 - KLocale::LongName", "Pesnau").toString(locale());
- case 2:
- return ki18nc("Coptic weekday 2 - KLocale::LongName", "Pshoment").toString(locale());
- case 3:
- return ki18nc("Coptic weekday 3 - KLocale::LongName", "Peftoou").toString(locale());
- case 4:
- return ki18nc("Coptic weekday 4 - KLocale::LongName", "Ptiou").toString(locale());
- case 5:
- return ki18nc("Coptic weekday 5 - KLocale::LongName", "Psoou").toString(locale());
- case 6:
- return ki18nc("Coptic weekday 6 - KLocale::LongName", "Psabbaton").toString(locale());
- case 7:
- return ki18nc("Coptic weekday 7 - KLocale::LongName", "Tkyriakē").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemCoptic::KCalendarSystemCoptic(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemCopticPrivate(this), config, locale)
@@ -446,17 +380,6 @@ QString KCalendarSystemCoptic::monthName(const QDate &date, MonthNameFormat form
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemCoptic::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemCoptic::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
-
bool KCalendarSystemCoptic::isLunar() const
{
return false;
diff --git a/kdecore/date/kcalendarsystemcoptic_p.h b/kdecore/date/kcalendarsystemcoptic_p.h
index c6488cd..a660f6c 100644
--- a/kdecore/date/kcalendarsystemcoptic_p.h
+++ b/kdecore/date/kcalendarsystemcoptic_p.h
@@ -53,9 +53,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemcopticprivate_p.h b/kdecore/date/kcalendarsystemcopticprivate_p.h
index 8ceb5ad..ded0436 100644
--- a/kdecore/date/kcalendarsystemcopticprivate_p.h
+++ b/kdecore/date/kcalendarsystemcopticprivate_p.h
@@ -41,7 +41,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
};
#endif // KCALENDARSYSTEMCOPTICPRIVATE_H
diff --git a/kdecore/date/kcalendarsystemethiopian.cpp b/kdecore/date/kcalendarsystemethiopian.cpp
index 5d37e16..b0fb07e 100644
--- a/kdecore/date/kcalendarsystemethiopian.cpp
+++ b/kdecore/date/kcalendarsystemethiopian.cpp
@@ -38,7 +38,6 @@ public:
virtual void loadDefaultEraList();
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
};
void KCalendarSystemEthiopianPrivate::loadDefaultEraList()
@@ -221,70 +220,6 @@ QString KCalendarSystemEthiopianPrivate::monthName(int month, int year, KLocale:
}
}
-// Names taken from http://www.ethiopianembassy.at/dates_cycles.htm, alternative transliterations exist
-QString KCalendarSystemEthiopianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Ethiopian weekday 1 - KLocale::NarrowName ", "S").toString(locale());
- case 2:
- return ki18nc("Ethiopian weekday 2 - KLocale::NarrowName ", "M").toString(locale());
- case 3:
- return ki18nc("Ethiopian weekday 3 - KLocale::NarrowName ", "R").toString(locale());
- case 4:
- return ki18nc("Ethiopian weekday 4 - KLocale::NarrowName ", "H").toString(locale());
- case 5:
- return ki18nc("Ethiopian weekday 5 - KLocale::NarrowName ", "A").toString(locale());
- case 6:
- return ki18nc("Ethiopian weekday 6 - KLocale::NarrowName ", "Q").toString(locale());
- case 7:
- return ki18nc("Ethiopian weekday 7 - KLocale::NarrowName ", "E").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Ethiopian weekday 1 - KLocale::ShortName", "Seg").toString(locale());
- case 2:
- return ki18nc("Ethiopian weekday 2 - KLocale::ShortName", "Mak").toString(locale());
- case 3:
- return ki18nc("Ethiopian weekday 3 - KLocale::ShortName", "Rob").toString(locale());
- case 4:
- return ki18nc("Ethiopian weekday 4 - KLocale::ShortName", "Ham").toString(locale());
- case 5:
- return ki18nc("Ethiopian weekday 5 - KLocale::ShortName", "Arb").toString(locale());
- case 6:
- return ki18nc("Ethiopian weekday 6 - KLocale::ShortName", "Qed").toString(locale());
- case 7:
- return ki18nc("Ethiopian weekday 7 - KLocale::ShortName", "Ehu").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Ethiopian weekday 1 - KLocale::LongName", "Segno").toString(locale());
- case 2:
- return ki18nc("Ethiopian weekday 2 - KLocale::LongName", "Maksegno").toString(locale());
- case 3:
- return ki18nc("Ethiopian weekday 3 - KLocale::LongName", "Rob").toString(locale());
- case 4:
- return ki18nc("Ethiopian weekday 4 - KLocale::LongName", "Hamus").toString(locale());
- case 5:
- return ki18nc("Ethiopian weekday 5 - KLocale::LongName", "Arb").toString(locale());
- case 6:
- return ki18nc("Ethiopian weekday 6 - KLocale::LongName", "Qedame").toString(locale());
- case 7:
- return ki18nc("Ethiopian weekday 7 - KLocale::LongName", "Ehud").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemEthiopian::KCalendarSystemEthiopian(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystemCoptic(*new KCalendarSystemEthiopianPrivate(this), config, locale)
@@ -355,16 +290,6 @@ QString KCalendarSystemEthiopian::monthName(const QDate &date, MonthNameFormat f
return KCalendarSystemCoptic::monthName(date, format);
}
-QString KCalendarSystemEthiopian::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystemCoptic::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemEthiopian::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystemCoptic::weekDayName(date, format);
-}
-
bool KCalendarSystemEthiopian::isLunar() const
{
return KCalendarSystemCoptic::isLunar();
diff --git a/kdecore/date/kcalendarsystemethiopian_p.h b/kdecore/date/kcalendarsystemethiopian_p.h
index 9020b8d..e5d769f 100644
--- a/kdecore/date/kcalendarsystemethiopian_p.h
+++ b/kdecore/date/kcalendarsystemethiopian_p.h
@@ -54,9 +54,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemgregorian.cpp b/kdecore/date/kcalendarsystemgregorian.cpp
index 7a9e4b4..ef60ee9 100644
--- a/kdecore/date/kcalendarsystemgregorian.cpp
+++ b/kdecore/date/kcalendarsystemgregorian.cpp
@@ -305,69 +305,6 @@ QString KCalendarSystemGregorianPrivate::monthName(int month, int year, KLocale:
}
}
-QString KCalendarSystemGregorianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemGregorian::KCalendarSystemGregorian(const KSharedConfig::Ptr config,
const KLocale *locale)
@@ -437,16 +374,6 @@ QString KCalendarSystemGregorian::monthName(const QDate &date, MonthNameFormat f
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemGregorian::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemGregorian::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
int KCalendarSystemGregorian::yearStringToInteger(const QString &sNum, int &iLength) const
{
return KCalendarSystem::yearStringToInteger(sNum, iLength);
diff --git a/kdecore/date/kcalendarsystemgregorian_p.h b/kdecore/date/kcalendarsystemgregorian_p.h
index 51414ad..e289f7e 100644
--- a/kdecore/date/kcalendarsystemgregorian_p.h
+++ b/kdecore/date/kcalendarsystemgregorian_p.h
@@ -58,9 +58,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual int yearStringToInteger(const QString &sNum, int &iLength) const;
virtual bool isLunar() const;
diff --git a/kdecore/date/kcalendarsystemgregorianprivate_p.h b/kdecore/date/kcalendarsystemgregorianprivate_p.h
index 1208fe9..80408b7 100644
--- a/kdecore/date/kcalendarsystemgregorianprivate_p.h
+++ b/kdecore/date/kcalendarsystemgregorianprivate_p.h
@@ -43,7 +43,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
bool m_useCommonEra;
};
diff --git a/kdecore/date/kcalendarsystemhebrew.cpp b/kdecore/date/kcalendarsystemhebrew.cpp
index 0c0c5c4..8685bcf 100644
--- a/kdecore/date/kcalendarsystemhebrew.cpp
+++ b/kdecore/date/kcalendarsystemhebrew.cpp
@@ -254,7 +254,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
virtual int integerFromString(const QString &string, int maxLength, int &readLength) const;
virtual QString stringFromInteger(int number, int padWidth = 0, QChar padChar = QLatin1Char('0')) const;
@@ -791,72 +790,6 @@ QString KCalendarSystemHebrewPrivate::monthName(int month, int year, KLocale::Da
}
}
-// Use Western day names for now as that's what the old version did,
-// but wouldn't it be better to use the right Hebrew names like Shabbat?
-// Could make it switchable by adding new enums to WeekDayFormat, e.g. ShortNameWestern?
-QString KCalendarSystemHebrewPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemHebrew::KCalendarSystemHebrew(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemHebrewPrivate(this), config, locale)
@@ -925,16 +858,6 @@ QString KCalendarSystemHebrew::monthName(const QDate &date, MonthNameFormat form
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemHebrew::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemHebrew::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
int KCalendarSystemHebrew::yearStringToInteger(const QString &string, int &readLength) const
{
int result = KCalendarSystem::yearStringToInteger(string, readLength);
diff --git a/kdecore/date/kcalendarsystemhebrew_p.h b/kdecore/date/kcalendarsystemhebrew_p.h
index 6362388..19e640a 100644
--- a/kdecore/date/kcalendarsystemhebrew_p.h
+++ b/kdecore/date/kcalendarsystemhebrew_p.h
@@ -57,9 +57,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual int yearStringToInteger(const QString &sNum, int &iLength) const;
virtual bool isLunar() const;
diff --git a/kdecore/date/kcalendarsystemindiannational.cpp b/kdecore/date/kcalendarsystemindiannational.cpp
index f51aa15..7a4016a 100644
--- a/kdecore/date/kcalendarsystemindiannational.cpp
+++ b/kdecore/date/kcalendarsystemindiannational.cpp
@@ -45,7 +45,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
};
// Shared d pointer base class definitions
@@ -305,69 +304,6 @@ QString KCalendarSystemIndianNationalPrivate::monthName(int month, int year, KLo
}
}
-QString KCalendarSystemIndianNationalPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Indian National weekday 1 - KLocale::NarrowName ", "S").toString(locale());
- case 2:
- return ki18nc("Indian National weekday 2 - KLocale::NarrowName ", "M").toString(locale());
- case 3:
- return ki18nc("Indian National weekday 3 - KLocale::NarrowName ", "B").toString(locale());
- case 4:
- return ki18nc("Indian National weekday 4 - KLocale::NarrowName ", "G").toString(locale());
- case 5:
- return ki18nc("Indian National weekday 5 - KLocale::NarrowName ", "S").toString(locale());
- case 6:
- return ki18nc("Indian National weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Indian National weekday 7 - KLocale::NarrowName ", "R").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Indian National weekday 1 - KLocale::ShortName", "Som").toString(locale());
- case 2:
- return ki18nc("Indian National weekday 2 - KLocale::ShortName", "Mañ").toString(locale());
- case 3:
- return ki18nc("Indian National weekday 3 - KLocale::ShortName", "Bud").toString(locale());
- case 4:
- return ki18nc("Indian National weekday 4 - KLocale::ShortName", "Gur").toString(locale());
- case 5:
- return ki18nc("Indian National weekday 5 - KLocale::ShortName", "Suk").toString(locale());
- case 6:
- return ki18nc("Indian National weekday 6 - KLocale::ShortName", "San").toString(locale());
- case 7:
- return ki18nc("Indian National weekday 7 - KLocale::ShortName", "Rav").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Indian National weekday 1 - KLocale::LongName", "Somavãra").toString(locale());
- case 2:
- return ki18nc("Indian National weekday 2 - KLocale::LongName", "Mañgalvã").toString(locale());
- case 3:
- return ki18nc("Indian National weekday 3 - KLocale::LongName", "Budhavãra").toString(locale());
- case 4:
- return ki18nc("Indian National weekday 4 - KLocale::LongName", "Guruvãra").toString(locale());
- case 5:
- return ki18nc("Indian National weekday 5 - KLocale::LongName", "Sukravãra").toString(locale());
- case 6:
- return ki18nc("Indian National weekday 6 - KLocale::LongName", "Sanivãra").toString(locale());
- case 7:
- return ki18nc("Indian National weekday 7 - KLocale::LongName", "Raviãra").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemIndianNational::KCalendarSystemIndianNational(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemIndianNationalPrivate(this), config, locale)
@@ -440,16 +376,6 @@ QString KCalendarSystemIndianNational::monthName(const QDate &date, MonthNameFor
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemIndianNational::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemIndianNational::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
bool KCalendarSystemIndianNational::isLunar() const
{
return false;
diff --git a/kdecore/date/kcalendarsystemindiannational_p.h b/kdecore/date/kcalendarsystemindiannational_p.h
index 8635b64..504e607 100644
--- a/kdecore/date/kcalendarsystemindiannational_p.h
+++ b/kdecore/date/kcalendarsystemindiannational_p.h
@@ -57,9 +57,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemislamiccivil.cpp b/kdecore/date/kcalendarsystemislamiccivil.cpp
index 2ec717a..26e8c99 100644
--- a/kdecore/date/kcalendarsystemislamiccivil.cpp
+++ b/kdecore/date/kcalendarsystemislamiccivil.cpp
@@ -43,7 +43,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
};
// Shared d pointer base class definitions
@@ -311,69 +310,6 @@ QString KCalendarSystemIslamicCivilPrivate::monthName(int month, int year, KLoca
}
}
-QString KCalendarSystemIslamicCivilPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Hijri weekday 1 - KLocale::NarrowName ", "I").toString(locale());
- case 2:
- return ki18nc("Hijri weekday 2 - KLocale::NarrowName ", "T").toString(locale());
- case 3:
- return ki18nc("Hijri weekday 3 - KLocale::NarrowName ", "A").toString(locale());
- case 4:
- return ki18nc("Hijri weekday 4 - KLocale::NarrowName ", "K").toString(locale());
- case 5:
- return ki18nc("Hijri weekday 5 - KLocale::NarrowName ", "J").toString(locale());
- case 6:
- return ki18nc("Hijri weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Hijri weekday 7 - KLocale::NarrowName ", "A").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Hijri weekday 1 - KLocale::ShortName", "Ith").toString(locale());
- case 2:
- return ki18nc("Hijri weekday 2 - KLocale::ShortName", "Thl").toString(locale());
- case 3:
- return ki18nc("Hijri weekday 3 - KLocale::ShortName", "Arb").toString(locale());
- case 4:
- return ki18nc("Hijri weekday 4 - KLocale::ShortName", "Kha").toString(locale());
- case 5:
- return ki18nc("Hijri weekday 5 - KLocale::ShortName", "Jum").toString(locale());
- case 6:
- return ki18nc("Hijri weekday 6 - KLocale::ShortName", "Sab").toString(locale());
- case 7:
- return ki18nc("Hijri weekday 7 - KLocale::ShortName", "Ahd").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Hijri weekday 1 - KLocale::LongName", "Yaum al-Ithnain").toString(locale());
- case 2:
- return ki18nc("Hijri weekday 2 - KLocale::LongName", "Yau al-Thulatha").toString(locale());
- case 3:
- return ki18nc("Hijri weekday 3 - KLocale::LongName", "Yaum al-Arbi'a").toString(locale());
- case 4:
- return ki18nc("Hijri weekday 4 - KLocale::LongName", "Yaum al-Khamees").toString(locale());
- case 5:
- return ki18nc("Hijri weekday 5 - KLocale::LongName", "Yaum al-Jumma").toString(locale());
- case 6:
- return ki18nc("Hijri weekday 6 - KLocale::LongName", "Yaum al-Sabt").toString(locale());
- case 7:
- return ki18nc("Hijri weekday 7 - KLocale::LongName", "Yaum al-Ahad").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemIslamicCivil::KCalendarSystemIslamicCivil(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemIslamicCivilPrivate(this), config, locale)
@@ -440,16 +376,6 @@ QString KCalendarSystemIslamicCivil::monthName(const QDate &date, MonthNameForma
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemIslamicCivil::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemIslamicCivil::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
bool KCalendarSystemIslamicCivil::isLunar() const
{
return true;
diff --git a/kdecore/date/kcalendarsystemislamiccivil_p.h b/kdecore/date/kcalendarsystemislamiccivil_p.h
index 87f22f4..0fff81a 100644
--- a/kdecore/date/kcalendarsystemislamiccivil_p.h
+++ b/kdecore/date/kcalendarsystemislamiccivil_p.h
@@ -59,9 +59,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemjalali.cpp b/kdecore/date/kcalendarsystemjalali.cpp
index 1b505b4..9775056 100644
--- a/kdecore/date/kcalendarsystemjalali.cpp
+++ b/kdecore/date/kcalendarsystemjalali.cpp
@@ -51,7 +51,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
};
// Shared d pointer base class definitions
@@ -317,69 +316,6 @@ QString KCalendarSystemJalaliPrivate::monthName(int month, int year, KLocale::Da
}
}
-QString KCalendarSystemJalaliPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Jalali weekday 1 - KLocale::NarrowName ", "2").toString(locale());
- case 2:
- return ki18nc("Jalali weekday 2 - KLocale::NarrowName ", "3").toString(locale());
- case 3:
- return ki18nc("Jalali weekday 3 - KLocale::NarrowName ", "4").toString(locale());
- case 4:
- return ki18nc("Jalali weekday 4 - KLocale::NarrowName ", "5").toString(locale());
- case 5:
- return ki18nc("Jalali weekday 5 - KLocale::NarrowName ", "J").toString(locale());
- case 6:
- return ki18nc("Jalali weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Jalali weekday 7 - KLocale::NarrowName ", "1").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Jalali weekday 1 - KLocale::ShortName", "2sh").toString(locale());
- case 2:
- return ki18nc("Jalali weekday 2 - KLocale::ShortName", "3sh").toString(locale());
- case 3:
- return ki18nc("Jalali weekday 3 - KLocale::ShortName", "4sh").toString(locale());
- case 4:
- return ki18nc("Jalali weekday 4 - KLocale::ShortName", "5sh").toString(locale());
- case 5:
- return ki18nc("Jalali weekday 5 - KLocale::ShortName", "Jom").toString(locale());
- case 6:
- return ki18nc("Jalali weekday 6 - KLocale::ShortName", "Shn").toString(locale());
- case 7:
- return ki18nc("Jalali weekday 7 - KLocale::ShortName", "1sh").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Jalali weekday 1 - KLocale::LongName", "Do shanbe").toString(locale());
- case 2:
- return ki18nc("Jalali weekday 2 - KLocale::LongName", "Se shanbe").toString(locale());
- case 3:
- return ki18nc("Jalali weekday 3 - KLocale::LongName", "Chahar shanbe").toString(locale());
- case 4:
- return ki18nc("Jalali weekday 4 - KLocale::LongName", "Panj shanbe").toString(locale());
- case 5:
- return ki18nc("Jalali weekday 5 - KLocale::LongName", "Jumee").toString(locale());
- case 6:
- return ki18nc("Jalali weekday 6 - KLocale::LongName", "Shanbe").toString(locale());
- case 7:
- return ki18nc("Jalali weekday 7 - KLocale::LongName", "Yek-shanbe").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemJalali::KCalendarSystemJalali(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemJalaliPrivate(this), config, locale)
@@ -448,16 +384,6 @@ QString KCalendarSystemJalali::monthName(const QDate &date, MonthNameFormat form
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemJalali::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemJalali::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
bool KCalendarSystemJalali::isLunar() const
{
return false;
diff --git a/kdecore/date/kcalendarsystemjalali_p.h b/kdecore/date/kcalendarsystemjalali_p.h
index 5a0dc7f..5c6f6a2 100644
--- a/kdecore/date/kcalendarsystemjalali_p.h
+++ b/kdecore/date/kcalendarsystemjalali_p.h
@@ -48,9 +48,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemjapanese.cpp b/kdecore/date/kcalendarsystemjapanese.cpp
index 144d7ae..3a0d8e7 100644
--- a/kdecore/date/kcalendarsystemjapanese.cpp
+++ b/kdecore/date/kcalendarsystemjapanese.cpp
@@ -160,16 +160,6 @@ QString KCalendarSystemJapanese::monthName(const QDate &date, MonthNameFormat fo
return KCalendarSystemGregorian::monthName(date, format);
}
-QString KCalendarSystemJapanese::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystemGregorian::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemJapanese::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystemGregorian::weekDayName(date, format);
-}
-
int KCalendarSystemJapanese::yearStringToInteger(const QString &sNum, int &iLength) const
{
QString gannen = i18nc("Japanese year 1 of era", "Gannen");
diff --git a/kdecore/date/kcalendarsystemjapanese_p.h b/kdecore/date/kcalendarsystemjapanese_p.h
index d1ad504..2e2f126 100644
--- a/kdecore/date/kcalendarsystemjapanese_p.h
+++ b/kdecore/date/kcalendarsystemjapanese_p.h
@@ -54,9 +54,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual int yearStringToInteger(const QString &sNum, int &iLength) const;
virtual bool isLunar() const;
diff --git a/kdecore/date/kcalendarsystemjulian.cpp b/kdecore/date/kcalendarsystemjulian.cpp
index 14282e2..e9a8d2c 100644
--- a/kdecore/date/kcalendarsystemjulian.cpp
+++ b/kdecore/date/kcalendarsystemjulian.cpp
@@ -46,7 +46,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
bool m_useCommonEra;
};
@@ -319,69 +318,6 @@ QString KCalendarSystemJulianPrivate::monthName(int month, int year, KLocale::Da
}
}
-QString KCalendarSystemJulianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Julian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
- case 2:
- return ki18nc("Julian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
- case 3:
- return ki18nc("Julian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
- case 4:
- return ki18nc("Julian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
- case 5:
- return ki18nc("Julian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
- case 6:
- return ki18nc("Julian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Julian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Julian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
- case 2:
- return ki18nc("Julian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
- case 3:
- return ki18nc("Julian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
- case 4:
- return ki18nc("Julian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
- case 5:
- return ki18nc("Julian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
- case 6:
- return ki18nc("Julian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
- case 7:
- return ki18nc("Julian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Julian weekday 1 - KLocale::LongName", "Monday").toString(locale());
- case 2:
- return ki18nc("Julian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
- case 3:
- return ki18nc("Julian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
- case 4:
- return ki18nc("Julian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
- case 5:
- return ki18nc("Julian weekday 5 - KLocale::LongName", "Friday").toString(locale());
- case 6:
- return ki18nc("Julian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
- case 7:
- return ki18nc("Julian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemJulian::KCalendarSystemJulian(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemJulianPrivate(this), config, locale)
@@ -449,16 +385,6 @@ QString KCalendarSystemJulian::monthName(const QDate &date, MonthNameFormat form
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemJulian::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemJulian::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
bool KCalendarSystemJulian::isLunar() const
{
return false;
diff --git a/kdecore/date/kcalendarsystemjulian_p.h b/kdecore/date/kcalendarsystemjulian_p.h
index 93c9b8d..6ebe11a 100644
--- a/kdecore/date/kcalendarsystemjulian_p.h
+++ b/kdecore/date/kcalendarsystemjulian_p.h
@@ -57,9 +57,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemminguo.cpp b/kdecore/date/kcalendarsystemminguo.cpp
index 68a23e1..477d090 100644
--- a/kdecore/date/kcalendarsystemminguo.cpp
+++ b/kdecore/date/kcalendarsystemminguo.cpp
@@ -134,16 +134,6 @@ QString KCalendarSystemMinguo::monthName(const QDate &date, MonthNameFormat form
return KCalendarSystemGregorian::monthName(date, format);
}
-QString KCalendarSystemMinguo::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystemGregorian::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemMinguo::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystemGregorian::weekDayName(date, format);
-}
-
bool KCalendarSystemMinguo::isLunar() const
{
return KCalendarSystemGregorian::isLunar();
diff --git a/kdecore/date/kcalendarsystemminguo_p.h b/kdecore/date/kcalendarsystemminguo_p.h
index 497d835..d259f12 100644
--- a/kdecore/date/kcalendarsystemminguo_p.h
+++ b/kdecore/date/kcalendarsystemminguo_p.h
@@ -54,9 +54,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemprivate_p.h b/kdecore/date/kcalendarsystemprivate_p.h
index 683817b..c6c41e0 100644
--- a/kdecore/date/kcalendarsystemprivate_p.h
+++ b/kdecore/date/kcalendarsystemprivate_p.h
@@ -47,7 +47,6 @@ public:
virtual int earliestValidYear() const = 0;
virtual int latestValidYear() const = 0;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive = false) const = 0;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const = 0;
// Virtual methods to re-implement if special maths needed
// Currently only Hebrew may need special conversion, rest should be OK
diff --git a/kdecore/date/kcalendarsystemqdate.cpp b/kdecore/date/kcalendarsystemqdate.cpp
index 215e538..3e5631a 100644
--- a/kdecore/date/kcalendarsystemqdate.cpp
+++ b/kdecore/date/kcalendarsystemqdate.cpp
@@ -51,7 +51,6 @@ public:
virtual int earliestValidYear() const;
virtual int latestValidYear() const;
virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const;
- virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const;
bool m_useCommonEra;
};
@@ -305,69 +304,6 @@ QString KCalendarSystemQDatePrivate::monthName(int month, int year, KLocale::Dat
}
}
-QString KCalendarSystemQDatePrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
-{
- if (format == KLocale::NarrowName) {
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale());
- default:
- return QString();
- }
- }
-
- if (format == KLocale::ShortName || format == KLocale:: ShortNumber) {
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale());
- default: return QString();
- }
- }
-
- switch (weekDay) {
- case 1:
- return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale());
- case 2:
- return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
- case 3:
- return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
- case 4:
- return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale());
- case 5:
- return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale());
- case 6:
- return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale());
- case 7:
- return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale());
- default:
- return QString();
- }
-}
-
KCalendarSystemQDate::KCalendarSystemQDate(const KSharedConfig::Ptr config, const KLocale *locale)
: KCalendarSystem(*new KCalendarSystemQDatePrivate(this), config, locale)
@@ -466,16 +402,6 @@ QString KCalendarSystemQDate::monthName(const QDate &date, MonthNameFormat forma
return KCalendarSystem::monthName(date, format);
}
-QString KCalendarSystemQDate::weekDayName(int weekDay, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(weekDay, format);
-}
-
-QString KCalendarSystemQDate::weekDayName(const QDate &date, WeekDayNameFormat format) const
-{
- return KCalendarSystem::weekDayName(date, format);
-}
-
bool KCalendarSystemQDate::isLunar() const
{
return false;
diff --git a/kdecore/date/kcalendarsystemqdate_p.h b/kdecore/date/kcalendarsystemqdate_p.h
index fb10a0a..55afe5a 100644
--- a/kdecore/date/kcalendarsystemqdate_p.h
+++ b/kdecore/date/kcalendarsystemqdate_p.h
@@ -66,9 +66,6 @@ public:
virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const;
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const;
- virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
- virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
-
virtual bool isLunar() const;
virtual bool isLunisolar() const;
virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemweek.cpp b/kdecore/date/kcalendarsystemweek.cpp
index ba7fff4..4f21ffe 100644
--- a/kdecore/date/kcalendarsystemweek.cpp
+++ b/kdecore/date/kcalendarsystemweek.cpp
@@ -252,3 +252,66 @@ bool KCalendarSystem::setDateIsoWeek(QDate &date, int year, int isoWeekNumber, i
return false;
}
+
+QString KCalendarSystem::weekDayName(int weekDay, WeekDayNameFormat format) const
+{
+ if (format == NarrowDayName) {
+ switch (weekDay) {
+ case 1:
+ return ki18nc("Weekday 1 - KLocale::NarrowName ", "M").toString(locale());
+ case 2:
+ return ki18nc("Weekday 2 - KLocale::NarrowName ", "T").toString(locale());
+ case 3:
+ return ki18nc("Weekday 3 - KLocale::NarrowName ", "W").toString(locale());
+ case 4:
+ return ki18nc("Weekday 4 - KLocale::NarrowName ", "T").toString(locale());
+ case 5:
+ return ki18nc("Weekday 5 - KLocale::NarrowName ", "F").toString(locale());
+ case 6:
+ return ki18nc("Weekday 6 - KLocale::NarrowName ", "S").toString(locale());
+ case 7:
+ return ki18nc("Weekday 7 - KLocale::NarrowName ", "S").toString(locale());
+ default:
+ return QString();
+ }
+ }
+
+ if (format == ShortDayName) {
+ switch (weekDay) {
+ case 1:
+ return ki18nc("Weekday 1 - KLocale::ShortName", "Mon").toString(locale());
+ case 2:
+ return ki18nc("Weekday 2 - KLocale::ShortName", "Tue").toString(locale());
+ case 3:
+ return ki18nc("Weekday 3 - KLocale::ShortName", "Wed").toString(locale());
+ case 4:
+ return ki18nc("Weekday 4 - KLocale::ShortName", "Thu").toString(locale());
+ case 5:
+ return ki18nc("Weekday 5 - KLocale::ShortName", "Fri").toString(locale());
+ case 6:
+ return ki18nc("Weekday 6 - KLocale::ShortName", "Sat").toString(locale());
+ case 7:
+ return ki18nc("Weekday 7 - KLocale::ShortName", "Sun").toString(locale());
+ default: return QString();
+ }
+ }
+
+ switch (weekDay) {
+ case 1:
+ return ki18nc("Weekday 1 - KLocale::LongName", "Monday").toString(locale());
+ case 2:
+ return ki18nc("Weekday 2 - KLocale::LongName", "Tuesday").toString(locale());
+ case 3:
+ return ki18nc("Weekday 3 - KLocale::LongName", "Wednesday").toString(locale());
+ case 4:
+ return ki18nc("Weekday 4 - KLocale::LongName", "Thursday").toString(locale());
+ case 5:
+ return ki18nc("Weekday 5 - KLocale::LongName", "Friday").toString(locale());
+ case 6:
+ return ki18nc("Weekday 6 - KLocale::LongName", "Saturday").toString(locale());
+ case 7:
+ return ki18nc("Weekday 7 - KLocale::LongName", "Sunday").toString(locale());
+ default:
+ return QString();
+ }
+}
diff --git a/kdecore/tests/kcalendartest.cpp b/kdecore/tests/kcalendartest.cpp
index 4baae5f..099e475 100644
--- a/kdecore/tests/kcalendartest.cpp
+++ b/kdecore/tests/kcalendartest.cpp
@@ -1309,8 +1309,6 @@ void KCalendarTest::testQDateCalendarBasic()
testEraDate(calendar, QDate(2005, 1, 1), 2005, "2005", "2005", "AD", "Anno Domini");
testEraDate(calendar, QDate(-5, 1, 1), 5, "5", "0005", "BC", "Before Christ");
-
- testWeekDayName(calendar, 6, QDate(2007, 7, 28), "S", "Sat", "Saturday");
testMonthName(calendar, 12, 2007, QDate(2007, 12, 20), "D", "Dec", "December", "of Dec", "of December");
QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
@@ -1391,8 +1389,6 @@ void KCalendarTest::testGregorianBasic()
testEraDate(calendar, QDate(2005, 1, 1), 2005, "2005", "2005", "AD", "Anno Domini");
testEraDate(calendar, QDate(-5, 1, 3), 5, "5", "0005", "BC", "Before Christ");
-
- testWeekDayName(calendar, 6, QDate(2007, 7, 28), "S", "Sat", "Saturday");
testMonthName(calendar, 12, 2007, QDate(2007, 12, 20), "D", "Dec", "December", "of Dec", "of December");
QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
@@ -1445,8 +1441,6 @@ void KCalendarTest::testHebrewBasic()
testDay(calendar, testDate, 1, "1", "01");
testEraDate(calendar, testDate, 5707, "5707", "5707", "AM", "Anno Mundi");
-
- testWeekDayName(calendar, 4, testDate, "T", "Thu", "Thursday");
testMonthName(calendar, 1, 5707, testDate, "T", "Tis", "Tishrey", "of Tis", "of Tishrey");
QCOMPARE(calendar->isProleptic(), false);
@@ -1519,8 +1513,6 @@ void KCalendarTest::testIslamicCivilBasic()
testDay(calendar, testDate, 6, "6", "06");
testEraDate(calendar, testDate, 1426, "1426", "1426", "AH", "Anno Hegirae");
-
- testWeekDayName(calendar, 6, testDate, "S", "Sab", "Yaum al-Sabt");
testMonthName(calendar, 12, 1428, QDate(2007, 12, 20), "H", "Hij", "Thu al-Hijjah", "of Hij", "of Thu al-Hijjah");
QCOMPARE(calendar->monthsInYear(testDate), 12);
@@ -1575,8 +1567,6 @@ void KCalendarTest::testJalaliBasic()
testDay(calendar, testDate, 9, "9", "09");
testEraDate(calendar, testDate, 1384, "1384", "1384", "AP", "Anno Persico");
-
- testWeekDayName(calendar, 3, testDate, "4", "4sh", "Chahar shanbe");
testMonthName(calendar, 6, 1384, testDate, "S", "Sha", "Shahrivar", "of Sha", "of Shahrivar");
QCOMPARE(calendar->monthsInYear(testDate), 12);
@@ -1663,8 +1653,6 @@ void KCalendarTest::testJapaneseBasic()
testDay(calendar, testDate, 9, "9", "09");
testEraDate(calendar, testDate, 19, "19", "0019", "Heisei", "Heisei");
-
- testWeekDayName(calendar, 6, QDate(2007, 7, 28), "S", "Sat", "Saturday");
testMonthName(calendar, 12, 2007, QDate(2007, 12, 20), "D", "Dec", "December", "of Dec", "of December");
QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
@@ -1758,8 +1746,6 @@ void KCalendarTest::testMinguoBasic()
testDay(calendar, QDate(2007, 7, 9), 9, QString("9"), QString("09"));
testEraDate(calendar, QDate(2007, 1, 1), 2007 - 1911, "96", "0096", "ROC", "Republic of China Era");
-
- testWeekDayName(calendar, 6, QDate(2007, 7, 28), "S", "Sat", "Saturday");
testMonthName(calendar, 12, 2007 - 1911, QDate(2007, 12, 20), "D", "Dec", "December", "of Dec", "of December");
QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
@@ -1804,8 +1790,6 @@ void KCalendarTest::testThaiBasic()
testDay(calendar, QDate(2007, 7, 9), 9, QString("9"), QString("09"));
testEraDate(calendar, QDate(2007, 1, 1), 2007 + 543, "2550", "2550", "BE", "Buddhist Era");
-
- testWeekDayName(calendar, 6, QDate(2007, 7, 28), "S", "Sat", "Saturday");
testMonthName(calendar, 12, 2007 + 543, QDate(2007, 12, 20), "D", "Dec", "December", "of Dec", "of December");
QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
@@ -1932,35 +1916,6 @@ void KCalendarTest::testEraDate(const KCalendarSystem *calendar, const QDate &da
QCOMPARE(calendar->eraName(date, KCalendarSystem::LongFormat), longEraName);
}
-// Pass in the week day number, the equivalent QDate, and the short and long day names
-// e.g. testWeekDayName( cal, 6, QDate(y,m,d), QString("Monday"), QString("Mon") )
-
-void KCalendarTest::testWeekDayName(const KCalendarSystem *calendar, int weekDay, const QDate &date,
- const QString &narrowName, const QString & shortName, const QString & longName)
-{
- QCOMPARE(calendar->weekDayName(weekDay, KCalendarSystem::ShortDayName), shortName);
- QCOMPARE(calendar->weekDayName(weekDay, KCalendarSystem::LongDayName), longName);
- QCOMPARE(calendar->weekDayName(weekDay), longName);
-
- // Test week day < min
- QCOMPARE(calendar->weekDayName(0, KCalendarSystem::ShortDayName), QString());
- QCOMPARE(calendar->weekDayName(0, KCalendarSystem::LongDayName), QString());
-
- // Test week day > max
- QCOMPARE(calendar->weekDayName(calendar->daysInWeek(date) + 1, KCalendarSystem::ShortDayName), QString());
- QCOMPARE(calendar->weekDayName(calendar->daysInWeek(date) + 1, KCalendarSystem::LongDayName), QString());
-
- // QDate parameter tests, so always in valid range
- QCOMPARE(calendar->weekDayName(date, KCalendarSystem::ShortDayName), shortName);
- QCOMPARE(calendar->weekDayName(date, KCalendarSystem::LongDayName), longName);
- QCOMPARE(calendar->weekDayName(date), longName);
-
- // Test format date componant
- QCOMPARE(calendar->formatDate(date, KLocale::DayOfWeekName, KLocale::NarrowName), narrowName);
- QCOMPARE(calendar->formatDate(date, KLocale::DayOfWeekName, KLocale::ShortName), shortName);
- QCOMPARE(calendar->formatDate(date, KLocale::DayOfWeekName, KLocale::LongName), longName);
-}
-
void KCalendarTest::testMonthName(const KCalendarSystem *calendar, int month, int year, const QDate &date,
const QString &narrowName, const QString &shortName, const QString &longName,
const QString &shortNamePossessive, const QString &longNamePossessive)
diff --git a/kdecore/tests/kcalendartest.h b/kdecore/tests/kcalendartest.h
index ba0c7bb..ecedf7a 100644
--- a/kdecore/tests/kcalendartest.h
+++ b/kdecore/tests/kcalendartest.h
@@ -53,8 +53,6 @@ protected:
int yearInEra, const QString &shortYearInEraString, const QString &longYearInEraString,
const QString &shortEraName, const QString &longEraName);
void testYmd(const KCalendarSystem *calendar, int y, int m, int d, int jd);
- void testWeekDayName(const KCalendarSystem *calendar, int weekDay, const QDate &date,
- const QString &narrowName, const QString &shortName, const QString &longName);
void testMonthName(const KCalendarSystem *calendar, int month, int year, const QDate &date,
const QString &narrowName, const QString &shortName, const QString &longName,
const QString &shortNamePossessive, const QString &longNamePossessive);
--
1.7.10.4
More information about the Kde-frameworks-devel
mailing list