[PATCH 16/23] kcalendarsystem: Fix lengthOfWeek to 7

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


Week length depends on the week system (i.e. KLocale::WeekNumberSystem) used,
not the calendar used, and is 7 for all week systems supported by KDE.
---
 kdecore/date/kcalendarsystem.cpp                 |   29 ++++++++--------------
 kdecore/date/kcalendarsystem.h                   |   18 +++++++++++---
 kdecore/date/kcalendarsystemcoptic.cpp           |   10 --------
 kdecore/date/kcalendarsystemcopticprivate_p.h    |    2 --
 kdecore/date/kcalendarsystemgregorian.cpp        |   10 --------
 kdecore/date/kcalendarsystemgregorianprivate_p.h |    2 --
 kdecore/date/kcalendarsystemhebrew.cpp           |   12 ---------
 kdecore/date/kcalendarsystemindiannational.cpp   |   12 ---------
 kdecore/date/kcalendarsystemislamiccivil.cpp     |   12 ---------
 kdecore/date/kcalendarsystemjalali.cpp           |   12 ---------
 kdecore/date/kcalendarsystemjulian.cpp           |   12 ---------
 kdecore/date/kcalendarsystemprivate_p.h          |    2 --
 kdecore/date/kcalendarsystemqdate.cpp            |   12 ---------
 kdecore/date/kdatetimeparser.cpp                 |    2 +-
 kdecore/date/klocalizeddate.h                    |    7 ++++--
 kdecore/localization/klocale.h                   |    2 +-
 kdecore/localization/klocale_kde.cpp             |    8 +++---
 17 filer ändrade, 37 tillägg(+), 127 borttagningar(-)

diff --git a/kdecore/date/kcalendarsystem.cpp b/kdecore/date/kcalendarsystem.cpp
index e040154..f8bc3e6 100644
--- a/kdecore/date/kcalendarsystem.cpp
+++ b/kdecore/date/kcalendarsystem.cpp
@@ -186,7 +186,7 @@ int KCalendarSystemPrivate::isoWeekNumber(const QDate &date, int *yearNum) const
 
     // iso 8601: week 1  is the first containing thursday and week starts on monday
     if (weekDay1 > 4 /*Thursday*/) {
-        firstDayWeek1 = q->addDays(firstDayWeek1 , daysInWeek() - weekDay1 + 1);   // next monday
+        firstDayWeek1 = q->addDays(firstDayWeek1 , 7 - weekDay1 + 1);   // next monday
     }
 
     dayOfWeek1InYear = dayOfYear(firstDayWeek1);
@@ -219,7 +219,7 @@ int KCalendarSystemPrivate::isoWeekNumber(const QDate &date, int *yearNum) const
             * yearNum = y;
         }
 
-        week = firstDayWeek1.daysTo(date) / daysInWeek() + 1;
+        week = firstDayWeek1.daysTo(date) / 7 + 1;
     }
 
     return week;
@@ -231,9 +231,9 @@ int KCalendarSystemPrivate::regularWeekNumber(const QDate &date, int weekStartDa
     int y, m, d;
     q->julianDayToDate(date.toJulianDay(), y, m, d);
 
-    int firstWeekDayOffset = (dayOfWeek(date) - weekStartDay + daysInWeek()) % daysInWeek();
+    int firstWeekDayOffset = (dayOfWeek(date) - weekStartDay + 7) % 7;
     int dayInYear = date.toJulianDay() - firstDayOfYear(y).toJulianDay();   // 0 indexed
-    int week = ((dayInYear - firstWeekDayOffset + daysInWeek()) / daysInWeek());
+    int week = ((dayInYear - firstWeekDayOffset + 7) / 7);
 
     if (dayOfWeek(firstDayOfYear(y)) != weekStartDay) {
         week = week + firstWeekNumber;
@@ -259,7 +259,7 @@ int KCalendarSystemPrivate::simpleWeekNumber(const QDate &date, int *yearNum) co
     if (yearNum) {
         *yearNum = y;
     }
-    return ((date.toJulianDay() - firstDayOfYear(y).toJulianDay()) / daysInWeek()) + 1;
+    return ((date.toJulianDay() - firstDayOfYear(y).toJulianDay()) / 7) + 1;
 }
 
 // Reimplement if special maths handling required, e.g. Hebrew.
@@ -605,7 +605,7 @@ int KCalendarSystemPrivate::dayOfWeek(const QDate &date) const
     // This is true for Julian/Gregorian calendar with jd 0 being Monday
     // We add 1 for ISO compliant numbering for 7 day week
     // Assumes we've never skipped weekdays
-    return ((date.toJulianDay() % daysInWeek()) + 1);
+    return ((date.toJulianDay() % 7) + 1);
 }
 
 QDate KCalendarSystemPrivate::firstDayOfYear(int year) const
