Remove KLocale bindings
KLocale is now kde4support and we have QLocale QML bindings. This patch removes the KLocale bindings from plasma-framework (they are not used anywhere anyway). If we miss something from KLocale in QLocale, we should upstream it. REVIEW: 114150
This commit is contained in:
parent
c29773656e
commit
13d1f5568f
@ -1,6 +1,5 @@
|
||||
|
||||
plasma_install_package(config org.kde.example.configuration)
|
||||
plasma_install_package(localegallery org.kde.example.locale)
|
||||
plasma_install_package(notes org.kde.example.notes)
|
||||
plasma_install_package(widgetgallery org.kde.example.widgetgallery)
|
||||
plasma_install_package(qmltasks org.kde.example.tasks)
|
||||
|
@ -1,482 +0,0 @@
|
||||
// -*- coding: iso-8859-1 -*-
|
||||
/*
|
||||
* Author: Giorgos Tsiapaliwkas <terietor@gmail.com>
|
||||
* Date: Wed Feb 15 2012, 18:28:32
|
||||
*
|
||||
* This program 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 or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.locale 2.0 as PlasmaLocale
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property int minimumHeight: 200
|
||||
property int minimumWidth: 500
|
||||
Column {
|
||||
id: column
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
spacing: 20
|
||||
PlasmaComponents.Label {
|
||||
id: text1
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: "<B>This is a test plasmoid for the locale bindings</B>"
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: text2
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: "<B>If you see this text,that means that every " +
|
||||
" non printable property/method has been already set. And it works!!</B>"
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: bt1
|
||||
anchors.horizontalCenter: column.horizontalCenter
|
||||
text: "click in order to test the Locale component"
|
||||
onClicked:{
|
||||
console.log("=====Locale Component====")
|
||||
console.log("country:" + locale.country)
|
||||
|
||||
locale.binaryUnitDialect = PlasmaLocale.Locale.IECBinaryDialect
|
||||
locale.calendarSystem = PlasmaLocale.Locale.CopticCalendar
|
||||
|
||||
locale.countryDivisionCode = "AL"
|
||||
console.log("countryDivisionCode:" + locale.countryDivisionCode)
|
||||
|
||||
console.log("currencyCode:" + locale.currencyCode)
|
||||
|
||||
locale.currencySymbol = "$"
|
||||
console.log("currencySymbol:" + locale.currencySymbol)
|
||||
|
||||
locale.dateTimeDigitSet = PlasmaLocale.Locale.EasternArabicIndicDigits
|
||||
console.log(locale.formatLocaleTime( "11:12:13", Locale.TimeWithoutAmPm|Locale.TimeWithoutSeconds ))
|
||||
console.log(locale.formatDateTime("2013-04-12", Locale.ShortDate ,Locale.Seconds ))
|
||||
|
||||
locale.dateFormat = "Y"
|
||||
console.log("dateFormat:" + locale.dateFormat)
|
||||
|
||||
locale.dateFormatShort = "Y"
|
||||
console.log("dateFormatShort:" + locale.dateFormatShort)
|
||||
|
||||
locale.dateMonthNamePossessive = false
|
||||
console.log("dateMonthNamePossessive:" + locale.dateMonthNamePossessive)
|
||||
|
||||
locale.decimalPlaces = 2
|
||||
console.log("decimalPlaces:" + locale.decimalPlaces)
|
||||
|
||||
locale.decimalSymbol = "."
|
||||
console.log("decimalSymbol:" + locale.decimalSymbol)
|
||||
|
||||
locale.digitSet = PlasmaLocale.Locale.EasternArabicIndicDigits
|
||||
console.log("digitSet:" + locale.digitSet)
|
||||
|
||||
console.log("language:" + locale.language)
|
||||
|
||||
locale.measureSystem = PlasmaLocale.Locale.Imperial
|
||||
|
||||
locale.monetaryDecimalPlaces = 3
|
||||
console.log("monetaryDecimalPlaces:" + locale.monetaryDecimalPlaces)
|
||||
|
||||
locale.monetaryDecimalSymbol = "."
|
||||
console.log("monetaryDecimalSymbol:" + locale.monetaryDecimalSymbol)
|
||||
|
||||
locale.monetaryDigitSet = PlasmaLocale.Locale.EasternArabicIndicDigits
|
||||
|
||||
locale.monetaryThousandsSeparator = "."
|
||||
console.log("monetaryThousandsSeparator:" + locale.monetaryThousandsSeparator)
|
||||
|
||||
locale.negativeMonetarySignPosition = PlasmaLocale.Locale.AfterMoney
|
||||
|
||||
locale.negativePrefixCurrencySymbol = false
|
||||
console.log("negativePrefixCurrencySymbol:" + locale.negativePrefixCurrencySymbol)
|
||||
|
||||
locale.negativeSign = "-"
|
||||
console.log("negativeSign:" + locale.negativeSign)
|
||||
|
||||
locale.pageSize = 6
|
||||
console.log("pageSize:" + locale.pageSize)
|
||||
|
||||
locale.positiveMonetarySignPosition = PlasmaLocale.Locale.AfterMoney
|
||||
|
||||
locale.positivePrefixCurrencySymbol = false
|
||||
console.log("positivePrefixCurrencySymbol:" + locale.positivePrefixCurrencySymbol)
|
||||
|
||||
locale.positiveSign = "+"
|
||||
console.log("positiveSign:" + locale.positiveSign)
|
||||
|
||||
locale.thousandsSeparator = "."
|
||||
console.log("thousandsSeparator:" + locale.thousandsSeparator)
|
||||
|
||||
locale.weekDayOfPray = 10
|
||||
console.log("weekDayOfPray:" + locale.weekDayOfPray)
|
||||
|
||||
locale.weekNumberSystem = PlasmaLocale.Locale.FirstFullWeek
|
||||
|
||||
locale.weekStartDay = 3
|
||||
console.log("weekStartDay:" + locale.weekStartDay)
|
||||
|
||||
locale.workingWeekEndDay = 6
|
||||
console.log("workingWeekEndDay:" + locale.workingWeekEndDay)
|
||||
|
||||
locale.workingWeekStartDay = 2
|
||||
console.log("workingWeekStartDay:" + locale.workingWeekEndDay)
|
||||
|
||||
console.log("use12Clock:" + locale.use12Clock)
|
||||
|
||||
console.log("defaultLanguage:" + locale.defaultLanguage)
|
||||
|
||||
console.log("defaultCountry:" + locale.defaultCountry)
|
||||
|
||||
console.log("defaultCurrencyCode:" + locale.defaultCurrencyCode)
|
||||
|
||||
for (var i in locale.languageList) {
|
||||
console.log("languageList:" + locale.languageList[i])
|
||||
}
|
||||
|
||||
for (var i in locale.currencyCodeList) {
|
||||
console.log("currencyCodeList:" + locale.currencyCodeList[i])
|
||||
}
|
||||
|
||||
for (var i in locale.installedLanguages) {
|
||||
console.log("installedLanguages:" + locale.installedLanguages[i])
|
||||
}
|
||||
|
||||
for (var i in locale.allCountriesList) {
|
||||
console.log("allCountriesList:" + locale.allCountriesList[i])
|
||||
}
|
||||
|
||||
console.log("formatDate:" + locale.formatDate("2010-05-05"))
|
||||
|
||||
console.log("formatDateTime:" + locale.formatDateTime("2010-05-05"))
|
||||
|
||||
console.log("formatMoney:" + locale.formatMoney(10))
|
||||
|
||||
console.log("formatLong:" + locale.formatLong(10))
|
||||
|
||||
console.log("formatByteSize:" + locale.formatByteSize(10))
|
||||
|
||||
console.log("formatDuration:" + locale.formatDuration(10))
|
||||
|
||||
console.log("prettyFormatDuration:" + locale.prettyFormatDuration(10))
|
||||
|
||||
console.log("formatLocaleTime:" + locale.formatLocaleTime("11:12:13"))
|
||||
|
||||
console.log("dayPeriodText:" + locale.dayPeriodText("11:22:33"))
|
||||
|
||||
console.log("readMoney:" + locale.readMoney("$ 21"))
|
||||
|
||||
console.log("readNumber:" + locale.readNumber(10.0,3))
|
||||
|
||||
console.log("readDate:" + locale.readDate("2004-02-01", PlasmaLocale.Locale.IsoFormat))
|
||||
|
||||
console.log("readTime:" + locale.readTime("11:22:33 AM"))
|
||||
|
||||
console.log("readLocaleTime:" + locale.readLocaleTime("11:12:13 AM"))
|
||||
|
||||
console.log("fileEncodingMib:" + locale.fileEncodingMib)
|
||||
|
||||
console.log("languageCodeToName:" + locale.languageCodeToName("en_US"))
|
||||
|
||||
console.log("isApplicationTranslatedInto:" + locale.isApplicationTranslatedInto("en_US"))
|
||||
|
||||
console.log("removeAcceleratorMarker:" + locale.removeAcceleratorMarker("&*hello"))
|
||||
|
||||
console.log("convertDigits:" + locale.convertDigits(locale.digitSet, PlasmaLocale.Locale.ArabicDigits))
|
||||
|
||||
for (var i in locale.allDigitSetsList) {
|
||||
console.log("allDigitSetsList:" + locale.allDigitSetsList[i])
|
||||
}
|
||||
|
||||
console.log("===========end===========")
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: bt2
|
||||
property variant hash
|
||||
anchors.horizontalCenter: column.horizontalCenter
|
||||
text: "click in order to test the CalendarSystem component"
|
||||
onClicked:{
|
||||
console.log("=====CalendarSystem Component====")
|
||||
|
||||
console.log("calendarLabel:" + calendar.calendarLabel)
|
||||
|
||||
console.log("epoch:" + calendar.epoch)
|
||||
|
||||
console.log("earliestValidDate:" + calendar.earliestValidDate)
|
||||
|
||||
console.log("latestValidDate:" + calendar.latestValidDate)
|
||||
|
||||
console.log("shortYearWindowStartYear:" + calendar.shortYearWindowStartYear)
|
||||
|
||||
console.log("weekStartDay:" + locale.weekStartDay)
|
||||
|
||||
console.log("isLunar:" + calendar.isLunar)
|
||||
|
||||
console.log("isLunisolar:" + calendar.isLunisolar)
|
||||
|
||||
console.log("isSolar:" + calendar.isSolar)
|
||||
|
||||
console.log("isProleptic:" + calendar.isProleptic)
|
||||
//Q_INVOKABLE methods
|
||||
|
||||
console.log("isValidIsoWeekDate:" + calendar.isValidIsoWeekDate(2012, 2, 3))
|
||||
|
||||
console.log("isValid:" + calendar.isValid("2012-02-03"))
|
||||
|
||||
console.log("year:" + calendar.year("2012-02-03"))
|
||||
|
||||
console.log("month:" + calendar.month("2012-02-03"))
|
||||
|
||||
console.log("day:" + calendar.day("2012-02-03"))
|
||||
|
||||
console.log("eraName:" + calendar.eraName("2012-02-03"))
|
||||
|
||||
console.log("eraYear:" + calendar.eraYear("2012-02-03"))
|
||||
|
||||
console.log("yearInEra:" + calendar.yearInEra("2012-02-03"))
|
||||
|
||||
console.log("addYears:" + calendar.addYears("2012-02-03", 3))
|
||||
|
||||
console.log("addMonthss:" + calendar.addMonths("2012-02-03", 3))
|
||||
|
||||
console.log("addDays:" + calendar.addDays("2012-02-03", 3))
|
||||
|
||||
console.log("yearsDifference:" + calendar.yearsDifference("2010-02-03", "2012-02-03"))
|
||||
|
||||
console.log("monthsDifference:" + calendar.monthsDifference("2012-02-03", "2012-04-03"))
|
||||
|
||||
console.log("daysDifference:" + calendar.daysDifference("2012-02-03", "2012-02-13"))
|
||||
|
||||
console.log("monthsInYear:" + calendar.monthsInYear(2012))
|
||||
|
||||
console.log("weeksInYear:" + calendar.weeksInYear(2012, PlasmaLocale.CalendarSystem.SimpleWeek))
|
||||
|
||||
console.log("daysInYear:" + calendar.daysInYear("2012-02-03"))
|
||||
|
||||
console.log("daysInMonth:" + calendar.daysInMonth(2012, 8))
|
||||
|
||||
console.log("daysInWeek:" + calendar.daysInWeek("2012-02-03"))
|
||||
|
||||
console.log("dayOfYear:" + calendar.dayOfYear("2012-02-03"))
|
||||
|
||||
console.log("week:" + calendar.week("2012-02-03", PlasmaLocale.CalendarSystem.SimpleWeek))
|
||||
|
||||
console.log("isLeapYear:" + calendar.isLeapYear(2012))
|
||||
|
||||
console.log("firstDayOfYear:" + calendar.firstDayOfYear(2012))
|
||||
|
||||
console.log("lastDayOfYear:" + calendar.lastDayOfYear(2012))
|
||||
|
||||
console.log("firstDayOfMonth:" + calendar.firstDayOfMonth(2012, 02))
|
||||
|
||||
console.log("lastDayOfMonth:" + calendar.lastDayOfMonth(2012, 02))
|
||||
|
||||
console.log("monthName:" + calendar.monthName(02, 2012))
|
||||
|
||||
console.log("weekDayName:" + calendar.weekDayName(3))
|
||||
|
||||
console.log("formatDate:" + calendar.formatDate("2012-02-03", PlasmaLocale.CalendarSystem.Year, PlasmaLocale.CalendarSystem.ShortNumber, PlasmaLocale.CalendarSystem.SimpleWeek))
|
||||
|
||||
console.log("readDate:" + calendar.readDate("2012-02-03", PlasmaLocale.CalendarSystem.IsoFormat))
|
||||
|
||||
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) {
|
||||
console.log(" " + i, "=", hash[i])
|
||||
}
|
||||
|
||||
console.log("dateDifference:")
|
||||
hash = calendar.dateDifference("2012-01-01", "2014-03-03")
|
||||
for (var i in hash) {
|
||||
console.log(" " + i, "=", hash[i])
|
||||
}
|
||||
|
||||
for (var i in calendar.calendarSystemsList) {
|
||||
console.log("calendarSystemsList:" + calendar.calendarSystemsList[i])
|
||||
}
|
||||
|
||||
console.log("===============end===============")
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaLocale.Locale {
|
||||
id: locale
|
||||
|
||||
binaryUnitDialect: PlasmaLocale.Locale.DefaultBinaryUnits
|
||||
onBinaryUnitDialectChanged: {
|
||||
console.log("the binaryUnitDialect property has been changed")
|
||||
}
|
||||
|
||||
calendarSystem: PlasmaLocale.Locale.QDateCalendar
|
||||
onCalendarSystemChanged: {
|
||||
console.log("the calendarSystem property has been changed")
|
||||
}
|
||||
|
||||
onCurrencyCodeChanged: {
|
||||
console.log("the currencyCode property has been changed")
|
||||
}
|
||||
|
||||
currencySymbol: "$"
|
||||
onCurrencySymbolChanged: {
|
||||
console.log("the currencySymbol property has been changed")
|
||||
}
|
||||
|
||||
countryDivisionCode: "AD"
|
||||
onCountryDivisionCodeChanged: {
|
||||
console.log("the countryDivisionCode property has been changed")
|
||||
}
|
||||
|
||||
dateFormat: "y"
|
||||
onDateFormatChanged: {
|
||||
console.log("the dateFormat property has been changed")
|
||||
}
|
||||
|
||||
dateFormatShort: "y"
|
||||
onDateFormatShortChanged: {
|
||||
console.log("the dateFormatShort property has been changed")
|
||||
}
|
||||
|
||||
dateMonthNamePossessive: true
|
||||
onDateMonthNamePossessiveChanged: {
|
||||
console.log("the dateMonthNamePossessive property has been changed")
|
||||
}
|
||||
|
||||
dateTimeDigitSet: PlasmaLocale.Locale.ArabicDigits
|
||||
onDateTimeDigitSetChanged: {
|
||||
console.log("the dateTimeDigitSet property has been changed")
|
||||
}
|
||||
|
||||
decimalPlaces: 1
|
||||
onDecimalPlacesChanged: {
|
||||
console.log("the decimalPlaces property has been changed")
|
||||
}
|
||||
|
||||
decimalSymbol: ","
|
||||
onDecimalSymbolChanged: {
|
||||
console.log("the decimalSymbol property has been changed")
|
||||
}
|
||||
|
||||
digitSet: PlasmaLocale.Locale.ArabicDigits
|
||||
onDigitSetChanged: {
|
||||
console.log("the digitSet property has been changed")
|
||||
}
|
||||
|
||||
measureSystem: PlasmaLocale.Locale.Metric
|
||||
onMeasureSystemChanged: {
|
||||
console.log("the measureSystem property has been changed")
|
||||
}
|
||||
|
||||
monetaryDecimalPlaces: 2
|
||||
onMonetaryDecimalPlacesChanged: {
|
||||
console.log("the monetaryDecimalPlaces property has been changed")
|
||||
}
|
||||
|
||||
monetaryDecimalSymbol: ","
|
||||
onMonetaryDecimalSymbolChanged: {
|
||||
console.log("the monetaryDecimalSymbol property has been changed")
|
||||
}
|
||||
|
||||
monetaryDigitSet: PlasmaLocale.Locale.ArabicDigits
|
||||
onMonetaryDigitSetChanged: {
|
||||
console.log("the monetaryDigitSet property has been changed")
|
||||
}
|
||||
|
||||
monetaryThousandsSeparator: ","
|
||||
onMonetaryThousandsSeparatorChanged: {
|
||||
console.log("the monetaryThousandsSeparator property has been changed")
|
||||
}
|
||||
|
||||
negativeMonetarySignPosition: PlasmaLocale.Locale.ParensAround
|
||||
onNegativeMonetarySignPositionChanged: {
|
||||
console.log("the negativeMonetarySignPosition property has been changed")
|
||||
}
|
||||
|
||||
negativePrefixCurrencySymbol: true
|
||||
onNegativePrefixCurrencySymbolChanged: {
|
||||
console.log("the negativePrefixCurrencySymbol property has been changed")
|
||||
}
|
||||
|
||||
negativeSign: "-----"
|
||||
onNegativeSignChanged: {
|
||||
console.log("the negativeSign property has been changed")
|
||||
}
|
||||
|
||||
pageSize: 5
|
||||
onPageSizeChanged: {
|
||||
console.log("the pageSign property has been changed")
|
||||
}
|
||||
|
||||
positiveMonetarySignPosition: PlasmaLocale.Locale.ParensAround
|
||||
onPositiveMonetarySignPositionChanged: {
|
||||
console.log("the positiveMonetarySignPosition property has been changed")
|
||||
}
|
||||
|
||||
positivePrefixCurrencySymbol: true
|
||||
onPositivePrefixCurrencySymbolChanged: {
|
||||
console.log("the positivePrefixCurrencySymbol property has been changed")
|
||||
}
|
||||
|
||||
positiveSign: " "
|
||||
onPositiveSignChanged: {
|
||||
console.log("the positiveSign property has been changed")
|
||||
}
|
||||
|
||||
thousandsSeparator: ","
|
||||
onThousandsSeparatorChanged: {
|
||||
console.log("the thousandsSeparator property has been changed")
|
||||
}
|
||||
|
||||
weekDayOfPray: 20
|
||||
onWeekDayOfPrayChanged: {
|
||||
console.log("the weekDayOfPray property has been changed")
|
||||
}
|
||||
|
||||
weekNumberSystem: PlasmaLocale.Locale.IsoWeekNumber
|
||||
onWeekNumberSystemChanged: {
|
||||
console.log("the weekNumberSystem property has been changed")
|
||||
}
|
||||
|
||||
weekStartDay: 2
|
||||
onWeekStartDayChanged: {
|
||||
console.log("the weekStartDay property has been changed")
|
||||
}
|
||||
|
||||
workingWeekEndDay: 5
|
||||
onWorkingWeekEndDayChanged: {
|
||||
console.log("the workingWeekEndDay property has been changed")
|
||||
}
|
||||
|
||||
workingWeekStartDay: 1
|
||||
onWorkingWeekStartDayChanged: {
|
||||
console.log("the workingWeekStartDay property has been changed")
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaLocale.CalendarSystem {
|
||||
id: calendar
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Locale gallery
|
||||
Name[de]=Lokale Galerie
|
||||
Name[es]=Galería de locales
|
||||
Name[nl]=Lokale galerij
|
||||
Name[pt]=Galeria regional
|
||||
Name[pt_BR]=Galeria regional
|
||||
Name[sk]=Galéria národných nastavení
|
||||
Name[sv]=Locale-galleri
|
||||
Name[uk]=Галерея локалей
|
||||
Name[x-test]=xxLocale galleryxx
|
||||
Comment=gallery of KLocale QML Bindings
|
||||
Comment[de]=Galerie von KLocale-Bindungen für QML
|
||||
Comment[nl]=galerij van KLocale QML-bindingen
|
||||
Comment[pt]=Galeria de Interfaces em QML do KLocale
|
||||
Comment[pt_BR]=Galeria de interfaces em QML do KLocale
|
||||
Comment[sk]=Galéria väzieb QML Klocale
|
||||
Comment[sv]=galleri av QML-bindningar för KLocale
|
||||
Comment[uk]=Галерея прив’язок QML для KLocale
|
||||
Comment[x-test]=xxgallery of KLocale QML Bindingsxx
|
||||
Type=Service
|
||||
ServiceTypes=Plasma/Applet
|
||||
Icon=preferences-desktop-theme
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-KDE-PluginInfo-Author=Giorgos Tsiapaliwkas
|
||||
X-KDE-PluginInfo-Email=terietor@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.example.locale
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
||||
X-KDE-PluginInfo-Category=Examples
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -44,10 +44,6 @@ Item {
|
||||
id: tx
|
||||
text: "Test Dialog"
|
||||
}
|
||||
LocaleItem {
|
||||
id: localeItem
|
||||
anchors { left: parent.left; right: parent.right; top: tx.bottom; }
|
||||
}
|
||||
PlasmaComponents.TextArea {
|
||||
anchors { left: parent.left; right: parent.right; top: localeItem.bottom; }
|
||||
width: parent.width
|
||||
|
@ -1,24 +0,0 @@
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.locale 2.0
|
||||
|
||||
|
||||
Item {
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
|
||||
Locale {
|
||||
id: locale
|
||||
}
|
||||
Column {
|
||||
PlasmaComponents.Label {
|
||||
text: "Locale Time Bindings"
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: locale.formatLocaleTime( "11:12:13", Locale.TimeWithoutAmPm|Locale.TimeWithoutSeconds )
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
text: locale.formatDateTime("2013-04-12", Locale.ShortDate ,Locale.Seconds )
|
||||
}
|
||||
}
|
||||
}
|
@ -6,5 +6,4 @@ add_subdirectory(qtextracomponents)
|
||||
add_subdirectory(plasmacomponents)
|
||||
add_subdirectory(plasmaextracomponents)
|
||||
add_subdirectory(platformcomponents)
|
||||
add_subdirectory(locale)
|
||||
add_subdirectory(calendar)
|
||||
|
@ -1,20 +0,0 @@
|
||||
project(localebindings)
|
||||
|
||||
set(localebindings_SRCS
|
||||
locale.cpp
|
||||
localebindingsplugin.cpp
|
||||
calendarsystem.cpp
|
||||
)
|
||||
|
||||
find_package(KDE4Support REQUIRED)
|
||||
|
||||
add_library(localebindingsplugin SHARED ${localebindings_SRCS})
|
||||
target_link_libraries(localebindingsplugin
|
||||
Qt5::Core
|
||||
Qt5::Quick
|
||||
Qt5::Qml
|
||||
KF5::KDE4Support
|
||||
KF5::KI18n
|
||||
)
|
||||
install(TARGETS localebindingsplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/locale)
|
||||
install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/locale)
|
@ -1,302 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
|
||||
Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
|
||||
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.
|
||||
*/
|
||||
|
||||
//own
|
||||
#include "calendarsystem.h"
|
||||
|
||||
//KDE
|
||||
#include <kcalendarsystem.h>
|
||||
#include <kglobal.h>
|
||||
|
||||
//Qt
|
||||
#include <QtCore/QDateTime>
|
||||
|
||||
CalendarSystem::CalendarSystem(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_calendarSystem = KCalendarSystem::create(KLocale::global()->calendarSystem());
|
||||
}
|
||||
|
||||
QList<int> CalendarSystem::calendarSystemsList()
|
||||
{
|
||||
QList<int> list;
|
||||
|
||||
foreach(KLocale::CalendarSystem calendarSystem, KCalendarSystem::calendarSystemsList()) {
|
||||
list.append((int)calendarSystem);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Locale::CalendarSystem CalendarSystem::calendarSystem() const
|
||||
{
|
||||
return (Locale::CalendarSystem)m_calendarSystem->calendarSystem();
|
||||
}
|
||||
|
||||
|
||||
QString CalendarSystem::calendarLabel() const
|
||||
{
|
||||
return m_calendarSystem->calendarLabel();
|
||||
}
|
||||
|
||||
QDate CalendarSystem::epoch() const
|
||||
{
|
||||
return m_calendarSystem->epoch();
|
||||
}
|
||||
|
||||
QDate CalendarSystem::earliestValidDate() const
|
||||
{
|
||||
return epoch();
|
||||
}
|
||||
|
||||
QDate CalendarSystem::latestValidDate() const
|
||||
{
|
||||
return m_calendarSystem->latestValidDate();
|
||||
}
|
||||
|
||||
bool CalendarSystem::isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfIsoWeek) const
|
||||
{
|
||||
return m_calendarSystem->isValidIsoWeekDate(year, isoWeekNumber, dayOfIsoWeek);
|
||||
}
|
||||
|
||||
bool CalendarSystem::isValid(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->isValid(date);
|
||||
}
|
||||
|
||||
QVariantMap CalendarSystem::getDate(const QDate date) const
|
||||
{
|
||||
QVariantMap hash;
|
||||
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
|
||||
m_calendarSystem->getDate(date, &year, &month, &day);
|
||||
|
||||
hash["year"] = year;
|
||||
hash["month"] = month;
|
||||
hash["day"] = day;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
int CalendarSystem::year(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->year(date);
|
||||
}
|
||||
|
||||
int CalendarSystem::month(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->month(date);
|
||||
}
|
||||
|
||||
int CalendarSystem::day(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->day(date);
|
||||
}
|
||||
|
||||
QString CalendarSystem::eraName(const QDate &date, StringFormat format) const
|
||||
{
|
||||
return m_calendarSystem->eraName(date, (KCalendarSystem::StringFormat)format);
|
||||
}
|
||||
|
||||
QString CalendarSystem::eraYear(const QDate &date, StringFormat format) const
|
||||
{
|
||||
return m_calendarSystem->eraYear(date, (KCalendarSystem::StringFormat)format);
|
||||
}
|
||||
|
||||
|
||||
int CalendarSystem::yearInEra(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->yearInEra(date);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::addYears(const QDate &date, int numYears) const
|
||||
{
|
||||
return m_calendarSystem->addYears(date, numYears);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::addMonths(const QDate &date, int numMonths) const
|
||||
{
|
||||
return m_calendarSystem->addMonths(date, numMonths);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::addDays(const QDate &date, int numDays) const
|
||||
{
|
||||
return m_calendarSystem->addDays(date, numDays);
|
||||
}
|
||||
|
||||
QVariantMap CalendarSystem::dateDifference(const QDate &fromDate, const QDate &toDate) const
|
||||
{
|
||||
QVariantMap hash;
|
||||
|
||||
int yearsDiff;
|
||||
int monthsDiff;
|
||||
int daysDiff;
|
||||
int direction;
|
||||
|
||||
m_calendarSystem->dateDifference(fromDate, toDate, &yearsDiff, &monthsDiff, &daysDiff, &direction);
|
||||
|
||||
hash["years"] = yearsDiff;
|
||||
hash["months"] = monthsDiff;
|
||||
hash["days"] = daysDiff;
|
||||
hash["direction"] = direction;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
int CalendarSystem::yearsDifference(const QDate &fromDate, const QDate &toDate) const
|
||||
{
|
||||
return m_calendarSystem->yearsDifference(fromDate, toDate);
|
||||
}
|
||||
|
||||
int CalendarSystem::monthsDifference(const QDate &fromDate, const QDate &toDate) const
|
||||
{
|
||||
return m_calendarSystem->monthsDifference(fromDate, toDate);
|
||||
}
|
||||
|
||||
int CalendarSystem::daysDifference(const QDate &fromDate, const QDate &toDate) const
|
||||
{
|
||||
return m_calendarSystem->daysDifference(fromDate, toDate);
|
||||
}
|
||||
|
||||
int CalendarSystem::monthsInYear(int year) const
|
||||
{
|
||||
return m_calendarSystem->monthsInYear(year);
|
||||
}
|
||||
|
||||
int CalendarSystem::weeksInYear(int year, WeekNumberSystem weekNumberSystem) const
|
||||
{
|
||||
return m_calendarSystem->weeksInYear(year, (KLocale::WeekNumberSystem)weekNumberSystem);
|
||||
}
|
||||
|
||||
int CalendarSystem::daysInYear(int year) const
|
||||
{
|
||||
return m_calendarSystem->daysInYear(year);
|
||||
}
|
||||
|
||||
int CalendarSystem::daysInMonth(int year, int month) const
|
||||
{
|
||||
return m_calendarSystem->daysInMonth(year, month);
|
||||
}
|
||||
|
||||
int CalendarSystem::daysInWeek(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->daysInWeek(date);
|
||||
}
|
||||
|
||||
int CalendarSystem::dayOfYear(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->dayOfYear(date);
|
||||
}
|
||||
|
||||
int CalendarSystem::dayOfWeek(const QDate &date) const
|
||||
{
|
||||
return m_calendarSystem->dayOfWeek(date);
|
||||
}
|
||||
|
||||
int CalendarSystem::week(const QDate &date, WeekNumberSystem weekNumberSystem) const
|
||||
{
|
||||
return m_calendarSystem->week(date, (KLocale::WeekNumberSystem)weekNumberSystem);
|
||||
}
|
||||
|
||||
bool CalendarSystem::isLeapYear(int year) const
|
||||
{
|
||||
return m_calendarSystem->isLeapYear(year);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::firstDayOfYear(int year) const
|
||||
{
|
||||
return m_calendarSystem->firstDayOfYear(year);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::lastDayOfYear(int year) const
|
||||
{
|
||||
return m_calendarSystem->lastDayOfYear(year);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::firstDayOfMonth(int year, int month) const
|
||||
{
|
||||
return m_calendarSystem->firstDayOfMonth(year, month);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::lastDayOfMonth(int year, int month) const
|
||||
{
|
||||
return m_calendarSystem->lastDayOfMonth(year, month);
|
||||
}
|
||||
|
||||
QString CalendarSystem::monthName(int month, int year, CalendarSystem::MonthNameFormat format) const
|
||||
{
|
||||
return m_calendarSystem->monthName(month, year, (KCalendarSystem::MonthNameFormat)format);
|
||||
}
|
||||
|
||||
QString CalendarSystem::weekDayName(int weekDay, CalendarSystem::WeekDayNameFormat format) const
|
||||
{
|
||||
return m_calendarSystem->weekDayName(weekDay, (KCalendarSystem::WeekDayNameFormat)format);
|
||||
}
|
||||
|
||||
QString CalendarSystem::formatDate(const QDate &date, DateTimeComponent component,
|
||||
DateTimeComponentFormat format,
|
||||
WeekNumberSystem weekNumberSystem) const
|
||||
{
|
||||
return m_calendarSystem->formatDate(date, (KLocale::DateTimeComponent)component,
|
||||
(KLocale::DateTimeComponentFormat)format,
|
||||
(KLocale::WeekNumberSystem)weekNumberSystem);
|
||||
}
|
||||
|
||||
QDate CalendarSystem::readDate(const QString &str, ReadDateFlags flags) const
|
||||
{
|
||||
return m_calendarSystem->readDate(str, (KLocale::ReadDateFlags)flags);
|
||||
}
|
||||
|
||||
int CalendarSystem::shortYearWindowStartYear() const
|
||||
{
|
||||
return m_calendarSystem->shortYearWindowStartYear();
|
||||
}
|
||||
|
||||
int CalendarSystem::applyShortYearWindow(int inputYear) const
|
||||
{
|
||||
return m_calendarSystem->applyShortYearWindow(inputYear);
|
||||
}
|
||||
|
||||
int CalendarSystem::weekStartDay() const
|
||||
{
|
||||
return m_calendarSystem->weekStartDay();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
@ -1,697 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
|
||||
Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
|
||||
|
||||
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 CALENDARSYSTEM_H
|
||||
#define CALENDARSYSTEM_H
|
||||
|
||||
//own
|
||||
#include "locale_p.h" // needed for enums
|
||||
|
||||
//Qt
|
||||
#include <QtCore/QDate>
|
||||
|
||||
class KCalendarSystem;
|
||||
|
||||
class CalendarSystem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//enums
|
||||
Q_ENUMS(StringFormat)
|
||||
Q_ENUMS(MonthNameFormat)
|
||||
Q_ENUMS(WeekDayNameFormat)
|
||||
Q_ENUMS(WeekNumberSystem)
|
||||
Q_ENUMS(ReadDateFlags)
|
||||
Q_ENUMS(DateTimeComponent)
|
||||
Q_ENUMS(DateTimeComponentFormat)
|
||||
|
||||
//properties
|
||||
Q_PROPERTY(QList<int> calendarSystemsList READ calendarSystemsList CONSTANT) //read-only
|
||||
Q_PROPERTY(Locale::CalendarSystem calendarSystem READ calendarSystem CONSTANT)//read-only
|
||||
Q_PROPERTY(QString calendarLabel READ calendarLabel CONSTANT)//read-only
|
||||
Q_PROPERTY(QDate epoch READ epoch CONSTANT)//read-only
|
||||
Q_PROPERTY(QDate earliestValidDate READ earliestValidDate CONSTANT)//read-only
|
||||
Q_PROPERTY(QDate latestValidDate READ latestValidDate CONSTANT)//read-only
|
||||
Q_PROPERTY(int shortYearWindowStartYear READ shortYearWindowStartYear CONSTANT)
|
||||
Q_PROPERTY(int weekStartDay READ weekStartDay CONSTANT)//read-only
|
||||
Q_PROPERTY(bool isLunar READ isLunar CONSTANT)//read-only
|
||||
Q_PROPERTY(bool isLunisolar READ isLunisolar CONSTANT)//read-only
|
||||
Q_PROPERTY(bool isSolar READ isSolar CONSTANT)//read-only
|
||||
Q_PROPERTY(bool isProleptic READ isProleptic CONSTANT)//read-only
|
||||
|
||||
public:
|
||||
|
||||
//ctor
|
||||
CalendarSystem(QObject *parent = 0);
|
||||
|
||||
//the above are enums which I borrow from the Locale class
|
||||
/**
|
||||
*
|
||||
* System used for Week Numbers
|
||||
*/
|
||||
enum WeekNumberSystem {
|
||||
DefaultWeekNumber = 1000, /**< The system locale default */
|
||||
IsoWeekNumber = 0, /**< ISO Week Number */
|
||||
FirstFullWeek = 1, /**< Week 1 starts on the first Week Start Day in year ends after 7 days */
|
||||
FirstPartialWeek = 2, /**< Week 1 starts Jan 1st ends day before first Week Start Day in year */
|
||||
SimpleWeek = 3 /**< Week 1 starts Jan 1st ends after 7 days */
|
||||
};
|
||||
|
||||
enum ReadDateFlags {
|
||||
NormalFormat = 1, /**< Only accept a date string in
|
||||
the locale LongDate format */
|
||||
shortFormat = 2, /**< Only accept a date string in
|
||||
the locale ShortDate format */
|
||||
IsoFormat = 4, /**< Only accept a date string in
|
||||
ISO date format (YYYY-MM-DD) */
|
||||
IsoWeekFormat = 8, /**< Only accept a date string in
|
||||
ISO Week date format (YYYY-Www-D) */
|
||||
IsoOrdinalFormat = 16 /**< Only accept a date string in
|
||||
ISO Week date format (YYYY-DDD) */
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
enum DateTimeComponent {
|
||||
Year = 0x1, /**< The Year portion of a date, may be number or name */
|
||||
YearName = 0x2, /**< The Year Name portion of a date */
|
||||
Month = 0x4, /**< The Month portion of a date, may be number or name */
|
||||
MonthName = 0x8, /**< The Month Name portion of a date */
|
||||
Day = 0x10, /**< The Day portion of a date, may be number or name */
|
||||
DayName = 0x20, /**< The Day Name portion of a date */
|
||||
JulianDay = 0x40, /**< The Julian Day of a date */
|
||||
EraName = 0x80, /**< The Era Name portion of a date */
|
||||
EraYear = 0x100, /**< The Era and Year portion of a date */
|
||||
YearInEra = 0x200, /**< The Year In Era portion of a date */
|
||||
DayOfYear = 0x400, /**< The Day Of Year portion of a date, may be number or name */
|
||||
DayOfYearName = 0x800, /**< The Day Of Year Name portion of a date */
|
||||
DayOfWeek = 0x1000, /**< The Day Of Week / Weekday portion of a date, may be number or name */
|
||||
DayOfWeekName = 0x2000, /**< The Day Of Week Name / Weekday Name portion of a date */
|
||||
Week = 0x4000, /**< The Week Number portion of a date */
|
||||
WeekYear = 0x8000, /**< The Week Year portion of a date */
|
||||
MonthsInYear = 0x10000, /**< The Months In Year portion of a date */
|
||||
WeeksInYear = 0x20000, /**< The Weeks In Year portion of a date */
|
||||
DaysInYear = 0x40000, /**< The Days In Year portion of a date */
|
||||
DaysInMonth = 0x80000, /**< The Days In Month portion of a date */
|
||||
DaysInWeek = 0x100000, /**< The Days In Week portion of a date */
|
||||
Hour = 0x200000, /**< The Hours portion of a date */
|
||||
Minute = 0x400000, /**< The Minutes portion of a date */
|
||||
Second = 0x800000, /**< The Seconds portion of a date */
|
||||
Millisecond = 0x1000000, /**< The Milliseconds portion of a date */
|
||||
DayPeriod = 0x2000000, /**< The Day Period portion of a date, e.g. AM/PM */
|
||||
DayPeriodHour = 0x4000000, /**< The Day Period Hour portion of a date */
|
||||
Timezone = 0x8000000, /**< The Time Zone portion of a date, may be offset or name */
|
||||
TimezoneName = 0x10000000, /**< The Time Zone Name portion of a date */
|
||||
UnixTime = 0x20000000 /**< The UNIX Time portion of a date */
|
||||
};
|
||||
|
||||
enum DateTimeComponentFormat {
|
||||
DefaultComponentFormat = 1000, /**< The system locale default for the componant */
|
||||
ShortNumber = 0, /**< Number at its natural width, e.g. 2 for the 2nd*/
|
||||
LongNumber, /**< Number padded to a required width, e.g. 02 for the 2nd*/
|
||||
narrowName = 3, /**< Narrow text format, may not be unique, e.g. M for Monday */
|
||||
shortName, /**< Short text format, e.g. Mon for Monday */
|
||||
longName /**< Long text format, e.g. Monday for Monday */
|
||||
};
|
||||
//end of the borrowing enums
|
||||
|
||||
/**
|
||||
* 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" */
|
||||
};
|
||||
|
||||
/**
|
||||
* 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" */
|
||||
};
|
||||
|
||||
/**
|
||||
* 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" */
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the list of currently supported Calendar Systems
|
||||
* @return list of Calendar Systems
|
||||
*/
|
||||
QList<int> calendarSystemsList();
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the Calendar System type of the CalendarSystem object
|
||||
*
|
||||
* @return type of calendar system
|
||||
*/
|
||||
Locale::CalendarSystem calendarSystem() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a localized label to display for the current Calendar System type.
|
||||
*
|
||||
* @return localized label for this Calendar System
|
||||
*/
|
||||
QString calendarLabel() const; //TODO, it returns undefined
|
||||
|
||||
/**
|
||||
* Returns a QDate holding the epoch of the calendar system. Usually YMD
|
||||
* of 1/1/1, access the returned QDates method toJulianDay() if you
|
||||
* require the actual Julian day number. Note: a particular calendar
|
||||
* system implementation may not include the epoch in its supported range,
|
||||
* or the calendar system may be proleptic in which case it supports dates
|
||||
* before the epoch.
|
||||
*
|
||||
* @see CalendarSystem::earliestValidDate
|
||||
* @see CalendarSystem::latestValidDate
|
||||
* @see CalendarSystem::isProleptic
|
||||
* @see CalendarSystem::isValid
|
||||
*
|
||||
* @return epoch of calendar system
|
||||
*/
|
||||
QDate epoch() const;
|
||||
|
||||
/**
|
||||
* Returns the earliest date valid in this calendar system implementation.
|
||||
*
|
||||
* If the calendar system is proleptic then this may be before epoch.
|
||||
*
|
||||
* @see CalendarSystem::epoch
|
||||
* @see CalendarSystem::latestValidDate
|
||||
*
|
||||
* @return date the earliest valid date
|
||||
*/
|
||||
QDate earliestValidDate() const;
|
||||
|
||||
/**
|
||||
* Returns the latest date valid in this calendar system implementation.
|
||||
*
|
||||
* @see CalendarSystem::epoch
|
||||
* @see CalendarSystem::earliestValidDate
|
||||
*
|
||||
* @return date the latest valid date
|
||||
*/
|
||||
QDate latestValidDate() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns whether a given date is valid in this calendar system.
|
||||
*
|
||||
* @param year the year portion of the date to check
|
||||
* @param isoWeekNumber the ISO week portion of the date to check
|
||||
* @param dayOfIsoWeek the day of week portion of the date to check
|
||||
* @return @c true if the date is valid, @c false otherwise
|
||||
*/
|
||||
Q_INVOKABLE bool isValidIsoWeekDate(int year, int isoWeekNumber, int dayOfIsoWeek) const;
|
||||
|
||||
/**
|
||||
* Returns whether a given date is valid in this calendar system.
|
||||
*
|
||||
* @param date the date to check
|
||||
* @return @c true if the date is valid, @c false otherwise
|
||||
*/
|
||||
Q_INVOKABLE bool isValid(const QDate &date) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the year, month and day portion of a given date in the current calendar system
|
||||
* The values are returned in a hash, the available keys are,
|
||||
* ["year"] the year of the date
|
||||
* ["month"] the month of the date
|
||||
* ["day"] the day of the date
|
||||
* @param date date to get year, month and day for
|
||||
*/
|
||||
Q_INVOKABLE QVariantMap getDate(const QDate date) const;
|
||||
|
||||
/**
|
||||
* Returns the year portion of a given date in the current calendar system
|
||||
*
|
||||
* @param date date to return year for
|
||||
* @return year, 0 if input date is invalid
|
||||
*/
|
||||
Q_INVOKABLE int year(const QDate &date) const;
|
||||
|
||||
/**
|
||||
* Returns the month portion of a given date in the current calendar system
|
||||
*
|
||||
* @param date date to return month for
|
||||
* @return month of year, 0 if input date is invalid
|
||||
*/
|
||||
Q_INVOKABLE int month(const QDate &date) const;
|
||||
|
||||
/**
|
||||
* Returns the day portion of a given date in the current calendar system
|
||||
*
|
||||
* @param date date to return day for
|
||||
* @return day of the month, 0 if input date is invalid
|
||||
*/
|
||||
Q_INVOKABLE int day(const QDate &date) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the Era Name portion of a given date in the current calendar system,
|
||||
* for example "AD" or "Anno Domini" for the Gregorian calendar and Christian Era.
|
||||
*
|
||||
* @param date date to return Era Name for
|
||||
* @param format format to return, either short or long
|
||||
* @return era name, empty string if input date is invalid
|
||||
*/
|
||||
Q_INVOKABLE QString eraName(const QDate &date, StringFormat format = ShortFormat) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the Era Year portion of a given date in the current
|
||||
* calendar system, for example "2000 AD" or "Heisei 22".
|
||||
*
|
||||
* @param date date to return Era Year for
|
||||
* @param format format to return, either short or long
|
||||
* @return era name, empty string if input date is invalid
|
||||
*/
|
||||
Q_INVOKABLE QString eraYear(const QDate &date, StringFormat format = ShortFormat) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the Year In Era portion of a given date in the current calendar
|
||||
* system, for example 1 for "1 BC".
|
||||
*
|
||||
* @param date date to return Year In Era for
|
||||
* @return Year In Era, -1 if input date is invalid
|
||||
*/
|
||||
Q_INVOKABLE int yearInEra(const QDate &date) const;
|
||||
|
||||
/**
|
||||
* Returns a QDate containing a date @p nyears years later.
|
||||
*
|
||||
* @param date The old date
|
||||
* @param nyears The number of years to add
|
||||
* @return The new date, null date if any errors
|
||||
*/
|
||||
Q_INVOKABLE QDate addYears(const QDate &date, int nyears) const;
|
||||
|
||||
/**
|
||||
* Returns a QDate containing a date @p nmonths months later.
|
||||
*
|
||||
* @param date The old date
|
||||
* @param nmonths number of months to add
|
||||
* @return The new date, null date if any errors
|
||||
*/
|
||||
Q_INVOKABLE QDate addMonths(const QDate &date, int nmonths) const;
|
||||
|
||||
/**
|
||||
* Returns a QDate containing a date @p ndays days later.
|
||||
*
|
||||
* @param date The old date
|
||||
* @param ndays number of days to add
|
||||
* @return The new date, null date if any errors
|
||||
*/
|
||||
Q_INVOKABLE QDate addDays(const QDate &date, int ndays) const;
|
||||
|
||||
/**
|
||||
* Returns the difference between two dates with a hash, the available keys are
|
||||
* ["years"] Returns number of years difference
|
||||
* ["months"] Returns number of months difference
|
||||
* ["days"] Returns number of days difference
|
||||
* ["direction"] Returns direction of difference, 1 if fromDate <= toDate, -1 otherwise
|
||||
* The difference is always caculated from the earlier date to the later
|
||||
* date in year, month and day order, with the @p direction parameter
|
||||
* indicating which direction the difference is applied from the @p toDate.
|
||||
*
|
||||
* For example, the difference between 2010-06-10 and 2012-09-5 is 2 years,
|
||||
* 2 months and 26 days. Note that the difference between two last days of
|
||||
* the month is always 1 month, e.g. 2010-01-31 to 2010-02-28 is 1 month
|
||||
* not 28 days.
|
||||
*
|
||||
* @param fromDate The date to start from
|
||||
* @param toDate The date to end at
|
||||
*/
|
||||
Q_INVOKABLE QVariantMap dateDifference(const QDate &fromDate, const QDate &toDate)const;
|
||||
|
||||
/**
|
||||
* Returns the difference between two dates in completed calendar years.
|
||||
* The returned value will be negative if @p fromDate > @p toDate.
|
||||
*
|
||||
* For example, the difference between 2010-06-10 and 2012-09-5 is 2 years.
|
||||
*
|
||||
* @param fromDate The date to start from
|
||||
* @param toDate The date to end at
|
||||
* @return The number of years difference
|
||||
*/
|
||||
Q_INVOKABLE int yearsDifference(const QDate &fromDate, const QDate &toDate) const;
|
||||
|
||||
/**
|
||||
* Returns the difference between two dates in completed calendar months
|
||||
* The returned value will be negative if @p fromDate > @p toDate.
|
||||
*
|
||||
* For example, the difference between 2010-06-10 and 2012-09-5 is 26 months.
|
||||
* Note that the difference between two last days of the month is always 1
|
||||
* month, e.g. 2010-01-31 to 2010-02-28 is 1 month not 28 days.
|
||||
*
|
||||
* @param fromDate The date to start from
|
||||
* @param toDate The date to end at
|
||||
* @return The number of months difference
|
||||
*/
|
||||
Q_INVOKABLE int monthsDifference(const QDate &fromDate, const QDate &toDate) const;
|
||||
|
||||
/**
|
||||
* Returns the difference between two dates in days
|
||||
* The returned value will be negative if @p fromDate > @p toDate.
|
||||
*
|
||||
* @param fromDate The date to start from
|
||||
* @param toDate The date to end at
|
||||
* @return The number of days difference
|
||||
*/
|
||||
Q_INVOKABLE int daysDifference(const QDate &fromDate, const QDate &toDate) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns number of months in the given year
|
||||
*
|
||||
* @param year the required year
|
||||
* @return number of months in the year, -1 if input date invalid
|
||||
*/
|
||||
Q_INVOKABLE int monthsInYear(int year) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the number of Weeks in a year using the required Week Number System.
|
||||
*
|
||||
* Unless you specifically want a particular Week Number System (e.g. ISO Weeks)
|
||||
* you should use the localized number of weeks provided by weeksInYear().
|
||||
*
|
||||
* @see week()
|
||||
* @see formatDate()
|
||||
* @param year the year
|
||||
* @param weekNumberSystem the week number system to use
|
||||
* @return number of weeks in the year, -1 if date invalid
|
||||
*/
|
||||
Q_INVOKABLE int weeksInYear(int year, WeekNumberSystem weekNumberSystem) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the number of days in the given year.
|
||||
*
|
||||
* @param year the year
|
||||
* @return number of days in year, -1 if input date invalid
|
||||
*/
|
||||
Q_INVOKABLE int daysInYear(int year) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the number of days in the given month.
|
||||
*
|
||||
* @param year the year the month is in
|
||||
* @param month the month
|
||||
* @return number of days in month, -1 if input date invalid
|
||||
*/
|
||||
Q_INVOKABLE int daysInMonth(int year, int month) const;
|
||||
|
||||
/**
|
||||
* Returns the number of days in the given week.
|
||||
*
|
||||
* @param date the date to obtain week from
|
||||
* @return number of days in week, -1 if input date invalid
|
||||
*/
|
||||
Q_INVOKABLE int daysInWeek(const QDate &date) const;
|
||||
|
||||
/**
|
||||
* Returns the day number of year for the given date
|
||||
*
|
||||
* The days are numbered 1..daysInYear()
|
||||
*
|
||||
* @param date the date to obtain day from
|
||||
* @return day of year number, -1 if input date not valid
|
||||
*/
|
||||
Q_INVOKABLE int dayOfYear(const QDate &date) const;
|
||||
|
||||
/**
|
||||
* Returns the weekday number for the given date
|
||||
*
|
||||
* The weekdays are numbered 1..7 for Monday..Sunday.
|
||||
*
|
||||
* This value is @em not affected by the value of weekStartDay()
|
||||
*
|
||||
* @param date the date to obtain day from
|
||||
* @return day of week number, -1 if input date not valid
|
||||
*/
|
||||
Q_INVOKABLE int dayOfWeek(const QDate &date) const;
|
||||
|
||||
/**
|
||||
* Returns the Week Number for the date in the required Week Number System.
|
||||
*
|
||||
* Unless you want a specific Week Number System (e.g. ISO Week), you should
|
||||
* use the localized Week Number form of week().
|
||||
*
|
||||
* If the date falls in the last week of the previous year or the first
|
||||
* week of the following year, then the yearNum returned will be set to the
|
||||
* appropriate year.
|
||||
*
|
||||
* Technically, the ISO Week Number only applies to the ISO/Gregorian Calendar
|
||||
* System, but the same rules will be applied to the current Calendar System.
|
||||
*
|
||||
* @see weeksInYear()
|
||||
* @see formatDate()
|
||||
* @param date the date to obtain week from
|
||||
* @param weekNumberSystem the Week Number System to use
|
||||
* @param yearNum returns the year the date belongs to
|
||||
* @return week number, -1 if input date invalid
|
||||
*/
|
||||
Q_INVOKABLE int week(const QDate &date, WeekNumberSystem weekNumberSystem) const;
|
||||
|
||||
/**
|
||||
* Returns whether a given year is a leap year.
|
||||
*
|
||||
* Input year must be checked for validity in current Calendar System prior to calling, no
|
||||
* validity checking performed in this routine, behaviour is undefined in invalid case.
|
||||
*
|
||||
* @param year the year to check
|
||||
* @return @c true if the year is a leap year, @c false otherwise
|
||||
*/
|
||||
Q_INVOKABLE bool isLeapYear(int year) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a QDate containing the first day of the year
|
||||
*
|
||||
* @param year The year to return the date for
|
||||
* @return The first day of the year
|
||||
*/
|
||||
Q_INVOKABLE QDate firstDayOfYear(int year) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a QDate containing the last day of the year
|
||||
*
|
||||
* @param year The year to return the date for
|
||||
* @return The last day of the year
|
||||
*/
|
||||
Q_INVOKABLE QDate lastDayOfYear(int year) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a QDate containing the first day of the month
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
Q_INVOKABLE QDate firstDayOfMonth(int year, int month) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a QDate containing the last day of the month
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
Q_INVOKABLE QDate lastDayOfMonth(int year, int month) const;
|
||||
|
||||
/**
|
||||
* Gets specific calendar type month name for a given month number
|
||||
* If an invalid month is specified, QString() is returned.
|
||||
*
|
||||
* @param month the month number
|
||||
* @param year the year the month belongs to
|
||||
* @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
|
||||
*/
|
||||
Q_INVOKABLE QString monthName(int month, int year, MonthNameFormat format = LongName) const;
|
||||
|
||||
/**
|
||||
* Gets specific calendar type week day name.
|
||||
* If an invalid week day is specified, QString() is returned.
|
||||
*
|
||||
* @param weekDay number of day in week (Monday = 1, ..., Sunday = 7)
|
||||
* @param format specifies whether the short month name or long month name should be used
|
||||
* @return day name, empty string if any error
|
||||
*/
|
||||
Q_INVOKABLE QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns a Date Component as a localized string in the requested format.
|
||||
*
|
||||
* For example for 2010-01-01 the Locale::Month with en_US Locale and Gregorian calendar may return:
|
||||
* CalendarSystem::ShortNumber = "1"
|
||||
* CalendarSystem::LongNumber = "01"
|
||||
* CalendarSystem::NarrowName = "J"
|
||||
* CalendarSystem::ShortName = "Jan"
|
||||
* CalendarSystem::LongName = "January"
|
||||
*
|
||||
* @param date The date to format
|
||||
* @param component The date component to return
|
||||
* @param format The format to return the @p component in
|
||||
* @param weekNumberSystem To override the default Week Number System to use
|
||||
* @return The localized string form of the date component
|
||||
*/
|
||||
Q_INVOKABLE QString formatDate(const QDate &date, DateTimeComponent component,
|
||||
DateTimeComponentFormat format, WeekNumberSystem weekNumberSystem) const;
|
||||
|
||||
/**
|
||||
* Converts a localized date string to a QDate.
|
||||
* This method is stricter than readDate(str,&ok): it will either accept
|
||||
* a date in full format or a date in short format, depending on @p flags.
|
||||
*
|
||||
* Uses the calendar system's internal locale set when the instance was
|
||||
* created, which ensures that the correct calendar system and locale
|
||||
* settings are respected, which would not occur in some cases if using
|
||||
* the global locale. Defaults to global locale.
|
||||
*
|
||||
* @see Locale::readDate
|
||||
*
|
||||
* @param str the string to convert
|
||||
* @param flags whether the date string is to be in full format or in short format
|
||||
* @param ok if non-null, will be set to @c true if the date is valid, @c false if invalid
|
||||
*
|
||||
* @return the string converted to a QDate
|
||||
*/
|
||||
Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the Short Year Window Start Year for the current Calendar System.
|
||||
*
|
||||
* Use this function to get the Start Year for the Short Year Window to be
|
||||
* applied when 2 digit years are entered for a Short Year input format,
|
||||
* e.g. if the Short Year Window Start Year is 1930, then the input Short
|
||||
* Year value of 40 is interpreted as 1940 and the input Short Year value
|
||||
* of 10 is interpreted as 2010.
|
||||
*
|
||||
* The Short Year Window is only ever applied when reading the Short Year
|
||||
* format and not the Long Year format, i.e. Locale::ShortFormat or '%y'
|
||||
* only and not Locale::LongFormat or '%Y'.
|
||||
*
|
||||
* The Start Year 0 effectively means not to use a Short Year Window
|
||||
*
|
||||
* Each Calendar System requires a different Short Year Window as they have
|
||||
* different epochs. The Gregorian Short Year Window usually pivots around
|
||||
* the year 2000, whereas the Hebrew Short Year Window usually pivots around
|
||||
* the year 5000.
|
||||
*
|
||||
* This value must always be used when evaluating user input Short Year
|
||||
* strings.
|
||||
*
|
||||
* @see Locale::shortYearWindowStartYear
|
||||
* @see Locale::applyShortYearWindow
|
||||
* @return the short year window start year
|
||||
*/
|
||||
int shortYearWindowStartYear() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the Year Number after applying the Year Window.
|
||||
*
|
||||
* If the @p inputYear is between 0 and 99, then apply the Year Window and
|
||||
* return the calculated Year Number.
|
||||
*
|
||||
* If the @p inputYear is not between 0 and 99, then the original Year Number
|
||||
* is returned.
|
||||
*
|
||||
* @see Locale::setYearWindowOffset
|
||||
* @see Locale::yearWindowOffset
|
||||
* @param inputYear the year number to apply the year window to
|
||||
* @return the year number after applying the year window
|
||||
*/
|
||||
Q_INVOKABLE int applyShortYearWindow(int inputYear) const;
|
||||
|
||||
/**
|
||||
* Use this to determine which day is the first day of the week.
|
||||
*
|
||||
* Uses the calendar system's internal locale set when the instance was
|
||||
* created, which ensures that the correct calendar system and locale
|
||||
* settings are respected, which would not occur in some cases if using
|
||||
* the global locale. Defaults to global locale.
|
||||
*
|
||||
* @see Locale::weekStartDay
|
||||
*
|
||||
* @return an integer (Monday = 1, ..., Sunday = 7)
|
||||
*/
|
||||
int weekStartDay() const;
|
||||
|
||||
/**
|
||||
* Returns whether the calendar is lunar based.
|
||||
*
|
||||
* @return @c true if the calendar is lunar based, @c false if not
|
||||
*/
|
||||
bool isLunar() const;
|
||||
|
||||
/**
|
||||
* Returns whether the calendar is lunisolar based.
|
||||
*
|
||||
* @return @c true if the calendar is lunisolar based, @c false if not
|
||||
*/
|
||||
bool isLunisolar() const;
|
||||
|
||||
/**
|
||||
* Returns whether the calendar is solar based.
|
||||
*
|
||||
* @return @c true if the calendar is solar based, @c false if not
|
||||
*/
|
||||
bool isSolar() const;
|
||||
|
||||
/**
|
||||
* Returns whether the calendar system is proleptic, i.e. whether dates
|
||||
* before the epoch are supported.
|
||||
*
|
||||
* @see CalendarSystem::epoch
|
||||
*
|
||||
* @return @c true if the calendar system is proleptic, @c false if not
|
||||
*/
|
||||
bool isProleptic() const;
|
||||
|
||||
private:
|
||||
KCalendarSystem *m_calendarSystem;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,576 +0,0 @@
|
||||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
|
||||
Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
//own
|
||||
#include "locale_p.h"
|
||||
|
||||
//KDE
|
||||
#include <klocale.h>
|
||||
#include <klocalizedstring.h>
|
||||
|
||||
//Qt
|
||||
#include <QDebug>
|
||||
|
||||
Locale::Locale(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_locale = KLocale::global();
|
||||
}
|
||||
|
||||
bool Locale::setCountryDivisionCode(const QString &countryDivisionCode)
|
||||
{
|
||||
bool ok = m_locale->setCountryDivisionCode(countryDivisionCode);
|
||||
emit countryDivisionCodeChanged();
|
||||
return ok;
|
||||
}
|
||||
|
||||
void Locale::setCurrencyCode(const QString &newCurrencyCode)
|
||||
{
|
||||
m_locale->setCurrencyCode(newCurrencyCode);
|
||||
emit currencyCodeChanged();
|
||||
}
|
||||
|
||||
bool Locale::isApplicationTranslatedInto(const QString &lang)
|
||||
{
|
||||
return KLocalizedString::isApplicationTranslatedInto(lang);
|
||||
}
|
||||
|
||||
void Locale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier,
|
||||
QString &charset)
|
||||
{
|
||||
Locale::splitLocale(locale, language, country, modifier, charset);
|
||||
}
|
||||
|
||||
QString Locale::language() const
|
||||
{
|
||||
return m_locale->language();
|
||||
}
|
||||
|
||||
QString Locale::country() const
|
||||
{
|
||||
return m_locale->country();
|
||||
}
|
||||
|
||||
QString Locale::countryDivisionCode() const
|
||||
{
|
||||
return m_locale->countryDivisionCode();
|
||||
}
|
||||
|
||||
QString Locale::currencyCode() const
|
||||
{
|
||||
return m_locale->currencyCode();
|
||||
}
|
||||
|
||||
QList<int> Locale::allDigitSetsList() const
|
||||
{
|
||||
QList<int> digitList;
|
||||
|
||||
foreach(KLocale::DigitSet digit, m_locale->allDigitSetsList()) {
|
||||
digitList.append((int)digit);
|
||||
}
|
||||
|
||||
return digitList;
|
||||
}
|
||||
|
||||
QString Locale::digitSetToName(Locale::DigitSet digitSet, bool withDigits) const
|
||||
{
|
||||
return m_locale->digitSetToName((KLocale::DigitSet)digitSet, withDigits);
|
||||
}
|
||||
|
||||
QString Locale::convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext) const
|
||||
{
|
||||
return m_locale->convertDigits(str, (KLocale::DigitSet)digitSet, ignoreContext);
|
||||
}
|
||||
|
||||
bool Locale::dateMonthNamePossessive() const
|
||||
{
|
||||
return m_locale->dateMonthNamePossessive();
|
||||
}
|
||||
|
||||
int Locale::weekStartDay() const
|
||||
{
|
||||
return m_locale->weekStartDay();
|
||||
}
|
||||
|
||||
int Locale::workingWeekStartDay() const
|
||||
{
|
||||
return m_locale->workingWeekStartDay();
|
||||
}
|
||||
|
||||
int Locale::workingWeekEndDay() const
|
||||
{
|
||||
return m_locale->workingWeekEndDay();
|
||||
}
|
||||
|
||||
int Locale::weekDayOfPray() const
|
||||
{
|
||||
return m_locale->weekDayOfPray();
|
||||
}
|
||||
|
||||
int Locale::decimalPlaces() const
|
||||
{
|
||||
return m_locale->decimalPlaces();
|
||||
}
|
||||
|
||||
QString Locale::decimalSymbol() const
|
||||
{
|
||||
return m_locale->decimalSymbol();
|
||||
}
|
||||
|
||||
QString Locale::thousandsSeparator() const
|
||||
{
|
||||
return m_locale->thousandsSeparator();
|
||||
}
|
||||
|
||||
QString Locale::currencySymbol() const
|
||||
{
|
||||
return m_locale->currencySymbol();
|
||||
}
|
||||
|
||||
QString Locale::monetaryDecimalSymbol() const
|
||||
{
|
||||
return m_locale->monetaryDecimalSymbol();
|
||||
}
|
||||
|
||||
QString Locale::monetaryThousandsSeparator() const
|
||||
{
|
||||
return m_locale->monetaryThousandsSeparator();
|
||||
}
|
||||
|
||||
QString Locale::positiveSign() const
|
||||
{
|
||||
return m_locale->positiveSign();
|
||||
}
|
||||
|
||||
QString Locale::negativeSign() const
|
||||
{
|
||||
return m_locale->negativeSign();
|
||||
}
|
||||
|
||||
int Locale::monetaryDecimalPlaces() const
|
||||
{
|
||||
return m_locale->monetaryDecimalPlaces();
|
||||
}
|
||||
|
||||
bool Locale::positivePrefixCurrencySymbol() const
|
||||
{
|
||||
return m_locale->positivePrefixCurrencySymbol();
|
||||
}
|
||||
|
||||
bool Locale::negativePrefixCurrencySymbol() const
|
||||
{
|
||||
return m_locale->negativePrefixCurrencySymbol();
|
||||
}
|
||||
|
||||
Locale::SignPosition Locale::positiveMonetarySignPosition() const
|
||||
{
|
||||
return (Locale::SignPosition)m_locale->positiveMonetarySignPosition();
|
||||
}
|
||||
|
||||
Locale::SignPosition Locale::negativeMonetarySignPosition() const
|
||||
{
|
||||
return (Locale::SignPosition)m_locale->negativeMonetarySignPosition();
|
||||
}
|
||||
|
||||
QString Locale::formatMoney(double num, const QString &symbol, int precision) const
|
||||
{
|
||||
return m_locale->formatMoney(num, symbol, precision);
|
||||
}
|
||||
|
||||
QString Locale::formatLong(long num) const
|
||||
{
|
||||
return m_locale->formatLong(num);
|
||||
}
|
||||
|
||||
QString Locale::formatNumber(const QString &numStr, bool round, int precision) const
|
||||
{
|
||||
return m_locale->formatNumber(numStr, round, precision);
|
||||
}
|
||||
|
||||
QString Locale::formatByteSize(double size, int precision, Locale::BinaryUnitDialect dialect,
|
||||
Locale::BinarySizeUnits specificUnit) const
|
||||
{
|
||||
return m_locale->formatByteSize(size, precision, (KLocale::BinaryUnitDialect)dialect, (KLocale::BinarySizeUnits)specificUnit);
|
||||
}
|
||||
|
||||
QString Locale::formatByteSize(double size) const
|
||||
{
|
||||
return m_locale->formatByteSize(size);
|
||||
}
|
||||
|
||||
Locale::BinaryUnitDialect Locale::binaryUnitDialect() const
|
||||
{
|
||||
return (Locale::BinaryUnitDialect)m_locale->binaryUnitDialect();
|
||||
}
|
||||
|
||||
void Locale::setBinaryUnitDialect(Locale::BinaryUnitDialect newDialect)
|
||||
{
|
||||
m_locale->setBinaryUnitDialect((KLocale::BinaryUnitDialect)newDialect);
|
||||
emit binaryUnitDialectChanged();
|
||||
}
|
||||
|
||||
QString Locale::formatDuration(unsigned long mSec) const
|
||||
{
|
||||
return m_locale->formatDuration(mSec);
|
||||
}
|
||||
|
||||
QString Locale::prettyFormatDuration(unsigned long mSec) const
|
||||
{
|
||||
return m_locale->prettyFormatDuration(mSec);
|
||||
}
|
||||
|
||||
QString Locale::formatDate(const QDate &date, Locale::DateFormat format) const
|
||||
{
|
||||
return m_locale->formatDate(date, (KLocale::DateFormat)format);
|
||||
}
|
||||
|
||||
double Locale::readNumber(const QString &_str) const
|
||||
{
|
||||
bool ok;
|
||||
return m_locale->readNumber(_str, &ok);
|
||||
}
|
||||
|
||||
double Locale::readMoney(const QString &_str) const
|
||||
{
|
||||
bool ok;
|
||||
return m_locale->readMoney(_str, &ok);
|
||||
}
|
||||
|
||||
QDate Locale::readDate(const QString &intstr, ReadDateFlags flags) const
|
||||
{
|
||||
bool ok;
|
||||
return m_locale->readDate(intstr, (KLocale::ReadDateFlags)flags, &ok);
|
||||
}
|
||||
|
||||
QTime Locale::readTime(const QString &intstr) const
|
||||
{
|
||||
bool ok;
|
||||
return m_locale->readTime(intstr, &ok);
|
||||
}
|
||||
|
||||
QTime Locale::readLocaleTime(const QString &intstr, TimeFormatOptions options,
|
||||
TimeProcessingOptions processing) const
|
||||
{
|
||||
bool ok;
|
||||
return m_locale->readLocaleTime(intstr, &ok, (KLocale::TimeFormatOptions)(int)options, (KLocale::TimeProcessingOptions)(int)processing);
|
||||
}
|
||||
|
||||
QString Locale::formatLocaleTime(const QTime &time, TimeFormatOptions options) const
|
||||
{
|
||||
return m_locale->formatLocaleTime(time, (KLocale::TimeFormatOptions)(int)options);
|
||||
}
|
||||
|
||||
bool Locale::use12Clock() const
|
||||
{
|
||||
return m_locale->use12Clock();
|
||||
}
|
||||
|
||||
QString Locale::dayPeriodText(const QTime &time, DateTimeComponentFormat format) const
|
||||
{
|
||||
return m_locale->dayPeriodText(time, (KLocale::DateTimeComponentFormat)format);
|
||||
}
|
||||
|
||||
QStringList Locale::languageList() const
|
||||
{
|
||||
return m_locale->languageList();
|
||||
}
|
||||
|
||||
QStringList Locale::currencyCodeList() const
|
||||
{
|
||||
return m_locale->currencyCodeList();
|
||||
}
|
||||
|
||||
QString Locale::formatDateTime(const QDateTime &dateTime, Locale::DateFormat format, DateTimeFormatOptions options) const
|
||||
{
|
||||
return m_locale->formatDateTime(dateTime, (KLocale::DateFormat)format, (KLocale::DateTimeFormatOptions)(int)options);
|
||||
}
|
||||
|
||||
void Locale::setDateFormat(const QString &format)
|
||||
{
|
||||
m_locale->setDateFormat(format);
|
||||
emit dateFormatChanged();
|
||||
}
|
||||
|
||||
void Locale::setDateFormatShort(const QString &format)
|
||||
{
|
||||
m_locale->setDateFormatShort(format);
|
||||
emit dateFormatShortChanged();
|
||||
}
|
||||
|
||||
void Locale::setDateMonthNamePossessive(bool possessive)
|
||||
{
|
||||
m_locale->setDateMonthNamePossessive(possessive);
|
||||
emit dateMonthNamePossessiveChanged();
|
||||
}
|
||||
|
||||
void Locale::setTimeFormat(const QString &format)
|
||||
{
|
||||
m_locale->setTimeFormat(format);
|
||||
emit timeFormatChanged();
|
||||
}
|
||||
|
||||
void Locale::setWeekStartDay(int day)
|
||||
{
|
||||
m_locale->setWeekStartDay(day);
|
||||
emit weekStartDayChanged();
|
||||
}
|
||||
|
||||
void Locale::setWorkingWeekStartDay(int day)
|
||||
{
|
||||
m_locale->setWorkingWeekStartDay(day);
|
||||
emit workingWeekStartDayChanged();
|
||||
}
|
||||
|
||||
void Locale::setWorkingWeekEndDay(int day)
|
||||
{
|
||||
m_locale->setWorkingWeekEndDay(day);
|
||||
emit workingWeekEndDayChanged();
|
||||
}
|
||||
|
||||
void Locale::setWeekDayOfPray(int day)
|
||||
{
|
||||
m_locale->setWeekDayOfPray(day);
|
||||
emit weekDayOfPrayChanged();
|
||||
}
|
||||
|
||||
QString Locale::dateFormat() const
|
||||
{
|
||||
return m_locale->dateFormat();
|
||||
}
|
||||
|
||||
QString Locale::dateFormatShort() const
|
||||
{
|
||||
return m_locale->dateFormatShort();
|
||||
}
|
||||
|
||||
QString Locale::timeFormat() const
|
||||
{
|
||||
return m_locale->timeFormat();
|
||||
}
|
||||
|
||||
void Locale::setDecimalPlaces(int digits)
|
||||
{
|
||||
m_locale->setDecimalPlaces(digits);
|
||||
emit decimalPlacesChanged();
|
||||
}
|
||||
|
||||
void Locale::setDecimalSymbol(const QString &symbol)
|
||||
{
|
||||
m_locale->setDecimalSymbol(symbol);
|
||||
emit decimalSymbolChanged();
|
||||
}
|
||||
|
||||
void Locale::setThousandsSeparator(const QString &separator)
|
||||
{
|
||||
m_locale->setThousandsSeparator(separator);
|
||||
emit thousandsSeparatorChanged();
|
||||
}
|
||||
|
||||
void Locale::setPositiveSign(const QString &sign)
|
||||
{
|
||||
m_locale->setPositiveSign(sign);
|
||||
emit positiveSignChanged();
|
||||
}
|
||||
|
||||
void Locale::setNegativeSign(const QString &sign)
|
||||
{
|
||||
m_locale->setNegativeSign(sign);
|
||||
emit negativeSignChanged();
|
||||
}
|
||||
|
||||
void Locale::setPositiveMonetarySignPosition(Locale::SignPosition signpos)
|
||||
{
|
||||
m_locale->setPositiveMonetarySignPosition((KLocale::SignPosition)signpos);
|
||||
emit positiveMonetarySignPositionChanged();
|
||||
}
|
||||
|
||||
void Locale::setNegativeMonetarySignPosition(Locale::SignPosition signpos)
|
||||
{
|
||||
m_locale->setNegativeMonetarySignPosition((KLocale::SignPosition)signpos);
|
||||
emit negativeMonetarySignPositionChanged();
|
||||
}
|
||||
|
||||
void Locale::setPositivePrefixCurrencySymbol(bool prefix)
|
||||
{
|
||||
m_locale->setPositivePrefixCurrencySymbol(prefix);
|
||||
emit positivePrefixCurrencySymbolChanged();
|
||||
}
|
||||
|
||||
void Locale::setNegativePrefixCurrencySymbol(bool prefix)
|
||||
{
|
||||
m_locale->setNegativePrefixCurrencySymbol(prefix);
|
||||
emit negativePrefixCurrencySymbolChanged();
|
||||
}
|
||||
|
||||
void Locale::setMonetaryDecimalPlaces(int digits)
|
||||
{
|
||||
m_locale->setMonetaryDecimalPlaces(digits);
|
||||
emit monetaryDecimalPlacesChanged();
|
||||
}
|
||||
|
||||
void Locale::setMonetaryThousandsSeparator(const QString &separator)
|
||||
{
|
||||
m_locale->setMonetaryThousandsSeparator(separator);
|
||||
emit monetaryThousandsSeparatorChanged();
|
||||
}
|
||||
|
||||
void Locale::setMonetaryDecimalSymbol(const QString &symbol)
|
||||
{
|
||||
m_locale->setMonetaryDecimalSymbol(symbol);
|
||||
emit monetaryDecimalSymbolChanged();
|
||||
}
|
||||
|
||||
void Locale::setCurrencySymbol(const QString & symbol)
|
||||
{
|
||||
m_locale->setCurrencySymbol(symbol);
|
||||
emit currencySymbolChanged();
|
||||
}
|
||||
|
||||
int Locale::pageSize() const
|
||||
{
|
||||
return m_locale->pageSize();
|
||||
}
|
||||
|
||||
void Locale::setPageSize(int size)
|
||||
{
|
||||
m_locale->setPageSize(size);
|
||||
emit pageSizeChanged();
|
||||
}
|
||||
|
||||
Locale::MeasureSystem Locale::measureSystem() const
|
||||
{
|
||||
return (Locale::MeasureSystem)m_locale->measureSystem();
|
||||
}
|
||||
|
||||
void Locale::setMeasureSystem(Locale::MeasureSystem value)
|
||||
{
|
||||
m_locale->setMeasureSystem((KLocale::MeasureSystem)value);
|
||||
emit measureSystemChanged();
|
||||
}
|
||||
|
||||
QString Locale::defaultLanguage()
|
||||
{
|
||||
return KLocale::defaultLanguage();
|
||||
}
|
||||
|
||||
QString Locale::defaultCountry()
|
||||
{
|
||||
return KLocale::defaultCountry();
|
||||
}
|
||||
|
||||
QString Locale::defaultCurrencyCode()
|
||||
{
|
||||
return KLocale::defaultCurrencyCode();
|
||||
}
|
||||
|
||||
int Locale::fileEncodingMib() const
|
||||
{
|
||||
return m_locale->fileEncodingMib();
|
||||
}
|
||||
|
||||
QStringList Locale::allLanguagesList() const
|
||||
{
|
||||
return m_locale->allLanguagesList();
|
||||
}
|
||||
|
||||
QStringList Locale::installedLanguages() const
|
||||
{
|
||||
return m_locale->installedLanguages();
|
||||
}
|
||||
|
||||
QString Locale::languageCodeToName(const QString &language) const
|
||||
{
|
||||
return m_locale->languageCodeToName(language);
|
||||
}
|
||||
|
||||
QStringList Locale::allCountriesList() const
|
||||
{
|
||||
return m_locale->allCountriesList();
|
||||
}
|
||||
|
||||
QString Locale::countryCodeToName(const QString &country) const
|
||||
{
|
||||
return m_locale->countryCodeToName(country);
|
||||
}
|
||||
|
||||
void Locale::setCalendarSystem(Locale::CalendarSystem calendarSystem)
|
||||
{
|
||||
m_locale->setCalendarSystem((KLocale::CalendarSystem)calendarSystem);
|
||||
emit calendarSystemChanged();
|
||||
}
|
||||
|
||||
Locale::CalendarSystem Locale::calendarSystem() const
|
||||
{
|
||||
return (Locale::CalendarSystem)m_locale->calendarSystem();
|
||||
}
|
||||
|
||||
void Locale::setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem)
|
||||
{
|
||||
m_locale->setWeekNumberSystem((KLocale::WeekNumberSystem)weekNumberSystem);
|
||||
emit WeekNumberSystemChanged();
|
||||
}
|
||||
|
||||
Locale::WeekNumberSystem Locale::weekNumberSystem() const
|
||||
{
|
||||
return (Locale::WeekNumberSystem)m_locale->weekNumberSystem();
|
||||
}
|
||||
|
||||
QString Locale::removeAcceleratorMarker(const QString &label) const
|
||||
{
|
||||
return KLocalizedString::removeAcceleratorMarker(label);
|
||||
}
|
||||
|
||||
void Locale::setDigitSet(Locale::DigitSet digitSet)
|
||||
{
|
||||
m_locale->setDigitSet((KLocale::DigitSet)digitSet);
|
||||
emit digitSetChanged();
|
||||
}
|
||||
|
||||
Locale::DigitSet Locale::digitSet() const
|
||||
{
|
||||
return (Locale::DigitSet)m_locale->digitSet();
|
||||
}
|
||||
|
||||
void Locale::setMonetaryDigitSet(Locale::DigitSet digitSet)
|
||||
{
|
||||
m_locale->setMonetaryDigitSet((KLocale::DigitSet)digitSet);
|
||||
emit monetaryDigitSetChanged();
|
||||
}
|
||||
|
||||
Locale::DigitSet Locale::monetaryDigitSet() const
|
||||
{
|
||||
return (Locale::DigitSet)m_locale->monetaryDigitSet();
|
||||
}
|
||||
|
||||
void Locale::setDateTimeDigitSet(Locale::DigitSet digitSet)
|
||||
{
|
||||
m_locale->setDateTimeDigitSet((KLocale::DigitSet)digitSet);
|
||||
emit dateTimeDigitSetChanged();
|
||||
}
|
||||
|
||||
Locale::DigitSet Locale::dateTimeDigitSet() const
|
||||
{
|
||||
return (Locale::DigitSet)m_locale->dateTimeDigitSet();
|
||||
}
|
||||
|
||||
void Locale::reparseConfiguration()
|
||||
{
|
||||
m_locale->reparseConfiguration();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 by Antonis Tsiapaliokas <kok3rs@gmail.com>
|
||||
* Copyright 2012 by Giorgos Tsiapaliwkas <terietor@gmail.com>
|
||||
|
||||
* This program 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, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "localebindingsplugin.h"
|
||||
#include <QtQml>
|
||||
#include "locale_p.h"
|
||||
#include "calendarsystem.h"
|
||||
|
||||
void LocaleBindingsPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.locale"));
|
||||
|
||||
qmlRegisterType<Locale>(uri, 2, 0, "Locale");
|
||||
qmlRegisterType<CalendarSystem>(uri, 2, 0, "CalendarSystem");
|
||||
}
|
||||
|
||||
#include "localebindingsplugin.moc"
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 by Antonis Tsiapaliokas <kok3rs@gmail.com>
|
||||
* Copyright 2012 by Giorgos Tsiapaliwkas <terietor@gmail.com>
|
||||
*
|
||||
* This program 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, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef LOCALEBINDINGSPLUGIN_H
|
||||
#define LOCALEBINDINGSPLUGIN_H
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
class LocaleBindingsPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,2 +0,0 @@
|
||||
module org.kde.locale
|
||||
plugin localebindingsplugin
|
Loading…
Reference in New Issue
Block a user