Remove the overloaded methods from Locale

This commit is contained in:
Giorgos Tsiapaliwkas 2012-03-26 11:27:36 +03:00
parent ee1ce0dca9
commit feefca269b
3 changed files with 13 additions and 108 deletions

View File

@ -198,11 +198,6 @@ QString Locale::formatMoney(double num, const QString &symbol, int precision) co
return m_locale->formatMoney(num, symbol, precision);
}
QString Locale::formatNumber(double num, int precision) const
{
return m_locale->formatNumber(num, precision);
}
QString Locale::formatLong(long num) const
{
return m_locale->formatLong(num);
@ -265,23 +260,15 @@ double Locale::readMoney(const QString &_str, bool *ok) const
return m_locale->readMoney(_str, ok);
}
QDate Locale::readDate(const QString &intstr, bool *ok) const
QDate Locale::readDate(const QString &intstr, ReadDateFlags flags) const
{
return m_locale->readDate(intstr, ok);
bool *ok;
return m_locale->readDate(intstr, (KLocale::ReadDateFlags)flags, ok);
}
QDate Locale::readDate(const QString &intstr, ReadDateFlags flags, bool *ok) const
{
return m_locale->readDate(intstr, (KLocale::ReadDateFlags)flags, ok);
}
QDate Locale::readDate(const QString &intstr, const QString &fmt, bool *ok) const
{
return m_locale->readDate(intstr, fmt, ok);
}
QTime Locale::readTime(const QString &intstr, bool *ok) const
QTime Locale::readTime(const QString &intstr) const
{
bool *ok;
return m_locale->readTime(intstr, ok);
}
@ -319,12 +306,7 @@ QStringList Locale::currencyCodeList() const
return m_locale->currencyCodeList();
}
QString Locale::formatDateTime(const QDateTime &dateTime, Locale::DateFormat format, bool includeSeconds) const
{
return m_locale->formatDateTime(dateTime, (KLocale::DateFormat)format, (KLocale::DateFormat)includeSeconds);
}
QString Locale::formatDateTime(const KDateTime &dateTime, Locale::DateFormat format, DateTimeFormatOptions options) const
QString Locale::formatDateTime(const QDateTime &dateTime, Locale::DateFormat format, DateTimeFormatOptions options) const
{
Q_UNUSED(format)
Q_UNUSED(options)
@ -561,11 +543,6 @@ void Locale::setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem)
emit WeekNumberSystemChanged();
}
Locale::WeekNumberSystem Locale::weekNumberSystem()
{
return (Locale::WeekNumberSystem)m_locale->weekNumberSystem();
}
Locale::WeekNumberSystem Locale::weekNumberSystem() const
{
return (Locale::WeekNumberSystem)m_locale->weekNumberSystem();

View File

@ -378,25 +378,6 @@ public:
*/
Q_INVOKABLE QString formatMoney(double num, const QString &currency = QString(), int precision = -1) const;
/**
* Given a double, converts that to a numeric string containing
* the localized numeric equivalent.
*
* e.g. given 123456.78F, return "123,456.78" (for some European country).
*
* If precision isn't specified or is < 0, then the default decimalPlaces() is used.
*
* This function is a wrapper that is provided for convenience.
*
* @param num The number to convert
* @param precision Number of decimal places used.
*
* @return The number as a localized string
* @see formatNumber(const QString, bool, int)
* @see decimalPlaces()
*/
Q_INVOKABLE QString formatNumber(double num, int precision = -1) const;
/**
* Given a string representing a number, converts that to a numeric
* string containing the localized numeric equivalent.
@ -743,19 +724,6 @@ public:
*/
Q_INVOKABLE QString formatDate(const QDate &date, DateFormat format = LongDate) const;
/**
* Returns a string formatted to the current locale's conventions
* regarding both date and time.
*
* @param dateTime the date and time to be formatted
* @param format category of date format to use
* @param includeSecs if @c true, the string will include the seconds part
* of the time; otherwise, the seconds will be omitted
*
* @return the date and time as a string
*/
Q_INVOKABLE QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
bool includeSecs = false) const;
/**
* Options for formatting date-time values.
*/
@ -776,7 +744,7 @@ public:
*
* @return The date and time as a string
*/
Q_INVOKABLE QString formatDateTime(const KDateTime &dateTime, DateFormat format = ShortDate,
Q_INVOKABLE QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
DateTimeFormatOptions options = 0) const;//TODO
/**
@ -921,17 +889,6 @@ public:
*/
void setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem);
//KDE5 remove in favour of const version
/**
*
* Returns the type of Week Number System used in this Locale
*
* @see Klocale::WeekNumberSystem
* @see setWeekNumberSystem()
* @returns the Week Number System used
*/
Locale::WeekNumberSystem weekNumberSystem();
/**
*
* Returns the type of Week Number System used in this Locale
@ -964,28 +921,6 @@ public:
*/
Q_INVOKABLE double readNumber(const QString &numStr, bool * ok = 0) const;
/**
* Converts a localized date string to a QDate. This method will try all
* ReadDateFlag formats in preferred order to read a valid date.
*
* The bool pointed by ok will be invalid if the date entered was not valid.
*
* @param str the string we want to convert.
* @param ok the boolean that is set to false if it's not a valid date.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QDate
* @see CalendarSystem::readDate()
*/
Q_INVOKABLE QDate readDate(const QString &str, bool* ok = 0) const;
/**
* Converts a localized date string to a QDate, using the specified format.
* You will usually not want to use this method.
* @see CalendarSystem::readDate()
*/
Q_INVOKABLE QDate readDate(const QString &intstr, const QString &fmt, bool* ok = 0) const;
/**
* Flags for readDate()
*/
@ -1009,27 +944,20 @@ public:
*
* @param str the string we want to convert.
* @param flags what format the the date string will be in
* @param ok the boolean that is set to false if it's not a valid date.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QDate
* @see CalendarSystem::readDate()
*/
Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags, bool *ok = 0) const;
Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags) const;
/**
* Converts a localized time string to a QTime.
* This method will try to parse it with seconds, then without seconds.
* The bool pointed to by @p ok will be set to false if the time entered was
* not valid.
*
* @param str the string we want to convert.
* @param ok the boolean that is set to false if it's not a valid time.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QTime
*/
Q_INVOKABLE QTime readTime(const QString &str, bool* ok = 0) const;
Q_INVOKABLE QTime readTime(const QString &str) const;
/**
* Additional processing options for readLocaleTime().
@ -1158,7 +1086,7 @@ public:
* @see QFile::encodeName
* @see QFile::decodeName
*/
int fileEncodingMib() const;
int fileEncodingMib() const; //TODO returns undefined
/**
* Changes the current date format.

View File

@ -182,16 +182,16 @@ Item {
console.log("formatLocaleTime:" + locale.formatLocaleTime("2010-05-05"))
console.log("dayPeriodText:" + locale.dayPeriodText("2010-05-05"))
console.log("dayPeriodText:" + locale.dayPeriodText("11:22:33"))
console.log("readMoney:" + locale.readMoney("$ 21"))
console.log("readNumber:" + locale.readNumber(locale.convertDigits(locale.digitSet, Locale.ArabicDigits)))
console.log("readNumber:" + locale.readNumber(10.0,3))
console.log("readDate:" + locale.readDate("2004-02-01"))
console.log("readDate:" + locale.readDate("2004-02-01", Locale.IsoFormat))
console.log("readTime:" + locale.readTime("11:22:33"))//TODO
console.log("readTime:" + locale.readTime("11:22:33"))//TODO its value in nothing(blank)
console.log("readLocaleTime:" + locale.readLocaleTime("11:12:13 AM"))