diff options
Diffstat (limited to 'kde-unstable')
-rw-r--r-- | kde-unstable/kdebindings-python/fix-build.patch | 96 | ||||
-rw-r--r-- | kde-unstable/kdelibs/kcalendarsystem-fixed.patch | 18073 | ||||
-rw-r--r-- | kde-unstable/kdepim/fix-console-build.patch | 11 | ||||
-rw-r--r-- | kde-unstable/libkface/PKGBUILD | 30 | ||||
-rw-r--r-- | kde-unstable/libkmap/PKGBUILD | 30 |
5 files changed, 0 insertions, 18240 deletions
diff --git a/kde-unstable/kdebindings-python/fix-build.patch b/kde-unstable/kdebindings-python/fix-build.patch deleted file mode 100644 index 6a3d0c9cf..000000000 --- a/kde-unstable/kdebindings-python/fix-build.patch +++ /dev/null @@ -1,96 +0,0 @@ ---- a/python/pykde4/kpythonpluginfactory/kpythonpluginfactory.cpp
-+++ b/python/pykde4/kpythonpluginfactory/kpythonpluginfactory.cpp
-@@ -18,6 +18,7 @@
- Boston, MA 02111-1307, USA.
- */
-
-+#include <Python.h>
- #include <QtCore/QCoreApplication>
- #include <QFileInfo>
- #include <QDir>
-@@ -25,7 +26,6 @@
- #include <klibloader.h>
- #include <kstandarddirs.h>
- #include <kcmodule.h>
--#include <Python.h>
- #include <kcomponentdata.h>
- #include <kdebug.h>Index: b/python/pykde4/CMakeLists.txt
-===================================================================
---- a/python/pykde4/CMakeLists.txt
-+++ b/python/pykde4/CMakeLists.txt
-@@ -87,6 +87,9 @@
- ${KDEPIMLIBS_INCLUDE_DIRS}
- )
-
-+# Pull in ARM configuration options if needed
-+STRING(REGEX MATCH "PyQt_qreal_double" SIP_ARM_HACK ${PYQT4_SIP_FLAGS} "")
-+
- SET(SIP_INCLUDES ${PYQT4_SIP_DIR} sip)
- SET(SIP_CONCAT_PARTS 8)
- IF (WIN32)
-@@ -94,7 +97,7 @@
- ELSE (WIN32)
- SET(SIP_TAGS ALL WS_X11 ${PYQT4_VERSION_TAG})
- ENDIF (WIN32)
--SET(SIP_DISABLE_FEATURES VendorID PyQt_NoPrintRangeBug)
-+SET(SIP_DISABLE_FEATURES VendorID PyQt_NoPrintRangeBug ${SIP_ARM_HACK})
-
- # Use an extra option when compiling on Python 3.
- IF (PYTHON_3)diff -ur kdebindings-4.5.95/python/pykde4/sip/nepomuk/nuao.sip kdebindings-4.5.95.mine/python/pykde4/sip/nepomuk/nuao.sip
---- kdebindings-4.5.95/python/pykde4/sip/nepomuk/nuao.sip 2010-12-22 09:55:07.000000000 +0000
-+++ kdebindings-4.5.95.mine/python/pykde4/sip/nepomuk/nuao.sip 2011-01-07 00:04:41.157926502 +0000
-@@ -32,7 +32,7 @@
- QUrl Event ();
- QUrl ModificationEvent ();
- QUrl UsageEvent ();
--QUrl duration ();
-+QUrl end ();
- QUrl eventCount ();
- QUrl firstEvent ();
- QUrl firstModification ();--- a/python/pykde4/kpythonpluginfactory/kpythonpluginfactory.cpp
-+++ b/python/pykde4/kpythonpluginfactory/kpythonpluginfactory.cpp
-@@ -297,7 +297,7 @@ QLibrary *LoadPythonLibrary()
- {
- QLibrary *pythonLib = new QLibrary();
- pythonLib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
-- pythonLib->setFileName(LIB_PYTHON);
-+ pythonLib->setFileName(LIB_PYTHON ".1");
- pythonLib->load();
- return pythonLib;
- }Index: b/python/pykde4/CMakeLists.txt
-===================================================================
---- a/python/pykde4/CMakeLists.txt
-+++ b/python/pykde4/CMakeLists.txt
-@@ -15,6 +15,18 @@
- SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/pykde)
- ENDIF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6)
-
-+# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
-+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
-+
-+# search packages used by KDE
-+find_package(KDE4 REQUIRED)
-+include (KDE4Defaults)
-+include (MacroLibrary)
-+include(MacroOptionalAddSubdirectory)
-+
-+add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DQT3_SUPPORT)
-+
-+
- FIND_PACKAGE(PythonLibrary REQUIRED)
- INCLUDE(PythonMacros)Do not link python modules against -lpython2.X. Since KDE4's cmake file uses --no-undefined by default, we have to remove that from the default CMAKE_SHARED_LINKER_FLAGS variable, but only for the pykde4 subdirectory.
-
-Index: b/python/pykde4/CMakeLists.txt
-===================================================================
---- a/python/pykde4/CMakeLists.txt
-+++ b/python/pykde4/CMakeLists.txt
-@@ -93,6 +93,9 @@
-
- ADD_DEFINITIONS(-D_REENTRANT -DQT_CORE_LIB -DQT_GUI_LIB -DUSING_SOPRANO_NRLMODEL_UNSTABLE_API)
-
-+# Do not use --no-undefined for python modules.
-+STRING(REPLACE -Wl,--no-undefined "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
-+
- FILE(GLOB kdecore_files_sip sip/kdecore/*.sip)
- set(SIP_EXTRA_FILES_DEPEND ${kdecore_files_sip})
- ADD_SIP_PYTHON_MODULE(PyKDE4.kdecore sip/kdecore/kdecoremod.sip ${KDE4_KDECORE_LIBS} ${KDE4_KPTY_LIBS} ${QT_QTNETWORK_LIBRARY})
diff --git a/kde-unstable/kdelibs/kcalendarsystem-fixed.patch b/kde-unstable/kdelibs/kcalendarsystem-fixed.patch deleted file mode 100644 index d97a9b904..000000000 --- a/kde-unstable/kdelibs/kcalendarsystem-fixed.patch +++ /dev/null @@ -1,18073 +0,0 @@ -diff --git a/kdecore/date/kcalendarera.cpp b/kdecore/date/kcalendarera.cpp -index d56c265..0a21e37 100644 ---- a/kdecore/date/kcalendarera.cpp -+++ b/kdecore/date/kcalendarera.cpp -@@ -71,21 +71,21 @@ int KCalendarEra::direction() const - return m_direction; - } - --bool KCalendarEra::isInEra( const QDate &date ) const -+bool KCalendarEra::isInEra(const QDate &date) const - { -- if ( m_endDate < m_startDate ) { -- return ( date >= m_endDate && date <= m_startDate ); -+ if (m_endDate < m_startDate) { -+ return (date >= m_endDate && date <= m_startDate); - } else { -- return ( date >= m_startDate && date <= m_endDate ); -+ return (date >= m_startDate && date <= m_endDate); - } - } - --int KCalendarEra::yearInEra( int year ) const -+int KCalendarEra::yearInEra(int year) const - { -- return ( ( year - m_startYear ) * m_direction ) + m_offset; -+ return ((year - m_startYear) * m_direction) + m_offset; - } - --int KCalendarEra::year( int yearInEra ) const -+int KCalendarEra::year(int yearInEra) const - { -- return ( ( yearInEra - m_offset ) / m_direction ) + m_startYear; -+ return ((yearInEra - m_offset) / m_direction) + m_startYear; - } -diff --git a/kdecore/date/kcalendarera_p.h b/kdecore/date/kcalendarera_p.h -index f1f05f7..d1564ea 100644 ---- a/kdecore/date/kcalendarera_p.h -+++ b/kdecore/date/kcalendarera_p.h -@@ -56,9 +56,9 @@ public: - int direction() const; - int offset() const; - -- bool isInEra( const QDate &date ) const; -- int yearInEra( int year ) const; -- int year( int yearInEra ) const; -+ bool isInEra(const QDate &date) const; -+ int yearInEra(int year) const; -+ int year(int yearInEra) const; - - private: - friend class KCalendarSystemPrivate; -diff --git a/kdecore/date/kcalendarsystem.cpp b/kdecore/date/kcalendarsystem.cpp -index ccc02cd..77ef0e9 100644 ---- a/kdecore/date/kcalendarsystem.cpp -+++ b/kdecore/date/kcalendarsystem.cpp -@@ -34,91 +34,92 @@ - #include "kcalendarsystemcoptic_p.h" - #include "kcalendarsystemethiopian_p.h" - #include "kcalendarsystemgregorian_p.h" --#include "kcalendarsystemgregorianproleptic_p.h" - #include "kcalendarsystemhebrew_p.h" --#include "kcalendarsystemhijri_p.h" - #include "kcalendarsystemindiannational_p.h" -+#include "kcalendarsystemislamiccivil_p.h" - #include "kcalendarsystemjalali_p.h" - #include "kcalendarsystemjapanese_p.h" - #include "kcalendarsystemjulian_p.h" - #include "kcalendarsystemminguo_p.h" -+#include "kcalendarsystemqdate_p.h" - #include "kcalendarsystemthai_p.h" - --KCalendarSystem *KCalendarSystem::create( const QString &calendarType, const KLocale *locale ) -+KCalendarSystem *KCalendarSystem::create(const QString &calendarType, const KLocale *locale) - { -- return create( calendarSystemForCalendarType( calendarType ), locale ); -+ return create(calendarSystem(calendarType), locale); - } - --KCalendarSystem *KCalendarSystem::create( const QString &calendarType, KSharedConfig::Ptr config, -- const KLocale *locale ) -+KCalendarSystem *KCalendarSystem::create(const QString &calendarType, KSharedConfig::Ptr config, -+ const KLocale *locale) - { -- return create( calendarSystemForCalendarType( calendarType ), config, locale ); -+ return create(calendarSystem(calendarType), config, locale); - } - - QStringList KCalendarSystem::calendarSystems() - { - QStringList lst; - -- lst.append( QLatin1String("coptic") ); -- lst.append( QLatin1String("ethiopian") ); -- lst.append( QLatin1String("gregorian") ); -- lst.append( QLatin1String("gregorian-proleptic") ); -- lst.append( QLatin1String("hebrew") ); -- lst.append( QLatin1String("hijri") ); -- lst.append( QLatin1String("indian-national") ); -- lst.append( QLatin1String("jalali") ); -- lst.append( QLatin1String("japanese") ); -- lst.append( QLatin1String("julian") ); -- lst.append( QLatin1String("minguo") ); -- lst.append( QLatin1String("thai") ); -+ lst.append(QLatin1String("coptic")); -+ lst.append(QLatin1String("ethiopian")); -+ lst.append(QLatin1String("gregorian")); -+ lst.append(QLatin1String("gregorian-proleptic")); -+ lst.append(QLatin1String("hebrew")); -+ lst.append(QLatin1String("hijri")); -+ lst.append(QLatin1String("indian-national")); -+ lst.append(QLatin1String("jalali")); -+ lst.append(QLatin1String("japanese")); -+ lst.append(QLatin1String("julian")); -+ lst.append(QLatin1String("minguo")); -+ lst.append(QLatin1String("thai")); - - return lst; - } - --QString KCalendarSystem::calendarLabel( const QString &calendarType ) -+QString KCalendarSystem::calendarLabel(const QString &calendarType) - { -- if ( calendarSystems().contains( calendarType ) ) { -- return KCalendarSystem::calendarLabel( KCalendarSystem::calendarSystemForCalendarType( calendarType ) ); -+ if (calendarSystemsList().contains(calendarSystem(calendarType))) { -+ return KCalendarSystem::calendarLabel(KCalendarSystem::calendarSystem(calendarType)); - } else { -- return ki18nc( "@item Calendar system", "Invalid Calendar Type" ).toString( KGlobal::locale() ); -+ return ki18nc("@item Calendar system", "Invalid Calendar Type").toString(KGlobal::locale()); - } - } - --KCalendarSystem *KCalendarSystem::create( KLocale::CalendarSystem calendarSystem, const KLocale *locale ) -+KCalendarSystem *KCalendarSystem::create(KLocale::CalendarSystem calendarSystem, const KLocale *locale) - { -- return create( calendarSystem, KSharedConfig::Ptr(), locale ); -+ return create(calendarSystem, KSharedConfig::Ptr(), locale); - } - --KCalendarSystem *KCalendarSystem::create( KLocale::CalendarSystem calendarSystem, KSharedConfig::Ptr config, -- const KLocale *locale ) -+KCalendarSystem *KCalendarSystem::create(KLocale::CalendarSystem calendarSystem, -+ KSharedConfig::Ptr config, -+ const KLocale *locale) - { -- switch ( calendarSystem ) { -+ switch (calendarSystem) { - case KLocale::QDateCalendar: -- return new KCalendarSystemGregorian( config, locale ); -+ return new KCalendarSystemQDate(config, locale); - case KLocale::CopticCalendar: -- return new KCalendarSystemCoptic( config, locale ); -+ return new KCalendarSystemCoptic(config, locale); - case KLocale::EthiopianCalendar: -- return new KCalendarSystemEthiopian( config, locale ); -+ return new KCalendarSystemEthiopian(config, locale); - case KLocale::GregorianCalendar: -- return new KCalendarSystemGregorianProleptic( config, locale ); -+ return new KCalendarSystemGregorian(config, locale); - case KLocale::HebrewCalendar: -- return new KCalendarSystemHebrew( config, locale ); -- case KLocale::IslamicCivilCalendar: -- return new KCalendarSystemHijri( config, locale ); -+ return new KCalendarSystemHebrew(config, locale); - case KLocale::IndianNationalCalendar: -- return new KCalendarSystemIndianNational( config, locale ); -+ return new KCalendarSystemIndianNational(config, locale); -+ case KLocale::IslamicCivilCalendar: -+ return new KCalendarSystemIslamicCivil(config, locale); - case KLocale::JalaliCalendar: -- return new KCalendarSystemJalali( config, locale ); -+ return new KCalendarSystemJalali(config, locale); - case KLocale::JapaneseCalendar: -- return new KCalendarSystemJapanese( config, locale ); -+ return new KCalendarSystemJapanese(config, locale); - case KLocale::JulianCalendar: -- return new KCalendarSystemJulian( config, locale ); -+ return new KCalendarSystemJulian(config, locale); - case KLocale::MinguoCalendar: -- return new KCalendarSystemMinguo( config, locale ); -+ return new KCalendarSystemMinguo(config, locale); - case KLocale::ThaiCalendar: -- return new KCalendarSystemThai( config, locale ); -+ return new KCalendarSystemThai(config, locale); - default: -- return new KCalendarSystemGregorian( config, locale ); -+ return new KCalendarSystemQDate(config, locale); - } - } - -@@ -126,90 +127,127 @@ QList<KLocale::CalendarSystem> KCalendarSystem::calendarSystemsList() - { - QList<KLocale::CalendarSystem> list; - -- list.append( KLocale::QDateCalendar ); -- list.append( KLocale::CopticCalendar ); -- list.append( KLocale::EthiopianCalendar ); -- list.append( KLocale::GregorianCalendar ); -- list.append( KLocale::HebrewCalendar ); -- list.append( KLocale::IslamicCivilCalendar ); -- list.append( KLocale::IndianNationalCalendar ); -- list.append( KLocale::JalaliCalendar ); -- list.append( KLocale::JapaneseCalendar ); -- list.append( KLocale::JulianCalendar ); -- list.append( KLocale::MinguoCalendar ); -- list.append( KLocale::ThaiCalendar ); -+ list.append(KLocale::QDateCalendar); -+ list.append(KLocale::CopticCalendar); -+ list.append(KLocale::EthiopianCalendar); -+ list.append(KLocale::GregorianCalendar); -+ list.append(KLocale::HebrewCalendar); -+ list.append(KLocale::IslamicCivilCalendar); -+ list.append(KLocale::IndianNationalCalendar); -+ list.append(KLocale::JalaliCalendar); -+ list.append(KLocale::JapaneseCalendar); -+ list.append(KLocale::JulianCalendar); -+ list.append(KLocale::MinguoCalendar); -+ list.append(KLocale::ThaiCalendar); - - return list; - } - --QString KCalendarSystem::calendarLabel( KLocale::CalendarSystem calendarSystem, const KLocale *locale ) -+QString KCalendarSystem::calendarLabel(KLocale::CalendarSystem calendarSystem, const KLocale *locale) - { -- switch ( calendarSystem ) { -+ switch (calendarSystem) { - case KLocale::QDateCalendar: -- return ki18nc( "@item Calendar system", "Gregorian" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Gregorian").toString(locale); - case KLocale::CopticCalendar: -- return ki18nc( "@item Calendar system", "Coptic" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Coptic").toString(locale); - case KLocale::EthiopianCalendar: -- return ki18nc( "@item Calendar system", "Ethiopian" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Ethiopian").toString(locale); - case KLocale::GregorianCalendar: -- return ki18nc( "@item Calendar system", "Gregorian (Proleptic)" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Gregorian (Proleptic)").toString(locale); - case KLocale::HebrewCalendar: -- return ki18nc( "@item Calendar system", "Hebrew" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Hebrew").toString(locale); - case KLocale::IslamicCivilCalendar: -- return ki18nc( "@item Calendar system", "Islamic / Hijri (Civil)" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Islamic / Hijri (Civil)").toString(locale); - case KLocale::IndianNationalCalendar: -- return ki18nc( "@item Calendar system", "Indian National" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Indian National").toString(locale); - case KLocale::JalaliCalendar: -- return ki18nc( "@item Calendar system", "Jalali" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Jalali").toString(locale); - case KLocale::JapaneseCalendar: -- return ki18nc( "@item Calendar system", "Japanese" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Japanese").toString(locale); - case KLocale::JulianCalendar: -- return ki18nc( "@item Calendar system", "Julian" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Julian").toString(locale); - case KLocale::MinguoCalendar: -- return ki18nc( "@item Calendar system", "Taiwanese" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Taiwanese").toString(locale); - case KLocale::ThaiCalendar: -- return ki18nc( "@item Calendar system", "Thai" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Thai").toString(locale); - } - -- return ki18nc( "@item Calendar system", "Invalid Calendar Type" ).toString( locale ); -+ return ki18nc("@item Calendar system", "Invalid Calendar Type").toString(locale); - } - --KLocale::CalendarSystem KCalendarSystem::calendarSystemForCalendarType( const QString &calendarType ) -+KLocale::CalendarSystem KCalendarSystem::calendarSystemForCalendarType(const QString &calendarType ) - { -- if ( calendarType == QLatin1String( "coptic" ) ) { -+ return calendarSystem( calendarType ); -+} -+ -+KLocale::CalendarSystem KCalendarSystem::calendarSystem(const QString &calendarType ) -+{ -+ if (calendarType == QLatin1String("coptic")) { - return KLocale::CopticCalendar; -- } else if ( calendarType == QLatin1String( "ethiopian" ) ) { -+ } else if (calendarType == QLatin1String("ethiopian")) { - return KLocale::EthiopianCalendar; -- } else if ( calendarType == QLatin1String( "gregorian" ) ) { -+ } else if (calendarType == QLatin1String("gregorian")) { - return KLocale::QDateCalendar; -- } else if ( calendarType == QLatin1String( "gregorian-proleptic" ) ) { -+ } else if (calendarType == QLatin1String("gregorian-proleptic")) { - return KLocale::GregorianCalendar; -- } else if ( calendarType == QLatin1String( "hebrew" ) ) { -+ } else if (calendarType == QLatin1String("hebrew")) { - return KLocale::HebrewCalendar; -- } else if ( calendarType == QLatin1String( "hijri" ) ) { -+ } else if (calendarType == QLatin1String("hijri")) { - return KLocale::IslamicCivilCalendar; -- } else if ( calendarType == QLatin1String( "indian-national" ) ) { -+ } else if (calendarType == QLatin1String("indian-national")) { - return KLocale::IndianNationalCalendar; -- } else if ( calendarType == QLatin1String( "jalali" ) ) { -+ } else if (calendarType == QLatin1String("jalali")) { - return KLocale::JalaliCalendar; -- } else if ( calendarType == QLatin1String( "japanese" ) ) { -+ } else if (calendarType == QLatin1String("japanese")) { - return KLocale::JapaneseCalendar; -- } else if ( calendarType == QLatin1String( "julian" ) ) { -+ } else if (calendarType == QLatin1String("julian")) { - return KLocale::JulianCalendar; -- } else if ( calendarType == QLatin1String( "minguo" ) ) { -+ } else if (calendarType == QLatin1String("minguo")) { - return KLocale::MinguoCalendar; -- } else if ( calendarType == QLatin1String( "thai" ) ) { -+ } else if (calendarType == QLatin1String("thai")) { - return KLocale::ThaiCalendar; - } else { - return KLocale::QDateCalendar; - } - } - -+QString KCalendarSystem::calendarType(KLocale::CalendarSystem calendarSystem) -+{ -+ if (calendarSystem == KLocale::QDateCalendar) { -+ return QLatin1String("gregorian"); -+ } else if (calendarSystem == KLocale::CopticCalendar) { -+ return QLatin1String("coptic"); -+ } else if (calendarSystem == KLocale::EthiopianCalendar) { -+ return QLatin1String("ethiopian"); -+ } else if (calendarSystem == KLocale::GregorianCalendar) { -+ return QLatin1String("gregorian-proleptic"); -+ } else if (calendarSystem == KLocale::HebrewCalendar) { -+ return QLatin1String("hebrew"); -+ } else if (calendarSystem == KLocale::IndianNationalCalendar) { -+ return QLatin1String("indian-national"); -+ } else if (calendarSystem == KLocale::IslamicCivilCalendar) { -+ return QLatin1String("hijri"); -+ } else if (calendarSystem == KLocale::JalaliCalendar) { -+ return QLatin1String("jalali"); -+ } else if (calendarSystem == KLocale::JapaneseCalendar) { -+ return QLatin1String("japanese"); -+ } else if (calendarSystem == KLocale::JulianCalendar) { -+ return QLatin1String("julian"); -+ } else if (calendarSystem == KLocale::MinguoCalendar) { -+ return QLatin1String("minguo"); -+ } else if (calendarSystem == KLocale::ThaiCalendar) { -+ return QLatin1String("thai"); -+ } else { -+ return QLatin1String("gregorian"); -+ } -+} -+ - // Shared d pointer base class definitions - --KCalendarSystemPrivate::KCalendarSystemPrivate( KCalendarSystem *q_ptr ): q( q_ptr ), -- m_eraList( 0 ), -- m_shortYearWindowStartYear( 2000 ) -+KCalendarSystemPrivate::KCalendarSystemPrivate(KCalendarSystem *q_ptr) -+ : q(q_ptr), -+ m_eraList(0), -+ m_shortYearWindowStartYear(2000) - { - } - -@@ -230,31 +268,31 @@ KLocale::CalendarSystem KCalendarSystemPrivate::calendarSystem() const - // This method MUST be re-implemented in any new Calendar System - void KCalendarSystemPrivate::loadDefaultEraList() - { -- addEra( '-', 1, q->epoch().addDays( -1 ), -1, q->earliestValidDate(), QLatin1String("Before KDE"), QLatin1String("BK"), QLatin1String("%Ey %EC") ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), QLatin1String("Anno KDE"), QLatin1String("AK"), QLatin1String("%Ey %EC") ); -+ addEra('-', 1, q->epoch().addDays(-1), -1, q->earliestValidDate(), QLatin1String("Before KDE"), QLatin1String("BK"), QLatin1String("%Ey %EC")); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), QLatin1String("Anno KDE"), QLatin1String("AK"), QLatin1String("%Ey %EC")); - } - - // Dummy version using Gregorian as an example - // This method MUST be re-implemented in any new Calendar System --int KCalendarSystemPrivate::monthsInYear( int year ) const -+int KCalendarSystemPrivate::monthsInYear(int year) const - { -- Q_UNUSED( year ) -+ Q_UNUSED(year) - return 12; - } - - // Dummy version using Gregorian as an example - // This method MUST be re-implemented in any new Calendar System --int KCalendarSystemPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemPrivate::daysInMonth(int year, int month) const - { -- if ( month == 2 ) { -- if ( isLeapYear( year ) ) { -+ if (month == 2) { -+ if (isLeapYear(year)) { - return 29; - } else { - return 28; - } - } - -- if ( month == 4 || month == 6 || month == 9 || month == 11 ) { -+ if (month == 4 || month == 6 || month == 9 || month == 11) { - return 30; - } - -@@ -263,9 +301,9 @@ int KCalendarSystemPrivate::daysInMonth( int year, int month ) const - - // Dummy version using Gregorian as an example - // This method MUST be re-implemented in any new Calendar System --int KCalendarSystemPrivate::daysInYear( int year ) const -+int KCalendarSystemPrivate::daysInYear(int year) const - { -- if ( isLeapYear( year ) ) { -+ if (isLeapYear(year)) { - return 366; - } else { - return 365; -@@ -281,16 +319,16 @@ int KCalendarSystemPrivate::daysInWeek() const - - // Dummy version using Gregorian as an example - // This method MUST be re-implemented in any new Calendar System --bool KCalendarSystemPrivate::isLeapYear( int year ) const -+bool KCalendarSystemPrivate::isLeapYear(int year) const - { -- if ( year < 1 ) { -+ if (year < 1) { - year = year + 1; - } - -- if ( year % 4 == 0 ) { -- if ( year % 100 != 0 ) { -+ if (year % 4 == 0) { -+ if (year % 100 != 0) { - return true; -- } else if ( year % 400 == 0 ) { -+ } else if (year % 400 == 0) { - return true; - } - } -@@ -346,120 +384,120 @@ int KCalendarSystemPrivate::latestValidYear() const - - // Dummy version - // This method MUST be re-implemented in any new Calendar System --QString KCalendarSystemPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( month ); -- Q_UNUSED( year ); -- Q_UNUSED( format ); -- Q_UNUSED( possessive ); -+ Q_UNUSED(month); -+ Q_UNUSED(year); -+ Q_UNUSED(format); -+ Q_UNUSED(possessive); - return QString(); - } - - // Dummy version - // This method MUST be re-implemented in any new Calendar System --QString KCalendarSystemPrivate::weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const -+QString KCalendarSystemPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- Q_UNUSED( weekDay ); -- Q_UNUSED( format ); -+ Q_UNUSED(weekDay); -+ Q_UNUSED(format); - return QString(); - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::week( const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum ) const -+int KCalendarSystemPrivate::week(const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum) const - { - int y, m, d; -- q->julianDayToDate( date.toJulianDay(), y, m, d ); -+ q->julianDayToDate(date.toJulianDay(), y, m, d); - -- switch ( weekNumberSystem ) { -+ switch (weekNumberSystem) { - case KLocale::IsoWeekNumber: -- return isoWeekNumber( date, yearNum ); -+ return isoWeekNumber(date, yearNum); - case KLocale::FirstFullWeek: -- return regularWeekNumber( date, locale()->weekStartDay(), 0, yearNum ); -+ return regularWeekNumber(date, locale()->weekStartDay(), 0, yearNum); - case KLocale::FirstPartialWeek: -- return regularWeekNumber( date, locale()->weekStartDay(), 1, yearNum ); -+ return regularWeekNumber(date, locale()->weekStartDay(), 1, yearNum); - case KLocale::SimpleWeek: -- return simpleWeekNumber( date, yearNum ); -+ return simpleWeekNumber(date, yearNum); - case KLocale::DefaultWeekNumber: - default: -- return week( date, locale()->weekNumberSystem(), yearNum ); -+ return week(date, locale()->weekNumberSystem(), yearNum); - } - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::isoWeekNumber( const QDate &date, int *yearNum ) const -+int KCalendarSystemPrivate::isoWeekNumber(const QDate &date, int *yearNum) const - { - int y, m, d; -- q->julianDayToDate( date.toJulianDay(), y, m, d ); -+ q->julianDayToDate(date.toJulianDay(), y, m, d); - - QDate firstDayWeek1, lastDay; - int week; - int weekDay1, dayOfWeek1InYear; - - // let's guess 1st day of 1st week -- firstDayWeek1 = firstDayOfYear( y ); -- weekDay1 = dayOfWeek( firstDayWeek1 ); -+ firstDayWeek1 = firstDayOfYear(y); -+ weekDay1 = dayOfWeek(firstDayWeek1); - - // 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 -+ if (weekDay1 > 4 /*Thursday*/) { -+ firstDayWeek1 = q->addDays(firstDayWeek1 , daysInWeek() - weekDay1 + 1); // next monday - } - -- dayOfWeek1InYear = dayOfYear( firstDayWeek1 ); -+ dayOfWeek1InYear = dayOfYear(firstDayWeek1); - - // our date in prev year's week -- if ( dayOfYear( date ) < dayOfWeek1InYear ) { -- if ( yearNum ) { -- *yearNum = addYears( y, - 1 ); -+ if (dayOfYear(date) < dayOfWeek1InYear) { -+ if (yearNum) { -+ *yearNum = addYears(y, - 1); - } -- return isoWeeksInYear( addYears( y, - 1 ) ); -+ return isoWeeksInYear(addYears(y, - 1)); - } - - // let's check if its last week belongs to next year -- lastDay = lastDayOfYear( y ); -+ lastDay = lastDayOfYear(y); - - // if our date is in last week && 1st week in next year has thursday -- if ( ( dayOfYear( date ) >= daysInYear( y ) - dayOfWeek( lastDay ) + 1 ) -- && dayOfWeek( lastDay ) < 4 ) { -- if ( yearNum ) { -- * yearNum = addYears( y, 1 ); -+ if ((dayOfYear(date) >= daysInYear(y) - dayOfWeek(lastDay) + 1) -+ && dayOfWeek(lastDay) < 4) { -+ if (yearNum) { -+ * yearNum = addYears(y, 1); - } - week = 1; - } else { - // To calculate properly the number of weeks from day a to x let's make a day 1 of week -- if( weekDay1 < 5 ) { -- firstDayWeek1 = q->addDays( firstDayWeek1, -( weekDay1 - 1 ) ); -+ if (weekDay1 < 5) { -+ firstDayWeek1 = q->addDays(firstDayWeek1, -(weekDay1 - 1)); - } - -- if ( yearNum ) { -+ if (yearNum) { - * yearNum = y; - } - -- week = firstDayWeek1.daysTo( date ) / daysInWeek() + 1; -+ week = firstDayWeek1.daysTo(date) / daysInWeek() + 1; - } - - return week; - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::regularWeekNumber( const QDate &date, int weekStartDay, int firstWeekNumber, int *weekYear ) const -+int KCalendarSystemPrivate::regularWeekNumber(const QDate &date, int weekStartDay, int firstWeekNumber, int *weekYear) const - { - int y, m, d; -- q->julianDayToDate( date.toJulianDay(), y, m, d ); -+ q->julianDayToDate(date.toJulianDay(), y, m, d); - -- int firstWeekDayOffset = ( dayOfWeek( date ) - weekStartDay + daysInWeek() ) % daysInWeek(); -- int dayInYear = date.toJulianDay() - firstDayOfYear( y ).toJulianDay(); // 0 indexed -- int week = ( ( dayInYear - firstWeekDayOffset + daysInWeek() ) / daysInWeek() ); -+ int firstWeekDayOffset = (dayOfWeek(date) - weekStartDay + daysInWeek()) % daysInWeek(); -+ int dayInYear = date.toJulianDay() - firstDayOfYear(y).toJulianDay(); // 0 indexed -+ int week = ((dayInYear - firstWeekDayOffset + daysInWeek()) / daysInWeek()); - -- if ( dayOfWeek( firstDayOfYear( y ) ) != weekStartDay ) { -+ if (dayOfWeek(firstDayOfYear(y)) != weekStartDay) { - week = week + firstWeekNumber; - } - -- if ( week < 1 ) { -+ if (week < 1) { - y = y - 1; -- week = regularWeeksInYear( y, weekStartDay, firstWeekNumber ); -+ week = regularWeeksInYear(y, weekStartDay, firstWeekNumber); - } - -- if ( weekYear ) { -+ if (weekYear) { - *weekYear = y; - } - -@@ -467,67 +505,67 @@ int KCalendarSystemPrivate::regularWeekNumber( const QDate &date, int weekStartD - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::simpleWeekNumber( const QDate &date, int *yearNum ) const -+int KCalendarSystemPrivate::simpleWeekNumber(const QDate &date, int *yearNum) const - { - int y, m, d; -- q->julianDayToDate( date.toJulianDay(), y, m, d ); -- if ( yearNum ) { -+ q->julianDayToDate(date.toJulianDay(), y, m, d); -+ if (yearNum) { - *yearNum = y; - } -- return ( ( date.toJulianDay() - firstDayOfYear( y ).toJulianDay() ) / daysInWeek() ) + 1; -+ return ((date.toJulianDay() - firstDayOfYear(y).toJulianDay()) / daysInWeek()) + 1; - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::weeksInYear( int year, KLocale::WeekNumberSystem weekNumberSystem ) const -+int KCalendarSystemPrivate::weeksInYear(int year, KLocale::WeekNumberSystem weekNumberSystem) const - { -- switch ( weekNumberSystem ) { -+ switch (weekNumberSystem) { - case KLocale::IsoWeekNumber: -- return isoWeeksInYear( year ); -+ return isoWeeksInYear(year); - case KLocale::FirstFullWeek: -- return regularWeeksInYear( year, locale()->weekStartDay(), 0 ); -+ return regularWeeksInYear(year, locale()->weekStartDay(), 0); - case KLocale::FirstPartialWeek: -- return regularWeeksInYear( year, locale()->weekStartDay(), 1 ); -+ return regularWeeksInYear(year, locale()->weekStartDay(), 1); - case KLocale::SimpleWeek: -- return simpleWeeksInYear( year ); -+ return simpleWeeksInYear(year); - case KLocale::DefaultWeekNumber: - default: -- return weeksInYear( year, locale()->weekNumberSystem() ); -+ return weeksInYear(year, locale()->weekNumberSystem()); - } - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::isoWeeksInYear( int year ) const -+int KCalendarSystemPrivate::isoWeeksInYear(int year) const - { -- QDate lastDayOfThisYear = lastDayOfYear( year ); -+ QDate lastDayOfThisYear = lastDayOfYear(year); - - int weekYear = year; -- int lastWeekInThisYear = isoWeekNumber( lastDayOfThisYear, &weekYear ); -+ int lastWeekInThisYear = isoWeekNumber(lastDayOfThisYear, &weekYear); - - // If error, or the last day of the year is in the first week of next year use the week before -- if ( lastWeekInThisYear < 1 || weekYear != year ) { -- lastWeekInThisYear = isoWeekNumber( q->addDays( lastDayOfThisYear, -7 ), &weekYear ); -+ if (lastWeekInThisYear < 1 || weekYear != year) { -+ lastWeekInThisYear = isoWeekNumber(q->addDays(lastDayOfThisYear, -7), &weekYear); - } - - return lastWeekInThisYear; - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::regularWeeksInYear( int year, int weekStartDay, int firstWeekNumber ) const -+int KCalendarSystemPrivate::regularWeeksInYear(int year, int weekStartDay, int firstWeekNumber) const - { -- return regularWeekNumber( lastDayOfYear( year ), weekStartDay, firstWeekNumber, 0 ); -+ return regularWeekNumber(lastDayOfYear(year), weekStartDay, firstWeekNumber, 0); - } - - // Reimplement if special maths handling required, e.g. Hebrew. --int KCalendarSystemPrivate::simpleWeeksInYear( int year ) const -+int KCalendarSystemPrivate::simpleWeeksInYear(int year) const - { -- return simpleWeekNumber( lastDayOfYear( year ), 0 ); -+ return simpleWeekNumber(lastDayOfYear(year), 0); - } - - // Reimplement if special maths handling required, e.g. Hebrew. - // Works for calendars with constant number of months, or where leap month is last month of year - // Will not work for Hebrew or others where leap month is inserted in middle of year --void KCalendarSystemPrivate::dateDifference( const QDate &fromDate, const QDate &toDate, -- int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction ) const -+void KCalendarSystemPrivate::dateDifference(const QDate &fromDate, const QDate &toDate, -+ int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const - { - // This could be optimised a little but is left in full as it's easier to understand - int dy = 0; -@@ -535,171 +573,171 @@ void KCalendarSystemPrivate::dateDifference( const QDate &fromDate, const QDate - int dd = 0; - int dir = 1; - -- if ( toDate < fromDate ) { -- dateDifference( toDate, fromDate, &dy, &dm, &dd, 0 ); -+ if (toDate < fromDate) { -+ dateDifference(toDate, fromDate, &dy, &dm, &dd, 0); - dir = -1; -- } else if ( toDate > fromDate ) { -+ } else if (toDate > fromDate) { - -- int fromYear = q->year( fromDate ); -- int toYear = q->year( toDate ); -- int fromMonth = q->month( fromDate ); -- int toMonth = q->month( toDate ); -- int fromDay = q->day( fromDate ); -- int toDay = q->day( toDate ); -+ int fromYear = q->year(fromDate); -+ int toYear = q->year(toDate); -+ int fromMonth = q->month(fromDate); -+ int toMonth = q->month(toDate); -+ int fromDay = q->day(fromDate); -+ int toDay = q->day(toDate); - -- int monthsInPrevYear = monthsInYear( addYears( toYear, -1 ) ); -- int daysInPrevMonth = q->daysInMonth( q->addMonths( toDate, -1 ) ); -- int daysInFromMonth = daysInMonth( fromYear, fromMonth ); -- int daysInToMonth = daysInMonth( toYear, toMonth ); -+ int monthsInPrevYear = monthsInYear(addYears(toYear, -1)); -+ int daysInPrevMonth = q->daysInMonth(q->addMonths(toDate, -1)); -+ int daysInFromMonth = daysInMonth(fromYear, fromMonth); -+ int daysInToMonth = daysInMonth(toYear, toMonth); - - // Calculate years difference -- if ( toYear == fromYear ) { -+ if (toYear == fromYear) { - dy = 0; -- } else if ( toMonth > fromMonth ) { -- dy = differenceYearNumbers( fromYear, toYear ); -- } else if ( toMonth < fromMonth ) { -- dy = differenceYearNumbers( fromYear, toYear ) - 1; -+ } else if (toMonth > fromMonth) { -+ dy = differenceYearNumbers(fromYear, toYear); -+ } else if (toMonth < fromMonth) { -+ dy = differenceYearNumbers(fromYear, toYear) - 1; - } else { // toMonth == fromMonth - // Allow for last day of month to last day of month and leap days - // e.g. 2000-02-29 to 2001-02-28 is 1 year not 0 years -- if ( ( toDay >= fromDay ) || ( fromDay == daysInFromMonth && toDay == daysInToMonth ) ) { -- dy = differenceYearNumbers( fromYear, toYear ); -+ if ((toDay >= fromDay) || (fromDay == daysInFromMonth && toDay == daysInToMonth)) { -+ dy = differenceYearNumbers(fromYear, toYear); - } else { -- dy = differenceYearNumbers( fromYear, toYear ) - 1; -+ dy = differenceYearNumbers(fromYear, toYear) - 1; - } - } - - // Calculate months and days difference -- if ( toDay >= fromDay ) { -- dm = ( monthsInPrevYear + toMonth - fromMonth ) % monthsInPrevYear; -+ if (toDay >= fromDay) { -+ dm = (monthsInPrevYear + toMonth - fromMonth) % monthsInPrevYear; - dd = toDay - fromDay; - } else { // toDay < fromDay - // Allow for last day of month to last day of month and leap days - // e.g. 2010-03-31 to 2010-04-30 is 1 month - // 2000-02-29 to 2001-02-28 is 1 year - // 2000-02-29 to 2001-03-01 is 1 year 1 day -- int prevMonth = q->month( q->addMonths( toDate, -1 ) ); -- if ( fromDay == daysInFromMonth && toDay == daysInToMonth ) { -- dm = ( monthsInPrevYear + toMonth - fromMonth ) % monthsInPrevYear; -+ int prevMonth = q->month(q->addMonths(toDate, -1)); -+ if (fromDay == daysInFromMonth && toDay == daysInToMonth) { -+ dm = (monthsInPrevYear + toMonth - fromMonth) % monthsInPrevYear; - dd = 0; -- } else if ( prevMonth == fromMonth && daysInPrevMonth < daysInFromMonth ) { -+ } else if (prevMonth == fromMonth && daysInPrevMonth < daysInFromMonth) { - // Special case where fromDate = leap day and toDate in month following but non-leap year - // e.g. 2000-02-29 to 2001-03-01 needs to use 29 to calculate day number not 28 -- dm = ( monthsInPrevYear + toMonth - fromMonth - 1 ) % monthsInPrevYear; -- dd = ( daysInFromMonth + toDay - fromDay ) % daysInFromMonth; -+ dm = (monthsInPrevYear + toMonth - fromMonth - 1) % monthsInPrevYear; -+ dd = (daysInFromMonth + toDay - fromDay) % daysInFromMonth; - } else { -- dm = ( monthsInPrevYear + toMonth - fromMonth - 1 ) % monthsInPrevYear; -- dd = ( daysInPrevMonth + toDay - fromDay ) % daysInPrevMonth; -+ dm = (monthsInPrevYear + toMonth - fromMonth - 1) % monthsInPrevYear; -+ dd = (daysInPrevMonth + toDay - fromDay) % daysInPrevMonth; - } - } - - } - - // Only return values if we have a valid pointer -- if ( yearsDiff ) { -+ if (yearsDiff) { - *yearsDiff = dy; - } -- if ( monthsDiff ) { -+ if (monthsDiff) { - *monthsDiff = dm; - } -- if ( daysDiff ) { -+ if (daysDiff) { - *daysDiff = dd; - } -- if ( direction ) { -+ if (direction) { - *direction = dir; - } - } - - // Reimplement if special maths handling required, e.g. Hebrew - // Allows for calendars with leap months at end of year but not during year --int KCalendarSystemPrivate::yearsDifference( const QDate &fromDate, const QDate &toDate ) const -+int KCalendarSystemPrivate::yearsDifference(const QDate &fromDate, const QDate &toDate) const - { - // This could be optimised a little but is left in full as it's easier to understand - // Alternatively could just call dateDifference(), but this is slightly more efficient - -- if ( toDate < fromDate ) { -- return 0 - yearsDifference( toDate, fromDate ); -+ if (toDate < fromDate) { -+ return 0 - yearsDifference(toDate, fromDate); - } - -- if ( toDate == fromDate ) { -+ if (toDate == fromDate) { - return 0; - } - -- int fromYear = q->year( fromDate ); -- int toYear = q->year( toDate ); -+ int fromYear = q->year(fromDate); -+ int toYear = q->year(toDate); - -- if ( toYear == fromYear ) { -+ if (toYear == fromYear) { - return 0; - } - -- int fromMonth = q->month( fromDate ); -- int toMonth = q->month( toDate ); -+ int fromMonth = q->month(fromDate); -+ int toMonth = q->month(toDate); - -- if ( toMonth > fromMonth ) { -- return differenceYearNumbers( fromYear, toYear ); -+ if (toMonth > fromMonth) { -+ return differenceYearNumbers(fromYear, toYear); - } - -- if ( toMonth < fromMonth ) { -- return differenceYearNumbers( fromYear, toYear ) - 1; -+ if (toMonth < fromMonth) { -+ return differenceYearNumbers(fromYear, toYear) - 1; - } - - // toMonth == fromMonth -- int fromDay = q->day( fromDate ); -- int toDay = q->day( toDate ); -+ int fromDay = q->day(fromDate); -+ int toDay = q->day(toDate); - - // Adjust for month numbers in from and to year - // Allow for last day of month to last day of month and leap days - // e.g. 2000-02-29 to 2001-02-28 is 1 year not 0 years -- if ( ( toDay >= fromDay ) || -- ( fromDay == daysInMonth( fromYear, fromMonth ) && -- toDay == daysInMonth( toYear, toMonth ) ) ) { -- return differenceYearNumbers( fromYear, toYear ); -+ if ((toDay >= fromDay) || -+ (fromDay == daysInMonth(fromYear, fromMonth) && -+ toDay == daysInMonth(toYear, toMonth))) { -+ return differenceYearNumbers(fromYear, toYear); - } else { -- return differenceYearNumbers( fromYear, toYear ) - 1; -+ return differenceYearNumbers(fromYear, toYear) - 1; - } - - } - - // Reimplement if special maths handling required, e.g. maybe Hebrew? - // Allows for calendars with leap months --int KCalendarSystemPrivate::monthsDifference( const QDate &fromDate, const QDate &toDate ) const -+int KCalendarSystemPrivate::monthsDifference(const QDate &fromDate, const QDate &toDate) const - { -- if ( toDate < fromDate ) { -- return 0 - monthsDifference( toDate, fromDate ); -+ if (toDate < fromDate) { -+ return 0 - monthsDifference(toDate, fromDate); - } - -- if ( toDate == fromDate ) { -+ if (toDate == fromDate) { - return 0; - } - -- int fromYear = q->year( fromDate ); -- int toYear = q->year( toDate ); -- int fromMonth = q->month( fromDate ); -- int toMonth = q->month( toDate ); -- int fromDay = q->day( fromDate ); -- int toDay = q->day( toDate ); -+ int fromYear = q->year(fromDate); -+ int toYear = q->year(toDate); -+ int fromMonth = q->month(fromDate); -+ int toMonth = q->month(toDate); -+ int fromDay = q->day(fromDate); -+ int toDay = q->day(toDate); - - int monthsInPreceedingYears; - - // Calculate number of months in full years preceding toYear -- if ( toYear == fromYear ) { -+ if (toYear == fromYear) { - monthsInPreceedingYears = 0; -- } else if ( hasLeapMonths() ) { -+ } else if (hasLeapMonths()) { - monthsInPreceedingYears = 0; -- for ( int y = fromYear; y < toYear; y = addYears( y, 1 ) ) { -- monthsInPreceedingYears = monthsInPreceedingYears + monthsInYear( y ); -+ for (int y = fromYear; y < toYear; y = addYears(y, 1)) { -+ monthsInPreceedingYears = monthsInPreceedingYears + monthsInYear(y); - } - } else { -- monthsInPreceedingYears = differenceYearNumbers( fromYear, toYear ) * monthsInYear( toYear ); -+ monthsInPreceedingYears = differenceYearNumbers(fromYear, toYear) * monthsInYear(toYear); - } - - // Adjust for months in from and to year - // Allow for last day of month to last day of month and leap days - // e.g. 2010-03-31 to 2010-04-30 is 1 month not 0 months - // also 2000-02-29 to 2001-02-28 is 12 months not 11 months -- if ( ( toDay >= fromDay ) || -- ( fromDay == daysInMonth( fromYear, fromMonth ) && -- toDay == daysInMonth( toYear, toMonth ) ) ) { -+ if ((toDay >= fromDay) || -+ (fromDay == daysInMonth(fromYear, fromMonth) && -+ toDay == daysInMonth(toYear, toMonth))) { - return monthsInPreceedingYears + toMonth - fromMonth; - } else { - return monthsInPreceedingYears + toMonth - fromMonth - 1; -@@ -709,26 +747,26 @@ int KCalendarSystemPrivate::monthsDifference( const QDate &fromDate, const QDate - // Reimplement if special string to integer handling required, e.g. Hebrew. - // Peel a number off the front of a string which may have other trailing chars after the number - // Stop either at either maxLength, eos, or first non-digit char --int KCalendarSystemPrivate::integerFromString( const QString &string, int maxLength, int &readLength ) const -+int KCalendarSystemPrivate::integerFromString(const QString &string, int maxLength, int &readLength) const - { - int value = -1; - int position = 0; - readLength = 0; - bool ok = false; - -- if ( maxLength < 0 ) { -+ if (maxLength < 0) { - maxLength = string.length(); - } - -- while ( position < string.length() && -+ while (position < string.length() && - position < maxLength && -- string.at( position ).isDigit() ) { -+ string.at(position).isDigit()) { - position++; - } - -- if ( position > 0 ) { -- value = string.left( position ).toInt( &ok ); -- if ( ok ) { -+ if (position > 0) { -+ value = string.left(position).toInt(&ok); -+ if (ok) { - readLength = position; - } else { - value = -1; -@@ -740,41 +778,41 @@ int KCalendarSystemPrivate::integerFromString( const QString &string, int maxLen - - // Reimplement if special integer to string handling required, e.g. Hebrew. - // Utility to convert an integer into the correct display string form --QString KCalendarSystemPrivate::stringFromInteger( int number, int padWidth, QChar padChar ) const -+QString KCalendarSystemPrivate::stringFromInteger(int number, int padWidth, QChar padChar) const - { -- return stringFromInteger( number, padWidth, padChar, q->locale()->dateTimeDigitSet() ); -+ return stringFromInteger(number, padWidth, padChar, q->locale()->dateTimeDigitSet()); - } - - // Reimplement if special integer to string handling required, e.g. Hebrew. - // Utility to convert an integer into the correct display string form --QString KCalendarSystemPrivate::stringFromInteger( int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet ) const -+QString KCalendarSystemPrivate::stringFromInteger(int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet) const - { -- if ( padChar == QLatin1Char('\0') || padWidth == 0 ) { -- return q->locale()->convertDigits( QString::number( number ), digitSet ); -+ if (padChar == QLatin1Char('\0') || padWidth == 0) { -+ return q->locale()->convertDigits(QString::number(number), digitSet); - } else { -- return q->locale()->convertDigits( QString::number( number ).rightJustified( padWidth, padChar ), digitSet ); -+ return q->locale()->convertDigits(QString::number(number).rightJustified(padWidth, padChar), digitSet); - } - } - - // Allows us to set dates outside publically valid range, USE WITH CARE!!!! --bool KCalendarSystemPrivate::setAnyDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemPrivate::setAnyDate(QDate &date, int year, int month, int day) const - { - int jd; -- q->dateToJulianDay( year, month, day, jd ); -- date = QDate::fromJulianDay( jd ); -+ q->dateToJulianDay(year, month, day, jd); -+ date = QDate::fromJulianDay(jd); - return true; - } - - // Utility to correctly add years to a year number because some systems such as - // Julian and Gregorian calendars don't have a year 0 --int KCalendarSystemPrivate::addYears( int originalYear, int addYears ) const -+int KCalendarSystemPrivate::addYears(int originalYear, int addYears) const - { - int newYear = originalYear + addYears; - -- if ( !hasYearZero() ) { -- if ( originalYear > 0 && newYear <= 0 ) { -+ if (!hasYearZero()) { -+ if (originalYear > 0 && newYear <= 0) { - newYear = newYear - 1; -- } else if ( originalYear < 0 && newYear >= 0 ) { -+ } else if (originalYear < 0 && newYear >= 0) { - newYear = newYear + 1; - } - } -@@ -784,14 +822,14 @@ int KCalendarSystemPrivate::addYears( int originalYear, int addYears ) const - - // Utility to correctly return number of years between two year numbers because some systems such as - // Julian and Gregorian calendars don't have a year 0 --int KCalendarSystemPrivate::differenceYearNumbers( int fromYear, int toYear ) const -+int KCalendarSystemPrivate::differenceYearNumbers(int fromYear, int toYear) const - { - int dy = toYear - fromYear; - -- if ( !hasYearZero() ) { -- if ( toYear > 0 && fromYear < 0 ) { -+ if (!hasYearZero()) { -+ if (toYear > 0 && fromYear < 0) { - dy = dy - 1; -- } else if ( toYear < 0 && fromYear > 0 ) { -+ } else if (toYear < 0 && fromYear > 0) { - dy = dy + 1; - } - } -@@ -805,71 +843,71 @@ QDate KCalendarSystemPrivate::invalidDate() const - return QDate(); - } - --QString KCalendarSystemPrivate::simpleDateString( const QString &str ) const -+QString KCalendarSystemPrivate::simpleDateString(const QString &str) const - { - QString newStr; -- for ( int i = 0; i < str.length(); i++ ) { -- if ( str.at(i).isLetterOrNumber() ) { -- newStr.append( str.at(i) ); -+ for (int i = 0; i < str.length(); i++) { -+ if (str.at(i).isLetterOrNumber()) { -+ newStr.append(str.at(i)); - } else { -- newStr.append( QLatin1Char(' ') ); -+ newStr.append(QLatin1Char(' ')); - } - } - newStr.simplified(); - return newStr; - } - --int KCalendarSystemPrivate::dayOfYear( const QDate &date ) const -+int KCalendarSystemPrivate::dayOfYear(const QDate &date) const - { - int y, m, d, jdFirstDayOfYear; -- q->julianDayToDate( date.toJulianDay(), y, m, d ); -- q->dateToJulianDay( y, 1, 1, jdFirstDayOfYear ); -+ q->julianDayToDate(date.toJulianDay(), y, m, d); -+ q->dateToJulianDay(y, 1, 1, jdFirstDayOfYear); - //Take the jd of the given date, and subtract the jd of the first day of that year -- return ( date.toJulianDay() - jdFirstDayOfYear + 1 ); -+ return (date.toJulianDay() - jdFirstDayOfYear + 1); - } - --int KCalendarSystemPrivate::dayOfWeek( const QDate &date ) const -+int KCalendarSystemPrivate::dayOfWeek(const QDate &date) const - { - // Makes assumption that Julian Day 0 was day 1 of week - // 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() % daysInWeek()) + 1); - } - --QDate KCalendarSystemPrivate::firstDayOfYear( int year ) const -+QDate KCalendarSystemPrivate::firstDayOfYear(int year) const - { - int jd; -- q->dateToJulianDay( year, 1, 1, jd ); -- return QDate::fromJulianDay( jd ); -+ q->dateToJulianDay(year, 1, 1, jd); -+ return QDate::fromJulianDay(jd); - } - --QDate KCalendarSystemPrivate::lastDayOfYear( int year ) const -+QDate KCalendarSystemPrivate::lastDayOfYear(int year) const - { - int jd; -- q->dateToJulianDay( year, 1, 1, jd ); -- jd = jd + daysInYear( year ) - 1; -- return QDate::fromJulianDay( jd ); -+ q->dateToJulianDay(year, 1, 1, jd); -+ jd = jd + daysInYear(year) - 1; -+ return QDate::fromJulianDay(jd); - } - --QDate KCalendarSystemPrivate::firstDayOfMonth( int year, int month ) const -+QDate KCalendarSystemPrivate::firstDayOfMonth(int year, int month) const - { - int jd; -- q->dateToJulianDay( year, month, 1, jd ); -- return QDate::fromJulianDay( jd ); -+ q->dateToJulianDay(year, month, 1, jd); -+ return QDate::fromJulianDay(jd); - } - --QDate KCalendarSystemPrivate::lastDayOfMonth( int year, int month ) const -+QDate KCalendarSystemPrivate::lastDayOfMonth(int year, int month) const - { - int jd; -- q->dateToJulianDay( year, month, 1, jd ); -- jd = jd + daysInMonth( year, month ) - 1; -- return QDate::fromJulianDay( jd ); -+ q->dateToJulianDay(year, month, 1, jd); -+ jd = jd + daysInMonth(year, month) - 1; -+ return QDate::fromJulianDay(jd); - } - - const KLocale * KCalendarSystemPrivate::locale() const - { -- if ( m_locale ) { -+ if (m_locale) { - return m_locale; - } else { - return KGlobal::locale(); -@@ -881,93 +919,93 @@ QList<KCalendarEra> *KCalendarSystemPrivate::eraList() const - return m_eraList; - } - --KCalendarEra KCalendarSystemPrivate::era( const QDate &eraDate ) const -+KCalendarEra KCalendarSystemPrivate::era(const QDate &eraDate) const - { -- for ( int i = m_eraList->count() -1; i >= 0; --i ) { -- if ( m_eraList->at( i ).isInEra( eraDate ) ) { -- return m_eraList->at( i ); -+ for (int i = m_eraList->count() - 1; i >= 0; --i) { -+ if (m_eraList->at(i).isInEra(eraDate)) { -+ return m_eraList->at(i); - } - } - return KCalendarEra(); - } - --KCalendarEra KCalendarSystemPrivate::era( const QString &eraName, int yearInEra ) const -+KCalendarEra KCalendarSystemPrivate::era(const QString &eraName, int yearInEra) const - { -- Q_UNUSED( yearInEra ) -+ Q_UNUSED(yearInEra) - -- for ( int i = m_eraList->count() - 1; i >= 0; --i ) { -- KCalendarEra era = m_eraList->at( i ); -- if ( era.name(KLocale::LongName).toLower() == eraName.toLower() || -- era.name(KLocale::ShortName).toLower() == eraName.toLower() ) { -+ for (int i = m_eraList->count() - 1; i >= 0; --i) { -+ KCalendarEra era = m_eraList->at(i); -+ if (era.name(KLocale::LongName).toLower() == eraName.toLower() || -+ era.name(KLocale::ShortName).toLower() == eraName.toLower()) { - return era; - } - } - return KCalendarEra(); - } - --void KCalendarSystemPrivate::loadEraList( const KConfigGroup & cg ) -+void KCalendarSystemPrivate::loadEraList(const KConfigGroup & cg) - { - delete m_eraList; - m_eraList = new QList<KCalendarEra>; - QString eraKey = QString::fromLatin1("Era1"); - int i = 1; -- while ( cg.hasKey( eraKey ) ) { -- QString eraEntry = cg.readEntry( eraKey, QString() ); -- if ( !eraEntry.isEmpty() ) { -+ while (cg.hasKey(eraKey)) { -+ QString eraEntry = cg.readEntry(eraKey, QString()); -+ if (!eraEntry.isEmpty()) { - // Based on LC_TIME, but different! - // Includes long and short names, uses ISO fomat dates - // e.g. +:1:0001-01-01:9999-12-31:Anno Domini:AD:%EC %Ey -- QChar direction = eraEntry.section( QLatin1Char(':'), 0, 0 ).at( 0 ); -+ QChar direction = eraEntry.section(QLatin1Char(':'), 0, 0).at(0); - QDate startDate, endDate; - int startYear; -- QString buffer = eraEntry.section( QLatin1Char(':'), 2, 2 ); -- if ( buffer.isEmpty() ) { -- if ( direction == QLatin1Char('-') ) { -+ QString buffer = eraEntry.section(QLatin1Char(':'), 2, 2); -+ if (buffer.isEmpty()) { -+ if (direction == QLatin1Char('-')) { - startDate = q->latestValidDate(); - } else { - startDate = q->earliestValidDate(); - } - } else { -- startDate = q->readDate( buffer, KLocale::IsoFormat ); -+ startDate = q->readDate(buffer, KLocale::IsoFormat); - } -- if ( q->isValid( startDate ) ) { -- startYear = q->year( startDate ); -+ if (q->isValid(startDate)) { -+ startYear = q->year(startDate); - } else { -- startYear = eraEntry.section( QLatin1Char(':'), 1, 1 ).toInt(); //Use offset -+ startYear = eraEntry.section(QLatin1Char(':'), 1, 1).toInt(); //Use offset - } - -- buffer = eraEntry.section( QLatin1Char(':'), 3, 3 ); -- if ( buffer.isEmpty() ) { -- if ( direction == QLatin1Char('-') ) { -+ buffer = eraEntry.section(QLatin1Char(':'), 3, 3); -+ if (buffer.isEmpty()) { -+ if (direction == QLatin1Char('-')) { - endDate = q->earliestValidDate(); - } else { - endDate = q->latestValidDate(); - } - } else { -- endDate = q->readDate( buffer, KLocale::IsoFormat ); -+ endDate = q->readDate(buffer, KLocale::IsoFormat); - } -- addEra( direction.toLatin1(), eraEntry.section( QLatin1Char(':'), 1, 1 ).toInt(), -- startDate, startYear, endDate, eraEntry.section( QLatin1Char(':'), 4, 4 ), -- eraEntry.section( QLatin1Char(':'), 5, 5 ), eraEntry.section( QLatin1Char(':'), 6 ) ); -+ addEra(direction.toLatin1(), eraEntry.section(QLatin1Char(':'), 1, 1).toInt(), -+ startDate, startYear, endDate, eraEntry.section(QLatin1Char(':'), 4, 4), -+ eraEntry.section(QLatin1Char(':'), 5, 5), eraEntry.section(QLatin1Char(':'), 6)); - } - ++i; - eraKey = QString::fromLatin1("Era%1").arg(i); - } - -- if ( m_eraList->isEmpty() ) { -+ if (m_eraList->isEmpty()) { - loadDefaultEraList(); - } - } - --void KCalendarSystemPrivate::addEra( char direction, int offset, -- const QDate &startDate, int startYear, const QDate &endDate, -- const QString &name, const QString &shortName, -- const QString &format ) -+void KCalendarSystemPrivate::addEra(char direction, int offset, -+ const QDate &startDate, int startYear, const QDate &endDate, -+ const QString &name, const QString &shortName, -+ const QString &format) - { - KCalendarEra newEra; - - newEra.m_sequence = m_eraList->count() + 1; -- if ( direction == '-' ) { -+ if (direction == '-') { - newEra.m_direction = -1; - } else { - newEra.m_direction = 1; -@@ -980,7 +1018,7 @@ void KCalendarSystemPrivate::addEra( char direction, int offset, - newEra.m_shortName = shortName; - newEra.m_format = format; - -- m_eraList->append( newEra ); -+ m_eraList->append(newEra); - } - - int KCalendarSystemPrivate::shortYearWindowStartYear() const -@@ -988,12 +1026,12 @@ int KCalendarSystemPrivate::shortYearWindowStartYear() const - return m_shortYearWindowStartYear; - } - --int KCalendarSystemPrivate::applyShortYearWindow( int inputYear ) const -+int KCalendarSystemPrivate::applyShortYearWindow(int inputYear) const - { -- if ( inputYear >= 0 && inputYear <= 99 ) { -+ if (inputYear >= 0 && inputYear <= 99) { - int shortStartYear = m_shortYearWindowStartYear % 100; - int yearOffset = m_shortYearWindowStartYear - shortStartYear; -- if ( inputYear >= shortStartYear ) { -+ if (inputYear >= shortStartYear) { - return inputYear + yearOffset; - } else { - return inputYear + yearOffset + 100; -@@ -1003,51 +1041,51 @@ int KCalendarSystemPrivate::applyShortYearWindow( int inputYear ) const - } - } - --void KCalendarSystemPrivate::loadShortYearWindowStartYear( const KConfigGroup & cg ) -+void KCalendarSystemPrivate::loadShortYearWindowStartYear(const KConfigGroup & cg) - { -- // Default to 2000 for backwards compatability -+ // Default to 2000 for backwards compatibility - // as that's the old readDate() default value - int startYear = 2000; -- if ( cg.exists() ) { -- startYear = cg.readEntry( "ShortYearWindowStartYear", 2000 ); -+ if (cg.exists()) { -+ startYear = cg.readEntry("ShortYearWindowStartYear", 2000); - } - m_shortYearWindowStartYear = startYear; - } - - KSharedConfig::Ptr KCalendarSystemPrivate::config() - { -- if ( m_config == KSharedConfig::Ptr() ) { -+ if (m_config == KSharedConfig::Ptr()) { - return KGlobal::config(); - } else { - return m_config; - } - } - --void KCalendarSystemPrivate::loadConfig( const QString & calendarType ) -+void KCalendarSystemPrivate::loadConfig(const QString & calendarType) - { -- KConfigGroup localeGroup( config(), QString::fromLatin1( "Locale" ) ); -- KConfigGroup calendarGroup = localeGroup.group( QString::fromLatin1( "KCalendarSystem %1" ).arg( calendarType ) ); -- loadEraList( calendarGroup ); -- loadShortYearWindowStartYear( calendarGroup ); -+ KConfigGroup localeGroup(config(), QString::fromLatin1("Locale")); -+ KConfigGroup calendarGroup = localeGroup.group(QString::fromLatin1("KCalendarSystem %1").arg(calendarType)); -+ loadEraList(calendarGroup); -+ loadShortYearWindowStartYear(calendarGroup); - } - - --KCalendarSystem::KCalendarSystem( const KLocale *locale ) -- : d_ptr( new KCalendarSystemPrivate( this ) ) -+KCalendarSystem::KCalendarSystem(const KLocale *locale) -+ : d_ptr(new KCalendarSystemPrivate(this)) - { - d_ptr->m_config = KSharedConfig::Ptr(); - d_ptr->m_locale = locale; - } - --KCalendarSystem::KCalendarSystem( const KSharedConfig::Ptr config, const KLocale *locale ) -- : d_ptr( new KCalendarSystemPrivate( this ) ) -+KCalendarSystem::KCalendarSystem(const KSharedConfig::Ptr config, const KLocale *locale) -+ : d_ptr(new KCalendarSystemPrivate(this)) - { - d_ptr->m_config = config; - d_ptr->m_locale = locale; - } - --KCalendarSystem::KCalendarSystem( KCalendarSystemPrivate &dd, const KSharedConfig::Ptr config, const KLocale *locale ) -- : d_ptr( &dd ) -+KCalendarSystem::KCalendarSystem(KCalendarSystemPrivate &dd, const KSharedConfig::Ptr config, const KLocale *locale) -+ : d_ptr(&dd) - { - d_ptr->m_config = config; - d_ptr->m_locale = locale; -@@ -1061,7 +1099,7 @@ KCalendarSystem::~KCalendarSystem() - // NOT VIRTUAL - If override needed use shared-d - KLocale::CalendarSystem KCalendarSystem::calendarSystem() const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - return d->calendarSystem(); - } -@@ -1069,14 +1107,14 @@ KLocale::CalendarSystem KCalendarSystem::calendarSystem() const - // NOT VIRTUAL - If override needed use shared-d - QString KCalendarSystem::calendarLabel() const - { -- return KCalendarSystem::calendarLabel( calendarSystem() ); -+ return KCalendarSystem::calendarLabel(calendarSystem()); - } - - // Dummy version using Gregorian as an example - // This method MUST be re-implemented in any new Calendar System - QDate KCalendarSystem::epoch() const - { -- return QDate::fromJulianDay( 38 ); -+ return QDate::fromJulianDay(38); - } - - QDate KCalendarSystem::earliestValidDate() const -@@ -1089,23 +1127,23 @@ QDate KCalendarSystem::earliestValidDate() const - QDate KCalendarSystem::latestValidDate() const - { - // Default to Gregorian 9999-12-31 -- return QDate::fromJulianDay( 5373484 ); -+ return QDate::fromJulianDay(5373484); - } - --bool KCalendarSystem::isValid( int year, int month, int day ) const -+bool KCalendarSystem::isValid(int year, int month, int day) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( year < d->earliestValidYear() || year > d->latestValidYear() || -- ( !d->hasYearZero() && year == 0 ) ) { -+ if (year < d->earliestValidYear() || year > d->latestValidYear() || -+ (!d->hasYearZero() && year == 0)) { - return false; - } - -- if ( month < 1 || month > d->monthsInYear( year ) ) { -+ if (month < 1 || month > d->monthsInYear(year)) { - return false; - } - -- if ( day < 1 || day > d->daysInMonth( year, month ) ) { -+ if (day < 1 || day > d->daysInMonth(year, month)) { - return false; - } - -@@ -1113,59 +1151,59 @@ bool KCalendarSystem::isValid( int year, int month, int day ) const - } - - // NOT VIRTUAL - If override needed use shared-d --bool KCalendarSystem::isValid( int year, int dayOfYear ) const -+bool KCalendarSystem::isValid(int year, int dayOfYear) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- return ( isValid( year, 1, 1 ) && dayOfYear > 0 && dayOfYear <= d->daysInYear( year ) ); -+ return (isValid(year, 1, 1) && dayOfYear > 0 && dayOfYear <= d->daysInYear(year)); - } - - // NOT VIRTUAL - If override needed use shared-d --bool KCalendarSystem::isValid( const QString &eraName, int yearInEra, int month, int day ) const -+bool KCalendarSystem::isValid(const QString &eraName, int yearInEra, int month, int day) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- KCalendarEra era = d->era( eraName, yearInEra ); -- return ( era.isValid() && isValid( era.year( yearInEra ), month, day ) ); -+ KCalendarEra era = d->era(eraName, yearInEra); -+ return (era.isValid() && isValid(era.year(yearInEra), month, day)); - } - - // NOT VIRTUAL - If override needed use shared-d --bool KCalendarSystem::isValidIsoWeekDate( int year, int isoWeekNumber, int dayOfIsoWeek ) const -+bool KCalendarSystem::isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfIsoWeek) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - //Tests Year value in standard YMD isValid() -- if ( !isValid( year, 1, 1 ) ) { -+ if (!isValid(year, 1, 1)) { - return false; - } - - //Test Week Number falls in valid range for this year -- int weeksInThisYear = weeksInYear( year ); -- if ( isoWeekNumber < 1 || isoWeekNumber > weeksInThisYear ) { -+ int weeksInThisYear = weeksInYear(year); -+ if (isoWeekNumber < 1 || isoWeekNumber > weeksInThisYear) { - return false; - } - - //Test Day of Week Number falls in valid range -- if ( dayOfIsoWeek < 1 || dayOfIsoWeek > d->daysInWeek() ) { -+ if (dayOfIsoWeek < 1 || dayOfIsoWeek > d->daysInWeek()) { - return false; - } - - //If not in earliest or latest years then all OK - //Otherwise need to check don't fall into previous or next year that would be invalid -- if ( year == d->earliestValidYear() && isoWeekNumber == 1 ) { -+ if (year == d->earliestValidYear() && isoWeekNumber == 1) { - //If firstDayOfYear falls on or before Thursday then firstDayOfYear falls in week 1 this - //year and if wanted dayOfIsoWeek falls before firstDayOfYear then falls in previous year - //and so in invalid year -- int dowFirstDay = dayOfWeek( d->firstDayOfYear( year ) ); -- if ( dowFirstDay <= 4 && dayOfIsoWeek < dowFirstDay ) { -+ int dowFirstDay = dayOfWeek(d->firstDayOfYear(year)); -+ if (dowFirstDay <= 4 && dayOfIsoWeek < dowFirstDay) { - return false; - } -- } else if ( year == d->latestValidYear() && isoWeekNumber == weeksInThisYear ) { -+ } else if (year == d->latestValidYear() && isoWeekNumber == weeksInThisYear) { - //If lastDayOfYear falls on or after Thursday then lastDayOfYear falls in last week this - //year and if wanted dayOfIsoWeek falls after lastDayOfYear then falls in next year - //and so in invalid year -- int dowLastDay = dayOfWeek( d->lastDayOfYear( year ) ); -- if ( dowLastDay >= 4 && dayOfIsoWeek > dowLastDay ) { -+ int dowLastDay = dayOfWeek(d->lastDayOfYear(year)); -+ if (dowLastDay >= 4 && dayOfIsoWeek > dowLastDay) { - return false; - } - } -@@ -1173,26 +1211,26 @@ bool KCalendarSystem::isValidIsoWeekDate( int year, int isoWeekNumber, int dayOf - return true; - } - --bool KCalendarSystem::isValid( const QDate &date ) const -+bool KCalendarSystem::isValid(const QDate &date) const - { -- if ( date.isNull() || date < earliestValidDate() || date > latestValidDate() ) { -+ if (date.isNull() || date < earliestValidDate() || date > latestValidDate()) { - return false; - } - return true; - } - --bool KCalendarSystem::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystem::setDate(QDate &date, int year, int month, int day) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - date = d->invalidDate(); - -- if ( isValid( year, month, day ) ) { -+ if (isValid(year, month, day)) { - int jd; -- dateToJulianDay( year, month, day, jd ); -- QDate calcDate = QDate::fromJulianDay( jd ); -+ dateToJulianDay(year, month, day, jd); -+ QDate calcDate = QDate::fromJulianDay(jd); - -- if ( isValid( calcDate ) ) { -+ if (isValid(calcDate)) { - date = calcDate; - return true; - } -@@ -1202,17 +1240,17 @@ bool KCalendarSystem::setDate( QDate &date, int year, int month, int day ) const - } - - // NOT VIRTUAL - If override needed use shared-d --bool KCalendarSystem::setDate( QDate &date, int year, int dayOfYear ) const -+bool KCalendarSystem::setDate(QDate &date, int year, int dayOfYear) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - date = d->invalidDate(); - -- if ( isValid( year, dayOfYear ) ) { -+ if (isValid(year, dayOfYear)) { - int jd; -- dateToJulianDay( year, 1, 1, jd ); -- QDate calcDate = QDate::fromJulianDay( jd + dayOfYear - 1 ); -- if ( isValid( calcDate ) ) { -+ dateToJulianDay(year, 1, 1, jd); -+ QDate calcDate = QDate::fromJulianDay(jd + dayOfYear - 1); -+ if (isValid(calcDate)) { - date = calcDate; - return true; - } -@@ -1222,35 +1260,35 @@ bool KCalendarSystem::setDate( QDate &date, int year, int dayOfYear ) const - } - - // NOT VIRTUAL - If override needed use shared-d --bool KCalendarSystem::setDate( QDate &date, QString eraName, int yearInEra, int month, int day ) const -+bool KCalendarSystem::setDate(QDate &date, QString eraName, int yearInEra, int month, int day) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- KCalendarEra era = d->era( eraName, yearInEra ); -- return ( era.isValid() && setDate( date, era.year( yearInEra ), month, day ) ); -+ KCalendarEra era = d->era(eraName, yearInEra); -+ return (era.isValid() && setDate(date, era.year(yearInEra), month, day)); - } - - // NOT VIRTUAL - If override needed use shared-d --bool KCalendarSystem::setDateIsoWeek( QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek ) const -+bool KCalendarSystem::setDateIsoWeek(QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - date = d->invalidDate(); - -- if ( isValidIsoWeekDate( year, isoWeekNumber, dayOfIsoWeek ) ) { -+ if (isValidIsoWeekDate(year, isoWeekNumber, dayOfIsoWeek)) { - -- QDate calcDate = d->firstDayOfYear( year ); -- int dowFirstDayOfYear = dayOfWeek( calcDate ); -+ QDate calcDate = d->firstDayOfYear(year); -+ int dowFirstDayOfYear = dayOfWeek(calcDate); - -- int daysToAdd = ( d->daysInWeek() * ( isoWeekNumber - 1 ) ) + dayOfIsoWeek; -+ int daysToAdd = (d->daysInWeek() * (isoWeekNumber - 1)) + dayOfIsoWeek; - -- if ( dowFirstDayOfYear <= 4 ) { -- calcDate = calcDate.addDays( daysToAdd - dowFirstDayOfYear ); -+ if (dowFirstDayOfYear <= 4) { -+ calcDate = calcDate.addDays(daysToAdd - dowFirstDayOfYear); - } else { -- calcDate = calcDate.addDays( daysInWeek( calcDate ) + daysToAdd - dowFirstDayOfYear ); -+ calcDate = calcDate.addDays(daysInWeek(calcDate) + daysToAdd - dowFirstDayOfYear); - } - -- if ( isValid( calcDate ) ) { -+ if (isValid(calcDate)) { - date = calcDate; - return true; - } -@@ -1260,42 +1298,42 @@ bool KCalendarSystem::setDateIsoWeek( QDate &date, int year, int isoWeekNumber, - } - - // Deprecated --bool KCalendarSystem::setYMD( QDate &date, int year, int month, int day ) const -+bool KCalendarSystem::setYMD(QDate &date, int year, int month, int day) const - { -- return setDate( date, year, month, day ); -+ return setDate(date, year, month, day); - } - - // NOT VIRTUAL - If override needed use shared-d --void KCalendarSystem::getDate( const QDate date, int *year, int *month, int *day ) const -+void KCalendarSystem::getDate(const QDate date, int *year, int *month, int *day) const - { - int y, m, d; - -- if ( isValid( date ) ) { -- julianDayToDate( date.toJulianDay(), y, m, d ); -+ if (isValid(date)) { -+ julianDayToDate(date.toJulianDay(), y, m, d); - } else { - y = 0; // How do you denote invalid year when we support -ve years? - m = 0; - d = 0; - } - -- if ( year ) { -+ if (year) { - *year = y; - } -- if ( month ) { -+ if (month) { - *month = m; - } -- if ( day ) { -+ if (day) { - *day = d; - } - - } - --int KCalendarSystem::year( const QDate &date ) const -+int KCalendarSystem::year(const QDate &date) const - { -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month, day; - -- julianDayToDate( date.toJulianDay(), year, month, day ); -+ julianDayToDate(date.toJulianDay(), year, month, day); - - return year; - } -@@ -1303,12 +1341,12 @@ int KCalendarSystem::year( const QDate &date ) const - return 0; // How do you denote invalid year when we support -ve years? - } - --int KCalendarSystem::month( const QDate &date ) const -+int KCalendarSystem::month(const QDate &date) const - { -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month, day; - -- julianDayToDate( date.toJulianDay(), year, month, day ); -+ julianDayToDate(date.toJulianDay(), year, month, day); - - return month; - } -@@ -1316,12 +1354,12 @@ int KCalendarSystem::month( const QDate &date ) const - return 0; - } - --int KCalendarSystem::day( const QDate &date ) const -+int KCalendarSystem::day(const QDate &date) const - { -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month, day; - -- julianDayToDate( date.toJulianDay(), year, month, day ); -+ julianDayToDate(date.toJulianDay(), year, month, day); - - return day; - } -@@ -1330,15 +1368,15 @@ int KCalendarSystem::day( const QDate &date ) const - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::eraName( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::eraName(const QDate &date, StringFormat format) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- if ( format == LongFormat ) { -- return d->era( date ).name( KLocale::LongName ); -+ if (isValid(date)) { -+ if (format == LongFormat) { -+ return d->era(date).name(KLocale::LongName); - } else { -- return d->era( date ).name( KLocale::ShortName ); -+ return d->era(date).name(KLocale::ShortName); - } - } - -@@ -1346,25 +1384,25 @@ QString KCalendarSystem::eraName( const QDate &date, StringFormat format ) const - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::eraYear( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::eraYear(const QDate &date, StringFormat format) const - { -- Q_UNUSED( format ) -- Q_D( const KCalendarSystem ); -+ Q_UNUSED(format) -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return formatDate( date, d->era( date ).format() ); -+ if (isValid(date)) { -+ return formatDate(date, d->era(date).format()); - } - - return QString(); - } - - // NOT VIRTUAL - If override needed use shared-d --int KCalendarSystem::yearInEra( const QDate &date ) const -+int KCalendarSystem::yearInEra(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->era( date ).yearInEra( year( date ) ); -+ if (isValid(date)) { -+ return d->era(date).yearInEra(year(date)); - } - - return -1; -@@ -1373,48 +1411,48 @@ int KCalendarSystem::yearInEra( const QDate &date ) const - // NOT VIRTUAL - If override needed use shared-d - QList<KCalendarEra> *KCalendarSystem::eraList() const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - return d->eraList(); - } - - // NOT VIRTUAL - If override needed use shared-d --KCalendarEra KCalendarSystem::era( const QDate &eraDate ) const -+KCalendarEra KCalendarSystem::era(const QDate &eraDate) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- return d->era( eraDate ); -+ return d->era(eraDate); - } - - // NOT VIRTUAL - If override needed use shared-d --KCalendarEra KCalendarSystem::era( const QString &eraName, int yearInEra ) const -+KCalendarEra KCalendarSystem::era(const QString &eraName, int yearInEra) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- return d->era( eraName, yearInEra ); -+ return d->era(eraName, yearInEra); - } - --QDate KCalendarSystem::addYears( const QDate &date, int numYears ) const -+QDate KCalendarSystem::addYears(const QDate &date, int numYears) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -+ if (isValid(date)) { - - int originalYear, originalMonth, originalDay; -- julianDayToDate( date.toJulianDay(), originalYear, originalMonth, originalDay ); -+ julianDayToDate(date.toJulianDay(), originalYear, originalMonth, originalDay); - -- int newYear = d->addYears( originalYear, numYears ); -+ int newYear = d->addYears(originalYear, numYears); - int newMonth = originalMonth; - int newDay = originalDay; - - //Adjust day number if new month has fewer days than old month -- int daysInNewMonth = d->daysInMonth( newYear, newMonth ); -- if ( daysInNewMonth < originalDay ) { -+ int daysInNewMonth = d->daysInMonth(newYear, newMonth); -+ if (daysInNewMonth < originalDay) { - newDay = daysInNewMonth; - } - - QDate newDate; -- setDate( newDate, newYear, newMonth, newDay ); -+ setDate(newDate, newYear, newMonth, newDay); - return newDate; - - } -@@ -1422,38 +1460,38 @@ QDate KCalendarSystem::addYears( const QDate &date, int numYears ) const - return d->invalidDate(); - } - --QDate KCalendarSystem::addMonths( const QDate &date, int numMonths ) const -+QDate KCalendarSystem::addMonths(const QDate &date, int numMonths) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -+ if (isValid(date)) { - - int originalYear, originalMonth, originalDay; -- julianDayToDate( date.toJulianDay(), originalYear, originalMonth, originalDay ); -+ julianDayToDate(date.toJulianDay(), originalYear, originalMonth, originalDay); - -- int monthsInOriginalYear = d->monthsInYear( originalYear ); -+ int monthsInOriginalYear = d->monthsInYear(originalYear); - -- int newYear = d->addYears( originalYear, ( originalMonth + numMonths ) / monthsInOriginalYear ); -- int newMonth = ( originalMonth + numMonths ) % monthsInOriginalYear; -+ int newYear = d->addYears(originalYear, (originalMonth + numMonths) / monthsInOriginalYear); -+ int newMonth = (originalMonth + numMonths) % monthsInOriginalYear; - int newDay = originalDay; - -- if ( newMonth == 0 ) { -- newYear = d->addYears( newYear, - 1 ); -+ if (newMonth == 0) { -+ newYear = d->addYears(newYear, - 1); - newMonth = monthsInOriginalYear; - } -- if ( newMonth < 0 ) { -- newYear = d->addYears( newYear, - 1 ); -+ if (newMonth < 0) { -+ newYear = d->addYears(newYear, - 1); - newMonth = newMonth + monthsInOriginalYear; - } - - //Adjust day number if new month has fewer days than old month -- int daysInNewMonth = d->daysInMonth( newYear, newMonth ); -- if ( daysInNewMonth < originalDay ) { -+ int daysInNewMonth = d->daysInMonth(newYear, newMonth); -+ if (daysInNewMonth < originalDay) { - newDay = daysInNewMonth; - } - - QDate newDate; -- setDate( newDate, newYear, newMonth, newDay ); -+ setDate(newDate, newYear, newMonth, newDay); - return newDate; - - } -@@ -1461,15 +1499,15 @@ QDate KCalendarSystem::addMonths( const QDate &date, int numMonths ) const - return d->invalidDate(); - } - --QDate KCalendarSystem::addDays( const QDate &date, int numDays ) const -+QDate KCalendarSystem::addDays(const QDate &date, int numDays) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - // QDate only holds a uint and has no boundary checking in addDays(), so we need to check -- if ( isValid( date ) && (long) date.toJulianDay() + (long) numDays > 0 ) { -+ if (isValid(date) && (long) date.toJulianDay() + (long) numDays > 0) { - // QDate adds straight to jd -- QDate temp = date.addDays( numDays ); -- if ( isValid( temp ) ) { -+ QDate temp = date.addDays(numDays); -+ if (isValid(temp)) { - return temp; - } - } -@@ -1478,519 +1516,517 @@ QDate KCalendarSystem::addDays( const QDate &date, int numDays ) const - } - - // NOT VIRTUAL - Uses shared-d instead --void KCalendarSystem::dateDifference( const QDate &fromDate, const QDate &toDate, -- int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction ) const -+void KCalendarSystem::dateDifference(const QDate &fromDate, const QDate &toDate, -+ int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( fromDate ) && isValid( toDate ) ) { -- d->dateDifference( fromDate, toDate, yearsDiff, monthsDiff, daysDiff, direction ); -+ if (isValid(fromDate) && isValid(toDate)) { -+ d->dateDifference(fromDate, toDate, yearsDiff, monthsDiff, daysDiff, direction); - } - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::yearsDifference( const QDate &fromDate, const QDate &toDate ) const -+int KCalendarSystem::yearsDifference(const QDate &fromDate, const QDate &toDate) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( fromDate ) && isValid( toDate ) ) { -- return d->yearsDifference( fromDate, toDate ); -+ if (isValid(fromDate) && isValid(toDate)) { -+ return d->yearsDifference(fromDate, toDate); - } - - return 0; - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::monthsDifference( const QDate &fromDate, const QDate &toDate ) const -+int KCalendarSystem::monthsDifference(const QDate &fromDate, const QDate &toDate) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( fromDate ) && isValid( toDate ) ) { -- return d->monthsDifference( fromDate, toDate ); -+ if (isValid(fromDate) && isValid(toDate)) { -+ return d->monthsDifference(fromDate, toDate); - } - - return 0; - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::daysDifference( const QDate &fromDate, const QDate &toDate ) const -+int KCalendarSystem::daysDifference(const QDate &fromDate, const QDate &toDate) const - { -- if ( isValid( fromDate ) && isValid( toDate ) ) { -+ if (isValid(fromDate) && isValid(toDate)) { - return toDate.toJulianDay() - fromDate.toJulianDay(); - } - - return 0; - } - --int KCalendarSystem::monthsInYear( const QDate &date ) const -+int KCalendarSystem::monthsInYear(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->monthsInYear( year( date ) ); -+ if (isValid(date)) { -+ return d->monthsInYear(year(date)); - } - - return -1; - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::monthsInYear( int year ) const -+int KCalendarSystem::monthsInYear(int year) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->monthsInYear( year ); -+ if (isValid(year, 1, 1)) { -+ return d->monthsInYear(year); - } - - return -1; - } - --int KCalendarSystem::weeksInYear( const QDate &date ) const -+int KCalendarSystem::weeksInYear(const QDate &date) const - { -- if ( isValid( date ) ) { -- return weeksInYear( year( date ) ); -- } -+ return weeksInYear(date, KLocale::DefaultWeekNumber); -+} - -- return -1; -+int KCalendarSystem::weeksInYear(int year) const -+{ -+ return weeksInYear(year, KLocale::DefaultWeekNumber); - } - --int KCalendarSystem::weeksInYear( int year ) const -+// NOT VIRTUAL - Uses shared-d instead -+int KCalendarSystem::weeksInYear(const QDate &date, KLocale::WeekNumberSystem weekNumberSystem) const - { -- return weeksInYear( year, KLocale::DefaultWeekNumber ); -+ Q_D(const KCalendarSystem); -+ -+ if (isValid(date)) { -+ return d->weeksInYear(year(date), weekNumberSystem); -+ } -+ -+ return -1; - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::weeksInYear( int year, KLocale::WeekNumberSystem weekNumberSystem ) const -+int KCalendarSystem::weeksInYear(int year, KLocale::WeekNumberSystem weekNumberSystem) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->weeksInYear( year, weekNumberSystem ); -+ if (isValid(year, 1, 1)) { -+ return d->weeksInYear(year, weekNumberSystem); - } - - return -1; - } - --int KCalendarSystem::daysInYear( const QDate &date ) const -+int KCalendarSystem::daysInYear(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->daysInYear( year( date ) ); -+ if (isValid(date)) { -+ return d->daysInYear(year(date)); - } - - return -1; - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::daysInYear( int year ) const -+int KCalendarSystem::daysInYear(int year) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->daysInYear( year ); -+ if (isValid(year, 1, 1)) { -+ return d->daysInYear(year); - } - - return -1; - } - --int KCalendarSystem::daysInMonth( const QDate &date ) const -+int KCalendarSystem::daysInMonth(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month; -- getDate( date, &year, &month, 0 ); -- return d->daysInMonth( year, month ); -+ getDate(date, &year, &month, 0); -+ return d->daysInMonth(year, month); - } - - return -1; - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::daysInMonth( int year, int month ) const -+int KCalendarSystem::daysInMonth(int year, int month) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->daysInMonth( year, month ); -+ if (isValid(year, 1, 1)) { -+ return d->daysInMonth(year, month); - } - - return -1; - } - --int KCalendarSystem::daysInWeek( const QDate &date ) const -+int KCalendarSystem::daysInWeek(const QDate &date) const - { -- Q_UNUSED( date ) -- Q_D( const KCalendarSystem ); -+ Q_UNUSED(date) -+ Q_D(const KCalendarSystem); - return d->daysInWeek(); - } - --int KCalendarSystem::dayOfYear( const QDate &date ) const -+int KCalendarSystem::dayOfYear(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->dayOfYear( date ); -+ if (isValid(date)) { -+ return d->dayOfYear(date); - } - - return -1; - } - --int KCalendarSystem::dayOfWeek( const QDate &date ) const -+int KCalendarSystem::dayOfWeek(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->dayOfWeek( date ); -+ if (isValid(date)) { -+ return d->dayOfWeek(date); - } - - return -1; - } - --int KCalendarSystem::weekNumber( const QDate &date, int *yearNum ) const -+int KCalendarSystem::weekNumber(const QDate &date, int *yearNum) const - { -- return week( date, KLocale::IsoWeekNumber, yearNum ); -+ return week(date, KLocale::IsoWeekNumber, yearNum); - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::week( const QDate &date, int *yearNum ) const -+int KCalendarSystem::week(const QDate &date, int *yearNum) const - { -- return week( date, KLocale::DefaultWeekNumber, yearNum ); -+ return week(date, KLocale::DefaultWeekNumber, yearNum); - } - - // NOT VIRTUAL - Uses shared-d instead --int KCalendarSystem::week( const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum ) const -+int KCalendarSystem::week(const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->week( date, weekNumberSystem, yearNum ); -+ if (isValid(date)) { -+ return d->week(date, weekNumberSystem, yearNum); - } - - return -1; - } - --bool KCalendarSystem::isLeapYear( int year ) const -+bool KCalendarSystem::isLeapYear(int year) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->isLeapYear( year ); -+ if (isValid(year, 1, 1)) { -+ return d->isLeapYear(year); - } - - return false; - } - --bool KCalendarSystem::isLeapYear( const QDate &date ) const -+bool KCalendarSystem::isLeapYear(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->isLeapYear( year( date ) ); -+ if (isValid(date)) { -+ return d->isLeapYear(year(date)); - } - - return false; - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::firstDayOfYear( int year ) const -+QDate KCalendarSystem::firstDayOfYear(int year) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->firstDayOfYear( year ); -+ if (isValid(year, 1, 1)) { -+ return d->firstDayOfYear(year); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::lastDayOfYear( int year ) const -+QDate KCalendarSystem::lastDayOfYear(int year) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, 1, 1 ) ) { -- return d->lastDayOfYear( year ); -+ if (isValid(year, 1, 1)) { -+ return d->lastDayOfYear(year); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::firstDayOfYear( const QDate &date ) const -+QDate KCalendarSystem::firstDayOfYear(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->firstDayOfYear( year( date ) ); -+ if (isValid(date)) { -+ return d->firstDayOfYear(year(date)); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::lastDayOfYear( const QDate &date ) const -+QDate KCalendarSystem::lastDayOfYear(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -- return d->lastDayOfYear( year( date ) ); -+ if (isValid(date)) { -+ return d->lastDayOfYear(year(date)); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::firstDayOfMonth( int year, int month ) const -+QDate KCalendarSystem::firstDayOfMonth(int year, int month) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, month, 1 ) ) { -- return d->firstDayOfMonth( year, month ); -+ if (isValid(year, month, 1)) { -+ return d->firstDayOfMonth(year, month); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::lastDayOfMonth( int year, int month ) const -+QDate KCalendarSystem::lastDayOfMonth(int year, int month) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( year, month, 1 ) ) { -- return d->lastDayOfMonth( year, month ); -+ if (isValid(year, month, 1)) { -+ return d->lastDayOfMonth(year, month); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::firstDayOfMonth( const QDate &date ) const -+QDate KCalendarSystem::firstDayOfMonth(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month; -- getDate( date, &year, &month, 0 ); -- return d->firstDayOfMonth( year, month ); -+ getDate(date, &year, &month, 0); -+ return d->firstDayOfMonth(year, month); - } - - return QDate(); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::lastDayOfMonth( const QDate &date ) const -+QDate KCalendarSystem::lastDayOfMonth(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month; -- getDate( date, &year, &month, 0 ); -- return d->lastDayOfMonth( year, month ); -+ getDate(date, &year, &month, 0); -+ return d->lastDayOfMonth(year, month); - } - - return QDate(); - } - --QString KCalendarSystem::monthName( int month, int year, KCalendarSystem::MonthNameFormat format ) const -+QString KCalendarSystem::monthName(int month, int year, KCalendarSystem::MonthNameFormat format) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( !isValid( year, month, 1 ) ) { -+ if (!isValid(year, month, 1)) { - return QString(); - } - -- if ( format == KCalendarSystem::NarrowName ) { -- return d->monthName( month, year, KLocale::NarrowName, false ); -+ if (format == KCalendarSystem::NarrowName) { -+ return d->monthName(month, year, KLocale::NarrowName, false); - } - -- if ( format == KCalendarSystem::ShortNamePossessive ) { -- return d->monthName( month, year, KLocale::ShortName, true ); -+ if (format == KCalendarSystem::ShortNamePossessive) { -+ return d->monthName(month, year, KLocale::ShortName, true); - } - -- if ( format == KCalendarSystem::ShortName ) { -- return d->monthName( month, year, KLocale::ShortName, false ); -+ if (format == KCalendarSystem::ShortName) { -+ return d->monthName(month, year, KLocale::ShortName, false); - } - -- if ( format == KCalendarSystem::LongNamePossessive ) { -- return d->monthName( month, year, KLocale::LongName, true ); -+ if (format == KCalendarSystem::LongNamePossessive) { -+ return d->monthName(month, year, KLocale::LongName, true); - } - - // KCalendarSystem::LongName or any other -- return d->monthName( month, year, KLocale::LongName, false ); -+ return d->monthName(month, year, KLocale::LongName, false); - } - --QString KCalendarSystem::monthName( const QDate &date, MonthNameFormat format ) const -+QString KCalendarSystem::monthName(const QDate &date, MonthNameFormat format) const - { -- if ( isValid( date ) ) { -+ if (isValid(date)) { - int year, month; -- getDate( date, &year, &month, 0 ); -- return monthName( month, year, format ); -+ getDate(date, &year, &month, 0); -+ return monthName(month, year, format); - } - - return QString(); - } - --QString KCalendarSystem::weekDayName( int weekDay, KCalendarSystem::WeekDayNameFormat format ) const -+QString KCalendarSystem::weekDayName(int weekDay, KCalendarSystem::WeekDayNameFormat format) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( weekDay < 1 || weekDay > d->daysInWeek() ) { -+ if (weekDay < 1 || weekDay > d->daysInWeek()) { - return QString(); - } - -- if ( format == KCalendarSystem::NarrowDayName ) { -- return d->weekDayName( weekDay, KLocale::NarrowName ); -+ 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); - } - -- 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 ); -+ return d->weekDayName(weekDay, KLocale::LongName); - } - --QString KCalendarSystem::weekDayName( const QDate &date, WeekDayNameFormat format ) const -+QString KCalendarSystem::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- if ( isValid( date ) ) { -- return weekDayName( dayOfWeek( date ), format ); -+ if (isValid(date)) { -+ return weekDayName(dayOfWeek(date), format); - } - - return QString(); - } - --QString KCalendarSystem::yearString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::yearString(const QDate &date, StringFormat format) const - { -- if ( format == ShortFormat ) { -- return formatDate( date, QLatin1String("%y") ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::Year, KLocale::ShortNumber); - } else { -- return formatDate( date, QLatin1String("%Y") ); -+ return formatDate(date, KLocale::Year, KLocale::LongNumber); - } - } - --QString KCalendarSystem::monthString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::monthString(const QDate &date, StringFormat format) const - { -- if ( format == ShortFormat ) { -- return formatDate( date, QLatin1String("%n") ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::Month, KLocale::ShortNumber); - } else { -- return formatDate( date, QLatin1String("%m") ); -+ return formatDate(date, KLocale::Month, KLocale::LongNumber); - } - } - --QString KCalendarSystem::dayString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::dayString(const QDate &date, StringFormat format) const - { -- if ( format == ShortFormat ) { -- return formatDate( date, QLatin1String("%e") ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::Day, KLocale::ShortNumber); - } else { -- return formatDate( date, QLatin1String("%d") ); -+ return formatDate(date, KLocale::Day, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::yearInEraString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::yearInEraString(const QDate &date, StringFormat format) const - { -- if ( format == ShortFormat ) { -- return formatDate( date, QLatin1String("%Ey") ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::YearInEra, KLocale::ShortNumber); - } else { -- return formatDate( date, QLatin1String("%4Ey") ); -+ return formatDate(date, KLocale::YearInEra, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::dayOfYearString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::dayOfYearString(const QDate &date, StringFormat format) const - { -- if ( format == ShortFormat ) { -- return formatDate( date, QLatin1String("%-j") ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::DayOfYear, KLocale::ShortNumber); - } else { -- return formatDate( date, QLatin1String("%j") ); -+ return formatDate(date, KLocale::DayOfYear, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::dayOfWeekString( const QDate &date ) const -+QString KCalendarSystem::dayOfWeekString(const QDate &date) const - { -- return formatDate( date, QLatin1String("%-u") ); -+ return formatDate(date, KLocale::DayOfWeek, KLocale::ShortNumber); - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::weekNumberString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::weekNumberString(const QDate &date, StringFormat format) const - { -- if ( format == ShortFormat ) { -- return formatDate( date, QLatin1String("%-V") ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::Week, KLocale::ShortNumber); - } else { -- return formatDate( date, QLatin1String("%V") ); -+ return formatDate(date, KLocale::Week, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::monthsInYearString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::monthsInYearString(const QDate &date, StringFormat format) const - { -- Q_D( const KCalendarSystem ); -- -- if ( format == ShortFormat ) { -- return d->stringFromInteger( monthsInYear( date ), 0, QLatin1Char('0') ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::MonthsInYear, KLocale::ShortNumber); - } else { -- return d->stringFromInteger( monthsInYear( date ), 2, QLatin1Char('0') ); -+ return formatDate(date, KLocale::MonthsInYear, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::weeksInYearString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::weeksInYearString(const QDate &date, StringFormat format) const - { -- Q_D( const KCalendarSystem ); -- -- if ( format == ShortFormat ) { -- return d->stringFromInteger( weeksInYear( date ), 0, QLatin1Char('0') ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::WeeksInYear, KLocale::ShortNumber); - } else { -- return d->stringFromInteger( weeksInYear( date ), 2, QLatin1Char('0') ); -+ return formatDate(date, KLocale::WeeksInYear, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::daysInYearString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::daysInYearString(const QDate &date, StringFormat format) const - { -- Q_D( const KCalendarSystem ); -- -- if ( format == ShortFormat ) { -- return d->stringFromInteger( daysInYear( date ), 0, QLatin1Char('0') ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::DaysInYear, KLocale::ShortNumber); - } else { -- return d->stringFromInteger( daysInYear( date ), 3, QLatin1Char('0') ); -+ return formatDate(date, KLocale::DaysInYear, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::daysInMonthString( const QDate &date, StringFormat format ) const -+QString KCalendarSystem::daysInMonthString(const QDate &date, StringFormat format) const - { -- Q_D( const KCalendarSystem ); -- -- if ( format == ShortFormat ) { -- return d->stringFromInteger( daysInMonth( date ), 0, QLatin1Char('0') ); -+ if (format == ShortFormat) { -+ return formatDate(date, KLocale::DaysInMonth, KLocale::ShortNumber); - } else { -- return d->stringFromInteger( daysInMonth( date ), 2, QLatin1Char('0') ); -+ return formatDate(date, KLocale::DaysInMonth, KLocale::LongNumber); - } - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::daysInWeekString( const QDate &date) const -+QString KCalendarSystem::daysInWeekString(const QDate &date) const - { -- Q_D( const KCalendarSystem ); -- Q_UNUSED( date ); -- return d->stringFromInteger( d->daysInWeek(), 0 ); -+ return formatDate(date, KLocale::DaysInWeek, KLocale::ShortNumber); - } - --int KCalendarSystem::yearStringToInteger( const QString &yearString, int &readLength ) const -+int KCalendarSystem::yearStringToInteger(const QString &yearString, int &readLength) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- QString minus = i18nc( "Negative symbol as used for year numbers, e.g. -5 = 5 BC", "-" ); -- if ( yearString.startsWith( minus ) ) { -- int value = d->integerFromString( yearString.mid( minus.length() ), 4, readLength ); -- if ( readLength > 0 && value >= 0 ) { -+ QString minus = i18nc("Negative symbol as used for year numbers, e.g. -5 = 5 BC", "-"); -+ if (yearString.startsWith(minus)) { -+ int value = d->integerFromString(yearString.mid(minus.length()), 4, readLength); -+ if (readLength > 0 && value >= 0) { - readLength = readLength + minus.length(); - return value * -1; - } else { -@@ -1998,31 +2034,31 @@ int KCalendarSystem::yearStringToInteger( const QString &yearString, int &readLe - } - } - -- return d->integerFromString( yearString, 4, readLength ); -+ return d->integerFromString(yearString, 4, readLength); - } - --int KCalendarSystem::monthStringToInteger( const QString &monthString, int &readLength ) const -+int KCalendarSystem::monthStringToInteger(const QString &monthString, int &readLength) const - { -- Q_D( const KCalendarSystem ); -- return d->integerFromString( monthString, 2, readLength ); -+ Q_D(const KCalendarSystem); -+ return d->integerFromString(monthString, 2, readLength); - } - --int KCalendarSystem::dayStringToInteger( const QString &dayString, int &readLength ) const -+int KCalendarSystem::dayStringToInteger(const QString &dayString, int &readLength) const - { -- Q_D( const KCalendarSystem ); -- return d->integerFromString( dayString, 2, readLength ); -+ Q_D(const KCalendarSystem); -+ return d->integerFromString(dayString, 2, readLength); - } - --QString KCalendarSystem::formatDate( const QDate &fromDate, KLocale::DateFormat toFormat ) const -+QString KCalendarSystem::formatDate(const QDate &fromDate, KLocale::DateFormat toFormat) const - { -- if ( !fromDate.isValid() ) { -+ if (!fromDate.isValid()) { - return QString(); - } - -- if ( toFormat == KLocale::FancyShortDate || toFormat == KLocale::FancyLongDate ) { -+ if (toFormat == KLocale::FancyShortDate || toFormat == KLocale::FancyLongDate) { - QDate now = KDateTime::currentLocalDate(); -- int daysToNow = fromDate.daysTo( now ); -- switch ( daysToNow ) { -+ int daysToNow = fromDate.daysTo(now); -+ switch (daysToNow) { - case 0: - return i18n("Today"); - case 1: -@@ -2032,47 +2068,47 @@ QString KCalendarSystem::formatDate( const QDate &fromDate, KLocale::DateFormat - case 4: - case 5: - case 6: -- return weekDayName( fromDate ); -+ return weekDayName(fromDate); - default: - break; - } - } - -- switch ( toFormat ) { -+ switch (toFormat) { - case KLocale::LongDate: - case KLocale::FancyLongDate: -- return formatDate( fromDate, locale()->dateFormat() ); -+ return formatDate(fromDate, locale()->dateFormat()); - case KLocale::IsoDate: -- return formatDate( fromDate, QLatin1String("%Y-%m-%d") ); -+ return formatDate(fromDate, QLatin1String("%Y-%m-%d")); - case KLocale::IsoWeekDate: -- return formatDate( fromDate, QLatin1String("%Y-W%V-%u") ); -+ return formatDate(fromDate, QLatin1String("%Y-W%V-%u")); - case KLocale::IsoOrdinalDate: -- return formatDate( fromDate, QLatin1String("%Y-%j") ); -+ return formatDate(fromDate, QLatin1String("%Y-%j")); - case KLocale::ShortDate: - case KLocale::FancyShortDate: - default: -- return formatDate( fromDate, locale()->dateFormatShort() ); -+ return formatDate(fromDate, locale()->dateFormatShort()); - } - - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::formatDate( const QDate &fromDate, const QString &toFormat, -- KLocale::DateTimeFormatStandard standard ) const -+QString KCalendarSystem::formatDate(const QDate &fromDate, const QString &toFormat, -+ KLocale::DateTimeFormatStandard standard) const - { -- return formatDate( fromDate, toFormat, locale()->dateTimeDigitSet(), standard ); -+ return formatDate(fromDate, toFormat, locale()->dateTimeDigitSet(), standard); - } - - // NOT VIRTUAL - If override needed use shared-d --QString KCalendarSystem::formatDate( const QDate &fromDate, const QString &toFormat, KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QString KCalendarSystem::formatDate(const QDate &fromDate, const QString &toFormat, KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard) const - { -- if ( !isValid( fromDate ) || toFormat.isEmpty() ) { -+ if (!isValid(fromDate) || toFormat.isEmpty()) { - return QString(); - } - - KDateTimeFormatter formatter; -- return formatter.formatDate( fromDate, toFormat, this, locale(), digitSet, formatStandard ); -+ return formatter.formatDate(fromDate, toFormat, this, locale(), digitSet, formatStandard); - } - - // NOT VIRTUAL - If override needed use shared-d -@@ -2080,25 +2116,24 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - KLocale::DateTimeComponentFormat format, - KLocale::WeekNumberSystem weekNumberSystem) const - { -- Q_D( const KCalendarSystem ); -- Q_UNUSED( weekNumberSystem ); -+ Q_D(const KCalendarSystem); - -- switch ( component ) { -+ switch (component) { - case KLocale::Year: - case KLocale::YearName: -- switch ( format ) { -+ switch (format) { - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: -- return yearString(date, KCalendarSystem::ShortFormat); -+ return formatDate(date, QLatin1String("%y")); - case KLocale::LongNumber: - case KLocale::LongName: - case KLocale::DefaultComponentFormat: - default: -- return yearString(date, KCalendarSystem::LongFormat); -+ return formatDate(date, QLatin1String("%Y")); - } - case KLocale::Month: -- switch ( format ) { -+ switch (format) { - case KLocale::LongName: - return monthName(date, KCalendarSystem::LongName); - case KLocale::ShortName: -@@ -2106,14 +2141,14 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - case KLocale::NarrowName: - return monthName(date, KCalendarSystem::NarrowName); - case KLocale::LongNumber: -- return monthString(date, KCalendarSystem::LongFormat); -+ return formatDate(date, QLatin1String("%m")); - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return monthString(date, KCalendarSystem::ShortFormat); -+ return formatDate(date, QLatin1String("%n")); - } - case KLocale::MonthName: -- switch ( format ) { -+ switch (format) { - case KLocale::NarrowName: - return monthName(date, KCalendarSystem::NarrowName); - case KLocale::ShortName: -@@ -2130,16 +2165,16 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return dayString(date, KCalendarSystem::LongFormat); -+ return formatDate(date, QLatin1String("%d")); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return dayString(date, KCalendarSystem::ShortFormat); -+ return formatDate(date, QLatin1String("%e")); - } - case KLocale::JulianDay: -- return d->stringFromInteger( date.toJulianDay(), 0 ); -+ return d->stringFromInteger(date.toJulianDay(), 0); - case KLocale::EraName: - switch (format) { - case KLocale::LongNumber: -@@ -2168,26 +2203,26 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return yearInEraString(date, KCalendarSystem::LongFormat); -+ return formatDate(date, QLatin1String("%4Ey")); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return yearInEraString(date, KCalendarSystem::ShortFormat); -+ return formatDate(date, QLatin1String("%Ey")); - } - case KLocale::DayOfYear: - case KLocale::DayOfYearName: - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return dayOfYearString(date, KCalendarSystem::LongFormat); -+ return formatDate(date, QLatin1String("%j")); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return dayOfYearString(date, KCalendarSystem::ShortFormat); -+ return formatDate(date, QLatin1String("%-j")); - } - case KLocale::DayOfWeek: - switch (format) { -@@ -2201,10 +2236,10 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return dayOfWeekString(date); -+ return formatDate(date, QLatin1String("%-u")); - } - case KLocale::DayOfWeekName: -- switch ( format ) { -+ switch (format) { - case KLocale::NarrowName: - return weekDayName(date, KCalendarSystem::NarrowDayName); - case KLocale::ShortName: -@@ -2220,69 +2255,68 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return weekNumberString(date, KCalendarSystem::LongFormat); -+ return d->stringFromInteger(week(date, weekNumberSystem, 0), 2, QLatin1Char('0')); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return weekNumberString(date, KCalendarSystem::ShortFormat); -+ return d->stringFromInteger(week(date, weekNumberSystem, 0), 0, QLatin1Char('0')); - } -- case KLocale::WeekYear: -- { -+ case KLocale::WeekYear: { - int weekYear; - QDate yearDate; -- weekNumber( date, &weekYear ); -- setDate( yearDate, weekYear, 1, 1 ); -- return formatDate( yearDate, KLocale::Year, format ); -+ week(date, weekNumberSystem, &weekYear); -+ setDate(yearDate, weekYear, 1, 1); -+ return formatDate(yearDate, KLocale::Year, format); - } - case KLocale::MonthsInYear: - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return monthsInYearString(date, KCalendarSystem::LongFormat); -+ return d->stringFromInteger(monthsInYear(date), 2, QLatin1Char('0')); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return monthsInYearString(date, KCalendarSystem::ShortFormat); -+ return d->stringFromInteger(monthsInYear(date), 0, QLatin1Char('0')); - } - case KLocale::WeeksInYear: - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return weeksInYearString(date, KCalendarSystem::LongFormat); -+ return d->stringFromInteger(weeksInYear(date), 2, QLatin1Char('0')); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return weeksInYearString(date, KCalendarSystem::ShortFormat); -+ return d->stringFromInteger(weeksInYear(date), 0, QLatin1Char('0')); - } - case KLocale::DaysInYear: - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return daysInYearString(date, KCalendarSystem::LongFormat); -+ return d->stringFromInteger(daysInYear(date), 3, QLatin1Char('0')); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return daysInYearString(date, KCalendarSystem::ShortFormat); -+ return d->stringFromInteger(daysInYear(date), 0, QLatin1Char('0')); - } - case KLocale::DaysInMonth: - switch (format) { - case KLocale::LongNumber: - case KLocale::LongName: -- return daysInMonthString(date, KCalendarSystem::LongFormat); -+ return d->stringFromInteger(daysInMonth(date), 2, QLatin1Char('0')); - case KLocale::ShortName: - case KLocale::NarrowName: - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return daysInMonthString(date, KCalendarSystem::ShortFormat); -+ return d->stringFromInteger(daysInMonth(date), 0, QLatin1Char('0')); - } - case KLocale::DaysInWeek: - switch (format) { -@@ -2293,26 +2327,26 @@ QString KCalendarSystem::formatDate(const QDate &date, KLocale::DateTimeComponen - case KLocale::ShortNumber: - case KLocale::DefaultComponentFormat: - default: -- return daysInWeekString(date); -+ return d->stringFromInteger(d->daysInWeek(), 0); - } - default: - return QString(); - } - } - --QDate KCalendarSystem::readDate( const QString &str, bool *ok ) const -+QDate KCalendarSystem::readDate(const QString &str, bool *ok) const - { - //Try each standard format in turn, start with the locale ones, - //then the well defined standards -- QDate date = readDate( str, KLocale::ShortFormat, ok); -- if ( !isValid( date ) ) { -- date = readDate( str, KLocale::NormalFormat, ok); -- if ( !isValid( date )) { -- date = readDate( str, KLocale::IsoFormat, ok); -- if ( !isValid( date ) ) { -- date = readDate( str, KLocale::IsoWeekFormat, ok); -- if ( !isValid( date ) ) { -- date = readDate( str, KLocale::IsoOrdinalFormat, ok); -+ QDate date = readDate(str, KLocale::ShortFormat, ok); -+ if (!isValid(date)) { -+ date = readDate(str, KLocale::NormalFormat, ok); -+ if (!isValid(date)) { -+ date = readDate(str, KLocale::IsoFormat, ok); -+ if (!isValid(date)) { -+ date = readDate(str, KLocale::IsoWeekFormat, ok); -+ if (!isValid(date)) { -+ date = readDate(str, KLocale::IsoOrdinalFormat, ok); - } - } - } -@@ -2321,35 +2355,35 @@ QDate KCalendarSystem::readDate( const QString &str, bool *ok ) const - return date; - } - --QDate KCalendarSystem::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const -+QDate KCalendarSystem::readDate(const QString &str, KLocale::ReadDateFlags flags, bool *ok) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- if ( flags & KLocale::ShortFormat ) { -- return readDate( str, locale()->dateFormatShort(), ok ); -- } else if ( flags & KLocale::NormalFormat ) { -- return readDate( str, locale()->dateFormat(), ok ); -- } else if ( flags & KLocale::IsoFormat ) { -- return readDate( str, QLatin1String("%Y-%m-%d"), ok ); -- } else if ( flags & KLocale::IsoWeekFormat ) { -- return readDate( str, QLatin1String("%Y-W%V-%u"), ok ); -- } else if ( flags & KLocale::IsoOrdinalFormat ) { -- return readDate( str, QLatin1String("%Y-%j"), ok ); -+ if (flags & KLocale::ShortFormat) { -+ return readDate(str, locale()->dateFormatShort(), ok); -+ } else if (flags & KLocale::NormalFormat) { -+ return readDate(str, locale()->dateFormat(), ok); -+ } else if (flags & KLocale::IsoFormat) { -+ return readDate(str, QLatin1String("%Y-%m-%d"), ok); -+ } else if (flags & KLocale::IsoWeekFormat) { -+ return readDate(str, QLatin1String("%Y-W%V-%u"), ok); -+ } else if (flags & KLocale::IsoOrdinalFormat) { -+ return readDate(str, QLatin1String("%Y-%j"), ok); - } - return d->invalidDate(); - } - --QDate KCalendarSystem::readDate( const QString &inputString, const QString &formatString, bool *ok ) const -+QDate KCalendarSystem::readDate(const QString &inputString, const QString &formatString, bool *ok) const - { -- return readDate( inputString, formatString, ok, KLocale::KdeFormat ); -+ return readDate(inputString, formatString, ok, KLocale::KdeFormat); - } - - // NOT VIRTUAL - If override needed use shared-d --QDate KCalendarSystem::readDate( const QString &inputString, const QString &formatString, bool *ok, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QDate KCalendarSystem::readDate(const QString &inputString, const QString &formatString, bool *ok, -+ KLocale::DateTimeFormatStandard formatStandard) const - { - KDateTimeParser parser; -- QDate resultDate = parser.parseDate( inputString, formatString, this, locale(), locale()->dateTimeDigitSet(), formatStandard ); -+ QDate resultDate = parser.parseDate(inputString, formatString, this, locale(), locale()->dateTimeDigitSet(), formatStandard); - if (ok) { - *ok = resultDate.isValid(); - } -@@ -2359,17 +2393,17 @@ QDate KCalendarSystem::readDate( const QString &inputString, const QString &form - // NOT VIRTUAL - If override needed use shared-d - int KCalendarSystem::shortYearWindowStartYear() const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - return d->shortYearWindowStartYear(); - } - - // NOT VIRTUAL - If override needed use shared-d --int KCalendarSystem::applyShortYearWindow( int inputYear ) const -+int KCalendarSystem::applyShortYearWindow(int inputYear) const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - -- return d->applyShortYearWindow( inputYear ); -+ return d->applyShortYearWindow(inputYear); - } - - int KCalendarSystem::weekStartDay() const -@@ -2383,7 +2417,7 @@ int KCalendarSystem::weekStartDay() const - // instead be wrapped in validity checks, as sometimes we want this to work outside the public valid - // range, i.e. to allow us to internally set dates of 1/1/10000 which are not publically valid but - // are required for internal maths --bool KCalendarSystem::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystem::julianDayToDate(int jd, int &year, int &month, int &day) const - { - // Formula from The Calendar FAQ by Claus Tondering - // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -@@ -2391,18 +2425,18 @@ bool KCalendarSystem::julianDayToDate( int jd, int &year, int &month, int &day ) - // the Boost licensed source code - - int a = jd + 32044; -- int b = ( ( 4 * a ) + 3 ) / 146097; -- int c = a - ( ( 146097 * b ) / 4 ); -- int d = ( ( 4 * c ) + 3 ) / 1461; -- int e = c - ( ( 1461 * d ) / 4 ); -- int m = ( ( 5 * e ) + 2 ) / 153; -- day = e - ( ( (153 * m ) + 2 ) / 5 ) + 1; -- month = m + 3 - ( 12 * ( m / 10 ) ); -- year = ( 100 * b ) + d - 4800 + ( m / 10 ); -+ int b = ((4 * a) + 3) / 146097; -+ int c = a - ((146097 * b) / 4); -+ int d = ((4 * c) + 3) / 1461; -+ int e = c - ((1461 * d) / 4); -+ int m = ((5 * e) + 2) / 153; -+ day = e - (((153 * m) + 2) / 5) + 1; -+ month = m + 3 - (12 * (m / 10)); -+ year = (100 * b) + d - 4800 + (m / 10); - - // If year is -ve then is BC. In Gregorian there is no year 0, but the maths - // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside -- if ( year < 1 ) { -+ if (year < 1) { - year = year - 1; - } - -@@ -2415,7 +2449,7 @@ bool KCalendarSystem::julianDayToDate( int jd, int &year, int &month, int &day ) - // instead be wrapped in validity checks, as sometimes we want this to work outside the public valid - // range, i.e. to allow us to internally set dates of 1/1/10000 which are not publically valid but - // are required for internal maths --bool KCalendarSystem::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystem::dateToJulianDay(int year, int month, int day, int &jd) const - { - // Formula from The Calendar FAQ by Claus Tondering - // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -@@ -2425,22 +2459,22 @@ bool KCalendarSystem::dateToJulianDay( int year, int month, int day, int &jd ) c - // If year is -ve then is BC. In Gregorian there is no year 0, but the maths - // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally - int y; -- if ( year < 1 ) { -+ if (year < 1) { - y = year + 1; - } else { - y = year; - } - -- int a = ( 14 - month ) / 12; -+ int a = (14 - month) / 12; - y = y + 4800 - a; -- int m = month + ( 12 * a ) - 3; -+ int m = month + (12 * a) - 3; - - jd = day -- + ( ( ( 153 * m ) + 2 ) / 5 ) -- + ( 365 * y ) -- + ( y / 4 ) -- - ( y / 100 ) -- + ( y / 400 ) -+ + (((153 * m) + 2) / 5) -+ + (365 * y) -+ + (y / 4) -+ - (y / 100) -+ + (y / 400) - - 32045; - - return true; -@@ -2448,25 +2482,25 @@ bool KCalendarSystem::dateToJulianDay( int year, int month, int day, int &jd ) c - - const KLocale * KCalendarSystem::locale() const - { -- Q_D( const KCalendarSystem ); -+ Q_D(const KCalendarSystem); - - return d->locale(); - } - - // Deprecated --void KCalendarSystem::setMaxMonthsInYear( int maxMonths ) -+void KCalendarSystem::setMaxMonthsInYear(int maxMonths) - { -- Q_UNUSED( maxMonths ) -+ Q_UNUSED(maxMonths) - } - - // Deprecated --void KCalendarSystem::setMaxDaysInWeek( int maxDays ) -+void KCalendarSystem::setMaxDaysInWeek(int maxDays) - { -- Q_UNUSED( maxDays ) -+ Q_UNUSED(maxDays) - } - - // Deprecated --void KCalendarSystem::setHasYear0( bool hasYear0 ) -+void KCalendarSystem::setHasYear0(bool hasYear0) - { -- Q_UNUSED( hasYear0 ) -+ Q_UNUSED(hasYear0) - } -diff --git a/kdecore/date/kcalendarsystem.h b/kdecore/date/kcalendarsystem.h -index 318e2d3..4dfda62 100644 ---- a/kdecore/date/kcalendarsystem.h -+++ b/kdecore/date/kcalendarsystem.h -@@ -45,28 +45,28 @@ public: - * Format for returned year number / month number / day number as string. - */ - enum StringFormat { -- ShortFormat, /**< Short string format, e.g. 2000 = "00" or 6 = "6" */ -- LongFormat /**< Long string format, e.g. 2000 = "2000" or 6 = "06" */ -+ ShortFormat, /**< Short string format, e.g. 2000 = "00" or 6 = "6" */ -+ LongFormat /**< Long string format, e.g. 2000 = "2000" or 6 = "06" */ - }; - - /** - * Format for returned month / day name. - */ - enum MonthNameFormat { -- ShortName, /**< Short name format, e.g. "Dec" */ -- LongName, /**< Long name format, e.g. "December" */ -- ShortNamePossessive, /**< Short name possessive format, e.g. "of Dec" */ -- LongNamePossessive, /**< Long name possessive format, e.g. "of December" */ -- NarrowName /**< Narrow name format, e.g. "D". @since 4.7 */ -+ ShortName, /**< Short name format, e.g. "Dec" */ -+ LongName, /**< Long name format, e.g. "December" */ -+ ShortNamePossessive, /**< Short name possessive format, e.g. "of Dec" */ -+ LongNamePossessive, /**< Long name possessive format, e.g. "of December" */ -+ NarrowName /**< Narrow name format, e.g. "D". @since 4.7 */ - }; - - /** - * Format for returned month / day name. - */ - enum WeekDayNameFormat { -- ShortDayName, /**< Short name format, e.g. "Fri" */ -- LongDayName, /**< Long name format, e.g. "Friday" */ -- NarrowDayName /**< Narrow name format, e.g. "F". @since 4.7 */ -+ ShortDayName, /**< Short name format, e.g. "Fri" */ -+ LongDayName, /**< Long name format, e.g. "Friday" */ -+ NarrowDayName /**< Narrow name format, e.g. "F". @since 4.7 */ - }; - - //KDE5 remove -@@ -80,8 +80,8 @@ public: - * @param locale locale to use for translations. The global locale is used if null. - * @return a KCalendarSystem object - */ -- static KCalendarSystem *create( const QString & calType = QLatin1String( "gregorian" ), -- const KLocale * locale = 0 ); -+ KDE_DEPRECATED static KCalendarSystem *create(const QString & calType = QLatin1String("gregorian"), -+ const KLocale * locale = 0); - - //KDE5 remove - /** -@@ -98,8 +98,8 @@ public: - * @param locale locale to use for translations. The global locale is used if null. - * @return a KCalendarSystem object - */ -- static KCalendarSystem *create( const QString & calType, KSharedConfig::Ptr config, -- const KLocale * locale = 0 ); -+ KDE_DEPRECATED static KCalendarSystem *create(const QString & calType, KSharedConfig::Ptr config, -+ const KLocale * locale = 0); - - //KDE5 add default value to calendarSystem - /** -@@ -111,8 +111,8 @@ public: - * @param locale locale to use for translations. The global locale is used if null. - * @return a KCalendarSystem object - */ -- static KCalendarSystem *create( KLocale::CalendarSystem calendarSystem, -- const KLocale *locale = 0 ); -+ static KCalendarSystem *create(KLocale::CalendarSystem calendarSystem, -+ const KLocale *locale = 0); - - /** - * @since 4.6 -@@ -126,8 +126,8 @@ public: - * @param locale locale to use for translations. The global locale is used if null. - * @return a KCalendarSystem object - */ -- static KCalendarSystem *create( KLocale::CalendarSystem calendarSystem, KSharedConfig::Ptr config, -- const KLocale *locale = 0 ); -+ static KCalendarSystem *create(KLocale::CalendarSystem calendarSystem, KSharedConfig::Ptr config, -+ const KLocale *locale = 0); - - //KDE5 remove - /** -@@ -137,7 +137,7 @@ public: - * - * @return list of names - */ -- static QStringList calendarSystems(); -+ KDE_DEPRECATED static QStringList calendarSystems(); - - /** - * @since 4.6 -@@ -160,23 +160,25 @@ public: - * - * @return label for calendar - */ -- static QString calendarLabel( const QString &calendarType ); -+ KDE_DEPRECATED static QString calendarLabel(const QString &calendarType); - - /** - * @since 4.6 - * - * Returns a localized label to display for the required Calendar System type. - * -- * Use with calendarSystemsList() to populate selction lists of available -+ * Use with calendarSystemsList() to populate selection lists of available - * calendar systems. - * -- * @param calendarType the specific calendar type to return the label for -+ * @param calendarSystem the specific calendar type to return the label for - * @param locale the locale to use for the label, defaults to global - * @return label for calendar - */ -- static QString calendarLabel( KLocale::CalendarSystem calendarSystem, const KLocale *locale = KGlobal::locale() ); -+ static QString calendarLabel(KLocale::CalendarSystem calendarSystem, const KLocale *locale = KGlobal::locale()); - -+ //KDE5 Remove - /** -+ * @deprecated use calendarSystem(const QString &calendarType) instead - * @since 4.6 - * - * Returns the Calendar System enum value for a given Calendar Type, -@@ -185,14 +187,38 @@ public: - * @param calendarType the calendar type to convert - * @return calendar system for calendar type - */ -- static KLocale::CalendarSystem calendarSystemForCalendarType( const QString &calendarType ); -+ KDE_DEPRECATED static KLocale::CalendarSystem calendarSystemForCalendarType(const QString &calendarType); -+ -+ //KDE5 Remove -+ /** -+ * @since 4.7 -+ * -+ * Returns the Calendar System enum value for a given Calendar Type, -+ * e.g. KLocale::QDateCalendar for "gregorian" -+ * -+ * @param calendarType the calendar type to convert -+ * @return calendar system for calendar type -+ */ -+ static KLocale::CalendarSystem calendarSystem(const QString &calendarType); -+ -+ //KDE5 remove -+ /** -+ * @since 4.7 -+ * -+ * Returns the deprecated Calendar Type for a given Calendar System enum value, -+ * e.g. "gregorian" for KLocale::QDateCalendar -+ * -+ * @param calendarSystem the calendar system to convert -+ * @return calendar type for calendar system -+ */ -+ static QString calendarType(KLocale::CalendarSystem calendarSystem); - - /** - * Constructor of abstract calendar class. This will be called by derived classes. - * - * @param locale locale to use for translations. The global locale is used if null. - */ -- explicit KCalendarSystem( const KLocale *locale = 0 ); -+ explicit KCalendarSystem(const KLocale *locale = 0); - - /** - * Constructor of abstract calendar class. This will be called by derived classes. -@@ -202,7 +228,7 @@ public: - if null. - * @param locale locale to use for translations. The global locale is used if null. - */ -- explicit KCalendarSystem( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystem(const KSharedConfig::Ptr config, const KLocale *locale = 0); - - /** - * Destructor. -@@ -216,7 +242,7 @@ public: - * - * @return type of calendar system - */ -- virtual QString calendarType() const = 0; -+ KDE_DEPRECATED virtual QString calendarType() const = 0; - - //KDE5 make virtual? - /** -@@ -285,7 +311,7 @@ public: - * @param day the day portion of the date to check - * @return @c true if the date is valid, @c false otherwise - */ -- virtual bool isValid( int year, int month, int day ) const = 0; -+ virtual bool isValid(int year, int month, int day) const = 0; - - //KDE5 make virtual? - /** -@@ -297,7 +323,7 @@ public: - * @param dayOfYear the day of year portion of the date to check - * @return @c true if the date is valid, @c false otherwise - */ -- bool isValid( int year, int dayOfYear ) const; -+ bool isValid(int year, int dayOfYear) const; - - //KDE5 make virtual? - /** -@@ -305,13 +331,13 @@ public: - * - * Returns whether a given date is valid in this calendar system. - * -- * @param era the Era Name portion of the date to check -+ * @param eraName the Era Name portion of the date to check - * @param yearInEra the Year In Era portion of the date to check - * @param month the Month portion of the date to check - * @param day the Day portion of the date to check - * @return @c true if the date is valid, @c false otherwise - */ -- bool isValid( const QString &eraName, int yearInEra, int month, int day ) const; -+ bool isValid(const QString &eraName, int yearInEra, int month, int day) const; - - //KDE5 make virtual? - /** -@@ -324,7 +350,7 @@ public: - * @param dayOfIsoWeek the day of week portion of the date to check - * @return @c true if the date is valid, @c false otherwise - */ -- bool isValidIsoWeekDate( int year, int isoWeekNumber, int dayOfIsoWeek ) const; -+ bool isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfIsoWeek) const; - - /** - * Returns whether a given date is valid in this calendar system. -@@ -332,7 +358,7 @@ public: - * @param date the date to check - * @return @c true if the date is valid, @c false otherwise - */ -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(const QDate &date) const; - - /** - * Changes the date's year, month and day. The range of the year, month -@@ -346,7 +372,7 @@ public: - * @param day day of month - * @return @c true if the date is valid, @c false otherwise - */ -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -+ virtual bool setDate(QDate &date, int year, int month, int day) const; - - //KDE5 make virtual? - /** -@@ -359,7 +385,7 @@ public: - * @param dayOfYear day of year - * @return @c true if the date is valid, @c false otherwise - */ -- bool setDate( QDate &date, int year, int dayOfYear ) const; -+ bool setDate(QDate &date, int year, int dayOfYear) const; - - //KDE5 make virtual? - /** -@@ -369,12 +395,12 @@ public: - * - * @param date date to change - * @param eraName Era string -- * @param year Year In Era number -+ * @param yearInEra Year In Era number - * @param month Month number - * @param day Day Of Month number - * @return @c true if the date is valid, @c false otherwise - */ -- bool setDate( QDate &date, QString eraName, int yearInEra, int month, int day ) const; -+ bool setDate(QDate &date, QString eraName, int yearInEra, int month, int day) const; - - //KDE5 make virtual? - /** -@@ -388,14 +414,10 @@ public: - * @param dayOfIsoWeek day of week Mon..Sun (1..7) - * @return @c true if the date is valid, @c false otherwise - */ -- bool setDateIsoWeek( QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek ) const; -+ bool setDateIsoWeek(QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek) const; - - /** -- * @deprecated -- * -- * Use setDate instead -- * -- * @see KCalendarSystem::setDate -+ * @deprecated Use setDate() instead - * - * Some implementations reject year range 00 to 99, but extended date - * ranges now require these to be accepted. Equivalent in QDate is -@@ -410,7 +432,7 @@ public: - * @param d Day of month - * @return true if the date is valid; otherwise returns false. - */ -- virtual bool setYMD( QDate &date, int y, int m, int d ) const; -+ KDE_DEPRECATED virtual bool setYMD(QDate &date, int y, int m, int d) const; - - //KDE5 make virtual? - /** -@@ -423,7 +445,7 @@ public: - * @param month month number returned in this variable - * @param day day of month returned in this variable - */ -- void getDate( const QDate date, int *year, int *month, int *day ) const; -+ void getDate(const QDate date, int *year, int *month, int *day) const; - - /** - * Returns the year portion of a given date in the current calendar system -@@ -431,7 +453,7 @@ public: - * @param date date to return year for - * @return year, 0 if input date is invalid - */ -- virtual int year( const QDate &date ) const; -+ virtual int year(const QDate &date) const; - - /** - * Returns the month portion of a given date in the current calendar system -@@ -439,7 +461,7 @@ public: - * @param date date to return month for - * @return month of year, 0 if input date is invalid - */ -- virtual int month( const QDate &date ) const; -+ virtual int month(const QDate &date) const; - - /** - * Returns the day portion of a given date in the current calendar system -@@ -447,7 +469,7 @@ public: - * @param date date to return day for - * @return day of the month, 0 if input date is invalid - */ -- virtual int day( const QDate &date ) const; -+ virtual int day(const QDate &date) const; - - //KDE5 make virtual? - /** -@@ -460,7 +482,7 @@ public: - * @param format format to return, either short or long - * @return era name, empty string if input date is invalid - */ -- QString eraName( const QDate &date, StringFormat format = ShortFormat ) const; -+ QString eraName(const QDate &date, StringFormat format = ShortFormat) const; - - //KDE5 make virtual? - /** -@@ -473,7 +495,7 @@ public: - * @param format format to return, either short or long - * @return era name, empty string if input date is invalid - */ -- QString eraYear( const QDate &date, StringFormat format = ShortFormat ) const; -+ QString eraYear(const QDate &date, StringFormat format = ShortFormat) const; - - //KDE5 make virtual? - /** -@@ -485,7 +507,7 @@ public: - * @param date date to return Year In Era for - * @return Year In Era, -1 if input date is invalid - */ -- int yearInEra( const QDate &date ) const; -+ int yearInEra(const QDate &date) const; - - /** - * Returns a QDate containing a date @p nyears years later. -@@ -494,7 +516,7 @@ public: - * @param nyears The number of years to add - * @return The new date, null date if any errors - */ -- virtual QDate addYears( const QDate &date, int nyears ) const; -+ virtual QDate addYears(const QDate &date, int nyears) const; - - /** - * Returns a QDate containing a date @p nmonths months later. -@@ -503,7 +525,7 @@ public: - * @param nmonths number of months to add - * @return The new date, null date if any errors - */ -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -+ virtual QDate addMonths(const QDate &date, int nmonths) const; - - /** - * Returns a QDate containing a date @p ndays days later. -@@ -512,7 +534,7 @@ public: - * @param ndays number of days to add - * @return The new date, null date if any errors - */ -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QDate addDays(const QDate &date, int ndays) const; - - //KDE5 make virtual? - /** -@@ -533,8 +555,8 @@ public: - * @param daysDiff Returns number of days difference - * @param direction Returns direction of difference, 1 if fromDate <= toDate, -1 otherwise - */ -- void dateDifference( const QDate &fromDate, const QDate &toDate, -- int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction ) const; -+ void dateDifference(const QDate &fromDate, const QDate &toDate, -+ int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const; - - //KDE5 make virtual? - /** -@@ -547,7 +569,7 @@ public: - * @param toDate The date to end at - * @return The number of years difference - */ -- int yearsDifference( const QDate &fromDate, const QDate &toDate ) const; -+ int yearsDifference(const QDate &fromDate, const QDate &toDate) const; - - //KDE5 make virtual? - /** -@@ -562,7 +584,7 @@ public: - * @param toDate The date to end at - * @return The number of months difference - */ -- int monthsDifference( const QDate &fromDate, const QDate &toDate ) const; -+ int monthsDifference(const QDate &fromDate, const QDate &toDate) const; - - //KDE5 make virtual? - /** -@@ -573,7 +595,7 @@ public: - * @param toDate The date to end at - * @return The number of days difference - */ -- int daysDifference( const QDate &fromDate, const QDate &toDate ) const; -+ int daysDifference(const QDate &fromDate, const QDate &toDate) const; - - /** - * Returns number of months in the given year -@@ -581,7 +603,7 @@ public: - * @param date the date to obtain year from - * @return number of months in the year, -1 if input date invalid - */ -- virtual int monthsInYear( const QDate &date ) const; -+ virtual int monthsInYear(const QDate &date) const; - - //KDE5 make virtual? - /** -@@ -592,7 +614,7 @@ public: - * @param year the required year - * @return number of months in the year, -1 if input date invalid - */ -- int monthsInYear( int year ) const; -+ int monthsInYear(int year) const; - - /** - * Returns the number of localized weeks in the given year. -@@ -600,7 +622,7 @@ public: - * @param date the date to obtain year from - * @return number of weeks in the year, -1 if input date invalid - */ -- virtual int weeksInYear( const QDate &date ) const; -+ virtual int weeksInYear(const QDate &date) const; - - //KDE5 Merge with virtual weeksInYear with default - /** -@@ -617,7 +639,7 @@ public: - * @param weekNumberSystem the week number system to use - * @return number of weeks in the year, -1 if date invalid - */ -- int weeksInYear( const QDate &date, KLocale::WeekNumberSystem weekNumberSystem ) const; -+ int weeksInYear(const QDate &date, KLocale::WeekNumberSystem weekNumberSystem) const; - - /** - * Returns the number of localized weeks in the given year. -@@ -625,7 +647,7 @@ public: - * @param year the year - * @return number of weeks in the year, -1 if input date invalid - */ -- virtual int weeksInYear( int year ) const; -+ virtual int weeksInYear(int year) const; - - //KDE5 Merge with virtual weeksInYear with default - /** -@@ -642,7 +664,7 @@ public: - * @param weekNumberSystem the week number system to use - * @return number of weeks in the year, -1 if date invalid - */ -- int weeksInYear( int year, KLocale::WeekNumberSystem weekNumberSystem ) const; -+ int weeksInYear(int year, KLocale::WeekNumberSystem weekNumberSystem) const; - - /** - * Returns the number of days in the given year. -@@ -650,7 +672,7 @@ public: - * @param date the date to obtain year from - * @return number of days in year, -1 if input date invalid - */ -- virtual int daysInYear( const QDate &date ) const; -+ virtual int daysInYear(const QDate &date) const; - - //KDE5 make virtual? - /** -@@ -661,7 +683,7 @@ public: - * @param year the year - * @return number of days in year, -1 if input date invalid - */ -- int daysInYear( int year ) const; -+ int daysInYear(int year) const; - - /** - * Returns the number of days in the given month. -@@ -669,7 +691,7 @@ public: - * @param date the date to obtain month from - * @return number of days in month, -1 if input date invalid - */ -- virtual int daysInMonth( const QDate &date ) const; -+ virtual int daysInMonth(const QDate &date) const; - - //KDE5 make virtual? - /** -@@ -681,7 +703,7 @@ public: - * @param month the month - * @return number of days in month, -1 if input date invalid - */ -- int daysInMonth( int year, int month ) const; -+ int daysInMonth(int year, int month) const; - - /** - * Returns the number of days in the given week. -@@ -689,7 +711,7 @@ public: - * @param date the date to obtain week from - * @return number of days in week, -1 if input date invalid - */ -- virtual int daysInWeek( const QDate &date ) const; -+ virtual int daysInWeek(const QDate &date) const; - - /** - * Returns the day number of year for the given date -@@ -699,7 +721,7 @@ public: - * @param date the date to obtain day from - * @return day of year number, -1 if input date not valid - */ -- virtual int dayOfYear( const QDate &date ) const; -+ virtual int dayOfYear(const QDate &date) const; - - /** - * Returns the weekday number for the given date -@@ -711,10 +733,10 @@ public: - * @param date the date to obtain day from - * @return day of week number, -1 if input date not valid - */ -- virtual int dayOfWeek( const QDate &date ) const; -+ virtual int dayOfWeek(const QDate &date) const; - - /** -- * @deprecated -+ * @deprecated use week() instead - * - * Returns the ISO week number for the given date. - * -@@ -728,7 +750,7 @@ public: - * @param yearNum returns the year the date belongs to - * @return ISO week number, -1 if input date invalid - */ -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -+ KDE_DEPRECATED virtual int weekNumber(const QDate &date, int *yearNum = 0) const; - - //KDE5 Make virtual? - /** -@@ -748,7 +770,7 @@ public: - * @param yearNum returns the year the date belongs to - * @return localized week number, -1 if input date invalid - */ -- int week( const QDate &date, int *yearNum = 0 ) const; -+ int week(const QDate &date, int *yearNum = 0) const; - - //KDE5 Make virtual? - /** -@@ -771,7 +793,7 @@ public: - * @param yearNum returns the year the date belongs to - * @return week number, -1 if input date invalid - */ -- int week( const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum = 0) const; -+ int week(const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum = 0) const; - - /** - * Returns whether a given year is a leap year. -@@ -782,7 +804,7 @@ public: - * @param year the year to check - * @return @c true if the year is a leap year, @c false otherwise - */ -- virtual bool isLeapYear( int year ) const = 0; -+ virtual bool isLeapYear(int year) const = 0; - - /** - * Returns whether a given date falls in a leap year. -@@ -793,7 +815,7 @@ public: - * @param date the date to check - * @return @c true if the date falls in a leap year, @c false otherwise - */ -- virtual bool isLeapYear( const QDate &date ) const; -+ virtual bool isLeapYear(const QDate &date) const; - - //KDE5 Make virtual? - /** -@@ -801,10 +823,10 @@ public: - * - * Returns a QDate containing the first day of the year - * -- * @param date The year to return the date for -+ * @param year The year to return the date for - * @return The first day of the year - */ -- QDate firstDayOfYear( int year ) const; -+ QDate firstDayOfYear(int year) const; - - //KDE5 Make virtual? - /** -@@ -812,10 +834,10 @@ public: - * - * Returns a QDate containing the last day of the year - * -- * @param date The year to return the date for -+ * @param year The year to return the date for - * @return The last day of the year - */ -- QDate lastDayOfYear( int year ) const; -+ QDate lastDayOfYear(int year) const; - - //KDE5 Make virtual? - /** -@@ -826,7 +848,7 @@ public: - * @param date The year to return the date for, defaults to today - * @return The first day of the year - */ -- QDate firstDayOfYear( const QDate &date = QDate::currentDate() ) const; -+ QDate firstDayOfYear(const QDate &date = QDate::currentDate()) const; - - //KDE5 Make virtual? - /** -@@ -837,7 +859,7 @@ public: - * @param date The year to return the date for, defaults to today - * @return The last day of the year - */ -- QDate lastDayOfYear( const QDate &date = QDate::currentDate() ) const; -+ QDate lastDayOfYear(const QDate &date = QDate::currentDate()) const; - - //KDE5 Make virtual? - /** -@@ -845,10 +867,11 @@ public: - * - * Returns a QDate containing the first day of the month - * -- * @param date The month to return the date for, defaults to today -+ * @param year The year to return the date for -+ * @param month The month to return the date for - * @return The first day of the month - */ -- QDate firstDayOfMonth( int year, int month ) const; -+ QDate firstDayOfMonth(int year, int month) const; - - //KDE5 Make virtual? - /** -@@ -856,10 +879,11 @@ public: - * - * Returns a QDate containing the last day of the month - * -- * @param date The month to return the date for, defaults to today -+ * @param year The year to return the date for -+ * @param month The month to return the date for - * @return The last day of the month - */ -- QDate lastDayOfMonth( int year, int month ) const; -+ QDate lastDayOfMonth(int year, int month) const; - - //KDE5 Make virtual? - /** -@@ -870,7 +894,7 @@ public: - * @param date The month to return the date for, defaults to today - * @return The first day of the month - */ -- QDate firstDayOfMonth( const QDate &date = QDate::currentDate() ) const; -+ QDate firstDayOfMonth(const QDate &date = QDate::currentDate()) const; - - //KDE5 Make virtual? - /** -@@ -881,7 +905,7 @@ public: - * @param date The month to return the date for, defaults to today - * @return The last day of the month - */ -- QDate lastDayOfMonth( const QDate &date = QDate::currentDate() ) const; -+ QDate lastDayOfMonth(const QDate &date = QDate::currentDate()) const; - - /** - * Gets specific calendar type month name for a given month number -@@ -892,7 +916,7 @@ public: - * @param format specifies whether the short month name or long month name should be used - * @return name of the month, empty string if any error - */ -- virtual QString monthName( int month, int year, MonthNameFormat format = LongName ) const = 0; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const = 0; - - /** - * Gets specific calendar type month name for a given date -@@ -901,7 +925,7 @@ public: - * @param format specifies whether the short month name or long month name should be used - * @return name of the month, empty string if any error - */ -- virtual QString monthName( const QDate &date, MonthNameFormat format = LongName ) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - - /** - * Gets specific calendar type week day name. -@@ -911,7 +935,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; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const = 0; - - /** - * Gets specific calendar type week day name. -@@ -920,9 +944,11 @@ 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; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * Converts a date into a year literal - * - * @param date date to convert -@@ -930,9 +956,11 @@ public: - * @return year literal of the date, empty string if any error - * @see year() - */ -- virtual QString yearString( const QDate &date, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED virtual QString yearString(const QDate &date, StringFormat format = LongFormat) const; - - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * Converts a date into a month literal - * - * @param pDate The date to convert -@@ -940,9 +968,11 @@ public: - * @return The month literal of the date, empty string if any error - * @see month() - */ -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED virtual QString monthString(const QDate &pDate, StringFormat format = LongFormat) const; - - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * Converts a date into a day literal - * - * @param pDate The date to convert -@@ -950,10 +980,12 @@ public: - * @return The day literal of the date, empty string if any error - * @see day() - */ -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED virtual QString dayString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.5 - * - * Converts a date into a Year In Era literal -@@ -962,10 +994,12 @@ public: - * @param format format to return, either short or long - * @return Year In Era literal of the date, empty string if any error - */ -- QString yearInEraString( const QDate &date, StringFormat format = ShortFormat ) const; -+ KDE_DEPRECATED QString yearInEraString(const QDate &date, StringFormat format = ShortFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Converts a date into a day of year literal -@@ -975,10 +1009,12 @@ public: - * @return The day of year literal of the date, empty string if any error - * @see dayOfYear() - */ -- QString dayOfYearString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED QString dayOfYearString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Converts a date into a day of week literal -@@ -987,10 +1023,12 @@ public: - * @return The day of week literal of the date, empty string if any error - * @see dayOfWeek() - */ -- QString dayOfWeekString( const QDate &pDate ) const; -+ KDE_DEPRECATED QString dayOfWeekString(const QDate &pDate) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Converts a date into a week number literal -@@ -1000,10 +1038,12 @@ public: - * @return The day literal of the date, empty string if any error - * @see weekNumber() - */ -- QString weekNumberString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED QString weekNumberString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Returns the months in year for a date as a numeric string -@@ -1013,10 +1053,12 @@ public: - * @return The months in year literal of the date, empty string if any error - * @see monthsInYear() - */ -- QString monthsInYearString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED QString monthsInYearString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Returns the weeks in year for a date as a numeric string -@@ -1026,10 +1068,12 @@ public: - * @return The weeks in year literal of the date, empty string if any error - * @see weeksInYear() - */ -- QString weeksInYearString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED QString weeksInYearString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Returns the days in year for a date as a numeric string -@@ -1039,10 +1083,12 @@ public: - * @return The days in year literal of the date, empty string if any error - * @see daysInYear() - */ -- QString daysInYearString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED QString daysInYearString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Returns the days in month for a date as a numeric string -@@ -1052,10 +1098,12 @@ public: - * @return The days in month literal of the date, empty string if any error - * @see daysInMonth() - */ -- QString daysInMonthString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ KDE_DEPRECATED QString daysInMonthString(const QDate &pDate, StringFormat format = LongFormat) const; - - //KDE5 make virtual? - /** -+ * @deprecated use formatDate(QDate, KLocale::DateTimeComponant, KLocale::DateTimeComponentFormat) -+ * - * @since 4.4 - * - * Returns the days in week for a date as a numeric string -@@ -1064,11 +1112,11 @@ public: - * @return The days in week literal of the date, empty string if any error - * @see daysInWeek() - */ -- QString daysInWeekString( const QDate &date ) const; -+ KDE_DEPRECATED QString daysInWeekString(const QDate &date) const; - - //KDE5 make protected or remove? - /** -- * @deprecated -+ * @deprecated for internal use only - * - * Converts a year literal of a part of a string into a integer starting at the beginning of the string - * -@@ -1076,11 +1124,11 @@ public: - * @param iLength The number of QChars used, and 0 if no valid symbols was found in the string - * @return An integer corresponding to the year - */ -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -+ virtual int yearStringToInteger(const QString &sNum, int &iLength) const; - - //KDE5 make protected or remove? - /** -- * @deprecated -+ * @deprecated for internal use only - * - * Converts a month literal of a part of a string into a integer starting at the beginning of the string - * -@@ -1088,11 +1136,11 @@ public: - * @param iLength The number of QChars used, and 0 if no valid symbols was found in the string - * @return An integer corresponding to the month - */ -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -+ virtual int monthStringToInteger(const QString &sNum, int &iLength) const; - - //KDE5 make protected or remove? - /** -- * @deprecated -+ * @deprecated for internal use only - * - * Converts a day literal of a part of a string into a integer starting at the beginning of the string - * -@@ -1100,7 +1148,7 @@ public: - * @param iLength The number of QChars used, and 0 if no valid symbols was found in the string - * @return An integer corresponding to the day - */ -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -+ virtual int dayStringToInteger(const QString &sNum, int &iLength) const; - - /** - * Returns a string formatted to the current locale's conventions -@@ -1118,7 +1166,7 @@ public: - * - * @return The date as a string - */ -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -+ virtual QString formatDate(const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate) const; - - //KDE5 Make virtual - /** -@@ -1237,8 +1285,8 @@ public: - * - * @return The date as a string - */ -- QString formatDate( const QDate &fromDate, const QString &toFormat, -- KLocale::DateTimeFormatStandard formatStandard = KLocale::KdeFormat ) const; -+ QString formatDate(const QDate &fromDate, const QString &toFormat, -+ KLocale::DateTimeFormatStandard formatStandard = KLocale::KdeFormat) const; - - //KDE5 Make virtual - /** -@@ -1257,8 +1305,8 @@ public: - * - * @return The date as a string - */ -- QString formatDate( const QDate &fromDate, const QString &toFormat, KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard = KLocale::KdeFormat ) const; -+ QString formatDate(const QDate &fromDate, const QString &toFormat, KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard = KLocale::KdeFormat) const; - - //KDE5 Make virtual - /** -@@ -1299,7 +1347,7 @@ public: - * - * @return the string converted to a QDate - */ -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -+ virtual QDate readDate(const QString &str, bool *ok = 0) const; - - /** - * Converts a localized date string to a QDate. -@@ -1319,7 +1367,7 @@ public: - * - * @return the string converted to a QDate - */ -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -+ virtual QDate readDate(const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0) const; - - /** - * Converts a localized date string to a QDate, using the specified @p format. -@@ -1334,7 +1382,7 @@ public: - * @see formatDate - * @see KLocale::readDate - */ -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -+ virtual QDate readDate(const QString &dateString, const QString &dateFormat, bool *ok = 0) const; - - //KDE5 Make virtual - /** -@@ -1396,8 +1444,8 @@ public: - * @see formatDate - * @see KLocale::readDate - */ -- QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok, -- KLocale::DateTimeFormatStandard formatStandard ) const; -+ QDate readDate(const QString &dateString, const QString &dateFormat, bool *ok, -+ KLocale::DateTimeFormatStandard formatStandard) const; - - //KDE5 Make virtual - /** -@@ -1448,7 +1496,7 @@ public: - * @param inputYear the year number to apply the year window to - * @return the year number after applying the year window - */ -- int applyShortYearWindow( int inputYear ) const; -+ int applyShortYearWindow(int inputYear) const; - - /** - * Use this to determine which day is the first day of the week. -@@ -1465,6 +1513,8 @@ public: - virtual int weekStartDay() const; - - /** -+ * @deprecated use KLocale::weekDayOfPray() instead -+ * - * Returns the day of the week traditionally associated with religious - * observance for this calendar system. Note this may not be accurate - * for the users locale, e.g. Gregorian calendar used in non-Christian -@@ -1473,7 +1523,7 @@ public: - * - * @return day number (None = 0, Monday = 1, ..., Sunday = 7) - */ -- virtual int weekDayOfPray() const = 0; -+ KDE_DEPRECATED virtual int weekDayOfPray() const = 0; - - /** - * Returns whether the calendar is lunar based. -@@ -1524,7 +1574,7 @@ protected: - * @param day day of month returned in this variable - * @return @c true if the date is valid, @c false otherwise - */ -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const = 0; -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const = 0; - - /** - * Internal method to convert YMD values for this calendar system into a -@@ -1542,7 +1592,7 @@ protected: - * @param jd Julian day number returned in this variable - * @return @c true if the date is valid, @c false otherwise - */ -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const = 0; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const = 0; - - /** - * Returns the locale used for translations and formats for this -@@ -1569,25 +1619,25 @@ protected: - const KLocale *locale() const; - - /** -- * @deprecated -+ * @deprecated for internal use only - * - * Sets the maximum number of months in a year - * - * Only for internal calendar system use - */ -- void setMaxMonthsInYear( int maxMonths ); -+ KDE_DEPRECATED void setMaxMonthsInYear(int maxMonths); - - /** -- * @deprecated -+ * @deprecated for internal use only - * - * Sets the maximum number of days in a week - * - * Only for internal calendar system use - */ -- void setMaxDaysInWeek( int maxDays ); -+ KDE_DEPRECATED void setMaxDaysInWeek(int maxDays); - - /** -- * @deprecated -+ * @deprecated for internal use only - * - * @since 4.4 - * -@@ -1595,7 +1645,7 @@ protected: - * - * Only for internal calendar system use - */ -- void setHasYear0( bool hasYear0 ); -+ KDE_DEPRECATED void setHasYear0(bool hasYear0); - - /** - * Constructor of abstract calendar class. This will be called by derived classes. -@@ -1606,36 +1656,38 @@ protected: - if null. - * @param locale locale to use for translations. The global locale is used if null. - */ -- KCalendarSystem( KCalendarSystemPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ KCalendarSystem(KCalendarSystemPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: - //Required for shared d-pointer as already private, remove in KDE5 - friend class KCalendarSystemCoptic; - friend class KCalendarSystemEthiopian; - friend class KCalendarSystemGregorian; -- friend class KCalendarSystemGregorianProleptic; - friend class KCalendarSystemHebrew; -- friend class KCalendarSystemHijri; - friend class KCalendarSystemIndianNational; -+ friend class KCalendarSystemIslamicCivil; - friend class KCalendarSystemJalali; - friend class KCalendarSystemJapanese; - friend class KCalendarSystemJulian; - friend class KCalendarSystemMinguo; -+ friend class KCalendarSystemQDate; - friend class KCalendarSystemThai; -+ //Other friends that need access to protected/private functions - friend class KLocalizedDate; - friend class KLocalizedDatePrivate; - friend class KDateTimeParser; -+ friend class KDateTable; - - // Era functions needed by friends, may be made public later if needed in KCM - QList<KCalendarEra> *eraList() const; -- KCalendarEra era( const QDate &eraDate ) const; -- KCalendarEra era( const QString &eraName, int yearInEra ) const; -+ KCalendarEra era(const QDate &eraDate) const; -+ KCalendarEra era(const QString &eraName, int yearInEra) const; - -- Q_DISABLE_COPY( KCalendarSystem ) -+ Q_DISABLE_COPY(KCalendarSystem) - KCalendarSystemPrivate * const d_ptr; // KDE5 make protected -- Q_DECLARE_PRIVATE( KCalendarSystem ) -+ Q_DECLARE_PRIVATE(KCalendarSystem) - }; - - #endif -diff --git a/kdecore/date/kcalendarsystemcoptic.cpp b/kdecore/date/kcalendarsystemcoptic.cpp -index d8ed426..25f4f0d 100644 ---- a/kdecore/date/kcalendarsystemcoptic.cpp -+++ b/kdecore/date/kcalendarsystemcoptic.cpp -@@ -29,8 +29,8 @@ - - // Shared d pointer implementations - --KCalendarSystemCopticPrivate::KCalendarSystemCopticPrivate( KCalendarSystemCoptic *q ) -- :KCalendarSystemPrivate( q ) -+KCalendarSystemCopticPrivate::KCalendarSystemCopticPrivate(KCalendarSystemCoptic *q) -+ : KCalendarSystemPrivate(q) - { - } - -@@ -47,22 +47,22 @@ void KCalendarSystemCopticPrivate::loadDefaultEraList() - { - QString name, shortName, format; - // AM for Anno Martyrum or "Year of the Martyrs" -- name = i18nc( "Calendar Era: Coptic Era of Martyrs, years > 0, LongFormat", "Anno Martyrum" ); -- shortName = i18nc( "Calendar Era: Coptic Era of Martyrs, years > 0, ShortFormat", "AM" ); -- format = i18nc( "(kdedt-format) Coptic, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Coptic Era of Martyrs, years > 0, LongFormat", "Anno Martyrum"); -+ shortName = i18nc("Calendar Era: Coptic Era of Martyrs, years > 0, ShortFormat", "AM"); -+ format = i18nc("(kdedt-format) Coptic, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --int KCalendarSystemCopticPrivate::monthsInYear( int year ) const -+int KCalendarSystemCopticPrivate::monthsInYear(int year) const - { -- Q_UNUSED( year ) -+ Q_UNUSED(year) - return 13; - } - --int KCalendarSystemCopticPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemCopticPrivate::daysInMonth(int year, int month) const - { -- if ( month == 13 ) { -- if ( isLeapYear( year ) ) { -+ if (month == 13) { -+ if (isLeapYear(year)) { - return 6; - } else { - return 5; -@@ -72,9 +72,9 @@ int KCalendarSystemCopticPrivate::daysInMonth( int year, int month ) const - return 30; - } - --int KCalendarSystemCopticPrivate::daysInYear( int year ) const -+int KCalendarSystemCopticPrivate::daysInYear(int year) const - { -- if ( isLeapYear( year ) ) { -+ if (isLeapYear(year)) { - return 366; - } else { - return 365; -@@ -86,16 +86,16 @@ int KCalendarSystemCopticPrivate::daysInWeek() const - return 7; - } - --bool KCalendarSystemCopticPrivate::isLeapYear( int year ) const -+bool KCalendarSystemCopticPrivate::isLeapYear(int year) const - { - //Uses same rule as Julian but offset by 1 year with year 3 being first leap year -- if ( year < 1 ) { -+ if (year < 1) { - year = year + 2; - } else { - year = year + 1; - } - -- if ( year % 4 == 0 ) { -+ if (year % 4 == 0) { - return true; - } - return false; -@@ -156,170 +156,170 @@ int KCalendarSystemCopticPrivate::latestValidYear() const - // * Mesore Mesori Mesorē Mesra Mesra - // * Kouji nabot Pi Kogi Enavot Epagomenē Nasie - // * --QString KCalendarSystemCopticPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemCopticPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( year ); -+ Q_UNUSED(year); - -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -+ if (format == KLocale::NarrowName) { -+ switch (month) { - case 1: -- return ki18nc( "Coptic month 1 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Coptic month 1 - KLocale::NarrowName", "T").toString(locale()); - case 2: -- return ki18nc( "Coptic month 2 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic month 2 - KLocale::NarrowName", "P").toString(locale()); - case 3: -- return ki18nc( "Coptic month 3 - KLocale::NarrowName", "H" ).toString( locale() ); -+ return ki18nc("Coptic month 3 - KLocale::NarrowName", "H").toString(locale()); - case 4: -- return ki18nc( "Coptic month 4 - KLocale::NarrowName", "K" ).toString( locale() ); -+ return ki18nc("Coptic month 4 - KLocale::NarrowName", "K").toString(locale()); - case 5: -- return ki18nc( "Coptic month 5 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Coptic month 5 - KLocale::NarrowName", "T").toString(locale()); - case 6: -- return ki18nc( "Coptic month 6 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Coptic month 6 - KLocale::NarrowName", "M").toString(locale()); - case 7: -- return ki18nc( "Coptic month 7 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic month 7 - KLocale::NarrowName", "P").toString(locale()); - case 8: -- return ki18nc( "Coptic month 8 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic month 8 - KLocale::NarrowName", "P").toString(locale()); - case 9: -- return ki18nc( "Coptic month 9 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic month 9 - KLocale::NarrowName", "P").toString(locale()); - case 10: -- return ki18nc( "Coptic month 10 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic month 10 - KLocale::NarrowName", "P").toString(locale()); - case 11: -- return ki18nc( "Coptic month 11 - KLocale::NarrowName", "E" ).toString( locale() ); -+ return ki18nc("Coptic month 11 - KLocale::NarrowName", "E").toString(locale()); - case 12: -- return ki18nc( "Coptic month 12 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::NarrowName", "M").toString(locale()); - case 13: -- return ki18nc( "Coptic month 13 - KLocale::NarrowName", "K" ).toString( locale() ); -+ return ki18nc("Coptic month 13 - KLocale::NarrowName", "K").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Coptic month 1 - KLocale::ShortName Possessive", "of Tho" ).toString( locale() ); -+ return ki18nc("Coptic month 1 - KLocale::ShortName Possessive", "of Tho").toString(locale()); - case 2: -- return ki18nc( "Coptic month 2 - KLocale::ShortName Possessive", "of Pao" ).toString( locale() ); -+ return ki18nc("Coptic month 2 - KLocale::ShortName Possessive", "of Pao").toString(locale()); - case 3: -- return ki18nc( "Coptic month 3 - KLocale::ShortName Possessive", "of Hat" ).toString( locale() ); -+ return ki18nc("Coptic month 3 - KLocale::ShortName Possessive", "of Hat").toString(locale()); - case 4: -- return ki18nc( "Coptic month 4 - KLocale::ShortName Possessive", "of Kia" ).toString( locale() ); -+ return ki18nc("Coptic month 4 - KLocale::ShortName Possessive", "of Kia").toString(locale()); - case 5: -- return ki18nc( "Coptic month 5 - KLocale::ShortName Possessive", "of Tob" ).toString( locale() ); -+ return ki18nc("Coptic month 5 - KLocale::ShortName Possessive", "of Tob").toString(locale()); - case 6: -- return ki18nc( "Coptic month 6 - KLocale::ShortName Possessive", "of Mes" ).toString( locale() ); -+ return ki18nc("Coptic month 6 - KLocale::ShortName Possessive", "of Mes").toString(locale()); - case 7: -- return ki18nc( "Coptic month 7 - KLocale::ShortName Possessive", "of Par" ).toString( locale() ); -+ return ki18nc("Coptic month 7 - KLocale::ShortName Possessive", "of Par").toString(locale()); - case 8: -- return ki18nc( "Coptic month 8 - KLocale::ShortName Possessive", "of Pam" ).toString( locale() ); -+ return ki18nc("Coptic month 8 - KLocale::ShortName Possessive", "of Pam").toString(locale()); - case 9: -- return ki18nc( "Coptic month 9 - KLocale::ShortName Possessive", "of Pas" ).toString( locale() ); -+ return ki18nc("Coptic month 9 - KLocale::ShortName Possessive", "of Pas").toString(locale()); - case 10: -- return ki18nc( "Coptic month 10 - KLocale::ShortName Possessive", "of Pan" ).toString( locale() ); -+ return ki18nc("Coptic month 10 - KLocale::ShortName Possessive", "of Pan").toString(locale()); - case 11: -- return ki18nc( "Coptic month 11 - KLocale::ShortName Possessive", "of Epe" ).toString( locale() ); -+ return ki18nc("Coptic month 11 - KLocale::ShortName Possessive", "of Epe").toString(locale()); - case 12: -- return ki18nc( "Coptic month 12 - KLocale::ShortName Possessive", "of Meo" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::ShortName Possessive", "of Meo").toString(locale()); - case 13: -- return ki18nc( "Coptic month 13 - KLocale::ShortName Possessive", "of Kou" ).toString( locale() ); -+ return ki18nc("Coptic month 13 - KLocale::ShortName Possessive", "of Kou").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Coptic month 1 - KLocale::ShortName", "Tho" ).toString( locale() ); -+ return ki18nc("Coptic month 1 - KLocale::ShortName", "Tho").toString(locale()); - case 2: -- return ki18nc( "Coptic month 2 - KLocale::ShortName", "Pao" ).toString( locale() ); -+ return ki18nc("Coptic month 2 - KLocale::ShortName", "Pao").toString(locale()); - case 3: -- return ki18nc( "Coptic month 3 - KLocale::ShortName", "Hat" ).toString( locale() ); -+ return ki18nc("Coptic month 3 - KLocale::ShortName", "Hat").toString(locale()); - case 4: -- return ki18nc( "Coptic month 4 - KLocale::ShortName", "Kia" ).toString( locale() ); -+ return ki18nc("Coptic month 4 - KLocale::ShortName", "Kia").toString(locale()); - case 5: -- return ki18nc( "Coptic month 5 - KLocale::ShortName", "Tob" ).toString( locale() ); -+ return ki18nc("Coptic month 5 - KLocale::ShortName", "Tob").toString(locale()); - case 6: -- return ki18nc( "Coptic month 6 - KLocale::ShortName", "Mes" ).toString( locale() ); -+ return ki18nc("Coptic month 6 - KLocale::ShortName", "Mes").toString(locale()); - case 7: -- return ki18nc( "Coptic month 7 - KLocale::ShortName", "Par" ).toString( locale() ); -+ return ki18nc("Coptic month 7 - KLocale::ShortName", "Par").toString(locale()); - case 8: -- return ki18nc( "Coptic month 8 - KLocale::ShortName", "Pam" ).toString( locale() ); -+ return ki18nc("Coptic month 8 - KLocale::ShortName", "Pam").toString(locale()); - case 9: -- return ki18nc( "Coptic month 9 - KLocale::ShortName", "Pas" ).toString( locale() ); -+ return ki18nc("Coptic month 9 - KLocale::ShortName", "Pas").toString(locale()); - case 10: -- return ki18nc( "Coptic month 10 - KLocale::ShortName", "Pan" ).toString( locale() ); -+ return ki18nc("Coptic month 10 - KLocale::ShortName", "Pan").toString(locale()); - case 11: -- return ki18nc( "Coptic month 11 - KLocale::ShortName", "Epe" ).toString( locale() ); -+ return ki18nc("Coptic month 11 - KLocale::ShortName", "Epe").toString(locale()); - case 12: -- return ki18nc( "Coptic month 12 - KLocale::ShortName", "Meo" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::ShortName", "Meo").toString(locale()); - case 13: -- return ki18nc( "Coptic month 12 - KLocale::ShortName", "Kou" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::ShortName", "Kou").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Coptic month 1 - KLocale::LongName Possessive", "of Thoout" ).toString( locale() ); -+ return ki18nc("Coptic month 1 - KLocale::LongName Possessive", "of Thoout").toString(locale()); - case 2: -- return ki18nc( "Coptic month 2 - KLocale::LongName Possessive", "of Paope" ).toString( locale() ); -+ return ki18nc("Coptic month 2 - KLocale::LongName Possessive", "of Paope").toString(locale()); - case 3: -- return ki18nc( "Coptic month 3 - KLocale::LongName Possessive", "of Hathor" ).toString( locale() ); -+ return ki18nc("Coptic month 3 - KLocale::LongName Possessive", "of Hathor").toString(locale()); - case 4: -- return ki18nc( "Coptic month 4 - KLocale::LongName Possessive", "of Kiahk" ).toString( locale() ); -+ return ki18nc("Coptic month 4 - KLocale::LongName Possessive", "of Kiahk").toString(locale()); - case 5: -- return ki18nc( "Coptic month 5 - KLocale::LongName Possessive", "of Tobe" ).toString( locale() ); -+ return ki18nc("Coptic month 5 - KLocale::LongName Possessive", "of Tobe").toString(locale()); - case 6: -- return ki18nc( "Coptic month 6 - KLocale::LongName Possessive", "of Meshir" ).toString( locale() ); -+ return ki18nc("Coptic month 6 - KLocale::LongName Possessive", "of Meshir").toString(locale()); - case 7: -- return ki18nc( "Coptic month 7 - KLocale::LongName Possessive", "of Paremhotep" ).toString( locale() ); -+ return ki18nc("Coptic month 7 - KLocale::LongName Possessive", "of Paremhotep").toString(locale()); - case 8: -- return ki18nc( "Coptic month 8 - KLocale::LongName Possessive", "of Parmoute" ).toString( locale() ); -+ return ki18nc("Coptic month 8 - KLocale::LongName Possessive", "of Parmoute").toString(locale()); - case 9: -- return ki18nc( "Coptic month 9 - KLocale::LongName Possessive", "of Pashons" ).toString( locale() ); -+ return ki18nc("Coptic month 9 - KLocale::LongName Possessive", "of Pashons").toString(locale()); - case 10: -- return ki18nc( "Coptic month 10 - KLocale::LongName Possessive", "of Paone" ).toString( locale() ); -+ return ki18nc("Coptic month 10 - KLocale::LongName Possessive", "of Paone").toString(locale()); - case 11: -- return ki18nc( "Coptic month 11 - KLocale::LongName Possessive", "of Epep" ).toString( locale() ); -+ return ki18nc("Coptic month 11 - KLocale::LongName Possessive", "of Epep").toString(locale()); - case 12: -- return ki18nc( "Coptic month 12 - KLocale::LongName Possessive", "of Mesore" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::LongName Possessive", "of Mesore").toString(locale()); - case 13: -- return ki18nc( "Coptic month 12 - KLocale::LongName Possessive", "of Kouji nabot" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::LongName Possessive", "of Kouji nabot").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( month ) { -+ switch (month) { - case 1: -- return ki18nc( "Coptic month 1 - KLocale::LongName", "Thoout" ).toString( locale() ); -+ return ki18nc("Coptic month 1 - KLocale::LongName", "Thoout").toString(locale()); - case 2: -- return ki18nc( "Coptic month 2 - KLocale::LongName", "Paope" ).toString( locale() ); -+ return ki18nc("Coptic month 2 - KLocale::LongName", "Paope").toString(locale()); - case 3: -- return ki18nc( "Coptic month 3 - KLocale::LongName", "Hathor" ).toString( locale() ); -+ return ki18nc("Coptic month 3 - KLocale::LongName", "Hathor").toString(locale()); - case 4: -- return ki18nc( "Coptic month 4 - KLocale::LongName", "Kiahk" ).toString( locale() ); -+ return ki18nc("Coptic month 4 - KLocale::LongName", "Kiahk").toString(locale()); - case 5: -- return ki18nc( "Coptic month 5 - KLocale::LongName", "Tobe" ).toString( locale() ); -+ return ki18nc("Coptic month 5 - KLocale::LongName", "Tobe").toString(locale()); - case 6: -- return ki18nc( "Coptic month 6 - KLocale::LongName", "Meshir" ).toString( locale() ); -+ return ki18nc("Coptic month 6 - KLocale::LongName", "Meshir").toString(locale()); - case 7: -- return ki18nc( "Coptic month 7 - KLocale::LongName", "Paremhotep" ).toString( locale() ); -+ return ki18nc("Coptic month 7 - KLocale::LongName", "Paremhotep").toString(locale()); - case 8: -- return ki18nc( "Coptic month 8 - KLocale::LongName", "Parmoute" ).toString( locale() ); -+ return ki18nc("Coptic month 8 - KLocale::LongName", "Parmoute").toString(locale()); - case 9: -- return ki18nc( "Coptic month 9 - KLocale::LongName", "Pashons" ).toString( locale() ); -+ return ki18nc("Coptic month 9 - KLocale::LongName", "Pashons").toString(locale()); - case 10: -- return ki18nc( "Coptic month 10 - KLocale::LongName", "Paone" ).toString( locale() ); -+ return ki18nc("Coptic month 10 - KLocale::LongName", "Paone").toString(locale()); - case 11: -- return ki18nc( "Coptic month 11 - KLocale::LongName", "Epep" ).toString( locale() ); -+ return ki18nc("Coptic month 11 - KLocale::LongName", "Epep").toString(locale()); - case 12: -- return ki18nc( "Coptic month 12 - KLocale::LongName", "Mesore" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::LongName", "Mesore").toString(locale()); - case 13: -- return ki18nc( "Coptic month 12 - KLocale::LongName", "Kouji nabot" ).toString( locale() ); -+ return ki18nc("Coptic month 12 - KLocale::LongName", "Kouji nabot").toString(locale()); - default: - return QString(); - } -@@ -327,115 +327,111 @@ QString KCalendarSystemCopticPrivate::monthName( int month, int year, KLocale::D - - // 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 -+QString KCalendarSystemCopticPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Coptic weekday 1 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic weekday 1 - KLocale::NarrowName", "P").toString(locale()); - case 2: -- return ki18nc( "Coptic weekday 2 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic weekday 2 - KLocale::NarrowName", "P").toString(locale()); - case 3: -- return ki18nc( "Coptic weekday 3 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic weekday 3 - KLocale::NarrowName", "P").toString(locale()); - case 4: -- return ki18nc( "Coptic weekday 4 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic weekday 4 - KLocale::NarrowName", "P").toString(locale()); - case 5: -- return ki18nc( "Coptic weekday 5 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic weekday 5 - KLocale::NarrowName", "P").toString(locale()); - case 6: -- return ki18nc( "Coptic weekday 6 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Coptic weekday 6 - KLocale::NarrowName", "P").toString(locale()); - case 7: -- return ki18nc( "Coptic weekday 7 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Coptic weekday 7 - KLocale::NarrowName", "T").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Coptic weekday 1 - KLocale::ShortName", "Pes" ).toString( locale() ); -+ return ki18nc("Coptic weekday 1 - KLocale::ShortName", "Pes").toString(locale()); - case 2: -- return ki18nc( "Coptic weekday 2 - KLocale::ShortName", "Psh" ).toString( locale() ); -+ return ki18nc("Coptic weekday 2 - KLocale::ShortName", "Psh").toString(locale()); - case 3: -- return ki18nc( "Coptic weekday 3 - KLocale::ShortName", "Pef" ).toString( locale() ); -+ return ki18nc("Coptic weekday 3 - KLocale::ShortName", "Pef").toString(locale()); - case 4: -- return ki18nc( "Coptic weekday 4 - KLocale::ShortName", "Pti" ).toString( locale() ); -+ return ki18nc("Coptic weekday 4 - KLocale::ShortName", "Pti").toString(locale()); - case 5: -- return ki18nc( "Coptic weekday 5 - KLocale::ShortName", "Pso" ).toString( locale() ); -+ return ki18nc("Coptic weekday 5 - KLocale::ShortName", "Pso").toString(locale()); - case 6: -- return ki18nc( "Coptic weekday 6 - KLocale::ShortName", "Psa" ).toString( locale() ); -+ return ki18nc("Coptic weekday 6 - KLocale::ShortName", "Psa").toString(locale()); - case 7: -- return ki18nc( "Coptic weekday 7 - KLocale::ShortName", "Tky" ).toString( locale() ); -+ return ki18nc("Coptic weekday 7 - KLocale::ShortName", "Tky").toString(locale()); - default: - return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Coptic weekday 1 - KLocale::LongName", "Pesnau" ).toString( locale() ); -+ return ki18nc("Coptic weekday 1 - KLocale::LongName", "Pesnau").toString(locale()); - case 2: -- return ki18nc( "Coptic weekday 2 - KLocale::LongName", "Pshoment" ).toString( locale() ); -+ return ki18nc("Coptic weekday 2 - KLocale::LongName", "Pshoment").toString(locale()); - case 3: -- return ki18nc( "Coptic weekday 3 - KLocale::LongName", "Peftoou" ).toString( locale() ); -+ return ki18nc("Coptic weekday 3 - KLocale::LongName", "Peftoou").toString(locale()); - case 4: -- return ki18nc( "Coptic weekday 4 - KLocale::LongName", "Ptiou" ).toString( locale() ); -+ return ki18nc("Coptic weekday 4 - KLocale::LongName", "Ptiou").toString(locale()); - case 5: -- return ki18nc( "Coptic weekday 5 - KLocale::LongName", "Psoou" ).toString( locale() ); -+ return ki18nc("Coptic weekday 5 - KLocale::LongName", "Psoou").toString(locale()); - case 6: -- return ki18nc( "Coptic weekday 6 - KLocale::LongName", "Psabbaton" ).toString( locale() ); -+ return ki18nc("Coptic weekday 6 - KLocale::LongName", "Psabbaton").toString(locale()); - case 7: -- return ki18nc( "Coptic weekday 7 - KLocale::LongName", "Tkyriakē" ).toString( locale() ); -+ return ki18nc("Coptic weekday 7 - KLocale::LongName", "Tkyriakē").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemCoptic::KCalendarSystemCoptic( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemCopticPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemCoptic::KCalendarSystemCoptic(const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemCopticPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemCoptic::KCalendarSystemCoptic( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemCopticPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemCoptic::KCalendarSystemCoptic(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemCopticPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemCoptic::KCalendarSystemCoptic( KCalendarSystemCopticPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemCoptic::KCalendarSystemCoptic(KCalendarSystemCopticPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemCoptic::~KCalendarSystemCoptic() - { -- delete dont_use; - } - - QString KCalendarSystemCoptic::calendarType() const - { -- return QLatin1String( "coptic" ); -+ return QLatin1String("coptic"); - } - - QDate KCalendarSystemCoptic::epoch() const - { - //0001-01-01, no Year 0. - //0284-08-29 AD Julian -- return QDate::fromJulianDay( 1825030 ); -+ return QDate::fromJulianDay(1825030); - } - - QDate KCalendarSystemCoptic::earliestValidDate() const - { - //0001-01-01, no Year 0. - //0284-08-29 AD Julian -- return QDate::fromJulianDay( 1825030 ); -+ return QDate::fromJulianDay(1825030); - } - - QDate KCalendarSystemCoptic::latestValidDate() const -@@ -443,188 +439,47 @@ QDate KCalendarSystemCoptic::latestValidDate() const - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - //9999-12-30 - //10283-08-29 AD Julian -- return QDate::fromJulianDay( 5477164 ); -+ return QDate::fromJulianDay(5477164); - } - --bool KCalendarSystemCoptic::isValid( int year, int month, int day ) const -+bool KCalendarSystemCoptic::isValid(int year, int month, int day) const - { -- return KCalendarSystem::isValid( year, month, day ); -+ return KCalendarSystem::isValid(year, month, day); - } - --bool KCalendarSystemCoptic::isValid( const QDate &date ) const -+bool KCalendarSystemCoptic::isValid(const QDate &date) const - { -- return KCalendarSystem::isValid( date ); -+ return KCalendarSystem::isValid(date); - } - --bool KCalendarSystemCoptic::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemCoptic::isLeapYear(int year) const - { -- return KCalendarSystem::setDate( date, year, month, day ); -+ return KCalendarSystem::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemCoptic::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemCoptic::isLeapYear(const QDate &date) const - { -- return KCalendarSystem::setDate( date, y, m, d ); -+ return KCalendarSystem::isLeapYear(date); - } - --int KCalendarSystemCoptic::year( const QDate &date ) const -+QString KCalendarSystemCoptic::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystem::year( date ); -+ return KCalendarSystem::monthName(month, year, format); - } - --int KCalendarSystemCoptic::month( const QDate &date ) const -+QString KCalendarSystemCoptic::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystem::month( date ); -+ return KCalendarSystem::monthName(date, format); - } - --int KCalendarSystemCoptic::day( const QDate &date ) const -+QString KCalendarSystemCoptic::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystem::day( date ); -+ return KCalendarSystem::weekDayName(weekDay, format); - } - --QDate KCalendarSystemCoptic::addYears( const QDate &date, int nyears ) const -+QString KCalendarSystemCoptic::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemCoptic::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemCoptic::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemCoptic::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemCoptic::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemCoptic::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemCoptic::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemCoptic::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemCoptic::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemCoptic::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemCoptic::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystem::dayOfWeek( date ); --} -- --int KCalendarSystemCoptic::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemCoptic::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemCoptic::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemCoptic::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemCoptic::monthName( const QDate &date, MonthNameFormat format ) const --{ -- 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 ); --} -- --QString KCalendarSystemCoptic::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemCoptic::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemCoptic::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemCoptic::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemCoptic::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemCoptic::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemCoptic::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemCoptic::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemCoptic::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemCoptic::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- --int KCalendarSystemCoptic::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); -+ return KCalendarSystem::weekDayName(date, format); - } - - int KCalendarSystemCoptic::weekDayOfPray() const -@@ -652,7 +507,7 @@ bool KCalendarSystemCoptic::isProleptic() const - return false; - } - --bool KCalendarSystemCoptic::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemCoptic::julianDayToDate(int jd, int &year, int &month, int &day) const - { - //The Coptic calendar has 12 months of 30 days, a 13th month of 5 or 6 days, - //and a leap year every 4th year without fail that falls on the last day of -@@ -663,32 +518,32 @@ bool KCalendarSystemCoptic::julianDayToDate( int jd, int &year, int &month, int - //pattern of 365/365/365/366 with the leap day the very last day makes the maths easier. - - //Day number in the fake epoch, 0 indexed -- int dayInEpoch = jd - ( epoch().toJulianDay() - 365 ); -+ int dayInEpoch = jd - (epoch().toJulianDay() - 365); - //How many full 4 year leap cycles have been completed, 1461 = (365*3)+366 - int leapCyclesCompleted = dayInEpoch / 1461; - //Which year are we in the current 4 year leap cycle, 0 indexed - //Need the qMin as day 366 of 4th year of cycle returns following year (max 3 as 0 index) -- int yearInCurrentLeapCycle = qMin( 3, ( dayInEpoch % 1461 ) / 365 ); -+ int yearInCurrentLeapCycle = qMin(3, (dayInEpoch % 1461) / 365); - //Calculate the year -- year = ( leapCyclesCompleted * 4 ) + yearInCurrentLeapCycle; -+ year = (leapCyclesCompleted * 4) + yearInCurrentLeapCycle; - //Days since the fake epoch up to 1st day of this year -- int daysBeforeThisYear = ( year * 365 ) + ( year / 4 ); -+ int daysBeforeThisYear = (year * 365) + (year / 4); - //Gives the day number in this year, 0 indexed - int dayOfThisYear = dayInEpoch - daysBeforeThisYear; - //Then just calculate month and day from that based on regular 30 day months -- month = ( ( dayOfThisYear ) / 30 ) + 1; -- day = dayOfThisYear - ( ( month - 1 ) * 30 ) + 1; -+ month = ((dayOfThisYear) / 30) + 1; -+ day = dayOfThisYear - ((month - 1) * 30) + 1; - - // If year is -ve then is BC. In Coptic there is no year 0, but the maths - // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside -- if ( year < 1 ) { -+ if (year < 1) { - year = year - 1; - } - - return true; - } - --bool KCalendarSystemCoptic::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemCoptic::dateToJulianDay(int year, int month, int day, int &jd) const - { - //The Coptic calendar has 12 months of 30 days, a 13th month of 5 or 6 days, - //and a leap year every 4th year without fail that falls on the last day of -@@ -699,17 +554,17 @@ bool KCalendarSystemCoptic::dateToJulianDay( int year, int month, int day, int & - // If year is -ve then is 'BC'. In Coptic there is no year 0, but the maths - // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally - int y; -- if ( year < 1 ) { -+ if (year < 1) { - y = year + 1; - } else { - y = year; - } - - jd = epoch().toJulianDay() - 1 // jd of day before Epoch -- + ( ( y - 1 ) * 365 ) // Add all normal days in years preceding -- + ( y / 4 ) // Add all leap days in years preceding -- + ( ( month - 1 ) * 30 ) // Add days this year in months preceding -- + day; // Add days in this month -+ + ((y - 1) * 365) // Add all normal days in years preceding -+ + (y / 4) // Add all leap days in years preceding -+ + ((month - 1) * 30) // Add days this year in months preceding -+ + day; // Add days in this month - - return true; - } -diff --git a/kdecore/date/kcalendarsystemcoptic_p.h b/kdecore/date/kcalendarsystemcoptic_p.h -index e62c0e2..d7498a4 100644 ---- a/kdecore/date/kcalendarsystemcoptic_p.h -+++ b/kdecore/date/kcalendarsystemcoptic_p.h -@@ -37,8 +37,8 @@ class KCalendarSystemCopticPrivate; - class KCalendarSystemCoptic: public KCalendarSystem - { - public: -- explicit KCalendarSystemCoptic( const KLocale *locale = 0 ); -- explicit KCalendarSystemCoptic( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemCoptic(const KLocale *locale = 0); -+ explicit KCalendarSystemCoptic(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemCoptic(); - - virtual QString calendarType() const; -@@ -46,58 +46,19 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -105,14 +66,13 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemCoptic( KCalendarSystemCopticPrivate &dd, const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemCoptic(KCalendarSystemCopticPrivate &dd, const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: -- Q_DECLARE_PRIVATE( KCalendarSystemCoptic ) -- KCalendarSystemCopticPrivate * const dont_use; // KDE5 remove, use shared d -+ Q_DECLARE_PRIVATE(KCalendarSystemCoptic) - }; - - #endif // KCALENDARSYSTEMCOPTIC_H -diff --git a/kdecore/date/kcalendarsystemcopticprivate_p.h b/kdecore/date/kcalendarsystemcopticprivate_p.h -index e2a15ca..d30bd6a 100644 ---- a/kdecore/date/kcalendarsystemcopticprivate_p.h -+++ b/kdecore/date/kcalendarsystemcopticprivate_p.h -@@ -25,26 +25,26 @@ - class KCalendarSystemCopticPrivate : public KCalendarSystemPrivate - { - public: -- explicit KCalendarSystemCopticPrivate( KCalendarSystemCoptic *q ); -+ explicit KCalendarSystemCopticPrivate(KCalendarSystemCoptic *q); - - virtual ~KCalendarSystemCopticPrivate(); - - // Virtual methods each calendar system must re-implement - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual int monthsInYear( int year ) const; -- virtual int daysInMonth( int year, int month ) const; -- virtual int daysInYear( int year ) const; -+ 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 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; -- virtual QString monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const; -- virtual QString weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) 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 967c356..d337003 100644 ---- a/kdecore/date/kcalendarsystemethiopian.cpp -+++ b/kdecore/date/kcalendarsystemethiopian.cpp -@@ -30,18 +30,16 @@ - class KCalendarSystemEthiopianPrivate : public KCalendarSystemCopticPrivate - { - public: -- explicit KCalendarSystemEthiopianPrivate( KCalendarSystemEthiopian *q ) : KCalendarSystemCopticPrivate( q ) -- { -+ explicit KCalendarSystemEthiopianPrivate(KCalendarSystemEthiopian *q) : KCalendarSystemCopticPrivate(q) { - } - -- virtual ~KCalendarSystemEthiopianPrivate() -- { -+ virtual ~KCalendarSystemEthiopianPrivate() { - } - - virtual KLocale::CalendarSystem calendarSystem() const; - 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; -+ virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const; -+ virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const; - }; - - KLocale::CalendarSystem KCalendarSystemEthiopianPrivate::calendarSystem() const -@@ -53,291 +51,287 @@ void KCalendarSystemEthiopianPrivate::loadDefaultEraList() - { - QString name, shortName, format; - // Incarnation Era, Amätä Mehrät, "Year of Mercy". -- name = i18nc( "Calendar Era: Ethiopian Incarnation Era, years > 0, LongFormat", "Amata Mehrat" ); -- shortName = i18nc( "Calendar Era: Ethiopian Incarnation Era, years > 0, ShortFormat", "AM" ); -- format = i18nc( "(kdedt-format) Ethiopian, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Ethiopian Incarnation Era, years > 0, LongFormat", "Amata Mehrat"); -+ shortName = i18nc("Calendar Era: Ethiopian Incarnation Era, years > 0, ShortFormat", "AM"); -+ format = i18nc("(kdedt-format) Ethiopian, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - - // Names taken from http://www.ethiopianembassy.at/dates_cycles.htm, alternative transliterations exist --QString KCalendarSystemEthiopianPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemEthiopianPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( year ); -+ Q_UNUSED(year); - -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -+ if (format == KLocale::NarrowName) { -+ switch (month) { - case 1: -- return ki18nc( "Ethiopian month 1 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Ethiopian month 1 - KLocale::NarrowName", "M").toString(locale()); - case 2: -- return ki18nc( "Ethiopian month 2 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Ethiopian month 2 - KLocale::NarrowName", "T").toString(locale()); - case 3: -- return ki18nc( "Ethiopian month 3 - KLocale::NarrowName", "H" ).toString( locale() ); -+ return ki18nc("Ethiopian month 3 - KLocale::NarrowName", "H").toString(locale()); - case 4: -- return ki18nc( "Ethiopian month 4 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Ethiopian month 4 - KLocale::NarrowName", "T").toString(locale()); - case 5: -- return ki18nc( "Ethiopian month 5 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Ethiopian month 5 - KLocale::NarrowName", "T").toString(locale()); - case 6: -- return ki18nc( "Ethiopian month 6 - KLocale::NarrowName", "Y" ).toString( locale() ); -+ return ki18nc("Ethiopian month 6 - KLocale::NarrowName", "Y").toString(locale()); - case 7: -- return ki18nc( "Ethiopian month 7 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Ethiopian month 7 - KLocale::NarrowName", "M").toString(locale()); - case 8: -- return ki18nc( "Ethiopian month 8 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Ethiopian month 8 - KLocale::NarrowName", "M").toString(locale()); - case 9: -- return ki18nc( "Ethiopian month 9 - KLocale::NarrowName", "G" ).toString( locale() ); -+ return ki18nc("Ethiopian month 9 - KLocale::NarrowName", "G").toString(locale()); - case 10: -- return ki18nc( "Ethiopian month 10 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Ethiopian month 10 - KLocale::NarrowName", "S").toString(locale()); - case 11: -- return ki18nc( "Ethiopian month 11 - KLocale::NarrowName", "H" ).toString( locale() ); -+ return ki18nc("Ethiopian month 11 - KLocale::NarrowName", "H").toString(locale()); - case 12: -- return ki18nc( "Ethiopian month 12 - KLocale::NarrowName", "N" ).toString( locale() ); -+ return ki18nc("Ethiopian month 12 - KLocale::NarrowName", "N").toString(locale()); - case 13: -- return ki18nc( "Ethiopian month 13 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Ethiopian month 13 - KLocale::NarrowName", "P").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Ethiopian month 1 - KLocale::ShortName Possessive", "of Mes" ).toString( locale() ); -+ return ki18nc("Ethiopian month 1 - KLocale::ShortName Possessive", "of Mes").toString(locale()); - case 2: -- return ki18nc( "Ethiopian month 2 - KLocale::ShortName Possessive", "of Teq" ).toString( locale() ); -+ return ki18nc("Ethiopian month 2 - KLocale::ShortName Possessive", "of Teq").toString(locale()); - case 3: -- return ki18nc( "Ethiopian month 3 - KLocale::ShortName Possessive", "of Hed" ).toString( locale() ); -+ return ki18nc("Ethiopian month 3 - KLocale::ShortName Possessive", "of Hed").toString(locale()); - case 4: -- return ki18nc( "Ethiopian month 4 - KLocale::ShortName Possessive", "of Tah" ).toString( locale() ); -+ return ki18nc("Ethiopian month 4 - KLocale::ShortName Possessive", "of Tah").toString(locale()); - case 5: -- return ki18nc( "Ethiopian month 5 - KLocale::ShortName Possessive", "of Ter" ).toString( locale() ); -+ return ki18nc("Ethiopian month 5 - KLocale::ShortName Possessive", "of Ter").toString(locale()); - case 6: -- return ki18nc( "Ethiopian month 6 - KLocale::ShortName Possessive", "of Yak" ).toString( locale() ); -+ return ki18nc("Ethiopian month 6 - KLocale::ShortName Possessive", "of Yak").toString(locale()); - case 7: -- return ki18nc( "Ethiopian month 7 - KLocale::ShortName Possessive", "of Mag" ).toString( locale() ); -+ return ki18nc("Ethiopian month 7 - KLocale::ShortName Possessive", "of Mag").toString(locale()); - case 8: -- return ki18nc( "Ethiopian month 8 - KLocale::ShortName Possessive", "of Miy" ).toString( locale() ); -+ return ki18nc("Ethiopian month 8 - KLocale::ShortName Possessive", "of Miy").toString(locale()); - case 9: -- return ki18nc( "Ethiopian month 9 - KLocale::ShortName Possessive", "of Gen" ).toString( locale() ); -+ return ki18nc("Ethiopian month 9 - KLocale::ShortName Possessive", "of Gen").toString(locale()); - case 10: -- return ki18nc( "Ethiopian month 10 - KLocale::ShortName Possessive", "of Sen" ).toString( locale() ); -+ return ki18nc("Ethiopian month 10 - KLocale::ShortName Possessive", "of Sen").toString(locale()); - case 11: -- return ki18nc( "Ethiopian month 11 - KLocale::ShortName Possessive", "of Ham" ).toString( locale() ); -+ return ki18nc("Ethiopian month 11 - KLocale::ShortName Possessive", "of Ham").toString(locale()); - case 12: -- return ki18nc( "Ethiopian month 12 - KLocale::ShortName Possessive", "of Neh" ).toString( locale() ); -+ return ki18nc("Ethiopian month 12 - KLocale::ShortName Possessive", "of Neh").toString(locale()); - case 13: -- return ki18nc( "Ethiopian month 13 - KLocale::ShortName Possessive", "of Pag" ).toString( locale() ); -+ return ki18nc("Ethiopian month 13 - KLocale::ShortName Possessive", "of Pag").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Ethiopian month 1 - KLocale::ShortName", "Mes" ).toString( locale() ); -+ return ki18nc("Ethiopian month 1 - KLocale::ShortName", "Mes").toString(locale()); - case 2: -- return ki18nc( "Ethiopian month 2 - KLocale::ShortName", "Teq" ).toString( locale() ); -+ return ki18nc("Ethiopian month 2 - KLocale::ShortName", "Teq").toString(locale()); - case 3: -- return ki18nc( "Ethiopian month 3 - KLocale::ShortName", "Hed" ).toString( locale() ); -+ return ki18nc("Ethiopian month 3 - KLocale::ShortName", "Hed").toString(locale()); - case 4: -- return ki18nc( "Ethiopian month 4 - KLocale::ShortName", "Tah" ).toString( locale() ); -+ return ki18nc("Ethiopian month 4 - KLocale::ShortName", "Tah").toString(locale()); - case 5: -- return ki18nc( "Ethiopian month 5 - KLocale::ShortName", "Ter" ).toString( locale() ); -+ return ki18nc("Ethiopian month 5 - KLocale::ShortName", "Ter").toString(locale()); - case 6: -- return ki18nc( "Ethiopian month 6 - KLocale::ShortName", "Yak" ).toString( locale() ); -+ return ki18nc("Ethiopian month 6 - KLocale::ShortName", "Yak").toString(locale()); - case 7: -- return ki18nc( "Ethiopian month 7 - KLocale::ShortName", "Mag" ).toString( locale() ); -+ return ki18nc("Ethiopian month 7 - KLocale::ShortName", "Mag").toString(locale()); - case 8: -- return ki18nc( "Ethiopian month 8 - KLocale::ShortName", "Miy" ).toString( locale() ); -+ return ki18nc("Ethiopian month 8 - KLocale::ShortName", "Miy").toString(locale()); - case 9: -- return ki18nc( "Ethiopian month 9 - KLocale::ShortName", "Gen" ).toString( locale() ); -+ return ki18nc("Ethiopian month 9 - KLocale::ShortName", "Gen").toString(locale()); - case 10: -- return ki18nc( "Ethiopian month 10 - KLocale::ShortName", "Sen" ).toString( locale() ); -+ return ki18nc("Ethiopian month 10 - KLocale::ShortName", "Sen").toString(locale()); - case 11: -- return ki18nc( "Ethiopian month 11 - KLocale::ShortName", "Ham" ).toString( locale() ); -+ return ki18nc("Ethiopian month 11 - KLocale::ShortName", "Ham").toString(locale()); - case 12: -- return ki18nc( "Ethiopian month 12 - KLocale::ShortName", "Neh" ).toString( locale() ); -+ return ki18nc("Ethiopian month 12 - KLocale::ShortName", "Neh").toString(locale()); - case 13: -- return ki18nc( "Ethiopian month 13 - KLocale::ShortName", "Pag" ).toString( locale() ); -+ return ki18nc("Ethiopian month 13 - KLocale::ShortName", "Pag").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Ethiopian month 1 - KLocale::LongName Possessive", "of Meskerem" ).toString( locale() ); -+ return ki18nc("Ethiopian month 1 - KLocale::LongName Possessive", "of Meskerem").toString(locale()); - case 2: -- return ki18nc( "Ethiopian month 2 - KLocale::LongName Possessive", "of Tequemt" ).toString( locale() ); -+ return ki18nc("Ethiopian month 2 - KLocale::LongName Possessive", "of Tequemt").toString(locale()); - case 3: -- return ki18nc( "Ethiopian month 3 - KLocale::LongName Possessive", "of Hedar" ).toString( locale() ); -+ return ki18nc("Ethiopian month 3 - KLocale::LongName Possessive", "of Hedar").toString(locale()); - case 4: -- return ki18nc( "Ethiopian month 4 - KLocale::LongName Possessive", "of Tahsas" ).toString( locale() ); -+ return ki18nc("Ethiopian month 4 - KLocale::LongName Possessive", "of Tahsas").toString(locale()); - case 5: -- return ki18nc( "Ethiopian month 5 - KLocale::LongName Possessive", "of Ter" ).toString( locale() ); -+ return ki18nc("Ethiopian month 5 - KLocale::LongName Possessive", "of Ter").toString(locale()); - case 6: -- return ki18nc( "Ethiopian month 6 - KLocale::LongName Possessive", "of Yakatit" ).toString( locale() ); -+ return ki18nc("Ethiopian month 6 - KLocale::LongName Possessive", "of Yakatit").toString(locale()); - case 7: -- return ki18nc( "Ethiopian month 7 - KLocale::LongName Possessive", "of Magabit" ).toString( locale() ); -+ return ki18nc("Ethiopian month 7 - KLocale::LongName Possessive", "of Magabit").toString(locale()); - case 8: -- return ki18nc( "Ethiopian month 8 - KLocale::LongName Possessive", "of Miyazya" ).toString( locale() ); -+ return ki18nc("Ethiopian month 8 - KLocale::LongName Possessive", "of Miyazya").toString(locale()); - case 9: -- return ki18nc( "Ethiopian month 9 - KLocale::LongName Possessive", "of Genbot" ).toString( locale() ); -+ return ki18nc("Ethiopian month 9 - KLocale::LongName Possessive", "of Genbot").toString(locale()); - case 10: -- return ki18nc( "Ethiopian month 10 - KLocale::LongName Possessive", "of Sene" ).toString( locale() ); -+ return ki18nc("Ethiopian month 10 - KLocale::LongName Possessive", "of Sene").toString(locale()); - case 11: -- return ki18nc( "Ethiopian month 11 - KLocale::LongName Possessive", "of Hamle" ).toString( locale() ); -+ return ki18nc("Ethiopian month 11 - KLocale::LongName Possessive", "of Hamle").toString(locale()); - case 12: -- return ki18nc( "Ethiopian month 12 - KLocale::LongName Possessive", "of Nehase" ).toString( locale() ); -+ return ki18nc("Ethiopian month 12 - KLocale::LongName Possessive", "of Nehase").toString(locale()); - case 13: -- return ki18nc( "Ethiopian month 13 - KLocale::LongName Possessive", "of Pagumen" ).toString( locale() ); -+ return ki18nc("Ethiopian month 13 - KLocale::LongName Possessive", "of Pagumen").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( month ) { -+ switch (month) { - case 1: -- return ki18nc( "Ethiopian month 1 - KLocale::LongName", "Meskerem" ).toString( locale() ); -+ return ki18nc("Ethiopian month 1 - KLocale::LongName", "Meskerem").toString(locale()); - case 2: -- return ki18nc( "Ethiopian month 2 - KLocale::LongName", "Tequemt" ).toString( locale() ); -+ return ki18nc("Ethiopian month 2 - KLocale::LongName", "Tequemt").toString(locale()); - case 3: -- return ki18nc( "Ethiopian month 3 - KLocale::LongName", "Hedar" ).toString( locale() ); -+ return ki18nc("Ethiopian month 3 - KLocale::LongName", "Hedar").toString(locale()); - case 4: -- return ki18nc( "Ethiopian month 4 - KLocale::LongName", "Tahsas" ).toString( locale() ); -+ return ki18nc("Ethiopian month 4 - KLocale::LongName", "Tahsas").toString(locale()); - case 5: -- return ki18nc( "Ethiopian month 5 - KLocale::LongName", "Ter" ).toString( locale() ); -+ return ki18nc("Ethiopian month 5 - KLocale::LongName", "Ter").toString(locale()); - case 6: -- return ki18nc( "Ethiopian month 6 - KLocale::LongName", "Yakatit" ).toString( locale() ); -+ return ki18nc("Ethiopian month 6 - KLocale::LongName", "Yakatit").toString(locale()); - case 7: -- return ki18nc( "Ethiopian month 7 - KLocale::LongName", "Magabit" ).toString( locale() ); -+ return ki18nc("Ethiopian month 7 - KLocale::LongName", "Magabit").toString(locale()); - case 8: -- return ki18nc( "Ethiopian month 8 - KLocale::LongName", "Miyazya" ).toString( locale() ); -+ return ki18nc("Ethiopian month 8 - KLocale::LongName", "Miyazya").toString(locale()); - case 9: -- return ki18nc( "Ethiopian month 9 - KLocale::LongName", "Genbot" ).toString( locale() ); -+ return ki18nc("Ethiopian month 9 - KLocale::LongName", "Genbot").toString(locale()); - case 10: -- return ki18nc( "Ethiopian month 10 - KLocale::LongName", "Sene" ).toString( locale() ); -+ return ki18nc("Ethiopian month 10 - KLocale::LongName", "Sene").toString(locale()); - case 11: -- return ki18nc( "Ethiopian month 11 - KLocale::LongName", "Hamle" ).toString( locale() ); -+ return ki18nc("Ethiopian month 11 - KLocale::LongName", "Hamle").toString(locale()); - case 12: -- return ki18nc( "Ethiopian month 12 - KLocale::LongName", "Nehase" ).toString( locale() ); -+ return ki18nc("Ethiopian month 12 - KLocale::LongName", "Nehase").toString(locale()); - case 13: -- return ki18nc( "Ethiopian month 13 - KLocale::LongName", "Pagumen" ).toString( locale() ); -+ return ki18nc("Ethiopian month 13 - KLocale::LongName", "Pagumen").toString(locale()); - default: - return QString(); - } - } - - // Names taken from http://www.ethiopianembassy.at/dates_cycles.htm, alternative transliterations exist --QString KCalendarSystemEthiopianPrivate::weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const -+QString KCalendarSystemEthiopianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Ethiopian weekday 1 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 1 - KLocale::NarrowName ", "S").toString(locale()); - case 2: -- return ki18nc( "Ethiopian weekday 2 - KLocale::NarrowName ", "M" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 2 - KLocale::NarrowName ", "M").toString(locale()); - case 3: -- return ki18nc( "Ethiopian weekday 3 - KLocale::NarrowName ", "R" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 3 - KLocale::NarrowName ", "R").toString(locale()); - case 4: -- return ki18nc( "Ethiopian weekday 4 - KLocale::NarrowName ", "H" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 4 - KLocale::NarrowName ", "H").toString(locale()); - case 5: -- return ki18nc( "Ethiopian weekday 5 - KLocale::NarrowName ", "A" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 5 - KLocale::NarrowName ", "A").toString(locale()); - case 6: -- return ki18nc( "Ethiopian weekday 6 - KLocale::NarrowName ", "Q" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 6 - KLocale::NarrowName ", "Q").toString(locale()); - case 7: -- return ki18nc( "Ethiopian weekday 7 - KLocale::NarrowName ", "E" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 7 - KLocale::NarrowName ", "E").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Ethiopian weekday 1 - KLocale::ShortName", "Seg" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 1 - KLocale::ShortName", "Seg").toString(locale()); - case 2: -- return ki18nc( "Ethiopian weekday 2 - KLocale::ShortName", "Mak" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 2 - KLocale::ShortName", "Mak").toString(locale()); - case 3: -- return ki18nc( "Ethiopian weekday 3 - KLocale::ShortName", "Rob" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 3 - KLocale::ShortName", "Rob").toString(locale()); - case 4: -- return ki18nc( "Ethiopian weekday 4 - KLocale::ShortName", "Ham" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 4 - KLocale::ShortName", "Ham").toString(locale()); - case 5: -- return ki18nc( "Ethiopian weekday 5 - KLocale::ShortName", "Arb" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 5 - KLocale::ShortName", "Arb").toString(locale()); - case 6: -- return ki18nc( "Ethiopian weekday 6 - KLocale::ShortName", "Qed" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 6 - KLocale::ShortName", "Qed").toString(locale()); - case 7: -- return ki18nc( "Ethiopian weekday 7 - KLocale::ShortName", "Ehu" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 7 - KLocale::ShortName", "Ehu").toString(locale()); - default: return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Ethiopian weekday 1 - KLocale::LongName", "Segno" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 1 - KLocale::LongName", "Segno").toString(locale()); - case 2: -- return ki18nc( "Ethiopian weekday 2 - KLocale::LongName", "Maksegno" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 2 - KLocale::LongName", "Maksegno").toString(locale()); - case 3: -- return ki18nc( "Ethiopian weekday 3 - KLocale::LongName", "Rob" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 3 - KLocale::LongName", "Rob").toString(locale()); - case 4: -- return ki18nc( "Ethiopian weekday 4 - KLocale::LongName", "Hamus" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 4 - KLocale::LongName", "Hamus").toString(locale()); - case 5: -- return ki18nc( "Ethiopian weekday 5 - KLocale::LongName", "Arb" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 5 - KLocale::LongName", "Arb").toString(locale()); - case 6: -- return ki18nc( "Ethiopian weekday 6 - KLocale::LongName", "Qedame" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 6 - KLocale::LongName", "Qedame").toString(locale()); - case 7: -- return ki18nc( "Ethiopian weekday 7 - KLocale::LongName", "Ehud" ).toString( locale() ); -+ return ki18nc("Ethiopian weekday 7 - KLocale::LongName", "Ehud").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemEthiopian::KCalendarSystemEthiopian( const KLocale *locale ) -- : KCalendarSystemCoptic( *new KCalendarSystemEthiopianPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemEthiopian::KCalendarSystemEthiopian(const KLocale *locale) -+ : KCalendarSystemCoptic(*new KCalendarSystemEthiopianPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemEthiopian::KCalendarSystemEthiopian( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemCoptic( *new KCalendarSystemEthiopianPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemEthiopian::KCalendarSystemEthiopian(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemCoptic(*new KCalendarSystemEthiopianPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemEthiopian::KCalendarSystemEthiopian( KCalendarSystemEthiopianPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemCoptic( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemEthiopian::KCalendarSystemEthiopian(KCalendarSystemEthiopianPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemCoptic(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemEthiopian::~KCalendarSystemEthiopian() - { -- delete dont_use; - } - - QString KCalendarSystemEthiopian::calendarType() const - { -- return QLatin1String( "ethiopian" ); -+ return QLatin1String("ethiopian"); - } - - QDate KCalendarSystemEthiopian::epoch() const - { - //0001-01-01, no Year 0. - //0008-08-29 AD Julian -- return QDate::fromJulianDay( 1724221 ); -+ return QDate::fromJulianDay(1724221); - } - - QDate KCalendarSystemEthiopian::earliestValidDate() const - { - //0001-01-01, no Year 0. - //0008-08-29 AD Julian -- return QDate::fromJulianDay( 1724221 ); -+ return QDate::fromJulianDay(1724221); - } - - QDate KCalendarSystemEthiopian::latestValidDate() const -@@ -345,188 +339,47 @@ QDate KCalendarSystemEthiopian::latestValidDate() const - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - //9999-12-30 - //100008-08-29 AD Julian -- return QDate::fromJulianDay( 5376721 ); -+ return QDate::fromJulianDay(5376721); - } - --bool KCalendarSystemEthiopian::isValid( int year, int month, int day ) const -+bool KCalendarSystemEthiopian::isValid(int year, int month, int day) const - { -- return KCalendarSystemCoptic::isValid( year, month, day ); -+ return KCalendarSystemCoptic::isValid(year, month, day); - } - --bool KCalendarSystemEthiopian::isValid( const QDate &date ) const -+bool KCalendarSystemEthiopian::isValid(const QDate &date) const - { -- return KCalendarSystemCoptic::isValid( date ); -+ return KCalendarSystemCoptic::isValid(date); - } - --bool KCalendarSystemEthiopian::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemEthiopian::isLeapYear(int year) const - { -- return KCalendarSystemCoptic::setDate( date, year, month, day ); -+ return KCalendarSystemCoptic::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemEthiopian::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemEthiopian::isLeapYear(const QDate &date) const - { -- return KCalendarSystemCoptic::setDate( date, y, m, d ); -+ return KCalendarSystemCoptic::isLeapYear(date); - } - --int KCalendarSystemEthiopian::year( const QDate &date ) const -+QString KCalendarSystemEthiopian::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystemCoptic::year( date ); -+ return KCalendarSystemCoptic::monthName(month, year, format); - } - --int KCalendarSystemEthiopian::month( const QDate &date ) const -+QString KCalendarSystemEthiopian::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystemCoptic::month( date ); -+ return KCalendarSystemCoptic::monthName(date, format); - } - --int KCalendarSystemEthiopian::day( const QDate &date ) const -+QString KCalendarSystemEthiopian::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystemCoptic::day( date ); -+ return KCalendarSystemCoptic::weekDayName(weekDay, format); - } - --QDate KCalendarSystemEthiopian::addYears( const QDate &date, int nyears ) const -+QString KCalendarSystemEthiopian::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystemCoptic::addYears( date, nyears ); --} -- --QDate KCalendarSystemEthiopian::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystemCoptic::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemEthiopian::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystemCoptic::addDays( date, ndays ); --} -- --int KCalendarSystemEthiopian::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystemCoptic::monthsInYear( date ); --} -- --int KCalendarSystemEthiopian::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystemCoptic::weeksInYear( date ); --} -- --int KCalendarSystemEthiopian::weeksInYear( int year ) const --{ -- return KCalendarSystemCoptic::weeksInYear( year ); --} -- --int KCalendarSystemEthiopian::daysInYear( const QDate &date ) const --{ -- return KCalendarSystemCoptic::daysInYear( date ); --} -- --int KCalendarSystemEthiopian::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystemCoptic::daysInMonth( date ); --} -- --int KCalendarSystemEthiopian::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystemCoptic::daysInWeek( date ); --} -- --int KCalendarSystemEthiopian::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystemCoptic::dayOfYear( date ); --} -- --int KCalendarSystemEthiopian::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystemCoptic::dayOfWeek( date ); --} -- --int KCalendarSystemEthiopian::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystemCoptic::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemEthiopian::isLeapYear( int year ) const --{ -- return KCalendarSystemCoptic::isLeapYear( year ); --} -- --bool KCalendarSystemEthiopian::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystemCoptic::isLeapYear( date ); --} -- --QString KCalendarSystemEthiopian::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystemCoptic::monthName( month, year, format ); --} -- --QString KCalendarSystemEthiopian::monthName( const QDate &date, MonthNameFormat format ) const --{ -- 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 ); --} -- --QString KCalendarSystemEthiopian::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemCoptic::yearString( pDate, format ); --} -- --QString KCalendarSystemEthiopian::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemCoptic::monthString( pDate, format ); --} -- --QString KCalendarSystemEthiopian::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemCoptic::dayString( pDate, format ); --} -- --int KCalendarSystemEthiopian::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemCoptic::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemEthiopian::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemCoptic::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemEthiopian::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemCoptic::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemEthiopian::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystemCoptic::formatDate( date, format ); --} -- --QDate KCalendarSystemEthiopian::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystemCoptic::readDate( str, ok ); --} -- --QDate KCalendarSystemEthiopian::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystemCoptic::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemEthiopian::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystemCoptic::readDate( str, flags, ok ); --} -- --int KCalendarSystemEthiopian::weekStartDay() const --{ -- return KCalendarSystemCoptic::weekStartDay(); -+ return KCalendarSystemCoptic::weekDayName(date, format); - } - - int KCalendarSystemEthiopian::weekDayOfPray() const -@@ -554,12 +407,12 @@ bool KCalendarSystemEthiopian::isProleptic() const - return false; - } - --bool KCalendarSystemEthiopian::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemEthiopian::julianDayToDate(int jd, int &year, int &month, int &day) const - { -- return KCalendarSystemCoptic::julianDayToDate( jd, year, month, day ); -+ return KCalendarSystemCoptic::julianDayToDate(jd, year, month, day); - } - --bool KCalendarSystemEthiopian::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemEthiopian::dateToJulianDay(int year, int month, int day, int &jd) const - { -- return KCalendarSystemCoptic::dateToJulianDay( year, month, day, jd ); -+ return KCalendarSystemCoptic::dateToJulianDay(year, month, day, jd); - } -diff --git a/kdecore/date/kcalendarsystemethiopian_p.h b/kdecore/date/kcalendarsystemethiopian_p.h -index 002c2c5..8394f07 100644 ---- a/kdecore/date/kcalendarsystemethiopian_p.h -+++ b/kdecore/date/kcalendarsystemethiopian_p.h -@@ -38,8 +38,8 @@ class KCalendarSystemEthiopianPrivate; - class KCalendarSystemEthiopian: public KCalendarSystemCoptic - { - public: -- explicit KCalendarSystemEthiopian( const KLocale *locale = 0 ); -- explicit KCalendarSystemEthiopian( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemEthiopian(const KLocale *locale = 0); -+ explicit KCalendarSystemEthiopian(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemEthiopian(); - - virtual QString calendarType() const; -@@ -47,58 +47,19 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -106,15 +67,14 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemEthiopian( KCalendarSystemEthiopianPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemEthiopian(KCalendarSystemEthiopianPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: - Q_DECLARE_PRIVATE(KCalendarSystemEthiopian) -- KCalendarSystemEthiopianPrivate * const dont_use; // KDE5 remove, use shared d - }; - - #endif // KCALENDARSYSTEMETHIOPIAN_H -diff --git a/kdecore/date/kcalendarsystemgregorian.cpp b/kdecore/date/kcalendarsystemgregorian.cpp -index 26132dc..57ba552 100644 ---- a/kdecore/date/kcalendarsystemgregorian.cpp -+++ b/kdecore/date/kcalendarsystemgregorian.cpp -@@ -1,7 +1,5 @@ - /* -- Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> -- Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> -- Copyright 2007, 2010 John Layt <john@layt.net> -+ Copyright 2009, 2010 John Layt <john@layt.net> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public -@@ -22,7 +20,7 @@ - // Derived gregorian kde calendar class - - #include "kcalendarsystemgregorian_p.h" --#include "kcalendarsystemprivate_p.h" -+#include "kcalendarsystemgregorianprivate_p.h" - #include "kcalendarera_p.h" - - #include "kdebug.h" -@@ -33,39 +31,10 @@ - #include <QtCore/QDate> - #include <QtCore/QCharRef> - --class KCalendarSystemGregorianPrivate : public KCalendarSystemPrivate --{ --public: -- explicit KCalendarSystemGregorianPrivate( KCalendarSystemGregorian *q ); -- -- virtual ~KCalendarSystemGregorianPrivate(); -- -- // Virtual methods each calendar system must re-implement -- virtual KLocale::CalendarSystem calendarSystem() const; -- virtual void loadDefaultEraList(); -- 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; -- 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; --}; -- --// Shared d pointer implementations -- --KCalendarSystemGregorianPrivate::KCalendarSystemGregorianPrivate( KCalendarSystemGregorian *q ) -- :KCalendarSystemPrivate( q ), -- m_useCommonEra( false ) -+// Shared d pointer base class definitions - -+KCalendarSystemGregorianPrivate::KCalendarSystemGregorianPrivate(KCalendarSystemGregorian *q) -+ : KCalendarSystemPrivate(q) - { - } - -@@ -75,54 +44,69 @@ KCalendarSystemGregorianPrivate::~KCalendarSystemGregorianPrivate() - - KLocale::CalendarSystem KCalendarSystemGregorianPrivate::calendarSystem() const - { -- return KLocale::QDateCalendar; -+ return KLocale::GregorianCalendar; - } - -+// Dummy version using Gregorian as an example -+// This method MUST be re-implemented in any new Calendar System - void KCalendarSystemGregorianPrivate::loadDefaultEraList() - { - QString name, shortName, format; - -- KConfigGroup lcg( config(), QString::fromLatin1( "Locale" ) ); -- KConfigGroup cg = lcg.group( QString::fromLatin1( "KCalendarSystem %1" ).arg( q->calendarType() ) ); -- m_useCommonEra = cg.readEntry( "UseCommonEra", false ); -+ KConfigGroup cg(config(), QString::fromLatin1("KCalendarSystem %1").arg(q->calendarType(q->calendarSystem()))); -+ m_useCommonEra = cg.readEntry("UseCommonEra", false); - -- if ( m_useCommonEra ) { -- name = i18nc( "Calendar Era: Gregorian Common Era, years < 0, LongFormat", "Before Common Era" ); -- shortName = i18nc( "Calendar Era: Gregorian Common Era, years < 0, ShortFormat", "BCE" ); -+ if (m_useCommonEra) { -+ name = i18nc("Calendar Era: Gregorian Common Era, years < 0, LongFormat", "Before Common Era"); -+ shortName = i18nc("Calendar Era: Gregorian Common Era, years < 0, ShortFormat", "BCE"); - } else { -- name = i18nc( "Calendar Era: Gregorian Christian Era, years < 0, LongFormat", "Before Christ" ); -- shortName = i18nc( "Calendar Era: Gregorian Christian Era, years < 0, ShortFormat", "BC" ); -+ name = i18nc("Calendar Era: Gregorian Christian Era, years < 0, LongFormat", "Before Christ"); -+ shortName = i18nc("Calendar Era: Gregorian Christian Era, years < 0, ShortFormat", "BC"); - } -- format = i18nc( "(kdedt-format) Gregorian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC" ); -- addEra( '-', 1, q->epoch().addDays( -1 ), -1, q->earliestValidDate(), name, shortName, format ); -+ format = i18nc("(kdedt-format) Gregorian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC"); -+ addEra('-', 1, q->epoch().addDays(-1), -1, q->earliestValidDate(), name, shortName, format); - -- if ( m_useCommonEra ) { -- name = i18nc( "Calendar Era: Gregorian Common Era, years > 0, LongFormat", "Common Era" ); -- shortName = i18nc( "Calendar Era: Gregorian Common Era, years > 0, ShortFormat", "CE" ); -+ if (m_useCommonEra) { -+ name = i18nc("Calendar Era: Gregorian Common Era, years > 0, LongFormat", "Common Era"); -+ shortName = i18nc("Calendar Era: Gregorian Common Era, years > 0, ShortFormat", "CE"); - } else { -- name = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini" ); -- shortName = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD" ); -+ name = i18nc("Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini"); -+ shortName = i18nc("Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD"); - } -- format = i18nc( "(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ format = i18nc("(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --int KCalendarSystemGregorianPrivate::monthsInYear( int year ) const -+int KCalendarSystemGregorianPrivate::monthsInYear(int year) const - { -- Q_UNUSED( year ) -+ Q_UNUSED(year) - return 12; - } - --int KCalendarSystemGregorianPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemGregorianPrivate::daysInMonth(int year, int month) const - { -- QDate tempDate( year, month, 1 ); -- return tempDate.daysInMonth(); -+ if (month == 2) { -+ if (isLeapYear(year)) { -+ return 29; -+ } else { -+ return 28; -+ } -+ } -+ -+ if (month == 4 || month == 6 || month == 9 || month == 11) { -+ return 30; -+ } -+ -+ return 31; - } - --int KCalendarSystemGregorianPrivate::daysInYear( int year ) const -+int KCalendarSystemGregorianPrivate::daysInYear(int year) const - { -- QDate tempDate( year, 1, 1 ); -- return tempDate.daysInYear(); -+ if (isLeapYear(year)) { -+ return 366; -+ } else { -+ return 365; -+ } - } - - int KCalendarSystemGregorianPrivate::daysInWeek() const -@@ -130,9 +114,21 @@ int KCalendarSystemGregorianPrivate::daysInWeek() const - return 7; - } - --bool KCalendarSystemGregorianPrivate::isLeapYear( int year ) const -+bool KCalendarSystemGregorianPrivate::isLeapYear(int year) const - { -- return QDate::isLeapYear( year ); -+ if (!hasYearZero() && year < 1) { -+ year = year + 1; -+ } -+ -+ if (year % 4 == 0) { -+ if (year % 100 != 0) { -+ return true; -+ } else if (year % 400 == 0) { -+ return true; -+ } -+ } -+ -+ return false; - } - - bool KCalendarSystemGregorianPrivate::hasLeapMonths() const -@@ -157,7 +153,7 @@ int KCalendarSystemGregorianPrivate::maxMonthsInYear() const - - int KCalendarSystemGregorianPrivate::earliestValidYear() const - { -- return -4712; -+ return -4713; - } - - int KCalendarSystemGregorianPrivate::latestValidYear() const -@@ -165,465 +161,321 @@ int KCalendarSystemGregorianPrivate::latestValidYear() const - return 9999; - } - --QString KCalendarSystemGregorianPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemGregorianPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( year ); -+ Q_UNUSED(year); - -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -+ if (format == KLocale::NarrowName) { -+ switch (month) { - case 1: -- return ki18nc( "Gregorian month 1 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Gregorian month 1 - KLocale::NarrowName", "J").toString(locale()); - case 2: -- return ki18nc( "Gregorian month 2 - KLocale::NarrowName", "F" ).toString( locale() ); -+ return ki18nc("Gregorian month 2 - KLocale::NarrowName", "F").toString(locale()); - case 3: -- return ki18nc( "Gregorian month 3 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Gregorian month 3 - KLocale::NarrowName", "M").toString(locale()); - case 4: -- return ki18nc( "Gregorian month 4 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Gregorian month 4 - KLocale::NarrowName", "A").toString(locale()); - case 5: -- return ki18nc( "Gregorian month 5 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Gregorian month 5 - KLocale::NarrowName", "M").toString(locale()); - case 6: -- return ki18nc( "Gregorian month 6 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Gregorian month 6 - KLocale::NarrowName", "J").toString(locale()); - case 7: -- return ki18nc( "Gregorian month 7 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Gregorian month 7 - KLocale::NarrowName", "J").toString(locale()); - case 8: -- return ki18nc( "Gregorian month 8 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Gregorian month 8 - KLocale::NarrowName", "A").toString(locale()); - case 9: -- return ki18nc( "Gregorian month 9 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Gregorian month 9 - KLocale::NarrowName", "S").toString(locale()); - case 10: -- return ki18nc( "Gregorian month 10 - KLocale::NarrowName", "O" ).toString( locale() ); -+ return ki18nc("Gregorian month 10 - KLocale::NarrowName", "O").toString(locale()); - case 11: -- return ki18nc( "Gregorian month 11 - KLocale::NarrowName", "N" ).toString( locale() ); -+ return ki18nc("Gregorian month 11 - KLocale::NarrowName", "N").toString(locale()); - case 12: -- return ki18nc( "Gregorian month 12 - KLocale::NarrowName", "D" ).toString( locale() ); -+ return ki18nc("Gregorian month 12 - KLocale::NarrowName", "D").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Gregorian month 1 - KLocale::ShortName Possessive", "of Jan" ).toString( locale() ); -+ return ki18nc("Gregorian month 1 - KLocale::ShortName Possessive", "of Jan").toString(locale()); - case 2: -- return ki18nc( "Gregorian month 2 - KLocale::ShortName Possessive", "of Feb" ).toString( locale() ); -+ return ki18nc("Gregorian month 2 - KLocale::ShortName Possessive", "of Feb").toString(locale()); - case 3: -- return ki18nc( "Gregorian month 3 - KLocale::ShortName Possessive", "of Mar" ).toString( locale() ); -+ return ki18nc("Gregorian month 3 - KLocale::ShortName Possessive", "of Mar").toString(locale()); - case 4: -- return ki18nc( "Gregorian month 4 - KLocale::ShortName Possessive", "of Apr" ).toString( locale() ); -+ return ki18nc("Gregorian month 4 - KLocale::ShortName Possessive", "of Apr").toString(locale()); - case 5: -- return ki18nc( "Gregorian month 5 - KLocale::ShortName Possessive", "of May" ).toString( locale() ); -+ return ki18nc("Gregorian month 5 - KLocale::ShortName Possessive", "of May").toString(locale()); - case 6: -- return ki18nc( "Gregorian month 6 - KLocale::ShortName Possessive", "of Jun" ).toString( locale() ); -+ return ki18nc("Gregorian month 6 - KLocale::ShortName Possessive", "of Jun").toString(locale()); - case 7: -- return ki18nc( "Gregorian month 7 - KLocale::ShortName Possessive", "of Jul" ).toString( locale() ); -+ return ki18nc("Gregorian month 7 - KLocale::ShortName Possessive", "of Jul").toString(locale()); - case 8: -- return ki18nc( "Gregorian month 8 - KLocale::ShortName Possessive", "of Aug" ).toString( locale() ); -+ return ki18nc("Gregorian month 8 - KLocale::ShortName Possessive", "of Aug").toString(locale()); - case 9: -- return ki18nc( "Gregorian month 9 - KLocale::ShortName Possessive", "of Sep" ).toString( locale() ); -+ return ki18nc("Gregorian month 9 - KLocale::ShortName Possessive", "of Sep").toString(locale()); - case 10: -- return ki18nc( "Gregorian month 10 - KLocale::ShortName Possessive", "of Oct" ).toString( locale() ); -+ return ki18nc("Gregorian month 10 - KLocale::ShortName Possessive", "of Oct").toString(locale()); - case 11: -- return ki18nc( "Gregorian month 11 - KLocale::ShortName Possessive", "of Nov" ).toString( locale() ); -+ return ki18nc("Gregorian month 11 - KLocale::ShortName Possessive", "of Nov").toString(locale()); - case 12: -- return ki18nc( "Gregorian month 12 - KLocale::ShortName Possessive", "of Dec" ).toString( locale() ); -+ return ki18nc("Gregorian month 12 - KLocale::ShortName Possessive", "of Dec").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Gregorian month 1 - KLocale::ShortName", "Jan" ).toString( locale() ); -+ return ki18nc("Gregorian month 1 - KLocale::ShortName", "Jan").toString(locale()); - case 2: -- return ki18nc( "Gregorian month 2 - KLocale::ShortName", "Feb" ).toString( locale() ); -+ return ki18nc("Gregorian month 2 - KLocale::ShortName", "Feb").toString(locale()); - case 3: -- return ki18nc( "Gregorian month 3 - KLocale::ShortName", "Mar" ).toString( locale() ); -+ return ki18nc("Gregorian month 3 - KLocale::ShortName", "Mar").toString(locale()); - case 4: -- return ki18nc( "Gregorian month 4 - KLocale::ShortName", "Apr" ).toString( locale() ); -+ return ki18nc("Gregorian month 4 - KLocale::ShortName", "Apr").toString(locale()); - case 5: -- return ki18nc( "Gregorian month 5 - KLocale::ShortName", "May" ).toString( locale() ); -+ return ki18nc("Gregorian month 5 - KLocale::ShortName", "May").toString(locale()); - case 6: -- return ki18nc( "Gregorian month 6 - KLocale::ShortName", "Jun" ).toString( locale() ); -+ return ki18nc("Gregorian month 6 - KLocale::ShortName", "Jun").toString(locale()); - case 7: -- return ki18nc( "Gregorian month 7 - KLocale::ShortName", "Jul" ).toString( locale() ); -+ return ki18nc("Gregorian month 7 - KLocale::ShortName", "Jul").toString(locale()); - case 8: -- return ki18nc( "Gregorian month 8 - KLocale::ShortName", "Aug" ).toString( locale() ); -+ return ki18nc("Gregorian month 8 - KLocale::ShortName", "Aug").toString(locale()); - case 9: -- return ki18nc( "Gregorian month 9 - KLocale::ShortName", "Sep" ).toString( locale() ); -+ return ki18nc("Gregorian month 9 - KLocale::ShortName", "Sep").toString(locale()); - case 10: -- return ki18nc( "Gregorian month 10 - KLocale::ShortName", "Oct" ).toString( locale() ); -+ return ki18nc("Gregorian month 10 - KLocale::ShortName", "Oct").toString(locale()); - case 11: -- return ki18nc( "Gregorian month 11 - KLocale::ShortName", "Nov" ).toString( locale() ); -+ return ki18nc("Gregorian month 11 - KLocale::ShortName", "Nov").toString(locale()); - case 12: -- return ki18nc( "Gregorian month 12 - KLocale::ShortName", "Dec" ).toString( locale() ); -+ return ki18nc("Gregorian month 12 - KLocale::ShortName", "Dec").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Gregorian month 1 - KLocale::LongName Possessive", "of January" ).toString( locale() ); -+ return ki18nc("Gregorian month 1 - KLocale::LongName Possessive", "of January").toString(locale()); - case 2: -- return ki18nc( "Gregorian month 2 - KLocale::LongName Possessive", "of February" ).toString( locale() ); -+ return ki18nc("Gregorian month 2 - KLocale::LongName Possessive", "of February").toString(locale()); - case 3: -- return ki18nc( "Gregorian month 3 - KLocale::LongName Possessive", "of March" ).toString( locale() ); -+ return ki18nc("Gregorian month 3 - KLocale::LongName Possessive", "of March").toString(locale()); - case 4: -- return ki18nc( "Gregorian month 4 - KLocale::LongName Possessive", "of April" ).toString( locale() ); -+ return ki18nc("Gregorian month 4 - KLocale::LongName Possessive", "of April").toString(locale()); - case 5: -- return ki18nc( "Gregorian month 5 - KLocale::LongName Possessive", "of May" ).toString( locale() ); -+ return ki18nc("Gregorian month 5 - KLocale::LongName Possessive", "of May").toString(locale()); - case 6: -- return ki18nc( "Gregorian month 6 - KLocale::LongName Possessive", "of June" ).toString( locale() ); -+ return ki18nc("Gregorian month 6 - KLocale::LongName Possessive", "of June").toString(locale()); - case 7: -- return ki18nc( "Gregorian month 7 - KLocale::LongName Possessive", "of July" ).toString( locale() ); -+ return ki18nc("Gregorian month 7 - KLocale::LongName Possessive", "of July").toString(locale()); - case 8: -- return ki18nc( "Gregorian month 8 - KLocale::LongName Possessive", "of August" ).toString( locale() ); -+ return ki18nc("Gregorian month 8 - KLocale::LongName Possessive", "of August").toString(locale()); - case 9: -- return ki18nc( "Gregorian month 9 - KLocale::LongName Possessive", "of September" ).toString( locale() ); -+ return ki18nc("Gregorian month 9 - KLocale::LongName Possessive", "of September").toString(locale()); - case 10: -- return ki18nc( "Gregorian month 10 - KLocale::LongName Possessive", "of October" ).toString( locale() ); -+ return ki18nc("Gregorian month 10 - KLocale::LongName Possessive", "of October").toString(locale()); - case 11: -- return ki18nc( "Gregorian month 11 - KLocale::LongName Possessive", "of November" ).toString( locale() ); -+ return ki18nc("Gregorian month 11 - KLocale::LongName Possessive", "of November").toString(locale()); - case 12: -- return ki18nc( "Gregorian month 12 - KLocale::LongName Possessive", "of December" ).toString( locale() ); -+ return ki18nc("Gregorian month 12 - KLocale::LongName Possessive", "of December").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( month ) { -+ switch (month) { - case 1: -- return ki18nc( "Gregorian month 1 - KLocale::LongName", "January" ).toString( locale() ); -+ return ki18nc("Gregorian month 1 - KLocale::LongName", "January").toString(locale()); - case 2: -- return ki18nc( "Gregorian month 2 - KLocale::LongName", "February" ).toString( locale() ); -+ return ki18nc("Gregorian month 2 - KLocale::LongName", "February").toString(locale()); - case 3: -- return ki18nc( "Gregorian month 3 - KLocale::LongName", "March" ).toString( locale() ); -+ return ki18nc("Gregorian month 3 - KLocale::LongName", "March").toString(locale()); - case 4: -- return ki18nc( "Gregorian month 4 - KLocale::LongName", "April" ).toString( locale() ); -+ return ki18nc("Gregorian month 4 - KLocale::LongName", "April").toString(locale()); - case 5: -- return ki18nc( "Gregorian month 5 - KLocale::LongName", "May" ).toString( locale() ); -+ return ki18nc("Gregorian month 5 - KLocale::LongName", "May").toString(locale()); - case 6: -- return ki18nc( "Gregorian month 6 - KLocale::LongName", "June" ).toString( locale() ); -+ return ki18nc("Gregorian month 6 - KLocale::LongName", "June").toString(locale()); - case 7: -- return ki18nc( "Gregorian month 7 - KLocale::LongName", "July" ).toString( locale() ); -+ return ki18nc("Gregorian month 7 - KLocale::LongName", "July").toString(locale()); - case 8: -- return ki18nc( "Gregorian month 8 - KLocale::LongName", "August" ).toString( locale() ); -+ return ki18nc("Gregorian month 8 - KLocale::LongName", "August").toString(locale()); - case 9: -- return ki18nc( "Gregorian month 9 - KLocale::LongName", "September" ).toString( locale() ); -+ return ki18nc("Gregorian month 9 - KLocale::LongName", "September").toString(locale()); - case 10: -- return ki18nc( "Gregorian month 10 - KLocale::LongName", "October" ).toString( locale() ); -+ return ki18nc("Gregorian month 10 - KLocale::LongName", "October").toString(locale()); - case 11: -- return ki18nc( "Gregorian month 11 - KLocale::LongName", "November" ).toString( locale() ); -+ return ki18nc("Gregorian month 11 - KLocale::LongName", "November").toString(locale()); - case 12: -- return ki18nc( "Gregorian month 12 - KLocale::LongName", "December" ).toString( locale() ); -+ return ki18nc("Gregorian month 12 - KLocale::LongName", "December").toString(locale()); - default: - return QString(); - } - } - --QString KCalendarSystemGregorianPrivate::weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const -+QString KCalendarSystemGregorianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Gregorian weekday 1 - KLocale::NarrowName ", "M" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale()); - case 2: -- return ki18nc( "Gregorian weekday 2 - KLocale::NarrowName ", "T" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale()); - case 3: -- return ki18nc( "Gregorian weekday 3 - KLocale::NarrowName ", "W" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale()); - case 4: -- return ki18nc( "Gregorian weekday 4 - KLocale::NarrowName ", "T" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale()); - case 5: -- return ki18nc( "Gregorian weekday 5 - KLocale::NarrowName ", "F" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale()); - case 6: -- return ki18nc( "Gregorian weekday 6 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale()); - case 7: -- return ki18nc( "Gregorian weekday 7 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Gregorian weekday 1 - KLocale::ShortName", "Mon" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale()); - case 2: -- return ki18nc( "Gregorian weekday 2 - KLocale::ShortName", "Tue" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale()); - case 3: -- return ki18nc( "Gregorian weekday 3 - KLocale::ShortName", "Wed" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale()); - case 4: -- return ki18nc( "Gregorian weekday 4 - KLocale::ShortName", "Thu" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale()); - case 5: -- return ki18nc( "Gregorian weekday 5 - KLocale::ShortName", "Fri" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale()); - case 6: -- return ki18nc( "Gregorian weekday 6 - KLocale::ShortName", "Sat" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale()); - case 7: -- return ki18nc( "Gregorian weekday 7 - KLocale::ShortName", "Sun" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale()); - default: return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Gregorian weekday 1 - KLocale::LongName", "Monday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale()); - case 2: -- return ki18nc( "Gregorian weekday 2 - KLocale::LongName", "Tuesday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale()); - case 3: -- return ki18nc( "Gregorian weekday 3 - KLocale::LongName", "Wednesday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale()); - case 4: -- return ki18nc( "Gregorian weekday 4 - KLocale::LongName", "Thursday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale()); - case 5: -- return ki18nc( "Gregorian weekday 5 - KLocale::LongName", "Friday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale()); - case 6: -- return ki18nc( "Gregorian weekday 6 - KLocale::LongName", "Saturday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale()); - case 7: -- return ki18nc( "Gregorian weekday 7 - KLocale::LongName", "Sunday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemGregorian::KCalendarSystemGregorian( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemGregorianPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemGregorian::KCalendarSystemGregorian(const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemGregorianPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemGregorian::KCalendarSystemGregorian( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemGregorianPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemGregorian::KCalendarSystemGregorian(const KSharedConfig::Ptr config, -+ const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemGregorianPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemGregorian::KCalendarSystemGregorian( KCalendarSystemGregorianPrivate &dd, const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemGregorian::KCalendarSystemGregorian(KCalendarSystemGregorianPrivate &dd, -+ const KSharedConfig::Ptr config, -+ const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemGregorian::~KCalendarSystemGregorian() - { -- delete dont_use; - } - - QString KCalendarSystemGregorian::calendarType() const - { -- return QLatin1String( "gregorian" ); -+ return QLatin1String("gregorian-proleptic"); - } - - QDate KCalendarSystemGregorian::epoch() const - { -- // 1 Jan 1 AD in Julian -- return QDate::fromJulianDay( 1721424 ); -+ return QDate::fromJulianDay(1721426); - } - - QDate KCalendarSystemGregorian::earliestValidDate() const - { -- // 1 Jan 4712 BC, no year zero, cant be 4713BC due to error in QDate that day 0 is not valid -- // and we really need the first in each year to be valid for the date maths -- return QDate::fromJulianDay( 366 ); -+ // Gregorian 1 Jan 4713 BC, no year zero -+ return QDate::fromJulianDay(38); - } - - QDate KCalendarSystemGregorian::latestValidDate() const - { -- // Set to last day of year 9999 until confirm date formats & widets support > 9999 -+ // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - // In Gregorian this is 9999-12-31, which is is jd 5373484 - // Can't call setDate( 9999, 12, 31 ) as it creates circular reference! -- return QDate::fromJulianDay( 5373484 ); --} -- --bool KCalendarSystemGregorian::isValid( int year, int month, int day ) const --{ -- // Limit to max year 9999 for now, QDate allows to be greater -- if ( year <= 9999 ) { -- return QDate::isValid( year, month, day ); -- } -- -- return false; --} -- --bool KCalendarSystemGregorian::isValid( const QDate &date ) const --{ -- return KCalendarSystem::isValid( date ); --} -- --bool KCalendarSystemGregorian::setDate( QDate &date, int year, int month, int day ) const --{ -- return KCalendarSystem::setDate( date, year, month, day ); --} -- --// Deprecated --bool KCalendarSystemGregorian::setYMD( QDate &date, int y, int m, int d ) const --{ -- return KCalendarSystem::setDate( date, y, m, d ); --} -- --int KCalendarSystemGregorian::year( const QDate &date ) const --{ -- return date.year(); --} -- --int KCalendarSystemGregorian::month( const QDate &date ) const --{ -- return date.month(); --} -- --int KCalendarSystemGregorian::day( const QDate &date ) const --{ -- return date.day(); --} -- --QDate KCalendarSystemGregorian::addYears( const QDate &date, int nyears ) const --{ -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemGregorian::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemGregorian::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemGregorian::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemGregorian::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemGregorian::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); -+ return QDate::fromJulianDay(5373484); - } - --int KCalendarSystemGregorian::daysInYear( const QDate &date ) const -+bool KCalendarSystemGregorian::isValid(int year, int month, int day) const - { -- return date.daysInYear(); -+ return KCalendarSystem::isValid(year, month, day); - } - --int KCalendarSystemGregorian::daysInMonth( const QDate &date ) const -+bool KCalendarSystemGregorian::isValid(const QDate &date) const - { -- return date.daysInMonth(); -+ return KCalendarSystem::isValid(date); - } - --int KCalendarSystemGregorian::daysInWeek( const QDate &date ) const -+bool KCalendarSystemGregorian::isLeapYear(int year) const - { -- return KCalendarSystem::daysInWeek( date ); -+ return KCalendarSystem::isLeapYear(year); - } - --int KCalendarSystemGregorian::dayOfYear( const QDate &date ) const -+bool KCalendarSystemGregorian::isLeapYear(const QDate &date) const - { -- return date.dayOfYear(); -+ return KCalendarSystem::isLeapYear(date); - } - --int KCalendarSystemGregorian::dayOfWeek( const QDate &date ) const -+QString KCalendarSystemGregorian::monthName(int month, int year, MonthNameFormat format) const - { -- return date.dayOfWeek(); -+ return KCalendarSystem::monthName(month, year, format); - } - --int KCalendarSystemGregorian::weekNumber( const QDate &date, int * yearNum ) const -+QString KCalendarSystemGregorian::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystem::weekNumber( date, yearNum ); -+ return KCalendarSystem::monthName(date, format); - } - --bool KCalendarSystemGregorian::isLeapYear( int year ) const -+QString KCalendarSystemGregorian::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return QDate::isLeapYear( year ); -+ return KCalendarSystem::weekDayName(weekDay, format); - } - --bool KCalendarSystemGregorian::isLeapYear( const QDate &date ) const -+QString KCalendarSystemGregorian::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return QDate::isLeapYear( date.year() ); -+ return KCalendarSystem::weekDayName(date, format); - } - --QString KCalendarSystemGregorian::monthName( int month, int year, MonthNameFormat format ) const -+int KCalendarSystemGregorian::yearStringToInteger(const QString &sNum, int &iLength) const - { -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemGregorian::monthName( const QDate &date, MonthNameFormat format ) const --{ -- 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 ); --} -- --QString KCalendarSystemGregorian::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemGregorian::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemGregorian::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemGregorian::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemGregorian::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemGregorian::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemGregorian::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemGregorian::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemGregorian::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemGregorian::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- --int KCalendarSystemGregorian::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); -+ return KCalendarSystem::yearStringToInteger(sNum, iLength); - } - - int KCalendarSystemGregorian::weekDayOfPray() const -@@ -648,24 +500,67 @@ bool KCalendarSystemGregorian::isSolar() const - - bool KCalendarSystemGregorian::isProleptic() const - { -- return false; -+ return true; - } - --bool KCalendarSystemGregorian::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemGregorian::julianDayToDate(int jd, int &year, int &month, int &day) const - { -- QDate date = QDate::fromJulianDay( jd ); -+ Q_D(const KCalendarSystemGregorian); -+ -+ // Formula from The Calendar FAQ by Claus Tondering -+ // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -+ // NOTE: Coded from scratch from mathematical formulas, not copied from -+ // the Boost licensed source code - -- date.getDate( &year, &month, &day ); -+ int a = jd + 32044; -+ int b = ((4 * a) + 3) / 146097; -+ int c = a - ((146097 * b) / 4); -+ int dd = ((4 * c) + 3) / 1461; -+ int e = c - ((1461 * dd) / 4); -+ int m = ((5 * e) + 2) / 153; -+ day = e - (((153 * m) + 2) / 5) + 1; -+ month = m + 3 - (12 * (m / 10)); -+ year = (100 * b) + dd - 4800 + (m / 10); - -- return date.isValid(); -+ // If year is -ve then is BC. In Gregorian there is no year 0, but the maths -+ // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside -+ // Check for Year 0 support as some Gregorian based calendars do have it, e.g. Thai and ISO -+ if (!d->hasYearZero() && year < 1) { -+ year = year - 1; -+ } -+ return true; - } - --bool KCalendarSystemGregorian::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemGregorian::dateToJulianDay(int year, int month, int day, int &jd) const - { -- QDate date; -+ Q_D(const KCalendarSystemGregorian); -+ -+ // Formula from The Calendar FAQ by Claus Tondering -+ // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -+ // NOTE: Coded from scratch from mathematical formulas, not copied from -+ // the Boost licensed source code - -- date.setDate( year, month, day ); -- jd = date.toJulianDay(); -+ // If year is -ve then is BC. In Gregorian there is no year 0, but the maths -+ // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally -+ // Check for Year 0 support as some Gregorian based calendars do have it, e.g. Thai and ISO -+ int y; -+ if (!d->hasYearZero() && year < 1) { -+ y = year + 1; -+ } else { -+ y = year; -+ } - -- return date.isValid(); -+ int a = (14 - month) / 12; -+ y = y + 4800 - a; -+ int m = month + (12 * a) - 3; -+ -+ jd = day -+ + (((153 * m) + 2) / 5) -+ + (365 * y) -+ + (y / 4) -+ - (y / 100) -+ + (y / 400) -+ - 32045; -+ -+ return true; - } -diff --git a/kdecore/date/kcalendarsystemgregorian_p.h b/kdecore/date/kcalendarsystemgregorian_p.h -index 31f861b..c173ea9 100644 ---- a/kdecore/date/kcalendarsystemgregorian_p.h -+++ b/kdecore/date/kcalendarsystemgregorian_p.h -@@ -1,7 +1,5 @@ - /* -- Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> -- Copyright (c) 2002 Hans Petter Bieker <bieker@kde.org> -- Copyright 2007, 2010 John Layt <john@layt.net> -+ Copyright 2009, 2010 John Layt <john@layt.net> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public -@@ -28,84 +26,46 @@ class KCalendarSystemGregorianPrivate; - - /** - * @internal -- * This is the Gregorian calendar implementation. -+ * This is the pure Gregorian calendar implementation. - * -- * The Gregorian calendar is the most used calendar today. The first year in -- * the calendar is set to the birth of Christ. -+ * Note: This is a proleptic version of the Gregorian calendar, it does not -+ * copy the QDate method of using the Julian Calendar for dates before 15 -+ * October 1582. This is the traditional proleptic Gregorian calendar -+ * that does not have a year 0, unlike the ISO version which does. - * -- * WARNING: This is not a pure Gregorian calendar, it copies the QDate method -- * of using the Julian Calendar for dates before 15 October 1582. -- * -- * @b license GNU-GPL v.2 -+ * @b license GNU-LGPL v.2 or later - * - * @see KLocale,KCalendarSystem - * -- * @author Carlos Moro <cfmoro@correo.uniovi.es> -+ * @author John Layt <john@layt.net> - */ - class KCalendarSystemGregorian: public KCalendarSystem - { - public: -- explicit KCalendarSystemGregorian ( const KLocale *locale = 0 ); -- explicit KCalendarSystemGregorian( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -- virtual ~KCalendarSystemGregorian (); -+ explicit KCalendarSystemGregorian(const KLocale *locale = 0); -+ explicit KCalendarSystemGregorian(const KSharedConfig::Ptr config, const KLocale *locale = 0); -+ virtual ~KCalendarSystemGregorian(); - - virtual QString calendarType() const; - - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -- -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -- -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -- -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -- -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -+ virtual int yearStringToInteger(const QString &sNum, int &iLength) const; - -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -113,15 +73,15 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemGregorian( KCalendarSystemGregorianPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemGregorian(KCalendarSystemGregorianPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: -- Q_DECLARE_PRIVATE( KCalendarSystemGregorian ) -- KCalendarSystemGregorianPrivate * const dont_use; // KDE5 remove, use shared d -+ friend class KCalendarSystemIndianNational; // To allow access to julianDayToDate() and dateToJulianDay() -+ Q_DECLARE_PRIVATE(KCalendarSystemGregorian) - }; - --#endif -+#endif // KCALENDARSYSTEMGREGORIAN_H -diff --git a/kdecore/date/kcalendarsystemgregorianprivate_p.h b/kdecore/date/kcalendarsystemgregorianprivate_p.h -new file mode 100644 -index 0000000..61d6646 ---- /dev/null -+++ b/kdecore/date/kcalendarsystemgregorianprivate_p.h -@@ -0,0 +1,54 @@ -+/* -+ Copyright 2009, 2010 John Layt <john@layt.net> -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+ -+#ifndef KCALENDARSYSTEMGREGORIANPRIVATE_H -+#define KCALENDARSYSTEMGREGORIANPRIVATE_H -+ -+// Derived gregorian kde calendar class -+ -+#include "kcalendarsystemprivate_p.h" -+ -+class KCalendarSystemGregorianPrivate : public KCalendarSystemPrivate -+{ -+public: -+ explicit KCalendarSystemGregorianPrivate(KCalendarSystemGregorian *q); -+ -+ virtual ~KCalendarSystemGregorianPrivate(); -+ -+ // Virtual methods each calendar system must re-implement -+ virtual KLocale::CalendarSystem calendarSystem() const; -+ virtual void loadDefaultEraList(); -+ 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; -+ 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; -+}; -+ -+#endif // KCALENDARSYSTEMGREGORIANPRIVATE_H -diff --git a/kdecore/date/kcalendarsystemgregorianproleptic.cpp b/kdecore/date/kcalendarsystemgregorianproleptic.cpp -deleted file mode 100644 -index 32ffeb4..0000000 ---- a/kdecore/date/kcalendarsystemgregorianproleptic.cpp -+++ /dev/null -@@ -1,706 +0,0 @@ --/* -- Copyright 2009, 2010 John Layt <john@layt.net> -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with this library; see the file COPYING.LIB. If not, write to -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- Boston, MA 02110-1301, USA. --*/ -- --// Derived gregorian kde calendar class -- --#include "kcalendarsystemgregorianproleptic_p.h" --#include "kcalendarsystemgregorianprolepticprivate_p.h" --#include "kcalendarera_p.h" -- --#include "kdebug.h" --#include "klocale.h" --#include "kglobal.h" --#include "kconfiggroup.h" -- --#include <QtCore/QDate> --#include <QtCore/QCharRef> -- --// Shared d pointer base class definitions -- --KCalendarSystemGregorianProlepticPrivate::KCalendarSystemGregorianProlepticPrivate( KCalendarSystemGregorianProleptic *q ) -- :KCalendarSystemPrivate( q ) --{ --} -- --KCalendarSystemGregorianProlepticPrivate::~KCalendarSystemGregorianProlepticPrivate() --{ --} -- --KLocale::CalendarSystem KCalendarSystemGregorianProlepticPrivate::calendarSystem() const --{ -- return KLocale::GregorianCalendar; --} -- --// Dummy version using Gregorian as an example --// This method MUST be re-implemented in any new Calendar System --void KCalendarSystemGregorianProlepticPrivate::loadDefaultEraList() --{ -- QString name, shortName, format; -- -- KConfigGroup cg( config(), QString::fromLatin1( "KCalendarSystem %1" ).arg( q->calendarType() ) ); -- m_useCommonEra = cg.readEntry( "UseCommonEra", false ); -- -- if ( m_useCommonEra ) { -- name = i18nc( "Calendar Era: Gregorian Common Era, years < 0, LongFormat", "Before Common Era" ); -- shortName = i18nc( "Calendar Era: Gregorian Common Era, years < 0, ShortFormat", "BCE" ); -- } else { -- name = i18nc( "Calendar Era: Gregorian Christian Era, years < 0, LongFormat", "Before Christ" ); -- shortName = i18nc( "Calendar Era: Gregorian Christian Era, years < 0, ShortFormat", "BC" ); -- } -- format = i18nc( "(kdedt-format) Gregorian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC" ); -- addEra( '-', 1, q->epoch().addDays( -1 ), -1, q->earliestValidDate(), name, shortName, format ); -- -- if ( m_useCommonEra ) { -- name = i18nc( "Calendar Era: Gregorian Common Era, years > 0, LongFormat", "Common Era" ); -- shortName = i18nc( "Calendar Era: Gregorian Common Era, years > 0, ShortFormat", "CE" ); -- } else { -- name = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini" ); -- shortName = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD" ); -- } -- format = i18nc( "(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); --} -- --int KCalendarSystemGregorianProlepticPrivate::monthsInYear( int year ) const --{ -- Q_UNUSED( year ) -- return 12; --} -- --int KCalendarSystemGregorianProlepticPrivate::daysInMonth( int year, int month ) const --{ -- if ( month == 2 ) { -- if ( isLeapYear( year ) ) { -- return 29; -- } else { -- return 28; -- } -- } -- -- if ( month == 4 || month == 6 || month == 9 || month == 11 ) { -- return 30; -- } -- -- return 31; --} -- --int KCalendarSystemGregorianProlepticPrivate::daysInYear( int year ) const --{ -- if ( isLeapYear( year ) ) { -- return 366; -- } else { -- return 365; -- } --} -- --int KCalendarSystemGregorianProlepticPrivate::daysInWeek() const --{ -- return 7; --} -- --bool KCalendarSystemGregorianProlepticPrivate::isLeapYear( int year ) const --{ -- if ( !hasYearZero() && year < 1 ) { -- year = year + 1; -- } -- -- if ( year % 4 == 0 ) { -- if ( year % 100 != 0 ) { -- return true; -- } else if ( year % 400 == 0 ) { -- return true; -- } -- } -- -- return false; --} -- --bool KCalendarSystemGregorianProlepticPrivate::hasLeapMonths() const --{ -- return false; --} -- --bool KCalendarSystemGregorianProlepticPrivate::hasYearZero() const --{ -- return false; --} -- --int KCalendarSystemGregorianProlepticPrivate::maxDaysInWeek() const --{ -- return 7; --} -- --int KCalendarSystemGregorianProlepticPrivate::maxMonthsInYear() const --{ -- return 12; --} -- --int KCalendarSystemGregorianProlepticPrivate::earliestValidYear() const --{ -- return -4713; --} -- --int KCalendarSystemGregorianProlepticPrivate::latestValidYear() const --{ -- return 9999; --} -- --QString KCalendarSystemGregorianProlepticPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const --{ -- Q_UNUSED( year ); -- -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Gregorian month 1 - KLocale::NarrowName", "J" ).toString( locale() ); -- case 2: -- return ki18nc( "Gregorian month 2 - KLocale::NarrowName", "F" ).toString( locale() ); -- case 3: -- return ki18nc( "Gregorian month 3 - KLocale::NarrowName", "M" ).toString( locale() ); -- case 4: -- return ki18nc( "Gregorian month 4 - KLocale::NarrowName", "A" ).toString( locale() ); -- case 5: -- return ki18nc( "Gregorian month 5 - KLocale::NarrowName", "M" ).toString( locale() ); -- case 6: -- return ki18nc( "Gregorian month 6 - KLocale::NarrowName", "J" ).toString( locale() ); -- case 7: -- return ki18nc( "Gregorian month 7 - KLocale::NarrowName", "J" ).toString( locale() ); -- case 8: -- return ki18nc( "Gregorian month 8 - KLocale::NarrowName", "A" ).toString( locale() ); -- case 9: -- return ki18nc( "Gregorian month 9 - KLocale::NarrowName", "S" ).toString( locale() ); -- case 10: -- return ki18nc( "Gregorian month 10 - KLocale::NarrowName", "O" ).toString( locale() ); -- case 11: -- return ki18nc( "Gregorian month 11 - KLocale::NarrowName", "N" ).toString( locale() ); -- case 12: -- return ki18nc( "Gregorian month 12 - KLocale::NarrowName", "D" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Gregorian month 1 - KLocale::ShortName Possessive", "of Jan" ).toString( locale() ); -- case 2: -- return ki18nc( "Gregorian month 2 - KLocale::ShortName Possessive", "of Feb" ).toString( locale() ); -- case 3: -- return ki18nc( "Gregorian month 3 - KLocale::ShortName Possessive", "of Mar" ).toString( locale() ); -- case 4: -- return ki18nc( "Gregorian month 4 - KLocale::ShortName Possessive", "of Apr" ).toString( locale() ); -- case 5: -- return ki18nc( "Gregorian month 5 - KLocale::ShortName Possessive", "of May" ).toString( locale() ); -- case 6: -- return ki18nc( "Gregorian month 6 - KLocale::ShortName Possessive", "of Jun" ).toString( locale() ); -- case 7: -- return ki18nc( "Gregorian month 7 - KLocale::ShortName Possessive", "of Jul" ).toString( locale() ); -- case 8: -- return ki18nc( "Gregorian month 8 - KLocale::ShortName Possessive", "of Aug" ).toString( locale() ); -- case 9: -- return ki18nc( "Gregorian month 9 - KLocale::ShortName Possessive", "of Sep" ).toString( locale() ); -- case 10: -- return ki18nc( "Gregorian month 10 - KLocale::ShortName Possessive", "of Oct" ).toString( locale() ); -- case 11: -- return ki18nc( "Gregorian month 11 - KLocale::ShortName Possessive", "of Nov" ).toString( locale() ); -- case 12: -- return ki18nc( "Gregorian month 12 - KLocale::ShortName Possessive", "of Dec" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Gregorian month 1 - KLocale::ShortName", "Jan" ).toString( locale() ); -- case 2: -- return ki18nc( "Gregorian month 2 - KLocale::ShortName", "Feb" ).toString( locale() ); -- case 3: -- return ki18nc( "Gregorian month 3 - KLocale::ShortName", "Mar" ).toString( locale() ); -- case 4: -- return ki18nc( "Gregorian month 4 - KLocale::ShortName", "Apr" ).toString( locale() ); -- case 5: -- return ki18nc( "Gregorian month 5 - KLocale::ShortName", "May" ).toString( locale() ); -- case 6: -- return ki18nc( "Gregorian month 6 - KLocale::ShortName", "Jun" ).toString( locale() ); -- case 7: -- return ki18nc( "Gregorian month 7 - KLocale::ShortName", "Jul" ).toString( locale() ); -- case 8: -- return ki18nc( "Gregorian month 8 - KLocale::ShortName", "Aug" ).toString( locale() ); -- case 9: -- return ki18nc( "Gregorian month 9 - KLocale::ShortName", "Sep" ).toString( locale() ); -- case 10: -- return ki18nc( "Gregorian month 10 - KLocale::ShortName", "Oct" ).toString( locale() ); -- case 11: -- return ki18nc( "Gregorian month 11 - KLocale::ShortName", "Nov" ).toString( locale() ); -- case 12: -- return ki18nc( "Gregorian month 12 - KLocale::ShortName", "Dec" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Gregorian month 1 - KLocale::LongName Possessive", "of January" ).toString( locale() ); -- case 2: -- return ki18nc( "Gregorian month 2 - KLocale::LongName Possessive", "of February" ).toString( locale() ); -- case 3: -- return ki18nc( "Gregorian month 3 - KLocale::LongName Possessive", "of March" ).toString( locale() ); -- case 4: -- return ki18nc( "Gregorian month 4 - KLocale::LongName Possessive", "of April" ).toString( locale() ); -- case 5: -- return ki18nc( "Gregorian month 5 - KLocale::LongName Possessive", "of May" ).toString( locale() ); -- case 6: -- return ki18nc( "Gregorian month 6 - KLocale::LongName Possessive", "of June" ).toString( locale() ); -- case 7: -- return ki18nc( "Gregorian month 7 - KLocale::LongName Possessive", "of July" ).toString( locale() ); -- case 8: -- return ki18nc( "Gregorian month 8 - KLocale::LongName Possessive", "of August" ).toString( locale() ); -- case 9: -- return ki18nc( "Gregorian month 9 - KLocale::LongName Possessive", "of September" ).toString( locale() ); -- case 10: -- return ki18nc( "Gregorian month 10 - KLocale::LongName Possessive", "of October" ).toString( locale() ); -- case 11: -- return ki18nc( "Gregorian month 11 - KLocale::LongName Possessive", "of November" ).toString( locale() ); -- case 12: -- return ki18nc( "Gregorian month 12 - KLocale::LongName Possessive", "of December" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- // Default to LongName -- switch ( month ) { -- case 1: -- return ki18nc( "Gregorian month 1 - KLocale::LongName", "January" ).toString( locale() ); -- case 2: -- return ki18nc( "Gregorian month 2 - KLocale::LongName", "February" ).toString( locale() ); -- case 3: -- return ki18nc( "Gregorian month 3 - KLocale::LongName", "March" ).toString( locale() ); -- case 4: -- return ki18nc( "Gregorian month 4 - KLocale::LongName", "April" ).toString( locale() ); -- case 5: -- return ki18nc( "Gregorian month 5 - KLocale::LongName", "May" ).toString( locale() ); -- case 6: -- return ki18nc( "Gregorian month 6 - KLocale::LongName", "June" ).toString( locale() ); -- case 7: -- return ki18nc( "Gregorian month 7 - KLocale::LongName", "July" ).toString( locale() ); -- case 8: -- return ki18nc( "Gregorian month 8 - KLocale::LongName", "August" ).toString( locale() ); -- case 9: -- return ki18nc( "Gregorian month 9 - KLocale::LongName", "September" ).toString( locale() ); -- case 10: -- return ki18nc( "Gregorian month 10 - KLocale::LongName", "October" ).toString( locale() ); -- case 11: -- return ki18nc( "Gregorian month 11 - KLocale::LongName", "November" ).toString( locale() ); -- case 12: -- return ki18nc( "Gregorian month 12 - KLocale::LongName", "December" ).toString( locale() ); -- default: -- return QString(); -- } --} -- --QString KCalendarSystemGregorianProlepticPrivate::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(); -- } --} -- -- --KCalendarSystemGregorianProleptic::KCalendarSystemGregorianProleptic( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemGregorianProlepticPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) --{ -- d_ptr->loadConfig( calendarType() ); --} -- --KCalendarSystemGregorianProleptic::KCalendarSystemGregorianProleptic( const KSharedConfig::Ptr config, -- const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemGregorianProlepticPrivate( this ), config, locale ), -- dont_use( 0 ) --{ -- d_ptr->loadConfig( calendarType() ); --} -- --KCalendarSystemGregorianProleptic::KCalendarSystemGregorianProleptic( KCalendarSystemGregorianProlepticPrivate &dd, -- const KSharedConfig::Ptr config, -- const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) --{ -- d_ptr->loadConfig( calendarType() ); --} -- --KCalendarSystemGregorianProleptic::~KCalendarSystemGregorianProleptic() --{ -- delete dont_use; --} -- --QString KCalendarSystemGregorianProleptic::calendarType() const --{ -- return QLatin1String( "gregorian-proleptic" ); --} -- --QDate KCalendarSystemGregorianProleptic::epoch() const --{ -- return QDate::fromJulianDay( 1721426 ); --} -- --QDate KCalendarSystemGregorianProleptic::earliestValidDate() const --{ -- // Gregorian 1 Jan 4713 BC, no year zero -- return QDate::fromJulianDay( 38 ); --} -- --QDate KCalendarSystemGregorianProleptic::latestValidDate() const --{ -- // Set to last day of year 9999 until confirm date formats & widgets support > 9999 -- // In Gregorian this is 9999-12-31, which is is jd 5373484 -- // Can't call setDate( 9999, 12, 31 ) as it creates circular reference! -- return QDate::fromJulianDay( 5373484 ); --} -- --bool KCalendarSystemGregorianProleptic::isValid( int year, int month, int day ) const --{ -- return KCalendarSystem::isValid( year, month, day ); --} -- --bool KCalendarSystemGregorianProleptic::isValid( const QDate &date ) const --{ -- return KCalendarSystem::isValid( date ); --} -- --bool KCalendarSystemGregorianProleptic::setDate( QDate &date, int year, int month, int day ) const --{ -- return KCalendarSystem::setDate( date, year, month, day ); --} -- --// Deprecated --bool KCalendarSystemGregorianProleptic::setYMD( QDate &date, int year, int month, int day ) const --{ -- return KCalendarSystem::setYMD( date, year, month, day ); --} -- --int KCalendarSystemGregorianProleptic::year( const QDate &date ) const --{ -- return KCalendarSystem::year( date ); --} -- --int KCalendarSystemGregorianProleptic::month( const QDate &date ) const --{ -- return KCalendarSystem::month( date ); --} -- --int KCalendarSystemGregorianProleptic::day( const QDate &date ) const --{ -- return KCalendarSystem::day( date ); --} -- --QDate KCalendarSystemGregorianProleptic::addYears( const QDate &date, int nyears ) const --{ -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemGregorianProleptic::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemGregorianProleptic::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemGregorianProleptic::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemGregorianProleptic::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemGregorianProleptic::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemGregorianProleptic::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemGregorianProleptic::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemGregorianProleptic::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemGregorianProleptic::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemGregorianProleptic::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystem::dayOfWeek( date ); --} -- --int KCalendarSystemGregorianProleptic::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemGregorianProleptic::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemGregorianProleptic::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemGregorianProleptic::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemGregorianProleptic::monthName( const QDate &date, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( date, format ); --} -- --QString KCalendarSystemGregorianProleptic::weekDayName( int weekDay, WeekDayNameFormat format ) const --{ -- return KCalendarSystem::weekDayName( weekDay, format ); --} -- --QString KCalendarSystemGregorianProleptic::weekDayName( const QDate &date, WeekDayNameFormat format ) const --{ -- return KCalendarSystem::weekDayName( date, format ); --} -- --QString KCalendarSystemGregorianProleptic::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemGregorianProleptic::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemGregorianProleptic::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemGregorianProleptic::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemGregorianProleptic::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemGregorianProleptic::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemGregorianProleptic::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemGregorianProleptic::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemGregorianProleptic::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemGregorianProleptic::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- --int KCalendarSystemGregorianProleptic::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); --} -- --int KCalendarSystemGregorianProleptic::weekDayOfPray() const --{ -- return 7; // sunday --} -- --bool KCalendarSystemGregorianProleptic::isLunar() const --{ -- return false; --} -- --bool KCalendarSystemGregorianProleptic::isLunisolar() const --{ -- return false; --} -- --bool KCalendarSystemGregorianProleptic::isSolar() const --{ -- return true; --} -- --bool KCalendarSystemGregorianProleptic::isProleptic() const --{ -- return true; --} -- --bool KCalendarSystemGregorianProleptic::julianDayToDate( int jd, int &year, int &month, int &day ) const --{ -- Q_D( const KCalendarSystemGregorianProleptic ); -- -- // Formula from The Calendar FAQ by Claus Tondering -- // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -- // NOTE: Coded from scratch from mathematical formulas, not copied from -- // the Boost licensed source code -- -- int a = jd + 32044; -- int b = ( ( 4 * a ) + 3 ) / 146097; -- int c = a - ( ( 146097 * b ) / 4 ); -- int dd = ( ( 4 * c ) + 3 ) / 1461; -- int e = c - ( ( 1461 * dd ) / 4 ); -- int m = ( ( 5 * e ) + 2 ) / 153; -- day = e - ( ( (153 * m ) + 2 ) / 5 ) + 1; -- month = m + 3 - ( 12 * ( m / 10 ) ); -- year = ( 100 * b ) + dd - 4800 + ( m / 10 ); -- -- // If year is -ve then is BC. In Gregorian there is no year 0, but the maths -- // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside -- // Check for Year 0 support as some Gregorian based calendars do have it, e.g. Thai and ISO -- if ( !d->hasYearZero() && year < 1 ) { -- year = year - 1; -- } -- return true; --} -- --bool KCalendarSystemGregorianProleptic::dateToJulianDay( int year, int month, int day, int &jd ) const --{ -- Q_D( const KCalendarSystemGregorianProleptic ); -- -- // Formula from The Calendar FAQ by Claus Tondering -- // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -- // NOTE: Coded from scratch from mathematical formulas, not copied from -- // the Boost licensed source code -- -- // If year is -ve then is BC. In Gregorian there is no year 0, but the maths -- // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally -- // Check for Year 0 support as some Gregorian based calendars do have it, e.g. Thai and ISO -- int y; -- if ( !d->hasYearZero() && year < 1 ) { -- y = year + 1; -- } else { -- y = year; -- } -- -- int a = ( 14 - month ) / 12; -- y = y + 4800 - a; -- int m = month + ( 12 * a ) - 3; -- -- jd = day -- + ( ( ( 153 * m ) + 2 ) / 5 ) -- + ( 365 * y ) -- + ( y / 4 ) -- - ( y / 100 ) -- + ( y / 400 ) -- - 32045; -- -- return true; --} -diff --git a/kdecore/date/kcalendarsystemgregorianproleptic_p.h b/kdecore/date/kcalendarsystemgregorianproleptic_p.h -deleted file mode 100644 -index bbb2f2f..0000000 ---- a/kdecore/date/kcalendarsystemgregorianproleptic_p.h -+++ /dev/null -@@ -1,125 +0,0 @@ --/* -- Copyright 2009, 2010 John Layt <john@layt.net> -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with this library; see the file COPYING.LIB. If not, write to -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- Boston, MA 02110-1301, USA. --*/ -- --#ifndef KCALENDARSYSTEMGREGORIANPROLEPTIC_H --#define KCALENDARSYSTEMGREGORIANPROLEPTIC_H -- --#include "kcalendarsystem.h" -- --class KCalendarSystemGregorianProlepticPrivate; -- --/** -- * @internal -- * This is the pure Gregorian calendar implementation. -- * -- * Note: This is a proleptic version of the Gregorian calendar, it does not -- * copy the QDate method of using the Julian Calendar for dates before 15 -- * October 1582. This is the traditional proleptic Gregorian calendar -- * that does not have a year 0, unlike the ISO version which does. -- * -- * @b license GNU-LGPL v.2 or later -- * -- * @see KLocale,KCalendarSystem -- * -- * @author John Layt <john@layt.net> -- */ --class KCalendarSystemGregorianProleptic: public KCalendarSystem --{ --public: -- explicit KCalendarSystemGregorianProleptic( const KLocale *locale = 0 ); -- explicit KCalendarSystemGregorianProleptic( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -- virtual ~KCalendarSystemGregorianProleptic(); -- -- virtual QString calendarType() const; -- -- virtual QDate epoch() const; -- virtual QDate earliestValidDate() const; -- virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -- -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -- -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -- -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -- -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -- -- virtual bool isLunar() const; -- virtual bool isLunisolar() const; -- virtual bool isSolar() const; -- virtual bool isProleptic() const; -- --protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemGregorianProleptic( KCalendarSystemGregorianProlepticPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -- --private: -- friend class KCalendarSystemIndianNational; // To allow access to julianDayToDate() and dateToJulianDay() -- Q_DECLARE_PRIVATE( KCalendarSystemGregorianProleptic ) -- KCalendarSystemGregorianProlepticPrivate * const dont_use; // KDE5 remove, use shared d --}; -- --#endif // KCALENDARSYSTEMGREGORIANPROLEPTIC_H -diff --git a/kdecore/date/kcalendarsystemgregorianprolepticprivate_p.h b/kdecore/date/kcalendarsystemgregorianprolepticprivate_p.h -deleted file mode 100644 -index e463b92..0000000 ---- a/kdecore/date/kcalendarsystemgregorianprolepticprivate_p.h -+++ /dev/null -@@ -1,54 +0,0 @@ --/* -- Copyright 2009, 2010 John Layt <john@layt.net> -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with this library; see the file COPYING.LIB. If not, write to -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- Boston, MA 02110-1301, USA. --*/ -- --#ifndef KCALENDARSYSTEMGREGORIANPROLEPTICPRIVATE_H --#define KCALENDARSYSTEMGREGORIANPROLEPTICPRIVATE_H -- --// Derived gregorian kde calendar class -- --#include "kcalendarsystemprivate_p.h" -- --class KCalendarSystemGregorianProlepticPrivate : public KCalendarSystemPrivate --{ --public: -- explicit KCalendarSystemGregorianProlepticPrivate( KCalendarSystemGregorianProleptic *q ); -- -- virtual ~KCalendarSystemGregorianProlepticPrivate(); -- -- // Virtual methods each calendar system must re-implement -- virtual KLocale::CalendarSystem calendarSystem() const; -- virtual void loadDefaultEraList(); -- 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; -- 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; --}; -- --#endif // KCALENDARSYSTEMGREGORIANPROLEPTICPRIVATE_H -diff --git a/kdecore/date/kcalendarsystemhebrew.cpp b/kdecore/date/kcalendarsystemhebrew.cpp -index b55c6ec..8620055 100644 ---- a/kdecore/date/kcalendarsystemhebrew.cpp -+++ b/kdecore/date/kcalendarsystemhebrew.cpp -@@ -31,7 +31,7 @@ - #include <QtCore/QDate> - #include <QtCore/QCharRef> - --static int hebrewDaysElapsed( int y ); -+static int hebrewDaysElapsed(int y); - - class h_date - { -@@ -46,26 +46,26 @@ public: - /* - * compute general date structure from hebrew date - */ --static class h_date * hebrewToGregorian( int y, int m, int d ) -+static class h_date * hebrewToGregorian(int y, int m, int d) - { - static class h_date h; - int s; - - y -= 3744; -- s = hebrewDaysElapsed( y ); -+ s = hebrewDaysElapsed(y); - d += s; -- s = hebrewDaysElapsed( y + 1 ) - s; /* length of year */ -+ s = hebrewDaysElapsed(y + 1) - s; /* length of year */ - -- if ( s > 365 && m > 6 ) { -+ if (s > 365 && m > 6) { - --m; - d += 30; - } -- d += ( 59 * ( m - 1 ) + 1 ) / 2; /* regular months */ -+ d += (59 * (m - 1) + 1) / 2; /* regular months */ - /* special cases */ -- if ( s % 10 > 4 && m > 2 ) { /* long Heshvan */ -+ if (s % 10 > 4 && m > 2) { /* long Heshvan */ - d++; - } -- if ( s % 10 < 4 && m > 3 ) { /* short Kislev */ -+ if (s % 10 < 4 && m > 3) { /* short Kislev */ - d--; - } - // ### HPB: Broken in leap years -@@ -73,53 +73,53 @@ static class h_date * hebrewToGregorian( int y, int m, int d ) - // d += 30; - d -= 6002; - -- y = ( d + 36525 ) * 4 / 146097 - 1; -- d -= y / 4 * 146097 + ( y % 4 ) * 36524; -+ y = (d + 36525) * 4 / 146097 - 1; -+ d -= y / 4 * 146097 + (y % 4) * 36524; - y *= 100; - - /* compute year */ -- s = ( d + 366 )*4 / 1461 - 1; -- d -= s / 4*1461 + ( s % 4 )*365; -+ s = (d + 366) * 4 / 1461 - 1; -+ d -= s / 4 * 1461 + (s % 4) * 365; - y += s; - /* compute month */ -- m = ( d + 245 )*12 / 367 - 7; -- d -= m*367 / 12 - 30; -- if ( ++m >= 12 ) { -+ m = (d + 245) * 12 / 367 - 7; -+ d -= m * 367 / 12 - 30; -+ if (++m >= 12) { - m -= 12; - y++; - } - h.hd_day = d; - h.hd_mon = m; - h.hd_year = y; -- return( &h ); -+ return(&h); - } - - /* - * compute date structure from no. of days since 1 Tishrei 3744 - */ --static class h_date * gregorianToHebrew( int y, int m, int d ) -+static class h_date * gregorianToHebrew(int y, int m, int d) - { - static class h_date h; - int s; - -- if ( ( m -= 2 ) <= 0 ) { -+ if ((m -= 2) <= 0) { - m += 12; - y--; - } - /* no. of days, Julian calendar */ -- d += 365*y + y / 4 + 367*m / 12 + 5968; -+ d += 365 * y + y / 4 + 367 * m / 12 + 5968; - /* Gregorian calendar */ - d -= y / 100 - y / 400 - 2; -- h.hd_dw = ( d + 1 ) % 7; -+ h.hd_dw = (d + 1) % 7; - - /* compute the year */ - y += 16; -- s = hebrewDaysElapsed( y ); -- m = hebrewDaysElapsed( y + 1 ); -- while( d >= m ) { /* computed year was underestimated */ -+ s = hebrewDaysElapsed(y); -+ m = hebrewDaysElapsed(y + 1); -+ while (d >= m) { /* computed year was underestimated */ - s = m; - y++; -- m = hebrewDaysElapsed( y + 1 ); -+ m = hebrewDaysElapsed(y + 1); - } - d -= s; - s = m - s; /* size of current year */ -@@ -128,31 +128,31 @@ static class h_date * gregorianToHebrew( int y, int m, int d ) - h.hd_flg = s % 10 - 4; - - /* compute day and month */ -- if ( d >= s - 236 ) { /* last 8 months are regular */ -+ if (d >= s - 236) { /* last 8 months are regular */ - d -= s - 236; - m = d * 2 / 59; -- d -= ( m * 59 + 1 ) / 2; -+ d -= (m * 59 + 1) / 2; - m += 4; -- if ( s > 365 && m <= 5 ) { /* Adar of Meuberet */ -+ if (s > 365 && m <= 5) { /* Adar of Meuberet */ - m += 8; - } - } else { - /* first 4 months have 117-119 days */ - s = 114 + s % 10; - m = d * 4 / s; -- d -= ( m * s + 3 ) / 4; -+ d -= (m * s + 3) / 4; - } - - h.hd_day = d; - h.hd_mon = m; - h.hd_year = y; -- return( &h ); -+ return(&h); - } - - /* constants, in 1/18th of minute */ - static const int HOUR = 1080; --static const int DAY = 24*HOUR; --static const int WEEK = 7*DAY; -+static const int DAY = 24 * HOUR; -+static const int WEEK = 7 * DAY; - #define M(h,p) ((h)*HOUR+p) - #define MONTH (DAY+M(12,793)) - -@@ -160,14 +160,14 @@ static const int WEEK = 7*DAY; - * @internal - * no. of days in y years - */ --static int hebrewDaysElapsed( int y ) -+static int hebrewDaysElapsed(int y) - { - int m, nm, dw, s, l; - - l = y * 7 + 1; // no. of leap months - m = y * 12 + l / 19; // total no. of months - l %= 19; -- nm = m * MONTH + M( 1 + 6, 779 ); // molad new year 3744 (16BC) + 6 hours -+ nm = m * MONTH + M(1 + 6, 779); // molad new year 3744 (16BC) + 6 hours - s = m * 28 + nm / DAY - 2; - - nm %= WEEK; -@@ -175,13 +175,13 @@ static int hebrewDaysElapsed( int y ) - nm %= DAY; - - // special cases of Molad Zaken -- if ( (l < 12 && dw == 3 && nm >= M( 9 + 6, 204 )) || -- (l < 7 && dw == 2 && nm >= M( 15 + 6, 589 )) ) { -+ if ((l < 12 && dw == 3 && nm >= M(9 + 6, 204)) || -+ (l < 7 && dw == 2 && nm >= M(15 + 6, 589))) { - s++, dw++; - } - - /* ADU */ -- if ( dw == 1 || dw == 4 || dw == 6 ) { -+ if (dw == 1 || dw == 4 || dw == 6) { - s++; - } - return s; -@@ -191,44 +191,44 @@ static int hebrewDaysElapsed( int y ) - * @internal - * true if long Cheshvan - */ --static int long_cheshvan( int year ) -+static int long_cheshvan(int year) - { - QDate first, last; - class h_date *gd; - -- gd = hebrewToGregorian( year, 1, 1 ); -- first.setYMD( gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1 ); -+ gd = hebrewToGregorian(year, 1, 1); -+ first.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1); - -- gd = hebrewToGregorian( year + 1, 1, 1 ); -- last.setYMD( gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1 ); -+ gd = hebrewToGregorian(year + 1, 1, 1); -+ last.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1); - -- return ( first.daysTo( last ) % 10 == 5 ); -+ return (first.daysTo(last) % 10 == 5); - } - - /** - * @internal - * true if short Kislev - */ --static int short_kislev( int year ) -+static int short_kislev(int year) - { - QDate first, last; - class h_date * gd; - -- gd = hebrewToGregorian( year, 1, 1 ); -- first.setYMD( gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1 ); -+ gd = hebrewToGregorian(year, 1, 1); -+ first.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1); - -- gd = hebrewToGregorian( year + 1, 1, 1 ); -- last.setYMD( gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1 ); -+ gd = hebrewToGregorian(year + 1, 1, 1); -+ last.setYMD(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1); - -- return ( first.daysTo( last ) % 10 == 3 ); -+ return (first.daysTo(last) % 10 == 3); - } - - // Ok --static class h_date *toHebrew( const QDate &date ) -+static class h_date *toHebrew(const QDate &date) - { - class h_date *sd; - -- sd = gregorianToHebrew( date.year(), date.month(), date.day() ); -+ sd = gregorianToHebrew(date.year(), date.month(), date.day()); - ++sd->hd_mon; - ++sd->hd_day; - -@@ -238,38 +238,38 @@ static class h_date *toHebrew( const QDate &date ) - class KCalendarSystemHebrewPrivate : public KCalendarSystemPrivate - { - public: -- explicit KCalendarSystemHebrewPrivate( KCalendarSystemHebrew *q ); -+ explicit KCalendarSystemHebrewPrivate(KCalendarSystemHebrew *q); - - virtual ~KCalendarSystemHebrewPrivate(); - - // Virtual methods each calendar system must re-implement - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual int monthsInYear( int year ) const; -- virtual int daysInMonth( int year, int month ) const; -- virtual int daysInYear( int year ) const; -+ 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 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; -- virtual QString monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const; -- virtual QString weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) 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; -- virtual QString stringFromInteger( int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet ) 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; -+ virtual QString stringFromInteger(int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet) const; - -- virtual int monthNumberToMonthIndex( int year, int month ) const; -+ virtual int monthNumberToMonthIndex(int year, int month) const; - }; - - // Shared d pointer base class definitions - --KCalendarSystemHebrewPrivate::KCalendarSystemHebrewPrivate( KCalendarSystemHebrew *q ) -- :KCalendarSystemPrivate( q ) -+KCalendarSystemHebrewPrivate::KCalendarSystemHebrewPrivate(KCalendarSystemHebrew *q) -+ : KCalendarSystemPrivate(q) - { - } - -@@ -286,55 +286,55 @@ void KCalendarSystemHebrewPrivate::loadDefaultEraList() - { - QString name, shortName, format; - // Jewish Era, Anno Mundi, "Year of the World". -- name = i18nc( "Calendar Era: Hebrew Era, years > 0, LongFormat", "Anno Mundi" ); -- shortName = i18nc( "Calendar Era: Hebrew Era, years > 0, ShortFormat", "AM" ); -- format = i18nc( "(kdedt-format) Hebrew, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Hebrew Era, years > 0, LongFormat", "Anno Mundi"); -+ shortName = i18nc("Calendar Era: Hebrew Era, years > 0, ShortFormat", "AM"); -+ format = i18nc("(kdedt-format) Hebrew, AM, full era year format used for %EY, e.g. 2000 AM", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --int KCalendarSystemHebrewPrivate::monthsInYear( int year ) const -+int KCalendarSystemHebrewPrivate::monthsInYear(int year) const - { -- if ( isLeapYear( year ) ) { -+ if (isLeapYear(year)) { - return 13; - } else { - return 12; - } - } - --int KCalendarSystemHebrewPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemHebrewPrivate::daysInMonth(int year, int month) const - { -- int mi = monthNumberToMonthIndex( year, month ); -+ int mi = monthNumberToMonthIndex(year, month); - -- if ( mi == 2 && long_cheshvan( year ) ) { -+ if (mi == 2 && long_cheshvan(year)) { - return 30; - } - -- if ( mi == 3 && short_kislev( year ) ) { -+ if (mi == 3 && short_kislev(year)) { - return 29; - } - -- if ( mi % 2 == 0 ) { // Even number months have 29 days -+ if (mi % 2 == 0) { // Even number months have 29 days - return 29; - } else { // Odd number months have 30 days - return 30; - } - } - --int KCalendarSystemHebrewPrivate::daysInYear( int year ) const -+int KCalendarSystemHebrewPrivate::daysInYear(int year) const - { - int days; - - // Get Regular year length -- if ( isLeapYear( year ) ) { // Has 13 months -+ if (isLeapYear(year)) { // Has 13 months - days = 384; - } else { // Has 12 months - days = 354; - } - - // Check if is Deficient or Abundant year -- if ( short_kislev( year ) ) { // Deficient -+ if (short_kislev(year)) { // Deficient - days = days - 1; -- } else if ( long_cheshvan( year ) ) { // Abundant -+ } else if (long_cheshvan(year)) { // Abundant - days = days + 1; - } - -@@ -346,9 +346,9 @@ int KCalendarSystemHebrewPrivate::daysInWeek() const - return 7; - } - --bool KCalendarSystemHebrewPrivate::isLeapYear( int year ) const -+bool KCalendarSystemHebrewPrivate::isLeapYear(int year) const - { -- return ( ( ( ( 7 * year ) + 1 ) % 19 ) < 7 ); -+ return ((((7 * year) + 1) % 19) < 7); - } - - bool KCalendarSystemHebrewPrivate::hasLeapMonths() const -@@ -381,9 +381,9 @@ int KCalendarSystemHebrewPrivate::latestValidYear() const - return 8119; - } - --int KCalendarSystemHebrewPrivate::integerFromString( const QString &inputString, int maxLength, int &readLength ) const -+int KCalendarSystemHebrewPrivate::integerFromString(const QString &inputString, int maxLength, int &readLength) const - { -- if ( locale()->language() == QLatin1String("he") ) { -+ if (locale()->language() == QLatin1String("he")) { - - // Hebrew numbers are composed of combinations of normal letters which have a numeric value. - // This is a non-positional system, the numeric values are simply added together, however -@@ -420,18 +420,18 @@ int KCalendarSystemHebrewPrivate::integerFromString( const QString &inputString, - int result = 0; - int value = 0; - -- for ( ; position < stringLength ; ++position ) { -+ for (; position < stringLength ; ++position) { - - thisChar = string[position]; - -- if ( position + 1 < stringLength ) { -+ if (position + 1 < stringLength) { - nextChar = string[position + 1]; - // Ignore any geresh or gershayim chars, we don't bother checking they are in the right place -- if ( nextChar == QLatin1Char('\'') || nextChar == QChar( 0x05F3 ) || // geresh -- nextChar == QLatin1Char('\"') || nextChar == QChar( 0x05F4 ) ) { // gershayim -- string.remove( position + 1, 1 ); -+ if (nextChar == QLatin1Char('\'') || nextChar == QChar(0x05F3) || // geresh -+ nextChar == QLatin1Char('\"') || nextChar == QChar(0x05F4)) { // gershayim -+ string.remove(position + 1, 1); - stringLength = string.length(); -- if ( position + 1 < stringLength ) { -+ if (position + 1 < stringLength) { - nextChar = string[position + 1]; - } else { - nextChar = QChar(); -@@ -442,7 +442,7 @@ int KCalendarSystemHebrewPrivate::integerFromString( const QString &inputString, - nextChar = QChar(); - } - -- if ( thisChar >= QChar( 0x05D0 ) && thisChar <= QChar( 0x05D7 ) ) { -+ if (thisChar >= QChar(0x05D0) && thisChar <= QChar(0x05D7)) { - - // If this char Alef to Het, 1 to 8, א to ח - -@@ -450,13 +450,13 @@ int KCalendarSystemHebrewPrivate::integerFromString( const QString &inputString, - // then this char is a thousands digit - // else this char is a ones digit - -- if ( nextChar >= QChar( 0x05D0 ) && nextChar <= QChar( 0x05EA ) ) { -- value = ( thisChar.unicode() - 0x05D0 + 1 ) * 1000; -+ if (nextChar >= QChar(0x05D0) && nextChar <= QChar(0x05EA)) { -+ value = (thisChar.unicode() - 0x05D0 + 1) * 1000; - } else { - value = thisChar.unicode() - 0x05D0 + 1; - } - -- } else if ( thisChar == QChar( 0x05D8 ) ) { -+ } else if (thisChar == QChar(0x05D8)) { - - // If this char is Tet, 9, ט - -@@ -465,31 +465,31 @@ int KCalendarSystemHebrewPrivate::integerFromString( const QString &inputString, - // and next char not 7 (Special case for 97 = 16) - // then is a thousands digit else is 9 - -- if ( nextChar >= QChar( 0x05D0 ) && nextChar <= QChar( 0x05EA ) && -- nextChar != QChar( 0x05D5 ) && nextChar != QChar( 0x05D6 ) ) { -+ if (nextChar >= QChar(0x05D0) && nextChar <= QChar(0x05EA) && -+ nextChar != QChar(0x05D5) && nextChar != QChar(0x05D6)) { - value = 9000; - } else { - value = 9; - } - -- } else if ( thisChar >= QChar( 0x05D9 ) && thisChar <= QChar( 0x05E6 ) ) { -+ } else if (thisChar >= QChar(0x05D9) && thisChar <= QChar(0x05E6)) { - - // If this char Yod to Tsadi, 10 to 90, י to צ - - // If next char is a tens or hundreds char then is an error - // Else is a tens digit - -- if ( nextChar >= QChar( 0x05D9 ) ) { -+ if (nextChar >= QChar(0x05D9)) { - return -1; - } else { - value = decadeValues[thisChar.unicode() - 0x05D9]; - } - -- } else if ( thisChar >= QChar( 0x05E7 ) && thisChar <= QChar( 0x05EA ) ) { -+ } else if (thisChar >= QChar(0x05E7) && thisChar <= QChar(0x05EA)) { - - // If this char Qof to Tav, 100 to 400, ק to ת, then is hundreds digit - -- value = ( thisChar.unicode() - 0x05E7 + 1 ) * 100; -+ value = (thisChar.unicode() - 0x05E7 + 1) * 100; - - } else { - -@@ -508,18 +508,18 @@ int KCalendarSystemHebrewPrivate::integerFromString( const QString &inputString, - return result; - - } else { -- return KCalendarSystemPrivate::integerFromString( inputString, maxLength, readLength ); -+ return KCalendarSystemPrivate::integerFromString(inputString, maxLength, readLength); - } - } - --QString KCalendarSystemHebrewPrivate::stringFromInteger( int number, int padWidth, QChar padChar ) const -+QString KCalendarSystemHebrewPrivate::stringFromInteger(int number, int padWidth, QChar padChar) const - { -- return KCalendarSystemPrivate::stringFromInteger( number, padWidth, padChar ); -+ return KCalendarSystemPrivate::stringFromInteger(number, padWidth, padChar); - } - --QString KCalendarSystemHebrewPrivate::stringFromInteger( int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet ) const -+QString KCalendarSystemHebrewPrivate::stringFromInteger(int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet) const - { -- if ( locale()->language() == QLatin1String("he") ) { -+ if (locale()->language() == QLatin1String("he")) { - - // Hebrew numbers are composed of combinations of normal letters which have a numeric value. - // This is a non-positional system, the numeric values are simply added together, however -@@ -546,8 +546,8 @@ QString KCalendarSystemHebrewPrivate::stringFromInteger( int number, int padWidt - */ - - const QChar decade[] = { -- // Tet = ט, Yod = י, Kaf = כ, Lamed = ל, Mem = מ -- // Nun = נ, Samekh = ס, Ayin = ע, Pe = פ, Tsadi = צ -+ // Tet = ט, Yod = י, Kaf = כ, Lamed = ל, Mem = מ -+ // Nun = נ, Samekh = ס, Ayin = ע, Pe = פ, Tsadi = צ - 0x05D8, 0x05D9, 0x05DB, 0x05DC, 0x05DE, - 0x05E0, 0x05E1, 0x05E2, 0x05E4, 0x05E6 - }; -@@ -555,15 +555,15 @@ QString KCalendarSystemHebrewPrivate::stringFromInteger( int number, int padWidt - QString result; - - // We have no rules for coping with numbers outside this range -- if ( number < 1 || number > 9999 ) { -- return KCalendarSystemPrivate::stringFromInteger( number, padWidth, padChar, digitSet ); -+ if (number < 1 || number > 9999) { -+ return KCalendarSystemPrivate::stringFromInteger(number, padWidth, padChar, digitSet); - } - - // Translate the thousands digit, just uses letter for number 1..9 ( א to ט, Alef to Tet ) - // Years 5001-5999 do not have the thousands by convention -- if ( number >= 1000 ) { -- if ( number <= 5000 || number >= 6000 ) { -- result += QChar( 0x05D0 - 1 + number / 1000 ); // Alef א to Tet ט -+ if (number >= 1000) { -+ if (number <= 5000 || number >= 6000) { -+ result += QChar(0x05D0 - 1 + number / 1000); // Alef א to Tet ט - } - number %= 1000; - } -@@ -571,28 +571,28 @@ QString KCalendarSystemHebrewPrivate::stringFromInteger( int number, int padWidt - // Translate the hundreds digit - // Use traditional method where we only have letters assigned values for 100, 200, 300 and 400 - // so may need to repeat 400 twice to make up the required number -- if ( number >= 100 ) { -- while ( number >= 500 ) { -- result += QChar( 0x05EA ); // Tav = ת -+ if (number >= 100) { -+ while (number >= 500) { -+ result += QChar(0x05EA); // Tav = ת - number -= 400; - } -- result += QChar( 0x05E7 - 1 + number / 100 ); // Qof = ק to xxx -+ result += QChar(0x05E7 - 1 + number / 100); // Qof = ק to xxx - number %= 100; - } - - // Translate the tens digit - // The numbers 15 and 16 translate to letters that spell out the name of God which is - // forbidden, so require special treatment where 15 = 9 + 6 and 1 = 9 + 7. -- if ( number >= 10 ) { -- if ( number == 15 || number == 16 ) -+ if (number >= 10) { -+ if (number == 15 || number == 16) - number -= 9; - result += decade[number / 10]; - number %= 10; - } - - // Translate the ones digit, uses letter for number 1..9 ( א to ט, Alef to Tet ) -- if ( number > 0 ) { -- result += QChar( 0x05D0 - 1 + number ); // Alef = א to xxx -+ if (number > 0) { -+ result += QChar(0x05D0 - 1 + number); // Alef = א to xxx - } - - // When used in a string with mixed names and numbers the numbers need special chars to -@@ -601,27 +601,27 @@ QString KCalendarSystemHebrewPrivate::stringFromInteger( int number, int padWidt - // single quote for convenience. - // Multiple digit numbers have a gershayim symbol ? (Unicode = 0x05F4) as second-to-last - // char, but we use double quote for convenience. -- if ( result.length() == 1 ) { -+ if (result.length() == 1) { - result += QLatin1Char('\''); - } else { -- result.insert( result.length() - 1, QLatin1Char('\"') ); -+ result.insert(result.length() - 1, QLatin1Char('\"')); - } - - return result; - - } else { -- return KCalendarSystemPrivate::stringFromInteger( number, padWidth, padChar, digitSet ); -+ return KCalendarSystemPrivate::stringFromInteger(number, padWidth, padChar, digitSet); - } - } - --int KCalendarSystemHebrewPrivate::monthNumberToMonthIndex( int year, int month ) const -+int KCalendarSystemHebrewPrivate::monthNumberToMonthIndex(int year, int month) const - { -- if ( isLeapYear( year ) ) { -- if ( month == 6 ) { -+ if (isLeapYear(year)) { -+ if (month == 6) { - return 13; // Adar I -- } else if ( month == 7 ) { -+ } else if (month == 7) { - return 14; // Adar II -- } else if ( month > 7 ) { -+ } else if (month > 7) { - return month - 1; // Because of Adar II - } - } -@@ -629,181 +629,181 @@ int KCalendarSystemHebrewPrivate::monthNumberToMonthIndex( int year, int month ) - return month; - } - --QString KCalendarSystemHebrewPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemHebrewPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { - // We must map month number to month index -- int monthIndex = monthNumberToMonthIndex( year, month ); -+ int monthIndex = monthNumberToMonthIndex(year, month); - -- if ( format == KLocale::NarrowName ) { -- switch ( monthIndex ) { -+ if (format == KLocale::NarrowName) { -+ switch (monthIndex) { - case 1: -- return ki18nc( "Hebrew month 1 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Hebrew month 1 - KLocale::NarrowName", "T").toString(locale()); - case 2: -- return ki18nc( "Hebrew month 2 - KLocale::NarrowName", "H" ).toString( locale() ); -+ return ki18nc("Hebrew month 2 - KLocale::NarrowName", "H").toString(locale()); - case 3: -- return ki18nc( "Hebrew month 3 - KLocale::NarrowName", "K" ).toString( locale() ); -+ return ki18nc("Hebrew month 3 - KLocale::NarrowName", "K").toString(locale()); - case 4: -- return ki18nc( "Hebrew month 4 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Hebrew month 4 - KLocale::NarrowName", "T").toString(locale()); - case 5: -- return ki18nc( "Hebrew month 5 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Hebrew month 5 - KLocale::NarrowName", "S").toString(locale()); - case 6: -- return ki18nc( "Hebrew month 6 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Hebrew month 6 - KLocale::NarrowName", "A").toString(locale()); - case 7: -- return ki18nc( "Hebrew month 7 - KLocale::NarrowName", "N" ).toString( locale() ); -+ return ki18nc("Hebrew month 7 - KLocale::NarrowName", "N").toString(locale()); - case 8: -- return ki18nc( "Hebrew month 8 - KLocale::NarrowName", "I" ).toString( locale() ); -+ return ki18nc("Hebrew month 8 - KLocale::NarrowName", "I").toString(locale()); - case 9: -- return ki18nc( "Hebrew month 9 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Hebrew month 9 - KLocale::NarrowName", "S").toString(locale()); - case 10: -- return ki18nc( "Hebrew month 10 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Hebrew month 10 - KLocale::NarrowName", "T").toString(locale()); - case 11: -- return ki18nc( "Hebrew month 11 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Hebrew month 11 - KLocale::NarrowName", "A").toString(locale()); - case 12: -- return ki18nc( "Hebrew month 12 - KLocale::NarrowName", "E" ).toString( locale() ); -+ return ki18nc("Hebrew month 12 - KLocale::NarrowName", "E").toString(locale()); - case 13: -- return ki18nc( "Hebrew month 13 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Hebrew month 13 - KLocale::NarrowName", "A").toString(locale()); - case 14: -- return ki18nc( "Hebrew month 14 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Hebrew month 14 - KLocale::NarrowName", "A").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( monthIndex ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (monthIndex) { - case 1: -- return ki18nc( "Hebrew month 1 - KLocale::ShortName Possessive", "of Tis" ).toString( locale() ); -+ return ki18nc("Hebrew month 1 - KLocale::ShortName Possessive", "of Tis").toString(locale()); - case 2: -- return ki18nc( "Hebrew month 2 - KLocale::ShortName Possessive", "of Hes" ).toString( locale() ); -+ return ki18nc("Hebrew month 2 - KLocale::ShortName Possessive", "of Hes").toString(locale()); - case 3: -- return ki18nc( "Hebrew month 3 - KLocale::ShortName Possessive", "of Kis" ).toString( locale() ); -+ return ki18nc("Hebrew month 3 - KLocale::ShortName Possessive", "of Kis").toString(locale()); - case 4: -- return ki18nc( "Hebrew month 4 - KLocale::ShortName Possessive", "of Tev" ).toString( locale() ); -+ return ki18nc("Hebrew month 4 - KLocale::ShortName Possessive", "of Tev").toString(locale()); - case 5: -- return ki18nc( "Hebrew month 5 - KLocale::ShortName Possessive", "of Shv" ).toString( locale() ); -+ return ki18nc("Hebrew month 5 - KLocale::ShortName Possessive", "of Shv").toString(locale()); - case 6: -- return ki18nc( "Hebrew month 6 - KLocale::ShortName Possessive", "of Ada" ).toString( locale() ); -+ return ki18nc("Hebrew month 6 - KLocale::ShortName Possessive", "of Ada").toString(locale()); - case 7: -- return ki18nc( "Hebrew month 7 - KLocale::ShortName Possessive", "of Nis" ).toString( locale() ); -+ return ki18nc("Hebrew month 7 - KLocale::ShortName Possessive", "of Nis").toString(locale()); - case 8: -- return ki18nc( "Hebrew month 8 - KLocale::ShortName Possessive", "of Iya" ).toString( locale() ); -+ return ki18nc("Hebrew month 8 - KLocale::ShortName Possessive", "of Iya").toString(locale()); - case 9: -- return ki18nc( "Hebrew month 9 - KLocale::ShortName Possessive", "of Siv" ).toString( locale() ); -+ return ki18nc("Hebrew month 9 - KLocale::ShortName Possessive", "of Siv").toString(locale()); - case 10: -- return ki18nc( "Hebrew month 10 - KLocale::ShortName Possessive", "of Tam" ).toString( locale() ); -+ return ki18nc("Hebrew month 10 - KLocale::ShortName Possessive", "of Tam").toString(locale()); - case 11: -- return ki18nc( "Hebrew month 11 - KLocale::ShortName Possessive", "of Av" ).toString( locale() ); -+ return ki18nc("Hebrew month 11 - KLocale::ShortName Possessive", "of Av").toString(locale()); - case 12: -- return ki18nc( "Hebrew month 12 - KLocale::ShortName Possessive", "of Elu" ).toString( locale() ); -+ return ki18nc("Hebrew month 12 - KLocale::ShortName Possessive", "of Elu").toString(locale()); - case 13: -- return ki18nc( "Hebrew month 13 - KLocale::ShortName Possessive", "of Ad1" ).toString( locale() ); -+ return ki18nc("Hebrew month 13 - KLocale::ShortName Possessive", "of Ad1").toString(locale()); - case 14: -- return ki18nc( "Hebrew month 14 - KLocale::ShortName Possessive", "of Ad2" ).toString( locale() ); -+ return ki18nc("Hebrew month 14 - KLocale::ShortName Possessive", "of Ad2").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( monthIndex ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (monthIndex) { - case 1: -- return ki18nc( "Hebrew month 1 - KLocale::ShortName", "Tis" ).toString( locale() ); -+ return ki18nc("Hebrew month 1 - KLocale::ShortName", "Tis").toString(locale()); - case 2: -- return ki18nc( "Hebrew month 2 - KLocale::ShortName", "Hes" ).toString( locale() ); -+ return ki18nc("Hebrew month 2 - KLocale::ShortName", "Hes").toString(locale()); - case 3: -- return ki18nc( "Hebrew month 3 - KLocale::ShortName", "Kis" ).toString( locale() ); -+ return ki18nc("Hebrew month 3 - KLocale::ShortName", "Kis").toString(locale()); - case 4: -- return ki18nc( "Hebrew month 4 - KLocale::ShortName", "Tev" ).toString( locale() ); -+ return ki18nc("Hebrew month 4 - KLocale::ShortName", "Tev").toString(locale()); - case 5: -- return ki18nc( "Hebrew month 5 - KLocale::ShortName", "Shv" ).toString( locale() ); -+ return ki18nc("Hebrew month 5 - KLocale::ShortName", "Shv").toString(locale()); - case 6: -- return ki18nc( "Hebrew month 6 - KLocale::ShortName", "Ada" ).toString( locale() ); -+ return ki18nc("Hebrew month 6 - KLocale::ShortName", "Ada").toString(locale()); - case 7: -- return ki18nc( "Hebrew month 7 - KLocale::ShortName", "Nis" ).toString( locale() ); -+ return ki18nc("Hebrew month 7 - KLocale::ShortName", "Nis").toString(locale()); - case 8: -- return ki18nc( "Hebrew month 8 - KLocale::ShortName", "Iya" ).toString( locale() ); -+ return ki18nc("Hebrew month 8 - KLocale::ShortName", "Iya").toString(locale()); - case 9: -- return ki18nc( "Hebrew month 9 - KLocale::ShortName", "Siv" ).toString( locale() ); -+ return ki18nc("Hebrew month 9 - KLocale::ShortName", "Siv").toString(locale()); - case 10: -- return ki18nc( "Hebrew month 10 - KLocale::ShortName", "Tam" ).toString( locale() ); -+ return ki18nc("Hebrew month 10 - KLocale::ShortName", "Tam").toString(locale()); - case 11: -- return ki18nc( "Hebrew month 11 - KLocale::ShortName", "Av" ).toString( locale() ); -+ return ki18nc("Hebrew month 11 - KLocale::ShortName", "Av").toString(locale()); - case 12: -- return ki18nc( "Hebrew month 12 - KLocale::ShortName", "Elu" ).toString( locale() ); -+ return ki18nc("Hebrew month 12 - KLocale::ShortName", "Elu").toString(locale()); - case 13: -- return ki18nc( "Hebrew month 13 - KLocale::ShortName", "Ad1" ).toString( locale() ); -+ return ki18nc("Hebrew month 13 - KLocale::ShortName", "Ad1").toString(locale()); - case 14: -- return ki18nc( "Hebrew month 14 - KLocale::ShortName", "Ad2" ).toString( locale() ); -+ return ki18nc("Hebrew month 14 - KLocale::ShortName", "Ad2").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( monthIndex ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (monthIndex) { - case 1: -- return ki18nc( "Hebrew month 1 - KLocale::LongName Possessive", "of Tishrey" ).toString( locale() ); -+ return ki18nc("Hebrew month 1 - KLocale::LongName Possessive", "of Tishrey").toString(locale()); - case 2: -- return ki18nc( "Hebrew month 2 - KLocale::LongName Possessive", "of Heshvan" ).toString( locale() ); -+ return ki18nc("Hebrew month 2 - KLocale::LongName Possessive", "of Heshvan").toString(locale()); - case 3: -- return ki18nc( "Hebrew month 3 - KLocale::LongName Possessive", "of Kislev" ).toString( locale() ); -+ return ki18nc("Hebrew month 3 - KLocale::LongName Possessive", "of Kislev").toString(locale()); - case 4: -- return ki18nc( "Hebrew month 4 - KLocale::LongName Possessive", "of Tevet" ).toString( locale() ); -+ return ki18nc("Hebrew month 4 - KLocale::LongName Possessive", "of Tevet").toString(locale()); - case 5: -- return ki18nc( "Hebrew month 5 - KLocale::LongName Possessive", "of Shvat" ).toString( locale() ); -+ return ki18nc("Hebrew month 5 - KLocale::LongName Possessive", "of Shvat").toString(locale()); - case 6: -- return ki18nc( "Hebrew month 6 - KLocale::LongName Possessive", "of Adar" ).toString( locale() ); -+ return ki18nc("Hebrew month 6 - KLocale::LongName Possessive", "of Adar").toString(locale()); - case 7: -- return ki18nc( "Hebrew month 7 - KLocale::LongName Possessive", "of Nisan" ).toString( locale() ); -+ return ki18nc("Hebrew month 7 - KLocale::LongName Possessive", "of Nisan").toString(locale()); - case 8: -- return ki18nc( "Hebrew month 8 - KLocale::LongName Possessive", "of Iyar" ).toString( locale() ); -+ return ki18nc("Hebrew month 8 - KLocale::LongName Possessive", "of Iyar").toString(locale()); - case 9: -- return ki18nc( "Hebrew month 9 - KLocale::LongName Possessive", "of Sivan" ).toString( locale() ); -+ return ki18nc("Hebrew month 9 - KLocale::LongName Possessive", "of Sivan").toString(locale()); - case 10: -- return ki18nc( "Hebrew month 10 - KLocale::LongName Possessive", "of Tamuz" ).toString( locale() ); -+ return ki18nc("Hebrew month 10 - KLocale::LongName Possessive", "of Tamuz").toString(locale()); - case 11: -- return ki18nc( "Hebrew month 11 - KLocale::LongName Possessive", "of Av" ).toString( locale() ); -+ return ki18nc("Hebrew month 11 - KLocale::LongName Possessive", "of Av").toString(locale()); - case 12: -- return ki18nc( "Hebrew month 12 - KLocale::LongName Possessive", "of Elul" ).toString( locale() ); -+ return ki18nc("Hebrew month 12 - KLocale::LongName Possessive", "of Elul").toString(locale()); - case 13: -- return ki18nc( "Hebrew month 13 - KLocale::LongName Possessive", "of Adar I" ).toString( locale() ); -+ return ki18nc("Hebrew month 13 - KLocale::LongName Possessive", "of Adar I").toString(locale()); - case 14: -- return ki18nc( "Hebrew month 14 - KLocale::LongName Possessive", "of Adar II" ).toString( locale() ); -+ return ki18nc("Hebrew month 14 - KLocale::LongName Possessive", "of Adar II").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( monthIndex ) { -+ switch (monthIndex) { - case 1: -- return ki18nc( "Hebrew month 1 - KLocale::LongName", "Tishrey" ).toString( locale() ); -+ return ki18nc("Hebrew month 1 - KLocale::LongName", "Tishrey").toString(locale()); - case 2: -- return ki18nc( "Hebrew month 2 - KLocale::LongName", "Heshvan" ).toString( locale() ); -+ return ki18nc("Hebrew month 2 - KLocale::LongName", "Heshvan").toString(locale()); - case 3: -- return ki18nc( "Hebrew month 3 - KLocale::LongName", "Kislev" ).toString( locale() ); -+ return ki18nc("Hebrew month 3 - KLocale::LongName", "Kislev").toString(locale()); - case 4: -- return ki18nc( "Hebrew month 4 - KLocale::LongName", "Tevet" ).toString( locale() ); -+ return ki18nc("Hebrew month 4 - KLocale::LongName", "Tevet").toString(locale()); - case 5: -- return ki18nc( "Hebrew month 5 - KLocale::LongName", "Shvat" ).toString( locale() ); -+ return ki18nc("Hebrew month 5 - KLocale::LongName", "Shvat").toString(locale()); - case 6: -- return ki18nc( "Hebrew month 6 - KLocale::LongName", "Adar" ).toString( locale() ); -+ return ki18nc("Hebrew month 6 - KLocale::LongName", "Adar").toString(locale()); - case 7: -- return ki18nc( "Hebrew month 7 - KLocale::LongName", "Nisan" ).toString( locale() ); -+ return ki18nc("Hebrew month 7 - KLocale::LongName", "Nisan").toString(locale()); - case 8: -- return ki18nc( "Hebrew month 8 - KLocale::LongName", "Iyar" ).toString( locale() ); -+ return ki18nc("Hebrew month 8 - KLocale::LongName", "Iyar").toString(locale()); - case 9: -- return ki18nc( "Hebrew month 9 - KLocale::LongName", "Sivan" ).toString( locale() ); -+ return ki18nc("Hebrew month 9 - KLocale::LongName", "Sivan").toString(locale()); - case 10: -- return ki18nc( "Hebrew month 10 - KLocale::LongName", "Tamuz" ).toString( locale() ); -+ return ki18nc("Hebrew month 10 - KLocale::LongName", "Tamuz").toString(locale()); - case 11: -- return ki18nc( "Hebrew month 11 - KLocale::LongName", "Av" ).toString( locale() ); -+ return ki18nc("Hebrew month 11 - KLocale::LongName", "Av").toString(locale()); - case 12: -- return ki18nc( "Hebrew month 12 - KLocale::LongName", "Elul" ).toString( locale() ); -+ return ki18nc("Hebrew month 12 - KLocale::LongName", "Elul").toString(locale()); - case 13: -- return ki18nc( "Hebrew month 13 - KLocale::LongName", "Adar I" ).toString( locale() ); -+ return ki18nc("Hebrew month 13 - KLocale::LongName", "Adar I").toString(locale()); - case 14: -- return ki18nc( "Hebrew month 14 - KLocale::LongName", "Adar II" ).toString( locale() ); -+ return ki18nc("Hebrew month 14 - KLocale::LongName", "Adar II").toString(locale()); - default: - return QString(); - } -@@ -812,106 +812,102 @@ QString KCalendarSystemHebrewPrivate::monthName( int month, int year, KLocale::D - // 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 -+QString KCalendarSystemHebrewPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Gregorian weekday 1 - KLocale::NarrowName ", "M" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 1 - KLocale::NarrowName ", "M").toString(locale()); - case 2: -- return ki18nc( "Gregorian weekday 2 - KLocale::NarrowName ", "T" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 2 - KLocale::NarrowName ", "T").toString(locale()); - case 3: -- return ki18nc( "Gregorian weekday 3 - KLocale::NarrowName ", "W" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 3 - KLocale::NarrowName ", "W").toString(locale()); - case 4: -- return ki18nc( "Gregorian weekday 4 - KLocale::NarrowName ", "T" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 4 - KLocale::NarrowName ", "T").toString(locale()); - case 5: -- return ki18nc( "Gregorian weekday 5 - KLocale::NarrowName ", "F" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 5 - KLocale::NarrowName ", "F").toString(locale()); - case 6: -- return ki18nc( "Gregorian weekday 6 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 6 - KLocale::NarrowName ", "S").toString(locale()); - case 7: -- return ki18nc( "Gregorian weekday 7 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 7 - KLocale::NarrowName ", "S").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Gregorian weekday 1 - KLocale::ShortName", "Mon" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 1 - KLocale::ShortName", "Mon").toString(locale()); - case 2: -- return ki18nc( "Gregorian weekday 2 - KLocale::ShortName", "Tue" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 2 - KLocale::ShortName", "Tue").toString(locale()); - case 3: -- return ki18nc( "Gregorian weekday 3 - KLocale::ShortName", "Wed" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 3 - KLocale::ShortName", "Wed").toString(locale()); - case 4: -- return ki18nc( "Gregorian weekday 4 - KLocale::ShortName", "Thu" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 4 - KLocale::ShortName", "Thu").toString(locale()); - case 5: -- return ki18nc( "Gregorian weekday 5 - KLocale::ShortName", "Fri" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 5 - KLocale::ShortName", "Fri").toString(locale()); - case 6: -- return ki18nc( "Gregorian weekday 6 - KLocale::ShortName", "Sat" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 6 - KLocale::ShortName", "Sat").toString(locale()); - case 7: -- return ki18nc( "Gregorian weekday 7 - KLocale::ShortName", "Sun" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 7 - KLocale::ShortName", "Sun").toString(locale()); - default: return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Gregorian weekday 1 - KLocale::LongName", "Monday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 1 - KLocale::LongName", "Monday").toString(locale()); - case 2: -- return ki18nc( "Gregorian weekday 2 - KLocale::LongName", "Tuesday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 2 - KLocale::LongName", "Tuesday").toString(locale()); - case 3: -- return ki18nc( "Gregorian weekday 3 - KLocale::LongName", "Wednesday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 3 - KLocale::LongName", "Wednesday").toString(locale()); - case 4: -- return ki18nc( "Gregorian weekday 4 - KLocale::LongName", "Thursday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 4 - KLocale::LongName", "Thursday").toString(locale()); - case 5: -- return ki18nc( "Gregorian weekday 5 - KLocale::LongName", "Friday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 5 - KLocale::LongName", "Friday").toString(locale()); - case 6: -- return ki18nc( "Gregorian weekday 6 - KLocale::LongName", "Saturday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 6 - KLocale::LongName", "Saturday").toString(locale()); - case 7: -- return ki18nc( "Gregorian weekday 7 - KLocale::LongName", "Sunday" ).toString( locale() ); -+ return ki18nc("Gregorian weekday 7 - KLocale::LongName", "Sunday").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemHebrew::KCalendarSystemHebrew( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemHebrewPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemHebrew::KCalendarSystemHebrew(const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemHebrewPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemHebrew::KCalendarSystemHebrew( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemHebrewPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemHebrew::KCalendarSystemHebrew(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemHebrewPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemHebrew::KCalendarSystemHebrew( KCalendarSystemHebrewPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemHebrew::KCalendarSystemHebrew(KCalendarSystemHebrewPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemHebrew::~KCalendarSystemHebrew() - { -- delete dont_use; - } - - QString KCalendarSystemHebrew::calendarType() const - { -- return QLatin1String( "hebrew" ); -+ return QLatin1String("hebrew"); - } - - QDate KCalendarSystemHebrew::epoch() const - { - // Hebrew 0001-01-01 (Gregorian -3760-09-07, Julian -3761-10-07) -- return QDate::fromJulianDay( 347998 ); -+ return QDate::fromJulianDay(347998); - } - - QDate KCalendarSystemHebrew::earliestValidDate() const -@@ -919,219 +915,88 @@ QDate KCalendarSystemHebrew::earliestValidDate() const - // Current formulas using direct Gregorian <-> Hebrew conversion using Qt - // will return invalid results prior to the Gregorian switchover in 1582 - // Next valid Hebrew year starts 5344-01-01 (Gregorian 1583-09-17) -- return QDate::fromJulianDay( 2299498 ); -+ return QDate::fromJulianDay(2299498); - } - - QDate KCalendarSystemHebrew::latestValidDate() const - { - // Testing shows current formulas only work up to 8119-13-29 (Gregorian 4359-10-07) -- return QDate::fromJulianDay( 3313431 ); -+ return QDate::fromJulianDay(3313431); - } - --bool KCalendarSystemHebrew::isValid( int year, int month, int day ) const -+bool KCalendarSystemHebrew::isValid(int year, int month, int day) const - { -- return KCalendarSystem::isValid( year, month, day ); -+ return KCalendarSystem::isValid(year, month, day); - } - --bool KCalendarSystemHebrew::isValid( const QDate &date ) const -+bool KCalendarSystemHebrew::isValid(const QDate &date) const - { -- return KCalendarSystem::isValid( date ); -+ return KCalendarSystem::isValid(date); - } - --bool KCalendarSystemHebrew::setDate( QDate &date, int year, int month, int day ) const -+int KCalendarSystemHebrew::dayOfWeek(const QDate &date) const - { -- return KCalendarSystem::setDate( date, year, month, day ); --} -- --// Deprecated --bool KCalendarSystemHebrew::setYMD( QDate &date, int year, int month, int day ) const --{ -- return KCalendarSystem::setYMD( date, year, month, day ); --} -- --int KCalendarSystemHebrew::year( const QDate &date ) const --{ -- return KCalendarSystem::year( date ); --} -- --int KCalendarSystemHebrew::month( const QDate &date ) const --{ -- return KCalendarSystem::month( date ); --} -- --int KCalendarSystemHebrew::day( const QDate &date ) const --{ -- return KCalendarSystem::day( date ); --} -- --QDate KCalendarSystemHebrew::addYears( const QDate &date, int nyears ) const --{ -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemHebrew::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemHebrew::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemHebrew::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemHebrew::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemHebrew::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemHebrew::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemHebrew::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemHebrew::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemHebrew::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemHebrew::dayOfWeek( const QDate &date ) const --{ -- class h_date * sd = toHebrew( date ); -- if ( sd->hd_dw == 0 ) { -+ class h_date * sd = toHebrew(date); -+ if (sd->hd_dw == 0) { - return 7; - } else { -- return ( sd->hd_dw ); -+ return (sd->hd_dw); - } - } - --int KCalendarSystemHebrew::weekNumber( const QDate &date, int *yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemHebrew::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemHebrew::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemHebrew::monthName( int month, int year, MonthNameFormat format ) const -+bool KCalendarSystemHebrew::isLeapYear(int year) const - { -- return KCalendarSystem::monthName( month, year, format ); -+ return KCalendarSystem::isLeapYear(year); - } - --QString KCalendarSystemHebrew::monthName( const QDate &date, MonthNameFormat format ) const -+bool KCalendarSystemHebrew::isLeapYear(const QDate &date) const - { -- return KCalendarSystem::monthName( date, format ); -+ return KCalendarSystem::isLeapYear(date); - } - --QString KCalendarSystemHebrew::weekDayName( int weekDay, WeekDayNameFormat format ) const -+QString KCalendarSystemHebrew::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystem::weekDayName( weekDay, format ); -+ return KCalendarSystem::monthName(month, year, format); - } - --QString KCalendarSystemHebrew::weekDayName( const QDate &date, WeekDayNameFormat format ) const -+QString KCalendarSystemHebrew::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystem::weekDayName( date, format ); -+ return KCalendarSystem::monthName(date, format); - } - --QString KCalendarSystemHebrew::yearString( const QDate &date, StringFormat format ) const -+QString KCalendarSystemHebrew::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystem::yearString( date, format ); -+ return KCalendarSystem::weekDayName(weekDay, format); - } - --QString KCalendarSystemHebrew::monthString( const QDate &date, StringFormat format ) const -+QString KCalendarSystemHebrew::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystem::monthString( date, format ); -+ return KCalendarSystem::weekDayName(date, format); - } - --QString KCalendarSystemHebrew::dayString( const QDate &date, StringFormat format ) const -+int KCalendarSystemHebrew::yearStringToInteger(const QString &string, int &readLength) const - { -- return KCalendarSystem::dayString( date, format ); --} -- --int KCalendarSystemHebrew::yearStringToInteger( const QString &string, int &readLength ) const --{ -- int result = KCalendarSystem::yearStringToInteger( string, readLength ); -+ int result = KCalendarSystem::yearStringToInteger(string, readLength); - - // Hebrew has no letter for 0, so 5 and 5000 are written the same - // Assume if less than 10 then we are in an exact multiple of 1000 -- if ( result < 10 ) { -+ if (result < 10) { - result = result * 1000; - } - - // Not good just assuming, make configurable -- if ( result < 1000 ) { -+ if (result < 1000) { - result += 5000; // assume we're in the 6th millenium (y6k bug) - } - - return result; - } - --int KCalendarSystemHebrew::monthStringToInteger( const QString &string, int &readLength ) const --{ -- return KCalendarSystem::monthStringToInteger( string, readLength ); --} -- --int KCalendarSystemHebrew::dayStringToInteger( const QString &string, int &readLength ) const --{ -- return KCalendarSystem::yearStringToInteger( string, readLength ); --} -- --QString KCalendarSystemHebrew::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemHebrew::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemHebrew::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemHebrew::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- - int KCalendarSystemHebrew::weekDayOfPray() const - { - return 6; // Saturday - } - --int KCalendarSystemHebrew::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); --} -- - bool KCalendarSystemHebrew::isLunar() const - { - return false; -@@ -1152,19 +1017,19 @@ bool KCalendarSystemHebrew::isProleptic() const - return false; - } - --bool KCalendarSystemHebrew::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemHebrew::julianDayToDate(int jd, int &year, int &month, int &day) const - { -- class h_date * sd = toHebrew( QDate::fromJulianDay( jd ) ); -+ class h_date * sd = toHebrew(QDate::fromJulianDay(jd)); - - year = sd->hd_year; - - month = sd->hd_mon; -- if ( isLeapYear( sd->hd_year ) ) { -- if( month == 13 /*AdarI*/ ) { -+ if (isLeapYear(sd->hd_year)) { -+ if (month == 13 /*AdarI*/) { - month = 6; -- } else if( month == 14 /*AdarII*/ ) { -+ } else if (month == 14 /*AdarII*/) { - month = 7; -- } else if ( month > 6 && month < 13 ) { -+ } else if (month > 6 && month < 13) { - ++month; - } - } -@@ -1174,11 +1039,11 @@ bool KCalendarSystemHebrew::julianDayToDate( int jd, int &year, int &month, int - return true; - } - --bool KCalendarSystemHebrew::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemHebrew::dateToJulianDay(int year, int month, int day, int &jd) const - { -- class h_date * gd = hebrewToGregorian( year, month, day ); -+ class h_date * gd = hebrewToGregorian(year, month, day); - -- QDate tempDate( gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1 ); -+ QDate tempDate(gd->hd_year, gd->hd_mon + 1, gd->hd_day + 1); - - jd = tempDate.toJulianDay(); - -diff --git a/kdecore/date/kcalendarsystemhebrew_p.h b/kdecore/date/kcalendarsystemhebrew_p.h -index 72e82ec..3c3f7fb 100644 ---- a/kdecore/date/kcalendarsystemhebrew_p.h -+++ b/kdecore/date/kcalendarsystemhebrew_p.h -@@ -41,8 +41,8 @@ class KCalendarSystemHebrewPrivate; - class KCalendarSystemHebrew : public KCalendarSystem - { - public: -- explicit KCalendarSystemHebrew( const KLocale * locale = 0 ); -- explicit KCalendarSystemHebrew( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemHebrew(const KLocale * locale = 0); -+ explicit KCalendarSystemHebrew(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemHebrew(); - - virtual QString calendarType() const; -@@ -50,58 +50,23 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual int dayOfWeek(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -+ virtual int yearStringToInteger(const QString &sNum, int &iLength) const; - -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -109,15 +74,14 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemHebrew( KCalendarSystemHebrewPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemHebrew(KCalendarSystemHebrewPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: -- Q_DECLARE_PRIVATE( KCalendarSystemHebrew ) -- KCalendarSystemHebrewPrivate * const dont_use; // KDE5 remove, use shared d -+ Q_DECLARE_PRIVATE(KCalendarSystemHebrew) - }; - - #endif // KCALENDARSYSTEMHEBREW_H -diff --git a/kdecore/date/kcalendarsystemhijri.cpp b/kdecore/date/kcalendarsystemhijri.cpp -deleted file mode 100644 -index 2af04ea..0000000 ---- a/kdecore/date/kcalendarsystemhijri.cpp -+++ /dev/null -@@ -1,741 +0,0 @@ --/* -- Copyright (c) 2002-2003 Carlos Moro <cfmoro@correo.uniovi.es> -- Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> -- Copyright 2007, 2008, 2009, 2010 John Layt <john@layt.net> -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with this library; see the file COPYING.LIB. If not, write to -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- Boston, MA 02110-1301, USA. --*/ -- --#include "kcalendarsystemhijri_p.h" --#include "kcalendarsystemprivate_p.h" -- --#include <QtCore/QDate> -- --class KCalendarSystemHijriPrivate : public KCalendarSystemPrivate --{ --public: -- explicit KCalendarSystemHijriPrivate( KCalendarSystemHijri *q ); -- -- virtual ~KCalendarSystemHijriPrivate(); -- -- // Virtual methods each calendar system must re-implement -- virtual KLocale::CalendarSystem calendarSystem() const; -- virtual void loadDefaultEraList(); -- 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; -- 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 -- --KCalendarSystemHijriPrivate::KCalendarSystemHijriPrivate( KCalendarSystemHijri *q ) -- :KCalendarSystemPrivate( q ) --{ --} -- --KCalendarSystemHijriPrivate::~KCalendarSystemHijriPrivate() --{ --} -- --KLocale::CalendarSystem KCalendarSystemHijriPrivate::calendarSystem() const --{ -- return KLocale::IslamicCivilCalendar; --} -- --void KCalendarSystemHijriPrivate::loadDefaultEraList() --{ -- QString name, shortName, format; -- // Islamic Era, Anno Hegirae, "Year of the Hijra". -- name = i18nc( "Calendar Era: Hijri Islamic Era, years > 0, LongFormat", "Anno Hegirae" ); -- shortName = i18nc( "Calendar Era: Hijri Islamic Era, years > 0, ShortFormat", "AH" ); -- format = i18nc( "(kdedt-format) Hijri, AH, full era year format used for %EY, e.g. 2000 AH", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); --} -- --int KCalendarSystemHijriPrivate::monthsInYear( int year ) const --{ -- Q_UNUSED( year ) -- return 12; --} -- --int KCalendarSystemHijriPrivate::daysInMonth( int year, int month ) const --{ -- if ( month == 12 && isLeapYear( year ) ) { -- return 30; -- } -- -- if ( month % 2 == 0 ) { // Even number months have 29 days -- return 29; -- } else { // Odd number months have 30 days -- return 30; -- } --} -- --int KCalendarSystemHijriPrivate::daysInYear( int year ) const --{ -- if ( isLeapYear( year ) ) { -- return 355; -- } else { -- return 354; -- } --} -- --int KCalendarSystemHijriPrivate::daysInWeek() const --{ -- return 7; --} -- --bool KCalendarSystemHijriPrivate::isLeapYear( int year ) const --{ -- // Years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 of the 30 year cycle -- -- /* -- The following C++ code is translated from the Lisp code -- in ``Calendrical Calculations'' by Nachum Dershowitz and -- Edward M. Reingold, Software---Practice & Experience, -- vol. 20, no. 9 (September, 1990), pp. 899--928. -- -- This code is in the public domain, but any use of it -- should publically acknowledge its source. -- */ -- -- if ( ( ( ( 11 * year ) + 14 ) % 30 ) < 11 ) { -- return true; -- } else { -- return false; -- } -- -- // The following variations will be implemented in separate classes in 4.5 -- // May be cleaner to formally define using a case statement switch on (year % 30) -- -- // Variation used by Bar Habraeus / Graves / Birashk / Some Microsoft products -- // Years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26, 29 of the 30 year cycle -- // if ( ( ( ( 11 * year ) + 15 ) % 30 ) < 11 ) { -- -- // Variation used by Bohras / Sahifa with epoch 15 July 622 jd = 1948440 -- // Years 2, 5, 8, 10, 13, 16, 19, 21, 24, 27, 29 of the 30 year cycle -- // if ( ( ( ( 11 * year ) + 1 ) % 30 ) < 11 ) { --} -- --bool KCalendarSystemHijriPrivate::hasLeapMonths() const --{ -- return false; --} -- --bool KCalendarSystemHijriPrivate::hasYearZero() const --{ -- return false; --} -- --int KCalendarSystemHijriPrivate::maxDaysInWeek() const --{ -- return 7; --} -- --int KCalendarSystemHijriPrivate::maxMonthsInYear() const --{ -- return 12; --} -- --int KCalendarSystemHijriPrivate::earliestValidYear() const --{ -- return 1; --} -- --int KCalendarSystemHijriPrivate::latestValidYear() const --{ -- return 9999; --} -- --QString KCalendarSystemHijriPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const --{ -- Q_UNUSED( year ); -- -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Hijri month 1 - KLocale::NarrowName", "M" ).toString( locale() ); -- case 2: -- return ki18nc( "Hijri month 2 - KLocale::NarrowName", "S" ).toString( locale() ); -- case 3: -- return ki18nc( "Hijri month 3 - KLocale::NarrowName", "A" ).toString( locale() ); -- case 4: -- return ki18nc( "Hijri month 4 - KLocale::NarrowName", "T" ).toString( locale() ); -- case 5: -- return ki18nc( "Hijri month 5 - KLocale::NarrowName", "A" ).toString( locale() ); -- case 6: -- return ki18nc( "Hijri month 6 - KLocale::NarrowName", "T" ).toString( locale() ); -- case 7: -- return ki18nc( "Hijri month 7 - KLocale::NarrowName", "R" ).toString( locale() ); -- case 8: -- return ki18nc( "Hijri month 8 - KLocale::NarrowName", "S" ).toString( locale() ); -- case 9: -- return ki18nc( "Hijri month 9 - KLocale::NarrowName", "R" ).toString( locale() ); -- case 10: -- return ki18nc( "Hijri month 10 - KLocale::NarrowName", "S" ).toString( locale() ); -- case 11: -- return ki18nc( "Hijri month 11 - KLocale::NarrowName", "Q" ).toString( locale() ); -- case 12: -- return ki18nc( "Hijri month 12 - KLocale::NarrowName", "H" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Hijri month 1 - KLocale::ShortName Possessive", "of Muh" ).toString( locale() ); -- case 2: -- return ki18nc( "Hijri month 2 - KLocale::ShortName Possessive", "of Saf" ).toString( locale() ); -- case 3: -- return ki18nc( "Hijri month 3 - KLocale::ShortName Possessive", "of R.A" ).toString( locale() ); -- case 4: -- return ki18nc( "Hijri month 4 - KLocale::ShortName Possessive", "of R.T" ).toString( locale() ); -- case 5: -- return ki18nc( "Hijri month 5 - KLocale::ShortName Possessive", "of J.A" ).toString( locale() ); -- case 6: -- return ki18nc( "Hijri month 6 - KLocale::ShortName Possessive", "of J.T" ).toString( locale() ); -- case 7: -- return ki18nc( "Hijri month 7 - KLocale::ShortName Possessive", "of Raj" ).toString( locale() ); -- case 8: -- return ki18nc( "Hijri month 8 - KLocale::ShortName Possessive", "of Sha" ).toString( locale() ); -- case 9: -- return ki18nc( "Hijri month 9 - KLocale::ShortName Possessive", "of Ram" ).toString( locale() ); -- case 10: -- return ki18nc( "Hijri month 10 - KLocale::ShortName Possessive", "of Shw" ).toString( locale() ); -- case 11: -- return ki18nc( "Hijri month 11 - KLocale::ShortName Possessive", "of Qid" ).toString( locale() ); -- case 12: -- return ki18nc( "Hijri month 12 - KLocale::ShortName Possessive", "of Hij" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Hijri month 1 - KLocale::ShortName", "Muh" ).toString( locale() ); -- case 2: -- return ki18nc( "Hijri month 2 - KLocale::ShortName", "Saf" ).toString( locale() ); -- case 3: -- return ki18nc( "Hijri month 3 - KLocale::ShortName", "R.A" ).toString( locale() ); -- case 4: -- return ki18nc( "Hijri month 4 - KLocale::ShortName", "R.T" ).toString( locale() ); -- case 5: -- return ki18nc( "Hijri month 5 - KLocale::ShortName", "J.A" ).toString( locale() ); -- case 6: -- return ki18nc( "Hijri month 6 - KLocale::ShortName", "J.T" ).toString( locale() ); -- case 7: -- return ki18nc( "Hijri month 7 - KLocale::ShortName", "Raj" ).toString( locale() ); -- case 8: -- return ki18nc( "Hijri month 8 - KLocale::ShortName", "Sha" ).toString( locale() ); -- case 9: -- return ki18nc( "Hijri month 9 - KLocale::ShortName", "Ram" ).toString( locale() ); -- case 10: -- return ki18nc( "Hijri month 10 - KLocale::ShortName", "Shw" ).toString( locale() ); -- case 11: -- return ki18nc( "Hijri month 11 - KLocale::ShortName", "Qid" ).toString( locale() ); -- case 12: -- return ki18nc( "Hijri month 12 - KLocale::ShortName", "Hij" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -- case 1: -- return ki18nc( "Hijri month 1 - KLocale::LongName Possessive", "of Muharram" ).toString( locale() ); -- case 2: -- return ki18nc( "Hijri month 2 - KLocale::LongName Possessive", "of Safar" ).toString( locale() ); -- case 3: -- return ki18nc( "Hijri month 3 - KLocale::LongName Possessive", "of Rabi` al-Awal" ).toString( locale() ); -- case 4: -- return ki18nc( "Hijri month 4 - KLocale::LongName Possessive", "of Rabi` al-Thaani" ).toString( locale() ); -- case 5: -- return ki18nc( "Hijri month 5 - KLocale::LongName Possessive", "of Jumaada al-Awal" ).toString( locale() ); -- case 6: -- return ki18nc( "Hijri month 6 - KLocale::LongName Possessive", "of Jumaada al-Thaani" ).toString( locale() ); -- case 7: -- return ki18nc( "Hijri month 7 - KLocale::LongName Possessive", "of Rajab" ).toString( locale() ); -- case 8: -- return ki18nc( "Hijri month 8 - KLocale::LongName Possessive", "of Sha`ban" ).toString( locale() ); -- case 9: -- return ki18nc( "Hijri month 9 - KLocale::LongName Possessive", "of Ramadan" ).toString( locale() ); -- case 10: -- return ki18nc( "Hijri month 10 - KLocale::LongName Possessive", "of Shawwal" ).toString( locale() ); -- case 11: -- return ki18nc( "Hijri month 11 - KLocale::LongName Possessive", "of Thu al-Qi`dah" ).toString( locale() ); -- case 12: -- return ki18nc( "Hijri month 12 - KLocale::LongName Possessive", "of Thu al-Hijjah" ).toString( locale() ); -- default: -- return QString(); -- } -- } -- -- // Default to LongName -- switch ( month ) { -- case 1: -- return ki18nc( "Hijri month 1 - KLocale::LongName", "Muharram" ).toString( locale() ); -- case 2: -- return ki18nc( "Hijri month 2 - KLocale::LongName", "Safar" ).toString( locale() ); -- case 3: -- return ki18nc( "Hijri month 3 - KLocale::LongName", "Rabi` al-Awal" ).toString( locale() ); -- case 4: -- return ki18nc( "Hijri month 4 - KLocale::LongName", "Rabi` al-Thaani" ).toString( locale() ); -- case 5: -- return ki18nc( "Hijri month 5 - KLocale::LongName", "Jumaada al-Awal" ).toString( locale() ); -- case 6: -- return ki18nc( "Hijri month 6 - KLocale::LongName", "Jumaada al-Thaani" ).toString( locale() ); -- case 7: -- return ki18nc( "Hijri month 7 - KLocale::LongName", "Rajab" ).toString( locale() ); -- case 8: -- return ki18nc( "Hijri month 8 - KLocale::LongName", "Sha`ban" ).toString( locale() ); -- case 9: -- return ki18nc( "Hijri month 9 - KLocale::LongName", "Ramadan" ).toString( locale() ); -- case 10: -- return ki18nc( "Hijri month 10 - KLocale::LongName", "Shawwal" ).toString( locale() ); -- case 11: -- return ki18nc( "Hijri month 11 - KLocale::LongName", "Thu al-Qi`dah" ).toString( locale() ); -- case 12: -- return ki18nc( "Hijri month 12 - KLocale::LongName", "Thu al-Hijjah" ).toString( locale() ); -- default: -- return QString(); -- } --} -- --QString KCalendarSystemHijriPrivate::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(); -- } --} -- -- --KCalendarSystemHijri::KCalendarSystemHijri( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemHijriPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) --{ -- d_ptr->loadConfig( calendarType() ); --} -- --KCalendarSystemHijri::KCalendarSystemHijri( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemHijriPrivate( this ), config, locale ), -- dont_use( 0 ) --{ -- d_ptr->loadConfig( calendarType() ); --} -- --KCalendarSystemHijri::KCalendarSystemHijri( KCalendarSystemHijriPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) --{ -- d_ptr->loadConfig( calendarType() ); --} -- --KCalendarSystemHijri::~KCalendarSystemHijri() --{ -- delete dont_use; --} -- --QString KCalendarSystemHijri::calendarType() const --{ -- return QLatin1String( "hijri" ); --} -- --QDate KCalendarSystemHijri::epoch() const --{ -- // 16 July 622 in the Julian calendar -- return QDate::fromJulianDay( 1948440 ); --} -- --QDate KCalendarSystemHijri::earliestValidDate() const --{ -- return epoch(); --} -- --QDate KCalendarSystemHijri::latestValidDate() const --{ -- // Set to last day of year 9999 -- // Last day of Hijri year 9999 is 9999-12-29 -- return QDate::fromJulianDay( 5491751 ); --} -- --bool KCalendarSystemHijri::isValid( int year, int month, int day ) const --{ -- return KCalendarSystem::isValid( year, month, day ); --} -- --bool KCalendarSystemHijri::isValid( const QDate &date ) const --{ -- return KCalendarSystem::isValid( date ); --} -- --bool KCalendarSystemHijri::setDate( QDate &date, int year, int month, int day ) const --{ -- return KCalendarSystem::setDate( date, year, month, day ); --} -- --// Deprecated --bool KCalendarSystemHijri::setYMD( QDate &date, int year, int month, int day ) const --{ -- return KCalendarSystem::setYMD( date, year, month, day ); --} -- --int KCalendarSystemHijri::year( const QDate &date ) const --{ -- return KCalendarSystem::year( date ); --} -- --int KCalendarSystemHijri::month( const QDate &date ) const --{ -- return KCalendarSystem::month( date ); --} -- --int KCalendarSystemHijri::day( const QDate &date ) const --{ -- return KCalendarSystem::day( date ); --} -- --QDate KCalendarSystemHijri::addYears( const QDate &date, int nyears ) const --{ -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemHijri::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemHijri::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemHijri::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemHijri::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemHijri::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemHijri::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemHijri::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemHijri::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemHijri::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemHijri::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystem::dayOfWeek( date ); --} -- --int KCalendarSystemHijri::weekNumber( const QDate &date, int *yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemHijri::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemHijri::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemHijri::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemHijri::monthName( const QDate &date, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( date, format ); --} -- --QString KCalendarSystemHijri::weekDayName( int weekDay, WeekDayNameFormat format ) const --{ -- return KCalendarSystem::weekDayName( weekDay, format ); --} -- --QString KCalendarSystemHijri::weekDayName( const QDate &date, WeekDayNameFormat format ) const --{ -- return KCalendarSystem::weekDayName( date, format ); --} -- --QString KCalendarSystemHijri::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemHijri::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemHijri::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemHijri::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemHijri::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemHijri::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemHijri::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemHijri::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemHijri::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemHijri::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- --int KCalendarSystemHijri::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); --} -- --int KCalendarSystemHijri::weekDayOfPray() const --{ -- return 5; // Friday --} -- --bool KCalendarSystemHijri::isLunar() const --{ -- return true; --} -- --bool KCalendarSystemHijri::isLunisolar() const --{ -- return false; --} -- --bool KCalendarSystemHijri::isSolar() const --{ -- return false; --} -- --bool KCalendarSystemHijri::isProleptic() const --{ -- return false; --} -- --bool KCalendarSystemHijri::julianDayToDate( int jd, int &year, int &month, int &day ) const --{ -- Q_D( const KCalendarSystemHijri ); -- -- /* -- The following C++ code is translated from the Lisp code -- in ``Calendrical Calculations'' by Nachum Dershowitz and -- Edward M. Reingold, Software---Practice & Experience, -- vol. 20, no. 9 (September, 1990), pp. 899--928. -- -- This code is in the public domain, but any use of it -- should publically acknowledge its source. -- */ -- -- // Search forward year by year from approximate year -- year = ( jd - epoch().toJulianDay() ) / 355; -- int testJd; -- dateToJulianDay( year, 12, d->daysInMonth( year, 12 ), testJd ); -- while ( jd > testJd ) { -- year++; -- dateToJulianDay( year, 12, d->daysInMonth( year, 12 ), testJd ); -- } -- -- // Search forward month by month from Muharram -- month = 1; -- dateToJulianDay( year, month, d->daysInMonth( year, month ), testJd ); -- while ( jd > testJd ) { -- month++; -- dateToJulianDay( year, month, d->daysInMonth( year, month ), testJd ); -- } -- -- dateToJulianDay( year, month, 1, testJd ); -- day = jd - testJd + 1; -- -- return true; -- -- // Alternative implementations -- -- // More recent editions of "Calendrical Calculations" by Dershowitz & Reingold have a more -- // efficient direct calculation without recusrion, but this cannot be used due to licensing -- -- /* -- Formula from "Explanatory Supplement to the Astronomical Almanac" 2006, derived from Fliegel & Van Flandern 1968 -- int L = jd - epoch().toJulianDay() + 10632; -- int N = ( L - 1 ) / 10631; -- L = L - 10631 * N + 354; -- int J = ( ( 10985 - L ) / 5316 ) x ( ( 50* L ) / 17719 ) + ( L / 5670 ) * ( ( 43 * L ) / 15238 ); -- L = L - ( ( 30 - J ) / 15 ) * ( ( 17719 * J ) / 50 ) - ( J / 16 ) * ( ( 15238 * J ) / 43 ) + 29; -- year = ( 30 * N ) + J - 30; -- month = ( 24 * L ) / 709; -- day = L - ( ( 709 * month ) / 24 ); -- */ -- -- /* -- Formula from Fourmilab website -- jd = Math.floor(jd) + 0.5; -- year = Math.floor(((30 * (jd - epoch().toJulianDay())) + 10646) / 10631); -- month = qMin(12, Math.ceil((jd - (29 + islamic_to_jd(year, 1, 1))) / 29.5) + 1); -- day = (jd - islamic_to_jd(year, month, 1)) + 1; -- */ --} -- --bool KCalendarSystemHijri::dateToJulianDay( int year, int month, int day, int &jd ) const --{ -- /* -- The following C++ code is translated from the Lisp code -- in ``Calendrical Calculations'' by Nachum Dershowitz and -- Edward M. Reingold, Software---Practice & Experience, -- vol. 20, no. 9 (September, 1990), pp. 899--928. -- -- This code is in the public domain, but any use of it -- should publically acknowledge its source. -- */ -- -- jd = epoch().toJulianDay() - 1 + // days before start of calendar -- ( year - 1 ) * 354 + // non-leap days in prior years -- ( 3 + ( 11 * year ) ) / 30 + // leap days in prior years -- 29 * ( month - 1 ) + // days so far... -- month / 2 + // ...this year -- day; // days so far this month -- -- return true; -- -- // Alternative implementations -- -- /* -- Formula from "Explanatory Supplement to the Astronomical Almanac" 2006, derived from Fliegel & Van Flandern 1968 -- jd = ( 3 + ( 11 * year ) ) / 30 + 354 * year + 30 * month - ( month - 1 ) / 2 + day + epoch().toJulianDay() - 385; -- */ --} -diff --git a/kdecore/date/kcalendarsystemhijri_p.h b/kdecore/date/kcalendarsystemhijri_p.h -deleted file mode 100644 -index 8204683..0000000 ---- a/kdecore/date/kcalendarsystemhijri_p.h -+++ /dev/null -@@ -1,124 +0,0 @@ --/* -- Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> -- Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> -- Copyright 2007, 2010 John Layt <john@layt.net> -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with this library; see the file COPYING.LIB. If not, write to -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- Boston, MA 02110-1301, USA. --*/ -- --#ifndef KCALENDARSYSTEMHIJRI_H --#define KCALENDARSYSTEMHIJRI_H -- --#include "kcalendarsystem.h" -- --class KCalendarSystemHijriPrivate; -- --/** -- * @internal -- * This is the Hijri calendar implementation. -- * -- * The Hijri calendar is the traditional Islamic calendar used in the Middle -- * East. -- * -- * @b license GNU-LGPL v2+ -- * -- * @see KLocale,KCalendarSystem -- * -- * @author Carlos Moro <cfmoro@correo.uniovi.es> -- */ --class KCalendarSystemHijri : public KCalendarSystem --{ --public: -- explicit KCalendarSystemHijri( const KLocale *locale = 0 ); -- explicit KCalendarSystemHijri( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -- virtual ~KCalendarSystemHijri(); -- -- virtual QString calendarType() const; -- -- virtual QDate epoch() const; -- virtual QDate earliestValidDate() const; -- virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -- -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -- -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -- -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -- -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -- -- virtual bool isLunar() const; -- virtual bool isLunisolar() const; -- virtual bool isSolar() const; -- virtual bool isProleptic() const; -- --protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemHijri( KCalendarSystemHijriPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -- --private: -- Q_DECLARE_PRIVATE( KCalendarSystemHijri ) -- KCalendarSystemHijriPrivate * const dont_use; // KDE5 remove, use shared d --}; -- --#endif // KCALENDARSYSTEMHIJRI_H -diff --git a/kdecore/date/kcalendarsystemindiannational.cpp b/kdecore/date/kcalendarsystemindiannational.cpp -index 2bd3643..f5b79f2 100644 ---- a/kdecore/date/kcalendarsystemindiannational.cpp -+++ b/kdecore/date/kcalendarsystemindiannational.cpp -@@ -29,32 +29,32 @@ - class KCalendarSystemIndianNationalPrivate : public KCalendarSystemPrivate - { - public: -- explicit KCalendarSystemIndianNationalPrivate( KCalendarSystemIndianNational *q ); -+ explicit KCalendarSystemIndianNationalPrivate(KCalendarSystemIndianNational *q); - - virtual ~KCalendarSystemIndianNationalPrivate(); - - // Virtual methods each calendar system must re-implement - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual int monthsInYear( int year ) const; -- virtual int daysInMonth( int year, int month ) const; -- virtual int daysInYear( int year ) const; -+ 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 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; -- virtual QString monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const; -- virtual QString weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) 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 - --KCalendarSystemIndianNationalPrivate::KCalendarSystemIndianNationalPrivate( KCalendarSystemIndianNational *q ) -- :KCalendarSystemPrivate( q ) -+KCalendarSystemIndianNationalPrivate::KCalendarSystemIndianNationalPrivate(KCalendarSystemIndianNational *q) -+ : KCalendarSystemPrivate(q) - { - } - -@@ -71,38 +71,38 @@ void KCalendarSystemIndianNationalPrivate::loadDefaultEraList() - { - QString name, shortName, format; - // Saka Era -- name = i18nc( "Calendar Era: Indian National Saka Era, years > 0, LongFormat", "Saka Era" ); -- shortName = i18nc( "Calendar Era: Indian National Saka Era, years > 0, ShortFormat", "SE" ); -- format = i18nc( "(kdedt-format) Indian National, SE, full era year format used for %EY, e.g. 2000 SE", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Indian National Saka Era, years > 0, LongFormat", "Saka Era"); -+ shortName = i18nc("Calendar Era: Indian National Saka Era, years > 0, ShortFormat", "SE"); -+ format = i18nc("(kdedt-format) Indian National, SE, full era year format used for %EY, e.g. 2000 SE", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --int KCalendarSystemIndianNationalPrivate::monthsInYear( int year ) const -+int KCalendarSystemIndianNationalPrivate::monthsInYear(int year) const - { -- Q_UNUSED( year ) -+ Q_UNUSED(year) - return 12; - } - --int KCalendarSystemIndianNationalPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemIndianNationalPrivate::daysInMonth(int year, int month) const - { -- if ( month == 1 ) { -- if ( isLeapYear( year ) ) { -+ if (month == 1) { -+ if (isLeapYear(year)) { - return 31; - } else { - return 30; - } - } - -- if ( month >= 2 && month <= 6 ) { -+ if (month >= 2 && month <= 6) { - return 31; - } - - return 30; - } - --int KCalendarSystemIndianNationalPrivate::daysInYear( int year ) const -+int KCalendarSystemIndianNationalPrivate::daysInYear(int year) const - { -- if ( isLeapYear( year ) ) { -+ if (isLeapYear(year)) { - return 366; - } else { - return 365; -@@ -114,19 +114,19 @@ int KCalendarSystemIndianNationalPrivate::daysInWeek() const - return 7; - } - --bool KCalendarSystemIndianNationalPrivate::isLeapYear( int year ) const -+bool KCalendarSystemIndianNationalPrivate::isLeapYear(int year) const - { - //Uses same rule as Gregorian, and is explicitly synchronized to Gregorian - //so add 78 years to get Gregorian year and apply Gregorian calculation - year = year + 78; -- if ( !hasYearZero() && year < 1 ) { -+ if (!hasYearZero() && year < 1) { - year = year + 1; - } - -- if ( year % 4 == 0 ) { -- if ( year % 100 != 0 ) { -+ if (year % 4 == 0) { -+ if (year % 100 != 0) { - return true; -- } else if ( year % 400 == 0 ) { -+ } else if (year % 400 == 0) { - return true; - } - } -@@ -164,267 +164,263 @@ int KCalendarSystemIndianNationalPrivate::latestValidYear() const - return 9999; - } - --QString KCalendarSystemIndianNationalPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemIndianNationalPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( year ); -+ Q_UNUSED(year); - -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -+ if (format == KLocale::NarrowName) { -+ switch (month) { - case 1: -- return ki18nc( "Indian National month 1 - KLocale::NarrowName", "C" ).toString( locale() ); -+ return ki18nc("Indian National month 1 - KLocale::NarrowName", "C").toString(locale()); - case 2: -- return ki18nc( "Indian National month 2 - KLocale::NarrowName", "V" ).toString( locale() ); -+ return ki18nc("Indian National month 2 - KLocale::NarrowName", "V").toString(locale()); - case 3: -- return ki18nc( "Indian National month 3 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Indian National month 3 - KLocale::NarrowName", "J").toString(locale()); - case 4: -- return ki18nc( "Indian National month 4 - KLocale::NarrowName", "Ā" ).toString( locale() ); -+ return ki18nc("Indian National month 4 - KLocale::NarrowName", "Ā").toString(locale()); - case 5: -- return ki18nc( "Indian National month 5 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Indian National month 5 - KLocale::NarrowName", "S").toString(locale()); - case 6: -- return ki18nc( "Indian National month 6 - KLocale::NarrowName", "B" ).toString( locale() ); -+ return ki18nc("Indian National month 6 - KLocale::NarrowName", "B").toString(locale()); - case 7: -- return ki18nc( "Indian National month 7 - KLocale::NarrowName", "Ā" ).toString( locale() ); -+ return ki18nc("Indian National month 7 - KLocale::NarrowName", "Ā").toString(locale()); - case 8: -- return ki18nc( "Indian National month 8 - KLocale::NarrowName", "K" ).toString( locale() ); -+ return ki18nc("Indian National month 8 - KLocale::NarrowName", "K").toString(locale()); - case 9: -- return ki18nc( "Indian National month 9 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Indian National month 9 - KLocale::NarrowName", "A").toString(locale()); - case 10: -- return ki18nc( "Indian National month 10 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Indian National month 10 - KLocale::NarrowName", "P").toString(locale()); - case 11: -- return ki18nc( "Indian National month 11 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Indian National month 11 - KLocale::NarrowName", "M").toString(locale()); - case 12: -- return ki18nc( "Indian National month 12 - KLocale::NarrowName", "P" ).toString( locale() ); -+ return ki18nc("Indian National month 12 - KLocale::NarrowName", "P").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Indian National month 1 - KLocale::ShortName Possessive", "of Cha" ).toString( locale() ); -+ return ki18nc("Indian National month 1 - KLocale::ShortName Possessive", "of Cha").toString(locale()); - case 2: -- return ki18nc( "Indian National month 2 - KLocale::ShortName Possessive", "of Vai" ).toString( locale() ); -+ return ki18nc("Indian National month 2 - KLocale::ShortName Possessive", "of Vai").toString(locale()); - case 3: -- return ki18nc( "Indian National month 3 - KLocale::ShortName Possessive", "of Jya" ).toString( locale() ); -+ return ki18nc("Indian National month 3 - KLocale::ShortName Possessive", "of Jya").toString(locale()); - case 4: -- return ki18nc( "Indian National month 4 - KLocale::ShortName Possessive", "of Āsh" ).toString( locale() ); -+ return ki18nc("Indian National month 4 - KLocale::ShortName Possessive", "of Āsh").toString(locale()); - case 5: -- return ki18nc( "Indian National month 5 - KLocale::ShortName Possessive", "of Shr" ).toString( locale() ); -+ return ki18nc("Indian National month 5 - KLocale::ShortName Possessive", "of Shr").toString(locale()); - case 6: -- return ki18nc( "Indian National month 6 - KLocale::ShortName Possessive", "of Bhā" ).toString( locale() ); -+ return ki18nc("Indian National month 6 - KLocale::ShortName Possessive", "of Bhā").toString(locale()); - case 7: -- return ki18nc( "Indian National month 7 - KLocale::ShortName Possessive", "of Āsw" ).toString( locale() ); -+ return ki18nc("Indian National month 7 - KLocale::ShortName Possessive", "of Āsw").toString(locale()); - case 8: -- return ki18nc( "Indian National month 8 - KLocale::ShortName Possessive", "of Kār" ).toString( locale() ); -+ return ki18nc("Indian National month 8 - KLocale::ShortName Possessive", "of Kār").toString(locale()); - case 9: -- return ki18nc( "Indian National month 9 - KLocale::ShortName Possessive", "of Agr" ).toString( locale() ); -+ return ki18nc("Indian National month 9 - KLocale::ShortName Possessive", "of Agr").toString(locale()); - case 10: -- return ki18nc( "Indian National month 10 - KLocale::ShortName Possessive", "of Pau" ).toString( locale() ); -+ return ki18nc("Indian National month 10 - KLocale::ShortName Possessive", "of Pau").toString(locale()); - case 11: -- return ki18nc( "Indian National month 11 - KLocale::ShortName Possessive", "of Māg" ).toString( locale() ); -+ return ki18nc("Indian National month 11 - KLocale::ShortName Possessive", "of Māg").toString(locale()); - case 12: -- return ki18nc( "Indian National month 12 - KLocale::ShortName Possessive", "of Phā" ).toString( locale() ); -+ return ki18nc("Indian National month 12 - KLocale::ShortName Possessive", "of Phā").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Indian National month 1 - KLocale::ShortName", "Cha" ).toString( locale() ); -+ return ki18nc("Indian National month 1 - KLocale::ShortName", "Cha").toString(locale()); - case 2: -- return ki18nc( "Indian National month 2 - KLocale::ShortName", "Vai" ).toString( locale() ); -+ return ki18nc("Indian National month 2 - KLocale::ShortName", "Vai").toString(locale()); - case 3: -- return ki18nc( "Indian National month 3 - KLocale::ShortName", "Jya" ).toString( locale() ); -+ return ki18nc("Indian National month 3 - KLocale::ShortName", "Jya").toString(locale()); - case 4: -- return ki18nc( "Indian National month 4 - KLocale::ShortName", "Āsh" ).toString( locale() ); -+ return ki18nc("Indian National month 4 - KLocale::ShortName", "Āsh").toString(locale()); - case 5: -- return ki18nc( "Indian National month 5 - KLocale::ShortName", "Shr" ).toString( locale() ); -+ return ki18nc("Indian National month 5 - KLocale::ShortName", "Shr").toString(locale()); - case 6: -- return ki18nc( "Indian National month 6 - KLocale::ShortName", "Bhā" ).toString( locale() ); -+ return ki18nc("Indian National month 6 - KLocale::ShortName", "Bhā").toString(locale()); - case 7: -- return ki18nc( "Indian National month 7 - KLocale::ShortName", "Āsw" ).toString( locale() ); -+ return ki18nc("Indian National month 7 - KLocale::ShortName", "Āsw").toString(locale()); - case 8: -- return ki18nc( "Indian National month 8 - KLocale::ShortName", "Kār" ).toString( locale() ); -+ return ki18nc("Indian National month 8 - KLocale::ShortName", "Kār").toString(locale()); - case 9: -- return ki18nc( "Indian National month 9 - KLocale::ShortName", "Agr" ).toString( locale() ); -+ return ki18nc("Indian National month 9 - KLocale::ShortName", "Agr").toString(locale()); - case 10: -- return ki18nc( "Indian National month 10 - KLocale::ShortName", "Pau" ).toString( locale() ); -+ return ki18nc("Indian National month 10 - KLocale::ShortName", "Pau").toString(locale()); - case 11: -- return ki18nc( "Indian National month 11 - KLocale::ShortName", "Māg" ).toString( locale() ); -+ return ki18nc("Indian National month 11 - KLocale::ShortName", "Māg").toString(locale()); - case 12: -- return ki18nc( "Indian National month 12 - KLocale::ShortName", "Phā" ).toString( locale() ); -+ return ki18nc("Indian National month 12 - KLocale::ShortName", "Phā").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Indian National month 1 - KLocale::LongName Possessive", "of Chaitra" ).toString( locale() ); -+ return ki18nc("Indian National month 1 - KLocale::LongName Possessive", "of Chaitra").toString(locale()); - case 2: -- return ki18nc( "Indian National month 2 - KLocale::LongName Possessive", "of Vaishākh" ).toString( locale() ); -+ return ki18nc("Indian National month 2 - KLocale::LongName Possessive", "of Vaishākh").toString(locale()); - case 3: -- return ki18nc( "Indian National month 3 - KLocale::LongName Possessive", "of Jyaishtha" ).toString( locale() ); -+ return ki18nc("Indian National month 3 - KLocale::LongName Possessive", "of Jyaishtha").toString(locale()); - case 4: -- return ki18nc( "Indian National month 4 - KLocale::LongName Possessive", "of Āshādha" ).toString( locale() ); -+ return ki18nc("Indian National month 4 - KLocale::LongName Possessive", "of Āshādha").toString(locale()); - case 5: -- return ki18nc( "Indian National month 5 - KLocale::LongName Possessive", "of Shrāvana" ).toString( locale() ); -+ return ki18nc("Indian National month 5 - KLocale::LongName Possessive", "of Shrāvana").toString(locale()); - case 6: -- return ki18nc( "Indian National month 6 - KLocale::LongName Possessive", "of Bhādrapad" ).toString( locale() ); -+ return ki18nc("Indian National month 6 - KLocale::LongName Possessive", "of Bhādrapad").toString(locale()); - case 7: -- return ki18nc( "Indian National month 7 - KLocale::LongName Possessive", "of Āshwin" ).toString( locale() ); -+ return ki18nc("Indian National month 7 - KLocale::LongName Possessive", "of Āshwin").toString(locale()); - case 8: -- return ki18nc( "Indian National month 8 - KLocale::LongName Possessive", "of Kārtik" ).toString( locale() ); -+ return ki18nc("Indian National month 8 - KLocale::LongName Possessive", "of Kārtik").toString(locale()); - case 9: -- return ki18nc( "Indian National month 9 - KLocale::LongName Possessive", "of Agrahayana" ).toString( locale() ); -+ return ki18nc("Indian National month 9 - KLocale::LongName Possessive", "of Agrahayana").toString(locale()); - case 10: -- return ki18nc( "Indian National month 10 - KLocale::LongName Possessive", "of Paush" ).toString( locale() ); -+ return ki18nc("Indian National month 10 - KLocale::LongName Possessive", "of Paush").toString(locale()); - case 11: -- return ki18nc( "Indian National month 11 - KLocale::LongName Possessive", "of Māgh" ).toString( locale() ); -+ return ki18nc("Indian National month 11 - KLocale::LongName Possessive", "of Māgh").toString(locale()); - case 12: -- return ki18nc( "Indian National month 12 - KLocale::LongName Possessive", "of Phālgun" ).toString( locale() ); -+ return ki18nc("Indian National month 12 - KLocale::LongName Possessive", "of Phālgun").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( month ) { -+ switch (month) { - case 1: -- return ki18nc( "Indian National month 1 - KLocale::LongName", "Chaitra" ).toString( locale() ); -+ return ki18nc("Indian National month 1 - KLocale::LongName", "Chaitra").toString(locale()); - case 2: -- return ki18nc( "Indian National month 2 - KLocale::LongName", "Vaishākh" ).toString( locale() ); -+ return ki18nc("Indian National month 2 - KLocale::LongName", "Vaishākh").toString(locale()); - case 3: -- return ki18nc( "Indian National month 3 - KLocale::LongName", "Jyaishtha" ).toString( locale() ); -+ return ki18nc("Indian National month 3 - KLocale::LongName", "Jyaishtha").toString(locale()); - case 4: -- return ki18nc( "Indian National month 4 - KLocale::LongName", "Āshādha" ).toString( locale() ); -+ return ki18nc("Indian National month 4 - KLocale::LongName", "Āshādha").toString(locale()); - case 5: -- return ki18nc( "Indian National month 5 - KLocale::LongName", "Shrāvana" ).toString( locale() ); -+ return ki18nc("Indian National month 5 - KLocale::LongName", "Shrāvana").toString(locale()); - case 6: -- return ki18nc( "Indian National month 6 - KLocale::LongName", "Bhādrapad" ).toString( locale() ); -+ return ki18nc("Indian National month 6 - KLocale::LongName", "Bhādrapad").toString(locale()); - case 7: -- return ki18nc( "Indian National month 7 - KLocale::LongName", "Āshwin" ).toString( locale() ); -+ return ki18nc("Indian National month 7 - KLocale::LongName", "Āshwin").toString(locale()); - case 8: -- return ki18nc( "Indian National month 8 - KLocale::LongName", "Kārtik" ).toString( locale() ); -+ return ki18nc("Indian National month 8 - KLocale::LongName", "Kārtik").toString(locale()); - case 9: -- return ki18nc( "Indian National month 9 - KLocale::LongName", "Agrahayana" ).toString( locale() ); -+ return ki18nc("Indian National month 9 - KLocale::LongName", "Agrahayana").toString(locale()); - case 10: -- return ki18nc( "Indian National month 10 - KLocale::LongName", "Paush" ).toString( locale() ); -+ return ki18nc("Indian National month 10 - KLocale::LongName", "Paush").toString(locale()); - case 11: -- return ki18nc( "Indian National month 11 - KLocale::LongName", "Māgh" ).toString( locale() ); -+ return ki18nc("Indian National month 11 - KLocale::LongName", "Māgh").toString(locale()); - case 12: -- return ki18nc( "Indian National month 12 - KLocale::LongName", "Phālgun" ).toString( locale() ); -+ return ki18nc("Indian National month 12 - KLocale::LongName", "Phālgun").toString(locale()); - default: - return QString(); - } - } - --QString KCalendarSystemIndianNationalPrivate::weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const -+QString KCalendarSystemIndianNationalPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Indian National weekday 1 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Indian National weekday 1 - KLocale::NarrowName ", "S").toString(locale()); - case 2: -- return ki18nc( "Indian National weekday 2 - KLocale::NarrowName ", "M" ).toString( locale() ); -+ return ki18nc("Indian National weekday 2 - KLocale::NarrowName ", "M").toString(locale()); - case 3: -- return ki18nc( "Indian National weekday 3 - KLocale::NarrowName ", "B" ).toString( locale() ); -+ return ki18nc("Indian National weekday 3 - KLocale::NarrowName ", "B").toString(locale()); - case 4: -- return ki18nc( "Indian National weekday 4 - KLocale::NarrowName ", "G" ).toString( locale() ); -+ return ki18nc("Indian National weekday 4 - KLocale::NarrowName ", "G").toString(locale()); - case 5: -- return ki18nc( "Indian National weekday 5 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Indian National weekday 5 - KLocale::NarrowName ", "S").toString(locale()); - case 6: -- return ki18nc( "Indian National weekday 6 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Indian National weekday 6 - KLocale::NarrowName ", "S").toString(locale()); - case 7: -- return ki18nc( "Indian National weekday 7 - KLocale::NarrowName ", "R" ).toString( locale() ); -+ return ki18nc("Indian National weekday 7 - KLocale::NarrowName ", "R").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Indian National weekday 1 - KLocale::ShortName", "Som" ).toString( locale() ); -+ return ki18nc("Indian National weekday 1 - KLocale::ShortName", "Som").toString(locale()); - case 2: -- return ki18nc( "Indian National weekday 2 - KLocale::ShortName", "Mañ" ).toString( locale() ); -+ return ki18nc("Indian National weekday 2 - KLocale::ShortName", "Mañ").toString(locale()); - case 3: -- return ki18nc( "Indian National weekday 3 - KLocale::ShortName", "Bud" ).toString( locale() ); -+ return ki18nc("Indian National weekday 3 - KLocale::ShortName", "Bud").toString(locale()); - case 4: -- return ki18nc( "Indian National weekday 4 - KLocale::ShortName", "Gur" ).toString( locale() ); -+ return ki18nc("Indian National weekday 4 - KLocale::ShortName", "Gur").toString(locale()); - case 5: -- return ki18nc( "Indian National weekday 5 - KLocale::ShortName", "Suk" ).toString( locale() ); -+ return ki18nc("Indian National weekday 5 - KLocale::ShortName", "Suk").toString(locale()); - case 6: -- return ki18nc( "Indian National weekday 6 - KLocale::ShortName", "San" ).toString( locale() ); -+ return ki18nc("Indian National weekday 6 - KLocale::ShortName", "San").toString(locale()); - case 7: -- return ki18nc( "Indian National weekday 7 - KLocale::ShortName", "Rav" ).toString( locale() ); -+ return ki18nc("Indian National weekday 7 - KLocale::ShortName", "Rav").toString(locale()); - default: return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Indian National weekday 1 - KLocale::LongName", "Somavãra" ).toString( locale() ); -+ 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() ); -+ 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() ); -+ 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() ); -+ 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() ); -+ 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() ); -+ 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() ); -+ return ki18nc("Indian National weekday 7 - KLocale::LongName", "Raviãra").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemIndianNational::KCalendarSystemIndianNational( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemIndianNationalPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemIndianNational::KCalendarSystemIndianNational(const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemIndianNationalPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemIndianNational::KCalendarSystemIndianNational( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemIndianNationalPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemIndianNational::KCalendarSystemIndianNational(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemIndianNationalPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemIndianNational::KCalendarSystemIndianNational( KCalendarSystemIndianNationalPrivate &dd, -- const KSharedConfig::Ptr config, -- const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemIndianNational::KCalendarSystemIndianNational(KCalendarSystemIndianNationalPrivate &dd, -+ const KSharedConfig::Ptr config, -+ const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemIndianNational::~KCalendarSystemIndianNational() - { -- delete dont_use; - } - - QString KCalendarSystemIndianNational::calendarType() const - { -- return QLatin1String( "indian-national" ); -+ return QLatin1String("indian-national"); - } - - QDate KCalendarSystemIndianNational::epoch() const - { - //0000-01-01, has Year 0. - //0078-03-22 AD Gregorian / 0078-03-24 AD Julian -- return QDate::fromJulianDay( 1749994 ); -+ return QDate::fromJulianDay(1749994); - } - - QDate KCalendarSystemIndianNational::earliestValidDate() const -@@ -432,7 +428,7 @@ QDate KCalendarSystemIndianNational::earliestValidDate() const - //0000-01-01, has Year 0. - //0078-03-22 AD Gregorian / 0078-03-24 AD Julian - //Don't do proleptic yet, need to check -- return QDate::fromJulianDay( 1749630 ); -+ return QDate::fromJulianDay(1749630); - } - - QDate KCalendarSystemIndianNational::latestValidDate() const -@@ -440,188 +436,47 @@ QDate KCalendarSystemIndianNational::latestValidDate() const - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - //9999-12-30 - //10078-03-21 AD Gregorian -- return QDate::fromJulianDay( 5402054 ); -+ return QDate::fromJulianDay(5402054); - } - --bool KCalendarSystemIndianNational::isValid( int year, int month, int day ) const -+bool KCalendarSystemIndianNational::isValid(int year, int month, int day) const - { -- return KCalendarSystem::isValid( year, month, day ); -+ return KCalendarSystem::isValid(year, month, day); - } - --bool KCalendarSystemIndianNational::isValid( const QDate &date ) const -+bool KCalendarSystemIndianNational::isValid(const QDate &date) const - { -- return KCalendarSystem::isValid( date ); -+ return KCalendarSystem::isValid(date); - } - --bool KCalendarSystemIndianNational::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemIndianNational::isLeapYear(int year) const - { -- return KCalendarSystem::setDate( date, year, month, day ); -+ return KCalendarSystem::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemIndianNational::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemIndianNational::isLeapYear(const QDate &date) const - { -- return KCalendarSystem::setDate( date, y, m, d ); -+ return KCalendarSystem::isLeapYear(date); - } - --int KCalendarSystemIndianNational::year( const QDate &date ) const -+QString KCalendarSystemIndianNational::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystem::year( date ); -+ return KCalendarSystem::monthName(month, year, format); - } - --int KCalendarSystemIndianNational::month( const QDate &date ) const -+QString KCalendarSystemIndianNational::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystem::month( date ); -+ return KCalendarSystem::monthName(date, format); - } - --int KCalendarSystemIndianNational::day( const QDate &date ) const -+QString KCalendarSystemIndianNational::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystem::day( date ); -+ return KCalendarSystem::weekDayName(weekDay, format); - } - --QDate KCalendarSystemIndianNational::addYears( const QDate &date, int nyears ) const -+QString KCalendarSystemIndianNational::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemIndianNational::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemIndianNational::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemIndianNational::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemIndianNational::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemIndianNational::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemIndianNational::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemIndianNational::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemIndianNational::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemIndianNational::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemIndianNational::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystem::dayOfWeek( date ); --} -- --int KCalendarSystemIndianNational::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemIndianNational::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemIndianNational::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemIndianNational::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemIndianNational::monthName( const QDate &date, MonthNameFormat format ) const --{ -- 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 ); --} -- --QString KCalendarSystemIndianNational::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemIndianNational::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemIndianNational::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemIndianNational::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemIndianNational::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemIndianNational::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemIndianNational::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemIndianNational::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemIndianNational::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemIndianNational::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- --int KCalendarSystemIndianNational::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); -+ return KCalendarSystem::weekDayName(date, format); - } - - int KCalendarSystemIndianNational::weekDayOfPray() const -@@ -649,22 +504,22 @@ bool KCalendarSystemIndianNational::isProleptic() const - return false; - } - --bool KCalendarSystemIndianNational::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemIndianNational::julianDayToDate(int jd, int &year, int &month, int &day) const - { - int L, N, I, J, D, M, Y; - - // "Explanatory Supplement to the Astronomical Almanac" 2006 section 12.94 pp 605-606 - // Originally from "Report of the Calendar Reform Committee" 1955 - L = jd + 68518; -- N = ( 4 * L ) / 146097; -- L = L - ( 146097 * N + 3 ) / 4; -- I = ( 4000 * ( L + 1 ) ) / 1461001; -- L = L - ( 1461 * I ) / 4 + 1; -- J = ( ( L - 1 ) / 31 ) * ( 1 - L / 185 ) + ( L / 185 ) * ( ( L - 156 ) / 30 + 5 ) - L / 366; -- D = L - 31 * J + ( ( J + 2 ) / 8 ) * ( J - 5 ); -+ N = (4 * L) / 146097; -+ L = L - (146097 * N + 3) / 4; -+ I = (4000 * (L + 1)) / 1461001; -+ L = L - (1461 * I) / 4 + 1; -+ J = ((L - 1) / 31) * (1 - L / 185) + (L / 185) * ((L - 156) / 30 + 5) - L / 366; -+ D = L - 31 * J + ((J + 2) / 8) * (J - 5); - L = J / 11; - M = J + 2 - 12 * L; -- Y = 100 * ( N - 49 ) + L + I - 78; -+ Y = 100 * (N - 49) + L + I - 78; - - day = D; - month = M; -@@ -673,7 +528,7 @@ bool KCalendarSystemIndianNational::julianDayToDate( int jd, int &year, int &mon - return true; - } - --bool KCalendarSystemIndianNational::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemIndianNational::dateToJulianDay(int year, int month, int day, int &jd) const - { - int Y = year; - int M = month; -@@ -682,11 +537,11 @@ bool KCalendarSystemIndianNational::dateToJulianDay( int year, int month, int da - // "Explanatory Supplement to the Astronomical Almanac" 2006 section 12.94 pp 605-606 - // Originally from "Report of the Calendar Reform Committee" 1955 - jd = 365 * Y -- + ( Y + 78 - 1 / M ) / 4 -+ + (Y + 78 - 1 / M) / 4 - + 31 * M -- - ( M + 9 ) / 11 -- - ( M / 7 ) * ( M - 7 ) -- - ( 3 * ( ( Y + 78 - 1 / M ) / 100 + 1 ) ) / 4 -+ - (M + 9) / 11 -+ - (M / 7) * (M - 7) -+ - (3 * ((Y + 78 - 1 / M) / 100 + 1)) / 4 - + D - + 1749579; - -diff --git a/kdecore/date/kcalendarsystemindiannational_p.h b/kdecore/date/kcalendarsystemindiannational_p.h -index 7399a39..0e8e036 100644 ---- a/kdecore/date/kcalendarsystemindiannational_p.h -+++ b/kdecore/date/kcalendarsystemindiannational_p.h -@@ -41,8 +41,8 @@ class KCalendarSystemIndianNationalPrivate; - class KCalendarSystemIndianNational: public KCalendarSystem - { - public: -- explicit KCalendarSystemIndianNational( const KLocale *locale = 0 ); -- explicit KCalendarSystemIndianNational( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemIndianNational(const KLocale *locale = 0); -+ explicit KCalendarSystemIndianNational(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemIndianNational(); - - virtual QString calendarType() const; -@@ -50,58 +50,19 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -109,15 +70,14 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemIndianNational( KCalendarSystemIndianNationalPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemIndianNational(KCalendarSystemIndianNationalPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: -- Q_DECLARE_PRIVATE( KCalendarSystemIndianNational ) -- KCalendarSystemIndianNationalPrivate * const dont_use; // KDE5 remove, use shared d -+ Q_DECLARE_PRIVATE(KCalendarSystemIndianNational) - }; - - #endif // KCALENDARSYSTEMINDIANNATIONAL_H -diff --git a/kdecore/date/kcalendarsystemislamiccivil.cpp b/kdecore/date/kcalendarsystemislamiccivil.cpp -new file mode 100644 -index 0000000..053ec55 ---- /dev/null -+++ b/kdecore/date/kcalendarsystemislamiccivil.cpp -@@ -0,0 +1,596 @@ -+/* -+ Copyright (c) 2002-2003 Carlos Moro <cfmoro@correo.uniovi.es> -+ Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> -+ Copyright 2007, 2008, 2009, 2010 John Layt <john@layt.net> -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+ -+#include "kcalendarsystemislamiccivil_p.h" -+#include "kcalendarsystemprivate_p.h" -+ -+#include <QtCore/QDate> -+ -+class KCalendarSystemIslamicCivilPrivate : public KCalendarSystemPrivate -+{ -+public: -+ explicit KCalendarSystemIslamicCivilPrivate(KCalendarSystemIslamicCivil *q); -+ -+ virtual ~KCalendarSystemIslamicCivilPrivate(); -+ -+ // Virtual methods each calendar system must re-implement -+ virtual KLocale::CalendarSystem calendarSystem() const; -+ virtual void loadDefaultEraList(); -+ 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; -+ 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 -+ -+KCalendarSystemIslamicCivilPrivate::KCalendarSystemIslamicCivilPrivate(KCalendarSystemIslamicCivil *q) -+ : KCalendarSystemPrivate(q) -+{ -+} -+ -+KCalendarSystemIslamicCivilPrivate::~KCalendarSystemIslamicCivilPrivate() -+{ -+} -+ -+KLocale::CalendarSystem KCalendarSystemIslamicCivilPrivate::calendarSystem() const -+{ -+ return KLocale::IslamicCivilCalendar; -+} -+ -+void KCalendarSystemIslamicCivilPrivate::loadDefaultEraList() -+{ -+ QString name, shortName, format; -+ // Islamic Era, Anno Hegirae, "Year of the Hijra". -+ name = i18nc("Calendar Era: Hijri Islamic Era, years > 0, LongFormat", "Anno Hegirae"); -+ shortName = i18nc("Calendar Era: Hijri Islamic Era, years > 0, ShortFormat", "AH"); -+ format = i18nc("(kdedt-format) Hijri, AH, full era year format used for %EY, e.g. 2000 AH", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); -+} -+ -+int KCalendarSystemIslamicCivilPrivate::monthsInYear(int year) const -+{ -+ Q_UNUSED(year) -+ return 12; -+} -+ -+int KCalendarSystemIslamicCivilPrivate::daysInMonth(int year, int month) const -+{ -+ if (month == 12 && isLeapYear(year)) { -+ return 30; -+ } -+ -+ if (month % 2 == 0) { // Even number months have 29 days -+ return 29; -+ } else { // Odd number months have 30 days -+ return 30; -+ } -+} -+ -+int KCalendarSystemIslamicCivilPrivate::daysInYear(int year) const -+{ -+ if (isLeapYear(year)) { -+ return 355; -+ } else { -+ return 354; -+ } -+} -+ -+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 -+ -+ /* -+ The following C++ code is translated from the Lisp code -+ in ``Calendrical Calculations'' by Nachum Dershowitz and -+ Edward M. Reingold, Software---Practice & Experience, -+ vol. 20, no. 9 (September, 1990), pp. 899--928. -+ -+ This code is in the public domain, but any use of it -+ should publically acknowledge its source. -+ */ -+ -+ if ((((11 * year) + 14) % 30) < 11) { -+ return true; -+ } else { -+ return false; -+ } -+ -+ // The following variations will be implemented in separate classes in 4.5 -+ // May be cleaner to formally define using a case statement switch on (year % 30) -+ -+ // Variation used by Bar Habraeus / Graves / Birashk / Some Microsoft products -+ // Years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26, 29 of the 30 year cycle -+ // if ( ( ( ( 11 * year ) + 15 ) % 30 ) < 11 ) { -+ -+ // Variation used by Bohras / Sahifa with epoch 15 July 622 jd = 1948440 -+ // Years 2, 5, 8, 10, 13, 16, 19, 21, 24, 27, 29 of the 30 year cycle -+ // if ( ( ( ( 11 * year ) + 1 ) % 30 ) < 11 ) { -+} -+ -+bool KCalendarSystemIslamicCivilPrivate::hasLeapMonths() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemIslamicCivilPrivate::hasYearZero() const -+{ -+ return false; -+} -+ -+int KCalendarSystemIslamicCivilPrivate::maxDaysInWeek() const -+{ -+ return 7; -+} -+ -+int KCalendarSystemIslamicCivilPrivate::maxMonthsInYear() const -+{ -+ return 12; -+} -+ -+int KCalendarSystemIslamicCivilPrivate::earliestValidYear() const -+{ -+ return 1; -+} -+ -+int KCalendarSystemIslamicCivilPrivate::latestValidYear() const -+{ -+ return 9999; -+} -+ -+QString KCalendarSystemIslamicCivilPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const -+{ -+ Q_UNUSED(year); -+ -+ if (format == KLocale::NarrowName) { -+ switch (month) { -+ case 1: -+ return ki18nc("Hijri month 1 - KLocale::NarrowName", "M").toString(locale()); -+ case 2: -+ return ki18nc("Hijri month 2 - KLocale::NarrowName", "S").toString(locale()); -+ case 3: -+ return ki18nc("Hijri month 3 - KLocale::NarrowName", "A").toString(locale()); -+ case 4: -+ return ki18nc("Hijri month 4 - KLocale::NarrowName", "T").toString(locale()); -+ case 5: -+ return ki18nc("Hijri month 5 - KLocale::NarrowName", "A").toString(locale()); -+ case 6: -+ return ki18nc("Hijri month 6 - KLocale::NarrowName", "T").toString(locale()); -+ case 7: -+ return ki18nc("Hijri month 7 - KLocale::NarrowName", "R").toString(locale()); -+ case 8: -+ return ki18nc("Hijri month 8 - KLocale::NarrowName", "S").toString(locale()); -+ case 9: -+ return ki18nc("Hijri month 9 - KLocale::NarrowName", "R").toString(locale()); -+ case 10: -+ return ki18nc("Hijri month 10 - KLocale::NarrowName", "S").toString(locale()); -+ case 11: -+ return ki18nc("Hijri month 11 - KLocale::NarrowName", "Q").toString(locale()); -+ case 12: -+ return ki18nc("Hijri month 12 - KLocale::NarrowName", "H").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { -+ case 1: -+ return ki18nc("Hijri month 1 - KLocale::ShortName Possessive", "of Muh").toString(locale()); -+ case 2: -+ return ki18nc("Hijri month 2 - KLocale::ShortName Possessive", "of Saf").toString(locale()); -+ case 3: -+ return ki18nc("Hijri month 3 - KLocale::ShortName Possessive", "of R.A").toString(locale()); -+ case 4: -+ return ki18nc("Hijri month 4 - KLocale::ShortName Possessive", "of R.T").toString(locale()); -+ case 5: -+ return ki18nc("Hijri month 5 - KLocale::ShortName Possessive", "of J.A").toString(locale()); -+ case 6: -+ return ki18nc("Hijri month 6 - KLocale::ShortName Possessive", "of J.T").toString(locale()); -+ case 7: -+ return ki18nc("Hijri month 7 - KLocale::ShortName Possessive", "of Raj").toString(locale()); -+ case 8: -+ return ki18nc("Hijri month 8 - KLocale::ShortName Possessive", "of Sha").toString(locale()); -+ case 9: -+ return ki18nc("Hijri month 9 - KLocale::ShortName Possessive", "of Ram").toString(locale()); -+ case 10: -+ return ki18nc("Hijri month 10 - KLocale::ShortName Possessive", "of Shw").toString(locale()); -+ case 11: -+ return ki18nc("Hijri month 11 - KLocale::ShortName Possessive", "of Qid").toString(locale()); -+ case 12: -+ return ki18nc("Hijri month 12 - KLocale::ShortName Possessive", "of Hij").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { -+ case 1: -+ return ki18nc("Hijri month 1 - KLocale::ShortName", "Muh").toString(locale()); -+ case 2: -+ return ki18nc("Hijri month 2 - KLocale::ShortName", "Saf").toString(locale()); -+ case 3: -+ return ki18nc("Hijri month 3 - KLocale::ShortName", "R.A").toString(locale()); -+ case 4: -+ return ki18nc("Hijri month 4 - KLocale::ShortName", "R.T").toString(locale()); -+ case 5: -+ return ki18nc("Hijri month 5 - KLocale::ShortName", "J.A").toString(locale()); -+ case 6: -+ return ki18nc("Hijri month 6 - KLocale::ShortName", "J.T").toString(locale()); -+ case 7: -+ return ki18nc("Hijri month 7 - KLocale::ShortName", "Raj").toString(locale()); -+ case 8: -+ return ki18nc("Hijri month 8 - KLocale::ShortName", "Sha").toString(locale()); -+ case 9: -+ return ki18nc("Hijri month 9 - KLocale::ShortName", "Ram").toString(locale()); -+ case 10: -+ return ki18nc("Hijri month 10 - KLocale::ShortName", "Shw").toString(locale()); -+ case 11: -+ return ki18nc("Hijri month 11 - KLocale::ShortName", "Qid").toString(locale()); -+ case 12: -+ return ki18nc("Hijri month 12 - KLocale::ShortName", "Hij").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { -+ case 1: -+ return ki18nc("Hijri month 1 - KLocale::LongName Possessive", "of Muharram").toString(locale()); -+ case 2: -+ return ki18nc("Hijri month 2 - KLocale::LongName Possessive", "of Safar").toString(locale()); -+ case 3: -+ return ki18nc("Hijri month 3 - KLocale::LongName Possessive", "of Rabi` al-Awal").toString(locale()); -+ case 4: -+ return ki18nc("Hijri month 4 - KLocale::LongName Possessive", "of Rabi` al-Thaani").toString(locale()); -+ case 5: -+ return ki18nc("Hijri month 5 - KLocale::LongName Possessive", "of Jumaada al-Awal").toString(locale()); -+ case 6: -+ return ki18nc("Hijri month 6 - KLocale::LongName Possessive", "of Jumaada al-Thaani").toString(locale()); -+ case 7: -+ return ki18nc("Hijri month 7 - KLocale::LongName Possessive", "of Rajab").toString(locale()); -+ case 8: -+ return ki18nc("Hijri month 8 - KLocale::LongName Possessive", "of Sha`ban").toString(locale()); -+ case 9: -+ return ki18nc("Hijri month 9 - KLocale::LongName Possessive", "of Ramadan").toString(locale()); -+ case 10: -+ return ki18nc("Hijri month 10 - KLocale::LongName Possessive", "of Shawwal").toString(locale()); -+ case 11: -+ return ki18nc("Hijri month 11 - KLocale::LongName Possessive", "of Thu al-Qi`dah").toString(locale()); -+ case 12: -+ return ki18nc("Hijri month 12 - KLocale::LongName Possessive", "of Thu al-Hijjah").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ // Default to LongName -+ switch (month) { -+ case 1: -+ return ki18nc("Hijri month 1 - KLocale::LongName", "Muharram").toString(locale()); -+ case 2: -+ return ki18nc("Hijri month 2 - KLocale::LongName", "Safar").toString(locale()); -+ case 3: -+ return ki18nc("Hijri month 3 - KLocale::LongName", "Rabi` al-Awal").toString(locale()); -+ case 4: -+ return ki18nc("Hijri month 4 - KLocale::LongName", "Rabi` al-Thaani").toString(locale()); -+ case 5: -+ return ki18nc("Hijri month 5 - KLocale::LongName", "Jumaada al-Awal").toString(locale()); -+ case 6: -+ return ki18nc("Hijri month 6 - KLocale::LongName", "Jumaada al-Thaani").toString(locale()); -+ case 7: -+ return ki18nc("Hijri month 7 - KLocale::LongName", "Rajab").toString(locale()); -+ case 8: -+ return ki18nc("Hijri month 8 - KLocale::LongName", "Sha`ban").toString(locale()); -+ case 9: -+ return ki18nc("Hijri month 9 - KLocale::LongName", "Ramadan").toString(locale()); -+ case 10: -+ return ki18nc("Hijri month 10 - KLocale::LongName", "Shawwal").toString(locale()); -+ case 11: -+ return ki18nc("Hijri month 11 - KLocale::LongName", "Thu al-Qi`dah").toString(locale()); -+ case 12: -+ return ki18nc("Hijri month 12 - KLocale::LongName", "Thu al-Hijjah").toString(locale()); -+ default: -+ return QString(); -+ } -+} -+ -+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 KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemIslamicCivilPrivate(this), KSharedConfig::Ptr(), locale) -+{ -+ d_ptr->loadConfig(calendarType()); -+} -+ -+KCalendarSystemIslamicCivil::KCalendarSystemIslamicCivil(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemIslamicCivilPrivate(this), config, locale) -+{ -+ d_ptr->loadConfig(calendarType()); -+} -+ -+KCalendarSystemIslamicCivil::KCalendarSystemIslamicCivil(KCalendarSystemIslamicCivilPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) -+{ -+ d_ptr->loadConfig(calendarType()); -+} -+ -+KCalendarSystemIslamicCivil::~KCalendarSystemIslamicCivil() -+{ -+} -+ -+QString KCalendarSystemIslamicCivil::calendarType() const -+{ -+ return QLatin1String("hijri"); -+} -+ -+QDate KCalendarSystemIslamicCivil::epoch() const -+{ -+ // 16 July 622 in the Julian calendar -+ return QDate::fromJulianDay(1948440); -+} -+ -+QDate KCalendarSystemIslamicCivil::earliestValidDate() const -+{ -+ return epoch(); -+} -+ -+QDate KCalendarSystemIslamicCivil::latestValidDate() const -+{ -+ // Set to last day of year 9999 -+ // Last day of Islamic Civil year 9999 is 9999-12-29 -+ return QDate::fromJulianDay(5491751); -+} -+ -+bool KCalendarSystemIslamicCivil::isValid(int year, int month, int day) const -+{ -+ return KCalendarSystem::isValid(year, month, day); -+} -+ -+bool KCalendarSystemIslamicCivil::isValid(const QDate &date) const -+{ -+ return KCalendarSystem::isValid(date); -+} -+ -+bool KCalendarSystemIslamicCivil::isLeapYear(int year) const -+{ -+ return KCalendarSystem::isLeapYear(year); -+} -+ -+bool KCalendarSystemIslamicCivil::isLeapYear(const QDate &date) const -+{ -+ return KCalendarSystem::isLeapYear(date); -+} -+ -+QString KCalendarSystemIslamicCivil::monthName(int month, int year, MonthNameFormat format) const -+{ -+ return KCalendarSystem::monthName(month, year, format); -+} -+ -+QString KCalendarSystemIslamicCivil::monthName(const QDate &date, MonthNameFormat format) const -+{ -+ 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); -+} -+ -+int KCalendarSystemIslamicCivil::weekDayOfPray() const -+{ -+ return 5; // Friday -+} -+ -+bool KCalendarSystemIslamicCivil::isLunar() const -+{ -+ return true; -+} -+ -+bool KCalendarSystemIslamicCivil::isLunisolar() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemIslamicCivil::isSolar() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemIslamicCivil::isProleptic() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemIslamicCivil::julianDayToDate(int jd, int &year, int &month, int &day) const -+{ -+ Q_D(const KCalendarSystemIslamicCivil); -+ -+ /* -+ The following C++ code is translated from the Lisp code -+ in ``Calendrical Calculations'' by Nachum Dershowitz and -+ Edward M. Reingold, Software---Practice & Experience, -+ vol. 20, no. 9 (September, 1990), pp. 899--928. -+ -+ This code is in the public domain, but any use of it -+ should publically acknowledge its source. -+ */ -+ -+ // Search forward year by year from approximate year -+ year = (jd - epoch().toJulianDay()) / 355; -+ int testJd; -+ dateToJulianDay(year, 12, d->daysInMonth(year, 12), testJd); -+ while (jd > testJd) { -+ year++; -+ dateToJulianDay(year, 12, d->daysInMonth(year, 12), testJd); -+ } -+ -+ // Search forward month by month from Muharram -+ month = 1; -+ dateToJulianDay(year, month, d->daysInMonth(year, month), testJd); -+ while (jd > testJd) { -+ month++; -+ dateToJulianDay(year, month, d->daysInMonth(year, month), testJd); -+ } -+ -+ dateToJulianDay(year, month, 1, testJd); -+ day = jd - testJd + 1; -+ -+ return true; -+ -+ // Alternative implementations -+ -+ // More recent editions of "Calendrical Calculations" by Dershowitz & Reingold have a more -+ // efficient direct calculation without recusrion, but this cannot be used due to licensing -+ -+ /* -+ Formula from "Explanatory Supplement to the Astronomical Almanac" 2006, derived from Fliegel & Van Flandern 1968 -+ int L = jd - epoch().toJulianDay() + 10632; -+ int N = ( L - 1 ) / 10631; -+ L = L - 10631 * N + 354; -+ int J = ( ( 10985 - L ) / 5316 ) x ( ( 50* L ) / 17719 ) + ( L / 5670 ) * ( ( 43 * L ) / 15238 ); -+ L = L - ( ( 30 - J ) / 15 ) * ( ( 17719 * J ) / 50 ) - ( J / 16 ) * ( ( 15238 * J ) / 43 ) + 29; -+ year = ( 30 * N ) + J - 30; -+ month = ( 24 * L ) / 709; -+ day = L - ( ( 709 * month ) / 24 ); -+ */ -+ -+ /* -+ Formula from Fourmilab website -+ jd = Math.floor(jd) + 0.5; -+ year = Math.floor(((30 * (jd - epoch().toJulianDay())) + 10646) / 10631); -+ month = qMin(12, Math.ceil((jd - (29 + islamic_to_jd(year, 1, 1))) / 29.5) + 1); -+ day = (jd - islamic_to_jd(year, month, 1)) + 1; -+ */ -+} -+ -+bool KCalendarSystemIslamicCivil::dateToJulianDay(int year, int month, int day, int &jd) const -+{ -+ /* -+ The following C++ code is translated from the Lisp code -+ in ``Calendrical Calculations'' by Nachum Dershowitz and -+ Edward M. Reingold, Software---Practice & Experience, -+ vol. 20, no. 9 (September, 1990), pp. 899--928. -+ -+ This code is in the public domain, but any use of it -+ should publically acknowledge its source. -+ */ -+ -+ jd = epoch().toJulianDay() - 1 + // days before start of calendar -+ (year - 1) * 354 + // non-leap days in prior years -+ (3 + (11 * year)) / 30 + // leap days in prior years -+ 29 * (month - 1) + // days so far... -+ month / 2 + // ...this year -+ day; // days so far this month -+ -+ return true; -+ -+ // Alternative implementations -+ -+ /* -+ Formula from "Explanatory Supplement to the Astronomical Almanac" 2006, derived from Fliegel & Van Flandern 1968 -+ jd = ( 3 + ( 11 * year ) ) / 30 + 354 * year + 30 * month - ( month - 1 ) / 2 + day + epoch().toJulianDay() - 385; -+ */ -+} -diff --git a/kdecore/date/kcalendarsystemislamiccivil_p.h b/kdecore/date/kcalendarsystemislamiccivil_p.h -new file mode 100644 -index 0000000..59629cc ---- /dev/null -+++ b/kdecore/date/kcalendarsystemislamiccivil_p.h -@@ -0,0 +1,85 @@ -+/* -+ Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> -+ Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> -+ Copyright 2007, 2010 John Layt <john@layt.net> -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+ -+#ifndef KCALENDARSYSTEMISLAMICCIVIL_H -+#define KCALENDARSYSTEMISLAMICCIVIL_H -+ -+#include "kcalendarsystem.h" -+ -+class KCalendarSystemIslamicCivilPrivate; -+ -+/** -+ * @internal -+ * This is the Islamic Civil calendar implementation. -+ * -+ * The Islamic or Hijri calendar is the traditional calendar used in the Middle -+ * East. This implementation is of the civil calculation that does not take -+ * observed sunset into account and so may vary from actual dates by 1-2 days. -+ * -+ * @b license GNU-LGPL v2+ -+ * -+ * @see KLocale,KCalendarSystem -+ * -+ * @author Carlos Moro <cfmoro@correo.uniovi.es> -+ */ -+class KCalendarSystemIslamicCivil : public KCalendarSystem -+{ -+public: -+ explicit KCalendarSystemIslamicCivil(const KLocale *locale = 0); -+ explicit KCalendarSystemIslamicCivil(const KSharedConfig::Ptr config, const KLocale *locale = 0); -+ virtual ~KCalendarSystemIslamicCivil(); -+ -+ virtual QString calendarType() const; -+ -+ virtual QDate epoch() const; -+ virtual QDate earliestValidDate() const; -+ virtual QDate latestValidDate() const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; -+ -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; -+ -+ 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 weekDayOfPray() const; -+ -+ virtual bool isLunar() const; -+ virtual bool isLunisolar() const; -+ virtual bool isSolar() const; -+ virtual bool isProleptic() const; -+ -+protected: -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemIslamicCivil(KCalendarSystemIslamicCivilPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); -+ -+private: -+ Q_DECLARE_PRIVATE(KCalendarSystemIslamicCivil) -+}; -+ -+#endif // KCALENDARSYSTEMISLAMICCIVIL_H -diff --git a/kdecore/date/kcalendarsystemjalali.cpp b/kdecore/date/kcalendarsystemjalali.cpp -index 543ba5a..1aaa804 100644 ---- a/kdecore/date/kcalendarsystemjalali.cpp -+++ b/kdecore/date/kcalendarsystemjalali.cpp -@@ -35,32 +35,32 @@ - class KCalendarSystemJalaliPrivate : public KCalendarSystemPrivate - { - public: -- explicit KCalendarSystemJalaliPrivate( KCalendarSystemJalali *q ); -+ explicit KCalendarSystemJalaliPrivate(KCalendarSystemJalali *q); - - virtual ~KCalendarSystemJalaliPrivate(); - - // Virtual methods each calendar system must re-implement - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual int monthsInYear( int year ) const; -- virtual int daysInMonth( int year, int month ) const; -- virtual int daysInYear( int year ) const; -+ 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 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; -- virtual QString monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const; -- virtual QString weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) 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 - --KCalendarSystemJalaliPrivate::KCalendarSystemJalaliPrivate( KCalendarSystemJalali *q ) -- :KCalendarSystemPrivate( q ) -+KCalendarSystemJalaliPrivate::KCalendarSystemJalaliPrivate(KCalendarSystemJalali *q) -+ : KCalendarSystemPrivate(q) - { - } - -@@ -77,38 +77,38 @@ void KCalendarSystemJalaliPrivate::loadDefaultEraList() - { - QString name, shortName, format; - // Islamic Era (Hijri), Anno Persico. -- name = i18nc( "Calendar Era: Jalali Islamic Era, years > 0, LongFormat", "Anno Persico" ); -- shortName = i18nc( "Calendar Era: Jalali Islamic Era, years > 0, ShortFormat", "AP" ); -- format = i18nc( "(kdedt-format) Jalali, AP, full era year format used for %EY, e.g. 2000 AP", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Jalali Islamic Era, years > 0, LongFormat", "Anno Persico"); -+ shortName = i18nc("Calendar Era: Jalali Islamic Era, years > 0, ShortFormat", "AP"); -+ format = i18nc("(kdedt-format) Jalali, AP, full era year format used for %EY, e.g. 2000 AP", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --int KCalendarSystemJalaliPrivate::monthsInYear( int year ) const -+int KCalendarSystemJalaliPrivate::monthsInYear(int year) const - { -- Q_UNUSED( year ) -+ Q_UNUSED(year) - return 12; - } - --int KCalendarSystemJalaliPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemJalaliPrivate::daysInMonth(int year, int month) const - { -- if ( month == 12 ) { -- if ( isLeapYear( year ) ) { -+ if (month == 12) { -+ if (isLeapYear(year)) { - return 30; - } else { - return 29; - } - } - -- if ( month <= 6 ) { -+ if (month <= 6) { - return 31; - } - - return 30; - } - --int KCalendarSystemJalaliPrivate::daysInYear( int year ) const -+int KCalendarSystemJalaliPrivate::daysInYear(int year) const - { -- if ( isLeapYear( year ) ) { -+ if (isLeapYear(year)) { - return 366; - } else { - return 365; -@@ -120,26 +120,26 @@ int KCalendarSystemJalaliPrivate::daysInWeek() const - return 7; - } - --bool KCalendarSystemJalaliPrivate::isLeapYear( int year ) const -+bool KCalendarSystemJalaliPrivate::isLeapYear(int year) const - { - // From formilab Public Domain code http://www.fourmilab.ch/documents/calendar/ - // Use Birashk algorithm as it matches the to/from jd code below - - // Birashk algorithm is incorrect in two years in period AP 1244 to 1531, - // 1403/1404 and 1436/1437, and so catch them here first -- if ( year == 1403 || year == 1436 ) { -+ if (year == 1403 || year == 1436) { - return true; -- } else if ( year == 1404 || year == 1437 ) { -+ } else if (year == 1404 || year == 1437) { - return false; - } - -- if ( year >= 0 ) { -+ if (year >= 0) { - year = year - 474; - } else { - year = year - 473; - } - -- if ( ( ( ( ( ( year % 2820 ) + 474 ) + 38 ) * 682 ) % 2816 ) < 682 ) { -+ if ((((((year % 2820) + 474) + 38) * 682) % 2816) < 682) { - return true; - } else { - return false; -@@ -176,461 +176,315 @@ int KCalendarSystemJalaliPrivate::latestValidYear() const - return 1530; - } - --QString KCalendarSystemJalaliPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemJalaliPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( year ); -+ Q_UNUSED(year); - -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -+ if (format == KLocale::NarrowName) { -+ switch (month) { - case 1: -- return ki18nc( "Jalali month 1 - KLocale::NarrowName", "F" ).toString( locale() ); -+ return ki18nc("Jalali month 1 - KLocale::NarrowName", "F").toString(locale()); - case 2: -- return ki18nc( "Jalali month 2 - KLocale::NarrowName", "O" ).toString( locale() ); -+ return ki18nc("Jalali month 2 - KLocale::NarrowName", "O").toString(locale()); - case 3: -- return ki18nc( "Jalali month 3 - KLocale::NarrowName", "K" ).toString( locale() ); -+ return ki18nc("Jalali month 3 - KLocale::NarrowName", "K").toString(locale()); - case 4: -- return ki18nc( "Jalali month 4 - KLocale::NarrowName", "T" ).toString( locale() ); -+ return ki18nc("Jalali month 4 - KLocale::NarrowName", "T").toString(locale()); - case 5: -- return ki18nc( "Jalali month 5 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Jalali month 5 - KLocale::NarrowName", "M").toString(locale()); - case 6: -- return ki18nc( "Jalali month 6 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Jalali month 6 - KLocale::NarrowName", "S").toString(locale()); - case 7: -- return ki18nc( "Jalali month 7 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Jalali month 7 - KLocale::NarrowName", "M").toString(locale()); - case 8: -- return ki18nc( "Jalali month 8 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Jalali month 8 - KLocale::NarrowName", "A").toString(locale()); - case 9: -- return ki18nc( "Jalali month 9 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Jalali month 9 - KLocale::NarrowName", "A").toString(locale()); - case 10: -- return ki18nc( "Jalali month 10 - KLocale::NarrowName", "D" ).toString( locale() ); -+ return ki18nc("Jalali month 10 - KLocale::NarrowName", "D").toString(locale()); - case 11: -- return ki18nc( "Jalali month 11 - KLocale::NarrowName", "B" ).toString( locale() ); -+ return ki18nc("Jalali month 11 - KLocale::NarrowName", "B").toString(locale()); - case 12: -- return ki18nc( "Jalali month 12 - KLocale::NarrowName", "E" ).toString( locale() ); -+ return ki18nc("Jalali month 12 - KLocale::NarrowName", "E").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Jalali month 1 - KLocale::ShortName Possessive", "of Far" ).toString( locale() ); -+ return ki18nc("Jalali month 1 - KLocale::ShortName Possessive", "of Far").toString(locale()); - case 2: -- return ki18nc( "Jalali month 2 - KLocale::ShortName Possessive", "of Ord" ).toString( locale() ); -+ return ki18nc("Jalali month 2 - KLocale::ShortName Possessive", "of Ord").toString(locale()); - case 3: -- return ki18nc( "Jalali month 3 - KLocale::ShortName Possessive", "of Kho" ).toString( locale() ); -+ return ki18nc("Jalali month 3 - KLocale::ShortName Possessive", "of Kho").toString(locale()); - case 4: -- return ki18nc( "Jalali month 4 - KLocale::ShortName Possessive", "of Tir" ).toString( locale() ); -+ return ki18nc("Jalali month 4 - KLocale::ShortName Possessive", "of Tir").toString(locale()); - case 5: -- return ki18nc( "Jalali month 5 - KLocale::ShortName Possessive", "of Mor" ).toString( locale() ); -+ return ki18nc("Jalali month 5 - KLocale::ShortName Possessive", "of Mor").toString(locale()); - case 6: -- return ki18nc( "Jalali month 6 - KLocale::ShortName Possessive", "of Sha" ).toString( locale() ); -+ return ki18nc("Jalali month 6 - KLocale::ShortName Possessive", "of Sha").toString(locale()); - case 7: -- return ki18nc( "Jalali month 7 - KLocale::ShortName Possessive", "of Meh" ).toString( locale() ); -+ return ki18nc("Jalali month 7 - KLocale::ShortName Possessive", "of Meh").toString(locale()); - case 8: -- return ki18nc( "Jalali month 8 - KLocale::ShortName Possessive", "of Aba" ).toString( locale() ); -+ return ki18nc("Jalali month 8 - KLocale::ShortName Possessive", "of Aba").toString(locale()); - case 9: -- return ki18nc( "Jalali month 9 - KLocale::ShortName Possessive", "of Aza" ).toString( locale() ); -+ return ki18nc("Jalali month 9 - KLocale::ShortName Possessive", "of Aza").toString(locale()); - case 10: -- return ki18nc( "Jalali month 10 - KLocale::ShortName Possessive", "of Dei" ).toString( locale() ); -+ return ki18nc("Jalali month 10 - KLocale::ShortName Possessive", "of Dei").toString(locale()); - case 11: -- return ki18nc( "Jalali month 11 - KLocale::ShortName Possessive", "of Bah" ).toString( locale() ); -+ return ki18nc("Jalali month 11 - KLocale::ShortName Possessive", "of Bah").toString(locale()); - case 12: -- return ki18nc( "Jalali month 12 - KLocale::ShortName Possessive", "of Esf" ).toString( locale() ); -+ return ki18nc("Jalali month 12 - KLocale::ShortName Possessive", "of Esf").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Jalali month 1 - KLocale::ShortName", "Far" ).toString( locale() ); -+ return ki18nc("Jalali month 1 - KLocale::ShortName", "Far").toString(locale()); - case 2: -- return ki18nc( "Jalali month 2 - KLocale::ShortName", "Ord" ).toString( locale() ); -+ return ki18nc("Jalali month 2 - KLocale::ShortName", "Ord").toString(locale()); - case 3: -- return ki18nc( "Jalali month 3 - KLocale::ShortName", "Kho" ).toString( locale() ); -+ return ki18nc("Jalali month 3 - KLocale::ShortName", "Kho").toString(locale()); - case 4: -- return ki18nc( "Jalali month 4 - KLocale::ShortName", "Tir" ).toString( locale() ); -+ return ki18nc("Jalali month 4 - KLocale::ShortName", "Tir").toString(locale()); - case 5: -- return ki18nc( "Jalali month 5 - KLocale::ShortName", "Mor" ).toString( locale() ); -+ return ki18nc("Jalali month 5 - KLocale::ShortName", "Mor").toString(locale()); - case 6: -- return ki18nc( "Jalali month 6 - KLocale::ShortName", "Sha" ).toString( locale() ); -+ return ki18nc("Jalali month 6 - KLocale::ShortName", "Sha").toString(locale()); - case 7: -- return ki18nc( "Jalali month 7 - KLocale::ShortName", "Meh" ).toString( locale() ); -+ return ki18nc("Jalali month 7 - KLocale::ShortName", "Meh").toString(locale()); - case 8: -- return ki18nc( "Jalali month 8 - KLocale::ShortName", "Aba" ).toString( locale() ); -+ return ki18nc("Jalali month 8 - KLocale::ShortName", "Aba").toString(locale()); - case 9: -- return ki18nc( "Jalali month 9 - KLocale::ShortName", "Aza" ).toString( locale() ); -+ return ki18nc("Jalali month 9 - KLocale::ShortName", "Aza").toString(locale()); - case 10: -- return ki18nc( "Jalali month 10 - KLocale::ShortName", "Dei" ).toString( locale() ); -+ return ki18nc("Jalali month 10 - KLocale::ShortName", "Dei").toString(locale()); - case 11: -- return ki18nc( "Jalali month 11 - KLocale::ShortName", "Bah" ).toString( locale() ); -+ return ki18nc("Jalali month 11 - KLocale::ShortName", "Bah").toString(locale()); - case 12: -- return ki18nc( "Jalali month 12 - KLocale::ShortName", "Esf" ).toString( locale() ); -+ return ki18nc("Jalali month 12 - KLocale::ShortName", "Esf").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Jalali month 1 - KLocale::LongName Possessive", "of Farvardin" ).toString( locale() ); -+ return ki18nc("Jalali month 1 - KLocale::LongName Possessive", "of Farvardin").toString(locale()); - case 2: -- return ki18nc( "Jalali month 2 - KLocale::LongName Possessive", "of Ordibehesht" ).toString( locale() ); -+ return ki18nc("Jalali month 2 - KLocale::LongName Possessive", "of Ordibehesht").toString(locale()); - case 3: -- return ki18nc( "Jalali month 3 - KLocale::LongName Possessive", "of Khordad" ).toString( locale() ); -+ return ki18nc("Jalali month 3 - KLocale::LongName Possessive", "of Khordad").toString(locale()); - case 4: -- return ki18nc( "Jalali month 4 - KLocale::LongName Possessive", "of Tir" ).toString( locale() ); -+ return ki18nc("Jalali month 4 - KLocale::LongName Possessive", "of Tir").toString(locale()); - case 5: -- return ki18nc( "Jalali month 5 - KLocale::LongName Possessive", "of Mordad" ).toString( locale() ); -+ return ki18nc("Jalali month 5 - KLocale::LongName Possessive", "of Mordad").toString(locale()); - case 6: -- return ki18nc( "Jalali month 6 - KLocale::LongName Possessive", "of Shahrivar" ).toString( locale() ); -+ return ki18nc("Jalali month 6 - KLocale::LongName Possessive", "of Shahrivar").toString(locale()); - case 7: -- return ki18nc( "Jalali month 7 - KLocale::LongName Possessive", "of Mehr" ).toString( locale() ); -+ return ki18nc("Jalali month 7 - KLocale::LongName Possessive", "of Mehr").toString(locale()); - case 8: -- return ki18nc( "Jalali month 8 - KLocale::LongName Possessive", "of Aban" ).toString( locale() ); -+ return ki18nc("Jalali month 8 - KLocale::LongName Possessive", "of Aban").toString(locale()); - case 9: -- return ki18nc( "Jalali month 9 - KLocale::LongName Possessive", "of Azar" ).toString( locale() ); -+ return ki18nc("Jalali month 9 - KLocale::LongName Possessive", "of Azar").toString(locale()); - case 10: -- return ki18nc( "Jalali month 10 - KLocale::LongName Possessive", "of Dei" ).toString( locale() ); -+ return ki18nc("Jalali month 10 - KLocale::LongName Possessive", "of Dei").toString(locale()); - case 11: -- return ki18nc( "Jalali month 11 - KLocale::LongName Possessive", "of Bahman" ).toString( locale() ); -+ return ki18nc("Jalali month 11 - KLocale::LongName Possessive", "of Bahman").toString(locale()); - case 12: -- return ki18nc( "Jalali month 12 - KLocale::LongName Possessive", "of Esfand" ).toString( locale() ); -+ return ki18nc("Jalali month 12 - KLocale::LongName Possessive", "of Esfand").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( month ) { -+ switch (month) { - case 1: -- return ki18nc( "Jalali month 1 - KLocale::LongName", "Farvardin" ).toString( locale() ); -+ return ki18nc("Jalali month 1 - KLocale::LongName", "Farvardin").toString(locale()); - case 2: -- return ki18nc( "Jalali month 2 - KLocale::LongName", "Ordibehesht" ).toString( locale() ); -+ return ki18nc("Jalali month 2 - KLocale::LongName", "Ordibehesht").toString(locale()); - case 3: -- return ki18nc( "Jalali month 3 - KLocale::LongName", "Khordad" ).toString( locale() ); -+ return ki18nc("Jalali month 3 - KLocale::LongName", "Khordad").toString(locale()); - case 4: -- return ki18nc( "Jalali month 4 - KLocale::LongName", "Tir" ).toString( locale() ); -+ return ki18nc("Jalali month 4 - KLocale::LongName", "Tir").toString(locale()); - case 5: -- return ki18nc( "Jalali month 5 - KLocale::LongName", "Mordad" ).toString( locale() ); -+ return ki18nc("Jalali month 5 - KLocale::LongName", "Mordad").toString(locale()); - case 6: -- return ki18nc( "Jalali month 6 - KLocale::LongName", "Shahrivar" ).toString( locale() ); -+ return ki18nc("Jalali month 6 - KLocale::LongName", "Shahrivar").toString(locale()); - case 7: -- return ki18nc( "Jalali month 7 - KLocale::LongName", "Mehr" ).toString( locale() ); -+ return ki18nc("Jalali month 7 - KLocale::LongName", "Mehr").toString(locale()); - case 8: -- return ki18nc( "Jalali month 8 - KLocale::LongName", "Aban" ).toString( locale() ); -+ return ki18nc("Jalali month 8 - KLocale::LongName", "Aban").toString(locale()); - case 9: -- return ki18nc( "Jalali month 9 - KLocale::LongName", "Azar" ).toString( locale() ); -+ return ki18nc("Jalali month 9 - KLocale::LongName", "Azar").toString(locale()); - case 10: -- return ki18nc( "Jalali month 10 - KLocale::LongName", "Dei" ).toString( locale() ); -+ return ki18nc("Jalali month 10 - KLocale::LongName", "Dei").toString(locale()); - case 11: -- return ki18nc( "Jalali month 11 - KLocale::LongName", "Bahman" ).toString( locale() ); -+ return ki18nc("Jalali month 11 - KLocale::LongName", "Bahman").toString(locale()); - case 12: -- return ki18nc( "Jalali month 12 - KLocale::LongName", "Esfand" ).toString( locale() ); -+ return ki18nc("Jalali month 12 - KLocale::LongName", "Esfand").toString(locale()); - default: - return QString(); - } - } - --QString KCalendarSystemJalaliPrivate::weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const -+QString KCalendarSystemJalaliPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Jalali weekday 1 - KLocale::NarrowName ", "2" ).toString( locale() ); -+ return ki18nc("Jalali weekday 1 - KLocale::NarrowName ", "2").toString(locale()); - case 2: -- return ki18nc( "Jalali weekday 2 - KLocale::NarrowName ", "3" ).toString( locale() ); -+ return ki18nc("Jalali weekday 2 - KLocale::NarrowName ", "3").toString(locale()); - case 3: -- return ki18nc( "Jalali weekday 3 - KLocale::NarrowName ", "4" ).toString( locale() ); -+ return ki18nc("Jalali weekday 3 - KLocale::NarrowName ", "4").toString(locale()); - case 4: -- return ki18nc( "Jalali weekday 4 - KLocale::NarrowName ", "5" ).toString( locale() ); -+ return ki18nc("Jalali weekday 4 - KLocale::NarrowName ", "5").toString(locale()); - case 5: -- return ki18nc( "Jalali weekday 5 - KLocale::NarrowName ", "J" ).toString( locale() ); -+ return ki18nc("Jalali weekday 5 - KLocale::NarrowName ", "J").toString(locale()); - case 6: -- return ki18nc( "Jalali weekday 6 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Jalali weekday 6 - KLocale::NarrowName ", "S").toString(locale()); - case 7: -- return ki18nc( "Jalali weekday 7 - KLocale::NarrowName ", "1" ).toString( locale() ); -+ return ki18nc("Jalali weekday 7 - KLocale::NarrowName ", "1").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Jalali weekday 1 - KLocale::ShortName", "2sh" ).toString( locale() ); -+ return ki18nc("Jalali weekday 1 - KLocale::ShortName", "2sh").toString(locale()); - case 2: -- return ki18nc( "Jalali weekday 2 - KLocale::ShortName", "3sh" ).toString( locale() ); -+ return ki18nc("Jalali weekday 2 - KLocale::ShortName", "3sh").toString(locale()); - case 3: -- return ki18nc( "Jalali weekday 3 - KLocale::ShortName", "4sh" ).toString( locale() ); -+ return ki18nc("Jalali weekday 3 - KLocale::ShortName", "4sh").toString(locale()); - case 4: -- return ki18nc( "Jalali weekday 4 - KLocale::ShortName", "5sh" ).toString( locale() ); -+ return ki18nc("Jalali weekday 4 - KLocale::ShortName", "5sh").toString(locale()); - case 5: -- return ki18nc( "Jalali weekday 5 - KLocale::ShortName", "Jom" ).toString( locale() ); -+ return ki18nc("Jalali weekday 5 - KLocale::ShortName", "Jom").toString(locale()); - case 6: -- return ki18nc( "Jalali weekday 6 - KLocale::ShortName", "Shn" ).toString( locale() ); -+ return ki18nc("Jalali weekday 6 - KLocale::ShortName", "Shn").toString(locale()); - case 7: -- return ki18nc( "Jalali weekday 7 - KLocale::ShortName", "1sh" ).toString( locale() ); -+ return ki18nc("Jalali weekday 7 - KLocale::ShortName", "1sh").toString(locale()); - default: return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Jalali weekday 1 - KLocale::LongName", "Do shanbe" ).toString( locale() ); -+ return ki18nc("Jalali weekday 1 - KLocale::LongName", "Do shanbe").toString(locale()); - case 2: -- return ki18nc( "Jalali weekday 2 - KLocale::LongName", "Se shanbe" ).toString( locale() ); -+ return ki18nc("Jalali weekday 2 - KLocale::LongName", "Se shanbe").toString(locale()); - case 3: -- return ki18nc( "Jalali weekday 3 - KLocale::LongName", "Chahar shanbe" ).toString( locale() ); -+ return ki18nc("Jalali weekday 3 - KLocale::LongName", "Chahar shanbe").toString(locale()); - case 4: -- return ki18nc( "Jalali weekday 4 - KLocale::LongName", "Panj shanbe" ).toString( locale() ); -+ return ki18nc("Jalali weekday 4 - KLocale::LongName", "Panj shanbe").toString(locale()); - case 5: -- return ki18nc( "Jalali weekday 5 - KLocale::LongName", "Jumee" ).toString( locale() ); -+ return ki18nc("Jalali weekday 5 - KLocale::LongName", "Jumee").toString(locale()); - case 6: -- return ki18nc( "Jalali weekday 6 - KLocale::LongName", "Shanbe" ).toString( locale() ); -+ return ki18nc("Jalali weekday 6 - KLocale::LongName", "Shanbe").toString(locale()); - case 7: -- return ki18nc( "Jalali weekday 7 - KLocale::LongName", "Yek-shanbe" ).toString( locale() ); -+ return ki18nc("Jalali weekday 7 - KLocale::LongName", "Yek-shanbe").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemJalali::KCalendarSystemJalali( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemJalaliPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemJalali::KCalendarSystemJalali(const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemJalaliPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemJalali::KCalendarSystemJalali( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemJalaliPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemJalali::KCalendarSystemJalali(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemJalaliPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemJalali::KCalendarSystemJalali( KCalendarSystemJalaliPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemJalali::KCalendarSystemJalali(KCalendarSystemJalaliPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemJalali::~KCalendarSystemJalali() - { -- delete dont_use; - } - - QString KCalendarSystemJalali::calendarType() const - { -- return QLatin1String( "jalali" ); -+ return QLatin1String("jalali"); - } - - QDate KCalendarSystemJalali::epoch() const - { - // 19 March 622 in the Julian calendar -- return QDate::fromJulianDay( 1948321 ); -+ return QDate::fromJulianDay(1948321); - } - - QDate KCalendarSystemJalali::earliestValidDate() const - { - // Using the Birashk formula which is accurate in period AP 1244 to 1530 (AD 1865 to 2152) - // 1244-01-01 Jalali 1865-03-21 Gregorian -- return QDate::fromJulianDay( 2402317 ); -+ return QDate::fromJulianDay(2402317); - } - - QDate KCalendarSystemJalali::latestValidDate() const - { - // Using the Birashk formula which is accurate in period AP 1244 to 1530 (AD 1865 to 2152) - // 1530-12-29 Jalali 2152-03-19 Gregorian -- return QDate::fromJulianDay( 2507140 ); -+ return QDate::fromJulianDay(2507140); - } - --bool KCalendarSystemJalali::isValid( int year, int month, int day ) const -+bool KCalendarSystemJalali::isValid(int year, int month, int day) const - { -- return KCalendarSystem::isValid( year, month, day ); -+ return KCalendarSystem::isValid(year, month, day); - } - --bool KCalendarSystemJalali::isValid( const QDate &date ) const -+bool KCalendarSystemJalali::isValid(const QDate &date) const - { -- return KCalendarSystem::isValid( date ); -+ return KCalendarSystem::isValid(date); - } - --bool KCalendarSystemJalali::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemJalali::isLeapYear(int year) const - { -- return KCalendarSystem::setDate( date, year, month, day ); -+ return KCalendarSystem::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemJalali::setYMD( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemJalali::isLeapYear(const QDate &date) const - { -- return KCalendarSystem::setYMD( date, year, month, day ); -+ return KCalendarSystem::isLeapYear(date); - } - --int KCalendarSystemJalali::year( const QDate &date ) const -+QString KCalendarSystemJalali::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystem::year( date ); -+ return KCalendarSystem::monthName(month, year, format); - } - --int KCalendarSystemJalali::month ( const QDate& date ) const -- --{ -- return KCalendarSystem::month( date ); --} -- --int KCalendarSystemJalali::day( const QDate &date ) const --{ -- return KCalendarSystem::day( date ); --} -- --QDate KCalendarSystemJalali::addYears( const QDate &date, int nyears ) const --{ -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemJalali::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemJalali::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemJalali::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemJalali::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemJalali::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemJalali::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemJalali::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemJalali::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemJalali::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemJalali::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystem::dayOfWeek( date ); --} -- --int KCalendarSystemJalali::weekNumber( const QDate &date, int *yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemJalali::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemJalali::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemJalali::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemJalali::monthName( const QDate &date, MonthNameFormat format ) const --{ -- 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 ); --} -- --QString KCalendarSystemJalali::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemJalali::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemJalali::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemJalali::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemJalali::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemJalali::dayStringToInteger( const QString & sNum, int & iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemJalali::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemJalali::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemJalali::readDate( const QString &intstr, const QString &fmt, bool *ok ) const -+QString KCalendarSystemJalali::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystem::readDate( intstr, fmt, ok ); -+ return KCalendarSystem::monthName(date, format); - } - --QDate KCalendarSystemJalali::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const -+QString KCalendarSystemJalali::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystem::readDate( str, flags, ok ); -+ return KCalendarSystem::weekDayName(weekDay, format); - } - --int KCalendarSystemJalali::weekStartDay() const -+QString KCalendarSystemJalali::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystem::weekStartDay(); -+ return KCalendarSystem::weekDayName(date, format); - } - - int KCalendarSystemJalali::weekDayOfPray() const -@@ -658,20 +512,20 @@ bool KCalendarSystemJalali::isProleptic() const - return false; - } - --bool KCalendarSystemJalali::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemJalali::julianDayToDate(int jd, int &year, int &month, int &day) const - { - // Birashk algorithm is incorrect in two years in period AP 1244 to 1531. - // This results in a leap day being added to the end of 1404 instead of 1403 - // and to the end of 1437 instead of 1436. Check for these dates first and - // return accordingly. Relies on later use of dateToJulianDay() to correctly - // calculate firstDayOfYear in 1404 and 1437, so no other adjustments needed. -- if ( jd == 2460755 ) { -+ if (jd == 2460755) { - year = 1403; - month = 12; - day = 30; - return true; - } -- if ( jd == 2472808 ) { -+ if (jd == 2472808) { - year = 1436; - month = 12; - day = 30; -@@ -686,54 +540,54 @@ bool KCalendarSystemJalali::julianDayToDate( int jd, int &year, int &month, int - int cycle; - int dayInCycle; - int yearInCycle; -- dateToJulianDay( 475, 1, 1, jdCycleStart ); -+ dateToJulianDay(475, 1, 1, jdCycleStart); - daysSinceCycleStart = jd - jdCycleStart; - cycle = daysSinceCycleStart / 1029983; - dayInCycle = daysSinceCycleStart % 1029983; -- if ( dayInCycle == 1029982 ) { -+ if (dayInCycle == 1029982) { - yearInCycle = 2820; - } else { - int aux1 = dayInCycle / 366; - int aux2 = dayInCycle % 366; -- yearInCycle = ( ( ( 2134 * aux1 ) + ( 2816 * aux2 ) + 2815 ) / 1028522 ) + aux1 + 1; -+ yearInCycle = (((2134 * aux1) + (2816 * aux2) + 2815) / 1028522) + aux1 + 1; - } -- year = yearInCycle + ( 2820 * cycle ) + 474; -- if ( year <= 0 ) { -+ year = yearInCycle + (2820 * cycle) + 474; -+ if (year <= 0) { - year = year - 1; - } - - int firstDayOfYear; -- dateToJulianDay( year, 1, 1, firstDayOfYear ); -+ dateToJulianDay(year, 1, 1, firstDayOfYear); - int dayinYear = jd - firstDayOfYear + 1; -- if( dayinYear <= 186 ) { -- month = ( ( dayinYear - 1 ) / 31 ) + 1; -- day = dayinYear - ( ( month - 1 ) * 31 ); -+ if (dayinYear <= 186) { -+ month = ((dayinYear - 1) / 31) + 1; -+ day = dayinYear - ((month - 1) * 31); - } else { -- month = ( ( dayinYear - 7 ) / 30 ) + 1; -- day = dayinYear - ( ( month - 1 ) * 30 ) - 6; -+ month = ((dayinYear - 7) / 30) + 1; -+ day = dayinYear - ((month - 1) * 30) - 6; - } - - return true; - } - --bool KCalendarSystemJalali::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemJalali::dateToJulianDay(int year, int month, int day, int &jd) const - { -- Q_D( const KCalendarSystemJalali ); -+ Q_D(const KCalendarSystemJalali); - - // Birashk algorithm is incorrect in two years in period AP 1244 to 1531. - // This results in a leap day being added to the end of 1404 instead of 1403 - // and to the end of 1437 instead of 1436. Thus all dates in 1404 and 1437 - // are off by 1 JD. Check for these dates first and adjust accordingly. -- if ( year == 1403 && month == 12 && day == 30 ) { -+ if (year == 1403 && month == 12 && day == 30) { - jd = 2460755; - return true; - } -- if ( year == 1436 && month == 12 && day == 30 ) { -+ if (year == 1436 && month == 12 && day == 30) { - jd = 2472808; - return true; - } -- if ( year == 1404 || year == 1437 ) { -- if ( month < 12 && day + 1 > d->daysInMonth( year, month ) ) { -+ if (year == 1404 || year == 1437) { -+ if (month < 12 && day + 1 > d->daysInMonth(year, month)) { - day = 1; - month = month + 1; - } else { -@@ -747,24 +601,24 @@ bool KCalendarSystemJalali::dateToJulianDay( int year, int month, int day, int & - long epyear; - long monthDays; - -- if ( year >= 0 ) { -+ if (year >= 0) { - epbase = year - 474; - } else { - epbase = year - 473; - } - -- epyear = 474 + ( epbase % 2820 ); -+ epyear = 474 + (epbase % 2820); - -- if ( month <= 7 ) { -- monthDays = ( month - 1 ) * 31; -+ if (month <= 7) { -+ monthDays = (month - 1) * 31; - } else { -- monthDays = ( ( month - 1 ) * 30 ) + 6; -+ monthDays = ((month - 1) * 30) + 6; - } - -- jd = ( epoch().toJulianDay() - 1 ) + // days before epoch -- ( epyear - 1 ) * 365 + // normal days in previous years -- ( ( ( epyear * 682 ) - 110 ) / 2816 ) + // leap days in previous years -- ( epbase / 2820 ) * 1029983 + -+ jd = (epoch().toJulianDay() - 1) + // days before epoch -+ (epyear - 1) * 365 + // normal days in previous years -+ (((epyear * 682) - 110) / 2816) + // leap days in previous years -+ (epbase / 2820) * 1029983 + - monthDays + // days in previous months this year - day; // days in this month - -diff --git a/kdecore/date/kcalendarsystemjalali_p.h b/kdecore/date/kcalendarsystemjalali_p.h -index d1b8350..6ae44ea 100644 ---- a/kdecore/date/kcalendarsystemjalali_p.h -+++ b/kdecore/date/kcalendarsystemjalali_p.h -@@ -32,8 +32,8 @@ class KCalendarSystemJalaliPrivate; - class KCalendarSystemJalali : public KCalendarSystem - { - public: -- explicit KCalendarSystemJalali( const KLocale * locale = 0 ); -- explicit KCalendarSystemJalali( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemJalali(const KLocale * locale = 0); -+ explicit KCalendarSystemJalali(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemJalali(); - - virtual QString calendarType() const; -@@ -41,58 +41,19 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -100,15 +61,14 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemJalali( KCalendarSystemJalaliPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemJalali(KCalendarSystemJalaliPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: -- Q_DECLARE_PRIVATE( KCalendarSystemJalali ) -- KCalendarSystemJalaliPrivate * const dont_use; // KDE5 remove, use shared d -+ Q_DECLARE_PRIVATE(KCalendarSystemJalali) - }; - - #endif // KCALENDARSYSTEMJALALI_H -diff --git a/kdecore/date/kcalendarsystemjapanese.cpp b/kdecore/date/kcalendarsystemjapanese.cpp -index feabd38..4d4e58a 100644 ---- a/kdecore/date/kcalendarsystemjapanese.cpp -+++ b/kdecore/date/kcalendarsystemjapanese.cpp -@@ -18,18 +18,18 @@ - */ - - #include "kcalendarsystemjapanese_p.h" --#include "kcalendarsystemgregorianprolepticprivate_p.h" -+#include "kcalendarsystemgregorianprivate_p.h" - - #include "kdebug.h" - #include "klocale.h" - - #include <QtCore/QDate> - --//Reuse the Gregorian Proleptic private implementation --class KCalendarSystemJapanesePrivate : public KCalendarSystemGregorianProlepticPrivate -+//Reuse the Gregorian private implementation -+class KCalendarSystemJapanesePrivate : public KCalendarSystemGregorianPrivate - { - public: -- explicit KCalendarSystemJapanesePrivate( KCalendarSystemJapanese *q ); -+ explicit KCalendarSystemJapanesePrivate(KCalendarSystemJapanese *q); - virtual ~KCalendarSystemJapanesePrivate(); - - virtual KLocale::CalendarSystem calendarSystem() const; -@@ -37,10 +37,10 @@ public: - virtual int earliestValidYear() const; - }; - --//Override only a few of the Gregorian Proleptic private methods -+//Override only a few of the Gregorian private methods - --KCalendarSystemJapanesePrivate::KCalendarSystemJapanesePrivate( KCalendarSystemJapanese *q ) -- : KCalendarSystemGregorianProlepticPrivate( q ) -+KCalendarSystemJapanesePrivate::KCalendarSystemJapanesePrivate(KCalendarSystemJapanese *q) -+ : KCalendarSystemGregorianPrivate(q) - { - } - -@@ -60,38 +60,38 @@ void KCalendarSystemJapanesePrivate::loadDefaultEraList() - // Nengō, Only do most recent for now, use AD for the rest. - // Feel free to add more, but have mercy on the translators :-) - -- name = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini" ); -- shortName = i18nc( "Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD" ); -- format = i18nc( "(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, QDate( 1868, 9, 7 ), name, shortName, format ); -+ name = i18nc("Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini"); -+ shortName = i18nc("Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD"); -+ format = i18nc("(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, QDate(1868, 9, 7), name, shortName, format); - -- name = i18nc( "Calendar Era: Japanese Nengō, Meiji Era, LongFormat", "Meiji" ); -+ name = i18nc("Calendar Era: Japanese Nengō, Meiji Era, LongFormat", "Meiji"); - shortName = name; -- format = i18nc( "(kdedt-format) Japanese, Meiji, full era year format used for %EY, year = 1, e.g. Meiji 1", "%EC Gannen" ); -- addEra( '+', 1, QDate( 1868, 9, 8 ), 1868, QDate( 1868, 12, 31 ), name, shortName, format ); -- format = i18nc( "(kdedt-format) Japanese, Meiji, full era year format used for %EY, year > 1, e.g. Meiji 22", "%EC %Ey" ); -- addEra( '+', 2, QDate( 1869, 1, 1 ), 1869, QDate( 1912, 7, 29 ), name, shortName, format ); -+ format = i18nc("(kdedt-format) Japanese, Meiji, full era year format used for %EY, year = 1, e.g. Meiji 1", "%EC Gannen"); -+ addEra('+', 1, QDate(1868, 9, 8), 1868, QDate(1868, 12, 31), name, shortName, format); -+ format = i18nc("(kdedt-format) Japanese, Meiji, full era year format used for %EY, year > 1, e.g. Meiji 22", "%EC %Ey"); -+ addEra('+', 2, QDate(1869, 1, 1), 1869, QDate(1912, 7, 29), name, shortName, format); - -- name = i18nc( "Calendar Era: Japanese Nengō, Taishō Era, LongFormat", "Taishō" ); -+ name = i18nc("Calendar Era: Japanese Nengō, Taishō Era, LongFormat", "Taishō"); - shortName = name; -- format = i18nc( "(kdedt-format) Japanese, Taishō, full era year format used for %EY, year = 1, e.g. Taishō 1", "%EC Gannen" ); -- addEra( '+', 1, QDate( 1912, 7, 30 ), 1912, QDate( 1912, 12, 31 ), name, shortName, format ); -- format = i18nc( "(kdedt-format) Japanese, Taishō, full era year format used for %EY, year > 1, e.g. Taishō 22", "%EC %Ey" ); -- addEra( '+', 2, QDate( 1913, 1, 1 ), 1913, QDate( 1926, 12, 24 ), name, shortName, format ); -+ format = i18nc("(kdedt-format) Japanese, Taishō, full era year format used for %EY, year = 1, e.g. Taishō 1", "%EC Gannen"); -+ addEra('+', 1, QDate(1912, 7, 30), 1912, QDate(1912, 12, 31), name, shortName, format); -+ format = i18nc("(kdedt-format) Japanese, Taishō, full era year format used for %EY, year > 1, e.g. Taishō 22", "%EC %Ey"); -+ addEra('+', 2, QDate(1913, 1, 1), 1913, QDate(1926, 12, 24), name, shortName, format); - -- name = i18nc( "Calendar Era: Japanese Nengō, Shōwa Era, LongFormat", "Shōwa" ); -+ name = i18nc("Calendar Era: Japanese Nengō, Shōwa Era, LongFormat", "Shōwa"); - shortName = name; -- format = i18nc( "(kdedt-format) Japanese, Shōwa, full era year format used for %EY, year = 1, e.g. Shōwa 1", "%EC Gannen" ); -- addEra( '+', 1, QDate( 1926, 12, 25 ), 1926, QDate( 1926, 12, 31 ), name, shortName, format ); -- format = i18nc( "(kdedt-format) Japanese, Shōwa, full era year format used for %EY, year > 1, e.g. Shōwa 22", "%EC %Ey" ); -- addEra( '+', 2, QDate( 1927, 1, 1 ), 1927, QDate( 1989, 1, 7 ), name, shortName, format ); -+ format = i18nc("(kdedt-format) Japanese, Shōwa, full era year format used for %EY, year = 1, e.g. Shōwa 1", "%EC Gannen"); -+ addEra('+', 1, QDate(1926, 12, 25), 1926, QDate(1926, 12, 31), name, shortName, format); -+ format = i18nc("(kdedt-format) Japanese, Shōwa, full era year format used for %EY, year > 1, e.g. Shōwa 22", "%EC %Ey"); -+ addEra('+', 2, QDate(1927, 1, 1), 1927, QDate(1989, 1, 7), name, shortName, format); - -- name = i18nc( "Calendar Era: Japanese Nengō, Heisei Era, LongFormat", "Heisei" ); -+ name = i18nc("Calendar Era: Japanese Nengō, Heisei Era, LongFormat", "Heisei"); - shortName = name; -- format = i18nc( "(kdedt-format) Japanese, Heisei, full era year format used for %EY, year = 1, e.g. Heisei 1", "%EC Gannen" ); -- addEra( '+', 1, QDate( 1989, 1, 8 ), 1989, QDate( 1989, 12, 31 ), name, shortName, format ); -- format = i18nc( "(kdedt-format) Japanese, Heisei, full era year format used for %EY, year > 1, e.g. Heisei 22", "%EC %Ey" ); -- addEra( '+', 2, QDate( 1990, 1, 1 ), 1990, q->latestValidDate(), name, shortName, format ); -+ format = i18nc("(kdedt-format) Japanese, Heisei, full era year format used for %EY, year = 1, e.g. Heisei 1", "%EC Gannen"); -+ addEra('+', 1, QDate(1989, 1, 8), 1989, QDate(1989, 12, 31), name, shortName, format); -+ format = i18nc("(kdedt-format) Japanese, Heisei, full era year format used for %EY, year > 1, e.g. Heisei 22", "%EC %Ey"); -+ addEra('+', 2, QDate(1990, 1, 1), 1990, q->latestValidDate(), name, shortName, format); - } - - int KCalendarSystemJapanesePrivate::earliestValidYear() const -@@ -100,23 +100,23 @@ int KCalendarSystemJapanesePrivate::earliestValidYear() const - } - - --KCalendarSystemJapanese::KCalendarSystemJapanese( const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( *new KCalendarSystemJapanesePrivate( this ), KSharedConfig::Ptr(), locale ) -+KCalendarSystemJapanese::KCalendarSystemJapanese(const KLocale *locale) -+ : KCalendarSystemGregorian(*new KCalendarSystemJapanesePrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemJapanese::KCalendarSystemJapanese( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( *new KCalendarSystemJapanesePrivate( this ), config, locale ) -+KCalendarSystemJapanese::KCalendarSystemJapanese(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemGregorian(*new KCalendarSystemJapanesePrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemJapanese::KCalendarSystemJapanese( KCalendarSystemJapanesePrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( dd, config, locale ) -+KCalendarSystemJapanese::KCalendarSystemJapanese(KCalendarSystemJapanesePrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemGregorian(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemJapanese::~KCalendarSystemJapanese() -@@ -125,215 +125,79 @@ KCalendarSystemJapanese::~KCalendarSystemJapanese() - - QString KCalendarSystemJapanese::calendarType() const - { -- return QLatin1String( "japanese" ); -+ return QLatin1String("japanese"); - } - - QDate KCalendarSystemJapanese::epoch() const - { - // 0001-01-01 Gregorian for now -- return QDate::fromJulianDay( 1721426 ); -+ return QDate::fromJulianDay(1721426); - } - - QDate KCalendarSystemJapanese::earliestValidDate() const - { - // 0001-01-01 Gregorian for now -- return QDate::fromJulianDay( 1721426 ); -+ return QDate::fromJulianDay(1721426); - } - - QDate KCalendarSystemJapanese::latestValidDate() const - { - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - // 9999-12-31 Gregorian -- return QDate::fromJulianDay( 5373484 ); -+ return QDate::fromJulianDay(5373484); - } - --bool KCalendarSystemJapanese::isValid( int year, int month, int day ) const -+bool KCalendarSystemJapanese::isValid(int year, int month, int day) const - { -- return KCalendarSystemGregorianProleptic::isValid( year, month, day ); -+ return KCalendarSystemGregorian::isValid(year, month, day); - } - --bool KCalendarSystemJapanese::isValid( const QDate &date ) const -+bool KCalendarSystemJapanese::isValid(const QDate &date) const - { -- return KCalendarSystemGregorianProleptic::isValid( date ); -+ return KCalendarSystemGregorian::isValid(date); - } - --bool KCalendarSystemJapanese::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemJapanese::isLeapYear(int year) const - { -- return KCalendarSystemGregorianProleptic::setDate( date, year, month, day ); -+ return KCalendarSystemGregorian::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemJapanese::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemJapanese::isLeapYear(const QDate &date) const - { -- return KCalendarSystemGregorianProleptic::setDate( date, y, m, d ); -+ return KCalendarSystemGregorian::isLeapYear(date); - } - --int KCalendarSystemJapanese::year( const QDate &date ) const -+QString KCalendarSystemJapanese::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::year( date ); -+ return KCalendarSystemGregorian::monthName(month, year, format); - } - --int KCalendarSystemJapanese::month( const QDate &date ) const -+QString KCalendarSystemJapanese::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::month( date ); -+ return KCalendarSystemGregorian::monthName(date, format); - } - --int KCalendarSystemJapanese::day( const QDate &date ) const -+QString KCalendarSystemJapanese::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::day( date ); -+ return KCalendarSystemGregorian::weekDayName(weekDay, format); - } - --QDate KCalendarSystemJapanese::addYears( const QDate &date, int nyears ) const -+QString KCalendarSystemJapanese::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::addYears( date, nyears ); -+ return KCalendarSystemGregorian::weekDayName(date, format); - } - --QDate KCalendarSystemJapanese::addMonths( const QDate &date, int nmonths ) const -+int KCalendarSystemJapanese::yearStringToInteger(const QString &sNum, int &iLength) const - { -- return KCalendarSystemGregorianProleptic::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemJapanese::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystemGregorianProleptic::addDays( date, ndays ); --} -- --int KCalendarSystemJapanese::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::monthsInYear( date ); --} -- --int KCalendarSystemJapanese::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::weeksInYear( date ); --} -- --int KCalendarSystemJapanese::weeksInYear( int year ) const --{ -- return KCalendarSystemGregorianProleptic::weeksInYear( year ); --} -- --int KCalendarSystemJapanese::daysInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInYear( date ); --} -- --int KCalendarSystemJapanese::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInMonth( date ); --} -- --int KCalendarSystemJapanese::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInWeek( date ); --} -- --int KCalendarSystemJapanese::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::dayOfYear( date ); --} -- --int KCalendarSystemJapanese::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::dayOfWeek( date ); --} -- --int KCalendarSystemJapanese::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystemGregorianProleptic::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemJapanese::isLeapYear( int year ) const --{ -- return KCalendarSystemGregorianProleptic::isLeapYear( year ); --} -- --bool KCalendarSystemJapanese::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::isLeapYear( date ); --} -- --QString KCalendarSystemJapanese::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthName( month, year, format ); --} -- --QString KCalendarSystemJapanese::monthName( const QDate &date, MonthNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthName( date, format ); --} -- --QString KCalendarSystemJapanese::weekDayName( int weekDay, WeekDayNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::weekDayName( weekDay, format ); --} -- --QString KCalendarSystemJapanese::weekDayName( const QDate &date, WeekDayNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::weekDayName( date, format ); --} -- --QString KCalendarSystemJapanese::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::yearString( pDate, format ); --} -- --QString KCalendarSystemJapanese::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthString( pDate, format ); --} -- --QString KCalendarSystemJapanese::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::dayString( pDate, format ); --} -- --int KCalendarSystemJapanese::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- QString gannen = i18nc( "Japanese year 1 of era", "Gannen" ); -- if ( sNum.startsWith( gannen, Qt::CaseInsensitive ) ) { -+ QString gannen = i18nc("Japanese year 1 of era", "Gannen"); -+ if (sNum.startsWith(gannen, Qt::CaseInsensitive)) { - iLength = gannen.length(); - return 1; - } else { -- return KCalendarSystemGregorianProleptic::yearStringToInteger( sNum, iLength ); -+ return KCalendarSystemGregorian::yearStringToInteger(sNum, iLength); - } - } - --int KCalendarSystemJapanese::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemJapanese::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemJapanese::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::formatDate( date, format ); --} -- --QDate KCalendarSystemJapanese::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( str, ok ); --} -- --QDate KCalendarSystemJapanese::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemJapanese::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( str, flags, ok ); --} -- --int KCalendarSystemJapanese::weekStartDay() const --{ -- return KCalendarSystemGregorianProleptic::weekStartDay(); --} -- - int KCalendarSystemJapanese::weekDayOfPray() const - { - return 7; // TODO JPL ??? -@@ -341,17 +205,17 @@ int KCalendarSystemJapanese::weekDayOfPray() const - - bool KCalendarSystemJapanese::isLunar() const - { -- return KCalendarSystemGregorianProleptic::isLunar(); -+ return KCalendarSystemGregorian::isLunar(); - } - - bool KCalendarSystemJapanese::isLunisolar() const - { -- return KCalendarSystemGregorianProleptic::isLunisolar(); -+ return KCalendarSystemGregorian::isLunisolar(); - } - - bool KCalendarSystemJapanese::isSolar() const - { -- return KCalendarSystemGregorianProleptic::isSolar(); -+ return KCalendarSystemGregorian::isSolar(); - } - - bool KCalendarSystemJapanese::isProleptic() const -@@ -359,12 +223,12 @@ bool KCalendarSystemJapanese::isProleptic() const - return false; - } - --bool KCalendarSystemJapanese::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemJapanese::julianDayToDate(int jd, int &year, int &month, int &day) const - { -- return KCalendarSystemGregorianProleptic::julianDayToDate( jd, year, month, day ); -+ return KCalendarSystemGregorian::julianDayToDate(jd, year, month, day); - } - --bool KCalendarSystemJapanese::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemJapanese::dateToJulianDay(int year, int month, int day, int &jd) const - { -- return KCalendarSystemGregorianProleptic::dateToJulianDay( year, month, day, jd ); -+ return KCalendarSystemGregorian::dateToJulianDay(year, month, day, jd); - } -diff --git a/kdecore/date/kcalendarsystemjapanese_p.h b/kdecore/date/kcalendarsystemjapanese_p.h -index 5409dfc..1781f8e 100644 ---- a/kdecore/date/kcalendarsystemjapanese_p.h -+++ b/kdecore/date/kcalendarsystemjapanese_p.h -@@ -20,7 +20,7 @@ - #ifndef KCALENDARSYSTEMJAPANESE_H - #define KCALENDARSYSTEMJAPANESE_H - --#include "kcalendarsystemgregorianproleptic_p.h" -+#include "kcalendarsystemgregorian_p.h" - - class KCalendarSystemJapanesePrivate; - -@@ -35,11 +35,11 @@ class KCalendarSystemJapanesePrivate; - * - * @author John Layt <john@layt.net> - */ --class KCalendarSystemJapanese: public KCalendarSystemGregorianProleptic -+class KCalendarSystemJapanese: public KCalendarSystemGregorian - { - public: -- explicit KCalendarSystemJapanese( const KLocale *locale = 0 ); -- explicit KCalendarSystemJapanese( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemJapanese(const KLocale *locale = 0); -+ explicit KCalendarSystemJapanese(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemJapanese(); - - virtual QString calendarType() const; -@@ -47,58 +47,21 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -+ virtual int yearStringToInteger(const QString &sNum, int &iLength) const; - -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -106,11 +69,11 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemJapanese( KCalendarSystemJapanesePrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemJapanese(KCalendarSystemJapanesePrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: - Q_DECLARE_PRIVATE(KCalendarSystemJapanese) -diff --git a/kdecore/date/kcalendarsystemjulian.cpp b/kdecore/date/kcalendarsystemjulian.cpp -index 5dbb71e..3372bb5 100644 ---- a/kdecore/date/kcalendarsystemjulian.cpp -+++ b/kdecore/date/kcalendarsystemjulian.cpp -@@ -31,34 +31,34 @@ - class KCalendarSystemJulianPrivate : public KCalendarSystemPrivate - { - public: -- explicit KCalendarSystemJulianPrivate( KCalendarSystemJulian *q ); -+ explicit KCalendarSystemJulianPrivate(KCalendarSystemJulian *q); - - virtual ~KCalendarSystemJulianPrivate(); - - // Virtual methods each calendar system must re-implement - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual int monthsInYear( int year ) const; -- virtual int daysInMonth( int year, int month ) const; -- virtual int daysInYear( int year ) const; -+ 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 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; -- virtual QString monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const; -- virtual QString weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) 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; - }; - - // Shared d pointer base class definitions - --KCalendarSystemJulianPrivate::KCalendarSystemJulianPrivate( KCalendarSystemJulian *q ) -- :KCalendarSystemPrivate( q ) -+KCalendarSystemJulianPrivate::KCalendarSystemJulianPrivate(KCalendarSystemJulian *q) -+ : KCalendarSystemPrivate(q) - { - } - -@@ -75,56 +75,56 @@ void KCalendarSystemJulianPrivate::loadDefaultEraList() - { - QString name, shortName, format; - -- KConfigGroup cg( config(), QString::fromLatin1( "KCalendarSystem %1" ).arg( q->calendarType() ) ); -- m_useCommonEra = cg.readEntry( "UseCommonEra", false ); -+ KConfigGroup cg(config(), QString::fromLatin1("KCalendarSystem %1").arg(q->calendarType(q->calendarSystem()))); -+ m_useCommonEra = cg.readEntry("UseCommonEra", false); - -- if ( m_useCommonEra ) { -- name = i18nc( "Calendar Era: Julian Common Era, years < 0, LongFormat", "Before Common Era" ); -- shortName = i18nc( "Calendar Era: Julian Common Era, years < 0, ShortFormat", "BCE" ); -+ if (m_useCommonEra) { -+ name = i18nc("Calendar Era: Julian Common Era, years < 0, LongFormat", "Before Common Era"); -+ shortName = i18nc("Calendar Era: Julian Common Era, years < 0, ShortFormat", "BCE"); - } else { -- name = i18nc( "Calendar Era: Julian Christian Era, years < 0, LongFormat", "Before Christ" ); -- shortName = i18nc( "Calendar Era: Julian Christian Era, years < 0, ShortFormat", "BC" ); -+ name = i18nc("Calendar Era: Julian Christian Era, years < 0, LongFormat", "Before Christ"); -+ shortName = i18nc("Calendar Era: Julian Christian Era, years < 0, ShortFormat", "BC"); - } -- format = i18nc( "(kdedt-format) Julian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC" ); -- addEra( '-', 1, q->epoch().addDays( -1 ), -1, q->earliestValidDate(), name, shortName, format ); -+ format = i18nc("(kdedt-format) Julian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC"); -+ addEra('-', 1, q->epoch().addDays(-1), -1, q->earliestValidDate(), name, shortName, format); - -- if ( m_useCommonEra ) { -- name = i18nc( "Calendar Era: Julian Common Era, years > 0, LongFormat", "Common Era" ); -- shortName = i18nc( "Calendar Era: Julian Common Era, years > 0, ShortFormat", "CE" ); -+ if (m_useCommonEra) { -+ name = i18nc("Calendar Era: Julian Common Era, years > 0, LongFormat", "Common Era"); -+ shortName = i18nc("Calendar Era: Julian Common Era, years > 0, ShortFormat", "CE"); - } else { -- name = i18nc( "Calendar Era: Julian Christian Era, years > 0, LongFormat", "Anno Domini" ); -- shortName = i18nc( "Calendar Era: Julian Christian Era, years > 0, ShortFormat", "AD" ); -+ name = i18nc("Calendar Era: Julian Christian Era, years > 0, LongFormat", "Anno Domini"); -+ shortName = i18nc("Calendar Era: Julian Christian Era, years > 0, ShortFormat", "AD"); - } -- format = i18nc( "(kdedt-format) Julian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ format = i18nc("(kdedt-format) Julian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --int KCalendarSystemJulianPrivate::monthsInYear( int year ) const -+int KCalendarSystemJulianPrivate::monthsInYear(int year) const - { -- Q_UNUSED( year ) -+ Q_UNUSED(year) - return 12; - } - --int KCalendarSystemJulianPrivate::daysInMonth( int year, int month ) const -+int KCalendarSystemJulianPrivate::daysInMonth(int year, int month) const - { -- if ( month == 2 ) { -- if ( isLeapYear( year ) ) { -+ if (month == 2) { -+ if (isLeapYear(year)) { - return 29; - } else { - return 28; - } - } - -- if ( month == 4 || month == 6 || month == 9 || month == 11 ) { -+ if (month == 4 || month == 6 || month == 9 || month == 11) { - return 30; - } - - return 31; - } - --int KCalendarSystemJulianPrivate::daysInYear( int year ) const -+int KCalendarSystemJulianPrivate::daysInYear(int year) const - { -- if ( isLeapYear( year ) ) { -+ if (isLeapYear(year)) { - return 366; - } else { - return 365; -@@ -136,13 +136,13 @@ int KCalendarSystemJulianPrivate::daysInWeek() const - return 7; - } - --bool KCalendarSystemJulianPrivate::isLeapYear( int year ) const -+bool KCalendarSystemJulianPrivate::isLeapYear(int year) const - { -- if ( year < 1 ) { -+ if (year < 1) { - year = year + 1; - } - -- if ( year % 4 == 0 ) { -+ if (year % 4 == 0) { - return true; - } - -@@ -179,459 +179,314 @@ int KCalendarSystemJulianPrivate::latestValidYear() const - return 9999; - } - --QString KCalendarSystemJulianPrivate::monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive ) const -+QString KCalendarSystemJulianPrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const - { -- Q_UNUSED( year ); -+ Q_UNUSED(year); - -- if ( format == KLocale::NarrowName ) { -- switch ( month ) { -+ if (format == KLocale::NarrowName) { -+ switch (month) { - case 1: -- return ki18nc( "Julian month 1 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Julian month 1 - KLocale::NarrowName", "J").toString(locale()); - case 2: -- return ki18nc( "Julian month 2 - KLocale::NarrowName", "F" ).toString( locale() ); -+ return ki18nc("Julian month 2 - KLocale::NarrowName", "F").toString(locale()); - case 3: -- return ki18nc( "Julian month 3 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Julian month 3 - KLocale::NarrowName", "M").toString(locale()); - case 4: -- return ki18nc( "Julian month 4 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Julian month 4 - KLocale::NarrowName", "A").toString(locale()); - case 5: -- return ki18nc( "Julian month 5 - KLocale::NarrowName", "M" ).toString( locale() ); -+ return ki18nc("Julian month 5 - KLocale::NarrowName", "M").toString(locale()); - case 6: -- return ki18nc( "Julian month 6 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Julian month 6 - KLocale::NarrowName", "J").toString(locale()); - case 7: -- return ki18nc( "Julian month 7 - KLocale::NarrowName", "J" ).toString( locale() ); -+ return ki18nc("Julian month 7 - KLocale::NarrowName", "J").toString(locale()); - case 8: -- return ki18nc( "Julian month 8 - KLocale::NarrowName", "A" ).toString( locale() ); -+ return ki18nc("Julian month 8 - KLocale::NarrowName", "A").toString(locale()); - case 9: -- return ki18nc( "Julian month 9 - KLocale::NarrowName", "S" ).toString( locale() ); -+ return ki18nc("Julian month 9 - KLocale::NarrowName", "S").toString(locale()); - case 10: -- return ki18nc( "Julian month 10 - KLocale::NarrowName", "O" ).toString( locale() ); -+ return ki18nc("Julian month 10 - KLocale::NarrowName", "O").toString(locale()); - case 11: -- return ki18nc( "Julian month 11 - KLocale::NarrowName", "N" ).toString( locale() ); -+ return ki18nc("Julian month 11 - KLocale::NarrowName", "N").toString(locale()); - case 12: -- return ki18nc( "Julian month 12 - KLocale::NarrowName", "D" ).toString( locale() ); -+ return ki18nc("Julian month 12 - KLocale::NarrowName", "D").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Julian month 1 - KLocale::ShortName Possessive", "of Jan" ).toString( locale() ); -+ return ki18nc("Julian month 1 - KLocale::ShortName Possessive", "of Jan").toString(locale()); - case 2: -- return ki18nc( "Julian month 2 - KLocale::ShortName Possessive", "of Feb" ).toString( locale() ); -+ return ki18nc("Julian month 2 - KLocale::ShortName Possessive", "of Feb").toString(locale()); - case 3: -- return ki18nc( "Julian month 3 - KLocale::ShortName Possessive", "of Mar" ).toString( locale() ); -+ return ki18nc("Julian month 3 - KLocale::ShortName Possessive", "of Mar").toString(locale()); - case 4: -- return ki18nc( "Julian month 4 - KLocale::ShortName Possessive", "of Apr" ).toString( locale() ); -+ return ki18nc("Julian month 4 - KLocale::ShortName Possessive", "of Apr").toString(locale()); - case 5: -- return ki18nc( "Julian month 5 - KLocale::ShortName Possessive", "of May" ).toString( locale() ); -+ return ki18nc("Julian month 5 - KLocale::ShortName Possessive", "of May").toString(locale()); - case 6: -- return ki18nc( "Julian month 6 - KLocale::ShortName Possessive", "of Jun" ).toString( locale() ); -+ return ki18nc("Julian month 6 - KLocale::ShortName Possessive", "of Jun").toString(locale()); - case 7: -- return ki18nc( "Julian month 7 - KLocale::ShortName Possessive", "of Jul" ).toString( locale() ); -+ return ki18nc("Julian month 7 - KLocale::ShortName Possessive", "of Jul").toString(locale()); - case 8: -- return ki18nc( "Julian month 8 - KLocale::ShortName Possessive", "of Aug" ).toString( locale() ); -+ return ki18nc("Julian month 8 - KLocale::ShortName Possessive", "of Aug").toString(locale()); - case 9: -- return ki18nc( "Julian month 9 - KLocale::ShortName Possessive", "of Sep" ).toString( locale() ); -+ return ki18nc("Julian month 9 - KLocale::ShortName Possessive", "of Sep").toString(locale()); - case 10: -- return ki18nc( "Julian month 10 - KLocale::ShortName Possessive", "of Oct" ).toString( locale() ); -+ return ki18nc("Julian month 10 - KLocale::ShortName Possessive", "of Oct").toString(locale()); - case 11: -- return ki18nc( "Julian month 11 - KLocale::ShortName Possessive", "of Nov" ).toString( locale() ); -+ return ki18nc("Julian month 11 - KLocale::ShortName Possessive", "of Nov").toString(locale()); - case 12: -- return ki18nc( "Julian month 12 - KLocale::ShortName Possessive", "of Dec" ).toString( locale() ); -+ return ki18nc("Julian month 12 - KLocale::ShortName Possessive", "of Dec").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName && !possessive ) { -- switch ( month ) { -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Julian month 1 - KLocale::ShortName", "Jan" ).toString( locale() ); -+ return ki18nc("Julian month 1 - KLocale::ShortName", "Jan").toString(locale()); - case 2: -- return ki18nc( "Julian month 2 - KLocale::ShortName", "Feb" ).toString( locale() ); -+ return ki18nc("Julian month 2 - KLocale::ShortName", "Feb").toString(locale()); - case 3: -- return ki18nc( "Julian month 3 - KLocale::ShortName", "Mar" ).toString( locale() ); -+ return ki18nc("Julian month 3 - KLocale::ShortName", "Mar").toString(locale()); - case 4: -- return ki18nc( "Julian month 4 - KLocale::ShortName", "Apr" ).toString( locale() ); -+ return ki18nc("Julian month 4 - KLocale::ShortName", "Apr").toString(locale()); - case 5: -- return ki18nc( "Julian month 5 - KLocale::ShortName", "May" ).toString( locale() ); -+ return ki18nc("Julian month 5 - KLocale::ShortName", "May").toString(locale()); - case 6: -- return ki18nc( "Julian month 6 - KLocale::ShortName", "Jun" ).toString( locale() ); -+ return ki18nc("Julian month 6 - KLocale::ShortName", "Jun").toString(locale()); - case 7: -- return ki18nc( "Julian month 7 - KLocale::ShortName", "Jul" ).toString( locale() ); -+ return ki18nc("Julian month 7 - KLocale::ShortName", "Jul").toString(locale()); - case 8: -- return ki18nc( "Julian month 8 - KLocale::ShortName", "Aug" ).toString( locale() ); -+ return ki18nc("Julian month 8 - KLocale::ShortName", "Aug").toString(locale()); - case 9: -- return ki18nc( "Julian month 9 - KLocale::ShortName", "Sep" ).toString( locale() ); -+ return ki18nc("Julian month 9 - KLocale::ShortName", "Sep").toString(locale()); - case 10: -- return ki18nc( "Julian month 10 - KLocale::ShortName", "Oct" ).toString( locale() ); -+ return ki18nc("Julian month 10 - KLocale::ShortName", "Oct").toString(locale()); - case 11: -- return ki18nc( "Julian month 11 - KLocale::ShortName", "Nov" ).toString( locale() ); -+ return ki18nc("Julian month 11 - KLocale::ShortName", "Nov").toString(locale()); - case 12: -- return ki18nc( "Julian month 12 - KLocale::ShortName", "Dec" ).toString( locale() ); -+ return ki18nc("Julian month 12 - KLocale::ShortName", "Dec").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::LongName && possessive ) { -- switch ( month ) { -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { - case 1: -- return ki18nc( "Julian month 1 - KLocale::LongName Possessive", "of January" ).toString( locale() ); -+ return ki18nc("Julian month 1 - KLocale::LongName Possessive", "of January").toString(locale()); - case 2: -- return ki18nc( "Julian month 2 - KLocale::LongName Possessive", "of February" ).toString( locale() ); -+ return ki18nc("Julian month 2 - KLocale::LongName Possessive", "of February").toString(locale()); - case 3: -- return ki18nc( "Julian month 3 - KLocale::LongName Possessive", "of March" ).toString( locale() ); -+ return ki18nc("Julian month 3 - KLocale::LongName Possessive", "of March").toString(locale()); - case 4: -- return ki18nc( "Julian month 4 - KLocale::LongName Possessive", "of April" ).toString( locale() ); -+ return ki18nc("Julian month 4 - KLocale::LongName Possessive", "of April").toString(locale()); - case 5: -- return ki18nc( "Julian month 5 - KLocale::LongName Possessive", "of May" ).toString( locale() ); -+ return ki18nc("Julian month 5 - KLocale::LongName Possessive", "of May").toString(locale()); - case 6: -- return ki18nc( "Julian month 6 - KLocale::LongName Possessive", "of June" ).toString( locale() ); -+ return ki18nc("Julian month 6 - KLocale::LongName Possessive", "of June").toString(locale()); - case 7: -- return ki18nc( "Julian month 7 - KLocale::LongName Possessive", "of July" ).toString( locale() ); -+ return ki18nc("Julian month 7 - KLocale::LongName Possessive", "of July").toString(locale()); - case 8: -- return ki18nc( "Julian month 8 - KLocale::LongName Possessive", "of August" ).toString( locale() ); -+ return ki18nc("Julian month 8 - KLocale::LongName Possessive", "of August").toString(locale()); - case 9: -- return ki18nc( "Julian month 9 - KLocale::LongName Possessive", "of September" ).toString( locale() ); -+ return ki18nc("Julian month 9 - KLocale::LongName Possessive", "of September").toString(locale()); - case 10: -- return ki18nc( "Julian month 10 - KLocale::LongName Possessive", "of October" ).toString( locale() ); -+ return ki18nc("Julian month 10 - KLocale::LongName Possessive", "of October").toString(locale()); - case 11: -- return ki18nc( "Julian month 11 - KLocale::LongName Possessive", "of November" ).toString( locale() ); -+ return ki18nc("Julian month 11 - KLocale::LongName Possessive", "of November").toString(locale()); - case 12: -- return ki18nc( "Julian month 12 - KLocale::LongName Possessive", "of December" ).toString( locale() ); -+ return ki18nc("Julian month 12 - KLocale::LongName Possessive", "of December").toString(locale()); - default: - return QString(); - } - } - - // Default to LongName -- switch ( month ) { -+ switch (month) { - case 1: -- return ki18nc( "Julian month 1 - KLocale::LongName", "January" ).toString( locale() ); -+ return ki18nc("Julian month 1 - KLocale::LongName", "January").toString(locale()); - case 2: -- return ki18nc( "Julian month 2 - KLocale::LongName", "February" ).toString( locale() ); -+ return ki18nc("Julian month 2 - KLocale::LongName", "February").toString(locale()); - case 3: -- return ki18nc( "Julian month 3 - KLocale::LongName", "March" ).toString( locale() ); -+ return ki18nc("Julian month 3 - KLocale::LongName", "March").toString(locale()); - case 4: -- return ki18nc( "Julian month 4 - KLocale::LongName", "April" ).toString( locale() ); -+ return ki18nc("Julian month 4 - KLocale::LongName", "April").toString(locale()); - case 5: -- return ki18nc( "Julian month 5 - KLocale::LongName", "May" ).toString( locale() ); -+ return ki18nc("Julian month 5 - KLocale::LongName", "May").toString(locale()); - case 6: -- return ki18nc( "Julian month 6 - KLocale::LongName", "June" ).toString( locale() ); -+ return ki18nc("Julian month 6 - KLocale::LongName", "June").toString(locale()); - case 7: -- return ki18nc( "Julian month 7 - KLocale::LongName", "July" ).toString( locale() ); -+ return ki18nc("Julian month 7 - KLocale::LongName", "July").toString(locale()); - case 8: -- return ki18nc( "Julian month 8 - KLocale::LongName", "August" ).toString( locale() ); -+ return ki18nc("Julian month 8 - KLocale::LongName", "August").toString(locale()); - case 9: -- return ki18nc( "Julian month 9 - KLocale::LongName", "September" ).toString( locale() ); -+ return ki18nc("Julian month 9 - KLocale::LongName", "September").toString(locale()); - case 10: -- return ki18nc( "Julian month 10 - KLocale::LongName", "October" ).toString( locale() ); -+ return ki18nc("Julian month 10 - KLocale::LongName", "October").toString(locale()); - case 11: -- return ki18nc( "Julian month 11 - KLocale::LongName", "November" ).toString( locale() ); -+ return ki18nc("Julian month 11 - KLocale::LongName", "November").toString(locale()); - case 12: -- return ki18nc( "Julian month 12 - KLocale::LongName", "December" ).toString( locale() ); -+ return ki18nc("Julian month 12 - KLocale::LongName", "December").toString(locale()); - default: - return QString(); - } - } - --QString KCalendarSystemJulianPrivate::weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const -+QString KCalendarSystemJulianPrivate::weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const - { -- if ( format == KLocale::NarrowName ) { -- switch ( weekDay ) { -+ if (format == KLocale::NarrowName) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Julian weekday 1 - KLocale::NarrowName ", "M" ).toString( locale() ); -+ return ki18nc("Julian weekday 1 - KLocale::NarrowName ", "M").toString(locale()); - case 2: -- return ki18nc( "Julian weekday 2 - KLocale::NarrowName ", "T" ).toString( locale() ); -+ return ki18nc("Julian weekday 2 - KLocale::NarrowName ", "T").toString(locale()); - case 3: -- return ki18nc( "Julian weekday 3 - KLocale::NarrowName ", "W" ).toString( locale() ); -+ return ki18nc("Julian weekday 3 - KLocale::NarrowName ", "W").toString(locale()); - case 4: -- return ki18nc( "Julian weekday 4 - KLocale::NarrowName ", "T" ).toString( locale() ); -+ return ki18nc("Julian weekday 4 - KLocale::NarrowName ", "T").toString(locale()); - case 5: -- return ki18nc( "Julian weekday 5 - KLocale::NarrowName ", "F" ).toString( locale() ); -+ return ki18nc("Julian weekday 5 - KLocale::NarrowName ", "F").toString(locale()); - case 6: -- return ki18nc( "Julian weekday 6 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Julian weekday 6 - KLocale::NarrowName ", "S").toString(locale()); - case 7: -- return ki18nc( "Julian weekday 7 - KLocale::NarrowName ", "S" ).toString( locale() ); -+ return ki18nc("Julian weekday 7 - KLocale::NarrowName ", "S").toString(locale()); - default: - return QString(); - } - } - -- if ( format == KLocale::ShortName || format == KLocale:: ShortNumber ) { -- switch ( weekDay ) { -+ if (format == KLocale::ShortName || format == KLocale:: ShortNumber) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Julian weekday 1 - KLocale::ShortName", "Mon" ).toString( locale() ); -+ return ki18nc("Julian weekday 1 - KLocale::ShortName", "Mon").toString(locale()); - case 2: -- return ki18nc( "Julian weekday 2 - KLocale::ShortName", "Tue" ).toString( locale() ); -+ return ki18nc("Julian weekday 2 - KLocale::ShortName", "Tue").toString(locale()); - case 3: -- return ki18nc( "Julian weekday 3 - KLocale::ShortName", "Wed" ).toString( locale() ); -+ return ki18nc("Julian weekday 3 - KLocale::ShortName", "Wed").toString(locale()); - case 4: -- return ki18nc( "Julian weekday 4 - KLocale::ShortName", "Thu" ).toString( locale() ); -+ return ki18nc("Julian weekday 4 - KLocale::ShortName", "Thu").toString(locale()); - case 5: -- return ki18nc( "Julian weekday 5 - KLocale::ShortName", "Fri" ).toString( locale() ); -+ return ki18nc("Julian weekday 5 - KLocale::ShortName", "Fri").toString(locale()); - case 6: -- return ki18nc( "Julian weekday 6 - KLocale::ShortName", "Sat" ).toString( locale() ); -+ return ki18nc("Julian weekday 6 - KLocale::ShortName", "Sat").toString(locale()); - case 7: -- return ki18nc( "Julian weekday 7 - KLocale::ShortName", "Sun" ).toString( locale() ); -+ return ki18nc("Julian weekday 7 - KLocale::ShortName", "Sun").toString(locale()); - default: return QString(); - } - } - -- switch ( weekDay ) { -+ switch (weekDay) { - case 1: -- return ki18nc( "Julian weekday 1 - KLocale::LongName", "Monday" ).toString( locale() ); -+ return ki18nc("Julian weekday 1 - KLocale::LongName", "Monday").toString(locale()); - case 2: -- return ki18nc( "Julian weekday 2 - KLocale::LongName", "Tuesday" ).toString( locale() ); -+ return ki18nc("Julian weekday 2 - KLocale::LongName", "Tuesday").toString(locale()); - case 3: -- return ki18nc( "Julian weekday 3 - KLocale::LongName", "Wednesday" ).toString( locale() ); -+ return ki18nc("Julian weekday 3 - KLocale::LongName", "Wednesday").toString(locale()); - case 4: -- return ki18nc( "Julian weekday 4 - KLocale::LongName", "Thursday" ).toString( locale() ); -+ return ki18nc("Julian weekday 4 - KLocale::LongName", "Thursday").toString(locale()); - case 5: -- return ki18nc( "Julian weekday 5 - KLocale::LongName", "Friday" ).toString( locale() ); -+ return ki18nc("Julian weekday 5 - KLocale::LongName", "Friday").toString(locale()); - case 6: -- return ki18nc( "Julian weekday 6 - KLocale::LongName", "Saturday" ).toString( locale() ); -+ return ki18nc("Julian weekday 6 - KLocale::LongName", "Saturday").toString(locale()); - case 7: -- return ki18nc( "Julian weekday 7 - KLocale::LongName", "Sunday" ).toString( locale() ); -+ return ki18nc("Julian weekday 7 - KLocale::LongName", "Sunday").toString(locale()); - default: - return QString(); - } - } - - --KCalendarSystemJulian::KCalendarSystemJulian( const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemJulianPrivate( this ), KSharedConfig::Ptr(), locale ), -- dont_use( 0 ) -+KCalendarSystemJulian::KCalendarSystemJulian(const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemJulianPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemJulian::KCalendarSystemJulian( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( *new KCalendarSystemJulianPrivate( this ), config, locale ), -- dont_use( 0 ) -+KCalendarSystemJulian::KCalendarSystemJulian(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemJulianPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemJulian::KCalendarSystemJulian( KCalendarSystemJulianPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystem( dd, config, locale ), -- dont_use( 0 ) -+KCalendarSystemJulian::KCalendarSystemJulian(KCalendarSystemJulianPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemJulian::~KCalendarSystemJulian() - { -- delete dont_use; - } - - QString KCalendarSystemJulian::calendarType() const - { -- return QLatin1String( "julian" ); -+ return QLatin1String("julian"); - } - - QDate KCalendarSystemJulian::epoch() const - { -- return QDate::fromJulianDay( 1721426 ); -+ return QDate::fromJulianDay(1721426); - } - - QDate KCalendarSystemJulian::earliestValidDate() const - { - // 1 Jan 4712 BC, no year zero, cant be 4713BC due to error in QDate that day 0 is not valid - // and we really need the first in each year to be valid for the date maths -- return QDate::fromJulianDay( 366 ); -+ return QDate::fromJulianDay(366); - } - - QDate KCalendarSystemJulian::latestValidDate() const - { - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - // 31 Dec 9999 AD, no year zero -- return QDate::fromJulianDay( 5373557 ); -+ return QDate::fromJulianDay(5373557); - } - --bool KCalendarSystemJulian::isValid( int year, int month, int day ) const -+bool KCalendarSystemJulian::isValid(int year, int month, int day) const - { -- return KCalendarSystem::isValid( year, month, day ); -+ return KCalendarSystem::isValid(year, month, day); - } - --bool KCalendarSystemJulian::isValid( const QDate &date ) const -+bool KCalendarSystemJulian::isValid(const QDate &date) const - { -- return KCalendarSystem::isValid( date ); -+ return KCalendarSystem::isValid(date); - } - --bool KCalendarSystemJulian::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemJulian::isLeapYear(int year) const - { -- return KCalendarSystem::setDate( date, year, month, day ); -+ return KCalendarSystem::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemJulian::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemJulian::isLeapYear(const QDate &date) const - { -- return KCalendarSystem::setDate( date, y, m, d ); -+ return KCalendarSystem::isLeapYear(date); - } - --int KCalendarSystemJulian::year( const QDate &date ) const -+QString KCalendarSystemJulian::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystem::year( date ); -+ return KCalendarSystem::monthName(month, year, format); - } - --int KCalendarSystemJulian::month( const QDate &date ) const -+QString KCalendarSystemJulian::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystem::month( date ); -+ return KCalendarSystem::monthName(date, format); - } - --int KCalendarSystemJulian::day( const QDate &date ) const -+QString KCalendarSystemJulian::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystem::day( date ); -+ return KCalendarSystem::weekDayName(weekDay, format); - } - --QDate KCalendarSystemJulian::addYears( const QDate &date, int nyears ) const -+QString KCalendarSystemJulian::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystem::addYears( date, nyears ); --} -- --QDate KCalendarSystemJulian::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystem::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemJulian::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystem::addDays( date, ndays ); --} -- --int KCalendarSystemJulian::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystem::monthsInYear( date ); --} -- --int KCalendarSystemJulian::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystem::weeksInYear( date ); --} -- --int KCalendarSystemJulian::weeksInYear( int year ) const --{ -- return KCalendarSystem::weeksInYear( year ); --} -- --int KCalendarSystemJulian::daysInYear( const QDate &date ) const --{ -- return KCalendarSystem::daysInYear( date ); --} -- --int KCalendarSystemJulian::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystem::daysInMonth( date ); --} -- --int KCalendarSystemJulian::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystem::daysInWeek( date ); --} -- --int KCalendarSystemJulian::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystem::dayOfYear( date ); --} -- --int KCalendarSystemJulian::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystem::dayOfWeek( date ); --} -- --int KCalendarSystemJulian::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystem::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemJulian::isLeapYear( int year ) const --{ -- return KCalendarSystem::isLeapYear( year ); --} -- --bool KCalendarSystemJulian::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystem::isLeapYear( date ); --} -- --QString KCalendarSystemJulian::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystem::monthName( month, year, format ); --} -- --QString KCalendarSystemJulian::monthName( const QDate &date, MonthNameFormat format ) const --{ -- 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 ); --} -- --QString KCalendarSystemJulian::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::yearString( pDate, format ); --} -- --QString KCalendarSystemJulian::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::monthString( pDate, format ); --} -- --QString KCalendarSystemJulian::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystem::dayString( pDate, format ); --} -- --int KCalendarSystemJulian::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemJulian::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemJulian::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystem::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemJulian::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystem::formatDate( date, format ); --} -- --QDate KCalendarSystemJulian::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, ok ); --} -- --QDate KCalendarSystemJulian::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystem::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemJulian::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystem::readDate( str, flags, ok ); --} -- --int KCalendarSystemJulian::weekStartDay() const --{ -- return KCalendarSystem::weekStartDay(); -+ return KCalendarSystem::weekDayName(date, format); - } - - int KCalendarSystemJulian::weekDayOfPray() const -@@ -659,7 +514,7 @@ bool KCalendarSystemJulian::isProleptic() const - return true; - } - --bool KCalendarSystemJulian::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemJulian::julianDayToDate(int jd, int &year, int &month, int &day) const - { - // Formula from The Calendar FAQ by Claus Tondering - // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -@@ -668,23 +523,23 @@ bool KCalendarSystemJulian::julianDayToDate( int jd, int &year, int &month, int - - int b = 0; - int c = jd + 32082; -- int d = ( ( 4 * c ) + 3 ) / 1461; -- int e = c - ( ( 1461 * d ) / 4 ); -- int m = ( ( 5 * e ) + 2 ) / 153; -- day = e - ( ( (153 * m ) + 2 ) / 5 ) + 1; -- month = m + 3 - ( 12 * ( m / 10 ) ); -- year = ( 100 * b ) + d - 4800 + ( m / 10 ); -+ int d = ((4 * c) + 3) / 1461; -+ int e = c - ((1461 * d) / 4); -+ int m = ((5 * e) + 2) / 153; -+ day = e - (((153 * m) + 2) / 5) + 1; -+ month = m + 3 - (12 * (m / 10)); -+ year = (100 * b) + d - 4800 + (m / 10); - - // If year is -ve then is BC. In Julian there is no year 0, but the maths - // is easier if we pretend there is, so internally year of 0 = 1BC = -1 outside -- if ( year < 1 ) { -+ if (year < 1) { - year = year - 1; - } - - return true; - } - --bool KCalendarSystemJulian::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemJulian::dateToJulianDay(int year, int month, int day, int &jd) const - { - // Formula from The Calendar FAQ by Claus Tondering - // http://www.tondering.dk/claus/cal/node3.html#SECTION003161000000000000000 -@@ -694,20 +549,20 @@ bool KCalendarSystemJulian::dateToJulianDay( int year, int month, int day, int & - // If year is -ve then is BC. In Julian there is no year 0, but the maths - // is easier if we pretend there is, so internally year of -1 = 1BC = 0 internally - int y; -- if ( year < 1 ) { -+ if (year < 1) { - y = year + 1; - } else { - y = year; - } - -- int a = ( 14 - month ) / 12; -+ int a = (14 - month) / 12; - y = y + 4800 - a; -- int m = month + ( 12 * a ) - 3; -+ int m = month + (12 * a) - 3; - - jd = day -- + ( ( ( 153 * m ) + 2 ) / 5 ) -- + ( 365 * y ) -- + ( y / 4 ) -+ + (((153 * m) + 2) / 5) -+ + (365 * y) -+ + (y / 4) - - 32083; - - return true; -diff --git a/kdecore/date/kcalendarsystemjulian_p.h b/kdecore/date/kcalendarsystemjulian_p.h -index 5976567..ebcad4a 100644 ---- a/kdecore/date/kcalendarsystemjulian_p.h -+++ b/kdecore/date/kcalendarsystemjulian_p.h -@@ -41,8 +41,8 @@ class KCalendarSystemJulianPrivate; - class KCalendarSystemJulian: public KCalendarSystem - { - public: -- explicit KCalendarSystemJulian( const KLocale *locale = 0 ); -- explicit KCalendarSystemJulian( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemJulian(const KLocale *locale = 0); -+ explicit KCalendarSystemJulian(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemJulian(); - - virtual QString calendarType() const; -@@ -50,58 +50,19 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -109,15 +70,14 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemJulian( KCalendarSystemJulianPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemJulian(KCalendarSystemJulianPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: -- Q_DECLARE_PRIVATE( KCalendarSystemJulian ) -- KCalendarSystemJulianPrivate * const dont_use; // KDE5 remove, use shared d -+ Q_DECLARE_PRIVATE(KCalendarSystemJulian) - }; - - #endif // KCALENDARSYSTEMJULIAN_H -diff --git a/kdecore/date/kcalendarsystemminguo.cpp b/kdecore/date/kcalendarsystemminguo.cpp -index 0230f93..66aea58 100644 ---- a/kdecore/date/kcalendarsystemminguo.cpp -+++ b/kdecore/date/kcalendarsystemminguo.cpp -@@ -18,30 +18,30 @@ - */ - - #include "kcalendarsystemminguo_p.h" --#include "kcalendarsystemgregorianprolepticprivate_p.h" -+#include "kcalendarsystemgregorianprivate_p.h" - - #include "kdebug.h" - #include "klocale.h" - - #include <QtCore/QDate> - --//Reuse the Gregorian Proleptic private implementation --class KCalendarSystemMinguoPrivate : public KCalendarSystemGregorianProlepticPrivate -+//Reuse the Gregorian private implementation -+class KCalendarSystemMinguoPrivate : public KCalendarSystemGregorianPrivate - { - public: -- explicit KCalendarSystemMinguoPrivate( KCalendarSystemMinguo *q ); -+ explicit KCalendarSystemMinguoPrivate(KCalendarSystemMinguo *q); - virtual ~KCalendarSystemMinguoPrivate(); - - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual bool isLeapYear( int year ) const; -+ virtual bool isLeapYear(int year) const; - virtual int earliestValidYear() const; - }; - --//Override only a few of the Gregorian Proleptic private methods -+//Override only a few of the Gregorian private methods - --KCalendarSystemMinguoPrivate::KCalendarSystemMinguoPrivate( KCalendarSystemMinguo *q ) -- : KCalendarSystemGregorianProlepticPrivate( q ) -+KCalendarSystemMinguoPrivate::KCalendarSystemMinguoPrivate(KCalendarSystemMinguo *q) -+ : KCalendarSystemGregorianPrivate(q) - { - } - -@@ -58,15 +58,15 @@ void KCalendarSystemMinguoPrivate::loadDefaultEraList() - { - QString name, shortName, format; - -- name = i18nc( "Calendar Era: Taiwan Republic of China Era, years > 0, LongFormat", "Republic of China Era" ); -- shortName = i18nc( "Calendar Era: Taiwan Republic of China Era, years > 0, ShortFormat", "ROC" ); -- format = i18nc( "(kdedt-format) Taiwan, ROC, full era year format used for %EY, e.g. ROC 99", "%EC %Ey" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Taiwan Republic of China Era, years > 0, LongFormat", "Republic of China Era"); -+ shortName = i18nc("Calendar Era: Taiwan Republic of China Era, years > 0, ShortFormat", "ROC"); -+ format = i18nc("(kdedt-format) Taiwan, ROC, full era year format used for %EY, e.g. ROC 99", "%EC %Ey"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --bool KCalendarSystemMinguoPrivate::isLeapYear( int year ) const -+bool KCalendarSystemMinguoPrivate::isLeapYear(int year) const - { -- return KCalendarSystemGregorianProlepticPrivate::isLeapYear( year + 1911 ); -+ return KCalendarSystemGregorianPrivate::isLeapYear(year + 1911); - } - - int KCalendarSystemMinguoPrivate::earliestValidYear() const -@@ -75,23 +75,23 @@ int KCalendarSystemMinguoPrivate::earliestValidYear() const - } - - --KCalendarSystemMinguo::KCalendarSystemMinguo( const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( *new KCalendarSystemMinguoPrivate( this ), KSharedConfig::Ptr(), locale ) -+KCalendarSystemMinguo::KCalendarSystemMinguo(const KLocale *locale) -+ : KCalendarSystemGregorian(*new KCalendarSystemMinguoPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemMinguo::KCalendarSystemMinguo( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( *new KCalendarSystemMinguoPrivate( this ), config, locale ) -+KCalendarSystemMinguo::KCalendarSystemMinguo(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemGregorian(*new KCalendarSystemMinguoPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemMinguo::KCalendarSystemMinguo( KCalendarSystemMinguoPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( dd, config, locale ) -+KCalendarSystemMinguo::KCalendarSystemMinguo(KCalendarSystemMinguoPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemGregorian(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemMinguo::~KCalendarSystemMinguo() -@@ -100,13 +100,13 @@ KCalendarSystemMinguo::~KCalendarSystemMinguo() - - QString KCalendarSystemMinguo::calendarType() const - { -- return QLatin1String( "minguo" ); -+ return QLatin1String("minguo"); - } - - QDate KCalendarSystemMinguo::epoch() const - { - // 0001-01-01 = 1912-01-01 AD Gregorian -- return QDate::fromJulianDay( 2419403 ); -+ return QDate::fromJulianDay(2419403); - } - - QDate KCalendarSystemMinguo::earliestValidDate() const -@@ -118,188 +118,47 @@ QDate KCalendarSystemMinguo::latestValidDate() const - { - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - // 9999-12-31 = 11910-12-31 AD Gregorian -- return QDate::fromJulianDay( 6071462 ); -+ return QDate::fromJulianDay(6071462); - } - --bool KCalendarSystemMinguo::isValid( int year, int month, int day ) const -+bool KCalendarSystemMinguo::isValid(int year, int month, int day) const - { -- return KCalendarSystemGregorianProleptic::isValid( year, month, day ); -+ return KCalendarSystemGregorian::isValid(year, month, day); - } - --bool KCalendarSystemMinguo::isValid( const QDate &date ) const -+bool KCalendarSystemMinguo::isValid(const QDate &date) const - { -- return KCalendarSystemGregorianProleptic::isValid( date ); -+ return KCalendarSystemGregorian::isValid(date); - } - --bool KCalendarSystemMinguo::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemMinguo::isLeapYear(int year) const - { -- return KCalendarSystemGregorianProleptic::setDate( date, year, month, day ); -+ return KCalendarSystemGregorian::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemMinguo::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemMinguo::isLeapYear(const QDate &date) const - { -- return KCalendarSystemGregorianProleptic::setDate( date, y, m, d ); -+ return KCalendarSystemGregorian::isLeapYear(date); - } - --int KCalendarSystemMinguo::year( const QDate &date ) const -+QString KCalendarSystemMinguo::monthName(int month, int year, MonthNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::year( date ); -+ return KCalendarSystemGregorian::monthName(month, year, format); - } - --int KCalendarSystemMinguo::month( const QDate &date ) const -+QString KCalendarSystemMinguo::monthName(const QDate &date, MonthNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::month( date ); -+ return KCalendarSystemGregorian::monthName(date, format); - } - --int KCalendarSystemMinguo::day( const QDate &date ) const -+QString KCalendarSystemMinguo::weekDayName(int weekDay, WeekDayNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::day( date ); -+ return KCalendarSystemGregorian::weekDayName(weekDay, format); - } - --QDate KCalendarSystemMinguo::addYears( const QDate &date, int nyears ) const -+QString KCalendarSystemMinguo::weekDayName(const QDate &date, WeekDayNameFormat format) const - { -- return KCalendarSystemGregorianProleptic::addYears( date, nyears ); --} -- --QDate KCalendarSystemMinguo::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystemGregorianProleptic::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemMinguo::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystemGregorianProleptic::addDays( date, ndays ); --} -- --int KCalendarSystemMinguo::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::monthsInYear( date ); --} -- --int KCalendarSystemMinguo::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::weeksInYear( date ); --} -- --int KCalendarSystemMinguo::weeksInYear( int year ) const --{ -- return KCalendarSystemGregorianProleptic::weeksInYear( year ); --} -- --int KCalendarSystemMinguo::daysInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInYear( date ); --} -- --int KCalendarSystemMinguo::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInMonth( date ); --} -- --int KCalendarSystemMinguo::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInWeek( date ); --} -- --int KCalendarSystemMinguo::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::dayOfYear( date ); --} -- --int KCalendarSystemMinguo::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::dayOfWeek( date ); --} -- --int KCalendarSystemMinguo::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystemGregorianProleptic::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemMinguo::isLeapYear( int year ) const --{ -- return KCalendarSystemGregorianProleptic::isLeapYear( year ); --} -- --bool KCalendarSystemMinguo::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::isLeapYear( date ); --} -- --QString KCalendarSystemMinguo::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthName( month, year, format ); --} -- --QString KCalendarSystemMinguo::monthName( const QDate &date, MonthNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthName( date, format ); --} -- --QString KCalendarSystemMinguo::weekDayName( int weekDay, WeekDayNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::weekDayName( weekDay, format ); --} -- --QString KCalendarSystemMinguo::weekDayName( const QDate &date, WeekDayNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::weekDayName( date, format ); --} -- --QString KCalendarSystemMinguo::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::yearString( pDate, format ); --} -- --QString KCalendarSystemMinguo::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthString( pDate, format ); --} -- --QString KCalendarSystemMinguo::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::dayString( pDate, format ); --} -- --int KCalendarSystemMinguo::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemMinguo::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemMinguo::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemMinguo::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::formatDate( date, format ); --} -- --QDate KCalendarSystemMinguo::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( str, ok ); --} -- --QDate KCalendarSystemMinguo::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemMinguo::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( str, flags, ok ); --} -- --int KCalendarSystemMinguo::weekStartDay() const --{ -- return KCalendarSystemGregorianProleptic::weekStartDay(); -+ return KCalendarSystemGregorian::weekDayName(date, format); - } - - int KCalendarSystemMinguo::weekDayOfPray() const -@@ -309,17 +168,17 @@ int KCalendarSystemMinguo::weekDayOfPray() const - - bool KCalendarSystemMinguo::isLunar() const - { -- return KCalendarSystemGregorianProleptic::isLunar(); -+ return KCalendarSystemGregorian::isLunar(); - } - - bool KCalendarSystemMinguo::isLunisolar() const - { -- return KCalendarSystemGregorianProleptic::isLunisolar(); -+ return KCalendarSystemGregorian::isLunisolar(); - } - - bool KCalendarSystemMinguo::isSolar() const - { -- return KCalendarSystemGregorianProleptic::isSolar(); -+ return KCalendarSystemGregorian::isSolar(); - } - - bool KCalendarSystemMinguo::isProleptic() const -@@ -327,15 +186,15 @@ bool KCalendarSystemMinguo::isProleptic() const - return false; - } - --bool KCalendarSystemMinguo::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemMinguo::julianDayToDate(int jd, int &year, int &month, int &day) const - { -- bool result = KCalendarSystemGregorianProleptic::julianDayToDate( jd, year, month, day ); -+ bool result = KCalendarSystemGregorian::julianDayToDate(jd, year, month, day); - year = year - 1911; - return result; - } - --bool KCalendarSystemMinguo::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemMinguo::dateToJulianDay(int year, int month, int day, int &jd) const - { -- return KCalendarSystemGregorianProleptic::dateToJulianDay( year + 1911, month, day, jd ); -+ return KCalendarSystemGregorian::dateToJulianDay(year + 1911, month, day, jd); - } - -diff --git a/kdecore/date/kcalendarsystemminguo_p.h b/kdecore/date/kcalendarsystemminguo_p.h -index a3f0acc..6e257af 100644 ---- a/kdecore/date/kcalendarsystemminguo_p.h -+++ b/kdecore/date/kcalendarsystemminguo_p.h -@@ -20,7 +20,7 @@ - #ifndef KCALENDARSYSTEMMINGUO_H - #define KCALENDARSYSTEMMINGUO_H - --#include "kcalendarsystemgregorianproleptic_p.h" -+#include "kcalendarsystemgregorian_p.h" - - class KCalendarSystemMinguoPrivate; - -@@ -35,11 +35,11 @@ class KCalendarSystemMinguoPrivate; - * - * @author John Layt <john@layt.net> - */ --class KCalendarSystemMinguo: public KCalendarSystemGregorianProleptic -+class KCalendarSystemMinguo: public KCalendarSystemGregorian - { - public: -- explicit KCalendarSystemMinguo( const KLocale *locale = 0 ); -- explicit KCalendarSystemMinguo( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemMinguo(const KLocale *locale = 0); -+ explicit KCalendarSystemMinguo(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemMinguo(); - - virtual QString calendarType() const; -@@ -47,58 +47,19 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -+ virtual QString monthName(int month, int year, MonthNameFormat format = LongName) const; -+ virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const; - -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -+ virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const; -+ virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const; - -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -106,11 +67,11 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemMinguo( KCalendarSystemMinguoPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemMinguo(KCalendarSystemMinguoPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: - Q_DECLARE_PRIVATE(KCalendarSystemMinguo) -diff --git a/kdecore/date/kcalendarsystemprivate_p.h b/kdecore/date/kcalendarsystemprivate_p.h -index ce3a6bc..406fece 100644 ---- a/kdecore/date/kcalendarsystemprivate_p.h -+++ b/kdecore/date/kcalendarsystemprivate_p.h -@@ -28,8 +28,7 @@ class KCalendarSystem; - class KCalendarEra; - class KLocale; - --struct DateComponents --{ -+struct DateComponents { - int day; - int month; - int year; -@@ -47,74 +46,74 @@ struct DateComponents - class KCalendarSystemPrivate - { - public: -- explicit KCalendarSystemPrivate( KCalendarSystem *q ); -+ explicit KCalendarSystemPrivate(KCalendarSystem *q); - - virtual ~KCalendarSystemPrivate(); - - // Virtual methods each calendar system must re-implement - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual int monthsInYear( int year ) const; -- virtual int daysInMonth( int year, int month ) const; -- virtual int daysInYear( int year ) const; -+ 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 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; -- virtual QString monthName( int month, int year, KLocale::DateTimeComponentFormat format, bool possessive = false ) const; -- virtual QString weekDayName( int weekDay, KLocale::DateTimeComponentFormat format ) const; -+ virtual QString monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive = false) const; -+ virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const; - - // Virtual methods to re-implement if special maths needed -- virtual int week( const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum ) const; -- virtual int isoWeekNumber( const QDate &date, int *yearNum ) const; -- virtual int regularWeekNumber( const QDate &date, int weekStartDay, int firstWeekNumber, int *weekYear ) const; -- virtual int simpleWeekNumber( const QDate &date, int *yearNum ) const; -- virtual int weeksInYear( int year, KLocale::WeekNumberSystem weekNumberSystem ) const; -- virtual int isoWeeksInYear( int year ) const; -- virtual int regularWeeksInYear( int year, int weekStartDay, int firstWeekNumber ) const; -- virtual int simpleWeeksInYear( int year ) const; -+ virtual int week(const QDate &date, KLocale::WeekNumberSystem weekNumberSystem, int *yearNum) const; -+ virtual int isoWeekNumber(const QDate &date, int *yearNum) const; -+ virtual int regularWeekNumber(const QDate &date, int weekStartDay, int firstWeekNumber, int *weekYear) const; -+ virtual int simpleWeekNumber(const QDate &date, int *yearNum) const; -+ virtual int weeksInYear(int year, KLocale::WeekNumberSystem weekNumberSystem) const; -+ virtual int isoWeeksInYear(int year) const; -+ virtual int regularWeeksInYear(int year, int weekStartDay, int firstWeekNumber) const; -+ virtual int simpleWeeksInYear(int year) const; - - // Virtual methods to re-implement if special maths needed - // Currently only Hebrew may need special conversion, rest should be OK -- virtual int yearsDifference( const QDate &fromDate, const QDate &toDate ) const; -- virtual int monthsDifference( const QDate &fromDate, const QDate &toDate ) const; -- virtual void dateDifference( const QDate &fromDate, const QDate &toDate, -- int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction ) const; -+ virtual int yearsDifference(const QDate &fromDate, const QDate &toDate) const; -+ virtual int monthsDifference(const QDate &fromDate, const QDate &toDate) const; -+ virtual void dateDifference(const QDate &fromDate, const QDate &toDate, -+ int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const; - - // Virtual methods to re-implement if special number/string conversion needed - // Currently only Hebrew needs special conversion, rest use KLocale DigitSet -- virtual int integerFromString( const QString &string, int maxLength, int &readLength ) const; -- virtual QString stringFromInteger( int number, int padWidth = 0, QChar padChar = QLatin1Char('0') ) const; -- virtual QString stringFromInteger( int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet ) 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; -+ virtual QString stringFromInteger(int number, int padWidth, QChar padChar, KLocale::DigitSet digitSet) const; - - // Utility functions -- bool setAnyDate( QDate &date, int year, int month, int day ) const; -- int addYears( int startYear, int yearsToAdd ) const; -- int differenceYearNumbers( int fromYear, int toYear ) const; -+ bool setAnyDate(QDate &date, int year, int month, int day) const; -+ int addYears(int startYear, int yearsToAdd) const; -+ int differenceYearNumbers(int fromYear, int toYear) const; - QDate invalidDate() const; -- QString simpleDateString( const QString &str ) const; -- int dayOfYear( const QDate &date ) const; -- int dayOfWeek( const QDate &date ) const; -- QDate firstDayOfYear( int year ) const; -- QDate lastDayOfYear( int year ) const; -- QDate firstDayOfMonth( int year, int month ) const; -- QDate lastDayOfMonth( int year, int month ) const; -+ QString simpleDateString(const QString &str) const; -+ int dayOfYear(const QDate &date) const; -+ int dayOfWeek(const QDate &date) const; -+ QDate firstDayOfYear(int year) const; -+ QDate lastDayOfYear(int year) const; -+ QDate firstDayOfMonth(int year, int month) const; -+ QDate lastDayOfMonth(int year, int month) const; - const KLocale *locale() const; -- void loadEraList( const KConfigGroup & cg ); -- void addEra( char direction, int offset, const QDate &startDate, int startYear, const QDate &endDate, -- const QString &name, const QString &shortName, const QString &format ); -+ void loadEraList(const KConfigGroup & cg); -+ void addEra(char direction, int offset, const QDate &startDate, int startYear, const QDate &endDate, -+ const QString &name, const QString &shortName, const QString &format); - QList<KCalendarEra> *eraList() const; -- KCalendarEra era( const QDate &eraDate ) const; -- KCalendarEra era( const QString &eraName, int yearInEra ) const; -+ KCalendarEra era(const QDate &eraDate) const; -+ KCalendarEra era(const QString &eraName, int yearInEra) const; - int shortYearWindowStartYear() const; -- int applyShortYearWindow( int inputYear ) const; -- void loadShortYearWindowStartYear( const KConfigGroup & cg ); -+ int applyShortYearWindow(int inputYear) const; -+ void loadShortYearWindowStartYear(const KConfigGroup & cg); - KSharedConfig::Ptr config(); -- void loadConfig( const QString & calendarType ); -+ void loadConfig(const QString & calendarType); - - // Global variables each calendar system must initialise - const KCalendarSystem *q; -diff --git a/kdecore/date/kcalendarsystemqdate.cpp b/kdecore/date/kcalendarsystemqdate.cpp -new file mode 100644 -index 0000000..1acf3be ---- /dev/null -+++ b/kdecore/date/kcalendarsystemqdate.cpp -@@ -0,0 +1,561 @@ -+/* -+ Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> -+ Copyright (c) 2002-2003 Hans Petter Bieker <bieker@kde.org> -+ Copyright 2007, 2010 John Layt <john@layt.net> -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+ -+// Derived QDate kde calendar class -+ -+#include "kcalendarsystemqdate_p.h" -+#include "kcalendarsystemprivate_p.h" -+#include "kcalendarera_p.h" -+ -+#include "kdebug.h" -+#include "klocale.h" -+#include "kglobal.h" -+#include "kconfiggroup.h" -+ -+#include <QtCore/QDate> -+#include <QtCore/QCharRef> -+ -+class KCalendarSystemQDatePrivate : public KCalendarSystemPrivate -+{ -+public: -+ explicit KCalendarSystemQDatePrivate(KCalendarSystemQDate *q); -+ -+ virtual ~KCalendarSystemQDatePrivate(); -+ -+ // Virtual methods each calendar system must re-implement -+ virtual KLocale::CalendarSystem calendarSystem() const; -+ virtual void loadDefaultEraList(); -+ 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; -+ 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; -+}; -+ -+// Shared d pointer implementations -+ -+KCalendarSystemQDatePrivate::KCalendarSystemQDatePrivate(KCalendarSystemQDate *q) -+ : KCalendarSystemPrivate(q), -+ m_useCommonEra(false) -+ -+{ -+} -+ -+KCalendarSystemQDatePrivate::~KCalendarSystemQDatePrivate() -+{ -+} -+ -+KLocale::CalendarSystem KCalendarSystemQDatePrivate::calendarSystem() const -+{ -+ return KLocale::QDateCalendar; -+} -+ -+void KCalendarSystemQDatePrivate::loadDefaultEraList() -+{ -+ QString name, shortName, format; -+ -+ KConfigGroup lcg(config(), QString::fromLatin1("Locale")); -+ KConfigGroup cg = lcg.group(QString::fromLatin1("KCalendarSystem %1").arg(q->calendarType(q->calendarSystem()))); -+ m_useCommonEra = cg.readEntry("UseCommonEra", false); -+ -+ if (m_useCommonEra) { -+ name = i18nc("Calendar Era: Gregorian Common Era, years < 0, LongFormat", "Before Common Era"); -+ shortName = i18nc("Calendar Era: Gregorian Common Era, years < 0, ShortFormat", "BCE"); -+ } else { -+ name = i18nc("Calendar Era: Gregorian Christian Era, years < 0, LongFormat", "Before Christ"); -+ shortName = i18nc("Calendar Era: Gregorian Christian Era, years < 0, ShortFormat", "BC"); -+ } -+ format = i18nc("(kdedt-format) Gregorian, BC, full era year format used for %EY, e.g. 2000 BC", "%Ey %EC"); -+ addEra('-', 1, q->epoch().addDays(-1), -1, q->earliestValidDate(), name, shortName, format); -+ -+ if (m_useCommonEra) { -+ name = i18nc("Calendar Era: Gregorian Common Era, years > 0, LongFormat", "Common Era"); -+ shortName = i18nc("Calendar Era: Gregorian Common Era, years > 0, ShortFormat", "CE"); -+ } else { -+ name = i18nc("Calendar Era: Gregorian Christian Era, years > 0, LongFormat", "Anno Domini"); -+ shortName = i18nc("Calendar Era: Gregorian Christian Era, years > 0, ShortFormat", "AD"); -+ } -+ format = i18nc("(kdedt-format) Gregorian, AD, full era year format used for %EY, e.g. 2000 AD", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); -+} -+ -+int KCalendarSystemQDatePrivate::monthsInYear(int year) const -+{ -+ Q_UNUSED(year) -+ return 12; -+} -+ -+int KCalendarSystemQDatePrivate::daysInMonth(int year, int month) const -+{ -+ QDate tempDate(year, month, 1); -+ return tempDate.daysInMonth(); -+} -+ -+int KCalendarSystemQDatePrivate::daysInYear(int year) const -+{ -+ QDate tempDate(year, 1, 1); -+ return tempDate.daysInYear(); -+} -+ -+int KCalendarSystemQDatePrivate::daysInWeek() const -+{ -+ return 7; -+} -+ -+bool KCalendarSystemQDatePrivate::isLeapYear(int year) const -+{ -+ return QDate::isLeapYear(year); -+} -+ -+bool KCalendarSystemQDatePrivate::hasLeapMonths() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemQDatePrivate::hasYearZero() const -+{ -+ return false; -+} -+ -+int KCalendarSystemQDatePrivate::maxDaysInWeek() const -+{ -+ return 7; -+} -+ -+int KCalendarSystemQDatePrivate::maxMonthsInYear() const -+{ -+ return 12; -+} -+ -+int KCalendarSystemQDatePrivate::earliestValidYear() const -+{ -+ return -4712; -+} -+ -+int KCalendarSystemQDatePrivate::latestValidYear() const -+{ -+ return 9999; -+} -+ -+QString KCalendarSystemQDatePrivate::monthName(int month, int year, KLocale::DateTimeComponentFormat format, bool possessive) const -+{ -+ Q_UNUSED(year); -+ -+ if (format == KLocale::NarrowName) { -+ switch (month) { -+ case 1: -+ return ki18nc("Gregorian month 1 - KLocale::NarrowName", "J").toString(locale()); -+ case 2: -+ return ki18nc("Gregorian month 2 - KLocale::NarrowName", "F").toString(locale()); -+ case 3: -+ return ki18nc("Gregorian month 3 - KLocale::NarrowName", "M").toString(locale()); -+ case 4: -+ return ki18nc("Gregorian month 4 - KLocale::NarrowName", "A").toString(locale()); -+ case 5: -+ return ki18nc("Gregorian month 5 - KLocale::NarrowName", "M").toString(locale()); -+ case 6: -+ return ki18nc("Gregorian month 6 - KLocale::NarrowName", "J").toString(locale()); -+ case 7: -+ return ki18nc("Gregorian month 7 - KLocale::NarrowName", "J").toString(locale()); -+ case 8: -+ return ki18nc("Gregorian month 8 - KLocale::NarrowName", "A").toString(locale()); -+ case 9: -+ return ki18nc("Gregorian month 9 - KLocale::NarrowName", "S").toString(locale()); -+ case 10: -+ return ki18nc("Gregorian month 10 - KLocale::NarrowName", "O").toString(locale()); -+ case 11: -+ return ki18nc("Gregorian month 11 - KLocale::NarrowName", "N").toString(locale()); -+ case 12: -+ return ki18nc("Gregorian month 12 - KLocale::NarrowName", "D").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ if (format == KLocale::ShortName && possessive) { -+ switch (month) { -+ case 1: -+ return ki18nc("Gregorian month 1 - KLocale::ShortName Possessive", "of Jan").toString(locale()); -+ case 2: -+ return ki18nc("Gregorian month 2 - KLocale::ShortName Possessive", "of Feb").toString(locale()); -+ case 3: -+ return ki18nc("Gregorian month 3 - KLocale::ShortName Possessive", "of Mar").toString(locale()); -+ case 4: -+ return ki18nc("Gregorian month 4 - KLocale::ShortName Possessive", "of Apr").toString(locale()); -+ case 5: -+ return ki18nc("Gregorian month 5 - KLocale::ShortName Possessive", "of May").toString(locale()); -+ case 6: -+ return ki18nc("Gregorian month 6 - KLocale::ShortName Possessive", "of Jun").toString(locale()); -+ case 7: -+ return ki18nc("Gregorian month 7 - KLocale::ShortName Possessive", "of Jul").toString(locale()); -+ case 8: -+ return ki18nc("Gregorian month 8 - KLocale::ShortName Possessive", "of Aug").toString(locale()); -+ case 9: -+ return ki18nc("Gregorian month 9 - KLocale::ShortName Possessive", "of Sep").toString(locale()); -+ case 10: -+ return ki18nc("Gregorian month 10 - KLocale::ShortName Possessive", "of Oct").toString(locale()); -+ case 11: -+ return ki18nc("Gregorian month 11 - KLocale::ShortName Possessive", "of Nov").toString(locale()); -+ case 12: -+ return ki18nc("Gregorian month 12 - KLocale::ShortName Possessive", "of Dec").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ if (format == KLocale::ShortName && !possessive) { -+ switch (month) { -+ case 1: -+ return ki18nc("Gregorian month 1 - KLocale::ShortName", "Jan").toString(locale()); -+ case 2: -+ return ki18nc("Gregorian month 2 - KLocale::ShortName", "Feb").toString(locale()); -+ case 3: -+ return ki18nc("Gregorian month 3 - KLocale::ShortName", "Mar").toString(locale()); -+ case 4: -+ return ki18nc("Gregorian month 4 - KLocale::ShortName", "Apr").toString(locale()); -+ case 5: -+ return ki18nc("Gregorian month 5 - KLocale::ShortName", "May").toString(locale()); -+ case 6: -+ return ki18nc("Gregorian month 6 - KLocale::ShortName", "Jun").toString(locale()); -+ case 7: -+ return ki18nc("Gregorian month 7 - KLocale::ShortName", "Jul").toString(locale()); -+ case 8: -+ return ki18nc("Gregorian month 8 - KLocale::ShortName", "Aug").toString(locale()); -+ case 9: -+ return ki18nc("Gregorian month 9 - KLocale::ShortName", "Sep").toString(locale()); -+ case 10: -+ return ki18nc("Gregorian month 10 - KLocale::ShortName", "Oct").toString(locale()); -+ case 11: -+ return ki18nc("Gregorian month 11 - KLocale::ShortName", "Nov").toString(locale()); -+ case 12: -+ return ki18nc("Gregorian month 12 - KLocale::ShortName", "Dec").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ if (format == KLocale::LongName && possessive) { -+ switch (month) { -+ case 1: -+ return ki18nc("Gregorian month 1 - KLocale::LongName Possessive", "of January").toString(locale()); -+ case 2: -+ return ki18nc("Gregorian month 2 - KLocale::LongName Possessive", "of February").toString(locale()); -+ case 3: -+ return ki18nc("Gregorian month 3 - KLocale::LongName Possessive", "of March").toString(locale()); -+ case 4: -+ return ki18nc("Gregorian month 4 - KLocale::LongName Possessive", "of April").toString(locale()); -+ case 5: -+ return ki18nc("Gregorian month 5 - KLocale::LongName Possessive", "of May").toString(locale()); -+ case 6: -+ return ki18nc("Gregorian month 6 - KLocale::LongName Possessive", "of June").toString(locale()); -+ case 7: -+ return ki18nc("Gregorian month 7 - KLocale::LongName Possessive", "of July").toString(locale()); -+ case 8: -+ return ki18nc("Gregorian month 8 - KLocale::LongName Possessive", "of August").toString(locale()); -+ case 9: -+ return ki18nc("Gregorian month 9 - KLocale::LongName Possessive", "of September").toString(locale()); -+ case 10: -+ return ki18nc("Gregorian month 10 - KLocale::LongName Possessive", "of October").toString(locale()); -+ case 11: -+ return ki18nc("Gregorian month 11 - KLocale::LongName Possessive", "of November").toString(locale()); -+ case 12: -+ return ki18nc("Gregorian month 12 - KLocale::LongName Possessive", "of December").toString(locale()); -+ default: -+ return QString(); -+ } -+ } -+ -+ // Default to LongName -+ switch (month) { -+ case 1: -+ return ki18nc("Gregorian month 1 - KLocale::LongName", "January").toString(locale()); -+ case 2: -+ return ki18nc("Gregorian month 2 - KLocale::LongName", "February").toString(locale()); -+ case 3: -+ return ki18nc("Gregorian month 3 - KLocale::LongName", "March").toString(locale()); -+ case 4: -+ return ki18nc("Gregorian month 4 - KLocale::LongName", "April").toString(locale()); -+ case 5: -+ return ki18nc("Gregorian month 5 - KLocale::LongName", "May").toString(locale()); -+ case 6: -+ return ki18nc("Gregorian month 6 - KLocale::LongName", "June").toString(locale()); -+ case 7: -+ return ki18nc("Gregorian month 7 - KLocale::LongName", "July").toString(locale()); -+ case 8: -+ return ki18nc("Gregorian month 8 - KLocale::LongName", "August").toString(locale()); -+ case 9: -+ return ki18nc("Gregorian month 9 - KLocale::LongName", "September").toString(locale()); -+ case 10: -+ return ki18nc("Gregorian month 10 - KLocale::LongName", "October").toString(locale()); -+ case 11: -+ return ki18nc("Gregorian month 11 - KLocale::LongName", "November").toString(locale()); -+ case 12: -+ return ki18nc("Gregorian month 12 - KLocale::LongName", "December").toString(locale()); -+ default: -+ return QString(); -+ } -+} -+ -+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 KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemQDatePrivate(this), KSharedConfig::Ptr(), locale) -+{ -+ d_ptr->loadConfig(calendarType()); -+} -+ -+KCalendarSystemQDate::KCalendarSystemQDate(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(*new KCalendarSystemQDatePrivate(this), config, locale) -+{ -+ d_ptr->loadConfig(calendarType()); -+} -+ -+KCalendarSystemQDate::KCalendarSystemQDate(KCalendarSystemQDatePrivate &dd, const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystem(dd, config, locale) -+{ -+ d_ptr->loadConfig(calendarType()); -+} -+ -+KCalendarSystemQDate::~KCalendarSystemQDate() -+{ -+} -+ -+QString KCalendarSystemQDate::calendarType() const -+{ -+ return QLatin1String("gregorian"); -+} -+ -+QDate KCalendarSystemQDate::epoch() const -+{ -+ // 1 Jan 1 AD in Julian -+ return QDate::fromJulianDay(1721424); -+} -+ -+QDate KCalendarSystemQDate::earliestValidDate() const -+{ -+ // 1 Jan 4712 BC, no year zero, cant be 4713BC due to error in QDate that day 0 is not valid -+ // and we really need the first in each year to be valid for the date maths -+ return QDate::fromJulianDay(366); -+} -+ -+QDate KCalendarSystemQDate::latestValidDate() const -+{ -+ // Set to last day of year 9999 until confirm date formats & widets support > 9999 -+ // In Gregorian this is 9999-12-31, which is is jd 5373484 -+ // Can't call setDate( 9999, 12, 31 ) as it creates circular reference! -+ return QDate::fromJulianDay(5373484); -+} -+ -+bool KCalendarSystemQDate::isValid(int year, int month, int day) const -+{ -+ // Limit to max year 9999 for now, QDate allows to be greater -+ if (year <= 9999) { -+ return QDate::isValid(year, month, day); -+ } -+ -+ return false; -+} -+ -+bool KCalendarSystemQDate::isValid(const QDate &date) const -+{ -+ return KCalendarSystem::isValid(date); -+} -+ -+int KCalendarSystemQDate::year(const QDate &date) const -+{ -+ return date.year(); -+} -+ -+int KCalendarSystemQDate::month(const QDate &date) const -+{ -+ return date.month(); -+} -+ -+int KCalendarSystemQDate::day(const QDate &date) const -+{ -+ return date.day(); -+} -+ -+int KCalendarSystemQDate::daysInYear(const QDate &date) const -+{ -+ return date.daysInYear(); -+} -+ -+int KCalendarSystemQDate::daysInMonth(const QDate &date) const -+{ -+ return date.daysInMonth(); -+} -+ -+int KCalendarSystemQDate::dayOfYear(const QDate &date) const -+{ -+ return date.dayOfYear(); -+} -+ -+int KCalendarSystemQDate::dayOfWeek(const QDate &date) const -+{ -+ return date.dayOfWeek(); -+} -+ -+bool KCalendarSystemQDate::isLeapYear(int year) const -+{ -+ return QDate::isLeapYear(year); -+} -+ -+bool KCalendarSystemQDate::isLeapYear(const QDate &date) const -+{ -+ return QDate::isLeapYear(date.year()); -+} -+ -+QString KCalendarSystemQDate::monthName(int month, int year, MonthNameFormat format) const -+{ -+ return KCalendarSystem::monthName(month, year, format); -+} -+ -+QString KCalendarSystemQDate::monthName(const QDate &date, MonthNameFormat format) const -+{ -+ 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); -+} -+ -+int KCalendarSystemQDate::weekDayOfPray() const -+{ -+ return 7; // sunday -+} -+ -+bool KCalendarSystemQDate::isLunar() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemQDate::isLunisolar() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemQDate::isSolar() const -+{ -+ return true; -+} -+ -+bool KCalendarSystemQDate::isProleptic() const -+{ -+ return false; -+} -+ -+bool KCalendarSystemQDate::julianDayToDate(int jd, int &year, int &month, int &day) const -+{ -+ QDate date = QDate::fromJulianDay(jd); -+ -+ date.getDate(&year, &month, &day); -+ -+ return date.isValid(); -+} -+ -+bool KCalendarSystemQDate::dateToJulianDay(int year, int month, int day, int &jd) const -+{ -+ QDate date; -+ -+ date.setDate(year, month, day); -+ jd = date.toJulianDay(); -+ -+ return date.isValid(); -+} -diff --git a/kdecore/date/kcalendarsystemqdate_p.h b/kdecore/date/kcalendarsystemqdate_p.h -new file mode 100644 -index 0000000..5d86bd6 ---- /dev/null -+++ b/kdecore/date/kcalendarsystemqdate_p.h -@@ -0,0 +1,93 @@ -+/* -+ Copyright (c) 2002 Carlos Moro <cfmoro@correo.uniovi.es> -+ Copyright (c) 2002 Hans Petter Bieker <bieker@kde.org> -+ Copyright 2007, 2010 John Layt <john@layt.net> -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public License -+ along with this library; see the file COPYING.LIB. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. -+*/ -+ -+#ifndef KCALENDARSYSTEMQDATE_H -+#define KCALENDARSYSTEMQDATE_H -+ -+#include "kcalendarsystem.h" -+ -+class KCalendarSystemQDatePrivate; -+ -+/** -+ * @internal -+ * This is the QDate calendar implementation which combines the Julian and Gregorian -+ * calculations into a single calendar. It should always be used by default in Qt -+ * applications for consistency. -+ * -+ * @b license GNU-LGPL v.2+ -+ * -+ * @see KLocale,KCalendarSystem -+ * -+ * @author John Layt <john@layt.net> -+ */ -+class KCalendarSystemQDate: public KCalendarSystem -+{ -+public: -+ explicit KCalendarSystemQDate(const KLocale *locale = 0); -+ explicit KCalendarSystemQDate(const KSharedConfig::Ptr config, const KLocale *locale = 0); -+ virtual ~KCalendarSystemQDate(); -+ -+ virtual QString calendarType() const; -+ -+ virtual QDate epoch() const; -+ virtual QDate earliestValidDate() const; -+ virtual QDate latestValidDate() const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; -+ -+ virtual int year(const QDate &date) const; -+ virtual int month(const QDate &date) const; -+ virtual int day(const QDate &date) const; -+ -+ virtual int daysInYear(const QDate &date) const; -+ virtual int daysInMonth(const QDate &date) const; -+ -+ virtual int dayOfYear(const QDate &date) const; -+ virtual int dayOfWeek(const QDate &date) const; -+ -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; -+ -+ 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 weekDayOfPray() const; -+ -+ virtual bool isLunar() const; -+ virtual bool isLunisolar() const; -+ virtual bool isSolar() const; -+ virtual bool isProleptic() const; -+ -+protected: -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemQDate(KCalendarSystemQDatePrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); -+ -+private: -+ Q_DECLARE_PRIVATE(KCalendarSystemQDate) -+}; -+ -+#endif -diff --git a/kdecore/date/kcalendarsystemthai.cpp b/kdecore/date/kcalendarsystemthai.cpp -index ab51aaa..9a1ca5a 100644 ---- a/kdecore/date/kcalendarsystemthai.cpp -+++ b/kdecore/date/kcalendarsystemthai.cpp -@@ -18,31 +18,31 @@ - */ - - #include "kcalendarsystemthai_p.h" --#include "kcalendarsystemgregorianprolepticprivate_p.h" -+#include "kcalendarsystemgregorianprivate_p.h" - - #include "kdebug.h" - #include "klocale.h" - - #include <QtCore/QDate> - --//Reuse the Gregorian Proleptic private implementation --class KCalendarSystemThaiPrivate : public KCalendarSystemGregorianProlepticPrivate -+//Reuse the Gregorian private implementation -+class KCalendarSystemThaiPrivate : public KCalendarSystemGregorianPrivate - { - public: -- explicit KCalendarSystemThaiPrivate( KCalendarSystemThai *q ); -+ explicit KCalendarSystemThaiPrivate(KCalendarSystemThai *q); - virtual ~KCalendarSystemThaiPrivate(); - - virtual KLocale::CalendarSystem calendarSystem() const; - virtual void loadDefaultEraList(); -- virtual bool isLeapYear( int year ) const; -+ virtual bool isLeapYear(int year) const; - virtual bool hasYearZero() const; - virtual int earliestValidYear() const; - }; - --//Override only a few of the Gregorian Proleptic private methods -+//Override only a few of the Gregorian private methods - --KCalendarSystemThaiPrivate::KCalendarSystemThaiPrivate( KCalendarSystemThai *q ) -- : KCalendarSystemGregorianProlepticPrivate( q ) -+KCalendarSystemThaiPrivate::KCalendarSystemThaiPrivate(KCalendarSystemThai *q) -+ : KCalendarSystemGregorianPrivate(q) - { - } - -@@ -59,15 +59,15 @@ void KCalendarSystemThaiPrivate::loadDefaultEraList() - { - QString name, shortName, format; - -- name = i18nc( "Calendar Era: Thai Buddhist Era, years > 0, LongFormat", "Buddhist Era" ); -- shortName = i18nc( "Calendar Era: Thai Buddhist Era, years > 0, ShortFormat", "BE" ); -- format = i18nc( "(kdedt-format) Thai, BE, full era year format used for %EY, e.g. 2000 BE", "%Ey %EC" ); -- addEra( '+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format ); -+ name = i18nc("Calendar Era: Thai Buddhist Era, years > 0, LongFormat", "Buddhist Era"); -+ shortName = i18nc("Calendar Era: Thai Buddhist Era, years > 0, ShortFormat", "BE"); -+ format = i18nc("(kdedt-format) Thai, BE, full era year format used for %EY, e.g. 2000 BE", "%Ey %EC"); -+ addEra('+', 1, q->epoch(), 1, q->latestValidDate(), name, shortName, format); - } - --bool KCalendarSystemThaiPrivate::isLeapYear( int year ) const -+bool KCalendarSystemThaiPrivate::isLeapYear(int year) const - { -- return KCalendarSystemGregorianProlepticPrivate::isLeapYear( year - 543 ); -+ return KCalendarSystemGregorianPrivate::isLeapYear(year - 543); - } - - bool KCalendarSystemThaiPrivate::hasYearZero() const -@@ -81,23 +81,23 @@ int KCalendarSystemThaiPrivate::earliestValidYear() const - } - - --KCalendarSystemThai::KCalendarSystemThai( const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( *new KCalendarSystemThaiPrivate( this ), KSharedConfig::Ptr(), locale ) -+KCalendarSystemThai::KCalendarSystemThai(const KLocale *locale) -+ : KCalendarSystemGregorian(*new KCalendarSystemThaiPrivate(this), KSharedConfig::Ptr(), locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemThai::KCalendarSystemThai( const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( *new KCalendarSystemThaiPrivate( this ), config, locale ) -+KCalendarSystemThai::KCalendarSystemThai(const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemGregorian(*new KCalendarSystemThaiPrivate(this), config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - --KCalendarSystemThai::KCalendarSystemThai( KCalendarSystemThaiPrivate &dd, -- const KSharedConfig::Ptr config, const KLocale *locale ) -- : KCalendarSystemGregorianProleptic( dd, config, locale ) -+KCalendarSystemThai::KCalendarSystemThai(KCalendarSystemThaiPrivate &dd, -+ const KSharedConfig::Ptr config, const KLocale *locale) -+ : KCalendarSystemGregorian(dd, config, locale) - { -- d_ptr->loadConfig( calendarType() ); -+ d_ptr->loadConfig(calendarType()); - } - - KCalendarSystemThai::~KCalendarSystemThai() -@@ -106,13 +106,13 @@ KCalendarSystemThai::~KCalendarSystemThai() - - QString KCalendarSystemThai::calendarType() const - { -- return QLatin1String( "thai" ); -+ return QLatin1String("thai"); - } - - QDate KCalendarSystemThai::epoch() const - { - // 0000-01-01 = 0544-01-01 BC Gregorian = 0544-01-07 BC Julian -- return QDate::fromJulianDay( 1522734 ); -+ return QDate::fromJulianDay(1522734); - } - - QDate KCalendarSystemThai::earliestValidDate() const -@@ -124,188 +124,27 @@ QDate KCalendarSystemThai::latestValidDate() const - { - // Set to last day of year 9999 until confirm date formats & widgets support > 9999 - // 9999-12-31 = 9456-12-31 AD Gregorian -- return QDate::fromJulianDay( 5175158 ); -+ return QDate::fromJulianDay(5175158); - } - --bool KCalendarSystemThai::isValid( int year, int month, int day ) const -+bool KCalendarSystemThai::isValid(int year, int month, int day) const - { -- return KCalendarSystemGregorianProleptic::isValid( year, month, day ); -+ return KCalendarSystemGregorian::isValid(year, month, day); - } - --bool KCalendarSystemThai::isValid( const QDate &date ) const -+bool KCalendarSystemThai::isValid(const QDate &date) const - { -- return KCalendarSystemGregorianProleptic::isValid( date ); -+ return KCalendarSystemGregorian::isValid(date); - } - --bool KCalendarSystemThai::setDate( QDate &date, int year, int month, int day ) const -+bool KCalendarSystemThai::isLeapYear(int year) const - { -- return KCalendarSystemGregorianProleptic::setDate( date, year, month, day ); -+ return KCalendarSystemGregorian::isLeapYear(year); - } - --// Deprecated --bool KCalendarSystemThai::setYMD( QDate &date, int y, int m, int d ) const -+bool KCalendarSystemThai::isLeapYear(const QDate &date) const - { -- return KCalendarSystemGregorianProleptic::setDate( date, y, m, d ); --} -- --int KCalendarSystemThai::year( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::year( date ); --} -- --int KCalendarSystemThai::month( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::month( date ); --} -- --int KCalendarSystemThai::day( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::day( date ); --} -- --QDate KCalendarSystemThai::addYears( const QDate &date, int nyears ) const --{ -- return KCalendarSystemGregorianProleptic::addYears( date, nyears ); --} -- --QDate KCalendarSystemThai::addMonths( const QDate &date, int nmonths ) const --{ -- return KCalendarSystemGregorianProleptic::addMonths( date, nmonths ); --} -- --QDate KCalendarSystemThai::addDays( const QDate &date, int ndays ) const --{ -- return KCalendarSystemGregorianProleptic::addDays( date, ndays ); --} -- --int KCalendarSystemThai::monthsInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::monthsInYear( date ); --} -- --int KCalendarSystemThai::weeksInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::weeksInYear( date ); --} -- --int KCalendarSystemThai::weeksInYear( int year ) const --{ -- return KCalendarSystemGregorianProleptic::weeksInYear( year ); --} -- --int KCalendarSystemThai::daysInYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInYear( date ); --} -- --int KCalendarSystemThai::daysInMonth( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInMonth( date ); --} -- --int KCalendarSystemThai::daysInWeek( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::daysInWeek( date ); --} -- --int KCalendarSystemThai::dayOfYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::dayOfYear( date ); --} -- --int KCalendarSystemThai::dayOfWeek( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::dayOfWeek( date ); --} -- --int KCalendarSystemThai::weekNumber( const QDate &date, int * yearNum ) const --{ -- return KCalendarSystemGregorianProleptic::weekNumber( date, yearNum ); --} -- --bool KCalendarSystemThai::isLeapYear( int year ) const --{ -- return KCalendarSystemGregorianProleptic::isLeapYear( year ); --} -- --bool KCalendarSystemThai::isLeapYear( const QDate &date ) const --{ -- return KCalendarSystemGregorianProleptic::isLeapYear( date ); --} -- --QString KCalendarSystemThai::monthName( int month, int year, MonthNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthName( month, year, format ); --} -- --QString KCalendarSystemThai::monthName( const QDate &date, MonthNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthName( date, format ); --} -- --QString KCalendarSystemThai::weekDayName( int weekDay, WeekDayNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::weekDayName( weekDay, format ); --} -- --QString KCalendarSystemThai::weekDayName( const QDate &date, WeekDayNameFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::weekDayName( date, format ); --} -- --QString KCalendarSystemThai::yearString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::yearString( pDate, format ); --} -- --QString KCalendarSystemThai::monthString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::monthString( pDate, format ); --} -- --QString KCalendarSystemThai::dayString( const QDate &pDate, StringFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::dayString( pDate, format ); --} -- --int KCalendarSystemThai::yearStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::yearStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemThai::monthStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::monthStringToInteger( sNum, iLength ); --} -- --int KCalendarSystemThai::dayStringToInteger( const QString &sNum, int &iLength ) const --{ -- return KCalendarSystemGregorianProleptic::dayStringToInteger( sNum, iLength ); --} -- --QString KCalendarSystemThai::formatDate( const QDate &date, KLocale::DateFormat format ) const --{ -- return KCalendarSystemGregorianProleptic::formatDate( date, format ); --} -- --QDate KCalendarSystemThai::readDate( const QString &str, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( str, ok ); --} -- --QDate KCalendarSystemThai::readDate( const QString &intstr, const QString &fmt, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( intstr, fmt, ok ); --} -- --QDate KCalendarSystemThai::readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok ) const --{ -- return KCalendarSystemGregorianProleptic::readDate( str, flags, ok ); --} -- --int KCalendarSystemThai::weekStartDay() const --{ -- return KCalendarSystemGregorianProleptic::weekStartDay(); -+ return KCalendarSystemGregorian::isLeapYear(date); - } - - int KCalendarSystemThai::weekDayOfPray() const -@@ -315,17 +154,17 @@ int KCalendarSystemThai::weekDayOfPray() const - - bool KCalendarSystemThai::isLunar() const - { -- return KCalendarSystemGregorianProleptic::isLunar(); -+ return KCalendarSystemGregorian::isLunar(); - } - - bool KCalendarSystemThai::isLunisolar() const - { -- return KCalendarSystemGregorianProleptic::isLunisolar(); -+ return KCalendarSystemGregorian::isLunisolar(); - } - - bool KCalendarSystemThai::isSolar() const - { -- return KCalendarSystemGregorianProleptic::isSolar(); -+ return KCalendarSystemGregorian::isSolar(); - } - - bool KCalendarSystemThai::isProleptic() const -@@ -333,15 +172,15 @@ bool KCalendarSystemThai::isProleptic() const - return false; - } - --bool KCalendarSystemThai::julianDayToDate( int jd, int &year, int &month, int &day ) const -+bool KCalendarSystemThai::julianDayToDate(int jd, int &year, int &month, int &day) const - { -- bool result = KCalendarSystemGregorianProleptic::julianDayToDate( jd, year, month, day ); -+ bool result = KCalendarSystemGregorian::julianDayToDate(jd, year, month, day); - year = year + 543; - return result; - } - --bool KCalendarSystemThai::dateToJulianDay( int year, int month, int day, int &jd ) const -+bool KCalendarSystemThai::dateToJulianDay(int year, int month, int day, int &jd) const - { -- return KCalendarSystemGregorianProleptic::dateToJulianDay( year - 543, month, day, jd ); -+ return KCalendarSystemGregorian::dateToJulianDay(year - 543, month, day, jd); - } - -diff --git a/kdecore/date/kcalendarsystemthai_p.h b/kdecore/date/kcalendarsystemthai_p.h -index c0007c0..9aa02a2 100644 ---- a/kdecore/date/kcalendarsystemthai_p.h -+++ b/kdecore/date/kcalendarsystemthai_p.h -@@ -20,7 +20,7 @@ - #ifndef KCALENDARSYSTEMTHAI_H - #define KCALENDARSYSTEMTHAI_H - --#include "kcalendarsystemgregorianproleptic_p.h" -+#include "kcalendarsystemgregorian_p.h" - - class KCalendarSystemThaiPrivate; - -@@ -35,11 +35,11 @@ class KCalendarSystemThaiPrivate; - * - * @author John Layt <john@layt.net> - */ --class KCalendarSystemThai: public KCalendarSystemGregorianProleptic -+class KCalendarSystemThai: public KCalendarSystemGregorian - { - public: -- explicit KCalendarSystemThai( const KLocale *locale = 0 ); -- explicit KCalendarSystemThai( const KSharedConfig::Ptr config, const KLocale *locale = 0 ); -+ explicit KCalendarSystemThai(const KLocale *locale = 0); -+ explicit KCalendarSystemThai(const KSharedConfig::Ptr config, const KLocale *locale = 0); - virtual ~KCalendarSystemThai(); - - virtual QString calendarType() const; -@@ -47,58 +47,13 @@ public: - virtual QDate epoch() const; - virtual QDate earliestValidDate() const; - virtual QDate latestValidDate() const; -- virtual bool isValid( int year, int month, int day ) const; -- virtual bool isValid( const QDate &date ) const; -+ virtual bool isValid(int year, int month, int day) const; -+ virtual bool isValid(const QDate &date) const; - -- virtual bool setDate( QDate &date, int year, int month, int day ) const; -- /** @deprecated */ -- virtual bool setYMD( QDate &date, int year, int month, int day ) const; -+ virtual bool isLeapYear(int year) const; -+ virtual bool isLeapYear(const QDate &date) const; - -- virtual int year( const QDate &date ) const; -- virtual int month( const QDate &date ) const; -- virtual int day( const QDate &date ) const; -- -- virtual QDate addYears( const QDate &date, int nyears ) const; -- virtual QDate addMonths( const QDate &date, int nmonths ) const; -- virtual QDate addDays( const QDate &date, int ndays ) const; -- -- virtual int monthsInYear( const QDate &date ) const; -- virtual int weeksInYear( const QDate &date ) const; -- virtual int weeksInYear( int year ) const; -- virtual int daysInYear( const QDate &date ) const; -- virtual int daysInMonth( const QDate &date ) const; -- virtual int daysInWeek( const QDate &date ) const; -- -- virtual int dayOfYear( const QDate &date ) const; -- virtual int dayOfWeek( const QDate &date ) const; -- -- virtual int weekNumber( const QDate &date, int *yearNum = 0 ) const; -- -- virtual bool isLeapYear( int year ) const; -- virtual bool isLeapYear( const QDate &date ) const; -- -- 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 QString yearString( const QDate & pDate, StringFormat format = LongFormat ) const; -- virtual QString monthString( const QDate &pDate, StringFormat format = LongFormat ) const; -- virtual QString dayString( const QDate &pDate, StringFormat format = LongFormat ) const; -- -- virtual int yearStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int monthStringToInteger( const QString &sNum, int &iLength ) const; -- virtual int dayStringToInteger( const QString &sNum, int &iLength ) const; -- -- virtual QString formatDate( const QDate &fromDate, KLocale::DateFormat toFormat = KLocale::LongDate ) const; -- -- virtual QDate readDate( const QString &str, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &dateString, const QString &dateFormat, bool *ok = 0 ) const; -- virtual QDate readDate( const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0 ) const; -- -- virtual int weekStartDay() const; -- virtual int weekDayOfPray () const; -+ virtual int weekDayOfPray() const; - - virtual bool isLunar() const; - virtual bool isLunisolar() const; -@@ -106,11 +61,11 @@ public: - virtual bool isProleptic() const; - - protected: -- virtual bool julianDayToDate( int jd, int &year, int &month, int &day ) const; -- virtual bool dateToJulianDay( int year, int month, int day, int &jd ) const; -- KCalendarSystemThai( KCalendarSystemThaiPrivate &dd, -- const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -- const KLocale *locale = 0 ); -+ virtual bool julianDayToDate(int jd, int &year, int &month, int &day) const; -+ virtual bool dateToJulianDay(int year, int month, int day, int &jd) const; -+ KCalendarSystemThai(KCalendarSystemThaiPrivate &dd, -+ const KSharedConfig::Ptr config = KSharedConfig::Ptr(), -+ const KLocale *locale = 0); - - private: - Q_DECLARE_PRIVATE(KCalendarSystemThai) -diff --git a/kdecore/date/kdatetime.cpp b/kdecore/date/kdatetime.cpp -index 5d24fdf..4ba627b 100644 ---- a/kdecore/date/kdatetime.cpp -+++ b/kdecore/date/kdatetime.cpp -@@ -39,7 +39,7 @@ - - #include <kglobal.h> - #include <klocale.h> --#include "kcalendarsystemgregorian_p.h" -+#include "kcalendarsystemqdate_p.h" - #include <ksystemtimezone.h> - #include <kdebug.h> - -@@ -1427,7 +1427,7 @@ QString KDateTime::toString(const QString &format) const - return QString(); - enum { TZNone, UTCOffsetShort, UTCOffset, UTCOffsetColon, TZAbbrev, TZName }; - KLocale *locale = KGlobal::locale(); -- KCalendarSystemGregorian calendar(locale); -+ KCalendarSystemQDate calendar(locale); - QString result; - QString s; - int num, numLength, zone; -@@ -2484,7 +2484,7 @@ QDateTime fromStr(const QString& string, const QString& format, int& utcOffset, - - enum { TZNone, UTCOffset, UTCOffsetColon, TZAbbrev, TZName }; - KLocale *locale = KGlobal::locale(); -- KCalendarSystemGregorian calendar(locale); -+ KCalendarSystemQDate calendar(locale); - int zone; - int s = 0; - int send = str.length(); -diff --git a/kdecore/date/kdatetimeformatter.cpp b/kdecore/date/kdatetimeformatter.cpp -index 9d8e271..82bbe9e 100644 ---- a/kdecore/date/kdatetimeformatter.cpp -+++ b/kdecore/date/kdatetimeformatter.cpp -@@ -33,8 +33,8 @@ - #include "kdebug.h" - - KDateTimeFormatter::KDateTimeFormatter() -- : m_englishLocale(0), -- m_englishCalendar(0) -+ : m_englishLocale(0), -+ m_englishCalendar(0) - { - } - -@@ -44,70 +44,70 @@ KDateTimeFormatter::~KDateTimeFormatter() - delete m_englishLocale; - } - --QString KDateTimeFormatter::formatDate( const QDate &fromDate, -- const QString &toFormat, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QString KDateTimeFormatter::formatDate(const QDate &fromDate, -+ const QString &toFormat, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard) const - { - // If not valid input, don't waste our time -- if ( !calendar->isValid( fromDate ) || toFormat.isEmpty() ) { -+ if (!calendar->isValid(fromDate) || toFormat.isEmpty()) { - return QString(); - } - -- return formatDateTime( KDateTime( fromDate ), toFormat, 0, calendar, locale, digitSet, formatStandard ); -+ return formatDateTime(KDateTime(fromDate), toFormat, 0, calendar, locale, digitSet, formatStandard); - } - --QString KDateTimeFormatter::formatTime( const QTime &fromTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QString KDateTimeFormatter::formatTime(const QTime &fromTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard) const - { - // If not valid input, don't waste our time -- if ( fromTime.isValid() || toFormat.isEmpty() ) { -+ if (fromTime.isValid() || toFormat.isEmpty()) { - return QString(); - } - -- return formatDateTime( KDateTime( QDate::currentDate(), fromTime ), toFormat, timeOptions, calendar, locale, digitSet, formatStandard ); -+ return formatDateTime(KDateTime(QDate::currentDate(), fromTime), toFormat, timeOptions, calendar, locale, digitSet, formatStandard); - } - - // Format an input date to match a POSIX date format string --QString KDateTimeFormatter::formatDateTime( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QString KDateTimeFormatter::formatDateTime(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard) const - { - // If not valid input, don't waste our time -- if ( !fromDateTime.isValid() || !calendar->isValid( fromDateTime.date() ) || toFormat.isEmpty() ) { -+ if (!fromDateTime.isValid() || !calendar->isValid(fromDateTime.date()) || toFormat.isEmpty()) { - return QString(); - } - -- if ( formatStandard == KLocale::UnicodeFormat ) { -- return formatDateTimeUnicode( fromDateTime, toFormat, timeOptions, calendar, locale, digitSet ); -+ if (formatStandard == KLocale::UnicodeFormat) { -+ return formatDateTimeUnicode(fromDateTime, toFormat, timeOptions, calendar, locale, digitSet); - } else { -- return formatDateTimePosix( fromDateTime, toFormat, timeOptions, calendar, locale, digitSet, formatStandard ); -+ return formatDateTimePosix(fromDateTime, toFormat, timeOptions, calendar, locale, digitSet, formatStandard); - } - } - - // Format an input date to match a POSIX date format string --QString KDateTimeFormatter::formatDateTimePosix( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QString KDateTimeFormatter::formatDateTimePosix(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard) const - { - //kDebug() << "formatDateTimePosix(" << fromDateTime << toFormat << ")"; - // If not valid input, don't waste our time -- if ( !fromDateTime.isValid() || toFormat.isEmpty() ) { -+ if (!fromDateTime.isValid() || toFormat.isEmpty()) { - return QString(); - } - -@@ -131,55 +131,55 @@ QString KDateTimeFormatter::formatDateTimePosix( const KDateTime &fromDateTime, - // Pre-fetch the core date components as they get used a lot - // and it is 1/3rd more efficient than 3 separatre calls - int year, month, day; -- calendar->getDate( fromDateTime.date(), &year, &month, &day ); -+ calendar->getDate(fromDateTime.date(), &year, &month, &day); - -- for ( int formatIndex = 0; formatIndex < toFormat.length(); ++formatIndex ) { -+ for (int formatIndex = 0; formatIndex < toFormat.length(); ++formatIndex) { - -- thisChar = toFormat.at( formatIndex ); -+ thisChar = toFormat.at(formatIndex); - -- if ( !escape ) { -+ if (!escape) { - -- if ( thisChar == QLatin1Char('%') ) { -+ if (thisChar == QLatin1Char('%')) { - escape = true; - escapeIndex = formatIndex; - } else { -- result.append( toFormat.at( formatIndex ) ); -+ result.append(toFormat.at(formatIndex)); - } - -- } else if ( !escapeMod && !escapeWidth && thisChar == QLatin1Char('-') ) { // no padding -+ } else if (!escapeMod && !escapeWidth && thisChar == QLatin1Char('-')) { // no padding - - padChar = QChar(); - escapePad = true; - -- } else if ( !escapeMod && !escapeWidth && thisChar == QLatin1Char('_') ) { // space padding -+ } else if (!escapeMod && !escapeWidth && thisChar == QLatin1Char('_')) { // space padding - - padChar = QLatin1Char(' '); - escapePad = true; - -- } else if ( !escapeMod && !escapeWidth && thisChar == QLatin1Char('0') ) { // 0 padding -+ } else if (!escapeMod && !escapeWidth && thisChar == QLatin1Char('0')) { // 0 padding - - padChar = QLatin1Char('0'); - escapePad = true; - -- } else if ( !escapeMod && !escapeWidth && ( thisChar == QLatin1Char('^') || thisChar == QLatin1Char('#') ) ) { // Change case -+ } else if (!escapeMod && !escapeWidth && (thisChar == QLatin1Char('^') || thisChar == QLatin1Char('#'))) { // Change case - - caseChar = thisChar; - -- } else if ( !escapeMod && -- ( ( !escapeWidth && thisChar >= QLatin1Char('1') && thisChar <= QLatin1Char('9') ) || -- ( escapeWidth && thisChar >= QLatin1Char('0') && thisChar <= QLatin1Char('9') ) ) ) { // Change width -+ } else if (!escapeMod && -+ ((!escapeWidth && thisChar >= QLatin1Char('1') && thisChar <= QLatin1Char('9')) || -+ (escapeWidth && thisChar >= QLatin1Char('0') && thisChar <= QLatin1Char('9')))) { // Change width - -- if ( escapeWidth ) { -+ if (escapeWidth) { - padWidth = padWidth * 10; - } -- padWidth = padWidth + QString( thisChar ).toInt(); -+ padWidth = padWidth + QString(thisChar).toInt(); - escapeWidth = true; - -- } else if ( !escapeMod && ( thisChar == QLatin1Char('E') || thisChar == QLatin1Char('O') || thisChar == QLatin1Char(':') ) ) { // Set modifier -+ } else if (!escapeMod && (thisChar == QLatin1Char('E') || thisChar == QLatin1Char('O') || thisChar == QLatin1Char(':'))) { // Set modifier - - escapeMod = true; - modifierChar = thisChar; -- if ( thisChar == QLatin1Char(':') ) { -+ if (thisChar == QLatin1Char(':')) { - invalidModifier = true; - } - -@@ -196,414 +196,414 @@ QString KDateTimeFormatter::formatDateTimePosix( const KDateTime &fromDateTime, - //Default settings unless overridden by pad and case flags and width: are 0 pad to 0 width no sign - //Names will override 0 pad with no pad unless flagged - //Numbers will override with correct width unless flagged -- QChar thisChar = toFormat.at( formatIndex ).unicode(); -- switch ( thisChar.unicode() ) { -- case '%': //Literal % -- if ( modifierChar != QLatin1Char(':') ) { // E and O mods are ignored if not used, but : is treated as literal -- componentString = QLatin1Char('%'); -- if ( !escapePad ) { -- padChar = QChar(); -- } -+ QChar thisChar = toFormat.at(formatIndex).unicode(); -+ switch (thisChar.unicode()) { -+ case '%': //Literal % -+ if (modifierChar != QLatin1Char(':')) { // E and O mods are ignored if not used, but : is treated as literal -+ componentString = QLatin1Char('%'); -+ if (!escapePad) { -+ padChar = QChar(); - } -- break; -- case 't': //Tab -- if ( modifierChar != QLatin1Char(':') ) { -- componentString = QString::fromLatin1("\t"); -- if ( !escapePad ) { -- padChar = QChar(); -- } -+ } -+ break; -+ case 't': //Tab -+ if (modifierChar != QLatin1Char(':')) { -+ componentString = QString::fromLatin1("\t"); -+ if (!escapePad) { -+ padChar = QChar(); - } -- break; -- case 'Y': -- if ( modifierChar == QLatin1Char('E') ) { //Era Year, default no pad to 0 places no sign -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -- } -- componentString = calendar->eraYear( fromDateTime.date() ); -- } else if ( modifierChar != QLatin1Char(':') ) { //Long year numeric, default 0 pad to 4 places with sign -- componentInteger = qAbs( year ); -- minWidth = 4; -- if ( year < 0 ) { -- signChar = QLatin1Char('-'); -- } -+ } -+ break; -+ case 'Y': -+ if (modifierChar == QLatin1Char('E')) { //Era Year, default no pad to 0 places no sign -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); - } -- break; -- case 'C': -- if ( modifierChar == QLatin1Char('E') ) { //Era name, default no pad to 0 places no sign -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -- } -- componentString = calendar->eraName( fromDateTime.date() ); -- } else if ( modifierChar != QLatin1Char(':') ) { //Century numeric, default 0 pad to 2 places with sign -- componentInteger = qAbs( year ) / 100 ; -- minWidth = 2; -- if ( year < 0 ) { -- signChar = QLatin1Char('-'); -- } -+ componentString = calendar->eraYear(fromDateTime.date()); -+ } else if (modifierChar != QLatin1Char(':')) { //Long year numeric, default 0 pad to 4 places with sign -+ componentInteger = qAbs(year); -+ minWidth = 4; -+ if (year < 0) { -+ signChar = QLatin1Char('-'); - } -- break; -- case 'y': -- if ( modifierChar == QLatin1Char('E') ) { //Year in Era number, default 0 pad to 1 places no sign -- componentInteger = calendar->yearInEra( fromDateTime.date() ); -- minWidth = 1; -- } else if ( modifierChar != QLatin1Char(':') ) { //Short year numeric, default 0 pad to 2 places with sign -- componentInteger = qAbs( year ) % 100; -- minWidth = 2; -- if ( year < 0 ) { -- signChar = QLatin1Char('-'); -- } -+ } -+ break; -+ case 'C': -+ if (modifierChar == QLatin1Char('E')) { //Era name, default no pad to 0 places no sign -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); - } -- break; -- case 'm': // Month numeric -+ componentString = calendar->eraName(fromDateTime.date()); -+ } else if (modifierChar != QLatin1Char(':')) { //Century numeric, default 0 pad to 2 places with sign -+ componentInteger = qAbs(year) / 100 ; -+ minWidth = 2; -+ if (year < 0) { -+ signChar = QLatin1Char('-'); -+ } -+ } -+ break; -+ case 'y': -+ if (modifierChar == QLatin1Char('E')) { //Year in Era number, default 0 pad to 1 places no sign -+ componentInteger = calendar->yearInEra(fromDateTime.date()); -+ minWidth = 1; -+ } else if (modifierChar != QLatin1Char(':')) { //Short year numeric, default 0 pad to 2 places with sign -+ componentInteger = qAbs(year) % 100; -+ minWidth = 2; -+ if (year < 0) { -+ signChar = QLatin1Char('-'); -+ } -+ } -+ break; -+ case 'm': // Month numeric -+ componentInteger = month; -+ if (modifierChar == QLatin1Char(':')) { //Short month numeric, default no pad to 1 places no sign -+ minWidth = 1; -+ if (!escapePad) { -+ padChar = QChar(); -+ } -+ invalidModifier = false; -+ } else { //Long month numeric, default 0 pad to 2 places no sign - componentInteger = month; -- if ( modifierChar == QLatin1Char(':') ) { //Short month numeric, default no pad to 1 places no sign -+ minWidth = 2; -+ } -+ break; -+ case 'n': -+ //PosixFormat %n is newline -+ //KdeFormat %n is short month numeric -+ if (modifierChar != QLatin1Char(':')) { -+ if (formatStandard == KLocale::KdeFormat) { -+ //Copy what %e does, no padding by default -+ //Short month numeric, default no pad to 1 places no sign -+ componentInteger = month; - minWidth = 1; -- if ( !escapePad ) { -+ if (!escapePad) { - padChar = QChar(); - } -- invalidModifier = false; -- } else { //Long month numeric, default 0 pad to 2 places no sign -- componentInteger = month; -- minWidth = 2; -+ } else { // formatStandard == KLocale::PosixFormat -+ componentString = QLatin1Char('\n'); - } -- break; -- case 'n': -- //PosixFormat %n is newline -- //KdeFormat %n is short month numeric -- if ( modifierChar != QLatin1Char(':') ) { -- if ( formatStandard == KLocale::KdeFormat ) { -- //Copy what %e does, no padding by default -- //Short month numeric, default no pad to 1 places no sign -- componentInteger = month; -- minWidth = 1; -- if ( !escapePad ) { -- padChar = QChar(); -- } -- } else { // formatStandard == KLocale::PosixFormat -- componentString = QLatin1Char('\n'); -+ } -+ break; -+ case 'd': //Long day numeric, default 0 pad to 2 places no sign -+ if (modifierChar != QLatin1Char(':')) { -+ componentInteger = day; -+ minWidth = 2; -+ } -+ break; -+ case 'e': //Short day numeric, default no sign -+ //PosixFormat %e is space pad to 2 places -+ //KdeFormat %e is no pad to 1 place -+ if (modifierChar != QLatin1Char(':')) { -+ componentInteger = day; -+ if (formatStandard == KLocale::KdeFormat) { -+ minWidth = 1; -+ if (!escapePad) { -+ padChar = QChar(); - } -- } -- break; -- case 'd': //Long day numeric, default 0 pad to 2 places no sign -- if ( modifierChar != QLatin1Char(':') ) { -- componentInteger = day; -+ } else { // formatStandard == KLocale::PosixFormat - minWidth = 2; -- } -- break; -- case 'e': //Short day numeric, default no sign -- //PosixFormat %e is space pad to 2 places -- //KdeFormat %e is no pad to 1 place -- if ( modifierChar != QLatin1Char(':') ) { -- componentInteger = day; -- if ( formatStandard == KLocale::KdeFormat ) { -- minWidth = 1; -- if ( !escapePad ) { -- padChar = QChar(); -- } -- } else { // formatStandard == KLocale::PosixFormat -- minWidth = 2; -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -- } -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); - } - } -- break; -- case 'B': //Long month name, default space pad to 0 places no sign -- if ( locale->dateMonthNamePossessive() ) { -- if ( modifierChar == QLatin1Char(':') ) { -- invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishCalendar->monthName( month, year, KCalendarSystem::LongNamePossessive ); -- } else { -- componentString = calendar->monthName( month, year, KCalendarSystem::LongNamePossessive ); -- } -+ } -+ break; -+ case 'B': //Long month name, default space pad to 0 places no sign -+ if (locale->dateMonthNamePossessive()) { -+ if (modifierChar == QLatin1Char(':')) { -+ invalidModifier = false; -+ initEnglish(calendar, locale); -+ componentString = m_englishCalendar->monthName(month, year, KCalendarSystem::LongNamePossessive); - } else { -- if ( modifierChar == QLatin1Char(':') ) { -- invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishCalendar->monthName( month, year, KCalendarSystem::LongName ); -- } else { -- componentString = calendar->monthName( month, year, KCalendarSystem::LongName ); -- } -- } -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -+ componentString = calendar->monthName(month, year, KCalendarSystem::LongNamePossessive); - } -- break; -- case 'h': //Short month name, default space pad to 0 places no sign -- case 'b': //Short month name, default space pad to 0 places no sign -- if ( locale->dateMonthNamePossessive() ) { -- if ( modifierChar == QLatin1Char(':') ) { -- invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishCalendar->monthName( month, year, KCalendarSystem::ShortNamePossessive ); -- } else { -- componentString = calendar->monthName( month, year, KCalendarSystem::ShortNamePossessive ); -- } -+ } else { -+ if (modifierChar == QLatin1Char(':')) { -+ invalidModifier = false; -+ initEnglish(calendar, locale); -+ componentString = m_englishCalendar->monthName(month, year, KCalendarSystem::LongName); - } else { -- if ( modifierChar == QLatin1Char(':') ) { -- invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishCalendar->monthName( month, year, KCalendarSystem::ShortName ); -- } else { -- componentString = calendar->monthName( month, year, KCalendarSystem::ShortName ); -- } -+ componentString = calendar->monthName(month, year, KCalendarSystem::LongName); - } -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -- } -- break; -- case 'A': //Long weekday name, default space pad to 0 places no sign -- if ( modifierChar == QLatin1Char(':') ) { -+ } -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); -+ } -+ break; -+ case 'h': //Short month name, default space pad to 0 places no sign -+ case 'b': //Short month name, default space pad to 0 places no sign -+ if (locale->dateMonthNamePossessive()) { -+ if (modifierChar == QLatin1Char(':')) { - invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishCalendar->weekDayName( fromDateTime.date(), KCalendarSystem::LongDayName ); -+ initEnglish(calendar, locale); -+ componentString = m_englishCalendar->monthName(month, year, KCalendarSystem::ShortNamePossessive); - } else { -- componentString = calendar->weekDayName( fromDateTime.date(), KCalendarSystem::LongDayName ); -+ componentString = calendar->monthName(month, year, KCalendarSystem::ShortNamePossessive); - } -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -- } -- break; -- case 'a': //Short weekday name, default space pad to 0 places no sign -- if ( modifierChar == QLatin1Char(':') ) { -+ } else { -+ if (modifierChar == QLatin1Char(':')) { - invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishCalendar->weekDayName( fromDateTime.date(), KCalendarSystem::ShortDayName ); -+ initEnglish(calendar, locale); -+ componentString = m_englishCalendar->monthName(month, year, KCalendarSystem::ShortName); - } else { -- componentString = calendar->weekDayName( fromDateTime.date(), KCalendarSystem::ShortDayName ); -- } -- if ( !escapePad ) { -- padChar = QLatin1Char(' '); -+ componentString = calendar->monthName(month, year, KCalendarSystem::ShortName); - } -- break; -- case 'j': //Long day of year numeric, default 0 pad to 3 places no sign -- if ( modifierChar != QLatin1Char(':') ) { -- componentInteger = calendar->dayOfYear( fromDateTime.date() ); -- minWidth = 3; -+ } -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); -+ } -+ break; -+ case 'A': //Long weekday name, default space pad to 0 places no sign -+ if (modifierChar == QLatin1Char(':')) { -+ invalidModifier = false; -+ initEnglish(calendar, locale); -+ componentString = m_englishCalendar->weekDayName(fromDateTime.date(), KCalendarSystem::LongDayName); -+ } else { -+ componentString = calendar->weekDayName(fromDateTime.date(), KCalendarSystem::LongDayName); -+ } -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); -+ } -+ break; -+ case 'a': //Short weekday name, default space pad to 0 places no sign -+ if (modifierChar == QLatin1Char(':')) { -+ invalidModifier = false; -+ initEnglish(calendar, locale); -+ componentString = m_englishCalendar->weekDayName(fromDateTime.date(), KCalendarSystem::ShortDayName); -+ } else { -+ componentString = calendar->weekDayName(fromDateTime.date(), KCalendarSystem::ShortDayName); -+ } -+ if (!escapePad) { -+ padChar = QLatin1Char(' '); -+ } -+ break; -+ case 'j': //Long day of year numeric, default 0 pad to 3 places no sign -+ if (modifierChar != QLatin1Char(':')) { -+ componentInteger = calendar->dayOfYear(fromDateTime.date()); -+ minWidth = 3; -+ } -+ break; -+ case 'V': //Long ISO week of year numeric, default 0 pad to 2 places no sign -+ if (modifierChar != QLatin1Char(':')) { -+ componentInteger = calendar->week(fromDateTime.date(), KLocale::IsoWeekNumber); -+ minWidth = 2; -+ } -+ break; -+ case 'G': //Long year of ISO week of year numeric, default 0 pad to 4 places with sign -+ if (modifierChar != QLatin1Char(':')) { -+ calendar->week(fromDateTime.date(), KLocale::IsoWeekNumber, &isoWeekYear); -+ calendar->setDate(yearDate, isoWeekYear, 1, 1); -+ componentInteger = qAbs(isoWeekYear); -+ minWidth = 4; -+ if (isoWeekYear < 0) { -+ signChar = QLatin1Char('-'); - } -- break; -- case 'V': //Long ISO week of year numeric, default 0 pad to 2 places no sign -- if ( modifierChar != QLatin1Char(':') ) { -- componentInteger = calendar->weekNumber( fromDateTime.date() ); -- minWidth = 2; -+ } -+ break; -+ case 'g': //Short year of ISO week of year numeric, default 0 pad to 2 places with sign -+ if (modifierChar != QLatin1Char(':')) { -+ calendar->week(fromDateTime.date(), KLocale::IsoWeekNumber, &isoWeekYear); -+ calendar->setDate(yearDate, isoWeekYear, 1, 1); -+ componentInteger = qAbs(isoWeekYear) % 100; -+ minWidth = 2; -+ if (isoWeekYear < 0) { -+ signChar = QLatin1Char('-'); - } -- break; -- case 'G': //Long year of ISO week of year numeric, default 0 pad to 4 places with sign -- if ( modifierChar != QLatin1Char(':') ) { -- calendar->weekNumber( fromDateTime.date(), &isoWeekYear ); -- calendar->setDate( yearDate, isoWeekYear, 1, 1 ); -- componentInteger = qAbs( isoWeekYear ); -- minWidth = 4; -- if ( isoWeekYear < 0 ) { -+ } -+ break; -+ case 'u': -+ if (modifierChar == QLatin1Char(':')) { // TZ UTC offset hours -+ invalidModifier = false; -+ KDateTime::SpecType timeSpecType = fromDateTime.timeType(); -+ if (timeSpecType == KDateTime::UTC || timeSpecType == KDateTime::TimeZone || -+ timeSpecType == KDateTime::OffsetFromUTC) { -+ componentInteger = fromDateTime.utcOffset() / 3600; -+ if (componentInteger >= 0) { -+ signChar = QLatin1Char('+'); -+ } else { -+ componentInteger = -componentInteger; - signChar = QLatin1Char('-'); - } -- } -- break; -- case 'g': //Short year of ISO week of year numeric, default 0 pad to 2 places with sign -- if ( modifierChar != QLatin1Char(':') ) { -- calendar->weekNumber( fromDateTime.date(), &isoWeekYear ); -- calendar->setDate( yearDate, isoWeekYear, 1, 1 ); -- componentInteger = qAbs( isoWeekYear ) % 100; - minWidth = 2; -- if ( isoWeekYear < 0 ) { -- signChar = QLatin1Char('-'); -- } - } -- break; -- case 'u': -- if ( modifierChar == QLatin1Char(':') ) { // TZ UTC offset hours -- invalidModifier = false; -- KDateTime::SpecType timeSpecType = fromDateTime.timeType(); -- if ( timeSpecType == KDateTime::UTC || timeSpecType == KDateTime::TimeZone || -- timeSpecType == KDateTime::OffsetFromUTC ) { -- componentInteger = fromDateTime.utcOffset() / 3600; -- if ( componentInteger >= 0 ) { -- signChar = QLatin1Char('+'); -- } else { -- componentInteger = -componentInteger; -- signChar = QLatin1Char('-'); -- } -- minWidth = 2; -- } -- } else { // Short day of week numeric -- componentInteger = calendar->dayOfWeek( fromDateTime.date() ); -- minWidth = 1; -- } -- break; -- case 'D': // US short date format, ignore any overrides -- if ( modifierChar != QLatin1Char(':') ) { -- componentString = formatDateTimePosix( fromDateTime, QString::fromLatin1("%m/%d/%y"), timeOptions, calendar, locale, digitSet, formatStandard ); -- padWidth = 0; -- padChar = QChar(); -- caseChar = QChar(); -- } -- break; -- case 'F': // Full or ISO short date format, ignore any overrides -- if ( modifierChar != QLatin1Char(':') ) { -- componentString = formatDateTimePosix( fromDateTime, QString::fromLatin1("%Y-%m-%d"), timeOptions, calendar, locale, digitSet, formatStandard ); -- padWidth = 0; -- padChar = QChar(); -- caseChar = QChar(); -- } -- break; -- case 'x': // Locale short date format, ignore any overrides -- if ( modifierChar != QLatin1Char(':') ) { -- componentString = formatDateTimePosix( fromDateTime, locale->dateFormatShort(), timeOptions, calendar, locale, digitSet, formatStandard ); -- padWidth = 0; -+ } else { // Short day of week numeric -+ componentInteger = calendar->dayOfWeek(fromDateTime.date()); -+ minWidth = 1; -+ } -+ break; -+ case 'D': // US short date format, ignore any overrides -+ if (modifierChar != QLatin1Char(':')) { -+ componentString = formatDateTimePosix(fromDateTime, QString::fromLatin1("%m/%d/%y"), timeOptions, calendar, locale, digitSet, formatStandard); -+ padWidth = 0; -+ padChar = QChar(); -+ caseChar = QChar(); -+ } -+ break; -+ case 'F': // Full or ISO short date format, ignore any overrides -+ if (modifierChar != QLatin1Char(':')) { -+ componentString = formatDateTimePosix(fromDateTime, QString::fromLatin1("%Y-%m-%d"), timeOptions, calendar, locale, digitSet, formatStandard); -+ padWidth = 0; -+ padChar = QChar(); -+ caseChar = QChar(); -+ } -+ break; -+ case 'x': // Locale short date format, ignore any overrides -+ if (modifierChar != QLatin1Char(':')) { -+ componentString = formatDateTimePosix(fromDateTime, locale->dateFormatShort(), timeOptions, calendar, locale, digitSet, formatStandard); -+ padWidth = 0; -+ padChar = QChar(); -+ caseChar = QChar(); -+ } -+ break; -+ case 'H': // Long 24 hour -+ case 'k': // Short 24 hour -+ if (modifierChar != QLatin1Char(':')) { -+ componentInteger = fromDateTime.time().hour(); -+ minWidth = 1; -+ if (!escapePad) { - padChar = QChar(); -- caseChar = QChar(); - } -- break; -- case 'H': // Long 24 hour -- case 'k': // Short 24 hour -- if ( modifierChar != QLatin1Char(':') ) { -+ } -+ break; -+ case 'I': // Long 12 hour -+ case 'l': // Short 12 hour -+ if (modifierChar != QLatin1Char(':')) { -+ if ((timeOptions & KLocale::TimeDuration) == KLocale::TimeDuration) { - componentInteger = fromDateTime.time().hour(); -+ } else { -+ componentInteger = locale->d->dayPeriodForTime(fromDateTime.time()).hourInPeriod(fromDateTime.time()); -+ } -+ if (thisChar == QLatin1Char('I')) { -+ minWidth = 2; -+ } else { - minWidth = 1; -- if ( !escapePad ) { -+ if (!escapePad) { - padChar = QChar(); - } - } -- break; -- case 'I': // Long 12 hour -- case 'l': // Short 12 hour -- if ( modifierChar != QLatin1Char(':') ) { -- if ( (timeOptions & KLocale::TimeDuration) == KLocale::TimeDuration ) { -- componentInteger = fromDateTime.time().hour(); -- } else { -- componentInteger = locale->d->dayPeriodForTime( fromDateTime.time() ).hourInPeriod( fromDateTime.time() ); -- } -- if ( thisChar == QLatin1Char('I') ) { -+ } -+ break; -+ case 'M': // Long minutes -+ if (modifierChar != QLatin1Char(':')) { -+ componentInteger = fromDateTime.time().minute(); -+ minWidth = 2; -+ } -+ break; -+ case 'S': // Long seconds -+ invalidModifier = false; -+ if ((timeOptions & KLocale::TimeWithoutSeconds) == KLocale::TimeWithoutSeconds) { -+ //TODO strip the preceding/following punctuation -+ } else { -+ componentInteger = fromDateTime.time().second(); -+ if (modifierChar == QLatin1Char(':')) { // Only if not 00 seconds -+ if (componentInteger > 0 || fromDateTime.time().msec() > 0) { -+ result.append(QLatin1Char(':')); - minWidth = 2; -- } else { -- minWidth = 1; -- if ( !escapePad ) { -- padChar = QChar(); -- } - } -- } -- break; -- case 'M': // Long minutes -- if ( modifierChar != QLatin1Char(':') ) { -- componentInteger = fromDateTime.time().minute(); -+ } else { - minWidth = 2; - } -- break; -- case 'S': // Long seconds -+ } -+ break; -+ case 's': -+ if (modifierChar == QLatin1Char(':')) { // Milliseconds - invalidModifier = false; -- if ( (timeOptions & KLocale::TimeWithoutSeconds) == KLocale::TimeWithoutSeconds ) { -- //TODO strip the preceeding/following punctuation -+ componentInteger = fromDateTime.time().msec(); -+ minWidth = 3; -+ } else { // Whole seconds since Unix Epoch -+ KDateTime unixEpoch; -+ unixEpoch.setTime_t(0); -+ componentInteger = unixEpoch.secsTo(fromDateTime); -+ } -+ break; -+ case 'p': // AM/PM symbol -+ case 'P': // AM/PM symbol in lowercase -+ if ((timeOptions & KLocale::TimeWithoutAmPm) == KLocale::TimeWithoutAmPm) { -+ //TODO strip the preceding/following punctuation -+ } else { -+ if (modifierChar == QLatin1Char(':')) { -+ invalidModifier = false; -+ initEnglish(calendar, locale); -+ componentString = m_englishLocale->d->dayPeriodForTime(fromDateTime.time()).periodName(KLocale::ShortName); - } else { -- componentInteger = fromDateTime.time().second(); -- if ( modifierChar == QLatin1Char(':') ) { // Only if not 00 seconds -- if ( componentInteger > 0 || fromDateTime.time().msec() > 0 ) { -- result.append( QLatin1Char(':') ); -- minWidth = 2; -- } -- } else { -- minWidth = 2; -- } -+ componentString = locale->d->dayPeriodForTime(fromDateTime.time()).periodName(KLocale::ShortName); - } -- break; -- case 's': -- if ( modifierChar == QLatin1Char(':') ) { // Milliseconds -- invalidModifier = false; -- componentInteger = fromDateTime.time().msec(); -- minWidth = 3; -- } else { // Whole seconds since Unix Epoch -- KDateTime unixEpoch; -- unixEpoch.setTime_t( 0 ); -- componentInteger = unixEpoch.secsTo( fromDateTime ); -+ if (thisChar == QLatin1Char('P')) { -+ componentString = componentString.toLower(); - } -- break; -- case 'p': // AM/PM symbol -- case 'P': // AM/PM symbol in lowercase -- if ( (timeOptions & KLocale::TimeWithoutAmPm) == KLocale::TimeWithoutAmPm ) { -- //TODO strip the preceeding/following punctuation -- } else { -- if ( modifierChar == QLatin1Char(':') ) { -- invalidModifier = false; -- initEnglish( calendar, locale ); -- componentString = m_englishLocale->d->dayPeriodForTime( fromDateTime.time() ).periodName( KLocale::ShortName ); -+ } -+ break; -+ case 'z': // TZ UTC Offset -+ invalidModifier = false; -+ timeSpecType = fromDateTime.timeType(); -+ if (timeSpecType == KDateTime::UTC || timeSpecType == KDateTime::TimeZone || -+ timeSpecType == KDateTime::OffsetFromUTC) { -+ if (modifierChar == QLatin1Char(':')) { // TZ UTC offset hours & minutes with colon -+ int offsetInSeconds = fromDateTime.utcOffset(); -+ if (offsetInSeconds >= 0) { -+ signChar = QLatin1Char('+'); - } else { -- componentString = locale->d->dayPeriodForTime( fromDateTime.time() ).periodName( KLocale::ShortName ); -- } -- if ( thisChar == QLatin1Char('P') ) { -- componentString = componentString.toLower(); -+ offsetInSeconds = -offsetInSeconds; -+ signChar = QLatin1Char('-'); - } -- } -- break; -- case 'z': // TZ UTC Offset -- invalidModifier = false; -- timeSpecType = fromDateTime.timeType(); -- if ( timeSpecType == KDateTime::UTC || timeSpecType == KDateTime::TimeZone || -- timeSpecType == KDateTime::OffsetFromUTC ) { -- if ( modifierChar == QLatin1Char(':') ) { // TZ UTC offset hours & minutes with colon -- int offsetInSeconds = fromDateTime.utcOffset(); -- if ( offsetInSeconds >= 0 ) { -- signChar = QLatin1Char('+'); -- } else { -- offsetInSeconds = -offsetInSeconds; -- signChar = QLatin1Char('-'); -- } -- int offsetHours = offsetInSeconds / 3600; -- int offsetMinutes = ( offsetInSeconds / 60 ) % 60; -- //int offsetSeconds = offsetInSeconds % 60; -- QString hourComponent = stringFromInteger( offsetHours, 2, QLatin1Char('0'), signChar, digitSet, locale ); -- QString minuteComponent = stringFromInteger( offsetMinutes, 2, QLatin1Char('0'), QChar(), digitSet, locale ); -- componentString = hourComponent + QLatin1Char(':') + minuteComponent; -- minWidth = 0; -- padChar = QChar(); -- padWidth = 0; -- } else { // TZ UTC offset hours & minutes -- componentInteger = fromDateTime.utcOffset() / 60; -- if ( componentInteger >= 0 ) { -- signChar = QLatin1Char('+'); -- } else { -- componentInteger = -componentInteger; -- signChar = QLatin1Char('-'); -- } -- minWidth = 4; -+ int offsetHours = offsetInSeconds / 3600; -+ int offsetMinutes = (offsetInSeconds / 60) % 60; -+ //int offsetSeconds = offsetInSeconds % 60; -+ QString hourComponent = stringFromInteger(offsetHours, 2, QLatin1Char('0'), signChar, digitSet, locale); -+ QString minuteComponent = stringFromInteger(offsetMinutes, 2, QLatin1Char('0'), QChar(), digitSet, locale); -+ componentString = hourComponent + QLatin1Char(':') + minuteComponent; -+ minWidth = 0; -+ padChar = QChar(); -+ padWidth = 0; -+ } else { // TZ UTC offset hours & minutes -+ componentInteger = fromDateTime.utcOffset() / 60; -+ if (componentInteger >= 0) { -+ signChar = QLatin1Char('+'); -+ } else { -+ componentInteger = -componentInteger; -+ signChar = QLatin1Char('-'); - } -+ minWidth = 4; - } -- break; -- case 'Z': // TZ Name -- invalidModifier = false; -- timeSpecType = fromDateTime.timeType(); -- if ( timeSpecType == KDateTime::UTC || timeSpecType == KDateTime::TimeZone ) { -- KTimeZone tz = fromDateTime.timeZone(); -- if ( tz.isValid() ) { -- if ( modifierChar == QLatin1Char(':') ) { // TZ full name -- componentString = QString::fromLatin1(tz.abbreviation(fromDateTime.toUtc().dateTime())); -- } else { // TZ abbreviated name -- componentString = tz.name(); -- } -+ } -+ break; -+ case 'Z': // TZ Name -+ invalidModifier = false; -+ timeSpecType = fromDateTime.timeType(); -+ if (timeSpecType == KDateTime::UTC || timeSpecType == KDateTime::TimeZone) { -+ KTimeZone tz = fromDateTime.timeZone(); -+ if (tz.isValid()) { -+ if (modifierChar == QLatin1Char(':')) { // TZ full name -+ componentString = QString::fromLatin1(tz.abbreviation(fromDateTime.toUtc().dateTime())); -+ } else { // TZ abbreviated name -+ componentString = tz.name(); - } - } -- break; -- default: //No valid format code, treat as literal -- invalidComponent = true; -- break; -+ } -+ break; -+ default: //No valid format code, treat as literal -+ invalidComponent = true; -+ break; - } - -- if ( invalidComponent || invalidModifier ) { // If escape sequence invalid treat as literal -- componentString = toFormat.mid( escapeIndex, formatIndex ); -- } else if ( componentString.isEmpty() ) { //i.e. is a number component -- padWidth = qMax( minWidth, padWidth ); -- componentString = stringFromInteger( componentInteger, padWidth, padChar, signChar, digitSet, locale ); -+ if (invalidComponent || invalidModifier) { // If escape sequence invalid treat as literal -+ componentString = toFormat.mid(escapeIndex, formatIndex); -+ } else if (componentString.isEmpty()) { //i.e. is a number component -+ padWidth = qMax(minWidth, padWidth); -+ componentString = stringFromInteger(componentInteger, padWidth, padChar, signChar, digitSet, locale); - } else { //i.e. is a string component -- if ( padChar != QChar() && padWidth != 0 ) { -- componentString = componentString.rightJustified( padWidth, padChar ); -+ if (padChar != QChar() && padWidth != 0) { -+ componentString = componentString.rightJustified(padWidth, padChar); - } - -- if ( caseChar == QLatin1Char('^') ) { -+ if (caseChar == QLatin1Char('^')) { - componentString = componentString.toUpper(); -- } else if ( caseChar == QLatin1Char('#') ) { -+ } else if (caseChar == QLatin1Char('#')) { - componentString = componentString.toUpper(); // JPL ??? - } - } - -- result.append( componentString ); -+ result.append(componentString); - - escape = false; - escapePad = false; -@@ -623,16 +623,16 @@ QString KDateTimeFormatter::formatDateTimePosix( const KDateTime &fromDateTime, - return result; - } - --void KDateTimeFormatter::initEnglish( const KCalendarSystem *calendar, const KLocale *locale ) const -+void KDateTimeFormatter::initEnglish(const KCalendarSystem *calendar, const KLocale *locale) const - { -- if ( !m_englishCalendar || m_englishCalendar->calendarType() != calendar->calendarType() ) { -- // Set up an English locale and calendar for use with ':' modifier which forces English names -- if ( !m_englishLocale ) { -- m_englishLocale = new KLocale( *locale ); -- m_englishLocale->setLanguage( QStringList() << QString::fromLatin1("en_US") ); -- } -- delete m_englishCalendar; -- m_englishCalendar = KCalendarSystem::create( calendar->calendarType(), m_englishLocale ); -+ if (!m_englishCalendar || m_englishCalendar->calendarSystem() != calendar->calendarSystem()) { -+ // Set up an English locale and calendar for use with ':' modifier which forces English names -+ if (!m_englishLocale) { -+ m_englishLocale = new KLocale(*locale); -+ m_englishLocale->setLanguage(QStringList() << QString::fromLatin1("en_US")); -+ } -+ delete m_englishCalendar; -+ m_englishCalendar = KCalendarSystem::create(calendar->calendarSystem(), m_englishLocale); - } - } - -@@ -640,12 +640,12 @@ void KDateTimeFormatter::initEnglish( const KCalendarSystem *calendar, const KLo - // Format an input date to match a UNICODE date format string - // Original QDate::fmtDateTime() code taken from Qt 4.7 under LGPL, now heavily modifed - // Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). --QString KDateTimeFormatter::formatDateTimeUnicode( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet ) const -+QString KDateTimeFormatter::formatDateTimeUnicode(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet) const - { - const QLatin1Char quote('\''); - -@@ -661,7 +661,7 @@ QString KDateTimeFormatter::formatDateTimeUnicode( const KDateTime &fromDateTime - status = QLatin1Char('0'); - } else { - if (!format.isEmpty()) { -- result += getUnicodeString( fromDateTime, format, timeOptions, calendar, locale, digitSet ); -+ result += getUnicodeString(fromDateTime, format, timeOptions, calendar, locale, digitSet); - format.clear(); - } - status = quote; -@@ -669,27 +669,27 @@ QString KDateTimeFormatter::formatDateTimeUnicode( const KDateTime &fromDateTime - } else if (status == quote) { - result += toFormat.at(i); - } else if (toFormat.at(i) == status) { -- if ( toFormat.at(i) == QLatin1Char('P') || -- toFormat.at(i) == QLatin1Char('p') ) { -+ if (toFormat.at(i) == QLatin1Char('P') || -+ toFormat.at(i) == QLatin1Char('p')) { - status = QLatin1Char('0'); - } -- format += toFormat.at( i ); -+ format += toFormat.at(i); - } else { -- result += getUnicodeString( fromDateTime, format, timeOptions, calendar, locale, digitSet ); -+ result += getUnicodeString(fromDateTime, format, timeOptions, calendar, locale, digitSet); - format.clear(); -- if ( ( toFormat.at(i) == QLatin1Char('d') ) || -- ( toFormat.at(i) == QLatin1Char('M') ) || -- ( toFormat.at(i) == QLatin1Char('y') ) ) { -- status = toFormat.at( i ); -- format += toFormat.at( i ); -+ if ((toFormat.at(i) == QLatin1Char('d')) || -+ (toFormat.at(i) == QLatin1Char('M')) || -+ (toFormat.at(i) == QLatin1Char('y'))) { -+ status = toFormat.at(i); -+ format += toFormat.at(i); - } else { -- result += toFormat.at( i ); -+ result += toFormat.at(i); - status = QLatin1Char('0'); - } - } - } - -- result += getUnicodeString( fromDateTime, format, timeOptions, calendar, locale, digitSet ); -+ result += getUnicodeString(fromDateTime, format, timeOptions, calendar, locale, digitSet); - - return result; - } -@@ -697,99 +697,98 @@ QString KDateTimeFormatter::formatDateTimeUnicode( const KDateTime &fromDateTime - // Original QDate::getFmtString() code taken from Qt 4.7 under LGPL, now heavily modifed - // Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - // Replaces tokens by their value. See QDateTime::toString() for a list of valid tokens --QString KDateTimeFormatter::getUnicodeString( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet ) const -+QString KDateTimeFormatter::getUnicodeString(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet) const - { -- if ( toFormat.isEmpty() ) { -+ if (toFormat.isEmpty()) { - return QString(); - } - - QString result = toFormat; - int removed = 0; - -- if ( toFormat.startsWith( QLatin1String( "dddd" ) ) ) { -- result = calendar->weekDayName( fromDateTime.date(), KCalendarSystem::LongDayName ); -+ if (toFormat.startsWith(QLatin1String("dddd"))) { -+ result = calendar->weekDayName(fromDateTime.date(), KCalendarSystem::LongDayName); - removed = 4; -- } else if ( toFormat.startsWith(QLatin1String( "ddd" ) ) ) { -- result = calendar->weekDayName( fromDateTime.date(), KCalendarSystem::ShortDayName ); -+ } else if (toFormat.startsWith(QLatin1String("ddd"))) { -+ result = calendar->weekDayName(fromDateTime.date(), KCalendarSystem::ShortDayName); - removed = 3; -- } else if ( toFormat.startsWith( QLatin1String( "dd" ) ) ) { -- result = QString::number( calendar->day( fromDateTime.date() ) ).rightJustified( 2, QLatin1Char('0'), true ); -+ } else if (toFormat.startsWith(QLatin1String("dd"))) { -+ result = QString::number(calendar->day(fromDateTime.date())).rightJustified(2, QLatin1Char('0'), true); - removed = 2; -- } else if ( toFormat.at(0) == QLatin1Char('d') ) { -- result = QString::number( calendar->day( fromDateTime.date() ) ); -+ } else if (toFormat.at(0) == QLatin1Char('d')) { -+ result = QString::number(calendar->day(fromDateTime.date())); - removed = 1; - } else if (toFormat.startsWith(QLatin1String("MMMM"))) { -- result = calendar->monthName( calendar->month( fromDateTime.date() ), calendar->year( fromDateTime.date() ), KCalendarSystem::LongName ); -+ result = calendar->monthName(calendar->month(fromDateTime.date()), calendar->year(fromDateTime.date()), KCalendarSystem::LongName); - removed = 4; - } else if (toFormat.startsWith(QLatin1String("MMM"))) { -- result = calendar->monthName( calendar->month( fromDateTime.date() ), calendar->year( fromDateTime.date() ), KCalendarSystem::ShortName ); -+ result = calendar->monthName(calendar->month(fromDateTime.date()), calendar->year(fromDateTime.date()), KCalendarSystem::ShortName); - removed = 3; - } else if (toFormat.startsWith(QLatin1String("MM"))) { -- result = QString::number( calendar->month( fromDateTime.date() ) ).rightJustified( 2, QLatin1Char('0'), true ); -+ result = QString::number(calendar->month(fromDateTime.date())).rightJustified(2, QLatin1Char('0'), true); - removed = 2; - } else if (toFormat.at(0) == QLatin1Char('M')) { -- result = QString::number( calendar->month( fromDateTime.date() ) ); -+ result = QString::number(calendar->month(fromDateTime.date())); - removed = 1; - } else if (toFormat.startsWith(QLatin1String("yyyy"))) { -- const int year = calendar->year( fromDateTime.date() ); -- result = QString::number( qAbs( year ) ).rightJustified( 4, QLatin1Char('0') ); -- if( year > 0 ) -+ const int year = calendar->year(fromDateTime.date()); -+ result = QString::number(qAbs(year)).rightJustified(4, QLatin1Char('0')); -+ if (year > 0) - removed = 4; -- else -- { -- result.prepend( QLatin1Char('-') ); -+ else { -+ result.prepend(QLatin1Char('-')); - removed = 5; - } -- } else if ( toFormat.startsWith( QLatin1String("yy") ) ) { -- result = QString::number( calendar->year(fromDateTime.date()) ).right( 2 ).rightJustified( 2, QLatin1Char('0') ); -+ } else if (toFormat.startsWith(QLatin1String("yy"))) { -+ result = QString::number(calendar->year(fromDateTime.date())).right(2).rightJustified(2, QLatin1Char('0')); - removed = 2; - } - -- if ( removed == 0 || removed >= toFormat.size() ) { -+ if (removed == 0 || removed >= toFormat.size()) { - return result; - } - -- return result + getUnicodeString( fromDateTime, toFormat.mid( removed ), timeOptions, calendar, locale, digitSet ); -+ return result + getUnicodeString(fromDateTime, toFormat.mid(removed), timeOptions, calendar, locale, digitSet); - } - - // Reimplement if special integer to string handling required, e.g. Hebrew. - // Utility to convert an integer into the correct display string form --QString KDateTimeFormatter::stringFromInteger( int number, int padWidth, QChar padChar, QChar signChar, -- KLocale::DigitSet digitSet, const KLocale *locale ) const -+QString KDateTimeFormatter::stringFromInteger(int number, int padWidth, QChar padChar, QChar signChar, -+ KLocale::DigitSet digitSet, const KLocale *locale) const - { --if ( padChar == QChar() && signChar == QChar() ) { -+ if (padChar == QChar() && signChar == QChar()) { - //kDebug() << " stringFromInteger(" << number << padWidth << "null" << "null" << ")"; --} else if ( padChar == QChar() ) { -+ } else if (padChar == QChar()) { - //kDebug() << " stringFromInteger(" << number << padWidth << "null" << signChar << ")"; --} else if ( signChar == QChar() ) { -+ } else if (signChar == QChar()) { - //kDebug() << " stringFromInteger(" << number << padWidth << padChar << "null" << ")"; --} else if ( signChar == QChar() ) { -+ } else if (signChar == QChar()) { - //kDebug() << " stringFromInteger(" << number << padWidth << padChar << signChar << ")"; --} -+ } - QString result; -- if ( padChar == QChar() || padWidth == 0 ) { // If null pad char or 0 width don't bother padding -+ if (padChar == QChar() || padWidth == 0) { // If null pad char or 0 width don't bother padding - //kDebug() << " no pad"; -- if ( signChar == QChar() ) { -- result = locale->convertDigits( QString::number( number ), digitSet ); -+ if (signChar == QChar()) { -+ result = locale->convertDigits(QString::number(number), digitSet); - } else { -- result = locale->convertDigits( QString::number( number ).prepend( signChar ), digitSet ); -+ result = locale->convertDigits(QString::number(number).prepend(signChar), digitSet); - } -- } else if ( signChar != QChar() ) { // If sign required -- if ( padChar == QLatin1Char('0') ) { // If zero-padded, zero considered part of the number, so pad the number then prepend the sign -+ } else if (signChar != QChar()) { // If sign required -+ if (padChar == QLatin1Char('0')) { // If zero-padded, zero considered part of the number, so pad the number then prepend the sign - //kDebug() << " zero pad with sign"; -- result = locale->convertDigits( QString::number( number ).rightJustified( padWidth, padChar ).prepend( signChar ), digitSet ); -+ result = locale->convertDigits(QString::number(number).rightJustified(padWidth, padChar).prepend(signChar), digitSet); - } else { // If space-padded space not considered part of the number, so prepend the sign and then pad the number - //kDebug() << " space pad with sign"; -- result = locale->convertDigits( QString::number( number ).prepend( signChar ).rightJustified( padWidth, padChar ), digitSet ); -+ result = locale->convertDigits(QString::number(number).prepend(signChar).rightJustified(padWidth, padChar), digitSet); - } - } else { // No sign required so just pad - //kDebug() << " pad no sign"; -- result = locale->convertDigits( QString::number( number ).rightJustified( padWidth, padChar ), digitSet ); -+ result = locale->convertDigits(QString::number(number).rightJustified(padWidth, padChar), digitSet); - } - //kDebug() << " result = " << result; - return result; -diff --git a/kdecore/date/kdatetimeformatter_p.h b/kdecore/date/kdatetimeformatter_p.h -index 7f64e08..bfa04dc 100644 ---- a/kdecore/date/kdatetimeformatter_p.h -+++ b/kdecore/date/kdatetimeformatter_p.h -@@ -38,56 +38,56 @@ public: - - virtual ~KDateTimeFormatter(); - -- virtual QString formatDate( const QDate &fromDate, -- const QString &toFormat, -- const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -- const KLocale *locale = KGlobal::locale(), -- KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), -- KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; -- -- virtual QString formatTime( const QTime &fromTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions = 0, -- const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -- const KLocale *locale = KGlobal::locale(), -- KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), -- KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; -- -- virtual QString formatDateTime( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions = 0, -- const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -- const KLocale *locale = KGlobal::locale(), -- KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), -- KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; -+ virtual QString formatDate(const QDate &fromDate, -+ const QString &toFormat, -+ const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -+ const KLocale *locale = KGlobal::locale(), -+ KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), -+ KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const; -+ -+ virtual QString formatTime(const QTime &fromTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions = 0, -+ const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -+ const KLocale *locale = KGlobal::locale(), -+ KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), -+ KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const; -+ -+ virtual QString formatDateTime(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions = 0, -+ const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -+ const KLocale *locale = KGlobal::locale(), -+ KLocale::DigitSet digitSet = KGlobal::locale()->dateTimeDigitSet(), -+ KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const; - - private: -- virtual QString formatDateTimePosix( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard standard ) const; -- -- virtual void initEnglish( const KCalendarSystem *calendar, const KLocale *locale ) const; -- -- virtual QString formatDateTimeUnicode( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet ) const; -- -- virtual QString getUnicodeString( const KDateTime &fromDateTime, -- const QString &toFormat, -- KLocale::TimeFormatOptions timeOptions, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet ) const; -- -- virtual QString stringFromInteger( int number, int padWidth, QChar padChar, QChar signChar, -- KLocale::DigitSet digitSet, const KLocale *locale ) const; -+ virtual QString formatDateTimePosix(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard standard) const; -+ -+ virtual void initEnglish(const KCalendarSystem *calendar, const KLocale *locale) const; -+ -+ virtual QString formatDateTimeUnicode(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet) const; -+ -+ virtual QString getUnicodeString(const KDateTime &fromDateTime, -+ const QString &toFormat, -+ KLocale::TimeFormatOptions timeOptions, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet) const; -+ -+ virtual QString stringFromInteger(int number, int padWidth, QChar padChar, QChar signChar, -+ KLocale::DigitSet digitSet, const KLocale *locale) const; - - // Is private class, but if ever made public need to move these into a d-> - // Some format modifiers force English names to be returned -diff --git a/kdecore/date/kdatetimeparser.cpp b/kdecore/date/kdatetimeparser.cpp -index ba50373..a416808 100644 ---- a/kdecore/date/kdatetimeparser.cpp -+++ b/kdecore/date/kdatetimeparser.cpp -@@ -34,46 +34,46 @@ KDateTimeParser::~KDateTimeParser() - } - - // Parse a DateTime input string and return just the Date component --QDate KDateTimeParser::parseDate( const QString &inputString, -- const QString &formatString, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard formatStandard ) const -+QDate KDateTimeParser::parseDate(const QString &inputString, -+ const QString &formatString, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard formatStandard) const - { - DateTimeComponents result; -- if ( formatStandard == KLocale::UnicodeFormat ) { -- result = parseDateUnicode( inputString, formatString, calendar, locale, digitSet ); -+ if (formatStandard == KLocale::UnicodeFormat) { -+ result = parseDateUnicode(inputString, formatString, calendar, locale, digitSet); - } else { -- result = parseDatePosix( inputString, formatString, calendar, locale, digitSet, formatStandard ); -+ result = parseDatePosix(inputString, formatString, calendar, locale, digitSet, formatStandard); - } - - QDate resultDate; - -- if ( !result.error && -- formatString.simplified().length() <= result.formatPosition && -- inputString.simplified().length() <= result.inputPosition ) { -+ if (!result.error && -+ formatString.simplified().length() <= result.formatPosition && -+ inputString.simplified().length() <= result.inputPosition) { - - // If there were no parsing errors, and we have reached the end of both the input and - // format strings, then see if we have a valid date based on the components parsed - - // If we haven't parsed a year component, then assume this year -- if ( !result.parsedYear ) { -- result.year = calendar->year( QDate::currentDate() ); -+ if (!result.parsedYear) { -+ result.year = calendar->year(QDate::currentDate()); - } - -- if ( ( !result.eraName.isEmpty() || result.yearInEra > -1 ) && result.month > 0 && result.day > 0 ) { -+ if ((!result.eraName.isEmpty() || result.yearInEra > -1) && result.month > 0 && result.day > 0) { - // Have parsed Era components as well as month and day components -- calendar->setDate( resultDate, result.eraName, result.yearInEra, result.month, result.day ); -- } else if ( result.month > 0 && result.day > 0 ) { -+ calendar->setDate(resultDate, result.eraName, result.yearInEra, result.month, result.day); -+ } else if (result.month > 0 && result.day > 0) { - // Have parsed month and day components -- calendar->setDate( resultDate, result.year, result.month, result.day ); -- } else if ( result.dayInYear > 0 ) { -+ calendar->setDate(resultDate, result.year, result.month, result.day); -+ } else if (result.dayInYear > 0) { - // Have parsed Day In Year component -- calendar->setDate( resultDate, result.year, result.dayInYear ); -- } else if ( result.isoWeekNumber > 0 && result.dayOfIsoWeek > 0 ) { -+ calendar->setDate(resultDate, result.year, result.dayInYear); -+ } else if (result.isoWeekNumber > 0 && result.dayOfIsoWeek > 0) { - // Have parsed ISO Week components -- calendar->setDateIsoWeek( resultDate, result.year, result.isoWeekNumber, result.dayOfIsoWeek ); -+ calendar->setDateIsoWeek(resultDate, result.year, result.isoWeekNumber, result.dayOfIsoWeek); - } - - } -@@ -81,12 +81,12 @@ QDate KDateTimeParser::parseDate( const QString &inputString, - return resultDate; - } - --DateTimeComponents KDateTimeParser::parseDatePosix( const QString &inputString, -- const QString &formatString, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard standard ) const -+DateTimeComponents KDateTimeParser::parseDatePosix(const QString &inputString, -+ const QString &formatString, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard standard) const - { - QString str = inputString.simplified().toLower(); - QString fmt = formatString.simplified(); -@@ -104,15 +104,15 @@ DateTimeComponents KDateTimeParser::parseDatePosix( const QString &inputString, - int readLength; // Temporary variable used when reading input - bool error = false; - -- while ( fmt.length() > fmtpos && str.length() > strpos && !error ) { -+ while (fmt.length() > fmtpos && str.length() > strpos && !error) { - -- QChar fmtChar = fmt.at( fmtpos++ ); -+ QChar fmtChar = fmt.at(fmtpos++); - -- if ( fmtChar != QLatin1Char('%') ) { -+ if (fmtChar != QLatin1Char('%')) { - -- if ( fmtChar.isSpace() && str.at(strpos).isSpace() ) { -+ if (fmtChar.isSpace() && str.at(strpos).isSpace()) { - strpos++; -- } else if ( fmtChar.toLower() == str.at(strpos) ) { -+ } else if (fmtChar.toLower() == str.at(strpos)) { - strpos++; - } else { - error = true; -@@ -123,169 +123,168 @@ DateTimeComponents KDateTimeParser::parseDatePosix( const QString &inputString, - QString shortName, longName; - QChar modifierChar; - // remove space at the beginning -- if ( str.length() > strpos && str.at( strpos ).isSpace() ) { -+ if (str.length() > strpos && str.at(strpos).isSpace()) { - strpos++; - } - -- fmtChar = fmt.at( fmtpos++ ); -- if ( fmtChar == QLatin1Char('E') ) { -+ fmtChar = fmt.at(fmtpos++); -+ if (fmtChar == QLatin1Char('E')) { - modifierChar = fmtChar; -- fmtChar = fmt.at( fmtpos++ ); -+ fmtChar = fmt.at(fmtpos++); - } - -- switch ( fmtChar.unicode() ) -- { -- case 'a': // Weekday Name Short -- case 'A': // Weekday Name Long -- error = true; -- j = 1; -- while ( error && j <= calendar->d_ptr->maxDaysInWeek() ) { -- shortName = calendar->weekDayName( j, KCalendarSystem::ShortDayName ).toLower(); -- longName = calendar->weekDayName( j, KCalendarSystem::LongDayName ).toLower(); -- if ( str.mid( strpos, longName.length() ) == longName ) { -- strpos += longName.length(); -- error = false; -- } else if ( str.mid( strpos, shortName.length() ) == shortName ) { -- strpos += shortName.length(); -- error = false; -- } -- ++j; -+ switch (fmtChar.unicode()) { -+ case 'a': // Weekday Name Short -+ case 'A': // Weekday Name Long -+ error = true; -+ j = 1; -+ while (error && j <= calendar->d_ptr->maxDaysInWeek()) { -+ shortName = calendar->weekDayName(j, KCalendarSystem::ShortDayName).toLower(); -+ longName = calendar->weekDayName(j, KCalendarSystem::LongDayName).toLower(); -+ if (str.mid(strpos, longName.length()) == longName) { -+ strpos += longName.length(); -+ error = false; -+ } else if (str.mid(strpos, shortName.length()) == shortName) { -+ strpos += shortName.length(); -+ error = false; - } -- break; -- case 'b': // Month Name Short -- case 'h': // Month Name Short -- case 'B': // Month Name Long -- error = true; -- j = 1; -- while ( error && j <= calendar->d_ptr->maxMonthsInYear() ) { -- // This may be a problem in calendar systems with variable number of months -- // in the year and/or names of months that change depending on the year, e.g -- // Hebrew. We really need to know the correct year first, but we may not have -- // read it yet and will be using the current year instead -- int monthYear; -- if ( parsedYear ) { -- monthYear = yy; -- } else { -- monthYear = calendar->year( QDate::currentDate() ); -- } -- if ( calendar->locale()->dateMonthNamePossessive() ) { -- shortName = calendar->monthName( j, monthYear, KCalendarSystem::ShortNamePossessive ).toLower(); -- longName = calendar->monthName( j, monthYear, KCalendarSystem::LongNamePossessive ).toLower(); -- } else { -- shortName = calendar->monthName( j, monthYear, KCalendarSystem::ShortName ).toLower(); -- longName = calendar->monthName( j, monthYear, KCalendarSystem::LongName ).toLower(); -- } -- if ( str.mid( strpos, longName.length() ) == longName ) { -- mm = j; -- strpos += longName.length(); -- error = false; -- } else if ( str.mid( strpos, shortName.length() ) == shortName ) { -- mm = j; -- strpos += shortName.length(); -- error = false; -- } -- ++j; -+ ++j; -+ } -+ break; -+ case 'b': // Month Name Short -+ case 'h': // Month Name Short -+ case 'B': // Month Name Long -+ error = true; -+ j = 1; -+ while (error && j <= calendar->d_ptr->maxMonthsInYear()) { -+ // This may be a problem in calendar systems with variable number of months -+ // in the year and/or names of months that change depending on the year, e.g -+ // Hebrew. We really need to know the correct year first, but we may not have -+ // read it yet and will be using the current year instead -+ int monthYear; -+ if (parsedYear) { -+ monthYear = yy; -+ } else { -+ monthYear = calendar->year(QDate::currentDate()); - } -- break; -- case 'd': // Day Number Long -- case 'e': // Day Number Short -- dd = calendar->dayStringToInteger( str.mid( strpos ), readLength ); -- strpos += readLength; -- error = readLength <= 0; -- break; -- case 'n': -- // PosixFormat %n is Newline -- // KdeFormat %n is Month Number Short -- if ( standard == KLocale::KdeFormat ) { -- mm = calendar->monthStringToInteger( str.mid( strpos ), readLength ); -- strpos += readLength; -- error = readLength <= 0; -+ if (calendar->locale()->dateMonthNamePossessive()) { -+ shortName = calendar->monthName(j, monthYear, KCalendarSystem::ShortNamePossessive).toLower(); -+ longName = calendar->monthName(j, monthYear, KCalendarSystem::LongNamePossessive).toLower(); -+ } else { -+ shortName = calendar->monthName(j, monthYear, KCalendarSystem::ShortName).toLower(); -+ longName = calendar->monthName(j, monthYear, KCalendarSystem::LongName).toLower(); - } -- // standard == KLocale::PosixFormat -- // all whitespace already 'eaten', no action required -- break; -- case 'm': // Month Number Long -- mm = calendar->monthStringToInteger( str.mid( strpos ), readLength ); -+ if (str.mid(strpos, longName.length()) == longName) { -+ mm = j; -+ strpos += longName.length(); -+ error = false; -+ } else if (str.mid(strpos, shortName.length()) == shortName) { -+ mm = j; -+ strpos += shortName.length(); -+ error = false; -+ } -+ ++j; -+ } -+ break; -+ case 'd': // Day Number Long -+ case 'e': // Day Number Short -+ dd = calendar->dayStringToInteger(str.mid(strpos), readLength); -+ strpos += readLength; -+ error = readLength <= 0; -+ break; -+ case 'n': -+ // PosixFormat %n is Newline -+ // KdeFormat %n is Month Number Short -+ if (standard == KLocale::KdeFormat) { -+ mm = calendar->monthStringToInteger(str.mid(strpos), readLength); - strpos += readLength; - error = readLength <= 0; -- break; -- case 'Y': // Year Number Long -- case 'y': // Year Number Short -- if ( modifierChar == QLatin1Char('E') ) { // Year In Era -- if ( fmtChar == QLatin1Char('y') ) { -- ey = calendar->yearStringToInteger( str.mid( strpos ), readLength ); -- strpos += readLength; -- error = readLength <= 0; -- } else { -- error = true; -- j = calendar->eraList()->count() -1; // Start with the most recent -- while ( error && j >= 0 ) { -- QString subFormat = calendar->eraList()->at( j ).format(); -- QString subInput = str.mid( strpos ); -- DateTimeComponents subResult = parseDatePosix( subInput, subFormat, calendar, locale, digitSet, standard ); -- if ( !subResult.error ) { -- if ( subResult.parsedYear ) { -- yy = subResult.year; -- parsedYear = true; -- error = false; -- strpos += subResult.inputPosition; -- } else if ( !subResult.eraName.isEmpty() && subResult.yearInEra >= 0 ) { -- ee = subResult.eraName; -- ey = subResult.yearInEra; -- error = false; -- strpos += subResult.inputPosition; -- } -- } -- --j; -- } -- } -- } else { -- yy = calendar->yearStringToInteger( str.mid( strpos ), readLength ); -+ } -+ // standard == KLocale::PosixFormat -+ // all whitespace already 'eaten', no action required -+ break; -+ case 'm': // Month Number Long -+ mm = calendar->monthStringToInteger(str.mid(strpos), readLength); -+ strpos += readLength; -+ error = readLength <= 0; -+ break; -+ case 'Y': // Year Number Long -+ case 'y': // Year Number Short -+ if (modifierChar == QLatin1Char('E')) { // Year In Era -+ if (fmtChar == QLatin1Char('y')) { -+ ey = calendar->yearStringToInteger(str.mid(strpos), readLength); - strpos += readLength; -- if ( fmtChar == QLatin1Char('y') ) { -- yy = calendar->applyShortYearWindow( yy ); -- } - error = readLength <= 0; -- if ( !error ) { -- parsedYear = true; -- } -- } -- break; -- case 'C': // Era -- error = true; -- if ( modifierChar == QLatin1Char('E') ) { -- j = calendar->eraList()->count() -1; // Start with the most recent -- while ( error && j >= 0 ) { -- shortName = calendar->d_ptr->m_eraList->at( j ).name( KLocale::ShortName ).toLower(); -- longName = calendar->eraList()->at( j ).name( KLocale::LongName ).toLower(); -- if ( str.mid( strpos, longName.length() ) == longName ) { -- strpos += longName.length(); -- ee = longName; -- error = false; -- } else if ( str.mid( strpos, shortName.length() ) == shortName ) { -- strpos += shortName.length(); -- ee = shortName; -- error = false; -+ } else { -+ error = true; -+ j = calendar->eraList()->count() - 1; // Start with the most recent -+ while (error && j >= 0) { -+ QString subFormat = calendar->eraList()->at(j).format(); -+ QString subInput = str.mid(strpos); -+ DateTimeComponents subResult = parseDatePosix(subInput, subFormat, calendar, locale, digitSet, standard); -+ if (!subResult.error) { -+ if (subResult.parsedYear) { -+ yy = subResult.year; -+ parsedYear = true; -+ error = false; -+ strpos += subResult.inputPosition; -+ } else if (!subResult.eraName.isEmpty() && subResult.yearInEra >= 0) { -+ ee = subResult.eraName; -+ ey = subResult.yearInEra; -+ error = false; -+ strpos += subResult.inputPosition; -+ } - } - --j; - } - } -- break; -- case 'j': // Day Of Year Number -- dayInYear = integerFromString( str.mid( strpos ), 3, readLength ); -- strpos += readLength; -- error = readLength <= 0; -- break; -- case 'V': // ISO Week Number -- isoWeekNumber = integerFromString( str.mid( strpos ), 2, readLength ); -- strpos += readLength; -- error = readLength <= 0; -- break; -- case 'u': // ISO Day Of Week -- dayOfIsoWeek = integerFromString( str.mid( strpos ), 1, readLength ); -+ } else { -+ yy = calendar->yearStringToInteger(str.mid(strpos), readLength); - strpos += readLength; -+ if (fmtChar == QLatin1Char('y')) { -+ yy = calendar->applyShortYearWindow(yy); -+ } - error = readLength <= 0; -- break; -+ if (!error) { -+ parsedYear = true; -+ } -+ } -+ break; -+ case 'C': // Era -+ error = true; -+ if (modifierChar == QLatin1Char('E')) { -+ j = calendar->eraList()->count() - 1; // Start with the most recent -+ while (error && j >= 0) { -+ shortName = calendar->d_ptr->m_eraList->at(j).name(KLocale::ShortName).toLower(); -+ longName = calendar->eraList()->at(j).name(KLocale::LongName).toLower(); -+ if (str.mid(strpos, longName.length()) == longName) { -+ strpos += longName.length(); -+ ee = longName; -+ error = false; -+ } else if (str.mid(strpos, shortName.length()) == shortName) { -+ strpos += shortName.length(); -+ ee = shortName; -+ error = false; -+ } -+ --j; -+ } -+ } -+ break; -+ case 'j': // Day Of Year Number -+ dayInYear = integerFromString(str.mid(strpos), 3, readLength); -+ strpos += readLength; -+ error = readLength <= 0; -+ break; -+ case 'V': // ISO Week Number -+ isoWeekNumber = integerFromString(str.mid(strpos), 2, readLength); -+ strpos += readLength; -+ error = readLength <= 0; -+ break; -+ case 'u': // ISO Day Of Week -+ dayOfIsoWeek = integerFromString(str.mid(strpos), 1, readLength); -+ strpos += readLength; -+ error = readLength <= 0; -+ break; - } - } - } -@@ -294,12 +293,12 @@ DateTimeComponents KDateTimeParser::parseDatePosix( const QString &inputString, - result.error = error; - result.inputPosition = strpos; - result.formatPosition = fmtpos; -- if ( error ) { -+ if (error) { - result.day = -1; - result.month = -1; - result.year = 0; - result.parsedYear = false; -- result.eraName = QString(); -+ result.eraName.clear(); - result.yearInEra = -1; - result.dayInYear = -1; - result.isoWeekNumber = -1; -@@ -319,12 +318,15 @@ DateTimeComponents KDateTimeParser::parseDatePosix( const QString &inputString, - } - - // Parse an input string to match a UNICODE DateTime format string and return any components found --DateTimeComponents KDateTimeParser::parseDateUnicode( const QString &inputString, -- const QString &formatString, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet ) const -+DateTimeComponents KDateTimeParser::parseDateUnicode(const QString &inputString, -+ const QString &formatString, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet) const - { -+ Q_UNUSED(calendar); -+ Q_UNUSED(locale); -+ Q_UNUSED(digitSet); - QString str = inputString.simplified().toLower(); - QString fmt = formatString.simplified(); - int dd = -1; -@@ -338,19 +340,19 @@ DateTimeComponents KDateTimeParser::parseDateUnicode( const QString &inputString - int dayOfIsoWeek = -1; - int strpos = 0; - int fmtpos = 0; -- int readLength; // Temporary variable used when reading input -+ //int readLength; // Temporary variable used when reading input - bool error = false; - - DateTimeComponents result; - result.error = error; - result.inputPosition = strpos; - result.formatPosition = fmtpos; -- if ( error ) { -+ if (error) { - result.day = -1; - result.month = -1; - result.year = 0; - result.parsedYear = false; -- result.eraName = QString(); -+ result.eraName.clear(); - result.yearInEra = -1; - result.dayInYear = -1; - result.isoWeekNumber = -1; -@@ -371,26 +373,26 @@ DateTimeComponents KDateTimeParser::parseDateUnicode( const QString &inputString - - // Peel a number off the front of a string which may have other trailing chars after the number - // Stop either at either maxLength, eos, or first non-digit char --int KDateTimeParser::integerFromString( const QString &string, int maxLength, int &readLength ) const -+int KDateTimeParser::integerFromString(const QString &string, int maxLength, int &readLength) const - { - int value = -1; - int position = 0; - readLength = 0; - bool ok = false; - -- if ( maxLength < 0 ) { -+ if (maxLength < 0) { - maxLength = string.length(); - } - -- while ( position < string.length() && -+ while (position < string.length() && - position < maxLength && -- string.at( position ).isDigit() ) { -+ string.at(position).isDigit()) { - position++; - } - -- if ( position > 0 ) { -- value = string.left( position ).toInt( &ok ); -- if ( ok ) { -+ if (position > 0) { -+ value = string.left(position).toInt(&ok); -+ if (ok) { - readLength = position; - } else { - value = -1; -diff --git a/kdecore/date/kdatetimeparser_p.h b/kdecore/date/kdatetimeparser_p.h -index 7a47c3a..4a25b34 100644 ---- a/kdecore/date/kdatetimeparser_p.h -+++ b/kdecore/date/kdatetimeparser_p.h -@@ -31,8 +31,7 @@ class QTime; - class KDateTime; - class KCalendarSystem; - --struct DateTimeComponents --{ -+struct DateTimeComponents { - int day; - int month; - int year; -@@ -54,28 +53,28 @@ public: - - virtual ~KDateTimeParser(); - -- virtual QDate parseDate( const QString &dateString, -- const QString &format, -- const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -- const KLocale *locale = KGlobal::locale(), -- KLocale::DigitSet digitSet = KLocale::ArabicDigits, -- KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat ) const; -+ virtual QDate parseDate(const QString &dateString, -+ const QString &format, -+ const KCalendarSystem *calendar = KGlobal::locale()->calendar(), -+ const KLocale *locale = KGlobal::locale(), -+ KLocale::DigitSet digitSet = KLocale::ArabicDigits, -+ KLocale::DateTimeFormatStandard standard = KLocale::KdeFormat) const; - - private: -- virtual DateTimeComponents parseDatePosix( const QString &dateString, -- const QString &format, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet, -- KLocale::DateTimeFormatStandard standard ) const; -+ virtual DateTimeComponents parseDatePosix(const QString &dateString, -+ const QString &format, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet, -+ KLocale::DateTimeFormatStandard standard) const; - -- virtual DateTimeComponents parseDateUnicode( const QString &inputString, -- const QString &format, -- const KCalendarSystem *calendar, -- const KLocale *locale, -- KLocale::DigitSet digitSet ) const; -+ virtual DateTimeComponents parseDateUnicode(const QString &inputString, -+ const QString &format, -+ const KCalendarSystem *calendar, -+ const KLocale *locale, -+ KLocale::DigitSet digitSet) const; - -- virtual int integerFromString( const QString &string, int maxLength, int &readLength ) const; -+ virtual int integerFromString(const QString &string, int maxLength, int &readLength) const; - }; - - #endif // KDATETIMEPARSER_H -diff --git a/kdecore/date/kdayperiod.cpp b/kdecore/date/kdayperiod.cpp -index 84170b4..c810552 100644 ---- a/kdecore/date/kdayperiod.cpp -+++ b/kdecore/date/kdayperiod.cpp -@@ -167,8 +167,8 @@ QTime KDayPeriod::time(int hip, int minute, int second, int millisecond) const - } - int hour; - if (periodStart() <= periodEnd() || -- (hip >= hourInPeriod(periodStart()) && -- hip <= hourInPeriod(QTime(23, 59, 59, 999)))) { -+ (hip >= hourInPeriod(periodStart()) && -+ hip <= hourInPeriod(QTime(23, 59, 59, 999)))) { - hour = hip + periodStart().hour() - d->m_offsetFromStart; - } else { - hour = hip; -@@ -197,7 +197,7 @@ bool KDayPeriod::isValid(const QTime &time) const - return time >= periodStart() && time <= periodEnd(); - } else { - return ((time >= periodStart() && time <= QTime(23, 59, 59, 999)) || -- (time >= QTime( 0, 0, 0 ) && time <= periodEnd())); -+ (time >= QTime(0, 0, 0) && time <= periodEnd())); - } - } else { - return false; -diff --git a/kdecore/date/klocalizeddate.cpp b/kdecore/date/klocalizeddate.cpp -index b624a34..b918e9e 100644 ---- a/kdecore/date/klocalizeddate.cpp -+++ b/kdecore/date/klocalizeddate.cpp -@@ -42,22 +42,22 @@ public: - }; - - KLocalizedDatePrivate::KLocalizedDatePrivate(const QDate &date, const KCalendarSystem *calendar, bool manageCalendar) -- : QSharedData(), -- m_date(date), -- m_calendar(calendar), -- m_manageCalendar(manageCalendar) -+ : QSharedData(), -+ m_date(date), -+ m_calendar(calendar), -+ m_manageCalendar(manageCalendar) - { - } - - KLocalizedDatePrivate::KLocalizedDatePrivate(const KLocalizedDatePrivate &rhs) -- : QSharedData(rhs), -- m_date(rhs.m_date), -- m_calendar(rhs.m_calendar), -- m_manageCalendar(rhs.m_manageCalendar) -+ : QSharedData(rhs), -+ m_date(rhs.m_date), -+ m_calendar(rhs.m_calendar), -+ m_manageCalendar(rhs.m_manageCalendar) - { - // If we're managing the calendar object, then take a copy, - // i.e. user called setCalendarSystem() rather than passing a custom one into the constructor -- if(m_manageCalendar) { -+ if (m_manageCalendar) { - m_calendar = KCalendarSystem::create(m_calendar->calendarSystem(), new KLocale(*m_calendar->locale())); - } - } -@@ -69,7 +69,7 @@ KLocalizedDatePrivate &KLocalizedDatePrivate::operator=(const KLocalizedDatePriv - m_manageCalendar = rhs.m_manageCalendar; - // If we're managing the calendar object, then take a copy, - // i.e. user called setCalendarSystem() rather than passing a custom one into the constructor -- if(rhs.m_manageCalendar) { -+ if (rhs.m_manageCalendar) { - m_calendar = KCalendarSystem::create(m_calendar->calendarSystem(), new KLocale(*m_calendar->locale())); - } - return *this; -@@ -91,18 +91,18 @@ KLocalizedDatePrivate::~KLocalizedDatePrivate() - *****************************************************************************/ - - KLocalizedDate::KLocalizedDate(const QDate &date, const KCalendarSystem *calendarSystem) -- : d(new KLocalizedDatePrivate(date, calendarSystem, false)) -+ : d(new KLocalizedDatePrivate(date, calendarSystem, false)) - { - } - - KLocalizedDate::KLocalizedDate(int year, int month, int day, const KCalendarSystem *calendarSystem) -- : d(new KLocalizedDatePrivate(QDate(), calendarSystem, false)) -+ : d(new KLocalizedDatePrivate(QDate(), calendarSystem, false)) - { - setDate(year, month, day); - } - - KLocalizedDate::KLocalizedDate(const KLocalizedDate &rhs) -- : d(new KLocalizedDatePrivate(*rhs.d)) -+ : d(new KLocalizedDatePrivate(*rhs.d)) - { - } - -@@ -148,7 +148,7 @@ KLocale::CalendarSystem KLocalizedDate::calendarSystem() - - const KCalendarSystem *KLocalizedDate::calendar() const - { -- if ( d->m_calendar ) { -+ if (d->m_calendar) { - return d->m_calendar; - } - return KGlobal::locale()->calendar(); -@@ -167,7 +167,7 @@ bool KLocalizedDate::isNull() const - - bool KLocalizedDate::isValid() const - { -- return calendar()->isValid( date() ); -+ return calendar()->isValid(date()); - } - - /***************************************************************************** -@@ -297,13 +297,12 @@ int KLocalizedDate::dayOfWeek() const - - int KLocalizedDate::week(int *yearNum) const - { -- return calendar()->weekNumber(date(), yearNum); -+ return calendar()->week(date(), yearNum); - } - - int KLocalizedDate::week(KLocale::WeekNumberSystem weekNumberSystem, int *yearNum) const - { -- Q_UNUSED(weekNumberSystem); -- return calendar()->weekNumber(date(), yearNum); -+ return calendar()->week(date(), weekNumberSystem, yearNum); - } - - int KLocalizedDate::monthsInYear() const -@@ -318,8 +317,7 @@ int KLocalizedDate::weeksInYear() const - - int KLocalizedDate::weeksInYear(KLocale::WeekNumberSystem weekNumberSystem) const - { -- Q_UNUSED(weekNumberSystem); -- return calendar()->weeksInYear(date()); -+ return calendar()->weeksInYear(date(), weekNumberSystem); - } - - int KLocalizedDate::daysInYear() const -@@ -454,13 +452,13 @@ bool KLocalizedDate::addDaysTo(int days) - } - - void KLocalizedDate::dateDifference(const KLocalizedDate &toDate, -- int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const -+ int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const - { - dateDifference(toDate.date(), yearsDiff, monthsDiff, daysDiff, direction); - } - - void KLocalizedDate::dateDifference(const QDate &toDate, -- int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const -+ int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const - { - calendar()->dateDifference(date(), toDate, yearsDiff, monthsDiff, daysDiff, direction); - } -@@ -606,7 +604,7 @@ QDataStream &operator>>(QDataStream &in, KLocalizedDate &date) - - QDebug operator<<(QDebug dbg, const KLocalizedDate &date) - { -- if (date.calendar()->calendarType() == QLatin1String("gregorian")) { -+ if (date.calendar()->calendarSystem() == KLocale::QDateCalendar) { - dbg.nospace() << "KLocalizedDate(" << date.formatDate(KLocale::IsoDate) << ", " - << date.calendar()->calendarLabel() << ')'; - } else { -diff --git a/kdecore/date/klocalizeddate.h b/kdecore/date/klocalizeddate.h -index 2d1d611..6842577 100644 ---- a/kdecore/date/klocalizeddate.h -+++ b/kdecore/date/klocalizeddate.h -@@ -17,8 +17,8 @@ - Boston, MA 02110-1301, USA. - */ - --#ifndef KDATE_H --#define KDATE_H -+#ifndef KLOCALIZEDDATE_H -+#define KLOCALIZEDDATE_H - - #include <QtCore/QString> - #include <QtCore/QDate> -@@ -151,7 +151,7 @@ public: - * See @ref custom for more details on using custom Calendar Systems. - * - * @param date the QDate to set the KLocalizedDate to, defaults to invalid date -- * @param locale the locale to use for date formats, defaults to the global -+ * @param calendar the calendar system to use, defaults to the global - */ - explicit KLocalizedDate(const QDate &date = QDate(), const KCalendarSystem *calendar = 0); - -@@ -169,6 +169,7 @@ public: - * @param year the year to set the KLocalizedDate to - * @param month the month to set the KLocalizedDate to - * @param day the day to set the KLocalizedDate to -+ * @param calendar the calendar system to use, defaults to the global - */ - KLocalizedDate(int year, int month, int day, const KCalendarSystem *calendar = 0); - -@@ -297,7 +298,7 @@ public: - * @see eraName() - * @see yearInEra() - * @param eraName Era string -- * @param year Year In Era number -+ * @param yearInEra Year In Era number - * @param month Month number - * @param day Day Of Month number - * @return @c true if the date is valid, @c false otherwise -@@ -421,7 +422,6 @@ public: - * See @ref formatting for more details on Date Formatting. - * - * @see formatDate() -- * @param format format to return, either short or long - * @return the localized era name, empty string if date is invalid - */ - QString eraName() const; -@@ -433,7 +433,6 @@ public: - * See @ref formatting for more details on Date Formatting. - * - * @see formatDate() -- * @param format format to return, either short or long - * @return the localized era year string, empty string if date is invalid - */ - QString eraYear() const; -@@ -1166,22 +1165,25 @@ Q_DECLARE_METATYPE(KLocalizedDate) - /** - * Data stream output operator - * -- * @param other the date to compare -+ * @param out the datastream to write to -+ * @param date the date to write to the stream - */ - QDataStream KDECORE_EXPORT &operator<<(QDataStream &out, const KLocalizedDate &date); - - /** - * Data stream input operator - * -- * @param other the date to compare -+ * @param out the datastream to read from -+ * @param date the date to read from the stream - */ - QDataStream KDECORE_EXPORT &operator>>(QDataStream &in, KLocalizedDate &date); - - /** - * Debug stream output operator - * -- * @param other the date to print -+ * @param out the debug datastream to write to -+ * @param date the date to write to the stream - */ --QDebug KDECORE_EXPORT operator<<(QDebug, const KLocalizedDate &); -+QDebug KDECORE_EXPORT operator<<(QDebug debug, const KLocalizedDate &date); - --#endif // KDATE_H -+#endif // KLOCALIZEDDATE_H -diff --git a/kdecore/CMakeLists.txt b/kdecore/CMakeLists.txt -index f78c115..276f005 100644 ---- a/kdecore/CMakeLists.txt -+++ b/kdecore/CMakeLists.txt -@@ -184,9 +184,9 @@ set(kdecore_LIB_SRCS - date/kcalendarsystem.cpp - date/kcalendarsystemcoptic.cpp - date/kcalendarsystemethiopian.cpp -+ date/kcalendarsystemqdate.cpp - date/kcalendarsystemgregorian.cpp -- date/kcalendarsystemgregorianproleptic.cpp -- date/kcalendarsystemhijri.cpp -+ date/kcalendarsystemislamiccivil.cpp - date/kcalendarsystemhebrew.cpp - date/kcalendarsystemindiannational.cpp - date/kcalendarsystemjalali.cpp diff --git a/kde-unstable/kdepim/fix-console-build.patch b/kde-unstable/kdepim/fix-console-build.patch deleted file mode 100644 index 552b8c0c1..000000000 --- a/kde-unstable/kdepim/fix-console-build.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/console/kabcclient/src/main.cpp -+++ b/console/kabcclient/src/main.cpp -@@ -117,7 +117,7 @@ int main(int argc, char** argv) - - cmdLineOptions.add("match-case", ki18n("Match key fields case sensitive. UID is always matched case sensitive")); - -- cmdLineOptions.add(ki18n("+[input data]"), ki18n("Input to use instead of reading stdin")); -+ cmdLineOptions.add("+[input data]", ki18n("Input to use instead of reading stdin")); - - KCmdLineArgs::addCmdLineOptions(cmdLineOptions); - KCmdLineArgs::init(argc, argv, &aboutData); diff --git a/kde-unstable/libkface/PKGBUILD b/kde-unstable/libkface/PKGBUILD deleted file mode 100644 index 9bdcab86b..000000000 --- a/kde-unstable/libkface/PKGBUILD +++ /dev/null @@ -1,30 +0,0 @@ -# $Id: PKGBUILD 124682 2011-05-23 20:54:29Z andrea $ -# Maintainer: Andrea Scarpino <andrea@archlinux.org> - -pkgname=libkface -pkgver=4.6.80 -pkgrel=1 -pkgdesc="A library to perform face recognition and detection over pictures" -url="http://kde.org/" -arch=('i686' 'x86_64') -license=('GPL' 'LGPL' 'FDL') -depends=('kdelibs' 'opencv') -makedepends=('cmake' 'automoc4') -#install=${pkgname}.install -source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") -sha1sums=('197b7c26e70c45339745efc839698c3ad276bb65') - -build() { - cd "${srcdir}" - mkdir build - cd build - cmake ../${pkgname}-${pkgver} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr - make -} - -package() { - cd "${srcdir}"/build - make DESTDIR="${pkgdir}" install -} diff --git a/kde-unstable/libkmap/PKGBUILD b/kde-unstable/libkmap/PKGBUILD deleted file mode 100644 index b2ae07a94..000000000 --- a/kde-unstable/libkmap/PKGBUILD +++ /dev/null @@ -1,30 +0,0 @@ -# $Id: PKGBUILD 124764 2011-05-24 08:23:10Z andrea $ -# Maintainer: Andrea Scarpino <andrea@archlinux.org> - -pkgname=libkmap -pkgver=4.6.80 -pkgrel=1 -pkgdesc="A library to browse and arrange photos over a map" -url="http://kde.org/" -arch=('i686' 'x86_64') -license=('GPL' 'LGPL' 'FDL') -depends=('kdeedu-marble') -makedepends=('cmake' 'automoc4') -source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") -sha1sums=('87a91c4076e4c8867d129679494a4de19ba2e1bd') - -build() { - cd "${srcdir}" - mkdir build - cd build - cmake ../${pkgname}-${pkgver} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DWITH_Kexiv2=OFF - make -} - -package() { - cd "${srcdir}"/build - make DESTDIR="${pkgdir}" install -} |