Fix the comments and a typo.

This commit is contained in:
Giorgos Tsiapaliwkas 2012-03-09 13:25:25 +02:00
parent 4d40a7dd92
commit b3c089f51c
4 changed files with 17 additions and 67 deletions

View File

@ -32,7 +32,6 @@ CalendarSystem::CalendarSystem(QObject* parent)
m_calendarSystem = KCalendarSystem::create(KGlobal::locale()->calendarSystem());
}
QList<Locale::CalendarSystem> CalendarSystem::calendarSystemsList()
{
QList<Locale::CalendarSystem> list;
@ -60,20 +59,17 @@ Locale::CalendarSystem CalendarSystem::calendarSystem(const QString &calendarTyp
return (Locale::CalendarSystem)KCalendarSystem::calendarSystem(calendarType);
}
// NOT VIRTUAL - If override needed use shared-d
Locale::CalendarSystem CalendarSystem::calendarSystem() const
{
return (Locale::CalendarSystem)m_calendarSystem->calendarSystem();
}
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::calendarLabel() const
{
return m_calendarSystem->calendarLabel();
}
// Dummy version using Gregorian as an example
// This method MUST be re-implemented in any new Calendar System
QDate CalendarSystem::epoch() const
{
return m_calendarSystem->epoch();
@ -84,8 +80,6 @@ QDate CalendarSystem::earliestValidDate() const
return epoch();
}
// Dummy version using Gregorian as an example
// This method MUST be re-implemented in any new Calendar System
QDate CalendarSystem::latestValidDate() const
{
// Default to Gregorian 9999-12-31
@ -97,19 +91,18 @@ bool CalendarSystem::isValid(int year, int month, int day) const
return m_calendarSystem->isValid(year, month, day);
}
// NOT VIRTUAL - If override needed use shared-d
bool CalendarSystem::isValid(int year, int dayOfYear) const
{
return m_calendarSystem->isValid(year, dayOfYear);
}
// NOT VIRTUAL - If override needed use shared-d
bool CalendarSystem::isValid(const QString &eraName, int yearInEra, int month, int day) const
{
return m_calendarSystem->isValid(eraName, yearInEra, month, day);
}
// NOT VIRTUAL - If override needed use shared-d
bool CalendarSystem::isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfIsoWeek) const
{
return m_calendarSystem->isValidIsoWeekDate(year, isoWeekNumber, dayOfIsoWeek);
@ -120,7 +113,6 @@ bool CalendarSystem::isValid(const QDate &date) const
return m_calendarSystem->isValid(date);
}
// NOT VIRTUAL - If override needed use shared-d
void CalendarSystem::getDate(const QDate date, int *year, int *month, int *day) const
{
return m_calendarSystem->getDate(date, year, month, day);
@ -141,19 +133,17 @@ int CalendarSystem::day(const QDate &date) const
return m_calendarSystem->day(date);
}
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::eraName(const QDate &date, StringFormat format) const
{
return m_calendarSystem->eraName(date, (KCalendarSystem::StringFormat)format);
}
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::eraYear(const QDate &date, StringFormat format) const
{
return m_calendarSystem->eraYear(date, (KCalendarSystem::StringFormat)format);
}
// NOT VIRTUAL - If override needed use shared-d
int CalendarSystem::yearInEra(const QDate &date) const
{
return m_calendarSystem->yearInEra(date);
@ -174,26 +164,22 @@ QDate CalendarSystem::addDays(const QDate &date, int numDays) const
return m_calendarSystem->addDays(date, numDays);
}
// NOT VIRTUAL - Uses shared-d instead
void CalendarSystem::dateDifference(const QDate &fromDate, const QDate &toDate,
int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const
{
return m_calendarSystem->dateDifference(fromDate, toDate, yearsDiff, monthsDiff, daysDiff, direction);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::yearsDifference(const QDate &fromDate, const QDate &toDate) const
{
return m_calendarSystem->yearsDifference(fromDate, toDate);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::monthsDifference(const QDate &fromDate, const QDate &toDate) const
{
return m_calendarSystem->monthsDifference(fromDate, toDate);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::daysDifference(const QDate &fromDate, const QDate &toDate) const
{
return m_calendarSystem->daysDifference(fromDate, toDate);
@ -204,7 +190,6 @@ int CalendarSystem::monthsInYear(const QDate &date) const
return m_calendarSystem->monthsInYear(date);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::monthsInYear(int year) const
{
return m_calendarSystem->monthsInYear(year);
@ -220,13 +205,11 @@ int CalendarSystem::weeksInYear(int year) const
return weeksInYear(year, Locale::DefaultWeekNumber);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::weeksInYear(const QDate &date, Locale::WeekNumberSystem weekNumberSystem) const
{
return m_calendarSystem->weeksInYear(date, (KLocale::WeekNumberSystem)weekNumberSystem);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::weeksInYear(int year, Locale::WeekNumberSystem weekNumberSystem) const
{
return m_calendarSystem->weeksInYear(year, (KLocale::WeekNumberSystem)weekNumberSystem);
@ -237,7 +220,6 @@ int CalendarSystem::daysInYear(const QDate &date) const
return m_calendarSystem->daysInYear(date);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::daysInYear(int year) const
{
return m_calendarSystem->daysInYear(year);
@ -248,7 +230,6 @@ int CalendarSystem::daysInMonth(const QDate &date) const
return m_calendarSystem->daysInMonth(date);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::daysInMonth(int year, int month) const
{
return m_calendarSystem->daysInMonth(year, month);
@ -269,13 +250,11 @@ int CalendarSystem::dayOfWeek(const QDate &date) const
return m_calendarSystem->dayOfWeek(date);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::week(const QDate &date, int *yearNum) const
{
return week(date, Locale::DefaultWeekNumber, yearNum);
}
// NOT VIRTUAL - Uses shared-d instead
int CalendarSystem::week(const QDate &date, Locale::WeekNumberSystem weekNumberSystem, int *yearNum) const
{
return m_calendarSystem->week(date, (KLocale::WeekNumberSystem)weekNumberSystem, yearNum);
@ -291,49 +270,42 @@ bool CalendarSystem::isLeapYear(const QDate &date) const
return m_calendarSystem->isLeapYear(date);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::firstDayOfYear(int year) const
{
return m_calendarSystem->firstDayOfYear(year);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::lastDayOfYear(int year) const
{
return m_calendarSystem->lastDayOfYear(year);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::firstDayOfYear(const QDate &date) const
{
return m_calendarSystem->firstDayOfYear(date);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::lastDayOfYear(const QDate &date) const
{
return m_calendarSystem->lastDayOfYear(date);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::firstDayOfMonth(int year, int month) const
{
return m_calendarSystem->firstDayOfMonth(year, month);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::lastDayOfMonth(int year, int month) const
{
return m_calendarSystem->lastDayOfMonth(year, month);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::firstDayOfMonth(const QDate &date) const
{
return m_calendarSystem->firstDayOfMonth(date);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::lastDayOfMonth(const QDate &date) const
{
return m_calendarSystem->lastDayOfMonth(date);
@ -364,14 +336,13 @@ QString CalendarSystem::formatDate(const QDate &fromDate, Locale::DateFormat toF
return m_calendarSystem->formatDate(fromDate, (KLocale::DateFormat)toFormat);
}
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::formatDate(const QDate &fromDate, const QString &toFormat,
Locale::DateTimeFormatStandard standard) const
{
return m_calendarSystem->formatDate(fromDate, toFormat, (KLocale::DateTimeFormatStandard)standard);
}
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::formatDate(const QDate &fromDate, const QString &toFormat, Locale::DigitSet digitSet,
Locale::DateTimeFormatStandard formatStandard) const
{
@ -379,7 +350,6 @@ QString CalendarSystem::formatDate(const QDate &fromDate, const QString &toForma
(KLocale::DateTimeFormatStandard)formatStandard);
}
// NOT VIRTUAL - If override needed use shared-d
QString CalendarSystem::formatDate(const QDate &date, Locale::DateTimeComponent component,
Locale::DateTimeComponentFormat format,
Locale::WeekNumberSystem weekNumberSystem) const
@ -404,7 +374,6 @@ QDate CalendarSystem::readDate(const QString &inputString, const QString &format
return readDate(inputString, formatString, ok, Locale::KdeFormat);
}
// NOT VIRTUAL - If override needed use shared-d
QDate CalendarSystem::readDate(const QString &inputString, const QString &formatString, bool *ok,
Locale::DateTimeFormatStandard formatStandard) const
{
@ -412,13 +381,11 @@ QDate CalendarSystem::readDate(const QString &inputString, const QString &format
(KLocale::DateTimeFormatStandard)formatStandard);
}
// NOT VIRTUAL - If override needed use shared-d
int CalendarSystem::shortYearWindowStartYear() const
{
return m_calendarSystem->shortYearWindowStartYear();
}
// NOT VIRTUAL - If override needed use shared-d
int CalendarSystem::applyShortYearWindow(int inputYear) const
{
return m_calendarSystem->applyShortYearWindow(inputYear);

View File

@ -27,7 +27,7 @@
#include <QtCore/QStringList>
#include <QtCore/QDate>
class CalendarSystem;
class KCalendarSystem;
class KCalendarEra;
/**

View File

@ -579,7 +579,6 @@ public:
*/
Q_INVOKABLE QString prettyFormatDuration(unsigned long mSec) const;
//KDE5 move to KDateTime namespace
/**
*
* Available Calendar Systems
@ -613,7 +612,6 @@ public:
ThaiCalendar = 23 /**< Thai Calendar, aka Buddhist or Thai Buddhist */
};
//KDE5 move to KDateTime namespace
/**
*
* System used for Week Numbers
@ -629,7 +627,6 @@ public:
SimpleWeek = 3 /**< Week 1 starts Jan 1st ends after 7 days */
};
//KDE5 move to KDateTime namespace
/**
*
* Standard used for Date Time Format String
@ -640,7 +637,6 @@ public:
UnicodeFormat /**< UNICODE Standard (Qt/Java/OSX/Windows) */
};
//KDE5 move to KDateTime namespace
/**
*
* Mode to use when parsing a Date Time input string
@ -657,14 +653,13 @@ public:
//StrictParsing /**< Parse Date/Time strictly to the format. */
};
//KDE5 move to KDateTime namespace
/**
*
* The various Components that make up a Date / Time
* In the future the Components may be combined as flags for dynamic
* generation of Date Formats.
*
* @see KCalendarSystem
* @see CalendarSystem
* @see KLocalizedDate
* @see DateTimeComponentFormat
*/
@ -701,7 +696,6 @@ public:
UnixTime = 0x20000000 /**< The UNIX Time portion of a date */
};
//KDE5 move to KDateTime namespace
/**
*
* Format used for individual Date/Time Components when converted to/from a string
@ -721,7 +715,6 @@ public:
Q_DECLARE_FLAGS(DateTimeComponents, DateTimeComponent)
//KDE5 move to KDateTime namespace
/**
* Format for date string.
*/
@ -739,7 +732,6 @@ public:
IsoOrdinalDate /**< ISO-8601 Ordinal Date format YYYY-DDD, e.g. 2009-001 */
};
//KDE5 move to KDateTime namespace
/**
* Returns a string formatted to the current locale's conventions
* regarding dates.
@ -751,7 +743,6 @@ public:
*/
Q_INVOKABLE QString formatDate(const QDate &date, DateFormat format = LongDate) const;
//KDE5 move to KDateTime namespace
/**
* Returns a string formatted to the current locale's conventions
* regarding both date and time.
@ -765,8 +756,6 @@ public:
*/
Q_INVOKABLE QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
bool includeSecs = false) const;
//KDE5 move to KDateTime namespace
/**
* Options for formatting date-time values.
*/
@ -777,7 +766,6 @@ public:
Q_DECLARE_FLAGS(DateTimeFormatOptions, DateTimeFormatOption)
//KDE5 move to KDateTime namespace
/**
* Returns a string formatted to the current locale's conventions
* regarding both date and time.
@ -825,7 +813,6 @@ public:
Q_DECLARE_FLAGS(TimeFormatOptions, TimeFormatOption)
//KDE5 move to KDateTime namespace
/**
*
* Returns a string formatted to the current locale's conventions
@ -909,7 +896,7 @@ public:
* Returns the type of Calendar System used in this Locale
*
* @see Locale::CalendarSystem
* @see KCalendarSystem
* @see CalendarSystem
* @return the type of Calendar System
*/
Locale::CalendarSystem calendarSystem() const;
@ -919,7 +906,7 @@ public:
* Sets the type of Calendar System to use in this Locale
*
* @see Locale::CalendarSystem
* @see KCalendarSystem
* @see CalendarSystem
* @param calendarSystem the Calendar System to use
*/
void setCalendarSystem(Locale::CalendarSystem calendarSystem);
@ -977,7 +964,6 @@ public:
*/
Q_INVOKABLE double readNumber(const QString &numStr, bool * ok = 0) const;
//KDE5 move to KDateTime namespace
/**
* Converts a localized date string to a QDate. This method will try all
* ReadDateFlag formats in preferred order to read a valid date.
@ -989,19 +975,17 @@ public:
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QDate
* @see KCalendarSystem::readDate()
* @see CalendarSystem::readDate()
*/
Q_INVOKABLE QDate readDate(const QString &str, bool* ok = 0) const;
//KDE5 move to KDateTime namespace
/**
* Converts a localized date string to a QDate, using the specified format.
* You will usually not want to use this method.
* @see KCalendarSystem::readDate()
* @see CalendarSystem::readDate()
*/
Q_INVOKABLE QDate readDate(const QString &intstr, const QString &fmt, bool* ok = 0) const;
//KDE5 move to KDateTime namespace
/**
* Flags for readDate()
*/
@ -1018,7 +1002,6 @@ public:
ISO Week date format (YYYY-DDD) */
};
//KDE5 move to KDateTime namespace
/**
* Converts a localized date string to a QDate.
* This method is stricter than readDate(str,&ok): it will only accept
@ -1030,7 +1013,7 @@ public:
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QDate
* @see KCalendarSystem::readDate()
* @see CalendarSystem::readDate()
*/
Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags, bool *ok = 0) const;

View File

@ -238,9 +238,9 @@ Item {
console.log("isValid:" + calendar.isValid(2012, 33))
//console.log("isValid:" + calendar.isValid(QString &eraName, int yearInEra, int month, int day)) TODO
console.log("isValid:" + calendar.isValid(calendar.formatDate("2012-02-03"), 2010, 5, 5))//TODO
console.log("isValidIsoWeekDate:" + calendar.isValidIsoWeekDate(2012, 2, 3)
console.log("isValidIsoWeekDate:" + calendar.isValidIsoWeekDate(2012, 2, 3))
console.log("isValid:" + calendar.isValid("2012-02-03"))
@ -302,9 +302,9 @@ Item {
console.log("formatDate:" + calendar.formatDate("2012-02-03"))
console.log("readDate:" + calendar.readDate("2012-02-03"))//TODO does it work?
console.log("readDate:" + calendar.readDate("2012-02-03"))
console.log("applyShortYearWindow:" + calendar.applyShortYearWindow(120))//TODO does it work?
console.log("applyShortYearWindow:" + calendar.applyShortYearWindow(50))
console.log("===============end===============")
}