[PATCH 10/23] kcalendarsystem: Remove the deprecated weekDayOfPray() method.

Jon Severinsson jon at severinsson.net
Fri Oct 12 15:13:45 UTC 2012


It really don't belong in the calendar, and removing it lets us remove
some very bogous values for calendars not tied to an Abrahamitic religion.

Note that API remains as an depecated alias for KLocale::weekDayOfPray(),
which may return 0 for no cultural week day of prayer, which the existing
documentation allows, but no calendar system ever did.
---
 kdecore/date/kcalendarsystem.h                 |    5 ++++-
 kdecore/date/kcalendarsystemcoptic.cpp         |    4 ----
 kdecore/date/kcalendarsystemcoptic_p.h         |    2 --
 kdecore/date/kcalendarsystemethiopian.cpp      |    5 -----
 kdecore/date/kcalendarsystemethiopian_p.h      |    2 --
 kdecore/date/kcalendarsystemgregorian.cpp      |    5 -----
 kdecore/date/kcalendarsystemgregorian_p.h      |    2 --
 kdecore/date/kcalendarsystemhebrew.cpp         |    5 -----
 kdecore/date/kcalendarsystemhebrew_p.h         |    2 --
 kdecore/date/kcalendarsystemindiannational.cpp |    5 -----
 kdecore/date/kcalendarsystemindiannational_p.h |    2 --
 kdecore/date/kcalendarsystemislamiccivil.cpp   |    5 -----
 kdecore/date/kcalendarsystemislamiccivil_p.h   |    2 --
 kdecore/date/kcalendarsystemjalali.cpp         |    5 -----
 kdecore/date/kcalendarsystemjalali_p.h         |    2 --
 kdecore/date/kcalendarsystemjapanese.cpp       |    5 -----
 kdecore/date/kcalendarsystemjapanese_p.h       |    2 --
 kdecore/date/kcalendarsystemjulian.cpp         |    5 -----
 kdecore/date/kcalendarsystemjulian_p.h         |    2 --
 kdecore/date/kcalendarsystemminguo.cpp         |    5 -----
 kdecore/date/kcalendarsystemminguo_p.h         |    2 --
 kdecore/date/kcalendarsystemqdate.cpp          |    5 -----
 kdecore/date/kcalendarsystemqdate_p.h          |    2 --
 kdecore/date/kcalendarsystemthai.cpp           |    5 -----
 kdecore/date/kcalendarsystemthai_p.h           |    2 --
 kdecore/tests/kcalendartest.cpp                |    8 --------
 26 filer ändrade, 4 tillägg(+), 92 borttagningar(-)

diff --git a/kdecore/date/kcalendarsystem.h b/kdecore/date/kcalendarsystem.h
index 45f10a1..7987f35 100644
--- a/kdecore/date/kcalendarsystem.h
+++ b/kdecore/date/kcalendarsystem.h
@@ -1412,7 +1412,10 @@ public:
      *
      * @return day number (None = 0, Monday = 1, ..., Sunday = 7)
      */
