diff options
Diffstat (limited to 'kde-unstable')
151 files changed, 23538 insertions, 22 deletions
diff --git a/kde-unstable/akonadi/PKGBUILD b/kde-unstable/akonadi/PKGBUILD index 52f2939bd..c19e6d4ce 100644 --- a/kde-unstable/akonadi/PKGBUILD +++ b/kde-unstable/akonadi/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 124449 2011-05-21 11:40:47Z andrea $ +# $Id: PKGBUILD 125234 2011-05-25 19:13:14Z andrea $ # Maintainer: Andrea Scarpino <andrea@archlinux.org> # Contributor: Pierre Schmitz <pierre@archlinux.de> pkgname=akonadi pkgver=1.5.80 -pkgrel=1 +pkgrel=2 pkgdesc="PIM layer, which provides an asynchronous API to access all kind of PIM data" arch=('i686' 'x86_64') url='http://pim.kde.org/akonadi' diff --git a/kde-unstable/kdeaccessibility/PKGBUILD b/kde-unstable/kdeaccessibility/PKGBUILD new file mode 100644 index 000000000..37fe2397e --- /dev/null +++ b/kde-unstable/kdeaccessibility/PKGBUILD @@ -0,0 +1,83 @@ +# $Id: PKGBUILD 124844 2011-05-24 18:14:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdeaccessibility +pkgname=('kdeaccessibility-jovie' + 'kdeaccessibility-kaccessible' + 'kdeaccessibility-kmag' + 'kdeaccessibility-kmousetool' + 'kdeaccessibility-kmouth') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://accessibility.kde.org' +license=('GPL' 'FDL') +groups=('kde' 'kdeaccessibility') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'kdelibs' 'speech-dispatcher') +source=("http://download.kde.org/stable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('a8d4ca99dadc9439b6a1ee91645527f954665cb1') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_Opentts=OFF + make +} + +package_kdeaccessibility-jovie() { + pkgdesc='A text to speech application' + depends=('kdebase-runtime' 'speech-dispatcher') + replaces=('kdeaccessibility-kttsd') + install='kdeaccessibility.install' + cd $srcdir/build/jovie + make DESTDIR=$pkgdir install + cd $srcdir/build/jovie/doc + make DESTDIR=$pkgdir install +} + +package_kdeaccessibility-kaccessible() { + pkgdesc='Provides accessibility services like focus tracking and a screenreader' + depends=('kdebase-runtime' 'speech-dispatcher') + install='kdeaccessibility.install' + cd $srcdir/build/kaccessible + make DESTDIR=$pkgdir install +} + +package_kdeaccessibility-kmag() { + pkgdesc='Screen Magnifier' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kmag/" + install='kdeaccessibility.install' + cd $srcdir/build/kmag + make DESTDIR=$pkgdir install + cd $srcdir/build/kmag/doc + make DESTDIR=$pkgdir install +} + +package_kdeaccessibility-kmousetool() { + pkgdesc='Clicks the mouse for you, reducing the effects of RSI' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kmousetool/" + install='kdeaccessibility.install' + cd $srcdir/build/kmousetool + make DESTDIR=$pkgdir install + cd $srcdir/build/kmousetool/doc + make DESTDIR=$pkgdir install +} + +package_kdeaccessibility-kmouth() { + pkgdesc='Speech Synthesizer Frontend' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kmouth/" + install='kdeaccessibility.install' + cd $srcdir/build/kmouth + make DESTDIR=$pkgdir install + cd $srcdir/build/kmouth/doc + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdeaccessibility/kdeaccessibility.install b/kde-unstable/kdeaccessibility/kdeaccessibility.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeaccessibility/kdeaccessibility.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeadmin/PKGBUILD b/kde-unstable/kdeadmin/PKGBUILD new file mode 100644 index 000000000..ceac7ec49 --- /dev/null +++ b/kde-unstable/kdeadmin/PKGBUILD @@ -0,0 +1,77 @@ +# $Id: PKGBUILD 124778 2011-05-24 11:55:25Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdeadmin +pkgname=('kdeadmin-kcron' + 'kdeadmin-ksystemlog' + 'kdeadmin-kuser' + 'kdeadmin-system-config-printer-kde') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeadmin') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'kdebindings-python' + 'system-config-printer-common') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2" + 'syslog-path.patch') +sha1sums=('ceb0ccd2d24b64770f6ac7649d312937a09a17e2' + '20095ce6e0f3e5b6800a7c6e52de6fddba62c031') + +build() { + cd ${srcdir}/${pkgbase}-${pkgver} + patch -p1 -i ${srcdir}/syslog-path.patch + + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_strigi-analyzer=OFF + make +} + +package_kdeadmin-kcron() { + pkgdesc='Configure and schedule tasks' + depends=('kdelibs') + cd $srcdir/build/kcron + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kcron + make DESTDIR=$pkgdir install +} + +package_kdeadmin-ksystemlog() { + pkgdesc='System log viewer tool' + depends=('kdebase-runtime') + url="http://kde.org/applications/system/ksystemlog/" + cd $srcdir/build/ksystemlog + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ksystemlog + make DESTDIR=$pkgdir install +} + +package_kdeadmin-kuser() { + pkgdesc='User Manager' + depends=('kdepim-runtime') + url="http://kde.org/applications/system/kuser/" + install='kdeadmin.install' + cd $srcdir/build/kuser + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kuser + make DESTDIR=$pkgdir install +} + +package_kdeadmin-system-config-printer-kde() { + pkgdesc='Configure local and remote Printers' + depends=('kdebindings-python' 'system-config-printer-common' 'python2-pyqt') + url="http://kde.org/applications/system/printerapplet/" + cd $srcdir/build/system-config-printer-kde + make DESTDIR=$pkgdir install + + # Use the python2 executable + find ${pkgdir} -name '*.py' | xargs sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' +} diff --git a/kde-unstable/kdeadmin/kdeadmin.install b/kde-unstable/kdeadmin/kdeadmin.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeadmin/kdeadmin.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeadmin/syslog-path.patch b/kde-unstable/kdeadmin/syslog-path.patch new file mode 100644 index 000000000..8a9142bf6 --- /dev/null +++ b/kde-unstable/kdeadmin/syslog-path.patch @@ -0,0 +1,11 @@ +--- kdeadmin-4.6.0/ksystemlog/src/modes/system/systemConfiguration.h~ 2011-01-27 14:24:29.840000005 +0100 ++++ kdeadmin-4.6.0/ksystemlog/src/modes/system/systemConfiguration.h 2011-01-27 14:24:53.803333335 +0100 +@@ -39,7 +39,7 @@ + SystemConfiguration() : + GenericLogModeConfiguration( + QLatin1String( SYSTEM_LOG_MODE_ID ), +- QStringList() << QLatin1String( "/var/log/syslog" ), ++ QStringList() << QLatin1String( "/var/log/messages.log" ), + QList<int>() << INFORMATION_LOG_LEVEL_ID + ) { + diff --git a/kde-unstable/kdeartwork/PKGBUILD b/kde-unstable/kdeartwork/PKGBUILD new file mode 100644 index 000000000..0118d8b45 --- /dev/null +++ b/kde-unstable/kdeartwork/PKGBUILD @@ -0,0 +1,104 @@ +# $Id: PKGBUILD 124845 2011-05-24 18:14:29Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdeartwork +pkgname=('kdeartwork-aurorae' + 'kdeartwork-colorschemes' + 'kdeartwork-desktopthemes' + 'kdeartwork-emoticons' + 'kdeartwork-iconthemes' + 'kdeartwork-kscreensaver' + 'kdeartwork-sounds' + 'kdeartwork-styles' + 'kdeartwork-wallpapers' + 'kdeartwork-weatherwallpapers') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeartwork') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'xscreensaver' 'eigen' + 'kdebase-workspace' 'libkexiv2') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('70c5274f2c933b87c10a1ae53eb6971ae3887e87') + +build() { + cd $srcdir + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdeartwork-aurorae() { + pkgdesc='An Aurorae theme based on the Oxygen plasma theme' + cd $srcdir/build/aurorae + make DESTDIR=$pkgdir install +} + +package_kdeartwork-colorschemes() { + pkgdesc='KDE color schemes' + replaces=('kdeaccessibility-colorschemes') + cd $srcdir/build/ColorSchemes + make DESTDIR=$pkgdir install +} + +package_kdeartwork-desktopthemes() { + pkgdesc='KDE desktop themes' + cd $srcdir/build/desktopthemes + make DESTDIR=$pkgdir install +} + +package_kdeartwork-emoticons() { + pkgdesc='KDE emoticons' + cd $srcdir/build/emoticons + make DESTDIR=$pkgdir install +} + +package_kdeartwork-iconthemes() { + pkgdesc='KDE icon themes' + replaces=('kdeaccessibility-iconthemes') + cd $srcdir/build/IconThemes + make DESTDIR=$pkgdir install +} + +package_kdeartwork-kscreensaver() { + pkgdesc='KDE screensaver' + depends=('kdebase-workspace' 'libkexiv2') + cd $srcdir/build/kscreensaver + make DESTDIR=$pkgdir install +} + +package_kdeartwork-sounds() { + pkgdesc='KDE sounds' + cd $srcdir/build/sounds + make DESTDIR=$pkgdir install +} + +package_kdeartwork-styles() { + pkgdesc='KDE styles' + depends=('kdebase-workspace') + cd $srcdir/build/styles + make DESTDIR=$pkgdir install + cd $srcdir/build/kwin-styles + make DESTDIR=$pkgdir install +} + +package_kdeartwork-wallpapers() { + pkgdesc='KDE wallpapers' + cd $srcdir/build/wallpapers + make DESTDIR=$pkgdir install + cd $srcdir/build/HighResolutionWallpapers + make DESTDIR=$pkgdir install +} + +package_kdeartwork-weatherwallpapers() { + pkgdesc='KDE weather wallpapers' + cd $srcdir/build/WeatherWallpapers + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdebase-konsole/PKGBUILD b/kde-unstable/kdebase-konsole/PKGBUILD new file mode 100644 index 000000000..105e3dc39 --- /dev/null +++ b/kde-unstable/kdebase-konsole/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124800 2011-05-24 13:26:15Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebase-konsole +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://kde.org/applications/system/konsole/' +pkgdesc="Terminal" +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebase') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +source=("http://download.kde.org/unstable/${pkgver}/src/konsole-${pkgver}.tar.bz2") +sha1sums=('7e7b5a0b37ae4d22e51a61f70afccbba86a93921') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../konsole-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebase-runtime/PKGBUILD b/kde-unstable/kdebase-runtime/PKGBUILD new file mode 100644 index 000000000..41d9de7c2 --- /dev/null +++ b/kde-unstable/kdebase-runtime/PKGBUILD @@ -0,0 +1,39 @@ +# $Id: PKGBUILD 124658 2011-05-23 19:42:48Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgname=kdebase-runtime +_pkgname=kde-runtime +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE Base Runtime Environment" +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL') +depends=('kdelibs' 'ntrack' 'smbclient' 'libssh' 'libcanberra' 'oxygen-icons' + 'xorg-xauth' 'hicolor-icon-theme' 'libqzeitgeist') +makedepends=('pkg-config' 'cmake' 'automoc4' 'kdepimlibs' 'openslp' 'xine-lib') +optdepends=('htdig: to build the search index in khelpcenter' + 'rarian: needed by khelpcenter' + 'gdb: drkonq crash handler') +install="${pkgname}.install" +source=("http://download.kde.org/stable/${pkgver}/src/${_pkgname}-${pkgver}.tar.bz2") +sha1sums=('5d06c11f43beb21ebf6c47d2a7addcbe710e019e') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../${_pkgname}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "$srcdir/build" + make DESTDIR="$pkgdir" install + rm -f "${pkgdir}/usr/share/icons/hicolor/index.theme" + ln -sf /usr/lib/kde4/libexec/kdesu "${pkgdir}/usr/bin/" +} diff --git a/kde-unstable/kdebase-runtime/kdebase-runtime.install b/kde-unstable/kdebase-runtime/kdebase-runtime.install new file mode 100644 index 000000000..3f06b8deb --- /dev/null +++ b/kde-unstable/kdebase-runtime/kdebase-runtime.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-mime-database usr/share/mime &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdebase-workspace/PKGBUILD b/kde-unstable/kdebase-workspace/PKGBUILD new file mode 100644 index 000000000..e1763778b --- /dev/null +++ b/kde-unstable/kdebase-workspace/PKGBUILD @@ -0,0 +1,76 @@ +# $Id: PKGBUILD 124944 2011-05-25 10:38:26Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgname=kdebase-workspace +_pkgname=kde-workspace +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE Base Workspace" +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde') +# note on libxdamage: +# not detected by namcap because libgl depends on it +# but nvidia providing libgl does not depend on libxdamage +depends=('kdepim-runtime' 'lm_sensors' 'libraw1394' 'libqalculate' 'qimageblitz' + 'polkit-kde' 'consolekit' 'xorg-xprop' 'libxdamage' 'libxklavier' 'libdmtx' + 'xorg-xsetroot' 'libxcomposite' 'libxinerama' 'libgles' 'kde-wallpapers') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' 'kdebindings-python') +replaces=('kdmtheme' 'kde-common' 'guidance-power-manager' 'policykit-kde' 'kdebase-kinfocenter') +conflicts=('kde-common' 'guidance-power-manager' 'policykit-kde' 'kdebase-kinfocenter') +install="${pkgname}.install" +backup=('usr/share/config/kdm/kdmrc' + 'etc/pam.d/kde' + 'etc/pam.d/kde-np' + 'etc/pam.d/kscreensaver') +options=('emptydirs') +source=("http://download.kde.org/stable/${pkgver}/src/${_pkgname}-${pkgver}.tar.bz2" + 'kdm-zsh-profile.patch' 'kdm' 'kde.pam' 'kde-np.pam' 'kscreensaver.pam' + 'fixpath.patch' 'terminate-server.patch') +sha1sums=('99bf68ee90c4cfa3568527a55c7c68d4247d9b13' + '8c2bdefb23a03b753b78d16944d03fa3939d2d99' + '5db3a245201bd4a50e65aa2ef583cf5490e4f646' + 'f7b38af38549242a240f1a90ab9964ca8a366129' + '603cc79c4d2b4eae62bb5f244aeecb3a778b5516' + '106635aa1aae51d6f0668b1853f6c49a4fe9d3d8' + 'd7b5883f7e65c6839b1f65f94d58026673dd0226' + 'ac7bc292c865bc1ab8c02e6341aa7aeaf1a3eeee') + +build() { + cd ${srcdir}/${_pkgname}-${pkgver} + patch -p0 -i ${srcdir}/kdm-zsh-profile.patch + patch -p0 -i ${srcdir}/fixpath.patch + patch -p0 -i ${srcdir}/terminate-server.patch + + cd ${srcdir} + mkdir build + cd build + cmake ../${_pkgname}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_Xmms=OFF \ + -DWITH_Googlegadgets=OFF \ + -DWITH_libgps=OFF \ + -DWITH_Prison=OFF \ + -DWITH_NetworkManager=OFF \ + -DKWIN_MOBILE_EFFECTS=OFF + make +} + +package() { + cd $srcdir/build + make DESTDIR=$pkgdir install + + install -D -m755 ${srcdir}/kdm ${pkgdir}/etc/rc.d/kdm + install -D -m644 ${srcdir}/kde.pam ${pkgdir}/etc/pam.d/kde + install -D -m644 ${srcdir}/kde-np.pam ${pkgdir}/etc/pam.d/kde-np + install -D -m644 ${srcdir}/kscreensaver.pam ${pkgdir}/etc/pam.d/kscreensaver + install -d -m755 ${pkgdir}/usr/share/xsessions/ + ln -sf /usr/share/apps/kdm/sessions/kde-plasma{,-safe}.desktop ${pkgdir}/usr/share/xsessions/ + install -d -m755 ${pkgdir}/etc/kde/{env,shutdown} + + install -d -g 135 -o 135 ${pkgdir}/var/lib/kdm +} diff --git a/kde-unstable/kdebase-workspace/fixpath.patch b/kde-unstable/kdebase-workspace/fixpath.patch new file mode 100644 index 000000000..be2b8383e --- /dev/null +++ b/kde-unstable/kdebase-workspace/fixpath.patch @@ -0,0 +1,34 @@ +--- startkde.cmake.orig 2009-01-15 14:24:44.000000000 +0100 ++++ startkde.cmake 2009-01-15 14:33:08.000000000 +0100 +@@ -34,22 +34,6 @@ + MALLOC_CHECK_=2 + export MALLOC_CHECK_ + +-# in case we have been started with full pathname spec without being in PATH +-bindir=`echo "$0" | sed -n 's,^\(/.*\)/[^/][^/]*$,\1,p'` +-if [ -n "$bindir" ]; then +- qbindir=`$bindir/kde4-config --qt-binaries` +- if [ -n "$qbindir" ]; then +- case $PATH in +- $qbindir|$qbindir:*|*:$qbindir|*:$qbindir:*) ;; +- *) PATH=$qbindir:$PATH; export PATH;; +- esac +- fi +- case $PATH in +- $bindir|$bindir:*|*:$bindir|*:$bindir:*) ;; +- *) PATH=$bindir:$PATH; export PATH;; +- esac +-fi +- + # Boot sequence: + # + # kdeinit is used to fork off processes which improves memory usage +@@ -206,7 +190,7 @@ + # For anything else (that doesn't set env vars, or that needs a window manager), + # better use the Autostart folder. + +-libpath=`kde4-config --path lib | tr : '\n'` ++libpath=`kde4-config --path lib | tr : '\n'`$(echo -e '\n/etc/kde/lib/') + + for prefix in `echo "$libpath" | sed -n -e 's,/lib[^/]*/,/env/,p'`; do + for file in "$prefix"*.sh; do diff --git a/kde-unstable/kdebase-workspace/kde-np.pam b/kde-unstable/kdebase-workspace/kde-np.pam new file mode 100644 index 000000000..81eeef47b --- /dev/null +++ b/kde-unstable/kdebase-workspace/kde-np.pam @@ -0,0 +1,7 @@ +#%PAM-1.0 +auth required pam_nologin.so +auth required pam_permit.so +account required pam_unix.so +password required pam_unix.so +session required pam_unix.so +session required pam_limits.so
\ No newline at end of file diff --git a/kde-unstable/kdebase-workspace/kde.pam b/kde-unstable/kdebase-workspace/kde.pam new file mode 100644 index 000000000..1a259390f --- /dev/null +++ b/kde-unstable/kdebase-workspace/kde.pam @@ -0,0 +1,7 @@ +#%PAM-1.0 +auth required pam_unix.so +auth required pam_nologin.so +account required pam_unix.so +password required pam_unix.so +session required pam_unix.so +session required pam_limits.so
\ No newline at end of file diff --git a/kde-unstable/kdebase-workspace/kdebase-workspace.install b/kde-unstable/kdebase-workspace/kdebase-workspace.install new file mode 100644 index 000000000..f7d6d305b --- /dev/null +++ b/kde-unstable/kdebase-workspace/kdebase-workspace.install @@ -0,0 +1,25 @@ +post_install() { + groupadd -g 135 kdm &>/dev/null + useradd -u 135 -g kdm -d /var/lib/kdm -s /bin/false -r -M kdm &>/dev/null + chown -R 135:135 var/lib/kdm &>/dev/null + xdg-icon-resource forceupdate --theme hicolor &>/dev/null + update-desktop-database -q +} + +post_upgrade() { + getent group kdm >/dev/null 2>&1 || groupadd -g 135 kdm &>/dev/null + getent passwd kdm >/dev/null 2>&1 || useradd -u 135 -g kdm -d /var/lib/kdm -s /bin/false -r -M kdm &>/dev/null + chown -R 135:135 var/lib/kdm &>/dev/null + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_remove() { + if getent passwd kdm >/dev/null 2>&1; then + userdel kdm + fi + if getent group kdm >/dev/null 2>&1; then + groupdel kdm + fi + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} diff --git a/kde-unstable/kdebase-workspace/kdm b/kde-unstable/kdebase-workspace/kdm new file mode 100644 index 000000000..799d58f4b --- /dev/null +++ b/kde-unstable/kdebase-workspace/kdm @@ -0,0 +1,36 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=$(pidof -o %PPID /usr/bin/kdm) +case "$1" in + start) + stat_busy "Starting KDE Desktop Manager" + [ -z "$PID" ] && /usr/bin/kdm &>/dev/null + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon kdm + stat_done + fi + ;; + stop) + stat_busy "Stopping KDE Desktop Manager" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon kdm + stat_done + fi + ;; + restart) + $0 stop + sleep 3 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/kde-unstable/kdebase-workspace/kdm-zsh-profile.patch b/kde-unstable/kdebase-workspace/kdm-zsh-profile.patch new file mode 100644 index 000000000..779456b39 --- /dev/null +++ b/kde-unstable/kdebase-workspace/kdm-zsh-profile.patch @@ -0,0 +1,11 @@ +--- kdm/kfrontend/genkdmconf.c 2008-02-13 09:40:49.000000000 +0000 ++++ kdm/kfrontend/genkdmconf.c 2008-05-16 12:47:36.000000000 +0000 +@@ -662,7 +662,7 @@ + " [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc\n" + " zhome=${ZDOTDIR:-$HOME}\n" + " # zshenv is always sourced automatically.\n" +-" [ -f $zdir/zprofile ] && . $zdir/zprofile\n" ++" [ -f /etc/profile ] && . /etc/profile\n" + " [ -f $zhome/.zprofile ] && . $zhome/.zprofile\n" + " [ -f $zdir/zlogin ] && . $zdir/zlogin\n" + " [ -f $zhome/.zlogin ] && . $zhome/.zlogin\n" diff --git a/kde-unstable/kdebase-workspace/kscreensaver.pam b/kde-unstable/kdebase-workspace/kscreensaver.pam new file mode 100644 index 000000000..b4d80c21f --- /dev/null +++ b/kde-unstable/kdebase-workspace/kscreensaver.pam @@ -0,0 +1 @@ +auth required pam_unix_auth.so diff --git a/kde-unstable/kdebase-workspace/terminate-server.patch b/kde-unstable/kdebase-workspace/terminate-server.patch new file mode 100644 index 000000000..094591317 --- /dev/null +++ b/kde-unstable/kdebase-workspace/terminate-server.patch @@ -0,0 +1,11 @@ +--- kdm/config.def 2009-08-27 10:17:39.000000000 +0200 ++++ kdm/config.def 2009-10-31 00:40:21.000000000 +0100 +@@ -1448,7 +1448,7 @@ + + Key: TerminateServer + Type: bool +-Default: false ++Default: true + User: core + Instance: #:*/! + Merge: xdm diff --git a/kde-unstable/kdebase/PKGBUILD b/kde-unstable/kdebase/PKGBUILD new file mode 100644 index 000000000..da7098290 --- /dev/null +++ b/kde-unstable/kdebase/PKGBUILD @@ -0,0 +1,117 @@ +# $Id: PKGBUILD 124659 2011-05-23 19:43:17Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdebase +pkgname=('kdebase-dolphin' + 'kdebase-kdepasswd' + 'kdebase-kdialog' + 'kdebase-keditbookmarks' + 'kdebase-kfind' + 'kdebase-konq-plugins' + 'kdebase-konqueror' + 'kdebase-lib' + 'kdebase-plasma') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebase') +makedepends=('kdelibs' 'pkgconfig' 'cmake' 'automoc4' 'tidyhtml') +source=("http://download.kde.org/unstable/${pkgver}/src/kde-baseapps-${pkgver}.tar.bz2") +sha1sums=('f89b848791628d675e26dd7e703bd79834d1c951') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../kde-baseapps-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdebase-dolphin() { + pkgdesc='File Manager' + depends=('kdebase-runtime' 'kdebase-lib') + optdepends=('ruby: servicemenu installation') + url="http://kde.org/applications/system/dolphin/" + cd $srcdir/build/dolphin + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/dolphin + make DESTDIR=$pkgdir install +} + +package_kdebase-kdepasswd() { + pkgdesc='Change Password' + depends=('kdebase-runtime' 'kdebase-lib') + cd $srcdir/build/kdepasswd + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kdepasswd + make DESTDIR=$pkgdir install +} + +package_kdebase-kdialog() { + pkgdesc='A utility for displaying dialog boxes from shell scripts' + depends=('kdebase-runtime') + cd $srcdir/build/kdialog + make DESTDIR=$pkgdir install +} + +package_kdebase-keditbookmarks() { + pkgdesc='Bookmark Organizer and Editor' + depends=('kdebase-runtime') + cd $srcdir/build/keditbookmarks + make DESTDIR=$pkgdir install +} + +package_kdebase-kfind() { + pkgdesc='Find Files/Folders' + depends=('kdebase-runtime' 'kdebase-lib') + url="http://kde.org/applications/utilities/kfind/" + install='kdebase.install' + cd $srcdir/build/kfind + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kfind + make DESTDIR=$pkgdir install +} + +package_kdebase-konq-plugins() { + pkgdesc='Extra plugins for Konqueror' + depends=('kdebase-konqueror') + replaces=('konq-plugins') + install='kdebase.install' + cd $srcdir/build/konq-plugins + make DESTDIR=$pkgdir install +} + +package_kdebase-konqueror() { + pkgdesc='KDE File Manager & Web Browser' + depends=('kdebase-dolphin' 'kdebase-keditbookmarks') + optdepends=('kwebkitpart: to enable webkit engine') + url="http://kde.org/applications/internet/konqueror/" + install='kdebase.install' + conflicts=('kdebase-nsplugins') + replaces=('kdebase-nsplugins') + for i in konqueror doc/konqueror nsplugins; do + cd $srcdir/build/${i} + make DESTDIR=$pkgdir install + done +} + +package_kdebase-lib() { + pkgdesc='KDE libraries for the basic desktop applications' + groups=() + depends=('kdelibs') + cd $srcdir/build/lib + make DESTDIR=$pkgdir install +} + +package_kdebase-plasma() { + pkgdesc='Display the contents of folders (User´s home folder as default)' + depends=('kdebase-workspace' 'kdebase-lib') + cd $srcdir/build/plasma + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdebase/kdebase.install b/kde-unstable/kdebase/kdebase.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdebase/kdebase.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdebindings-kimono/PKGBUILD b/kde-unstable/kdebindings-kimono/PKGBUILD new file mode 100644 index 000000000..0fa73a2b1 --- /dev/null +++ b/kde-unstable/kdebindings-kimono/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124934 2011-05-25 09:35:20Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-kimono +pkgver=4.6.80 +pkgrel=1 +pkgdesc=".NET/Mono bindings for the KDE libraries" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-qyoto' 'kdebindings-smokekde') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen' 'boost' 'kdepimlibs') +conflicts=('kdebindings-csharp') +source=("http://download.kde.org/unstable/${pkgver}/src/kimono-${pkgver}.tar.bz2") +sha1sums=('911dfbee3141ca0f72c13e15bafc549ccd9ab33a') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kimono-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-korundum/PKGBUILD b/kde-unstable/kdebindings-korundum/PKGBUILD new file mode 100644 index 000000000..9c40054a2 --- /dev/null +++ b/kde-unstable/kdebindings-korundum/PKGBUILD @@ -0,0 +1,32 @@ +# $Id: PKGBUILD 124940 2011-05-25 09:48:53Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-korundum +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE bindings for ruby" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-qtruby' 'kdebindings-smokekde') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen' 'boost' + 'kdepimlibs' 'kdegraphics-okular' 'kdesdk-kate') +conflicts=('kdebindings-ruby') +source=("http://download.kde.org/unstable/${pkgver}/src/korundum-${pkgver}.tar.bz2") +sha1sums=('30209e7e3d3dc54c7eb787d7e7bcc90735c5bc1a') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../korundum-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-perlkde/PKGBUILD b/kde-unstable/kdebindings-perlkde/PKGBUILD new file mode 100644 index 000000000..4dfb0d07e --- /dev/null +++ b/kde-unstable/kdebindings-perlkde/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124941 2011-05-25 09:55:03Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-perlkde +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Perl bindings for the KDE libraries" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-perlqt' 'kdebindings-smokekde') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen' 'kdepimlibs' + 'kdegraphics-okular' 'kdesdk-kate') +source=("http://download.kde.org/unstable/${pkgver}/src/perlkde-${pkgver}.tar.bz2") +sha1sums=('0d689b8ffcfaeb1f4e216f00f0ddacb5f59b9047') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../perlkde-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-perlqt/PKGBUILD b/kde-unstable/kdebindings-perlqt/PKGBUILD new file mode 100644 index 000000000..a8268f3c5 --- /dev/null +++ b/kde-unstable/kdebindings-perlqt/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124667 2011-05-23 20:36:47Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-perlqt +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Perl bindings for the Qt libraries" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-smokeqt') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen') +source=("http://download.kde.org/unstable/${pkgver}/src/perlqt-${pkgver}.tar.bz2") +sha1sums=('aa6f72ff5eed3f178a1d7274e61c2c7ed81fd74e') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../perlqt-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-python/PKGBUILD b/kde-unstable/kdebindings-python/PKGBUILD new file mode 100644 index 000000000..817ca914a --- /dev/null +++ b/kde-unstable/kdebindings-python/PKGBUILD @@ -0,0 +1,41 @@ +# $Id: PKGBUILD 124775 2011-05-24 11:26:16Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-python +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE bindings for python" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdepim-runtime' 'python2-pyqt' 'qscintilla' 'boost-libs') +makedepends=('cmake' 'automoc4' 'boost') +source=("http://download.kde.org/unstable/${pkgver}/src/pykde4-${pkgver}.tar.bz2" + 'fix-build.patch') +sha1sums=('f45e40298046ecea382f9b85c34b3e21d856a9da' + '3d2329981ea571d38f0354c6d1300a2743a775db') + +build() { + cd "${srcdir}"/pykde4-${pkgver} + patch -p3 -i "${srcdir}"/fix-build.patch + + cd "${srcdir}" + mkdir build + cd build + cmake ../pykde4-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DPYTHON_EXECUTABLE=/usr/bin/python2 + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install + + # Use the python2 executable + find "${pkgdir}" -name '*.py' | xargs sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' +} +sha1sums=('f45e40298046ecea382f9b85c34b3e21d856a9da' + '4eb8917ad922819bbea038d79a9786cf5d0e2767') diff --git a/kde-unstable/kdebindings-qtruby/PKGBUILD b/kde-unstable/kdebindings-qtruby/PKGBUILD new file mode 100644 index 000000000..82fd53c1b --- /dev/null +++ b/kde-unstable/kdebindings-qtruby/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124815 2011-05-24 15:22:45Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-qtruby +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Qt bindings for ruby" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-smokeqt' 'ruby') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen') +conflicts=('kdebindings-ruby') +source=("http://download.kde.org/unstable/${pkgver}/src/qtruby-${pkgver}.tar.bz2") +sha1sums=('9b153784efb3187ca4f38a14355b8a5ce283316c') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../qtruby-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-qyoto/PKGBUILD b/kde-unstable/kdebindings-qyoto/PKGBUILD new file mode 100644 index 000000000..d130b397d --- /dev/null +++ b/kde-unstable/kdebindings-qyoto/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124815 2011-05-24 15:22:45Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-qyoto +pkgver=4.6.80 +pkgrel=1 +pkgdesc=".NET/Mono bindings for the Qt libraries" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-smokeqt' 'mono') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen') +conflicts=('kdebindings-csharp') +source=("http://download.kde.org/unstable/${pkgver}/src/qyoto-${pkgver}.tar.bz2") +sha1sums=('7f63ae1c1e30edf226ca8418d5fa78edaf42cb36') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../qyoto-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-smokegen/PKGBUILD b/kde-unstable/kdebindings-smokegen/PKGBUILD new file mode 100644 index 000000000..ba2edc4f6 --- /dev/null +++ b/kde-unstable/kdebindings-smokegen/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124815 2011-05-24 15:22:45Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-smokegen +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A general purpose C++ parser with a plugin infrastructure" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +conflicts=('kdebindings-smoke') +source=("http://download.kde.org/unstable/${pkgver}/src/smokegen-${pkgver}.tar.bz2") +sha1sums=('ce860f4308df4cc91b1e49d0f1f5bca3805c4cf1') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../smokegen-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-smokekde/PKGBUILD b/kde-unstable/kdebindings-smokekde/PKGBUILD new file mode 100644 index 000000000..6f9724353 --- /dev/null +++ b/kde-unstable/kdebindings-smokekde/PKGBUILD @@ -0,0 +1,32 @@ +# $Id: PKGBUILD 124928 2011-05-25 09:28:04Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-smokekde +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Language independent library for KDE bindings" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebindings-smokeqt') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen' 'boost' + 'kdepimlibs' 'kdegraphics-okular' 'kdesdk-kate') +conflicts=('kdebindings-smoke') +source=("http://download.kde.org/unstable/${pkgver}/src/smokekde-${pkgver}.tar.bz2") +sha1sums=('9fd8cbac3f0affce6fa078b07ca418a5e0c79521') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../smokekde-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdebindings-smokeqt/PKGBUILD b/kde-unstable/kdebindings-smokeqt/PKGBUILD new file mode 100644 index 000000000..c7bdbcbd1 --- /dev/null +++ b/kde-unstable/kdebindings-smokeqt/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124815 2011-05-24 15:22:45Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdebindings-smokeqt +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Language independent library for Qt bindings" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdebindings') +depends=('kdebase-runtime' 'qimageblitz' 'qscintilla' 'qwt') +makedepends=('cmake' 'automoc4' 'kdebindings-smokegen') +conflicts=('kdebindings-smoke') +source=("http://download.kde.org/unstable/${pkgver}/src/smokeqt-${pkgver}.tar.bz2") +sha1sums=('872b77e7e445b7492a647e63e267677604d76a96') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../smokeqt-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-blinken/PKGBUILD b/kde-unstable/kdeedu-blinken/PKGBUILD new file mode 100644 index 000000000..7ebd3c811 --- /dev/null +++ b/kde-unstable/kdeedu-blinken/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-blinken +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Memory Enhancement Game" +url="http://kde.org/applications/education/blinken/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/blinken-${pkgver}.tar.bz2") +sha1sums=('847ee81d2a4f5f1acb4bf8c0835c2e8187a631ea') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../blinken-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-blinken/kdeedu-blinken.install b/kde-unstable/kdeedu-blinken/kdeedu-blinken.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-blinken/kdeedu-blinken.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-cantor/PKGBUILD b/kde-unstable/kdeedu-cantor/PKGBUILD new file mode 100644 index 000000000..a82cacfaa --- /dev/null +++ b/kde-unstable/kdeedu-cantor/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-cantor +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE Frontend to Mathematical Software" +url="http://kde.org/applications/education/cantor/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'r' 'libspectre') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/cantor-${pkgver}.tar.bz2") +sha1sums=('0c6ebd5e523bf5fdf01bbf654ce60a55fc72cbe2') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../cantor-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-cantor/kdeedu-cantor.install b/kde-unstable/kdeedu-cantor/kdeedu-cantor.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-cantor/kdeedu-cantor.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kalgebra/PKGBUILD b/kde-unstable/kdeedu-kalgebra/PKGBUILD new file mode 100644 index 000000000..40b24830e --- /dev/null +++ b/kde-unstable/kdeedu-kalgebra/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kalgebra +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Graph Calculator" +url="http://kde.org/applications/education/kalgebra/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'libkdeedu') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kalgebra-${pkgver}.tar.bz2") +sha1sums=('d448a675782157d8c553db497e048231d6eb5f53') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kalgebra-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kalgebra/kdeedu-kalgebra.install b/kde-unstable/kdeedu-kalgebra/kdeedu-kalgebra.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-kalgebra/kdeedu-kalgebra.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kalzium/PKGBUILD b/kde-unstable/kdeedu-kalzium/PKGBUILD new file mode 100644 index 000000000..8bc1d0c3c --- /dev/null +++ b/kde-unstable/kdeedu-kalzium/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kalzium +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Periodic Table of Elements" +url="http://kde.org/applications/education/kalzium/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdelibs' 'avogadro' 'ocaml') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kalzium-${pkgver}.tar.bz2") +sha1sums=('1ace4d42711904d9556efbe1ff89dc4c803887fe') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kalzium-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kalzium/kdeedu-kalzium.install b/kde-unstable/kdeedu-kalzium/kdeedu-kalzium.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kalzium/kdeedu-kalzium.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kanagram/PKGBUILD b/kde-unstable/kdeedu-kanagram/PKGBUILD new file mode 100644 index 000000000..45a33746c --- /dev/null +++ b/kde-unstable/kdeedu-kanagram/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kanagram +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Letter Order Game" +url="http://kde.org/applications/education/kanagram/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'libkdeedu') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kanagram-${pkgver}.tar.bz2") +sha1sums=('b7075ffa2c366acecfce13b5bef9938c6317aefb') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kanagram-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kanagram/kdeedu-kanagram.install b/kde-unstable/kdeedu-kanagram/kdeedu-kanagram.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kanagram/kdeedu-kanagram.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kbruch/PKGBUILD b/kde-unstable/kdeedu-kbruch/PKGBUILD new file mode 100644 index 000000000..9710c1df2 --- /dev/null +++ b/kde-unstable/kdeedu-kbruch/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kbruch +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Exercise Fractions" +url="http://kde.org/applications/education/kbruch/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kbruch-${pkgver}.tar.bz2") +sha1sums=('205b7f2171e67b55fc1bbcd0844702daf9dcb4a6') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kbruch-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kbruch/kdeedu-kbruch.install b/kde-unstable/kdeedu-kbruch/kdeedu-kbruch.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kbruch/kdeedu-kbruch.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kgeography/PKGBUILD b/kde-unstable/kdeedu-kgeography/PKGBUILD new file mode 100644 index 000000000..720c4027a --- /dev/null +++ b/kde-unstable/kdeedu-kgeography/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kgeography +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Geography Trainer" +url="http://kde.org/applications/education/kgeography/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kgeography-${pkgver}.tar.bz2") +sha1sums=('2d161ef150618780e6f2bcf3a8e19993a5c95fa6') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kgeography-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kgeography/kdeedu-kgeography.install b/kde-unstable/kdeedu-kgeography/kdeedu-kgeography.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kgeography/kdeedu-kgeography.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-khangman/PKGBUILD b/kde-unstable/kdeedu-khangman/PKGBUILD new file mode 100644 index 000000000..56df0fbce --- /dev/null +++ b/kde-unstable/kdeedu-khangman/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-khangman +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Hangman Game" +url="http://kde.org/applications/education/khangman/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'libkdeedu') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/khangman-${pkgver}.tar.bz2") +sha1sums=('a3e140a71c27400d49f75b862965123c1df6e992') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../khangman-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-khangman/kdeedu-khangman.install b/kde-unstable/kdeedu-khangman/kdeedu-khangman.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-khangman/kdeedu-khangman.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kig/PKGBUILD b/kde-unstable/kdeedu-kig/PKGBUILD new file mode 100644 index 000000000..ca6f92279 --- /dev/null +++ b/kde-unstable/kdeedu-kig/PKGBUILD @@ -0,0 +1,34 @@ +# $Id: PKGBUILD 125335 2011-05-25 23:12:03Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kig +pkgver=4.6.80 +pkgrel=2 +pkgdesc="Interactive Geometry" +url="http://kde.org/applications/education/kig/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kig-${pkgver}.tar.bz2") +sha1sums=('d0b2ca69262b1e720be8ab2b6cfb9dd6b5a81371') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kig-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install + + # Use the python2 executable + sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' "${pkgdir}"/usr/bin/pykig.py +} diff --git a/kde-unstable/kdeedu-kig/kdeedu-kig.install b/kde-unstable/kdeedu-kig/kdeedu-kig.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-kig/kdeedu-kig.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kiten/PKGBUILD b/kde-unstable/kdeedu-kiten/PKGBUILD new file mode 100644 index 000000000..6ba5c4b19 --- /dev/null +++ b/kde-unstable/kdeedu-kiten/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kiten +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Japanese Reference/Study Tool" +url="http://kde.org/applications/education/kiten/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kiten-${pkgver}.tar.bz2") +sha1sums=('a5120c87015e044b4313e889b80afd608341e414') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kiten-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kiten/kdeedu-kiten.install b/kde-unstable/kdeedu-kiten/kdeedu-kiten.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kiten/kdeedu-kiten.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-klettres/PKGBUILD b/kde-unstable/kdeedu-klettres/PKGBUILD new file mode 100644 index 000000000..70f5e54b4 --- /dev/null +++ b/kde-unstable/kdeedu-klettres/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-klettres +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Learn The Alphabet" +url="http://kde.org/applications/education/klettres/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/klettres-${pkgver}.tar.bz2") +sha1sums=('395a1c700eaf1fee83216facbe5442162d383e64') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../klettres-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-klettres/kdeedu-klettres.install b/kde-unstable/kdeedu-klettres/kdeedu-klettres.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-klettres/kdeedu-klettres.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kmplot/PKGBUILD b/kde-unstable/kdeedu-kmplot/PKGBUILD new file mode 100644 index 000000000..8db40962f --- /dev/null +++ b/kde-unstable/kdeedu-kmplot/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kmplot +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Mathematical Function Plotter" +url="http://kde.org/applications/education/kmplot/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kmplot-${pkgver}.tar.bz2") +sha1sums=('be3593a33b05a59d82020d988804e82737abbc09') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kmplot-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kmplot/kdeedu-kmplot.install b/kde-unstable/kdeedu-kmplot/kdeedu-kmplot.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-kmplot/kdeedu-kmplot.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kstars/PKGBUILD b/kde-unstable/kdeedu-kstars/PKGBUILD new file mode 100644 index 000000000..77306c68d --- /dev/null +++ b/kde-unstable/kdeedu-kstars/PKGBUILD @@ -0,0 +1,32 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kstars +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Desktop Planetarium" +url="http://kde.org/applications/education/kstars/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'eigen' 'cfitsio' 'libindi') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kstars-${pkgver}.tar.bz2") +sha1sums=('c74818da033d70200b873a954a2f05af3e03c610') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kstars-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_Xplanet=OFF + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kstars/kdeedu-kstars.install b/kde-unstable/kdeedu-kstars/kdeedu-kstars.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kstars/kdeedu-kstars.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-ktouch/PKGBUILD b/kde-unstable/kdeedu-ktouch/PKGBUILD new file mode 100644 index 000000000..0b8e706e9 --- /dev/null +++ b/kde-unstable/kdeedu-ktouch/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-ktouch +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Touch Typing Tutor" +url="http://kde.org/applications/education/ktouch/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/ktouch-${pkgver}.tar.bz2") +sha1sums=('7e80926b1fe45d7af861891a140e843b27cbf171') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../ktouch-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-ktouch/kdeedu-ktouch.install b/kde-unstable/kdeedu-ktouch/kdeedu-ktouch.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-ktouch/kdeedu-ktouch.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kturtle/PKGBUILD b/kde-unstable/kdeedu-kturtle/PKGBUILD new file mode 100644 index 000000000..dc60d6200 --- /dev/null +++ b/kde-unstable/kdeedu-kturtle/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kturtle +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Educational Programming Environment" +url="http://kde.org/applications/education/kturtle/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kturtle-${pkgver}.tar.bz2") +sha1sums=('5aa67c458212315616a9c67e06a3e8a8a79ee302') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kturtle-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kturtle/kdeedu-kturtle.install b/kde-unstable/kdeedu-kturtle/kdeedu-kturtle.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-kturtle/kdeedu-kturtle.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-kwordquiz/PKGBUILD b/kde-unstable/kdeedu-kwordquiz/PKGBUILD new file mode 100644 index 000000000..76696bc6d --- /dev/null +++ b/kde-unstable/kdeedu-kwordquiz/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-kwordquiz +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Flash Card Trainer" +url="http://kde.org/applications/education/kwordquiz/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'libkdeedu') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kwordquiz-${pkgver}.tar.bz2") +sha1sums=('44277946ffad538cd50690af9475e0520698bafb') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kwordquiz-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-kwordquiz/kdeedu-kwordquiz.install b/kde-unstable/kdeedu-kwordquiz/kdeedu-kwordquiz.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-kwordquiz/kdeedu-kwordquiz.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-marble/PKGBUILD b/kde-unstable/kdeedu-marble/PKGBUILD new file mode 100644 index 000000000..39fe50f17 --- /dev/null +++ b/kde-unstable/kdeedu-marble/PKGBUILD @@ -0,0 +1,36 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-marble +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Desktop Globe" +url="http://kde.org/applications/education/marble/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'gpsd') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/marble-${pkgver}.tar.bz2" + 'gpsd-2.96.patch') +sha1sums=('4d7663909efe3b42006debd78f1217bb3dfffd88' + 'f44dfd3bb384e631d59b93d7dda3413795da8183') + +build() { + cd "${srcdir}"/marble-${pkgver} + patch -p1 -i "${srcdir}"/gpsd-2.96.patch + + cd "${srcdir}" + mkdir build + cd build + cmake ../marble-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-marble/gpsd-2.96.patch b/kde-unstable/kdeedu-marble/gpsd-2.96.patch new file mode 100644 index 000000000..e27702181 --- /dev/null +++ b/kde-unstable/kdeedu-marble/gpsd-2.96.patch @@ -0,0 +1,41 @@ +--- marble-4.6.80/src/plugins/positionprovider/gpsd/GpsdConnection.cpp ++++ marble-4.6.80/src/plugins/positionprovider/gpsd/GpsdConnection.cpp +@@ -18,6 +18,9 @@ using namespace Marble; + + GpsdConnection::GpsdConnection( QObject* parent ) + : QObject( parent ), ++#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 ) ++ m_gpsd("localhost", DEFAULT_GPSD_PORT), ++#endif + m_timer( 0 ) + { + connect( &m_timer, SIGNAL( timeout() ), this, SLOT( update() ) ); +@@ -26,7 +29,11 @@ GpsdConnection::GpsdConnection( QObject* + void GpsdConnection::initialize() + { + m_timer.stop(); ++#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 ) ++ gps_data_t* data; ++#else + gps_data_t* data = m_gpsd.open(); ++#endif + if ( data ) { + m_status = PositionProviderStatusAcquiring; + emit statusChanged( m_status ); +@@ -73,8 +80,16 @@ void GpsdConnection::initialize() + void GpsdConnection::update() + { + #if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 3 ) && defined( PACKET_SET ) ++#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 ) ++ if ( m_gpsd.waiting(0) ) { ++#else + if ( m_gpsd.waiting() ) { ++#endif ++#if defined( GPSD_API_MAJOR_VERSION ) && ( GPSD_API_MAJOR_VERSION >= 5 ) ++ gps_data_t* data = m_gpsd.read(); ++#else + gps_data_t* data = m_gpsd.poll(); ++#endif + if ( data && data->set & PACKET_SET ) { + emit gpsdInfo( *data ); + } diff --git a/kde-unstable/kdeedu-marble/kdeedu-marble.install b/kde-unstable/kdeedu-marble/kdeedu-marble.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-marble/kdeedu-marble.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-parley/PKGBUILD b/kde-unstable/kdeedu-parley/PKGBUILD new file mode 100644 index 000000000..7b27fa558 --- /dev/null +++ b/kde-unstable/kdeedu-parley/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-parley +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Vocabulary Trainer" +url="http://kde.org/applications/education/parley/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'libkdeedu') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/parley-${pkgver}.tar.bz2") +sha1sums=('991f7aeee7849913a167d65b792791724bc5c1aa') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../parley-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-parley/kdeedu-parley.install b/kde-unstable/kdeedu-parley/kdeedu-parley.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdeedu-parley/kdeedu-parley.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeedu-rocs/PKGBUILD b/kde-unstable/kdeedu-rocs/PKGBUILD new file mode 100644 index 000000000..1ab660c03 --- /dev/null +++ b/kde-unstable/kdeedu-rocs/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-rocs +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Rocs Graph Theory" +url="http://kde.org/applications/education/rocs/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'boost-libs') +makedepends=('cmake' 'automoc4' 'boost') +source=("http://download.kde.org/unstable/${pkgver}/src/rocs-${pkgver}.tar.bz2") +sha1sums=('90ea18d54bc7dc6a87db72e34fb9131849300392') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../rocs-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-step/PKGBUILD b/kde-unstable/kdeedu-step/PKGBUILD new file mode 100644 index 000000000..6b63198df --- /dev/null +++ b/kde-unstable/kdeedu-step/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124761 2011-05-24 08:01:51Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdeedu-step +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Interactive Physical Simulator" +url="http://kde.org/applications/education/step/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeedu') +depends=('kdebase-runtime' 'libqalculate' 'gsl' 'eigen') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/step-${pkgver}.tar.bz2") +sha1sums=('a71d1ed2f92c9b881640b273adafa71240ca6e8a') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../step-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdeedu-step/kdeedu-step.install b/kde-unstable/kdeedu-step/kdeedu-step.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeedu-step/kdeedu-step.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/PKGBUILD b/kde-unstable/kdegames/PKGBUILD new file mode 100644 index 000000000..bc3b1576a --- /dev/null +++ b/kde-unstable/kdegames/PKGBUILD @@ -0,0 +1,514 @@ +# $Id: PKGBUILD 124786 2011-05-24 12:57:40Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdegames +pkgname=('kdegames-bomber' + 'kdegames-bovo' + 'kdegames-granatier' + 'kdegames-kajongg' + 'kdegames-kapman' + 'kdegames-katomic' + 'kdegames-kbattleship' + 'kdegames-kblackbox' + 'kdegames-kblocks' + 'kdegames-kbounce' + 'kdegames-kbreakout' + 'kdegames-kdiamond' + 'kdegames-kfourinline' + 'kdegames-kgoldrunner' + 'kdegames-kigo' + 'kdegames-killbots' + 'kdegames-kiriki' + 'kdegames-kjumpingcube' + 'kdegames-klines' + 'kdegames-klickety' + 'kdegames-kmahjongg' + 'kdegames-kmines' + 'kdegames-knetwalk' + 'kdegames-kolf' + 'kdegames-kollision' + 'kdegames-konquest' + 'kdegames-kpatience' + 'kdegames-kreversi' + 'kdegames-kshisen' + 'kdegames-ksirk' + 'kdegames-kspaceduel' + 'kdegames-ksquares' + 'kdegames-ksudoku' + 'kdegames-ktron' + 'kdegames-ktuberling' + 'kdegames-kubrick' + 'kdegames-libkdegames' + 'kdegames-libkmahjongg' + 'kdegames-lskat' + 'kdegames-palapeli') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegames') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'ggz-client-libs' 'twisted' + 'kdebindings-python' 'openal') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('c9e21203e8f47e1748c309a4ff14c87953c43839') + +build() { + cd $srcdir + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdegames-bomber() { + pkgdesc='Arcade Bombing Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/bomber/" + install='kdegames.install' + cd $srcdir/build/bomber + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/bomber + make DESTDIR=$pkgdir install +} + +package_kdegames-bovo() { + pkgdesc='Five-in-a-row Board Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/bovo/" + install='kdegames.install' + cd $srcdir/build/bovo + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/bovo + make DESTDIR=$pkgdir install +} + +package_kdegames-granatier() { + pkgdesc='Granatier' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'openal') + url="http://kde.org/applications/games/granatier/" + install='kdegames.install' + cd $srcdir/build/granatier + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/granatier + make DESTDIR=$pkgdir install +} + +package_kdegames-kajongg() { + pkgdesc='The ancient Chinese board game for 4 players' + depends=('kdegames-libkdegames' 'kdegames-libkmahjongg' 'kdebindings-python' 'twisted') + install='kdegames.install' + cd $srcdir/build/kajongg + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kajongg + make DESTDIR=$pkgdir install + + # Use the python2 executable + find "${pkgdir}" -name '*.py' | xargs sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' +} + +package_kdegames-kapman() { + pkgdesc='Eat pills escaping ghosts' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kapman/" + install='kdegames.install' + cd $srcdir/build/kapman + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kapman + make DESTDIR=$pkgdir install +} + +package_kdegames-katomic() { + pkgdesc='Sokoban-like Logic Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/katomic/" + install='kdegames.install' + cd $srcdir/build/katomic + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/katomic + make DESTDIR=$pkgdir install +} + +package_kdegames-kbattleship() { + pkgdesc='Battleship Game' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'ggz-client-libs') + url="http://kde.org/applications/games/kbattleship/" + install='kdegames-kbattleship.install' + cd $srcdir/build/kbattleship + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kbattleship + make DESTDIR=$pkgdir install + install -D -m644 $srcdir/${pkgbase}-${pkgver}/kbattleship/src/module.dsc \ + $pkgdir/usr/share/ggz/kbattleship.dsc +} + +package_kdegames-kblackbox() { + pkgdesc='Blackbox Logic Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kblackbox/" + install='kdegames.install' + cd $srcdir/build/kblackbox + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kblackbox + make DESTDIR=$pkgdir install +} + +package_kdegames-kblocks() { + pkgdesc='Falling Blocks Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kblocks/" + install='kdegames.install' + cd $srcdir/build/kblocks + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kblocks + make DESTDIR=$pkgdir install +} + +package_kdegames-kbounce() { + pkgdesc='Ball Bouncing Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kbounce/" + install='kdegames.install' + cd $srcdir/build/kbounce + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kbounce + make DESTDIR=$pkgdir install +} + +package_kdegames-kbreakout() { + pkgdesc='Breakout-like Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kbreakout/" + install='kdegames.install' + cd $srcdir/build/kbreakout + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kbreakout + make DESTDIR=$pkgdir install +} + +package_kdegames-kdiamond() { + pkgdesc='Three-in-a-row game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kdiamond/" + install='kdegames.install' + cd $srcdir/build/kdiamond + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kdiamond + make DESTDIR=$pkgdir install +} + +package_kdegames-kfourinline() { + pkgdesc='Four-in-a-row Board Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kfourinline/" + install='kdegames-kfourinline.install' + cd $srcdir/build/kfourinline + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kfourinline + make DESTDIR=$pkgdir install +} + +package_kdegames-kgoldrunner() { + pkgdesc='A game of action and puzzle-solving' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kgoldrunner/" + install='kdegames.install' + cd $srcdir/build/kgoldrunner + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kgoldrunner + make DESTDIR=$pkgdir install +} + +package_kdegames-kigo() { + pkgdesc='Go Board Game' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'gnugo') + url="http://kde.org/applications/games/kigo/" + install='kdegames-kigo.install' + cd $srcdir/build/kigo + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kigo + make DESTDIR=$pkgdir install +} + +package_kdegames-killbots() { + pkgdesc='Killbots' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/killbots/" + install='kdegames.install' + cd $srcdir/build/killbots + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/killbots + make DESTDIR=$pkgdir install +} + +package_kdegames-kiriki() { + pkgdesc='Yahtzee-like Dice Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kiriki/" + install='kdegames.install' + cd $srcdir/build/kiriki + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kiriki + make DESTDIR=$pkgdir install +} + +package_kdegames-kjumpingcube() { + pkgdesc='Territory Capture Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kjumpingcube/" + install='kdegames.install' + cd $srcdir/build/kjumpingcube + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kjumpingcube + make DESTDIR=$pkgdir install +} + +package_kdegames-klickety() { + pkgdesc='Board Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + replaces=('kdegames-ksame') + conflicts=('kdegames-ksame') + url="http://kde.org/applications/games/ksame/" + install='kdegames.install' + cd $srcdir/build/klickety + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/klickety + make DESTDIR=$pkgdir install +} + +package_kdegames-klines() { + pkgdesc='Tactical Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/klines/" + install='kdegames.install' + cd $srcdir/build/klines + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/klines + make DESTDIR=$pkgdir install +} + +package_kdegames-kmahjongg() { + pkgdesc='Mahjongg Solitaire' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'kdegames-libkmahjongg') + url="http://kde.org/applications/games/kmahjongg/" + install='kdegames.install' + cd $srcdir/build/kmahjongg + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kmahjongg + make DESTDIR=$pkgdir install +} + +package_kdegames-kmines() { + pkgdesc='Minesweeper-like Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kmines/" + install='kdegames.install' + cd $srcdir/build/kmines + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kmines + make DESTDIR=$pkgdir install +} + +package_kdegames-knetwalk() { + pkgdesc='Network Construction Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/knetwalk/" + install='kdegames.install' + cd $srcdir/build/knetwalk + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/knetwalk + make DESTDIR=$pkgdir install +} + +package_kdegames-kolf() { + pkgdesc='Miniature Golf' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kolf/" + install='kdegames-kolf.install' + cd $srcdir/build/kolf + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kolf + make DESTDIR=$pkgdir install +} + +package_kdegames-kollision() { + pkgdesc='A simple ball dodging game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kollision/" + install='kdegames.install' + cd $srcdir/build/kollision + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kollision + make DESTDIR=$pkgdir install +} + +package_kdegames-konquest() { + pkgdesc='Galactic Strategy Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/konquest/" + install='kdegames.install' + cd $srcdir/build/konquest + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/konquest + make DESTDIR=$pkgdir install +} + +package_kdegames-kpatience() { + pkgdesc='Patience Card Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kpatience/" + install='kdegames.install' + replaces=('kdegames-kpat') + cd $srcdir/build/kpat + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kpat + make DESTDIR=$pkgdir install +} + +package_kdegames-kreversi() { + pkgdesc='Reversi Board Game' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'ggz-client-libs') + url="http://kde.org/applications/games/kreversi/" + install='kdegames-kreversi.install' + cd $srcdir/build/kreversi + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kreversi + make DESTDIR=$pkgdir install + install -D -m644 $srcdir/${pkgbase}-${pkgver}/kreversi/module.dsc \ + $pkgdir/usr/share/ggz/kreversi.dsc +} + +package_kdegames-kshisen() { + pkgdesc='Shisen-Sho Mahjongg-like Tile Game' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'kdegames-libkmahjongg') + url="http://kde.org/applications/games/kshisen/" + install='kdegames.install' + cd $srcdir/build/kshisen + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kshisen + make DESTDIR=$pkgdir install +} + +package_kdegames-ksirk() { + pkgdesc='World Domination Strategy Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/ksirk/" + install='kdegames.install' + cd $srcdir/build/ksirk + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ksirk + make DESTDIR=$pkgdir install +} + +package_kdegames-kspaceduel() { + pkgdesc='Space Arcade Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kspaceduel/" + install='kdegames-kspaceduel.install' + cd $srcdir/build/kspaceduel + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kspaceduel + make DESTDIR=$pkgdir install +} + +package_kdegames-ksquares() { + pkgdesc='Connect the dots to create squares' + depends=('kdebase-runtime' 'kdegames-libkdegames' 'ggz-client-libs') + url="http://kde.org/applications/games/ksquares/" + install='kdegames-ksquares.install' + cd $srcdir/build/ksquares + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ksquares + make DESTDIR=$pkgdir install + install -D -m644 $srcdir/${pkgbase}-${pkgver}/ksquares/src/module.dsc \ + $pkgdir/usr/share/ggz/ksquares.dsc +} + +package_kdegames-ksudoku() { + pkgdesc='KSudoku, Sudoku game & more for KDE' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/ksudoku/" + install='kdegames.install' + cd $srcdir/build/ksudoku + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ksudoku + make DESTDIR=$pkgdir install +} + +package_kdegames-ktron() { + pkgdesc='Tron-like Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/ktron/" + install='kdegames.install' + cd $srcdir/build/ktron + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ktron + make DESTDIR=$pkgdir install +} + +package_kdegames-ktuberling() { + pkgdesc='Picture Game for Children' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/ktuberling/" + install='kdegames-ktuberling.install' + cd $srcdir/build/ktuberling + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ktuberling + make DESTDIR=$pkgdir install +} + +package_kdegames-kubrick() { + pkgdesc='A 3-D game based on Rubik´s Cube' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/kubrick/" + install='kdegames.install' + cd $srcdir/build/kubrick + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kubrick + make DESTDIR=$pkgdir install +} + +package_kdegames-libkdegames() { + pkgdesc='KDE game library' + groups=() + depends=('kdelibs') + cd $srcdir/build/libkdegames + make DESTDIR=$pkgdir install + for i in $srcdir/${pkgbase}-${pkgver}/cmake/modules/*.cmake; do + install -D -m644 $i $pkgdir/usr/share/apps/cmake/modules/$(basename $i) + done +} + +package_kdegames-libkmahjongg() { + pkgdesc='Library used for loading and rendering of Mahjongg tilesets' + groups=() + depends=('kdelibs') + cd $srcdir/build/libkmahjongg + make DESTDIR=$pkgdir install +} + +package_kdegames-lskat() { + pkgdesc='Card Game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/lskat/" + install='kdegames-lskat.install' + cd $srcdir/build/lskat + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/lskat + make DESTDIR=$pkgdir install +} + +package_kdegames-palapeli() { + pkgdesc='Jigsaw puzzle game' + depends=('kdebase-runtime' 'kdegames-libkdegames') + url="http://kde.org/applications/games/palapeli/" + install='kdegames-palapeli.install' + cd $srcdir/build/palapeli + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/palapeli + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdegames/kdegames-kbattleship.install b/kde-unstable/kdegames/kdegames-kbattleship.install new file mode 100644 index 000000000..ac4516ed0 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-kbattleship.install @@ -0,0 +1,24 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q + ggz-config -i -f -m usr/share/ggz/kbattleship.dsc >& /dev/null +} + +pre_remove() { + if [ -f usr/share/ggz/kbattleship.dsc ]; then + ggz-config -r -m usr/share/ggz/kbattleship.dsc >& /dev/null + fi +} + +pre_upgrade() { + pre_remove +} + +post_upgrade() { + post_install +} + +post_remove() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} diff --git a/kde-unstable/kdegames/kdegames-kfourinline.install b/kde-unstable/kdegames/kdegames-kfourinline.install new file mode 100644 index 000000000..9b20edb30 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-kfourinline.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames-kigo.install b/kde-unstable/kdegames/kdegames-kigo.install new file mode 100644 index 000000000..9b20edb30 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-kigo.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames-kolf.install b/kde-unstable/kdegames/kdegames-kolf.install new file mode 100644 index 000000000..9b20edb30 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-kolf.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames-kreversi.install b/kde-unstable/kdegames/kdegames-kreversi.install new file mode 100644 index 000000000..4623e6e49 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-kreversi.install @@ -0,0 +1,22 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + ggz-config -i -f -m usr/share/ggz/kreversi.dsc >& /dev/null +} + +pre_remove() { + if [ -f usr/share/ggz/kreversi.dsc ]; then + ggz-config -r -m usr/share/ggz/kreversi.dsc >& /dev/null + fi +} + +pre_upgrade() { + pre_remove +} + +post_upgrade() { + post_install +} + +post_remove() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} diff --git a/kde-unstable/kdegames/kdegames-kspaceduel.install b/kde-unstable/kdegames/kdegames-kspaceduel.install new file mode 100644 index 000000000..9b20edb30 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-kspaceduel.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames-ksquares.install b/kde-unstable/kdegames/kdegames-ksquares.install new file mode 100644 index 000000000..5a619897d --- /dev/null +++ b/kde-unstable/kdegames/kdegames-ksquares.install @@ -0,0 +1,22 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + ggz-config -i -f -m usr/share/ggz/ksquares.dsc >& /dev/null +} + +pre_remove() { + if [ -f usr/share/ggz/ksquares.dsc ]; then + ggz-config -r -m usr/share/ggz/ksquares.dsc >& /dev/null + fi +} + +pre_upgrade() { + pre_remove +} + +post_upgrade() { + post_install +} + +post_remove() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} diff --git a/kde-unstable/kdegames/kdegames-ktuberling.install b/kde-unstable/kdegames/kdegames-ktuberling.install new file mode 100644 index 000000000..9b20edb30 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-ktuberling.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames-lskat.install b/kde-unstable/kdegames/kdegames-lskat.install new file mode 100644 index 000000000..9b20edb30 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-lskat.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames-palapeli.install b/kde-unstable/kdegames/kdegames-palapeli.install new file mode 100644 index 000000000..c77e68041 --- /dev/null +++ b/kde-unstable/kdegames/kdegames-palapeli.install @@ -0,0 +1,13 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-mime-database usr/share/mime &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegames/kdegames.install b/kde-unstable/kdegames/kdegames.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdegames/kdegames.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegraphics-gwenview/PKGBUILD b/kde-unstable/kdegraphics-gwenview/PKGBUILD new file mode 100644 index 000000000..c8528477b --- /dev/null +++ b/kde-unstable/kdegraphics-gwenview/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124674 2011-05-23 20:43:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-gwenview +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A fast and easy to use image viewer for KDE" +url="http://kde.org/applications/graphics/gwenview/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +depends=('kdebase-lib' 'libkipi') +makedepends=('cmake' 'automoc4') +optdepends=('kipi-plugins') +source=("http://download.kde.org/unstable/${pkgver}/src/gwenview-${pkgver}.tar.bz2") +sha1sums=('41b93bdcab6ba169be4ed3fcfb481c6ae1161bd6') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../gwenview-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-gwenview/kdegraphics-gwenview.install b/kde-unstable/kdegraphics-gwenview/kdegraphics-gwenview.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdegraphics-gwenview/kdegraphics-gwenview.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegraphics-kamera/PKGBUILD b/kde-unstable/kdegraphics-kamera/PKGBUILD new file mode 100644 index 000000000..17b0a9b3f --- /dev/null +++ b/kde-unstable/kdegraphics-kamera/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124674 2011-05-23 20:43:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-kamera +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Configure Kamera" +url="http://kde.org/applications/graphics/kamera/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +depends=('kdebase-runtime' 'gphoto2') +makedepends=('cmake' 'automoc4') +source=("http://download.kde.org/unstable/${pkgver}/src/kamera-${pkgver}.tar.bz2") +sha1sums=('cba0e4ca19fe62a9cbfe7b2559e5364c16944901') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kamera-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-kcolorchooser/PKGBUILD b/kde-unstable/kdegraphics-kcolorchooser/PKGBUILD new file mode 100644 index 000000000..ebad9e424 --- /dev/null +++ b/kde-unstable/kdegraphics-kcolorchooser/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124674 2011-05-23 20:43:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-kcolorchooser +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Color Chooser" +url="http://kde.org/applications/graphics/kcolorchooser/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kcolorchooser-${pkgver}.tar.bz2") +sha1sums=('99aad5ebb4b1d5d99426e8a33c2f15717cc4087e') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kcolorchooser-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-kcolorchooser/kdegraphics-kcolorchooser.install b/kde-unstable/kdegraphics-kcolorchooser/kdegraphics-kcolorchooser.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdegraphics-kcolorchooser/kdegraphics-kcolorchooser.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegraphics-kgamma/PKGBUILD b/kde-unstable/kdegraphics-kgamma/PKGBUILD new file mode 100644 index 000000000..18926be42 --- /dev/null +++ b/kde-unstable/kdegraphics-kgamma/PKGBUILD @@ -0,0 +1,33 @@ +# $Id: PKGBUILD 124788 2011-05-24 12:59:42Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-kgamma +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A monitor calibration tool" +url="http://kde.org/applications/graphics/kgamma/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +# note on libxxf86vm: +# not detected by namcap because libgl depends on it +# but nvidia providing libgl does not depend on libxxf86vm +depends=('kdebase-runtime' 'libxxf86vm') +makedepends=('cmake' 'automoc4') +source=("http://download.kde.org/unstable/${pkgver}/src/kgamma-${pkgver}.tar.bz2") +sha1sums=('aac4e43df0095e0511bb27cc27a23b10847eb075') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kgamma-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-kolourpaint/PKGBUILD b/kde-unstable/kdegraphics-kolourpaint/PKGBUILD new file mode 100644 index 000000000..c68c46c2d --- /dev/null +++ b/kde-unstable/kdegraphics-kolourpaint/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124674 2011-05-23 20:43:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-kolourpaint +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Paint Program" +url="http://kde.org/applications/graphics/kolourpaint/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +depends=('kdebase-runtime' 'qimageblitz') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kolourpaint-${pkgver}.tar.bz2") +sha1sums=('c79fc3a31d61623a02e7c89ede19cbe7e49a8518') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kolourpaint-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-kolourpaint/kdegraphics-kolourpaint.install b/kde-unstable/kdegraphics-kolourpaint/kdegraphics-kolourpaint.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdegraphics-kolourpaint/kdegraphics-kolourpaint.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegraphics-kruler/PKGBUILD b/kde-unstable/kdegraphics-kruler/PKGBUILD new file mode 100644 index 000000000..663888d54 --- /dev/null +++ b/kde-unstable/kdegraphics-kruler/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124674 2011-05-23 20:43:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-kruler +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Screen Ruler" +url="http://kde.org/applications/graphics/kruler/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +depends=('kdebase-runtime') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/kruler-${pkgver}.tar.bz2") +sha1sums=('b43fee1954baa7b84866a1cd5f15cbcff54d5e3d') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../kruler-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-kruler/kdegraphics-kruler.install b/kde-unstable/kdegraphics-kruler/kdegraphics-kruler.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdegraphics-kruler/kdegraphics-kruler.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegraphics-ksaneplugin/PKGBUILD b/kde-unstable/kdegraphics-ksaneplugin/PKGBUILD new file mode 100644 index 000000000..4dde21e03 --- /dev/null +++ b/kde-unstable/kdegraphics-ksaneplugin/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-ksaneplugin +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A scan plugin that implements the scanning" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('libksane') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +source=("http://download.kde.org/unstable/${pkgver}/src/ksaneplugin-${pkgver}.tar.bz2") +sha1sums=('3caa70899ed3797c9739409d311779f39fa9eda7') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../ksaneplugin-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-ksnapshot/PKGBUILD b/kde-unstable/kdegraphics-ksnapshot/PKGBUILD new file mode 100644 index 000000000..de10d1e5e --- /dev/null +++ b/kde-unstable/kdegraphics-ksnapshot/PKGBUILD @@ -0,0 +1,32 @@ +# $Id: PKGBUILD 124674 2011-05-23 20:43:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-ksnapshot +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Screen Capture Program" +url="http://kde.org/applications/graphics/ksnapshot/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +depends=('kdelibs' 'libkipi') +makedepends=('cmake' 'automoc4') +optdepends=('kipi-plugins') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/ksnapshot-${pkgver}.tar.bz2") +sha1sums=('684be8b03920e4a92625337ff18a5b368482dd08') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../ksnapshot-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-ksnapshot/kdegraphics-ksnapshot.install b/kde-unstable/kdegraphics-ksnapshot/kdegraphics-ksnapshot.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdegraphics-ksnapshot/kdegraphics-ksnapshot.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdegraphics-strigi-analyzer/PKGBUILD b/kde-unstable/kdegraphics-strigi-analyzer/PKGBUILD new file mode 100644 index 000000000..4c027b673 --- /dev/null +++ b/kde-unstable/kdegraphics-strigi-analyzer/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-strigi-analyzer +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Strigi analyzers for various graphics file formats" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('bc4c901bc4bc7080c91ed739d2480294d2fc5033') + +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/kdegraphics-svgpart/PKGBUILD b/kde-unstable/kdegraphics-svgpart/PKGBUILD new file mode 100644 index 000000000..ce748bb92 --- /dev/null +++ b/kde-unstable/kdegraphics-svgpart/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-svgpart +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A KPart for viewving SVGs" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +source=("http://download.kde.org/unstable/${pkgver}/src/svgpart-${pkgver}.tar.bz2") +sha1sums=('300fc6a062ea34e6131097ae9a59e8279f3c1193') + +build() { + cd "${srcdir}" + mkdir build + cd build + cmake ../svgpart-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd "${srcdir}"/build + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdegraphics-thumbnailers/PKGBUILD b/kde-unstable/kdegraphics-thumbnailers/PKGBUILD new file mode 100644 index 000000000..7a3e5b1a1 --- /dev/null +++ b/kde-unstable/kdegraphics-thumbnailers/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=kdegraphics-thumbnailers +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Thumbnailers for various graphics file formats" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('libkexiv2' 'libkdcraw') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('d350cb85ad8520be00f6ee1f05a393d777e0f021') + +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/kdegraphics/PKGBUILD b/kde-unstable/kdegraphics/PKGBUILD new file mode 100644 index 000000000..9aaa3cacf --- /dev/null +++ b/kde-unstable/kdegraphics/PKGBUILD @@ -0,0 +1,39 @@ +# $Id: PKGBUILD 124827 2011-05-24 16:19:00Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdegraphics +pkgname=('kdegraphics-okular') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdegraphics') +makedepends=('kdelibs' 'pkgconfig' 'cmake' 'automoc4' 'qimageblitz' 'ebook-tools' + 'poppler-qt' 'libspectre' 'chmlib' 'djvulibre') +source=("http://download.kde.org/stable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('69f191663db147cf481edd9f528fcae50c1dc2c3') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdegraphics-okular() { + pkgdesc='Document Viewer' + depends=('kdebase-runtime' 'qimageblitz' 'poppler-qt' 'chmlib' 'djvulibre' + 'ebook-tools' 'libspectre') + url="http://kde.org/applications/graphics/okular/" + install='kdegraphics-okular.install' + cd $srcdir/build/okular + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/okular + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdegraphics/kdegraphics-okular.install b/kde-unstable/kdegraphics/kdegraphics-okular.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdegraphics/kdegraphics-okular.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdelibs/PKGBUILD b/kde-unstable/kdelibs/PKGBUILD new file mode 100644 index 000000000..8bfff6584 --- /dev/null +++ b/kde-unstable/kdelibs/PKGBUILD @@ -0,0 +1,63 @@ +# $Id: PKGBUILD 124924 2011-05-25 08:50:46Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgname=kdelibs +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE Core Libraries" +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +depends=('strigi' 'attica' 'libxss' 'xz' 'openssl' 'soprano' 'krb5' + 'shared-desktop-ontologies' 'qca' 'libdbusmenu-qt' 'polkit-qt' 'grantlee' + 'shared-mime-info' 'enchant' 'giflib' 'jasper' 'openexr' 'xdg-utils' + 'phonon' 'hicolor-icon-theme' 'upower' 'udisks' 'libxcursor' + 'docbook-xsl') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'intltool' 'avahi' 'libgl' + 'hspell') +replaces=('kdelibs-experimental') +install='kdelibs.install' +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2" + 'kde-applications-menu.patch' 'archlinux-menu.patch' + 'kcalendarsystem-fixed.patch') +sha1sums=('313e051b08762ec68d7d7aaceb5471ede2bf66ac' + '86ee8c8660f19de8141ac99cd6943964d97a1ed7' + '63a850ab4196b9d06934f2b4a13acd9f7739bc67' + '13cbb58347dc7103684bb002b8f636fc0fa9e738') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + + # avoid file conflict with gnome-menu + patch -p1 -i $srcdir/kde-applications-menu.patch + # add Archlinux menu entry + patch -p1 -i $srcdir/archlinux-menu.patch + + # Already fixed upstream + patch -p1 -i "${srcdir}"/kcalendarsystem-fixed.patch + + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgname}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DKDE_DISTRIBUTION_TEXT='Arch Linux' \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSYSCONF_INSTALL_DIR=/etc \ + -DHTML_INSTALL_DIR=/usr/share/doc/kde/html \ + -DKDE_DEFAULT_HOME='.kde4' \ + -DWITH_FAM=OFF + make +} + +package() { + cd $srcdir/build + make DESTDIR=$pkgdir install + + # cert bundle seems to be hardcoded + # link it to the one from ca-certificates + rm -f $pkgdir/usr/share/apps/kssl/ca-bundle.crt + ln -sf /etc/ssl/certs/ca-certificates.crt $pkgdir/usr/share/apps/kssl/ca-bundle.crt +} diff --git a/kde-unstable/kdelibs/archlinux-menu.patch b/kde-unstable/kdelibs/archlinux-menu.patch new file mode 100644 index 000000000..546784fa2 --- /dev/null +++ b/kde-unstable/kdelibs/archlinux-menu.patch @@ -0,0 +1,22 @@ +--- kdelibs-4.3.98/kded/applications.menu 2010-01-31 19:28:11.000000000 +0000 ++++ kdelibs-4.3.98/kded/applications.menu 2010-01-31 22:25:53.556043077 +0000 +@@ -16,11 +16,19 @@ + </DefaultLayout> + <Layout> + <Merge type="menus"/> ++ <Menuname>Arch Linux</Menuname> + <Menuname>Applications</Menuname> + <Merge type="files"/> + </Layout> + + <Menu> ++ <Name>Arch Linux</Name> ++ <Directory>Archlinux.directory</Directory> ++ <Include> ++ <Category>Archlinux</Category> ++ </Include> ++ </Menu> ++ <Menu> + <Name>Applications</Name> + <Directory>kde-unknown.directory</Directory> + <OnlyUnallocated/> diff --git a/kde-unstable/kdelibs/kcalendarsystem-fixed.patch b/kde-unstable/kdelibs/kcalendarsystem-fixed.patch new file mode 100644 index 000000000..d97a9b904 --- /dev/null +++ b/kde-unstable/kdelibs/kcalendarsystem-fixed.patch @@ -0,0 +1,18073 @@ +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/kdelibs/kde-applications-menu.patch b/kde-unstable/kdelibs/kde-applications-menu.patch new file mode 100644 index 000000000..4b513298a --- /dev/null +++ b/kde-unstable/kdelibs/kde-applications-menu.patch @@ -0,0 +1,22 @@ +--- kdelibs-4.3.98/kded/CMakeLists.txt 2009-10-02 14:55:17.000000000 +0000 ++++ kdelibs-4.3.98/kded/CMakeLists.txt 2010-01-31 22:16:13.946933892 +0000 +@@ -69,7 +69,7 @@ + if (WIN32) + install( FILES applications.menu DESTINATION ${SHARE_INSTALL_PREFIX}/xdg/menus ) + else (WIN32) +-install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus ) ++install( FILES applications.menu DESTINATION ${SYSCONF_INSTALL_DIR}/xdg/menus RENAME kde-applications.menu ) + endif (WIN32) + install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) + install( FILES kded.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update ) +--- kdelibs-4.3.98/kded/kbuildsycoca.cpp 2009-12-04 23:10:18.000000000 +0000 ++++ kdelibs-4.3.98/kded/kbuildsycoca.cpp 2010-01-31 22:16:13.962766572 +0000 +@@ -302,7 +302,7 @@ + if (!m_trackId.isEmpty()) + g_vfolder->setTrackId(m_trackId); + +- VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("applications.menu", true); ++ VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("kde-applications.menu", true); + + KServiceGroup::Ptr entry = g_bsgf->addNew("/", kdeMenu->directoryFile, KServiceGroup::Ptr(), false); + entry->setLayoutInfo(kdeMenu->layoutList); diff --git a/kde-unstable/kdelibs/kdelibs.install b/kde-unstable/kdelibs/kdelibs.install new file mode 100644 index 000000000..c77e68041 --- /dev/null +++ b/kde-unstable/kdelibs/kdelibs.install @@ -0,0 +1,13 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-mime-database usr/share/mime &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdemultimedia/PKGBUILD b/kde-unstable/kdemultimedia/PKGBUILD new file mode 100644 index 000000000..363b255ed --- /dev/null +++ b/kde-unstable/kdemultimedia/PKGBUILD @@ -0,0 +1,109 @@ +# $Id: PKGBUILD 124769 2011-05-24 09:53:01Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdemultimedia +pkgname=('kdemultimedia-dragonplayer' + 'kdemultimedia-ffmpegthumbs' + 'kdemultimedia-juk' + 'kdemultimedia-kioslave' + 'kdemultimedia-kmix' + 'kdemultimedia-kscd' + 'kdemultimedia-mplayerthumbs') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdemultimedia') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'kdelibs' 'tunepimp' + 'ffmpeg' 'mplayer' 'pulseaudio' 'libmusicbrainz3') +source=("http://download.kde.org/stable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2" + 'mplayerthumbs.config') +sha1sums=('60fa25d125aa77b66fd1c1e9e043df48abf35bd4' + 'ba016fa2563c14ffcba852c62506b66bfc6ee683') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_Xine=OFF + make +} + +package_kdemultimedia-dragonplayer() { + pkgdesc='Video Player' + depends=('kdebase-runtime') + url="http://kde.org/applications/multimedia/dragonplayer/" + install='kdemultimedia.install' + cd $srcdir/build/dragonplayer + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/dragonplayer + make DESTDIR=$pkgdir install +} + +package_kdemultimedia-ffmpegthumbs() { + pkgdesc='Video Files (ffmpegthumbs)' + depends=('kdebase-runtime' 'ffmpeg') + install='kdemultimedia.install' + cd $srcdir/build/ffmpegthumbs + make DESTDIR=$pkgdir install +} + +package_kdemultimedia-juk() { + pkgdesc='Music Player' + depends=('kdebase-runtime' 'tunepimp') + url="http://kde.org/applications/multimedia/juk" + install='kdemultimedia.install' + cd $srcdir/build/juk + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/juk + make DESTDIR=$pkgdir install +} + +package_kdemultimedia-kioslave() { + pkgdesc='Audio CD Browser' + depends=('kdelibs' 'libmusicbrainz3' 'cdparanoia') + conflicts=('kdemultimedia-libkcddb' 'kdemultimedia-libkcompactdisc') + replaces=('kdemultimedia-libkcddb' 'kdemultimedia-libkcompactdisc') + for i in kioslave doc/kioslave libkcddb libkcompactdisc; do + cd $srcdir/build/${i} + make DESTDIR=$pkgdir install + done +} + +package_kdemultimedia-kmix() { + pkgdesc='Sound Mixer' + depends=('kdebase-runtime') + url="http://kde.org/applications/multimedia/kmix" + install='kdemultimedia.install' + cd $srcdir/build/kmix + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kmix + make DESTDIR=$pkgdir install +} + +package_kdemultimedia-kscd() { + pkgdesc='CD Player' + depends=('kdebase-runtime' 'libmusicbrainz3') + url="http://kde.org/applications/multimedia/kscd" + install='kdemultimedia.install' + cd $srcdir/build/kscd + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kcontrol/cddbretrieval + make DESTDIR=$pkgdir install +} + +package_kdemultimedia-mplayerthumbs() { + pkgdesc='Video Files (MPlayerThumbs)' + depends=('kdebase-runtime' 'mplayer') + replaces=('mplayerthumbs') + conflicts=('mplayerthumbs') + cd $srcdir/build/mplayerthumbs + make DESTDIR=$pkgdir install + install -D -m644 $srcdir/mplayerthumbs.config $pkgdir/usr/share/config/mplayerthumbs +} diff --git a/kde-unstable/kdemultimedia/kdemultimedia.install b/kde-unstable/kdemultimedia/kdemultimedia.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdemultimedia/kdemultimedia.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdemultimedia/mplayerthumbs.config b/kde-unstable/kdemultimedia/mplayerthumbs.config new file mode 100644 index 000000000..761a17953 --- /dev/null +++ b/kde-unstable/kdemultimedia/mplayerthumbs.config @@ -0,0 +1,2 @@ +[MPlayerThumbsCfg] +backend=0 diff --git a/kde-unstable/kdenetwork/PKGBUILD b/kde-unstable/kdenetwork/PKGBUILD new file mode 100644 index 000000000..763acd722 --- /dev/null +++ b/kde-unstable/kdenetwork/PKGBUILD @@ -0,0 +1,114 @@ +# $Id: PKGBUILD 124770 2011-05-24 10:05:32Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdenetwork +pkgname=('kdenetwork-filesharing' + 'kdenetwork-kdnssd' + 'kdenetwork-kget' + 'kdenetwork-kopete' + 'kdenetwork-kppp' + 'kdenetwork-krdc' + 'kdenetwork-krfb') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdenetwork') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' 'speex' 'ortp' 'libotr' + 'qca-ossl' 'kdebase-workspace' 'kdebase-lib' 'libvncserver' 'libmsn' 'ppp' + 'v4l-utils' 'libidn' 'rdesktop' 'qimageblitz' 'libxdamage' 'libgadu' + 'telepathy-qt4' 'libktorrent' 'libmms') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('8afe1547ea6f9f7acbdaf73b3ade4e3c752e645e') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DMOZPLUGIN_INSTALL_DIR=/usr/lib/mozilla/plugins/ \ + -DWITH_Xmms=OFF \ + -DWITH_LibMeanwhile=OFF + make +} + +package_kdenetwork-filesharing() { + pkgdesc='Konqueror properties dialog plugin to share a directory with the local network' + depends=('kdelibs' 'smbclient') + install='kdenetwork.install' + cd $srcdir/build/filesharing + make DESTDIR=$pkgdir install +} + +package_kdenetwork-kdnssd() { + pkgdesc='Monitors the network for DNS-SD services' + depends=('kdelibs') + cd $srcdir/build/kdnssd + make DESTDIR=$pkgdir install +} + +package_kdenetwork-kget() { + pkgdesc='Download Manager' + depends=('kdebase-workspace' 'kdebase-lib' 'libktorrent' 'libmms') + optdepends=('python2: YouTube plugin') + url="http://kde.org/applications/internet/kget/" + install='kdenetwork.install' + cd $srcdir/build/kget + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kget + make DESTDIR=$pkgdir install + + # Use the python2 executable + find ${pkgdir} -name '*.py' | xargs sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' +} + +package_kdenetwork-kopete() { + pkgdesc='Instant Messenger' + depends=('kdebase-runtime' 'kdepimlibs' 'qca-ossl' 'libotr' 'libmsn' + 'libidn' 'qimageblitz' 'v4l-utils' 'libgadu') + url="http://kde.org/applications/internet/kopete/" + install='kdenetwork.install' + cd $srcdir/build/kopete + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kopete + make DESTDIR=$pkgdir install +} + +package_kdenetwork-kppp() { + pkgdesc='Internet Dial-Up Tool' + depends=('kdebase-runtime' 'ppp') + url="http://kde.org/applications/internet/kppp/" + install='kdenetwork.install' + cd $srcdir/build/kppp + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kppp + make DESTDIR=$pkgdir install +} + +package_kdenetwork-krdc() { + pkgdesc='Remote Desktop Client' + depends=('kdebase-runtime' 'libvncserver' 'rdesktop' 'telepathy-qt4') + optdepends=('kdebase-keditbookmarks: to edit bookmarks') + url="http://kde.org/applications/internet/krdc/" + cd $srcdir/build/krdc + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/krdc + make DESTDIR=$pkgdir install +} + +package_kdenetwork-krfb() { + pkgdesc='Desktop Sharing' + # note on libxdamage: + # not detected by namcap because libgl depends on it + # but nvidia providing libgl does not depend on libxdamage + depends=('kdebase-runtime' 'libvncserver' 'libxdamage') + cd $srcdir/build/krfb + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/krfb + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdenetwork/kdenetwork.install b/kde-unstable/kdenetwork/kdenetwork.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdenetwork/kdenetwork.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdepim-runtime/PKGBUILD b/kde-unstable/kdepim-runtime/PKGBUILD index c367ccfc8..72aecd954 100644 --- a/kde-unstable/kdepim-runtime/PKGBUILD +++ b/kde-unstable/kdepim-runtime/PKGBUILD @@ -3,7 +3,7 @@ # Contributor: Pierre Schmitz <pierre@archlinux.de> pkgname=kdepim-runtime -pkgver=4.5.96 +pkgver=4.6.80 pkgrel=1 pkgdesc='KDE PIM Runtime Environment' arch=('i686' 'x86_64') @@ -12,16 +12,10 @@ license=('GPL' 'LGPL' 'FDL') depends=('kdepimlibs' 'kdebase-runtime') makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost') install=${pkgname}.install -#source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") -source=("http://download.kde.org/unstable/kdepim/${pkgver}/${pkgname}-${pkgver}.tar.bz2" - 'disable-l10n.patch') -sha1sums=('fd1cf58d5b62c647a7920dfc1d79126843750b1e' - '991d81435205185dcb2285a6e728f7756ae92b0d') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('18cb10ea5a7373c4eea859b0d0518b6a9c0e6a4e') build() { - cd "${srcdir}"/${pkgname}-${pkgver} - patch -Np0 -i "${srcdir}"/disable-l10n.patch - cd "${srcdir}" mkdir build cd build diff --git a/kde-unstable/kdepim/PKGBUILD b/kde-unstable/kdepim/PKGBUILD index 53c4696c0..1b0491433 100644 --- a/kde-unstable/kdepim/PKGBUILD +++ b/kde-unstable/kdepim/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 123823 2011-05-13 18:23:10Z andrea $ +# $Id: PKGBUILD 124768 2011-05-24 09:38:48Z andrea $ # Maintainer: Andrea Scarpino <andrea@archlinux.org> # Contributor: Pierre Schmitz <pierre@archlinux.de> @@ -20,25 +20,24 @@ pkgname=('kdepim-akonadiconsole' 'kdepim-ktimetracker' 'kdepim-libkdepim' 'kdepim-wizards') -pkgver=4.5.96 +pkgver=4.6.80 pkgrel=1 arch=('i686' 'x86_64') url='http://pim.kde.org' license=('GPL' 'LGPL' 'FDL') groups=('kde' 'kdepim') makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' 'kdepim-runtime' 'libxss' - 'pilot-link' 'kde-agent' 'docbook-xsl') -#source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") -source=("http://download.kde.org/unstable/${pkgbase}/${pkgver}/${pkgbase}-${pkgver}.tar.bz2" - 'disable-l10n.patch') -sha1sums=('f425f143fe3381be2bb018bab92d89fd112595f0' - '25e36f160ced051268e59fad6ed2de33a9c7657a') + 'pilot-link' 'kde-agent') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2" + 'fix-console-build.patch') +sha1sums=('dc32fee3332df3bdb4395f3a229d88de34ae4de1' + 'e4b82bcee6c46aad39196a5bb2732fed72ff4541') build() { - cd "${srcdir}"/${pkgbase}-${pkgver} - patch -Np0 -i "${srcdir}"/disable-l10n.patch + cd "${srcdir}"/${pkgbase}-${pkgver} + patch -p1 -i "${srcdir}"/fix-console-build.patch - cd "${srcdir}" + cd "${srcdir}" mkdir build cd build cmake ../${pkgbase}-${pkgver} \ diff --git a/kde-unstable/kdepim/fix-console-build.patch b/kde-unstable/kdepim/fix-console-build.patch new file mode 100644 index 000000000..552b8c0c1 --- /dev/null +++ b/kde-unstable/kdepim/fix-console-build.patch @@ -0,0 +1,11 @@ +--- 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/kdepimlibs/PKGBUILD b/kde-unstable/kdepimlibs/PKGBUILD new file mode 100644 index 000000000..2fff6052c --- /dev/null +++ b/kde-unstable/kdepimlibs/PKGBUILD @@ -0,0 +1,32 @@ +# $Id: PKGBUILD 124655 2011-05-23 19:42:19Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgname=kdepimlibs +pkgver=4.6.80 +pkgrel=1 +pkgdesc="KDE PIM Libraries" +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL') +depends=('kdelibs' 'gpgme' 'akonadi' 'libical' ) +makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' 'cyrus-sasl' 'openldap') +install='kdepimlibs.install' +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('e07ba03177775ee6db6669123b944dd7c3b362f1') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgname}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd $srcdir/build + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdepimlibs/kdepimlibs.install b/kde-unstable/kdepimlibs/kdepimlibs.install new file mode 100644 index 000000000..99262607c --- /dev/null +++ b/kde-unstable/kdepimlibs/kdepimlibs.install @@ -0,0 +1,11 @@ +post_install() { + update-mime-database usr/share/mime &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +}
\ No newline at end of file diff --git a/kde-unstable/kdeplasma-addons/PKGBUILD b/kde-unstable/kdeplasma-addons/PKGBUILD new file mode 100644 index 000000000..567e16086 --- /dev/null +++ b/kde-unstable/kdeplasma-addons/PKGBUILD @@ -0,0 +1,603 @@ +# $Id: PKGBUILD 124813 2011-05-24 15:14:21Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdeplasma-addons +pkgname=('kdeplasma-addons-applets-bball' + 'kdeplasma-addons-applets-binary-clock' + 'kdeplasma-addons-applets-blackboard' + 'kdeplasma-addons-applets-bookmarks' + 'kdeplasma-addons-applets-bubblemon' + 'kdeplasma-addons-applets-calculator' + 'kdeplasma-addons-applets-charselect' + 'kdeplasma-addons-applets-comic' + 'kdeplasma-addons-applets-community' + 'kdeplasma-addons-applets-dict' + 'kdeplasma-addons-applets-eyes' + 'kdeplasma-addons-applets-fifteenpuzzle' + 'kdeplasma-addons-applets-filewatcher' + 'kdeplasma-addons-applets-frame' + 'kdeplasma-addons-applets-fuzzy-clock' + 'kdeplasma-addons-applets-incomingmsg' + 'kdeplasma-addons-applets-kdeobservatory' + 'kdeplasma-addons-applets-kimpanel' + 'kdeplasma-addons-applets-knowledgebase' + 'kdeplasma-addons-applets-kolourpicker' + 'kdeplasma-addons-applets-konqprofiles' + 'kdeplasma-addons-applets-konsoleprofiles' + 'kdeplasma-addons-applets-lancelot' + 'kdeplasma-addons-applets-leavenote' + 'kdeplasma-addons-applets-life' + 'kdeplasma-addons-applets-luna' + 'kdeplasma-addons-applets-magnifique' + 'kdeplasma-addons-applets-mediaplayer' + 'kdeplasma-addons-applets-microblog' + 'kdeplasma-addons-applets-news' + 'kdeplasma-addons-applets-notes' + 'kdeplasma-addons-applets-nowplaying' + 'kdeplasma-addons-applets-paste' + 'kdeplasma-addons-applets-pastebin' + 'kdeplasma-addons-applets-plasmaboard' + 'kdeplasma-addons-applets-previewer' + 'kdeplasma-addons-applets-qalculate' + 'kdeplasma-addons-applets-rememberthemilk' + 'kdeplasma-addons-applets-rssnow' + 'kdeplasma-addons-applets-showdashboard' + 'kdeplasma-addons-applets-showdesktop' + 'kdeplasma-addons-applets-social-news' + 'kdeplasma-addons-applets-spellcheck' + 'kdeplasma-addons-applets-systemloadviewer' + 'kdeplasma-addons-applets-timer' + 'kdeplasma-addons-applets-unitconverter' + 'kdeplasma-addons-applets-weather' + 'kdeplasma-addons-applets-weatherstation' + 'kdeplasma-addons-applets-webslice' + 'kdeplasma-addons-containments' + 'kdeplasma-addons-libs' + 'kdeplasma-addons-runners-audioplayercontrol' + 'kdeplasma-addons-runners-browserhistory' + 'kdeplasma-addons-runners-characters' + 'kdeplasma-addons-runners-contacts' + 'kdeplasma-addons-runners-converter' + 'kdeplasma-addons-runners-datetime' + 'kdeplasma-addons-runners-events' + 'kdeplasma-addons-runners-katesessions' + 'kdeplasma-addons-runners-konquerorsessions' + 'kdeplasma-addons-runners-konsolesessions' + 'kdeplasma-addons-runners-kopete' + 'kdeplasma-addons-runners-mediawiki' + 'kdeplasma-addons-runners-spellchecker' + 'kdeplasma-addons-wallpapers-mandelbrot' + 'kdeplasma-addons-wallpapers-marble' + 'kdeplasma-addons-wallpapers-pattern' + 'kdeplasma-addons-wallpapers-virus' + 'kdeplasma-addons-wallpapers-weather') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL') +groups=('kde' 'kdeplasma-addons') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'kdebase-workspace' 'kdeedu-marble' + 'eigen' 'scim' 'qwt' 'boost' 'libkexiv2') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('09b97248aa576991f9f5e9ddaa3392618e2337e7') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdeplasma-addons-applets-bball() { + pkgdesc='A bouncy ball for plasma' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/bball + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-binary-clock() { + pkgdesc='Time displayed in binary format' + depends=('kdebase-workspace') + cd $srcdir/build/applets/binary-clock + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-blackboard() { + pkgdesc='Black Board' + depends=('kdebase-workspace') + cd $srcdir/build/applets/blackboard + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-bookmarks() { + pkgdesc='Quick Access to the Bookmarks' + depends=('kdebase-workspace') + cd $srcdir/build/applets/bookmarks + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-bubblemon() { + pkgdesc='A pretty bubble that monitors your system.' + depends=('kdebase-workspace') + cd $srcdir/build/applets/bubblemon + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-calculator() { + pkgdesc='Calculate simple sums' + depends=('kdebase-workspace') + cd $srcdir/build/applets/calculator + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-charselect() { + pkgdesc='View, select, and copy characters from a font collection' + depends=('kdebase-workspace') + cd $srcdir/build/applets/charselect + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-comic() { + pkgdesc='View comic strips from the Internet' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/comic + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-community() { + pkgdesc='Communicate using the Social Desktop' + depends=('kdebase-workspace') + cd $srcdir/build/applets/community + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-dict() { + pkgdesc='Look up the meaning of words and their translation into different languages' + depends=('kdebase-workspace') + cd $srcdir/build/applets/dict + make DESTDIR=$pkgdir install + # FIXME + # /usr/share/icons/oxygen/scalable/apps/accessories-dictionary.svgz + rm -rf $pkgdir/usr/share/icons +} + +package_kdeplasma-addons-applets-eyes() { + pkgdesc='XEyes clone' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/eyes + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-fifteenpuzzle() { + pkgdesc='Put the pieces in order' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/fifteenPuzzle + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-filewatcher() { + pkgdesc='Watch for changes in specified files' + depends=('kdebase-workspace') + cd $srcdir/build/applets/fileWatcher + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-frame() { + pkgdesc='Display your favorite pictures' + depends=('kdebase-workspace' 'libkexiv2') + cd $srcdir/build/applets/frame + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-fuzzy-clock() { + pkgdesc='Time displayed in a less precise format' + depends=('kdebase-workspace') + cd $srcdir/build/applets/fuzzy-clock + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-incomingmsg() { + pkgdesc='Notification of new messages' + depends=('kdebase-workspace') + cd $srcdir/build/applets/incomingmsg + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-kdeobservatory() { + pkgdesc='Visualize the KDE ecosystem' + depends=('kdebase-workspace' 'qwt') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/kdeobservatory + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-kimpanel() { + pkgdesc='A generic input method panel for Oriental languages' + depends=('kdebase-workspace') + optdepends=('scim: SCIM backend' + 'fcitx: FCITX backend') + cd $srcdir/build/applets/kimpanel + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-knowledgebase() { + pkgdesc='Opendesktop Knowledgebase' + depends=('kdebase-workspace') + cd $srcdir/build/applets/knowledgebase + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-kolourpicker() { + pkgdesc='Pick a color from the desktop' + depends=('kdebase-workspace') + cd $srcdir/build/applets/kolourpicker + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-konqprofiles() { + pkgdesc='List and launch Konqueror profiles' + depends=('kdebase-workspace') + cd $srcdir/build/applets/konqprofiles + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-konsoleprofiles() { + pkgdesc='List and launch Konsole profiles' + depends=('kdebase-workspace') + cd $srcdir/build/applets/konsoleprofiles + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-lancelot() { + pkgdesc='Launcher to start applications' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + replaces=('lancelot') + provides=('lancelot') + conflicts=('lancelot') + install='kdeplasma-addons-applets-lancelot.install' + cd $srcdir/build/applets/lancelot + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-leavenote() { + pkgdesc='Leave notes for users while they are away' + depends=('kdebase-workspace') + cd $srcdir/build/applets/leavenote + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-life() { + pkgdesc='Life' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/life + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-luna() { + pkgdesc='Display moon phases for your location' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/luna + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-magnifique() { + pkgdesc='A magnification glass for the Plasma desktop' + depends=('kdebase-workspace') + cd $srcdir/build/applets/magnifique + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-mediaplayer() { + pkgdesc='Widget that can play video and sound' + depends=('kdebase-workspace') + cd $srcdir/build/applets/mediaplayer + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-microblog() { + pkgdesc='Update and view your microblog status.' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/microblog + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-news() { + pkgdesc='Show news from various sources' + depends=('kdebase-workspace') + cd $srcdir/build/applets/news + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-notes() { + pkgdesc='Desktop sticky notes' + depends=('kdebase-workspace') + cd $srcdir/build/applets/notes + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-nowplaying() { + pkgdesc='Displays currently playing audio' + depends=('kdebase-workspace') + cd $srcdir/build/applets/nowplaying + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-paste() { + pkgdesc='Paste text snippets' + depends=('kdebase-workspace') + cd $srcdir/build/applets/paste + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-pastebin() { + pkgdesc='Paste text/images to a remote server' + depends=('kdebase-workspace') + cd $srcdir/build/applets/pastebin + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-plasmaboard() { + pkgdesc='A virtual, on-screen keyboard' + depends=('kdebase-workspace') + cd $srcdir/build/applets/plasmaboard + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-previewer() { + pkgdesc='Preview This File' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/previewer + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-qalculate() { + pkgdesc='A powerful mathematical equation solver' + depends=('kdebase-workspace') + install='kdeplasma-addons-applets.install' + cd $srcdir/build/applets/qalculate + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-rememberthemilk() { + pkgdesc='Remember The Milk Todo list applet' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/rememberthemilk + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-rssnow() { + pkgdesc='Show news from various sources' + depends=('kdebase-workspace') + cd $srcdir/build/applets/rssnow + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-showdashboard() { + pkgdesc='Show the Plasma widget dashboard above other windows' + depends=('kdebase-workspace') + cd $srcdir/build/applets/showdashboard + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-showdesktop() { + pkgdesc='Show the Plasma desktop' + depends=('kdebase-workspace') + cd $srcdir/build/applets/showdesktop + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-social-news() { + pkgdesc='Stay informed with the Social Desktop' + replaces=('kdeplasma-addons-applets-opendesktop' 'kdeplasma-addons-applets-opendesktop-activities') + conflicts=('kdeplasma-addons-applets-opendesktop' 'kdeplasma-addons-applets-opendesktop-activities') + depends=('kdebase-workspace') + cd $srcdir/build/applets/social-news + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-spellcheck() { + pkgdesc='Fast spell checking' + depends=('kdebase-workspace') + cd $srcdir/build/applets/spellcheck + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-systemloadviewer() { + pkgdesc='Tiny CPU/RAM/Swap monitor' + depends=('kdebase-workspace') + cd $srcdir/build/applets/systemloadviewer + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-timer() { + pkgdesc='Countdown over a specified time period' + depends=('kdebase-workspace') + cd $srcdir/build/applets/timer + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-unitconverter() { + pkgdesc='Plasmoid for converting units' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/unitconverter + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-weather() { + pkgdesc='Displays Weather information' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/weather + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-weatherstation() { + pkgdesc='Weather reports with an LCD display style' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/weatherstation + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-applets-webslice() { + pkgdesc='Show a part of a webpage' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/applets/webslice + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-containments() { + pkgdesc='Activities types for Plasma shells' + depends=('kdebase-workspace') + cd $srcdir/build/containments + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-libs() { + pkgdesc='Plasma Addon Library' + depends=('kdebase-workspace') + groups=() + replaces=('kdeplasma-addons-dataengines') + provides=('kdeplasma-addons-dataengines') + conflicts=('kdeplasma-addons-dataengines') + cd $srcdir/build/libs + make DESTDIR=$pkgdir install + cd $srcdir/build/dataengines + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-audioplayercontrol() { + pkgdesc='Allows to control MPRIS audio players (it is able to search through Amarok´s collection, too)' + depends=('kdebase-workspace') + cd $srcdir/build/runners/audioplayercontrol + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-browserhistory() { + pkgdesc='Searches in Konqueror´s history' + depends=('kdebase-workspace') + cd $srcdir/build/runners/browserhistory + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-characters() { + pkgdesc='special Characters' + depends=('kdebase-workspace') + cd $srcdir/build/runners/characters + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-contacts() { + pkgdesc='Finds entries in your address book' + depends=('kdebase-workspace') + cd $srcdir/build/runners/contacts + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-converter() { + pkgdesc='Convert values to different units' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/runners/converter + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-datetime() { + pkgdesc='The current date and time, locally or in any timezone' + depends=('kdebase-workspace') + cd $srcdir/build/runners/datetime + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-events() { + pkgdesc='Calendar Events runner' + depends=('kdebase-workspace') + cd $srcdir/build/runners/events + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-katesessions() { + pkgdesc='Matches Kate Sessions' + depends=('kdebase-workspace') + cd $srcdir/build/runners/katesessions + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-konquerorsessions() { + pkgdesc='Matches Konqueror Sessions' + depends=('kdebase-workspace') + cd $srcdir/build/runners/konquerorsessions + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-konsolesessions() { + pkgdesc='Matches Konsole Sessions' + depends=('kdebase-workspace') + cd $srcdir/build/runners/konsolesessions + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-kopete() { + pkgdesc='Kopete Contact runner' + depends=('kdebase-workspace') + cd $srcdir/build/runners/kopete + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-mediawiki() { + pkgdesc='Search on Wikitravel' + depends=('kdebase-workspace') + cd $srcdir/build/runners/mediawiki + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-runners-spellchecker() { + pkgdesc='Check the spelling of a word' + depends=('kdebase-workspace') + cd $srcdir/build/runners/spellchecker + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-wallpapers-mandelbrot() { + pkgdesc='Mandelbrot' + depends=('kdebase-workspace') + cd $srcdir/build/wallpapers/mandelbrot + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-wallpapers-marble() { + pkgdesc='Globe' + depends=('kdebase-workspace' 'kdeedu-marble') + cd $srcdir/build/wallpapers/marble + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-wallpapers-pattern() { + pkgdesc='Pattern' + depends=('kdebase-workspace') + cd $srcdir/build/wallpapers/pattern + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-wallpapers-virus() { + pkgdesc='Virus' + depends=('kdebase-workspace') + cd $srcdir/build/wallpapers/virus + make DESTDIR=$pkgdir install +} + +package_kdeplasma-addons-wallpapers-weather() { + pkgdesc='Weather' + depends=('kdebase-workspace' 'kdeplasma-addons-libs') + cd $srcdir/build/wallpapers/weather + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdeplasma-addons/kdeplasma-addons-applets-lancelot.install b/kde-unstable/kdeplasma-addons/kdeplasma-addons-applets-lancelot.install new file mode 100644 index 000000000..ce5c32e1b --- /dev/null +++ b/kde-unstable/kdeplasma-addons/kdeplasma-addons-applets-lancelot.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-mime-database usr/share/mime &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +}
\ No newline at end of file diff --git a/kde-unstable/kdeplasma-addons/kdeplasma-addons-applets.install b/kde-unstable/kdeplasma-addons/kdeplasma-addons-applets.install new file mode 100644 index 000000000..c4ef46ba8 --- /dev/null +++ b/kde-unstable/kdeplasma-addons/kdeplasma-addons-applets.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +}
\ No newline at end of file diff --git a/kde-unstable/kdesdk-kate/PKGBUILD b/kde-unstable/kdesdk-kate/PKGBUILD new file mode 100644 index 000000000..c64df1df3 --- /dev/null +++ b/kde-unstable/kdesdk-kate/PKGBUILD @@ -0,0 +1,58 @@ +# $Id: PKGBUILD 124689 2011-05-23 21:22:48Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgbase=kdesdk-kate +pkgname=('kdebase-kwrite' + 'kdesdk-kate') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +makedepends=('kdelibs ''cmake' 'automoc4') +source=("http://download.kde.org/unstable/${pkgver}/src/kate-${pkgver}.tar.bz2" + 'pkgbuild-syntax-highlight.patch') +sha1sums=('9c95690b9f967a0ed52afcf6c4d7ace3ef9284ff' + 'ab0c5d2a796b0f283154799add161c99f48ffcd5') + +build() { + cd "${srcdir}"/kate-${pkgver} + patch -p1 -i "${srcdir}"/pkgbuild-syntax-highlight.patch + + cd "${srcdir}" + mkdir build + cd build + cmake ../kate-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_KTEXTEDITOR=OFF + make +} + +package_kdebase-kwrite() { + pkgdesc="Text Editor" + depends=('kdebase-runtime') + groups=('kde' 'kdebase') + install='kdebase-kwrite.install' + + cd "${srcdir}"/build/kwrite + make DESTDIR="${pkgdir}" install + + cd "${srcdir}"/build/part + make DESTDIR="${pkgdir}" install + + cd "${srcdir}"/build/doc/kwrite + make DESTDIR="${pkgdir}" install +} + +package_kdesdk-kate() { + pkgdesc="Advanced Text Editor" + depends=('kdebase-kwrite') + groups=('kde' 'kdesdk') + install='kdesdk-kate.install' + + cd "${srcdir}"/build/kate + make DESTDIR="${pkgdir}" install + + cd "${srcdir}"/build/doc/kate + make DESTDIR="${pkgdir}" install +} diff --git a/kde-unstable/kdesdk-kate/kdebase-kwrite.install b/kde-unstable/kdesdk-kate/kdebase-kwrite.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdesdk-kate/kdebase-kwrite.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdesdk-kate/kdesdk-kate.install b/kde-unstable/kdesdk-kate/kdesdk-kate.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/kdesdk-kate/kdesdk-kate.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdesdk-kate/pkgbuild-syntax-highlight.patch b/kde-unstable/kdesdk-kate/pkgbuild-syntax-highlight.patch new file mode 100644 index 000000000..3c43eca0f --- /dev/null +++ b/kde-unstable/kdesdk-kate/pkgbuild-syntax-highlight.patch @@ -0,0 +1,11 @@ +--- kate-4.6.80/part/syntax/data/bash.xml~ 2011-05-23 21:20:34.295137123 +0000 ++++ kate-4.6.80/part/syntax/data/bash.xml 2011-05-23 21:20:54.581993368 +0000 +@@ -8,7 +8,7 @@ + <!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following --> + <!ENTITY pathpart "([\w_@.%*?+-]|\\ )"> <!-- valid character in a file name --> + ]> +-<language name="Bash" version="2.12" kateversion="2.4" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;.bashrc;.bash_profile;.bash_login;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL"> ++<language name="Bash" version="2.12" kateversion="2.4" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL"> + + <!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl) + Changes by Matthew Woehlke (mw_triad@users.sourceforge.net) diff --git a/kde-unstable/kdesdk/PKGBUILD b/kde-unstable/kdesdk/PKGBUILD new file mode 100644 index 000000000..c01ad1d6e --- /dev/null +++ b/kde-unstable/kdesdk/PKGBUILD @@ -0,0 +1,247 @@ +# $Id: PKGBUILD 124846 2011-05-24 18:38:10Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdesdk +pkgname=('kdesdk-cervisia' + 'kdesdk-dolphin-plugins' + 'kdesdk-kapptemplate' + 'kdesdk-kcachegrind' + 'kdesdk-kdeaccounts-plugin' + 'kdesdk-kdepalettes' + 'kdesdk-kioslave' + 'kdesdk-kmtrace' + 'kdesdk-kompare' + 'kdesdk-kpartloader' + 'kdesdk-kprofilemethod' +# 'kdesdk-kspy' + 'kdesdk-kstartperf' + 'kdesdk-kuiviewer' + 'kdesdk-lokalize' + 'kdesdk-okteta' + 'kdesdk-poxml' +# 'kdesdk-scheck' + 'kdesdk-scripts' + 'kdesdk-strigi-analyzer' + 'kdesdk-umbrello') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdesdk') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' 'subversion' 'antlr2' + 'kdepimlibs' 'kdebase-lib') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2" + 'fix-python2-path.patch') +sha1sums=('2193e14b8373b833221dbf08ecdb0075e86abe44' + 'd05ca0231869c484fd3861955d960a60aff7dcfb') + +build() { + cd ${srcdir}/${pkgbase}-${pkgver} + + # Fix python2 path + patch -Np1 -i ${srcdir}/fix-python2-path.patch + sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \ + -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \ + $(find . -name '*.py') + + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdesdk-cervisia() { + pkgdesc='CVS Frontend' + depends=('kdebase-runtime') + url="http://kde.org/applications/development/cervisia/" + install='kdesdk.install' + cd $srcdir/build/cervisia + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/cervisia + make DESTDIR=$pkgdir install +} + +package_kdesdk-dolphin-plugins() { + pkgdesc='Extra Dolphin plugins' + depends=('kdebase-dolphin' 'subversion' 'git' 'kdesdk-kompare') + install='kdesdk.install' + cd $srcdir/build/dolphin-plugins/git + make DESTDIR=$pkgdir install + cd $srcdir/build/dolphin-plugins/svn + make DESTDIR=$pkgdir install +} + +package_kdesdk-kapptemplate() { + pkgdesc='KDE Template Generator' + depends=('kdebase-runtime') + url="http://kde.org/applications/development/kapptemplate/" + install='kdesdk.install' + cd $srcdir/build/kapptemplate + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kapptemplate + make DESTDIR=$pkgdir install +} + +package_kdesdk-kcachegrind() { + pkgdesc='Visualization of Performance Profiling Data' + depends=('kdebase-runtime' 'python2') + optdepends=('php: PHP support') + url="http://kde.org/applications/development/kcachegrind/" + install='kdesdk.install' + cd $srcdir/build/kcachegrind + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kcachegrind + make DESTDIR=$pkgdir install +} + +package_kdesdk-kdeaccounts-plugin() { + pkgdesc='KDE Repository Accounts' + depends=('kdepim-runtime') + cd $srcdir/build/kdeaccounts-plugin + make DESTDIR=$pkgdir install +} + +package_kdesdk-kdepalettes() { + pkgdesc='Palettes for the Gimp that match the KDE standard color palette' + optdepends=('gimp') + install -D -m644 $srcdir/${pkgbase}-${pkgver}/kdepalettes/KDE_Gimp \ + $pkgdir/usr/share/gimp/2.0/palettes/KDE.gpl +} + +package_kdesdk-kioslave() { + pkgdesc='KDED Subversion Module' + depends=('kdebase-runtime' 'subversion') + cd $srcdir/build/kioslave + make DESTDIR=$pkgdir install +} + +package_kdesdk-kmtrace() { + pkgdesc='A KDE tool to assist with malloc debugging using glibc´s "mtrace" functionality' + depends=('kdebase-runtime') + cd $srcdir/build/kmtrace + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kmtrace + make DESTDIR=$pkgdir install +} + +package_kdesdk-kompare() { + pkgdesc='Diff/Patch Frontend' + depends=('kdebase-runtime') + url="http://kde.org/applications/development/kompare/" + install='kdesdk.install' + cd $srcdir/build/kompare + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kompare + make DESTDIR=$pkgdir install +} + +package_kdesdk-kpartloader() { + pkgdesc='A test application for KParts' + depends=('kdebase-runtime') + install='kdesdk.install' + cd $srcdir/build/kpartloader + make DESTDIR=$pkgdir install +} + +package_kdesdk-kprofilemethod() { + pkgdesc='Macros helping to profile' + cd $srcdir/build/kprofilemethod + make DESTDIR=$pkgdir install +} + +package_kdesdk-kspy() { + pkgdesc='An Object Inspector for Qt/KDE applications' + depends=('kdebase-runtime') + cd $srcdir/build/kspy + make DESTDIR=$pkgdir install +} + +package_kdesdk-kstartperf() { + pkgdesc='Startup time measurement tool for KDE applications' + depends=('kdebase-runtime') + cd $srcdir/build/kstartperf + make DESTDIR=$pkgdir install +} + +package_kdesdk-kuiviewer() { + pkgdesc='Qt Designer UI File Viewer' + depends=('kdebase-runtime') + url="http://kde.org/applications/development/kuiviewer/" + install='kdesdk.install' + cd $srcdir/build/kuiviewer + make DESTDIR=$pkgdir install +} + +package_kdesdk-lokalize() { + pkgdesc='Computer-Aided Translation System' + depends=('kdebase-runtime' 'kdebindings-python') + url="http://kde.org/applications/development/lokalize/" + optdepends=('translate-toolkit: enable extra python script') + install='kdesdk.install' + cd $srcdir/build/lokalize + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/lokalize + make DESTDIR=$pkgdir install +} + +package_kdesdk-okteta() { + pkgdesc='Hex Editor' + depends=('kdebase-runtime') + replaces=('kdeutils-okteta') + conflicts=('kdeutils-okteta') + url="http://kde.org/applications/utilities/okteta" + install='kdesdk-okteta.install' + cd $srcdir/build/okteta + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/okteta + make DESTDIR=$pkgdir install +} + +package_kdesdk-poxml() { + pkgdesc='Translates DocBook XML files using gettext po files' + depends=('qt' 'antlr2') + cd $srcdir/build/poxml + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/poxml + make DESTDIR=$pkgdir install +} + +package_kdesdk-scheck() { + pkgdesc='An interface style to highlight accel and style guide conflicts' + depends=('kdebase-runtime') + cd $srcdir/build/scheck + make DESTDIR=$pkgdir install +} + +package_kdesdk-scripts() { + pkgdesc='KDE SDK scripts' + depends=('python2') + cd $srcdir/build/scripts + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/scripts + make DESTDIR=$pkgdir install +} + +package_kdesdk-strigi-analyzer() { + pkgdesc='Strigi-Analyzer for KDE SDK' + depends=('kdelibs') + cd $srcdir/build/strigi-analyzer + make DESTDIR=$pkgdir install +} + +package_kdesdk-umbrello() { + pkgdesc='UML Modeller' + depends=('kdebase-runtime') + url="http://kde.org/applications/development/umbrello/" + install='kdesdk.install' + cd $srcdir/build/umbrello + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/umbrello + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdesdk/fix-python2-path.patch b/kde-unstable/kdesdk/fix-python2-path.patch new file mode 100644 index 000000000..c2c0745d1 --- /dev/null +++ b/kde-unstable/kdesdk/fix-python2-path.patch @@ -0,0 +1,64 @@ +--- kdesdk-4.5.80/kcachegrind/converters/hotshot2calltree~ 2010-11-24 11:53:38.586666671 +0100 ++++ kdesdk-4.5.80/kcachegrind/converters/hotshot2calltree 2010-11-24 11:53:38.623333337 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + # _*_ coding: latin1 _*_ + + # +--- kdesdk-4.5.80/lokalize/scripts/msgmerge.py~ 2010-11-24 11:22:42.120000002 +0100 ++++ kdesdk-4.5.80/lokalize/scripts/msgmerge.py 2010-11-24 11:22:42.146666670 +0100 +@@ -114,7 +114,7 @@ + print >>sys.stderr, "Execution failed:", e + + cmd='%s/odf/xliffmerge.py -i %s -t %s -o %s' % (ourPath,xliffpathname,xlifftemplatepathname,xliffpathname) +- if os.name!='nt': cmd='python '+cmd ++ if os.name!='nt': cmd='python2 '+cmd + else: cmd=cmd.replace('/','\\') + os.system(cmd) + +--- kdesdk-4.5.80/lokalize/scripts/xliff2odf.py~ 2010-11-24 11:24:10.853333336 +0100 ++++ kdesdk-4.5.80/lokalize/scripts/xliff2odf.py 2010-11-24 11:24:10.883333336 +0100 +@@ -42,7 +42,7 @@ + xliff2odf.convertxliff(xliffinput, translatedodfpathname, odf) + + ourpath=([p for p in sys.path if os.path.exists(p+'/xliff2odf.py')]+[''])[0] +- os.system('python "'+ourpath+'/xliff2odf-standalone.py" "%s" "%s" &'%(translatedodfpathname, Editor.currentEntryId())) ++ os.system('python2 "'+ourpath+'/xliff2odf-standalone.py" "%s" "%s" &'%(translatedodfpathname, Editor.currentEntryId())) + + try: convert() + except: print 'error occured' +--- kdesdk-4.5.80/scripts/rename_source_files~ 2010-11-24 11:45:41.040000004 +0100 ++++ kdesdk-4.5.80/scripts/rename_source_files 2010-11-24 11:45:41.093333336 +0100 +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python2 + # + # Copyright David Faure <faure@kde.org>, License LGPL v2 + # +--- kdesdk-4.5.80/scripts/svn2log.sh~ 2010-11-24 11:46:24.863333337 +0100 ++++ kdesdk-4.5.80/scripts/svn2log.sh 2010-11-24 11:46:24.896666669 +0100 +@@ -17,6 +17,6 @@ + svn cat svn://anonsvn.kde.org/home/kde/trunk/kde-common/accounts > /tmp/accounts.$PPID + + echo "Creating changelog..."; +-svn log -v --xml $1 | python $CURRENT/svn2log.py --users=/tmp/accounts.$PPID --users-charset=UTF8 ++svn log -v --xml $1 | python2 $CURRENT/svn2log.py --users=/tmp/accounts.$PPID --users-charset=UTF8 + + rm /tmp/accounts.$PPID +--- kdesdk-4.5.80/scripts/kde_generate_export_header~ 2010-11-24 11:48:49.696666669 +0100 ++++ kdesdk-4.5.80/scripts/kde_generate_export_header 2010-11-24 11:48:49.753333338 +0100 +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python2 + + import os, sys, string + +--- kdesdk-4.5.80/scripts/reviewboarddiff~ 2010-11-24 11:49:37.686666670 +0100 ++++ kdesdk-4.5.80/scripts/reviewboarddiff 2010-11-24 11:49:37.740000003 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + # encoding: utf-8 + # + # Generates reviewboard compatible diffs from git-svn repositories. diff --git a/kde-unstable/kdesdk/kdesdk-okteta.install b/kde-unstable/kdesdk/kdesdk-okteta.install new file mode 100644 index 000000000..3f06b8deb --- /dev/null +++ b/kde-unstable/kdesdk/kdesdk-okteta.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-mime-database usr/share/mime &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdesdk/kdesdk.install b/kde-unstable/kdesdk/kdesdk.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdesdk/kdesdk.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdetoys/PKGBUILD b/kde-unstable/kdetoys/PKGBUILD new file mode 100644 index 000000000..1eba40691 --- /dev/null +++ b/kde-unstable/kdetoys/PKGBUILD @@ -0,0 +1,56 @@ +# $Id: PKGBUILD 124780 2011-05-24 12:05:42Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdetoys +pkgname=('kdetoys-amor' + 'kdetoys-kteatime' + 'kdetoys-ktux') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdetoys') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'kdebase-workspace') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('b268bb38f84199d33d3be1fe3e0389c0abb35e69') + +build() { + cd $srcdir + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdetoys-amor() { + pkgdesc='On-Screen Creature' + depends=('kdebase-runtime') + install='kdetoys.install' + cd $srcdir/build/amor + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/amor + make DESTDIR=$pkgdir install +} + +package_kdetoys-kteatime() { + pkgdesc='Tea Cooker' + depends=('kdebase-runtime') + install='kdetoys.install' + cd $srcdir/build/kteatime + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kteatime + make DESTDIR=$pkgdir install +} + +package_kdetoys-ktux() { + pkgdesc='KTux' + depends=('kdebase-workspace' ) + install='kdetoys.install' + cd $srcdir/build/ktux + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdetoys/kdetoys.install b/kde-unstable/kdetoys/kdetoys.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdetoys/kdetoys.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdeutils/PKGBUILD b/kde-unstable/kdeutils/PKGBUILD new file mode 100644 index 000000000..89915c6f6 --- /dev/null +++ b/kde-unstable/kdeutils/PKGBUILD @@ -0,0 +1,180 @@ +# $Id: PKGBUILD 124777 2011-05-24 11:52:41Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdeutils +pkgname=('kdeutils-ark' + 'kdeutils-filelight' + 'kdeutils-kcalc' + 'kdeutils-kcharselect' + 'kdeutils-kdf' + 'kdeutils-kfloppy' + 'kdeutils-kgpg' + 'kdeutils-kremotecontrol' + 'kdeutils-ktimer' + 'kdeutils-kwallet' + 'kdeutils-printer-applet' + 'kdeutils-superkaramba' + 'kdeutils-sweeper') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdeutils') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'kdebase-lib' 'kdebase-workspace' + 'kdebindings-python' 'system-config-printer-common' 'libarchive' 'qimageblitz' + 'qjson') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('90b5e5bd95ec2de2d36db20c6155d23dbeab2d60') + +build() { + cd ${srcdir} + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdeutils-ark() { + pkgdesc='Archiving Tool' + depends=('kdebase-runtime' 'kdebase-lib' 'libarchive') + optdepends=('p7zip' 'zip' 'unzip' 'unrar') + url="http://kde.org/applications/utilities/ark/" + cd $srcdir/build/ark + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ark + make DESTDIR=$pkgdir install +} + +package_kdeutils-filelight() { + pkgdesc='View disk usage information' + depends=('kdebase-runtime' 'qimageblitz') + replaces=('filelight') + conflicts=('filelight') + install='kdeutils.install' + url="http://methylblue.com/filelight/" + cd $srcdir/build/filelight + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/filelight + make DESTDIR=$pkgdir install +} + +package_kdeutils-kcalc() { + pkgdesc='Scientific Calculator' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kcalc/" + cd $srcdir/build/kcalc + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kcalc + make DESTDIR=$pkgdir install +} + +package_kdeutils-kcharselect() { + pkgdesc='Character Selector' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kcharselect/" + cd $srcdir/build/kcharselect + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kcharselect + make DESTDIR=$pkgdir install +} + +package_kdeutils-kdf() { + pkgdesc='View Disk Usage' + depends=('kdebase-runtime') + url="http://kde.org/applications/system/kdiskfree/" + install='kdeutils.install' + cd $srcdir/build/kdf + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kdf + make DESTDIR=$pkgdir install +} + +package_kdeutils-kfloppy() { + pkgdesc='Floppy Formatter' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kfloppy/" + install='kdeutils.install' + cd $srcdir/build/kfloppy + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kfloppy + make DESTDIR=$pkgdir install +} + +package_kdeutils-kgpg() { + pkgdesc='A GnuPG frontend' + depends=('kdepim-runtime' 'kde-agent') + url="http://kde.org/applications/utilities/kgpg" + install='kdeutils.install' + cd $srcdir/build/kgpg + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kgpg + make DESTDIR=$pkgdir install +} + +package_kdeutils-kremotecontrol() { + pkgdesc='Configure your remote controls for use with applications' + replaces=('kdeutils-kdelirc') + conflicts=('kdeutils-kdelirc') + depends=('kdebase-workspace') + url="http://kde.org/applications/utilities/kremotecontrol" + install='kdeutils.install' + cd $srcdir/build/kremotecontrol + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kcontrol/kremotecontrol + make DESTDIR=$pkgdir install +} + +package_kdeutils-ktimer() { + pkgdesc='Countdown Launcher' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/ktimer" + install='kdeutils.install' + cd $srcdir/build/ktimer + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/ktimer + make DESTDIR=$pkgdir install +} + +package_kdeutils-kwallet() { + pkgdesc='Wallet Management Tool' + depends=('kdebase-runtime') + url="http://kde.org/applications/system/kwalletmanager/" + install='kdeutils.install' + cd $srcdir/build/kwallet + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kwallet + make DESTDIR=$pkgdir install +} + +package_kdeutils-printer-applet() { + pkgdesc='System tray icon for managing print jobs' + depends=('kdebase-runtime' 'kdebindings-python' 'system-config-printer-common') + url="http://kde.org/applications/system/printerapplet/" + cd $srcdir/build/printer-applet + make DESTDIR=$pkgdir install + + # Use the python2 executable + find "${pkgdir}" -name '*.py' | xargs sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' +} + +package_kdeutils-superkaramba() { + pkgdesc='An engine for cool desktop eyecandy' + depends=('kdebase-runtime' 'kdebindings-python' 'qimageblitz') + url="http://kde.org/applications/utilities/superkaramba" + install='kdeutils.install' + cd $srcdir/build/superkaramba + make DESTDIR=$pkgdir install +} + +package_kdeutils-sweeper() { + pkgdesc='System Cleaner' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/sweeper/" + cd $srcdir/build/sweeper + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdeutils/kdeutils.install b/kde-unstable/kdeutils/kdeutils.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdeutils/kdeutils.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/kdewebdev/PKGBUILD b/kde-unstable/kdewebdev/PKGBUILD new file mode 100644 index 000000000..d70b92ee0 --- /dev/null +++ b/kde-unstable/kdewebdev/PKGBUILD @@ -0,0 +1,67 @@ +# $Id: PKGBUILD 124779 2011-05-24 12:04:03Z andrea $ +# Maintainer: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=kdewebdev +pkgname=('kdewebdev-kfilereplace' + 'kdewebdev-kimagemapeditor' + 'kdewebdev-klinkstatus' + 'kdewebdev-kommander') +pkgver=4.6.80 +pkgrel=1 +arch=('i686' 'x86_64') +url='http://www.kde.org' +license=('GPL' 'LGPL' 'FDL') +groups=('kde' 'kdewebdev') +makedepends=('pkgconfig' 'cmake' 'automoc4' 'ruby' 'tidyhtml' 'kdepim-runtime' + 'boost') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgbase}-${pkgver}.tar.bz2") +sha1sums=('d5e35391eb64265f66d81c5bdd8d95abf11d474a') + +build() { + cd $srcdir + mkdir build + cd build + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package_kdewebdev-kfilereplace() { + pkgdesc='Search & Replace Tool' + depends=('kdebase-runtime') + url="http://kde.org/applications/utilities/kfilereplace/" + install='kdewebdev.install' + cd $srcdir/build/kfilereplace + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kfilereplace + make DESTDIR=$pkgdir install +} + +package_kdewebdev-kimagemapeditor() { + pkgdesc='HTML Image Map Editor' + depends=('kdebase-runtime') + install='kdewebdev.install' + cd $srcdir/build/kimagemapeditor + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/kimagemapeditor + make DESTDIR=$pkgdir install +} + +package_kdewebdev-klinkstatus() { + pkgdesc='Link Checker' + depends=('kdepim-runtime' 'tidyhtml') + install='kdewebdev.install' + cd $srcdir/build/klinkstatus + make DESTDIR=$pkgdir install + cd $srcdir/build/doc/klinkstatus + make DESTDIR=$pkgdir install +} + +package_kdewebdev-kommander() { + pkgdesc='Executor for Kommander dialogs' + depends=('kdebase-runtime') + cd $srcdir/build/kommander + make DESTDIR=$pkgdir install +} diff --git a/kde-unstable/kdewebdev/kdewebdev.install b/kde-unstable/kdewebdev/kdewebdev.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/kdewebdev/kdewebdev.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/libkdcraw/PKGBUILD b/kde-unstable/libkdcraw/PKGBUILD new file mode 100644 index 000000000..95daa4280 --- /dev/null +++ b/kde-unstable/libkdcraw/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=libkdcraw +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A C++ interface used to decode RAW picture" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs' 'lcms') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('19fe60a51ede7bf5b4047f8fff22cd8361ebd90c') + +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/libkdcraw/libkdcraw.install b/kde-unstable/libkdcraw/libkdcraw.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/libkdcraw/libkdcraw.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/libkdeedu/PKGBUILD b/kde-unstable/libkdeedu/PKGBUILD new file mode 100644 index 000000000..fa4986b87 --- /dev/null +++ b/kde-unstable/libkdeedu/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124792 2011-05-24 13:04:47Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=libkdeedu +pkgver=4.6.80 +pkgrel=1 +pkgdesc="Libraries used by KDE Education applications" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs') +makedepends=('cmake' 'automoc4') +install=${pkgname}.install +replaces=('kdeedu-libkdeedu' 'kdeedu-data') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('2349b0a1676b61c7915a272030d6388e8bd6c3b1') + +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/libkdeedu/libkdeedu.install b/kde-unstable/libkdeedu/libkdeedu.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/libkdeedu/libkdeedu.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/libkexiv2/PKGBUILD b/kde-unstable/libkexiv2/PKGBUILD new file mode 100644 index 000000000..c80f8cd71 --- /dev/null +++ b/kde-unstable/libkexiv2/PKGBUILD @@ -0,0 +1,30 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=libkexiv2 +pkgver=4.6.80 +pkgrel=1 +pkgdesc="A library to manipulate pictures metadata" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('cff979e2bcc604ec422feff0bc1fee3483955e5d') + +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/libkface/PKGBUILD b/kde-unstable/libkface/PKGBUILD new file mode 100644 index 000000000..9bdcab86b --- /dev/null +++ b/kde-unstable/libkface/PKGBUILD @@ -0,0 +1,30 @@ +# $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/libkipi/PKGBUILD b/kde-unstable/libkipi/PKGBUILD new file mode 100644 index 000000000..b11e5a1cf --- /dev/null +++ b/kde-unstable/libkipi/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=libkipi +pkgver=4.6.80 +pkgrel=1 +pkgdesc="An interface to use kipi-plugins from a KDE application" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('f87620e1eaa795129447473c3b89dbc5a27da161') + +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/libkipi/libkipi.install b/kde-unstable/libkipi/libkipi.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/libkipi/libkipi.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/libkmap/PKGBUILD b/kde-unstable/libkmap/PKGBUILD new file mode 100644 index 000000000..b2ae07a94 --- /dev/null +++ b/kde-unstable/libkmap/PKGBUILD @@ -0,0 +1,30 @@ +# $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 +} diff --git a/kde-unstable/libksane/PKGBUILD b/kde-unstable/libksane/PKGBUILD new file mode 100644 index 000000000..b1f117368 --- /dev/null +++ b/kde-unstable/libksane/PKGBUILD @@ -0,0 +1,31 @@ +# $Id: PKGBUILD 124799 2011-05-24 13:21:06Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> + +pkgname=libksane +pkgver=4.6.80 +pkgrel=1 +pkgdesc="An image scanning library" +url="http://kde.org/" +arch=('i686' 'x86_64') +license=('GPL' 'LGPL' 'FDL') +depends=('kdelibs' 'sane') +makedepends=('cmake' 'automoc4') +conflicts=('kdegraphics-libs') +install=${pkgname}.install +source=("http://download.kde.org/unstable/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2") +sha1sums=('19cf8532f5ea046343fcaa51b9a9c0df7aae2978') + +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/libksane/libksane.install b/kde-unstable/libksane/libksane.install new file mode 100644 index 000000000..e70c054ec --- /dev/null +++ b/kde-unstable/libksane/libksane.install @@ -0,0 +1,11 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/qt/PKGBUILD b/kde-unstable/qt/PKGBUILD new file mode 100644 index 000000000..89e96034f --- /dev/null +++ b/kde-unstable/qt/PKGBUILD @@ -0,0 +1,222 @@ +# $Id: PKGBUILD 125344 2011-05-26 00:12:04Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Pierre Schmitz <pierre@archlinux.de> + +pkgbase=qt +pkgname=('qt' 'qt-private-headers') +pkgver=4.7.3 +pkgrel=2 +arch=('i686' 'x86_64') +url='http://qt.nokia.com/' +license=('GPL3' 'LGPL') +makedepends=('libtiff' 'libpng' 'libmng' 'sqlite3' 'ca-certificates' 'glib2' 'dbus' + 'fontconfig' 'libgl' 'libsm' 'libxrandr' 'libxv' 'libxi' 'alsa-lib' + 'xdg-utils' 'hicolor-icon-theme' 'desktop-file-utils' 'mesa' 'postgresql-libs' + 'mysql' 'unixodbc' 'cups' 'gtk2') +options=('!libtool') +_pkgfqn="qt-everywhere-opensource-src-${pkgver}" +source=("ftp://ftp.qt.nokia.com/qt/source/${_pkgfqn}.tar.gz" + 'assistant.desktop' 'designer.desktop' 'linguist.desktop' + 'qtconfig.desktop' + 'qtbug-16292.patch') +md5sums=('49b96eefb1224cc529af6fe5608654fe' + 'fc211414130ab2764132e7370f8e5caa' + '85179f5e0437514f8639957e1d8baf62' + 'f11852b97583610f3dbb669ebc3e21bc' + '6b771c8a81dd90b45e8a79afa0e5bbfd' + 'dc7ed8c2e8c68a175f7f05a34dccc937') + +build() { + unset QMAKESPEC + export QT4DIR=$srcdir/$_pkgfqn + export PATH=${QT4DIR}/bin:${PATH} + export LD_LIBRARY_PATH=${QT4DIR}/lib:${LD_LIBRARY_PATH} + + cd $srcdir/$_pkgfqn + + # Already fixed upstream + patch -p1 -i "${srcdir}"/qtbug-16292.patch + + sed -i "s|-O2|$CXXFLAGS|" mkspecs/common/g++.conf + sed -i "/^QMAKE_RPATH/s| -Wl,-rpath,||g" mkspecs/common/g++.conf + sed -i "/^QMAKE_LFLAGS\s/s|+=|+= $LDFLAGS|g" mkspecs/common/g++.conf + + ./configure -confirm-license -opensource \ + -prefix /usr \ + -docdir /usr/share/doc/qt \ + -plugindir /usr/lib/qt/plugins \ + -importdir /usr/lib/qt/imports \ + -datadir /usr/share/qt \ + -translationdir /usr/share/qt/translations \ + -sysconfdir /etc \ + -examplesdir /usr/share/doc/qt/examples \ + -demosdir /usr/share/doc/qt/demos \ + -largefile \ + -plugin-sql-{psql,mysql,sqlite,odbc} \ + -system-sqlite \ + -xmlpatterns \ + -no-phonon \ + -no-phonon-backend \ + -svg \ + -webkit \ + -script \ + -scripttools \ + -system-zlib \ + -system-libtiff \ + -system-libpng \ + -system-libmng \ + -system-libjpeg \ + -nomake demos \ + -nomake examples \ + -nomake docs \ + -no-rpath \ + -openssl-linked \ + -silent \ + -optimized-qmake \ + -dbus \ + -reduce-relocations \ + -no-separate-debug-info \ + -gtkstyle \ + -opengl \ + -no-openvg \ + -glib + make +} + +package_qt() { + pkgdesc='A cross-platform application and UI framework' + depends=('libtiff' 'libpng' 'libmng' 'sqlite3' 'ca-certificates' 'glib2' 'dbus' + 'fontconfig' 'libgl' 'libsm' 'libxrandr' 'libxv' 'libxi' 'alsa-lib' + 'xdg-utils' 'hicolor-icon-theme' 'desktop-file-utils') + optdepends=('postgresql-libs: PostgreSQL driver' + 'libmysqlclient: MySQL driver' + 'unixodbc: ODBC driver' + 'libxinerama: Xinerama support' + 'libxcursor: Xcursor support' + 'libxfixes: Xfixes support') + install='qt.install' + + cd $srcdir/$_pkgfqn + make INSTALL_ROOT=$pkgdir install + + # install missing icons and desktop files + for icon in tools/linguist/linguist/images/icons/linguist-*-32.png ; do + size=$(echo $(basename ${icon}) | cut -d- -f2) + install -p -D -m644 ${icon} ${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/linguist.png + done + install -p -D -m644 src/gui/dialogs/images/qtlogo-64.png ${pkgdir}/usr/share/icons/hicolor/64x64/apps/qtlogo.png + install -p -D -m644 tools/assistant/tools/assistant/images/assistant.png ${pkgdir}/usr/share/icons/hicolor/32x32/apps/assistant.png + install -p -D -m644 tools/designer/src/designer/images/designer.png ${pkgdir}/usr/share/icons/hicolor/128x128/apps/designer.png + install -d ${pkgdir}/usr/share/applications + install -m644 ${srcdir}/{linguist,designer,assistant,qtconfig}.desktop ${pkgdir}/usr/share/applications/ + + # install license addition + install -D -m644 LGPL_EXCEPTION.txt ${pkgdir}/usr/share/licenses/qt/LGPL_EXCEPTION.txt + + # Fix wrong path in pkgconfig files + find ${pkgdir}/usr/lib/pkgconfig -type f -name '*.pc' \ + -exec perl -pi -e "s, -L${srcdir}/?\S+,,g" {} \; + # Fix wrong path in prl files + find ${pkgdir}/usr/lib -type f -name '*.prl' \ + -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d;s/\(QMAKE_PRL_LIBS =\).*/\1/' {} \; +} + +package_qt-private-headers(){ + pkgdesc="Qt private headers for development" + depends=("qt=${pkgver}") + + install -d ${pkgdir}/usr/include/phonon/private + cd ${srcdir}/$_pkgfqn/src/3rdparty/phonon/phonon/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/phonon/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/Qt3Support/private + cd ${srcdir}/$_pkgfqn/src/qt3support/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/Qt3Support/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtCore/private + cd ${srcdir}/$_pkgfqn/src/corelib/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtCore/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtDBus/private + cd ${srcdir}/$_pkgfqn/src/dbus/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtDBus/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtDeclarative/private + cd ${srcdir}/$_pkgfqn/src/declarative/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtDeclarative/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtDesigner/private + cd ${srcdir}/$_pkgfqn/tools/designer/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtDesigner/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtGui/private + cd ${srcdir}/$_pkgfqn/src/gui/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtGui/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtHelp/private + cd ${srcdir}/$_pkgfqn/tools/assistant/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtHelp/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtMultimedia/private + cd ${srcdir}/$_pkgfqn/src/multimedia/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtMultimedia/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtNetwork/private + cd ${srcdir}/$_pkgfqn/src/network/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtNetwork/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtOpenGL/private + cd ${srcdir}/$_pkgfqn/src/opengl/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtOpenGL/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtScript/private + cd ${srcdir}/$_pkgfqn/src/script/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtScript/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtScriptTools/private + cd ${srcdir}/$_pkgfqn/src/scripttools/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtScriptTools/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtSql/private + cd ${srcdir}/$_pkgfqn/src/sql/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtSql/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtSvg/private + cd ${srcdir}/$_pkgfqn/src/svg/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtSvg/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtTest/private + cd ${srcdir}/$_pkgfqn/src/testlib/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtTest/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtUiTools/private + cd ${srcdir}/$_pkgfqn/tools/designer/src/uitools + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtUiTools/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtWebKit/private + cd ${srcdir}/$_pkgfqn/src/3rdparty/webkit + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtWebKit/private/ \; &> /dev/null + + install -d ${pkgdir}/usr/include/QtXmlPatterns/private + cd ${srcdir}/$_pkgfqn/src/xmlpatterns/ + find . -name "*_p.h" -exec install -m644 {} \ + ${pkgdir}/usr/include/QtXmlPatterns/private/ \; &> /dev/null +} diff --git a/kde-unstable/qt/assistant.desktop b/kde-unstable/qt/assistant.desktop new file mode 100644 index 000000000..a9e98c44b --- /dev/null +++ b/kde-unstable/qt/assistant.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Qt Assistant +Comment=Shows Qt documentation and examples +Exec=/usr/bin/assistant +Icon=assistant +Terminal=false +Encoding=UTF-8 +Type=Application +Categories=Qt;Development;Documentation; diff --git a/kde-unstable/qt/designer.desktop b/kde-unstable/qt/designer.desktop new file mode 100644 index 000000000..9b7b6e9aa --- /dev/null +++ b/kde-unstable/qt/designer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Qt Designer +GenericName=Interface Designer +Comment=Design GUIs for Qt applications +Exec=/usr/bin/designer +Icon=designer +MimeType=application/x-designer; +Terminal=false +Encoding=UTF-8 +Type=Application +Categories=Qt;Development; diff --git a/kde-unstable/qt/linguist.desktop b/kde-unstable/qt/linguist.desktop new file mode 100644 index 000000000..8cbe86599 --- /dev/null +++ b/kde-unstable/qt/linguist.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Qt Linguist +Comment=Add translations to Qt applications +Exec=/usr/bin/linguist +Icon=linguist +MimeType=text/vnd.trolltech.linguist;application/x-linguist; +Terminal=false +Encoding=UTF-8 +Type=Application +Categories=Qt;Development; diff --git a/kde-unstable/qt/qt.install b/kde-unstable/qt/qt.install new file mode 100644 index 000000000..81ce5c4b0 --- /dev/null +++ b/kde-unstable/qt/qt.install @@ -0,0 +1,12 @@ +post_install() { + xdg-icon-resource forceupdate --theme hicolor &> /dev/null + update-desktop-database -q +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} diff --git a/kde-unstable/qt/qtbug-16292.patch b/kde-unstable/qt/qtbug-16292.patch new file mode 100644 index 000000000..9728e28f5 --- /dev/null +++ b/kde-unstable/qt/qtbug-16292.patch @@ -0,0 +1,62 @@ +From e340844bd614add505a39a3a6b915632476f6305 Mon Sep 17 00:00:00 2001 +From: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> +Date: Tue, 15 Feb 2011 11:19:26 +0100 +Subject: [PATCH] Fix crash in KPackageKit + +QTreeViewPrivate::itemHeight() may refer to an invalid QModelIndex +after calling QTreeView::indexRowSizeHint(). + +Same thing inside QTreeView::indexRowSizeHint(), since +QHeaderView::count() will call +QAbstractItemViewPrivate::executePostedLayout() which may invalidate +all the QModelIndex. + +Reviewed-by: Olivier +Task-number: QTBUG-16292 +--- + src/gui/itemviews/qtreeview.cpp | 11 ++++++----- + 1 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp +index f1f3236..c0573bb 100644 +--- a/src/gui/itemviews/qtreeview.cpp ++++ b/src/gui/itemviews/qtreeview.cpp +@@ -2753,6 +2753,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const + + int start = -1; + int end = -1; ++ int indexRow = index.row(); + int count = d->header->count(); + bool emptyHeader = (count == 0); + QModelIndex parent = index.parent(); +@@ -2789,7 +2790,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const + int logicalColumn = emptyHeader ? column : d->header->logicalIndex(column); + if (d->header->isSectionHidden(logicalColumn)) + continue; +- QModelIndex idx = d->model->index(index.row(), logicalColumn, parent); ++ QModelIndex idx = d->model->index(indexRow, logicalColumn, parent); + if (idx.isValid()) { + QWidget *editor = d->editorForIndex(idx).editor; + if (editor && d->persistent.contains(editor)) { +@@ -3224,14 +3225,14 @@ int QTreeViewPrivate::itemHeight(int item) const + if (viewItems.isEmpty()) + return 0; + const QModelIndex &index = viewItems.at(item).index; ++ if (!index.isValid()) ++ return 0; + int height = viewItems.at(item).height; +- if (height <= 0 && index.isValid()) { ++ if (height <= 0) { + height = q_func()->indexRowSizeHint(index); + viewItems[item].height = height; + } +- if (!index.isValid() || height < 0) +- return 0; +- return height; ++ return qMax(height, 0); + } + + +-- +1.6.1 + diff --git a/kde-unstable/qt/qtconfig.desktop b/kde-unstable/qt/qtconfig.desktop new file mode 100644 index 000000000..46dcf9e3d --- /dev/null +++ b/kde-unstable/qt/qtconfig.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Qt Config +Comment=Configure Qt behavior, styles, fonts +Exec=/usr/bin/qtconfig +Icon=qtlogo +Terminal=false +Encoding=UTF-8 +Type=Application +Categories=Qt;Settings; +NoDisplay=true |