fix the calendarSystemsList list

This commit is contained in:
Giorgos Tsiapaliwkas 2012-03-23 15:46:46 +02:00
parent c0cee92b7d
commit c94a4917c4
3 changed files with 12 additions and 40 deletions

View File

@ -32,12 +32,12 @@ CalendarSystem::CalendarSystem(QObject* parent)
m_calendarSystem = KCalendarSystem::create(KGlobal::locale()->calendarSystem());
}
QList<Locale::CalendarSystem> CalendarSystem::calendarSystemsList()
QList<int> CalendarSystem::calendarSystemsList()
{
QList<Locale::CalendarSystem> list;
QList<int> list;
foreach(KLocale::CalendarSystem calendarSystem, KCalendarSystem::calendarSystemsList()) {
list.append((Locale::CalendarSystem)calendarSystem);
list.append((int)calendarSystem);
}
return list;

View File

@ -49,6 +49,7 @@ Q_ENUMS(DateTimeComponent)
Q_ENUMS(DateTimeComponentFormat)
//properties
Q_PROPERTY(QList<int> calendarSystemsList READ calendarSystemsList)
Q_PROPERTY(Locale::CalendarSystem calendarSystem READ calendarSystem NOTIFY calendarSystemChanged)//read-only
Q_PROPERTY(QString calendarLabel READ calendarLabel NOTIFY calendarLabelChanged)//read-only
Q_PROPERTY(QDate epoch READ epoch NOTIFY epochChanged)//read-only
@ -172,41 +173,7 @@ public:
* Returns the list of currently supported Calendar Systems
* @return list of Calendar Systems
*/
static QList<Locale::CalendarSystem> calendarSystemsList();//TODO
/**
*
* Returns a localized label to display for the required Calendar System type.
*
* Use with calendarSystemsList() to populate selection lists of available
* calendar systems.
*
* @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
*/
Q_INVOKABLE static QString calendarLabel(Locale::CalendarSystem calendarSystem, const KLocale *locale = KGlobal::locale());
/**
*
* Returns the Calendar System enum value for a given Calendar Type,
* e.g. Locale::QDateCalendar for "gregorian"
*
* @param calendarType the calendar type to convert
* @return calendar system for calendar type
*/
Q_INVOKABLE static Locale::CalendarSystem calendarSystem(const QString &calendarType);
//KDE5 remove
/**
*
* Returns the deprecated Calendar Type for a given Calendar System enum value,
* e.g. "gregorian" for Locale::QDateCalendar
*
* @param calendarSystem the calendar system to convert
* @return calendar type for calendar system
*/
Q_INVOKABLE static QString calendarType(Locale::CalendarSystem calendarSystem);
static QList<int> calendarSystemsList();
/**
*
@ -216,7 +183,6 @@ public:
*/
Locale::CalendarSystem calendarSystem() const;
//KDE5 make virtual?
/**
*
* Returns a localized label to display for the current Calendar System type.

View File

@ -85,6 +85,7 @@ Item {
console.log("decimalSymbol:" + locale.decimalSymbol)
locale.digitSet = Locale.EasternArabicIndicDigits
console.log("digitSet:" + locale.digitSet)
console.log("language:" + locale.language)
@ -205,7 +206,7 @@ Item {
console.log("convertDigits:" + locale.convertDigits(locale.digitSet, Locale.ArabicDigits))
for (var i in locale.allDigitSetsList) {
console.log("digits:" + locale.allDigitSetsList[i])
console.log("allDigitSetsList:" + locale.allDigitSetsList[i])
}
console.log("===========end===========")
@ -303,6 +304,7 @@ Item {
console.log("applyShortYearWindow:" + calendar.applyShortYearWindow(50))
console.log("calendarSystem:" + calendar.calendarSystem)
console.log("getDate:")
hash = calendar.getDate("2012-02-03")
for (var i in hash) {
@ -315,6 +317,10 @@ Item {
console.log(" " + i, "=", hash[i])
}
for (var i in calendar.calendarSystemsList) {
console.log("calendarSystemsList:" + calendar.calendarSystemsList[i])
}
console.log("===============end===============")
}
}