@@ -861,7 +861,7 @@ bool KCalendarSystem::isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfI
     }
 
     //Test Day of Week Number falls in valid range
-    if (dayOfIsoWeek < 1 || dayOfIsoWeek > d->daysInWeek()) {
+    if (dayOfIsoWeek < 1 || dayOfIsoWeek > 7) {
         return false;
     }
 
@@ -945,12 +945,12 @@ bool KCalendarSystem::setDateIsoWeek(QDate &date, int year, int isoWeekNumber, i
         QDate calcDate = d->firstDayOfYear(year);
         int dowFirstDayOfYear = dayOfWeek(calcDate);
 
-        int daysToAdd = (d->daysInWeek() * (isoWeekNumber - 1)) + dayOfIsoWeek;
+        int daysToAdd = (7 * (isoWeekNumber - 1)) + dayOfIsoWeek;
 
         if (dowFirstDayOfYear <= 4) {
             calcDate = calcDate.addDays(daysToAdd - dowFirstDayOfYear);
         } else {
-            calcDate = calcDate.addDays(daysInWeek(calcDate) + daysToAdd - dowFirstDayOfYear);
+            calcDate = calcDate.addDays(7 + daysToAdd - dowFirstDayOfYear);
         }
 
         if (isValid(calcDate)) {
@@ -1304,13 +1304,6 @@ int KCalendarSystem::daysInMonth(int year, int month) const
     return -1;
 }
 
-int KCalendarSystem::daysInWeek(const QDate &date) const
-{
-    Q_UNUSED(date)
-    Q_D(const KCalendarSystem);
-    return d->daysInWeek();
-}
-
 int KCalendarSystem::dayOfYear(const QDate &date) const
 {
     Q_D(const KCalendarSystem);
@@ -1521,7 +1514,7 @@ QString KCalendarSystem::weekDayName(int weekDay, KCalendarSystem::WeekDayNameFo
 {
     Q_D(const KCalendarSystem);
 
-    if (weekDay < 1 || weekDay > d->daysInWeek()) {
+    if (weekDay < 1 || weekDay > 7) {
         return QString();
     }
 
@@ -1966,7 +1959,7 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen
         case KLocale::ShortNumber:
         case KLocale::DefaultComponentFormat:
         default:
-            return d->stringFromInteger(d->daysInWeek(), 0);
+            return d->stringFromInteger(7, 0);
         }
     default:
         return QString();
diff --git a/kdecore/date/kcalendarsystem.h b/kdecore/date/kcalendarsystem.h
index c1eb159..d31fc0a 100644
--- a/kdecore/date/kcalendarsystem.h
+++ b/kdecore/date/kcalendarsystem.h
@@ -601,12 +601,24 @@ public:
     int daysInMonth(int year, int month) const;
 
     /**
+     * @deprecated use 7 instead
+     *
      * Returns the number of days in the given week.
      *
-     * @param date the date to obtain week from
-     * @return number of days in week, -1 if input date invalid
+     * @note This API is misdesigned, does not work, and have never worked. The
+     *       number of days in a week does not depend on the calendar system or
+     *       the date, only on the week number system used. For all week number
+     *       system ever supported by @c KCalendarSystem it returns, and has
+     *       always returned, @c 7.
+     *
+     * @param date ignored
+     * @return 7
      */
-    virtual int daysInWeek(const QDate &date) const;
+    KDECORE_DEPRECATED inline int daysInWeek(const QDate &date) const
+    {
+        Q_UNUSED(date);
+        return 7;
+    }
 
     /**
      * Returns the day number of year for the given date
diff --git a/kdecore/date/kcalendarsystemcoptic.cpp b/kdecore/date/kcalendarsystemcoptic.cpp
index e01a7e3..707802c 100644
--- a/kdecore/date/kcalendarsystemcoptic.cpp
+++ b/kdecore/date/kcalendarsystemcoptic.cpp
@@ -76,11 +76,6 @@ int KCalendarSystemCopticPrivate::daysInYear(int year) const
     }
 }
 
-int KCalendarSystemCopticPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemCopticPrivate::isLeapYear(int year) const
 {
     //Uses same rule as Julian but offset by 1 year with year 3 being first leap year
@@ -106,11 +101,6 @@ bool KCalendarSystemCopticPrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemCopticPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemCopticPrivate::maxMonthsInYear() const
 {
     return 13;
diff --git a/kdecore/date/kcalendarsystemcopticprivate_p.h b/kdecore/date/kcalendarsystemcopticprivate_p.h
index 35907ff..8ceb5ad 100644
--- a/kdecore/date/kcalendarsystemcopticprivate_p.h
+++ b/kdecore/date/kcalendarsystemcopticprivate_p.h
@@ -34,11 +34,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
diff --git a/kdecore/date/kcalendarsystemgregorian.cpp b/kdecore/date/kcalendarsystemgregorian.cpp
index 1a5aaa8..7a9e4b4 100644
--- a/kdecore/date/kcalendarsystemgregorian.cpp
+++ b/kdecore/date/kcalendarsystemgregorian.cpp
@@ -104,11 +104,6 @@ int KCalendarSystemGregorianPrivate::daysInYear(int year) const
     }
 }
 
-int KCalendarSystemGregorianPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemGregorianPrivate::isLeapYear(int year) const
 {
     if (!hasYearZero() && year < 1) {
@@ -136,11 +131,6 @@ bool KCalendarSystemGregorianPrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemGregorianPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemGregorianPrivate::maxMonthsInYear() const
 {
     return 12;
diff --git a/kdecore/date/kcalendarsystemgregorianprivate_p.h b/kdecore/date/kcalendarsystemgregorianprivate_p.h
index fb7a0dd..1208fe9 100644
--- a/kdecore/date/kcalendarsystemgregorianprivate_p.h
+++ b/kdecore/date/kcalendarsystemgregorianprivate_p.h
@@ -36,11 +36,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
diff --git a/kdecore/date/kcalendarsystemhebrew.cpp b/kdecore/date/kcalendarsystemhebrew.cpp
index fdae5a3..f5a9e94 100644
--- a/kdecore/date/kcalendarsystemhebrew.cpp
+++ b/kdecore/date/kcalendarsystemhebrew.cpp
@@ -247,11 +247,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
@@ -335,11 +333,6 @@ int KCalendarSystemHebrewPrivate::daysInYear(int year) const
     return days;
 }
 
-int KCalendarSystemHebrewPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemHebrewPrivate::isLeapYear(int year) const
 {
     return ((((7 * year) + 1) % 19) < 7);
@@ -355,11 +348,6 @@ bool KCalendarSystemHebrewPrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemHebrewPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemHebrewPrivate::maxMonthsInYear() const
 {
     return 13;
diff --git a/kdecore/date/kcalendarsystemindiannational.cpp b/kdecore/date/kcalendarsystemindiannational.cpp
index fe8b0b7..f51aa15 100644
--- a/kdecore/date/kcalendarsystemindiannational.cpp
+++ b/kdecore/date/kcalendarsystemindiannational.cpp
@@ -38,11 +38,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
@@ -103,11 +101,6 @@ int KCalendarSystemIndianNationalPrivate::daysInYear(int year) const
     }
 }
 
-int KCalendarSystemIndianNationalPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemIndianNationalPrivate::isLeapYear(int year) const
 {
     //Uses same rule as Gregorian, and is explicitly synchronized to Gregorian
@@ -138,11 +131,6 @@ bool KCalendarSystemIndianNationalPrivate::hasYearZero() const
     return true;
 }
 
-int KCalendarSystemIndianNationalPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemIndianNationalPrivate::maxMonthsInYear() const
 {
     return 12;
diff --git a/kdecore/date/kcalendarsystemislamiccivil.cpp b/kdecore/date/kcalendarsystemislamiccivil.cpp
index 56abff4..2ec717a 100644
--- a/kdecore/date/kcalendarsystemislamiccivil.cpp
+++ b/kdecore/date/kcalendarsystemislamiccivil.cpp
@@ -36,11 +36,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
@@ -97,11 +95,6 @@ int KCalendarSystemIslamicCivilPrivate::daysInYear(int year) const
     }
 }
 
-int KCalendarSystemIslamicCivilPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemIslamicCivilPrivate::isLeapYear(int year) const
 {
     // Years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 of the 30 year cycle
@@ -144,11 +137,6 @@ bool KCalendarSystemIslamicCivilPrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemIslamicCivilPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemIslamicCivilPrivate::maxMonthsInYear() const
 {
     return 12;
diff --git a/kdecore/date/kcalendarsystemjalali.cpp b/kdecore/date/kcalendarsystemjalali.cpp
index 71feab3..1b505b4 100644
--- a/kdecore/date/kcalendarsystemjalali.cpp
+++ b/kdecore/date/kcalendarsystemjalali.cpp
@@ -44,11 +44,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
@@ -109,11 +107,6 @@ int KCalendarSystemJalaliPrivate::daysInYear(int year) const
     }
 }
 
-int KCalendarSystemJalaliPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemJalaliPrivate::isLeapYear(int year) const
 {
     // From formilab Public Domain code http://www.fourmilab.ch/documents/calendar/
@@ -150,11 +143,6 @@ bool KCalendarSystemJalaliPrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemJalaliPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemJalaliPrivate::maxMonthsInYear() const
 {
     return 12;
diff --git a/kdecore/date/kcalendarsystemjulian.cpp b/kdecore/date/kcalendarsystemjulian.cpp
index 74eb6ef..14282e2 100644
--- a/kdecore/date/kcalendarsystemjulian.cpp
+++ b/kdecore/date/kcalendarsystemjulian.cpp
@@ -39,11 +39,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
@@ -124,11 +122,6 @@ int KCalendarSystemJulianPrivate::daysInYear(int year) const
     }
 }
 
-int KCalendarSystemJulianPrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemJulianPrivate::isLeapYear(int year) const
 {
     if (year < 1) {
@@ -152,11 +145,6 @@ bool KCalendarSystemJulianPrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemJulianPrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemJulianPrivate::maxMonthsInYear() const
 {
     return 12;
diff --git a/kdecore/date/kcalendarsystemprivate_p.h b/kdecore/date/kcalendarsystemprivate_p.h
index d935ead..b77597a 100644
--- a/kdecore/date/kcalendarsystemprivate_p.h
+++ b/kdecore/date/kcalendarsystemprivate_p.h
@@ -40,11 +40,9 @@ public:
     virtual int monthsInYear(int year) const = 0;
     virtual int daysInMonth(int year, int month) const = 0;
     virtual int daysInYear(int year) const = 0;
-    virtual int daysInWeek() const = 0;
     virtual bool isLeapYear(int year) const = 0;
     virtual bool hasLeapMonths() const = 0;
     virtual bool hasYearZero() const = 0;
-    virtual int maxDaysInWeek() const = 0;
     virtual int maxMonthsInYear() const = 0;
     virtual int earliestValidYear() const = 0;
     virtual int latestValidYear() const = 0;
diff --git a/kdecore/date/kcalendarsystemqdate.cpp b/kdecore/date/kcalendarsystemqdate.cpp
index f73e7f0..44677b7 100644
--- a/kdecore/date/kcalendarsystemqdate.cpp
+++ b/kdecore/date/kcalendarsystemqdate.cpp
@@ -44,11 +44,9 @@ public:
     virtual int monthsInYear(int year) const;
     virtual int daysInMonth(int year, int month) const;
     virtual int daysInYear(int year) const;
-    virtual int daysInWeek() const;
     virtual bool isLeapYear(int year) const;
     virtual bool hasLeapMonths() const;
     virtual bool hasYearZero() const;
-    virtual int maxDaysInWeek() const;
     virtual int maxMonthsInYear() const;
     virtual int earliestValidYear() const;
     virtual int latestValidYear() const;
@@ -118,11 +116,6 @@ int KCalendarSystemQDatePrivate::daysInYear(int year) const
     return tempDate.daysInYear();
 }
 
-int KCalendarSystemQDatePrivate::daysInWeek() const
-{
-    return 7;
-}
-
 bool KCalendarSystemQDatePrivate::isLeapYear(int year) const
 {
     return QDate::isLeapYear(year);
@@ -138,11 +131,6 @@ bool KCalendarSystemQDatePrivate::hasYearZero() const
     return false;
 }
 
-int KCalendarSystemQDatePrivate::maxDaysInWeek() const
-{
-    return 7;
-}
-
 int KCalendarSystemQDatePrivate::maxMonthsInYear() const
 {
     return 12;
diff --git a/kdecore/date/kdatetimeparser.cpp b/kdecore/date/kdatetimeparser.cpp
index a416808..705c366 100644
--- a/kdecore/date/kdatetimeparser.cpp
+++ b/kdecore/date/kdatetimeparser.cpp
@@ -138,7 +138,7 @@ DateTimeComponents KDateTimeParser::parseDatePosix(const QString &inputString,
             case 'A':  // Weekday Name Long
                 error = true;
                 j = 1;
-                while (error && j <= calendar->d_ptr->maxDaysInWeek()) {
+                while (error && j <= 7) {
                     shortName = calendar->weekDayName(j, KCalendarSystem::ShortDayName).toLower();
                     longName = calendar->weekDayName(j, KCalendarSystem::LongDayName).toLower();
                     if (str.mid(strpos, longName.length()) == longName) {
diff --git a/kdecore/date/klocalizeddate.h b/kdecore/date/klocalizeddate.h
index 1bfe261..466fb5f 100644
--- a/kdecore/date/klocalizeddate.h
+++ b/kdecore/date/klocalizeddate.h
@@ -582,14 +582,17 @@ public:
     int daysInMonth() const;
 
     /**
+     * @deprecated use 7 instead
+     *
      * Returns the number of days in the week.
      *
      * See @ref formatting for why you should never display this value.
      *
      * @see formatDate()
-     * @return number of days in week, -1 if date invalid
+     * @see KCalendarSystem::daysInWeek()
+     * @return 7
      */
-    int daysInWeek() const;
+    KDECORE_DEPRECATED int daysInWeek() const;
 
     /**
      * Returns whether the currently set date falls in a Leap Year in the
diff --git a/kdecore/localization/klocale.h b/kdecore/localization/klocale.h
index b3442a9..934e5bc 100644
--- a/kdecore/localization/klocale.h
+++ b/kdecore/localization/klocale.h
@@ -883,7 +883,7 @@ public:
         WeeksInYear   = 0x20000,    /**< The Weeks In Year portion of a date */
         DaysInYear    = 0x40000,    /**< The Days In Year portion of a date */
         DaysInMonth   = 0x80000,    /**< The Days In Month portion of a date */
-        DaysInWeek    = 0x100000,   /**< The Days In Week portion of a date */
+        DaysInWeek    = 0x100000,   /**< The Days In Week portion of a date @deprecated */
         Hour          = 0x200000,   /**< The Hours portion of a date */
         Minute        = 0x400000,   /**< The Minutes portion of a date */
         Second        = 0x800000,   /**< The Seconds portion of a date */
diff --git a/kdecore/localization/klocale_kde.cpp b/kdecore/localization/klocale_kde.cpp
index f01754b..d6ff731 100644
--- a/kdecore/localization/klocale_kde.cpp
+++ b/kdecore/localization/klocale_kde.cpp
@@ -2684,28 +2684,28 @@ void KLocalePrivate::setTimeFormat(const QString &format)
 
 void KLocalePrivate::setWeekStartDay(int day)
 {
-    if (day >= 1 && day <= calendar()->daysInWeek(QDate())) {
+    if (day >= 1 && day <= 7) {
         m_weekStartDay = day;
     }
 }
 
 void KLocalePrivate::setWorkingWeekStartDay(int day)
 {
-    if (day >= 1 && day <= calendar()->daysInWeek(QDate())) {
+    if (day >= 1 && day <= 7) {
         m_workingWeekStartDay = day;
     }
 }
 
 void KLocalePrivate::setWorkingWeekEndDay(int day)
 {
-    if (day >= 1 && day <= calendar()->daysInWeek(QDate())) {
+    if (day >= 1 && day <= 7) {
         m_workingWeekEndDay = day;
     }
 }
 
 void KLocalePrivate::setWeekDayOfPray(int day)
 {
-    if (day >= 0 && day <= calendar()->daysInWeek(QDate())) { // 0 = None
+    if (day >= 0 && day <= 7) { // 0 = None
         m_weekDayOfPray = day;
     }
 }
-- 
1.7.10.4



More information about the Kde-frameworks-devel mailing list