Git commit a9cf6d58d5219f65a3ac8c176f4ae0c7c8f9aca5 by Giorgos Tsiapaliwkas. Committed on 16/05/2012 at 20:16. Pushed by tsiapaliwkas into branch 'master'. Initial import for locale gallery. The locale gallery has been moved from kde-runtime to kdeexamples A +484 -0 plasma/declarative/localegallery/contents/ui/main.qml [L= icense: LGPL (v2+)] A +18 -0 plasma/declarative/localegallery/metadata.desktop http://commits.kde.org/kdeexamples/a9cf6d58d5219f65a3ac8c176f4ae0c7c8f9aca5 diff --git a/plasma/declarative/localegallery/contents/ui/main.qml b/plasma= /declarative/localegallery/contents/ui/main.qml new file mode 100644 index 0000000..3110e91 --- /dev/null +++ b/plasma/declarative/localegallery/contents/ui/main.qml @@ -0,0 +1,484 @@ +// -*- coding: iso-8859-1 -*- +/* + * Author: Giorgos Tsiapaliwkas + * 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 1.1 +import org.kde.plasma.components 0.1 as PlasmaComponents +import org.kde.plasma.locale 0.1 + +Item { + 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 + Text { + id: text1 + anchors.horizontalCenter: column.horizontalCenter + text: "This is a test plasmoid for the locale bindings" + color: "black" + } + + Text { + id: text2 + anchors.horizontalCenter: column.horizontalCenter + text: "If you see this text,that means that every " + + " non printable property/method has been already set. And it w= orks!!" + color: "black" + } + + PlasmaComponents.Button { + id: bt1 + anchors.horizontalCenter: column.horizontalCenter + text: "click in order to test the Locale component" + onClicked:{ + console.log("=3D=3D=3D=3D=3DLocale Component=3D=3D=3D=3D") + console.log("country:" + locale.country) + + locale.binaryUnitDialect =3D Locale.IECBinaryDialect + locale.calendarSystem =3D Locale.CopticCalendar + + locale.countryDivisionCode =3D "AL" + console.log("countryDivisionCode:" + locale.countryDivisio= nCode) + + console.log("currencyCode:" + locale.currencyCode) + + locale.currencySymbol =3D "$" + console.log("currencySymbol:" + locale.currencySymbol) + + locale.dateTimeDigitSet =3D Locale.EasternArabicIndicDigits + + locale.dateFormat =3D "Y" + console.log("dateFormat:" + locale.dateFormat) + + locale.dateFormatShort =3D "Y" + console.log("dateFormatShort:" + locale.dateFormatShort) + + locale.dateMonthNamePossessive =3D false + console.log("dateMonthNamePossessive:" + locale.dateMonthN= amePossessive) + + locale.decimalPlaces =3D 2 + console.log("decimalPlaces:" + locale.decimalPlaces) + + locale.decimalSymbol =3D "." + console.log("decimalSymbol:" + locale.decimalSymbol) + + locale.digitSet =3D Locale.EasternArabicIndicDigits + console.log("digitSet:" + locale.digitSet) + + console.log("language:" + locale.language) + + locale.measureSystem =3D Locale.Imperial + + locale.monetaryDecimalPlaces =3D 3 + console.log("monetaryDecimalPlaces:" + locale.monetaryDeci= malPlaces) + + locale.monetaryDecimalSymbol =3D "." + console.log("monetaryDecimalSymbol:" + locale.monetaryDeci= malSymbol) + + locale.monetaryDigitSet =3D Locale.EasternArabicIndicDigits + + locale.monetaryThousandsSeparator =3D "." + console.log("monetaryThousandsSeparator:" + locale.monetar= yThousandsSeparator) + + locale.negativeMonetarySignPosition =3D Locale.AfterMoney + + locale.negativePrefixCurrencySymbol =3D false + console.log("negativePrefixCurrencySymbol:" + locale.negat= ivePrefixCurrencySymbol) + + locale.negativeSign =3D "-" + console.log("negativeSign:" + locale.negativeSign) + + locale.pageSize =3D 6 + console.log("pageSize:" + locale.pageSize) + + locale.positiveMonetarySignPosition =3D Locale.AfterMoney + + locale.positivePrefixCurrencySymbol =3D false + console.log("positivePrefixCurrencySymbol:" + locale.posit= ivePrefixCurrencySymbol) + + locale.positiveSign =3D "+" + console.log("positiveSign:" + locale.positiveSign) + + locale.thousandsSeparator =3D "." + console.log("thousandsSeparator:" + locale.thousandsSepara= tor) + + locale.weekDayOfPray =3D 10 + console.log("weekDayOfPray:" + locale.weekDayOfPray) + + locale.weekNumberSystem =3D Locale.FirstFullWeek + + locale.weekStartDay =3D 3 + console.log("weekStartDay:" + locale.weekStartDay) + + locale.workingWeekEndDay =3D 6 + console.log("workingWeekEndDay:" + locale.workingWeekEndDa= y) + + locale.workingWeekStartDay =3D 2 + console.log("workingWeekStartDay:" + locale.workingWeekEnd= Day) + + console.log("use12Clock:" + locale.use12Clock) + + console.log("defaultLanguage:" + locale.defaultLanguage) + + console.log("defaultCountry:" + locale.defaultCountry) + + console.log("defaultCurrencyCode:" + locale.defaultCurrenc= yCode) + + console.log("the useTranscript:" + locale.useTranscript) + + console.log("the encodingMib:" + locale.encodingMib) + + for (var i in locale.languageList) { + console.log("languageList:" + locale.languageList[i]) + } + + for (var i in locale.currencyCodeList) { + console.log("currencyCodeList:" + locale.currencyCodeL= ist[i]) + } + + for (var i in locale.installedLanguages) { + console.log("installedLanguages:" + locale.installedLa= nguages[i]) + } + + for (var i in locale.allCountriesList) { + console.log("allCountriesList:" + locale.allCountriesL= ist[i]) + } + + console.log("formatDate:" + locale.formatDate("2010-05-05"= )) + + console.log("formatDateTime:" + locale.formatDateTime("201= 0-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.prettyFormatD= uration(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", Lo= cale.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.languageCodeToN= ame("en_US")) + + console.log("isApplicationTranslatedInto:" + locale.isAppl= icationTranslatedInto("en_US")) + + console.log("removeAcceleratorMarker:" + locale.removeAcce= leratorMarker("&*hello")) + + console.log("convertDigits:" + locale.convertDigits(locale= .digitSet, Locale.ArabicDigits)) + + for (var i in locale.allDigitSetsList) { + console.log("allDigitSetsList:" + locale.allDigitSetsL= ist[i]) + } + + console.log("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dend=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D") + } + } + + PlasmaComponents.Button { + id: bt2 + property variant hash + anchors.horizontalCenter: column.horizontalCenter + text: "click in order to test the CalendarSystem component" + onClicked:{ + console.log("=3D=3D=3D=3D=3DCalendarSystem Component=3D=3D= =3D=3D") + + console.log("calendarLabel:" + calendar.calendarLabel) + + console.log("epoch:" + calendar.epoch) + + console.log("earliestValidDate:" + calendar.earliestValidD= ate) + + console.log("latestValidDate:" + calendar.latestValidDate) + + console.log("shortYearWindowStartYear:" + calendar.shortYe= arWindowStartYear) + + 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.isValidIsoWee= kDate(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.monthsDifferenc= e("2012-02-03", "2012-04-03")) + + console.log("daysDifference:" + calendar.daysDifference("2= 012-02-03", "2012-02-13")) + + console.log("monthsInYear:" + calendar.monthsInYear(2012)) + + console.log("weeksInYear:" + calendar.weeksInYear(2012, Ca= lendarSystem.SimpleWeek)) + + console.log("daysInYear:" + calendar.daysInYear("2012-02-0= 3")) + + console.log("daysInMonth:" + calendar.daysInMonth(2012, 8)) + + console.log("daysInWeek:" + calendar.daysInWeek("2012-02-0= 3")) + + console.log("dayOfYear:" + calendar.dayOfYear("2012-02-03"= )) + + console.log("week:" + calendar.week("2012-02-03", Calendar= System.SimpleWeek)) + + console.log("isLeapYear:" + calendar.isLeapYear(2012)) + + console.log("firstDayOfYear:" + calendar.firstDayOfYear(20= 12)) + + console.log("lastDayOfYear:" + calendar.lastDayOfYear(2012= )) + + console.log("firstDayOfMonth:" + calendar.firstDayOfMonth(= 2012, 02)) + + console.log("lastDayOfMonth:" + calendar.lastDayOfMonth(20= 12, 02)) + + console.log("monthName:" + calendar.monthName(02, 2012)) + + console.log("weekDayName:" + calendar.weekDayName(3)) + + console.log("formatDate:" + calendar.formatDate("2012-02-0= 3", CalendarSystem.Year, CalendarSystem.ShortNumber, CalendarSystem.SimpleW= eek)) + + console.log("readDate:" + calendar.readDate("2012-02-03", = CalendarSystem.IsoFormat)) + + console.log("applyShortYearWindow:" + calendar.applyShortY= earWindow(50)) + + console.log("calendarSystem:" + calendar.calendarSystem) + console.log("getDate:") + hash =3D calendar.getDate("2012-02-03") + for (var i in hash) { + console.log(" " + i, "=3D", hash[i]) + } + + console.log("dateDifference:") + hash =3D calendar.dateDifference("2012-01-01", "2014-03-03= ") + for (var i in hash) { + console.log(" " + i, "=3D", hash[i]) + } + + for (var i in calendar.calendarSystemsList) { + console.log("calendarSystemsList:" + calendar.calendar= SystemsList[i]) + } + + console.log("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= end=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D") + } + } + + Locale { + id: locale + + binaryUnitDialect: Locale.DefaultBinaryUnits + onBinaryUnitDialectChanged: { + console.log("the binaryUnitDialect property has been changed") + } + + calendarSystem: 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 cha= nged") + } + + 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: Locale.ArabicDigits + onDateTimeDigitSetChanged: { + console.log("the dateTimeDigitSet property has been change= d") + } + + decimalPlaces: 1 + onDecimalPlacesChanged: { + console.log("the decimalPlaces property has been changed") + } + + decimalSymbol: "," + onDecimalSymbolChanged: { + console.log("the decimalSymbol property has been changed") + } + + digitSet: Locale.ArabicDigits + onDigitSetChanged: { + console.log("the digitSet property has been changed") + } + + measureSystem: Locale.Metric + onMeasureSystemChanged: { + console.log("the measureSystem property has been changed") + } + + monetaryDecimalPlaces: 2 + onMonetaryDecimalPlacesChanged: { + console.log("the monetaryDecimalPlaces property has been c= hanged") + } + + monetaryDecimalSymbol: "," + onMonetaryDecimalSymbolChanged: { + console.log("the monetaryDecimalSymbol property has been c= hanged") + } + + monetaryDigitSet: Locale.ArabicDigits + onMonetaryDigitSetChanged: { + console.log("the monetaryDigitSet property has been change= d") + } + + monetaryThousandsSeparator: "," + onMonetaryThousandsSeparatorChanged: { + console.log("the monetaryThousandsSeparator property has b= een changed") + } + + negativeMonetarySignPosition: 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: 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 chan= ged") + } + + weekDayOfPray: 20 + onWeekDayOfPrayChanged: { + console.log("the weekDayOfPray property has been changed") + } + + weekNumberSystem: Locale.IsoWeekNumber + onWeekNumberSystemChanged: { + console.log("the weekNumberSystem property has been change= d") + } + + weekStartDay: 2 + onWeekStartDayChanged: { + console.log("the weekStartDay property has been changed") + } + + workingWeekEndDay: 5 + onWorkingWeekEndDayChanged: { + console.log("the workingWeekEndDay property has been chang= ed") + } + + workingWeekStartDay: 1 + onWorkingWeekStartDayChanged: { + console.log("the workingWeekStartDay property has been cha= nged") + } + } + + CalendarSystem { + id: calendar + } + } +} diff --git a/plasma/declarative/localegallery/metadata.desktop b/plasma/dec= larative/localegallery/metadata.desktop new file mode 100644 index 0000000..909eea8 --- /dev/null +++ b/plasma/declarative/localegallery/metadata.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Encoding=3DUTF-8 +Name=3DLocale gallery +Comment=3Dgallery of KLocale QML Bindings +Type=3DService +ServiceTypes=3DPlasma/Applet +Icon=3Dpreferences-desktop-theme +X-Plasma-API=3Ddeclarativeappletscript +X-Plasma-MainScript=3Dui/main.qml +X-KDE-PluginInfo-Author=3DGiorgos Tsiapaliwkas +X-KDE-PluginInfo-Email=3Dterietor@gmail.com +X-KDE-PluginInfo-Name=3Dorg.kde.example.locale +X-KDE-PluginInfo-Version=3D1.0 +X-KDE-PluginInfo-Website=3Dhttp://plasma.kde.org/ +X-KDE-PluginInfo-Category=3DExamples +X-KDE-PluginInfo-Depends=3D +X-KDE-PluginInfo-License=3DGPL +X-KDE-PluginInfo-EnabledByDefault=3Dtrue