-    KDECORE_DEPRECATED virtual int weekDayOfPray() const = 0;
+    KDECORE_DEPRECATED inline int weekDayOfPray() const
+    {
+        return locale()->weekDayOfPray();
+    }
 
     /**
      * Returns whether the calendar is lunar based.
diff --git a/kdecore/date/kcalendarsystemcoptic.cpp b/kdecore/date/kcalendarsystemcoptic.cpp
index c9a5b5a..7f57b76 100644
--- a/kdecore/date/kcalendarsystemcoptic.cpp
+++ b/kdecore/date/kcalendarsystemcoptic.cpp
@@ -476,10 +476,6 @@ QString KCalendarSystemCoptic::weekDayName(const QDate &date, WeekDayNameFormat
     return KCalendarSystem::weekDayName(date, format);
 }
 
-int KCalendarSystemCoptic::weekDayOfPray() const
-{
-    return 7;
-}
 
 bool KCalendarSystemCoptic::isLunar() const
 {
diff --git a/kdecore/date/kcalendarsystemcoptic_p.h b/kdecore/date/kcalendarsystemcoptic_p.h
index 3d38186..575a3d5 100644
--- a/kdecore/date/kcalendarsystemcoptic_p.h
+++ b/kdecore/date/kcalendarsystemcoptic_p.h
@@ -57,8 +57,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemethiopian.cpp b/kdecore/date/kcalendarsystemethiopian.cpp
index 43a2dbd..03ac1d3 100644
--- a/kdecore/date/kcalendarsystemethiopian.cpp
+++ b/kdecore/date/kcalendarsystemethiopian.cpp
@@ -376,11 +376,6 @@ QString KCalendarSystemEthiopian::weekDayName(const QDate &date, WeekDayNameForm
     return KCalendarSystemCoptic::weekDayName(date, format);
 }
 
-int KCalendarSystemEthiopian::weekDayOfPray() const
-{
-    return 7;
-}
-
 bool KCalendarSystemEthiopian::isLunar() const
 {
     return KCalendarSystemCoptic::isLunar();
diff --git a/kdecore/date/kcalendarsystemethiopian_p.h b/kdecore/date/kcalendarsystemethiopian_p.h
index 51e936e..16f5b10 100644
--- a/kdecore/date/kcalendarsystemethiopian_p.h
+++ b/kdecore/date/kcalendarsystemethiopian_p.h
@@ -58,8 +58,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() 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 f605d11..481be1b 100644
--- a/kdecore/date/kcalendarsystemgregorian.cpp
+++ b/kdecore/date/kcalendarsystemgregorian.cpp
@@ -472,11 +472,6 @@ int KCalendarSystemGregorian::yearStringToInteger(const QString &sNum, int &iLen
     return KCalendarSystem::yearStringToInteger(sNum, iLength);
 }
 
-int KCalendarSystemGregorian::weekDayOfPray() const
-{
-    return 7; // sunday
-}
-
 bool KCalendarSystemGregorian::isLunar() const
 {
     return false;
diff --git a/kdecore/date/kcalendarsystemgregorian_p.h b/kdecore/date/kcalendarsystemgregorian_p.h
index bb3e8ff..d11e774 100644
--- a/kdecore/date/kcalendarsystemgregorian_p.h
+++ b/kdecore/date/kcalendarsystemgregorian_p.h
@@ -64,8 +64,6 @@ public:
 
     virtual int yearStringToInteger(const QString &sNum, int &iLength) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemhebrew.cpp b/kdecore/date/kcalendarsystemhebrew.cpp
index 4097d1e..3646e7f 100644
--- a/kdecore/date/kcalendarsystemhebrew.cpp
+++ b/kdecore/date/kcalendarsystemhebrew.cpp
@@ -986,11 +986,6 @@ int KCalendarSystemHebrew::yearStringToInteger(const QString &string, int &readL
     return result;
 }
 
-int KCalendarSystemHebrew::weekDayOfPray() const
-{
-    return 6; // Saturday
-}
-
 bool KCalendarSystemHebrew::isLunar() const
 {
     return false;
diff --git a/kdecore/date/kcalendarsystemhebrew_p.h b/kdecore/date/kcalendarsystemhebrew_p.h
index 0405797..965ca94 100644
--- a/kdecore/date/kcalendarsystemhebrew_p.h
+++ b/kdecore/date/kcalendarsystemhebrew_p.h
@@ -65,8 +65,6 @@ public:
 
     virtual int yearStringToInteger(const QString &sNum, int &iLength) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemindiannational.cpp b/kdecore/date/kcalendarsystemindiannational.cpp
index bf222f6..20eee48 100644
--- a/kdecore/date/kcalendarsystemindiannational.cpp
+++ b/kdecore/date/kcalendarsystemindiannational.cpp
@@ -473,11 +473,6 @@ QString KCalendarSystemIndianNational::weekDayName(const QDate &date, WeekDayNam
     return KCalendarSystem::weekDayName(date, format);
 }
 
-int KCalendarSystemIndianNational::weekDayOfPray() const
-{
-    return 7; // JPL ???
-}
-
 bool KCalendarSystemIndianNational::isLunar() const
 {
     return false;
diff --git a/kdecore/date/kcalendarsystemindiannational_p.h b/kdecore/date/kcalendarsystemindiannational_p.h
index 409954c..d4549a7 100644
--- a/kdecore/date/kcalendarsystemindiannational_p.h
+++ b/kdecore/date/kcalendarsystemindiannational_p.h
@@ -61,8 +61,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() 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 f6c7c4b..816aabc 100644
--- a/kdecore/date/kcalendarsystemislamiccivil.cpp
+++ b/kdecore/date/kcalendarsystemislamiccivil.cpp
@@ -473,11 +473,6 @@ QString KCalendarSystemIslamicCivil::weekDayName(const QDate &date, WeekDayNameF
     return KCalendarSystem::weekDayName(date, format);
 }
 
-int KCalendarSystemIslamicCivil::weekDayOfPray() const
-{
-    return 5; // Friday
-}
-
 bool KCalendarSystemIslamicCivil::isLunar() const
 {
     return true;
diff --git a/kdecore/date/kcalendarsystemislamiccivil_p.h b/kdecore/date/kcalendarsystemislamiccivil_p.h
index 4f493e5..343072b 100644
--- a/kdecore/date/kcalendarsystemislamiccivil_p.h
+++ b/kdecore/date/kcalendarsystemislamiccivil_p.h
@@ -63,8 +63,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() 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 2ddadc2..3fc9526 100644
--- a/kdecore/date/kcalendarsystemjalali.cpp
+++ b/kdecore/date/kcalendarsystemjalali.cpp
@@ -481,11 +481,6 @@ QString KCalendarSystemJalali::weekDayName(const QDate &date, WeekDayNameFormat
     return KCalendarSystem::weekDayName(date, format);
 }
 
-int KCalendarSystemJalali::weekDayOfPray() const
-{
-    return 5; // friday
-}
-
 bool KCalendarSystemJalali::isLunar() const
 {
     return false;
diff --git a/kdecore/date/kcalendarsystemjalali_p.h b/kdecore/date/kcalendarsystemjalali_p.h
index 8a8de09..c9e2ce2 100644
--- a/kdecore/date/kcalendarsystemjalali_p.h
+++ b/kdecore/date/kcalendarsystemjalali_p.h
@@ -52,8 +52,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() 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 138cab3..2562894 100644
--- a/kdecore/date/kcalendarsystemjapanese.cpp
+++ b/kdecore/date/kcalendarsystemjapanese.cpp
@@ -192,11 +192,6 @@ int KCalendarSystemJapanese::yearStringToInteger(const QString &sNum, int &iLeng
     }
 }
 
-int KCalendarSystemJapanese::weekDayOfPray() const
-{
-    return 7; // TODO JPL ???
-}
-
 bool KCalendarSystemJapanese::isLunar() const
 {
     return KCalendarSystemGregorian::isLunar();
diff --git a/kdecore/date/kcalendarsystemjapanese_p.h b/kdecore/date/kcalendarsystemjapanese_p.h
index b60c2bc..1970936 100644
--- a/kdecore/date/kcalendarsystemjapanese_p.h
+++ b/kdecore/date/kcalendarsystemjapanese_p.h
@@ -60,8 +60,6 @@ public:
 
     virtual int yearStringToInteger(const QString &sNum, int &iLength) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemjulian.cpp b/kdecore/date/kcalendarsystemjulian.cpp
index cf891fd..1d7abc6 100644
--- a/kdecore/date/kcalendarsystemjulian.cpp
+++ b/kdecore/date/kcalendarsystemjulian.cpp
@@ -482,11 +482,6 @@ QString KCalendarSystemJulian::weekDayName(const QDate &date, WeekDayNameFormat
     return KCalendarSystem::weekDayName(date, format);
 }
 
-int KCalendarSystemJulian::weekDayOfPray() const
-{
-    return 7; // sunday
-}
-
 bool KCalendarSystemJulian::isLunar() const
 {
     return false;
diff --git a/kdecore/date/kcalendarsystemjulian_p.h b/kdecore/date/kcalendarsystemjulian_p.h
index d6639e9..4916697 100644
--- a/kdecore/date/kcalendarsystemjulian_p.h
+++ b/kdecore/date/kcalendarsystemjulian_p.h
@@ -61,8 +61,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() 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 97b420d..55ea124 100644
--- a/kdecore/date/kcalendarsystemminguo.cpp
+++ b/kdecore/date/kcalendarsystemminguo.cpp
@@ -155,11 +155,6 @@ QString KCalendarSystemMinguo::weekDayName(const QDate &date, WeekDayNameFormat
     return KCalendarSystemGregorian::weekDayName(date, format);
 }
 
-int KCalendarSystemMinguo::weekDayOfPray() const
-{
-    return 7; // TODO JPL ???
-}
-
 bool KCalendarSystemMinguo::isLunar() const
 {
     return KCalendarSystemGregorian::isLunar();
diff --git a/kdecore/date/kcalendarsystemminguo_p.h b/kdecore/date/kcalendarsystemminguo_p.h
index 4931d0f..c41c0d6 100644
--- a/kdecore/date/kcalendarsystemminguo_p.h
+++ b/kdecore/date/kcalendarsystemminguo_p.h
@@ -58,8 +58,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemqdate.cpp b/kdecore/date/kcalendarsystemqdate.cpp
index 9f85cb9..dbb0a91 100644
--- a/kdecore/date/kcalendarsystemqdate.cpp
+++ b/kdecore/date/kcalendarsystemqdate.cpp
@@ -509,11 +509,6 @@ QString KCalendarSystemQDate::weekDayName(const QDate &date, WeekDayNameFormat f
     return KCalendarSystem::weekDayName(date, format);
 }
 
-int KCalendarSystemQDate::weekDayOfPray() const
-{
-    return 7; // sunday
-}
-
 bool KCalendarSystemQDate::isLunar() const
 {
     return false;
diff --git a/kdecore/date/kcalendarsystemqdate_p.h b/kdecore/date/kcalendarsystemqdate_p.h
index b82acbd..626f14d 100644
--- a/kdecore/date/kcalendarsystemqdate_p.h
+++ b/kdecore/date/kcalendarsystemqdate_p.h
@@ -71,8 +71,6 @@ public:
     virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
     virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/date/kcalendarsystemthai.cpp b/kdecore/date/kcalendarsystemthai.cpp
index fc050f9..45b0d8b 100644
--- a/kdecore/date/kcalendarsystemthai.cpp
+++ b/kdecore/date/kcalendarsystemthai.cpp
@@ -141,11 +141,6 @@ bool KCalendarSystemThai::isLeapYear(const QDate &date) const
     return KCalendarSystemGregorian::isLeapYear(date);
 }
 
-int KCalendarSystemThai::weekDayOfPray() const
-{
-    return 7; // TODO JPL ???
-}
-
 bool KCalendarSystemThai::isLunar() const
 {
     return KCalendarSystemGregorian::isLunar();
diff --git a/kdecore/date/kcalendarsystemthai_p.h b/kdecore/date/kcalendarsystemthai_p.h
index 674fabc..7c0f9d8 100644
--- a/kdecore/date/kcalendarsystemthai_p.h
+++ b/kdecore/date/kcalendarsystemthai_p.h
@@ -52,8 +52,6 @@ public:
     virtual bool isLeapYear(int year) const;
     virtual bool isLeapYear(const QDate &date) const;
 
-    virtual int weekDayOfPray() const;
-
     virtual bool isLunar() const;
     virtual bool isLunisolar() const;
     virtual bool isSolar() const;
diff --git a/kdecore/tests/kcalendartest.cpp b/kdecore/tests/kcalendartest.cpp
index 051e8cc..2e372d7 100644
--- a/kdecore/tests/kcalendartest.cpp
+++ b/kdecore/tests/kcalendartest.cpp
@@ -1316,7 +1316,6 @@ void KCalendarTest::testQDateCalendarBasic()
     QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 7);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), false);
@@ -1401,7 +1400,6 @@ void KCalendarTest::testGregorianBasic()
     QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 7);
 
     QCOMPARE(calendar->isProleptic(), true);
     QCOMPARE(calendar->isLunar(), false);
@@ -1456,7 +1454,6 @@ void KCalendarTest::testHebrewBasic()
     testMonthName(calendar, 1, 5707, testDate, "T", "Tis", "Tishrey", "of Tis", "of Tishrey");
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 6);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), false);
@@ -1535,7 +1532,6 @@ void KCalendarTest::testIslamicCivilBasic()
     QCOMPARE(calendar->monthsInYear(testDate), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 5);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), true);
@@ -1594,7 +1590,6 @@ void KCalendarTest::testJalaliBasic()
     QCOMPARE(calendar->monthsInYear(testDate), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 5);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), false);
@@ -1685,7 +1680,6 @@ void KCalendarTest::testJapaneseBasic()
     QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 7);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), false);
@@ -1783,7 +1777,6 @@ void KCalendarTest::testMinguoBasic()
     QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 7);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), false);
@@ -1832,7 +1825,6 @@ void KCalendarTest::testThaiBasic()
     QCOMPARE(calendar->monthsInYear(QDate(2007, 1, 1)), 12);
 
     QCOMPARE(calendar->weekStartDay(), 1);
-    QCOMPARE(calendar->weekDayOfPray(), 7);
 
     QCOMPARE(calendar->isProleptic(), false);
     QCOMPARE(calendar->isLunar(), false);
-- 
1.7.10.4



More information about the Kde-frameworks-devel mailing list