2012-01-31 12:28:12 +01:00
|
|
|
/*
|
2012-02-01 11:09:15 +01:00
|
|
|
Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
|
|
|
|
Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
|
2012-01-31 12:28:12 +01:00
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
#include "calendarsystem.h"
|
2012-01-31 12:28:12 +01:00
|
|
|
|
|
|
|
#include "kdebug.h"
|
|
|
|
#include "kconfiggroup.h"
|
2012-02-12 14:51:55 +01:00
|
|
|
#include <KCalendarSystem>
|
2012-02-10 21:31:00 +01:00
|
|
|
#include <KDateTime>
|
2012-02-16 11:22:44 +01:00
|
|
|
#include <KGlobal>
|
2012-02-12 15:14:18 +01:00
|
|
|
#include <QtCore/QDateTime>
|
2012-01-31 12:28:12 +01:00
|
|
|
|
2012-02-14 11:29:21 +01:00
|
|
|
CalendarSystem::CalendarSystem(QObject* parent)
|
|
|
|
: QObject(parent)
|
|
|
|
{
|
2012-02-16 11:22:44 +01:00
|
|
|
m_calendarSystem = KCalendarSystem::create(KGlobal::locale()->calendarSystem());
|
2012-02-14 11:29:21 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
QList<Locale::CalendarSystem> CalendarSystem::calendarSystemsList()
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
QList<Locale::CalendarSystem> list;
|
2012-01-31 12:28:12 +01:00
|
|
|
|
2012-02-12 14:51:55 +01:00
|
|
|
foreach(KLocale::CalendarSystem calendarSystem, KCalendarSystem::calendarSystemsList()) {
|
2012-02-01 13:02:43 +01:00
|
|
|
list.append((Locale::CalendarSystem)calendarSystem);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 13:02:43 +01:00
|
|
|
return list;
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-12 14:51:55 +01:00
|
|
|
QString CalendarSystem::calendarLabel(Locale::CalendarSystem calendarSystem, const KLocale *locale)
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 14:51:55 +01:00
|
|
|
return KCalendarSystem::calendarLabel((KLocale::CalendarSystem)calendarSystem, locale);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-12 14:51:55 +01:00
|
|
|
QString CalendarSystem::calendarType(Locale::CalendarSystem calendarSystem)
|
|
|
|
{
|
|
|
|
return KCalendarSystem::calendarType((KLocale::CalendarSystem)calendarSystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
Locale::CalendarSystem CalendarSystem::calendarSystem(const QString &calendarType )
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 14:51:55 +01:00
|
|
|
return (Locale::CalendarSystem)KCalendarSystem::calendarSystem(calendarType);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
Locale::CalendarSystem CalendarSystem::calendarSystem() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return (Locale::CalendarSystem)m_calendarSystem->calendarSystem();
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-03-09 12:25:25 +01:00
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::calendarLabel() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 14:51:55 +01:00
|
|
|
return m_calendarSystem->calendarLabel();
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::epoch() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->epoch();
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::earliestValidDate() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
|
|
|
return epoch();
|
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::latestValidDate() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
|
|
|
// Default to Gregorian 9999-12-31
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->latestValidDate();
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isValid(int year, int month, int day) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isValid(year, month, day);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-03-09 12:25:25 +01:00
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isValid(int year, int dayOfYear) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isValid(year, dayOfYear);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-03-09 12:25:25 +01:00
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isValid(const QString &eraName, int yearInEra, int month, int day) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isValid(eraName, yearInEra, month, day);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfIsoWeek) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isValidIsoWeekDate(year, isoWeekNumber, dayOfIsoWeek);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isValid(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isValid(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
void CalendarSystem::getDate(const QDate date, int *year, int *month, int *day) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->getDate(date, year, month, day);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::year(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->year(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::month(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->month(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::day(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->day(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::eraName(const QDate &date, StringFormat format) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 15:00:18 +01:00
|
|
|
return m_calendarSystem->eraName(date, (KCalendarSystem::StringFormat)format);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::eraYear(const QDate &date, StringFormat format) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 15:00:18 +01:00
|
|
|
return m_calendarSystem->eraYear(date, (KCalendarSystem::StringFormat)format);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-03-09 12:25:25 +01:00
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::yearInEra(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->yearInEra(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 13:02:43 +01:00
|
|
|
QDate CalendarSystem::addYears(const QDate &date, int numYears) const
|
|
|
|
{
|
|
|
|
return m_calendarSystem->addYears(date, numYears);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::addMonths(const QDate &date, int numMonths) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->addMonths(date, numMonths);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::addDays(const QDate &date, int numDays) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->addDays(date, numDays);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
void CalendarSystem::dateDifference(const QDate &fromDate, const QDate &toDate,
|
2012-01-31 12:28:12 +01:00
|
|
|
int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const
|
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->dateDifference(fromDate, toDate, yearsDiff, monthsDiff, daysDiff, direction);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::yearsDifference(const QDate &fromDate, const QDate &toDate) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->yearsDifference(fromDate, toDate);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::monthsDifference(const QDate &fromDate, const QDate &toDate) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->monthsDifference(fromDate, toDate);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::daysDifference(const QDate &fromDate, const QDate &toDate) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->daysDifference(fromDate, toDate);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::monthsInYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->monthsInYear(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::monthsInYear(int year) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->monthsInYear(year);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::weeksInYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 11:24:48 +01:00
|
|
|
return weeksInYear(date, Locale::DefaultWeekNumber);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::weeksInYear(int year) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 11:24:48 +01:00
|
|
|
return weeksInYear(year, Locale::DefaultWeekNumber);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
int CalendarSystem::weeksInYear(const QDate &date, Locale::WeekNumberSystem weekNumberSystem) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->weeksInYear(date, (KLocale::WeekNumberSystem)weekNumberSystem);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
int CalendarSystem::weeksInYear(int year, Locale::WeekNumberSystem weekNumberSystem) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->weeksInYear(year, (KLocale::WeekNumberSystem)weekNumberSystem);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::daysInYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->daysInYear(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::daysInYear(int year) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->daysInYear(year);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::daysInMonth(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->daysInMonth(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::daysInMonth(int year, int month) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->daysInMonth(year, month);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::daysInWeek(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 15:00:18 +01:00
|
|
|
return m_calendarSystem->daysInWeek(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::dayOfYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->dayOfYear(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::dayOfWeek(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->dayOfWeek(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::week(const QDate &date, int *yearNum) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 11:24:48 +01:00
|
|
|
return week(date, Locale::DefaultWeekNumber, yearNum);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
int CalendarSystem::week(const QDate &date, Locale::WeekNumberSystem weekNumberSystem, int *yearNum) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->week(date, (KLocale::WeekNumberSystem)weekNumberSystem, yearNum);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isLeapYear(int year) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isLeapYear(year);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
bool CalendarSystem::isLeapYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->isLeapYear(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::firstDayOfYear(int year) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->firstDayOfYear(year);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::lastDayOfYear(int year) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->lastDayOfYear(year);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::firstDayOfYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->firstDayOfYear(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-03-09 12:25:25 +01:00
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::lastDayOfYear(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->lastDayOfYear(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::firstDayOfMonth(int year, int month) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->firstDayOfMonth(year, month);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::lastDayOfMonth(int year, int month) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->lastDayOfMonth(year, month);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::firstDayOfMonth(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->firstDayOfMonth(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::lastDayOfMonth(const QDate &date) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->lastDayOfMonth(date);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::monthName(int month, int year, CalendarSystem::MonthNameFormat format) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->monthName(month, year, (KCalendarSystem::MonthNameFormat)format);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::monthName(const QDate &date, MonthNameFormat format) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->monthName(date, (KCalendarSystem::MonthNameFormat)format);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::weekDayName(int weekDay, CalendarSystem::WeekDayNameFormat format) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->weekDayName(weekDay, (KCalendarSystem::WeekDayNameFormat)format);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::weekDayName(const QDate &date, WeekDayNameFormat format) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->weekDayName(date, (KCalendarSystem::WeekDayNameFormat)format);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
QString CalendarSystem::formatDate(const QDate &fromDate, Locale::DateFormat toFormat) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->formatDate(fromDate, (KLocale::DateFormat)toFormat);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QString CalendarSystem::formatDate(const QDate &fromDate, const QString &toFormat,
|
2012-02-01 11:24:48 +01:00
|
|
|
Locale::DateTimeFormatStandard standard) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-12 15:00:18 +01:00
|
|
|
return m_calendarSystem->formatDate(fromDate, toFormat, (KLocale::DateTimeFormatStandard)standard);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-03-09 12:25:25 +01:00
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
QString CalendarSystem::formatDate(const QDate &fromDate, const QString &toFormat, Locale::DigitSet digitSet,
|
|
|
|
Locale::DateTimeFormatStandard formatStandard) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->formatDate(fromDate, toFormat, (KLocale::DigitSet)digitSet,
|
|
|
|
(KLocale::DateTimeFormatStandard)formatStandard);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
QString CalendarSystem::formatDate(const QDate &date, Locale::DateTimeComponent component,
|
|
|
|
Locale::DateTimeComponentFormat format,
|
|
|
|
Locale::WeekNumberSystem weekNumberSystem) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->formatDate(date, (KLocale::DateTimeComponent)component,
|
|
|
|
(KLocale::DateTimeComponentFormat)format,
|
|
|
|
(KLocale::WeekNumberSystem)weekNumberSystem);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::readDate(const QString &str, bool *ok) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->readDate(str, ok);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 11:24:48 +01:00
|
|
|
QDate CalendarSystem::readDate(const QString &str, Locale::ReadDateFlags flags, bool *ok) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->readDate(str, (KLocale::ReadDateFlags)flags, ok);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::readDate(const QString &inputString, const QString &formatString, bool *ok) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 11:24:48 +01:00
|
|
|
return readDate(inputString, formatString, ok, Locale::KdeFormat);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
QDate CalendarSystem::readDate(const QString &inputString, const QString &formatString, bool *ok,
|
2012-02-01 11:24:48 +01:00
|
|
|
Locale::DateTimeFormatStandard formatStandard) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->readDate(inputString, formatString, ok,
|
|
|
|
(KLocale::DateTimeFormatStandard)formatStandard);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::shortYearWindowStartYear() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->shortYearWindowStartYear();
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::applyShortYearWindow(int inputYear) const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->applyShortYearWindow(inputYear);
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 10:47:40 +01:00
|
|
|
int CalendarSystem::weekStartDay() const
|
2012-01-31 12:28:12 +01:00
|
|
|
{
|
2012-02-01 13:02:43 +01:00
|
|
|
return m_calendarSystem->weekStartDay();
|
2012-01-31 12:28:12 +01:00
|
|
|
}
|
2012-02-16 11:22:44 +01:00
|
|
|
|
|
|
|
bool CalendarSystem::isSolar() const
|
|
|
|
{
|
|
|
|
return m_calendarSystem->isSolar();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CalendarSystem::isLunar() const
|
|
|
|
{
|
|
|
|
return m_calendarSystem->isLunar();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CalendarSystem::isLunisolar() const
|
|
|
|
{
|
|
|
|
return m_calendarSystem->isLunisolar();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CalendarSystem::isProleptic() const
|
|
|
|
{
|
|
|
|
return m_calendarSystem->isProleptic();
|
|
|
|
}
|