]> git.pld-linux.org Git - packages/kde4-kdebase-runtime.git/blame - kde4-kdebase-runtime-locale.patch
- md5
[packages/kde4-kdebase-runtime.git] / kde4-kdebase-runtime-locale.patch
CommitLineData
eb8b4a7d
AM
1diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/calendarsystem.h kde-runtime-4.9.0/plasma/declarativeimports/locale/calendarsystem.h
2--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/calendarsystem.h 2012-05-23 01:59:52.000000000 +0200
3+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/calendarsystem.h 2012-07-29 10:43:38.395812270 +0200
4@@ -22,7 +22,7 @@
5 #define CALENDARSYSTEM_H
6
7 //own
8-#include "locale.h" // needed for enums
9+#include "kdelocale.h" // needed for enums
10
11 //Qt
12 #include <QtCore/QDate>
13diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/CMakeLists.txt kde-runtime-4.9.0/plasma/declarativeimports/locale/CMakeLists.txt
14--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/CMakeLists.txt 2012-06-19 23:47:36.000000000 +0200
15+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/CMakeLists.txt 2012-07-29 10:52:01.795222262 +0200
16@@ -3,7 +3,7 @@
17 include(KDE4Defaults)
18
19 set(localebindings_SRCS
20- locale.cpp
21+ kdelocale.cpp
22 localebindingsplugin.cpp
23 calendarsystem.cpp
24 )
25diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/kdelocale.cpp kde-runtime-4.9.0/plasma/declarativeimports/locale/kdelocale.cpp
26--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/kdelocale.cpp 1970-01-01 01:00:00.000000000 +0100
27+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/kdelocale.cpp 2012-07-29 10:43:47.799379026 +0200
28@@ -0,0 +1,582 @@
29+/* This file is part of the KDE libraries
30+ Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
31+ Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
32+
33+ This library is free software; you can redistribute it and/or
34+ modify it under the terms of the GNU Library General Public
35+ License as published by the Free Software Foundation; either
36+ version 2 of the License, or (at your option) any later version.
37+
38+ This library is distributed in the hope that it will be useful,
39+ but WITHOUT ANY WARRANTY; without even the implied warranty of
40+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41+ Library General Public License for more details.
42+
43+ You should have received a copy of the GNU Library General Public License
44+ along with this library; see the file COPYING.LIB. If not, write to
45+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
46+ Boston, MA 02110-1301, USA.
47+*/
48+
49+//own
50+#include "kdelocale.h"
51+
52+//KDE
53+#include <KGlobal>
54+
55+Locale::Locale(QObject* parent)
56+ : QObject(parent)
57+{
58+ m_locale = KGlobal::locale();
59+}
60+
61+bool Locale::setCountryDivisionCode(const QString &countryDivisionCode)
62+{
63+ bool ok = m_locale->setCountryDivisionCode(countryDivisionCode);
64+ emit countryDivisionCodeChanged();
65+ return ok;
66+}
67+
68+void Locale::setCurrencyCode(const QString &newCurrencyCode)
69+{
70+ m_locale->setCurrencyCode(newCurrencyCode);
71+ emit currencyCodeChanged();
72+}
73+
74+bool Locale::isApplicationTranslatedInto(const QString &lang)
75+{
76+ return m_locale->isApplicationTranslatedInto(lang);
77+}
78+
79+void Locale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier,
80+ QString &charset)
81+{
82+ Locale::splitLocale(locale, language, country, modifier, charset);
83+}
84+
85+QString Locale::language() const
86+{
87+ return m_locale->language();
88+}
89+
90+QString Locale::country() const
91+{
92+ return m_locale->country();
93+}
94+
95+QString Locale::countryDivisionCode() const
96+{
97+ return m_locale->countryDivisionCode();
98+}
99+
100+QString Locale::currencyCode() const
101+{
102+ return m_locale->currencyCode();
103+}
104+
105+QString Locale::translateQt(const char *context, const char *sourceText, const char *comment) const
106+{
107+ return m_locale->translateQt(context, sourceText, comment);
108+}
109+
110+QList<int> Locale::allDigitSetsList() const
111+{
112+ QList<int> digitList;
113+
114+ foreach(KLocale::DigitSet digit, m_locale->allDigitSetsList()) {
115+ digitList.append((int)digit);
116+ }
117+
118+ return digitList;
119+}
120+
121+QString Locale::digitSetToName(Locale::DigitSet digitSet, bool withDigits) const
122+{
123+ return m_locale->digitSetToName((KLocale::DigitSet)digitSet, withDigits);
124+}
125+
126+QString Locale::convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext) const
127+{
128+ return m_locale->convertDigits(str, (KLocale::DigitSet)digitSet, ignoreContext);
129+}
130+
131+bool Locale::dateMonthNamePossessive() const
132+{
133+ return m_locale->dateMonthNamePossessive();
134+}
135+
136+int Locale::weekStartDay() const
137+{
138+ return m_locale->weekStartDay();
139+}
140+
141+int Locale::workingWeekStartDay() const
142+{
143+ return m_locale->workingWeekStartDay();
144+}
145+
146+int Locale::workingWeekEndDay() const
147+{
148+ return m_locale->workingWeekEndDay();
149+}
150+
151+int Locale::weekDayOfPray() const
152+{
153+ return m_locale->weekDayOfPray();
154+}
155+
156+int Locale::decimalPlaces() const
157+{
158+ return m_locale->decimalPlaces();
159+}
160+
161+QString Locale::decimalSymbol() const
162+{
163+ return m_locale->decimalSymbol();
164+}
165+
166+QString Locale::thousandsSeparator() const
167+{
168+ return m_locale->thousandsSeparator();
169+}
170+
171+QString Locale::currencySymbol() const
172+{
173+ return m_locale->currencySymbol();
174+}
175+
176+QString Locale::monetaryDecimalSymbol() const
177+{
178+ return m_locale->monetaryDecimalSymbol();
179+}
180+
181+QString Locale::monetaryThousandsSeparator() const
182+{
183+ return m_locale->monetaryThousandsSeparator();
184+}
185+
186+QString Locale::positiveSign() const
187+{
188+ return m_locale->positiveSign();
189+}
190+
191+QString Locale::negativeSign() const
192+{
193+ return m_locale->negativeSign();
194+}
195+
196+int Locale::monetaryDecimalPlaces() const
197+{
198+ return m_locale->monetaryDecimalPlaces();
199+}
200+
201+bool Locale::positivePrefixCurrencySymbol() const
202+{
203+ return m_locale->positivePrefixCurrencySymbol();
204+}
205+
206+bool Locale::negativePrefixCurrencySymbol() const
207+{
208+ return m_locale->negativePrefixCurrencySymbol();
209+}
210+
211+Locale::SignPosition Locale::positiveMonetarySignPosition() const
212+{
213+ return (Locale::SignPosition)m_locale->positiveMonetarySignPosition();
214+}
215+
216+Locale::SignPosition Locale::negativeMonetarySignPosition() const
217+{
218+ return (Locale::SignPosition)m_locale->negativeMonetarySignPosition();
219+}
220+
221+QString Locale::formatMoney(double num, const QString &symbol, int precision) const
222+{
223+ return m_locale->formatMoney(num, symbol, precision);
224+}
225+
226+QString Locale::formatLong(long num) const
227+{
228+ return m_locale->formatLong(num);
229+}
230+
231+QString Locale::formatNumber(const QString &numStr, bool round, int precision) const
232+{
233+ return m_locale->formatNumber(numStr, round, precision);
234+}
235+
236+QString Locale::formatByteSize(double size, int precision, Locale::BinaryUnitDialect dialect,
237+ Locale::BinarySizeUnits specificUnit) const
238+{
239+ return m_locale->formatByteSize(size, precision, (KLocale::BinaryUnitDialect)dialect, (KLocale::BinarySizeUnits)specificUnit);
240+}
241+
242+QString Locale::formatByteSize(double size) const
243+{
244+ return m_locale->formatByteSize(size);
245+}
246+
247+Locale::BinaryUnitDialect Locale::binaryUnitDialect() const
248+{
249+ return (Locale::BinaryUnitDialect)m_locale->binaryUnitDialect();
250+}
251+
252+void Locale::setBinaryUnitDialect(Locale::BinaryUnitDialect newDialect)
253+{
254+ m_locale->setBinaryUnitDialect((KLocale::BinaryUnitDialect)newDialect);
255+ emit binaryUnitDialectChanged();
256+}
257+
258+QString Locale::formatDuration(unsigned long mSec) const
259+{
260+ return m_locale->formatDuration(mSec);
261+}
262+
263+QString Locale::prettyFormatDuration(unsigned long mSec) const
264+{
265+ return m_locale->prettyFormatDuration(mSec);
266+}
267+
268+QString Locale::formatDate(const QDate &date, Locale::DateFormat format) const
269+{
270+ return m_locale->formatDate(date, (KLocale::DateFormat)format);
271+}
272+
273+double Locale::readNumber(const QString &_str) const
274+{
275+ bool ok;
276+ return m_locale->readNumber(_str, &ok);
277+}
278+
279+double Locale::readMoney(const QString &_str) const
280+{
281+ bool ok;
282+ return m_locale->readMoney(_str, &ok);
283+}
284+
285+QDate Locale::readDate(const QString &intstr, ReadDateFlags flags) const
286+{
287+ bool ok;
288+ return m_locale->readDate(intstr, (KLocale::ReadDateFlags)flags, &ok);
289+}
290+
291+QTime Locale::readTime(const QString &intstr) const
292+{
293+ bool ok;
294+ return m_locale->readTime(intstr, &ok);
295+}
296+
297+QTime Locale::readLocaleTime(const QString &intstr, TimeFormatOptions options,
298+ TimeProcessingOptions processing) const
299+{
300+ bool ok;
301+ return m_locale->readLocaleTime(intstr, &ok, (KLocale::TimeFormatOptions)(int)options, (KLocale::TimeProcessingOptions)(int)processing);
302+}
303+
304+QString Locale::formatLocaleTime(const QTime &time, TimeFormatOptions options) const
305+{
306+ return m_locale->formatLocaleTime(time, (KLocale::TimeFormatOptions)(int)options);
307+}
308+
309+bool Locale::use12Clock() const
310+{
311+ return m_locale->use12Clock();
312+}
313+
314+QString Locale::dayPeriodText(const QTime &time, DateTimeComponentFormat format) const
315+{
316+ return m_locale->dayPeriodText(time, (KLocale::DateTimeComponentFormat)format);
317+}
318+
319+QStringList Locale::languageList() const
320+{
321+ return m_locale->languageList();
322+}
323+
324+QStringList Locale::currencyCodeList() const
325+{
326+ return m_locale->currencyCodeList();
327+}
328+
329+QString Locale::formatDateTime(const QDateTime &dateTime, Locale::DateFormat format, DateTimeFormatOptions options) const
330+{
331+ return m_locale->formatDateTime(dateTime, (KLocale::DateFormat)format, (KLocale::DateTimeFormatOptions)(int)options);
332+}
333+
334+void Locale::setDateFormat(const QString &format)
335+{
336+ m_locale->setDateFormat(format);
337+ emit dateFormatChanged();
338+}
339+
340+void Locale::setDateFormatShort(const QString &format)
341+{
342+ m_locale->setDateFormatShort(format);
343+ emit dateFormatShortChanged();
344+}
345+
346+void Locale::setDateMonthNamePossessive(bool possessive)
347+{
348+ m_locale->setDateMonthNamePossessive(possessive);
349+ emit dateMonthNamePossessiveChanged();
350+}
351+
352+void Locale::setTimeFormat(const QString &format)
353+{
354+ m_locale->setTimeFormat(format);
355+ emit timeFormatChanged();
356+}
357+
358+void Locale::setWeekStartDay(int day)
359+{
360+ m_locale->setWeekStartDay(day);
361+ emit weekStartDayChanged();
362+}
363+
364+void Locale::setWorkingWeekStartDay(int day)
365+{
366+ m_locale->setWorkingWeekStartDay(day);
367+ emit workingWeekStartDayChanged();
368+}
369+
370+void Locale::setWorkingWeekEndDay(int day)
371+{
372+ m_locale->setWorkingWeekEndDay(day);
373+ emit workingWeekEndDayChanged();
374+}
375+
376+void Locale::setWeekDayOfPray(int day)
377+{
378+ m_locale->setWeekDayOfPray(day);
379+ emit weekDayOfPrayChanged();
380+}
381+
382+QString Locale::dateFormat() const
383+{
384+ return m_locale->dateFormat();
385+}
386+
387+QString Locale::dateFormatShort() const
388+{
389+ return m_locale->dateFormatShort();
390+}
391+
392+QString Locale::timeFormat() const
393+{
394+ return m_locale->timeFormat();
395+}
396+
397+void Locale::setDecimalPlaces(int digits)
398+{
399+ m_locale->setDecimalPlaces(digits);
400+ emit decimalPlacesChanged();
401+}
402+
403+void Locale::setDecimalSymbol(const QString &symbol)
404+{
405+ m_locale->setDecimalSymbol(symbol);
406+ emit decimalSymbolChanged();
407+}
408+
409+void Locale::setThousandsSeparator(const QString &separator)
410+{
411+ m_locale->setThousandsSeparator(separator);
412+ emit thousandsSeparatorChanged();
413+}
414+
415+void Locale::setPositiveSign(const QString &sign)
416+{
417+ m_locale->setPositiveSign(sign);
418+ emit positiveSignChanged();
419+}
420+
421+void Locale::setNegativeSign(const QString &sign)
422+{
423+ m_locale->setNegativeSign(sign);
424+ emit negativeSignChanged();
425+}
426+
427+void Locale::setPositiveMonetarySignPosition(Locale::SignPosition signpos)
428+{
429+ m_locale->setPositiveMonetarySignPosition((KLocale::SignPosition)signpos);
430+ emit positiveMonetarySignPositionChanged();
431+}
432+
433+void Locale::setNegativeMonetarySignPosition(Locale::SignPosition signpos)
434+{
435+ m_locale->setNegativeMonetarySignPosition((KLocale::SignPosition)signpos);
436+ emit negativeMonetarySignPositionChanged();
437+}
438+
439+void Locale::setPositivePrefixCurrencySymbol(bool prefix)
440+{
441+ m_locale->setPositivePrefixCurrencySymbol(prefix);
442+ emit positivePrefixCurrencySymbolChanged();
443+}
444+
445+void Locale::setNegativePrefixCurrencySymbol(bool prefix)
446+{
447+ m_locale->setNegativePrefixCurrencySymbol(prefix);
448+ emit negativePrefixCurrencySymbolChanged();
449+}
450+
451+void Locale::setMonetaryDecimalPlaces(int digits)
452+{
453+ m_locale->setMonetaryDecimalPlaces(digits);
454+ emit monetaryDecimalPlacesChanged();
455+}
456+
457+void Locale::setMonetaryThousandsSeparator(const QString &separator)
458+{
459+ m_locale->setMonetaryThousandsSeparator(separator);
460+ emit monetaryThousandsSeparatorChanged();
461+}
462+
463+void Locale::setMonetaryDecimalSymbol(const QString &symbol)
464+{
465+ m_locale->setMonetaryDecimalSymbol(symbol);
466+ emit monetaryDecimalSymbolChanged();
467+}
468+
469+void Locale::setCurrencySymbol(const QString & symbol)
470+{
471+ m_locale->setCurrencySymbol(symbol);
472+ emit currencySymbolChanged();
473+}
474+
475+int Locale::pageSize() const
476+{
477+ return m_locale->pageSize();
478+}
479+
480+void Locale::setPageSize(int size)
481+{
482+ m_locale->setPageSize(size);
483+ emit pageSizeChanged();
484+}
485+
486+Locale::MeasureSystem Locale::measureSystem() const
487+{
488+ return (Locale::MeasureSystem)m_locale->measureSystem();
489+}
490+
491+void Locale::setMeasureSystem(Locale::MeasureSystem value)
492+{
493+ m_locale->setMeasureSystem((KLocale::MeasureSystem)value);
494+ emit measureSystemChanged();
495+}
496+
497+QString Locale::defaultLanguage()
498+{
499+ return KLocale::defaultLanguage();
500+}
501+
502+QString Locale::defaultCountry()
503+{
504+ return KLocale::defaultCountry();
505+}
506+
507+QString Locale::defaultCurrencyCode()
508+{
509+ return KLocale::defaultCurrencyCode();
510+}
511+
512+bool Locale::useTranscript() const
513+{
514+ return m_locale->useTranscript();
515+}
516+
517+int Locale::fileEncodingMib() const
518+{
519+ return m_locale->fileEncodingMib();
520+}
521+
522+QStringList Locale::allLanguagesList() const
523+{
524+ return m_locale->allLanguagesList();
525+}
526+
527+QStringList Locale::installedLanguages() const
528+{
529+ return m_locale->installedLanguages();
530+}
531+
532+QString Locale::languageCodeToName(const QString &language) const
533+{
534+ return m_locale->languageCodeToName(language);
535+}
536+
537+QStringList Locale::allCountriesList() const
538+{
539+ return m_locale->allCountriesList();
540+}
541+
542+QString Locale::countryCodeToName(const QString &country) const
543+{
544+ return m_locale->countryCodeToName(country);
545+}
546+
547+void Locale::setCalendarSystem(Locale::CalendarSystem calendarSystem)
548+{
549+ m_locale->setCalendarSystem((KLocale::CalendarSystem)calendarSystem);
550+ emit calendarSystemChanged();
551+}
552+
553+Locale::CalendarSystem Locale::calendarSystem() const
554+{
555+ return (Locale::CalendarSystem)m_locale->calendarSystem();
556+}
557+
558+void Locale::setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem)
559+{
560+ m_locale->setWeekNumberSystem((KLocale::WeekNumberSystem)weekNumberSystem);
561+ emit WeekNumberSystemChanged();
562+}
563+
564+Locale::WeekNumberSystem Locale::weekNumberSystem() const
565+{
566+ return (Locale::WeekNumberSystem)m_locale->weekNumberSystem();
567+}
568+
569+QString Locale::removeAcceleratorMarker(const QString &label) const
570+{
571+ return m_locale->removeAcceleratorMarker(label);
572+}
573+
574+void Locale::setDigitSet(Locale::DigitSet digitSet)
575+{
576+ m_locale->setDigitSet((KLocale::DigitSet)digitSet);
577+ emit digitSetChanged();
578+}
579+
580+Locale::DigitSet Locale::digitSet() const
581+{
582+ return (Locale::DigitSet)m_locale->digitSet();
583+}
584+
585+void Locale::setMonetaryDigitSet(Locale::DigitSet digitSet)
586+{
587+ m_locale->setMonetaryDigitSet((KLocale::DigitSet)digitSet);
588+ emit monetaryDigitSetChanged();
589+}
590+
591+Locale::DigitSet Locale::monetaryDigitSet() const
592+{
593+ return (Locale::DigitSet)m_locale->monetaryDigitSet();
594+}
595+
596+void Locale::setDateTimeDigitSet(Locale::DigitSet digitSet)
597+{
598+ m_locale->setDateTimeDigitSet((KLocale::DigitSet)digitSet);
599+ emit dateTimeDigitSetChanged();
600+}
601+
602+Locale::DigitSet Locale::dateTimeDigitSet() const
603+{
604+ return (Locale::DigitSet)m_locale->dateTimeDigitSet();
605+}
606+
607+void Locale::reparseConfiguration()
608+{
609+ m_locale->reparseConfiguration();
610+}
611diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/kdelocale.h kde-runtime-4.9.0/plasma/declarativeimports/locale/kdelocale.h
612--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/kdelocale.h 1970-01-01 01:00:00.000000000 +0100
613+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/kdelocale.h 2012-07-29 10:52:17.188937217 +0200
614@@ -0,0 +1,1585 @@
615+/* This file is part of the KDE libraries
616+ Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
617+ Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
618+
619+ This library is free software; you can redistribute it and/or
620+ modify it under the terms of the GNU Library General Public
621+ License as published by the Free Software Foundation; either
622+ version 2 of the License, or (at your option) any later version.
623+
624+ This library is distributed in the hope that it will be useful,
625+ but WITHOUT ANY WARRANTY; without even the implied warranty of
626+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
627+ Library General Public License for more details.
628+
629+ You should have received a copy of the GNU Library General Public License
630+ along with this library; see the file COPYING.LIB. If not, write to
631+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
632+ Boston, MA 02110-1301, USA.
633+*/
634+#ifndef KDELOCALE_H
635+#define KDELOCALE_H
636+
637+//Qt
638+#include <QObject>
639+#include <QTime>
640+#include <QDate>
641+
642+//KDE
643+#include <KLocale>
644+
645+class QString;
646+class QDate;
647+class QTime;
648+class QDateTime;
649+
650+/**
651+ * \file klocale.h
652+ */
653+
654+/**
655+ *
656+ * KLocale provides support for country specific stuff like
657+ * the national language.
658+ *
659+ * KLocale supports translating, as well as specifying the format
660+ * for numbers, currency, time, and date.
661+ *
662+ * Use KGlobal::locale() to get pointer to the global KLocale object,
663+ * containing the applications current locale settings.
664+ *
665+ * For example, to format the date May 17, 1995 in the current locale, use:
666+ *
667+ * \code
668+ * QString date = KGlobal::locale()->formatDate(QDate(1995,5,17));
669+ * \endcode
670+ *
671+ * @author Stephan Kulow <coolo@kde.org>, Preston Brown <pbrown@kde.org>,
672+ * Hans Petter Bieker <bieker@kde.org>, Lukas Tinkl <lukas.tinkl@suse.cz>
673+ * @short class for supporting locale settings and national language
674+ */
675+class Locale : public QObject
676+{
677+Q_OBJECT
678+
679+//enuns
680+Q_ENUMS(BinarySizeUnits)
681+Q_ENUMS(BinaryUnitDialect)
682+Q_ENUMS(CalendarSystem)
683+Q_ENUMS(DateFormat)
684+Q_ENUMS(DateTimeComponent)
685+Q_ENUMS(DateTimeComponentFormat)
686+Q_ENUMS(DateTimeFormatOption )
687+Q_ENUMS(DigitSet)
688+Q_ENUMS(MeasureSystem)
689+Q_ENUMS(ReadDateFlags)
690+Q_ENUMS(SignPosition)
691+Q_ENUMS(TimeFormatOption)
692+Q_ENUMS(TimeProcessingOption)
693+Q_ENUMS(WeekNumberSystem)
694+
695+//properties
696+Q_PROPERTY(BinaryUnitDialect binaryUnitDialect READ binaryUnitDialect WRITE setBinaryUnitDialect NOTIFY binaryUnitDialectChanged)
697+Q_PROPERTY(Locale::CalendarSystem calendarSystem READ calendarSystem WRITE setCalendarSystem NOTIFY calendarSystemChanged)
698+Q_PROPERTY(QString country READ country CONSTANT) //read-only
699+Q_PROPERTY(QString countryDivisionCode READ countryDivisionCode WRITE setCountryDivisionCode NOTIFY countryDivisionCodeChanged)
700+Q_PROPERTY(QString currencyCode READ currencyCode WRITE setCurrencyCode NOTIFY currencyCodeChanged)
701+Q_PROPERTY(QString currencySymbol READ currencySymbol WRITE setCurrencySymbol NOTIFY currencySymbolChanged)
702+Q_PROPERTY(QString dateFormat READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged)
703+Q_PROPERTY(QString dateFormatShort READ dateFormatShort WRITE setDateFormat NOTIFY dateFormatShortChanged)
704+Q_PROPERTY(bool dateMonthNamePossessive READ dateMonthNamePossessive WRITE setDateMonthNamePossessive NOTIFY dateMonthNamePossessiveChanged)
705+Q_PROPERTY(DigitSet dateTimeDigitSet READ dateTimeDigitSet WRITE setDateTimeDigitSet NOTIFY dateTimeDigitSetChanged)
706+Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces NOTIFY decimalPlacesChanged)
707+Q_PROPERTY(QString decimalSymbol READ decimalSymbol WRITE setDecimalSymbol NOTIFY decimalSymbolChanged)
708+Q_PROPERTY(DigitSet digitSet READ digitSet WRITE setDigitSet NOTIFY digitSetChanged)
709+Q_PROPERTY(QString language READ language CONSTANT) //read-only
710+Q_PROPERTY(MeasureSystem measureSystem READ measureSystem WRITE setMeasureSystem NOTIFY measureSystemChanged)
711+Q_PROPERTY(int monetaryDecimalPlaces READ monetaryDecimalPlaces WRITE setMonetaryDecimalPlaces NOTIFY monetaryDecimalPlacesChanged)
712+Q_PROPERTY(QString monetaryDecimalSymbol READ monetaryDecimalSymbol WRITE setMonetaryDecimalSymbol NOTIFY monetaryDecimalSymbolChanged)
713+Q_PROPERTY(DigitSet monetaryDigitSet READ monetaryDigitSet WRITE setMonetaryDigitSet NOTIFY monetaryDigitSetChanged)
714+Q_PROPERTY(QString monetaryThousandsSeparator READ monetaryThousandsSeparator WRITE setMonetaryThousandsSeparator NOTIFY monetaryThousandsSeparatorChanged)
715+Q_PROPERTY(SignPosition negativeMonetarySignPosition READ negativeMonetarySignPosition WRITE setNegativeMonetarySignPosition NOTIFY negativeMonetarySignPositionChanged)
716+Q_PROPERTY(bool negativePrefixCurrencySymbol READ negativePrefixCurrencySymbol WRITE setNegativePrefixCurrencySymbol NOTIFY negativePrefixCurrencySymbolChanged)
717+Q_PROPERTY(QString negativeSign READ negativeSign WRITE setNegativeSign NOTIFY negativeSignChanged)
718+Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged)
719+Q_PROPERTY(SignPosition positiveMonetarySignPosition READ positiveMonetarySignPosition WRITE setPositiveMonetarySignPosition NOTIFY positiveMonetarySignPositionChanged)
720+Q_PROPERTY(bool positivePrefixCurrencySymbol READ positivePrefixCurrencySymbol WRITE setPositivePrefixCurrencySymbol NOTIFY positivePrefixCurrencySymbolChanged)
721+Q_PROPERTY(QString positiveSign READ positiveSign WRITE setPositiveSign NOTIFY positiveSignChanged)
722+Q_PROPERTY(QString thousandsSeparator READ thousandsSeparator WRITE setThousandsSeparator NOTIFY thousandsSeparatorChanged)
723+Q_PROPERTY(int weekDayOfPray READ weekDayOfPray WRITE setWeekDayOfPray NOTIFY weekDayOfPrayChanged)
724+Q_PROPERTY(Locale::WeekNumberSystem weekNumberSystem READ weekNumberSystem WRITE setWeekNumberSystem NOTIFY WeekNumberSystemChanged)
725+Q_PROPERTY(int weekStartDay READ weekStartDay WRITE setWeekStartDay NOTIFY weekStartDayChanged)
726+Q_PROPERTY(int workingWeekEndDay READ workingWeekEndDay WRITE setWorkingWeekEndDay NOTIFY workingWeekEndDayChanged)
727+Q_PROPERTY(int workingWeekStartDay READ workingWeekStartDay WRITE setWorkingWeekStartDay NOTIFY workingWeekStartDayChanged)
728+Q_PROPERTY(bool use12Clock READ use12Clock CONSTANT)
729+Q_PROPERTY(QString defaultLanguage READ defaultLanguage CONSTANT)//read-only
730+Q_PROPERTY(QString defaultCountry READ defaultCountry CONSTANT)//read-only
731+Q_PROPERTY(QString defaultCurrencyCode READ defaultCurrencyCode CONSTANT)//read-only
732+Q_PROPERTY(bool useTranscript READ useTranscript CONSTANT) //read-only
733+Q_PROPERTY(int fileEncodingMib READ fileEncodingMib CONSTANT) //read-only
734+Q_PROPERTY(QStringList languageList READ languageList CONSTANT) //read-only
735+Q_PROPERTY(QStringList currencyCodeList READ currencyCodeList CONSTANT) //read-only
736+Q_PROPERTY(QStringList allLanguagesList READ allLanguagesList CONSTANT) //read-only
737+Q_PROPERTY(QStringList installedLanguages READ installedLanguages CONSTANT) //read-only
738+Q_PROPERTY(QStringList allCountriesList READ allCountriesList CONSTANT) //read-only
739+Q_PROPERTY(QList<int> allDigitSetsList READ allDigitSetsList CONSTANT) //read-only
740+
741+public:
742+ /**
743+ * ctor
744+ */
745+ Locale(QObject *parent = 0);
746+
747+ /**
748+ * Various positions for where to place the positive or negative
749+ * sign when they are related to a monetary value.
750+ */
751+ enum SignPosition {
752+ /**
753+ * Put parantheses around the quantity, e.g. "$ (217)"
754+ */
755+ ParensAround = 0,
756+ /**
757+ * Prefix the quantity with the sign, e.g. "$ -217"
758+ */
759+ BeforeQuantityMoney = 1,
760+ /**
761+ * Suffix the quanitity with the sign, e.g. "$ 217-"
762+ */
763+ AfterQuantityMoney = 2,
764+ /**
765+ * Prefix the currency symbol with the sign, e.g. "-$ 217"
766+ */
767+ BeforeMoney = 3,
768+ /**
769+ * Suffix the currency symbol with the sign, e.g. "$- 217"
770+ */
771+ AfterMoney = 4
772+ };
773+
774+ /**
775+ *
776+ * The set of digit characters used to display and enter numbers.
777+ */
778+ enum DigitSet {
779+ ArabicDigits, /**< 0123456789 (European and some Asian
780+ languages and western Arabic dialects) */
781+ ArabicIndicDigits, /**< Ù ÙĄÙąÙŁÙ€Ù„ÙŠÙ§ÙšÙ© (eastern Arabic dialects) */
782+ EasternArabicIndicDigits, /**< Û°Û±ÛČÛłÛŽÛ”Û¶Û·ÛžÛč (Persian and Urdu) */
783+ DevenagariDigits, /**< à„Šà„§à„šà„©à„Șà„«à„Źà„­à„źà„Ż (Hindi) */
784+ BengaliDigits, /**< ৊১৚৩à§Șà§«à§Źà§­à§źà§Ż (Bengali and Assamese) */
785+ GujaratiDigits, /**< ૊૧૚૩à«Șà««à«Źà«­à«źà«Ż (Gujarati) */
786+ GurmukhiDigits, /**< ੊੧ਗ਼੩à©Șà©«à©Źà©­à©źà©Ż (Punjabi) */
787+ KannadaDigits, /**< àłŠàł§àłšàł©àłȘàł«àłŹàł­àłźàłŻ (Kannada) */
788+ KhmerDigits, /**< áŸ áŸĄáŸąáŸŁáŸ€áŸ„áŸŠáŸ§áŸšáŸ© (Khmer) */
789+ MalayalamDigits, /**< à”Šà”§à”šà”©à”Șà”«à”Źà”­à”źà”Ż (Malayalam) */
790+ OriyaDigits, /**< ୊୧୚୩à­Șà­«à­Źà­­à­źà­Ż (Oriya) */
791+ TamilDigits, /**< àŻŠàŻ§àŻšàŻ©àŻȘàŻ«àŻŹàŻ­àŻź (Tamil) */
792+ TeluguDigits, /**< ొ౧ౚ౩à±Șà±«à±Źà±­à±Ż (Telugu) */
793+ ThaiDigits /**< àčàč‘àč’àč“àč”àč•àč–àč—àč˜àč™ (Thai) */
794+ // The following Decimal Digit Sets are defined in Unicode but the associated
795+ // languages are not yet translated in KDE, so are not yet enabled.
796+ // The script names are taken from the Unicode standard, the associated
797+ // languages from Wikipedia.
798+ // BalineseDigits, /**< ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙ (Balinese) */
799+ // ChamDigits, /**< ꩐꩑꩒꩓꩔꩕꩖꩗꩘꩙ (Cham) */
800+ // JavaneseDigits, /**< ꧐꧑꧒꧓꧔꧕꧖꧗꧘꧙ (Javanese) */
801+ // KayahLiDigits, /**< ꀀꀁꀂꀃꀄꀅꀆꀇꀈꀉ (Kayah) */
802+ // LaoDigits, /**< ໐໑໒໓໔໕໖໗໘໙ (Lao) */
803+ // LepchaDigits, /**< ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉ (Lepcha) */
804+ // LimbuDigits, /**< ᄆᄇᄈᄉᄊᄋᄌᄍᄎᄏ (Limbu) */
805+ // MeeteiMayekDigits, /**< êŻ°êŻ±êŻČêŻłêŻŽêŻ”êŻ¶êŻ·êŻžêŻč (Meitei) */
806+ // MongolianDigits, /**< ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙ (Mongolian) */
807+ // MyanmarDigits, /**< ၀၁၂၃၄၅၆၇၈၉ (Myanmar/Burmese ) */
808+ // MyanmarShanDigits, /**< ႐႑႒႓႔႕႖႗႘႙ (Shan) */
809+ // NewTaiLueDigits, /**< ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙ (Tai LĂŒ) */
810+ // NKoDigits, /**< ߀߁߂߃߄߅߆߇߈߉ (Mande and N'Ko) */
811+ // OlChikiDigits, /**< ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙ (Santali) */
812+ // OsmanyaDigits, /**< Ò ÒĄÒąÒŁÒ€Ò„ÒŠÒ§ÒšÒ© (Somali) */
813+ // SaurashtraDigits, /**< êŁêŁ‘êŁ’êŁ“êŁ”êŁ•êŁ–êŁ—êŁ˜êŁ™ (Saurashtra) */
814+ // SundaneseDigits, /**< áź°áź±áźČ៳៎។៶៷៞áźč (Sundanese) */
815+ // TaiThamDigits, /**< áȘáȘ‘áȘ’áȘ“áȘ”áȘ•áȘ–áȘ—áȘ˜áȘ™ (Tai LĂŒ) */
816+ // TibetanDigits, /**< àŒ àŒĄàŒąàŒŁàŒ€àŒ„àŒŠàŒ§àŒšàŒ© (Tibetan) */
817+ // VaiDigits, /**< ê˜ ê˜Ąê˜ąê˜Łê˜€ê˜„ê˜Šê˜§ê˜šê˜© (Vai) */
818+ };
819+
820+ /**
821+ *
822+ * Convert a digit set identifier to a human readable, localized name.
823+ *
824+ * @param digitSet the digit set identifier
825+ * @param withDigits whether to add the digits themselves to the name
826+ *
827+ * @return the human readable and localized name of the digit set
828+ *
829+ * @see DigitSet
830+ */
831+ QString digitSetToName(DigitSet digitSet, bool withDigits = false) const;
832+
833+ /**
834+ *
835+ * Provides list of all known digit set identifiers.
836+ *
837+ * @return list of all digit set identifiers
838+ * @see DigitSet
839+ * @see digitSetToName
840+ */
841+ QList<int> allDigitSetsList() const;
842+
843+ /**
844+ * Returns what a decimal point should look like ("." or "," etc.)
845+ * according to the current locale or user settings.
846+ *
847+ * @return The decimal symbol used by locale.
848+ */
849+ QString decimalSymbol() const;
850+
851+ /**
852+ * Returns what the thousands separator should look
853+ * like ("," or "." etc.)
854+ * according to the current locale or user settings.
855+ *
856+ * @return The thousands separator used by locale.
857+ */
858+ QString thousandsSeparator() const;
859+
860+ /**
861+ *
862+ * Returns the identifier of the digit set used to display numbers.
863+ *
864+ * @return the digit set identifier
865+ * @see DigitSet
866+ * @see digitSetToName
867+ */
868+ DigitSet digitSet() const;
869+
870+ /**
871+ *
872+ * Returns the ISO 4217 Currency Code for the current locale
873+ *
874+ * @return The default ISO Currency Code used by locale.
875+ */
876+ QString currencyCode() const;
877+
878+ /**
879+ * Returns what the symbol denoting currency in the current locale
880+ * as as defined by user settings should look like.
881+ *
882+ * @return The default currency symbol used by locale.
883+ */
884+ QString currencySymbol() const;
885+
886+ /**
887+ * Returns what a decimal point should look like ("." or "," etc.)
888+ * for monetary values, according to the current locale or user
889+ * settings.
890+ *
891+ * @return The monetary decimal symbol used by locale.
892+ */
893+ QString monetaryDecimalSymbol() const;
894+
895+ /**
896+ * Returns what a thousands separator for monetary values should
897+ * look like ("," or " " etc.) according to the current locale or
898+ * user settings.
899+ *
900+ * @return The monetary thousands separator used by locale.
901+ */
902+ QString monetaryThousandsSeparator() const;
903+
904+ /**
905+ * Returns what a positive sign should look like ("+", " ", etc.)
906+ * according to the current locale or user settings.
907+ *
908+ * @return The positive sign used by locale.
909+ */
910+ QString positiveSign() const;
911+
912+ /**
913+ * Returns what a negative sign should look like ("-", etc.)
914+ * according to the current locale or user settings.
915+ *
916+ * @return The negative sign used by locale.
917+ */
918+ QString negativeSign() const;
919+
920+ /**
921+ *
922+ * The number of decimal places to include in numeric values (usually 2).
923+ *
924+ * @return Default number of numeric decimal places used by locale.
925+ */
926+ int decimalPlaces() const;
927+
928+ /**
929+ *
930+ * The number of decimal places to include in monetary values (usually 2).
931+ *
932+ * @return Default number of monetary decimal places used by locale.
933+ */
934+ int monetaryDecimalPlaces() const;
935+
936+ /**
937+ * If and only if the currency symbol precedes a positive value,
938+ * this will be true.
939+ *
940+ * @return Where to print the currency symbol for positive numbers.
941+ */
942+ bool positivePrefixCurrencySymbol() const;
943+
944+ /**
945+ * If and only if the currency symbol precedes a negative value,
946+ * this will be true.
947+ *
948+ * @return True if the currency symbol precedes negative numbers.
949+ */
950+ bool negativePrefixCurrencySymbol() const;
951+
952+ /**
953+ * Returns the position of a positive sign in relation to a
954+ * monetary value.
955+ *
956+ * @return Where/how to print the positive sign.
957+ * @see SignPosition
958+ */
959+ SignPosition positiveMonetarySignPosition() const;
960+
961+ /**
962+ * Denotes where to place a negative sign in relation to a
963+ * monetary value.
964+ *
965+ * @return Where/how to print the negative sign.
966+ * @see SignPosition
967+ */
968+ SignPosition negativeMonetarySignPosition() const;
969+
970+ /**
971+ *
972+ * Retuns the digit set used to display monetary values.
973+ *
974+ * @return the digit set identifier
975+ * @see DigitSet
976+ * @see digitSetToName
977+ */
978+ DigitSet monetaryDigitSet() const;
979+
980+ /**
981+ * Given a double, converts that to a numeric string containing
982+ * the localized monetary equivalent.
983+ *
984+ * e.g. given 123456, return "$ 123,456.00".
985+ *
986+ * If precision isn't specified or is < 0, then the default monetaryDecimalPlaces() is used.
987+ *
988+ * @param num The number we want to format
989+ * @param currency The currency symbol you want.
990+ * @param precision Number of decimal places displayed
991+ *
992+ * @return The number of money as a localized string
993+ * @see monetaryDecimalPlaces()
994+ */
995+ Q_INVOKABLE QString formatMoney(double num, const QString &currency = QString(), int precision = -1) const;
996+
997+ /**
998+ * Given a string representing a number, converts that to a numeric
999+ * string containing the localized numeric equivalent.
1000+ *
1001+ * e.g. given 123456.78F, return "123,456.78" (for some European country).
1002+ *
1003+ * If precision isn't specified or is < 0, then the default decimalPlaces() is used.
1004+ *
1005+ * @param numStr The number to format, as a string.
1006+ * @param round Round fractional digits. (default true)
1007+ * @param precision Number of fractional digits used for rounding. Unused if round=false.
1008+ *
1009+ * @return The number as a localized string
1010+ */
1011+ Q_INVOKABLE QString formatNumber(const QString &numStr, bool round = true, int precision = -1) const;
1012+
1013+ /**
1014+ * Given an integer, converts that to a numeric string containing
1015+ * the localized numeric equivalent.
1016+ *
1017+ * e.g. given 123456L, return "123,456" (for some European country).
1018+ *
1019+ * @param num The number to convert
1020+ *
1021+ * @return The number as a localized string
1022+ */
1023+ Q_INVOKABLE QString formatLong(long num) const;
1024+
1025+ /**
1026+ * These binary units are used in KDE by the formatByteSize()
1027+ * functions.
1028+ *
1029+ * NOTE: There are several different units standards:
1030+ * 1) SI (i.e. metric), powers-of-10.
1031+ * 2) IEC, powers-of-2, with specific units KiB, MiB, etc.
1032+ * 3) JEDEC, powers-of-2, used for solid state memory sizing which
1033+ * is why you see flash cards labels as e.g. 4GB. These (ab)use
1034+ * the metric units. Although JEDEC only defines KB, MB, GB, if
1035+ * JEDEC is selected all units will be powers-of-2 with metric
1036+ * prefixes for clarity in the event of sizes larger than 1024 GB.
1037+ *
1038+ * Although 3 different dialects are possible this enum only uses
1039+ * metric names since adding all 3 different names of essentially the same
1040+ * unit would be pointless. Use BinaryUnitDialect to control the exact
1041+ * units returned.
1042+ *
1043+ * @see binaryUnitDialect
1044+ */
1045+ enum BinarySizeUnits {
1046+ /// Auto-choose a unit such that the result is in the range [0, 1000 or 1024)
1047+ DefaultBinaryUnits = 1000,
1048+
1049+ // The first real unit must be 0 for the current implementation!
1050+ UnitByte = 0, ///< B 1 byte
1051+ UnitKiloByte, ///< KiB/KB/kB 1024/1000 bytes.
1052+ UnitMegaByte, ///< MiB/MB/MB 2^20/10^06 bytes.
1053+ UnitGigaByte, ///< GiB/GB/GB 2^30/10^09 bytes.
1054+ UnitTeraByte, ///< TiB/TB/TB 2^40/10^12 bytes.
1055+ UnitPetaByte, ///< PiB/PB/PB 2^50/10^15 bytes.
1056+ UnitExaByte, ///< EiB/EB/EB 2^60/10^18 bytes.
1057+ UnitZettaByte, ///< ZiB/ZB/ZB 2^70/10^21 bytes.
1058+ UnitYottaByte, ///< YiB/YB/YB 2^80/10^24 bytes.
1059+ UnitLastUnit = UnitYottaByte
1060+ };
1061+
1062+ /**
1063+ * This enum chooses what dialect is used for binary units.
1064+ *
1065+ * Note: Although JEDEC abuses the metric prefixes and can therefore be
1066+ * confusing, it has been used to describe *memory* sizes for quite some time
1067+ * and programs should therefore use either Default, JEDEC, or IEC 60027-2
1068+ * for memory sizes.
1069+ *
1070+ * On the other hand network transmission rates are typically in metric so
1071+ * Default, Metric, or IEC (which is unambiguous) should be chosen.
1072+ *
1073+ * Normally choosing DefaultBinaryUnits is the best option as that uses
1074+ * the user's selection for units.
1075+ *
1076+ * @see binaryUnitDialect
1077+ * @see setBinaryUnitDialect
1078+ */
1079+ enum BinaryUnitDialect {
1080+ DefaultBinaryDialect = 1000, ///< Used if no specific preference
1081+ IECBinaryDialect = 0, ///< KDE Default, KiB, MiB, etc. 2^(10*n)
1082+ JEDECBinaryDialect, ///< KDE 3.5 default, KB, MB, etc. 2^(10*n)
1083+ MetricBinaryDialect, ///< SI Units, kB, MB, etc. 10^(3*n)
1084+ LastBinaryDialect = MetricBinaryDialect
1085+ };
1086+
1087+ /**
1088+ * Converts @p size from bytes to the string representation using the
1089+ * user's default binary unit dialect. The default unit dialect is
1090+ * IEC 60027-2.
1091+ *
1092+ * Example:
1093+ * formatByteSize(1024) returns "1.0 KiB" by default.
1094+ *
1095+ * @param size size in bytes
1096+ * @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
1097+ * @see BinaryUnitDialect
1098+ * @todo KDE 5: Remove in favor of overload added in KDE 4.4.
1099+ */
1100+ Q_INVOKABLE QString formatByteSize(double size) const;
1101+
1102+ /**
1103+ *
1104+ * Converts @p size from bytes to the appropriate string representation
1105+ * using the binary unit dialect @p dialect and the specific units @p specificUnit.
1106+ *
1107+ * Example:
1108+ * formatByteSize(1000, unit, Locale::BinaryUnitKilo) returns:
1109+ * for Locale::MetricBinaryUnits, "1.0 kB",
1110+ * for Locale::IECBinaryUnits, "0.9 KiB",
1111+ * for Locale::JEDECBinaryUnits, "0.9 KB".
1112+ *
1113+ * @param size size in bytes
1114+ * @param precision number of places after the decimal point to use. KDE uses
1115+ * 1 by default so when in doubt use 1.
1116+ * @param dialect binary unit standard to use. Use DefaultBinaryUnits to
1117+ * use the localized user selection unless you need to use a specific
1118+ * unit type (such as displaying a flash memory size in JEDEC).
1119+ * @param specificUnit specific unit size to use in result. Use
1120+ * DefaultBinarySize to automatically select a unit that will return
1121+ * a sanely-sized number.
1122+ * @return converted size as a translated string including the units.
1123+ * E.g. "1.23 KiB", "2 GB" (JEDEC), "4.2 kB" (Metric).
1124+ * @see BinaryUnitDialect
1125+ */
1126+ QString formatByteSize(double size, int precision,
1127+ BinaryUnitDialect dialect = Locale::DefaultBinaryDialect,
1128+ BinarySizeUnits specificUnit = Locale::DefaultBinaryUnits) const;
1129+
1130+ /**
1131+ * Returns the user's configured binary unit dialect.
1132+ * e.g. if MetricBinaryDialect is returned then the values
1133+ * configured for how much a set of bytes are worth would
1134+ * be 10^(3*n) and KB (1000 bytes == 1 KB), in this case.
1135+ *
1136+ * Will never return DefaultBinaryDialect.
1137+ *
1138+ * @return User's configured binary unit dialect
1139+ * @see BinaryUnitDialect
1140+ */
1141+ BinaryUnitDialect binaryUnitDialect() const;
1142+
1143+ /**
1144+ * Sets @p newDialect to be the default dialect for this locale (and only
1145+ * this locale). Newly created KLocale objects will continue to default
1146+ * to the user's choice.
1147+ *
1148+ * @param newDialect the new dialect to set as default for this locale object.
1149+ */
1150+ void setBinaryUnitDialect(BinaryUnitDialect newDialect);
1151+
1152+ /**
1153+ * Given a number of milliseconds, converts that to a string containing
1154+ * the localized equivalent
1155+ *
1156+ * e.g. given formatDuration(60000), returns "1.0 minutes"
1157+ *
1158+ * @param mSec Time duration in milliseconds
1159+ * @return converted duration as a string - e.g. "5.5 seconds" "23.0 minutes"
1160+ */
1161+ Q_INVOKABLE QString formatDuration(unsigned long mSec) const;
1162+
1163+ /**
1164+ * Given a number of milliseconds, converts that to a pretty string containing
1165+ * the localized equivalent.
1166+ *
1167+ * e.g. given prettyFormatDuration(60001) returns "1 minute"
1168+ * given prettyFormatDuration(62005) returns "1 minute and 2 seconds"
1169+ * given prettyFormatDuration(90060000) returns "1 day and 1 hour"
1170+ *
1171+ * @param mSec Time duration in milliseconds
1172+ * @return converted duration as a string.
1173+ * Units not interesting to the user, for example seconds or minutes when the first
1174+ * unit is day, are not returned because they are irrelevant. The same applies for
1175+ * seconds when the first unit is hour.
1176+ */
1177+ Q_INVOKABLE QString prettyFormatDuration(unsigned long mSec) const;
1178+
1179+ /**
1180+ *
1181+ * Available Calendar Systems
1182+ *
1183+ * @see setCalendarSystem()
1184+ * @see calendarSystem()
1185+ */
1186+ enum CalendarSystem {
1187+ QDateCalendar = 1, /**< KDE Default, hybrid of Gregorian and Julian as used by QDate */
1188+ //BahaiCalendar = 2, /**< Baha'i Calendar */
1189+ //BuddhistLunarCalendar = 3, /**< Buddhist Lunar Calendar*/
1190+ //ChineseCalendar = 4, /**< Chinese Calendar */
1191+ CopticCalendar = 5, /**< Coptic Calendar as used Coptic Church and some parts of Egypt */
1192+ EthiopianCalendar = 6, /**< Ethiopian Calendar, aka Ethiopic Calendar */
1193+ //EthiopianAmeteAlemCalendar = 7, /**< Ethiopian Amete Alem version, aka Ethiopic Amete Alem */
1194+ GregorianCalendar = 8, /**< Gregorian Calendar, pure proleptic implementation */
1195+ HebrewCalendar = 9, /**< Hebrew Calendar, aka Jewish Calendar */
1196+ //HinduCalendar = 10, /**< Hindu Lunar Calendar */
1197+ //IslamicLunarCalendar = 11, /**< Islamic Lunar Calendar */
1198+ IslamicCivilCalendar = 12, /**< Islamic Civil Calendar, aka Hijri, not the Lunar Calendar */
1199+ //IslamicUmAlQuraCalendar = 13, /**< Islamic Lunar Calendar, Um Al Qura varient used in Saudi Arabia */
1200+ IndianNationalCalendar = 14, /**< Indian National Calendar, not the Lunar Calendar */
1201+ //Iso8601Calendar = 15, /**< ISO 8601 Standard Calendar */
1202+ JalaliCalendar = 16, /**< Jalali Calendar, aka Persian or Iranian, also used in Afghanistan */
1203+ //JalaliBirashkCalendar = 17, /**< Jalali Calendar, Birashk Algorythm variant */
1204+ //Jalali33YearCalendar = 18, /**< Jalali Calendar, 33 Year cycle variant */
1205+ JapaneseCalendar= 19, /**< Japanese Calendar, Gregorian calculation using Japanese Era (NengĂŽ) */
1206+ //JucheCalendar = 20, /**< Juche Calendar, used in North Korea */
1207+ JulianCalendar = 21, /**< Julian Calendar, as used in Orthodox Churches */
1208+ MinguoCalendar= 22, /**< Minguo Calendar, aka ROC, Republic of China or Taiwanese */
1209+ ThaiCalendar = 23 /**< Thai Calendar, aka Buddhist or Thai Buddhist */
1210+ };
1211+
1212+ /**
1213+ *
1214+ * System used for Week Numbers
1215+ *
1216+ * @see setWeekNumberSystem()
1217+ * @see weekNumberSystem()
1218+ */
1219+ enum WeekNumberSystem {
1220+ DefaultWeekNumber = 1000, /**< The system locale default */
1221+ IsoWeekNumber = 0, /**< ISO Week Number */
1222+ FirstFullWeek = 1, /**< Week 1 starts on the first Week Start Day in year ends after 7 days */
1223+ FirstPartialWeek = 2, /**< Week 1 starts Jan 1st ends day before first Week Start Day in year */
1224+ SimpleWeek = 3 /**< Week 1 starts Jan 1st ends after 7 days */
1225+ };
1226+
1227+ /**
1228+ *
1229+ * The various Components that make up a Date / Time
1230+ * In the future the Components may be combined as flags for dynamic
1231+ * generation of Date Formats.
1232+ *
1233+ * @see CalendarSystem
1234+ * @see KLocalizedDate
1235+ * @see DateTimeComponentFormat
1236+ */
1237+ enum DateTimeComponent {
1238+ Year = 0x1, /**< The Year portion of a date, may be number or name */
1239+ YearName = 0x2, /**< The Year Name portion of a date */
1240+ Month = 0x4, /**< The Month portion of a date, may be number or name */
1241+ MonthName = 0x8, /**< The Month Name portion of a date */
1242+ Day = 0x10, /**< The Day portion of a date, may be number or name */
1243+ DayName = 0x20, /**< The Day Name portion of a date */
1244+ JulianDay = 0x40, /**< The Julian Day of a date */
1245+ EraName = 0x80, /**< The Era Name portion of a date */
1246+ EraYear = 0x100, /**< The Era and Year portion of a date */
1247+ YearInEra = 0x200, /**< The Year In Era portion of a date */
1248+ DayOfYear = 0x400, /**< The Day Of Year portion of a date, may be number or name */
1249+ DayOfYearName = 0x800, /**< The Day Of Year Name portion of a date */
1250+ DayOfWeek = 0x1000, /**< The Day Of Week / Weekday portion of a date, may be number or name */
1251+ DayOfWeekName = 0x2000, /**< The Day Of Week Name / Weekday Name portion of a date */
1252+ Week = 0x4000, /**< The Week Number portion of a date */
1253+ WeekYear = 0x8000, /**< The Week Year portion of a date */
1254+ MonthsInYear = 0x10000, /**< The Months In Year portion of a date */
1255+ WeeksInYear = 0x20000, /**< The Weeks In Year portion of a date */
1256+ DaysInYear = 0x40000, /**< The Days In Year portion of a date */
1257+ DaysInMonth = 0x80000, /**< The Days In Month portion of a date */
1258+ DaysInWeek = 0x100000, /**< The Days In Week portion of a date */
1259+ Hour = 0x200000, /**< The Hours portion of a date */
1260+ Minute = 0x400000, /**< The Minutes portion of a date */
1261+ Second = 0x800000, /**< The Seconds portion of a date */
1262+ Millisecond = 0x1000000, /**< The Milliseconds portion of a date */
1263+ DayPeriod = 0x2000000, /**< The Day Period portion of a date, e.g. AM/PM */
1264+ DayPeriodHour = 0x4000000, /**< The Day Period Hour portion of a date */
1265+ Timezone = 0x8000000, /**< The Time Zone portion of a date, may be offset or name */
1266+ TimezoneName = 0x10000000, /**< The Time Zone Name portion of a date */
1267+ UnixTime = 0x20000000 /**< The UNIX Time portion of a date */
1268+ };
1269+
1270+ /**
1271+ *
1272+ * Format used for individual Date/Time Components when converted to/from a string
1273+ * Largely equivalent to the UNICODE CLDR format width definitions 1..5
1274+ *
1275+ * @see DateTimeComponentFormat
1276+ */
1277+ enum DateTimeComponentFormat {
1278+ DefaultComponentFormat = 1000, /**< The system locale default for the componant */
1279+ ShortNumber = 0, /**< Number at its natural width, e.g. 2 for the 2nd*/
1280+ LongNumber, /**< Number padded to a required width, e.g. 02 for the 2nd*/
1281+ //OrdinalNumber /**< Ordinal number format, e.g. "2nd" for the 2nd */
1282+ NarrowName = 3, /**< Narrow text format, may not be unique, e.g. M for Monday */
1283+ ShortName, /**< Short text format, e.g. Mon for Monday */
1284+ LongName /**< Long text format, e.g. Monday for Monday */
1285+ };
1286+
1287+ Q_DECLARE_FLAGS(DateTimeComponents, DateTimeComponent)
1288+
1289+ /**
1290+ * Format for date string.
1291+ */
1292+ enum DateFormat {
1293+ ShortDate, /**< Locale Short date format, e.g. 08-04-2007 */
1294+ LongDate, /**< Locale Long date format, e.g. Sunday 08 April 2007 */
1295+ FancyShortDate, /**< Same as ShortDate for dates a week or more ago. For more
1296+ recent dates, it is represented as Today, Yesterday, or
1297+ the weekday name. */
1298+ FancyLongDate, /**< Same as LongDate for dates a week or more ago. For more
1299+ recent dates, it is represented as Today, Yesterday, or
1300+ the weekday name. */
1301+ IsoDate, /**< ISO-8601 Date format YYYY-MM-DD, e.g. 2009-12-31 */
1302+ IsoWeekDate, /**< ISO-8601 Week Date format YYYY-Www-D, e.g. 2009-W01-1 */
1303+ IsoOrdinalDate /**< ISO-8601 Ordinal Date format YYYY-DDD, e.g. 2009-001 */
1304+ };
1305+
1306+ /**
1307+ * Returns a string formatted to the current locale's conventions
1308+ * regarding dates.
1309+ *
1310+ * @param date the date to be formatted
1311+ * @param format category of date format to use
1312+ *
1313+ * @return the date as a string
1314+ */
1315+ Q_INVOKABLE QString formatDate(const QDate &date, DateFormat format = LongDate) const;
1316+
1317+ /**
1318+ * Options for formatting date-time values.
1319+ */
1320+ enum DateTimeFormatOption {
1321+ TimeZone = 0x01, /**< Include a time zone string */
1322+ Seconds = 0x02 /**< Include the seconds value */
1323+ };
1324+
1325+ Q_DECLARE_FLAGS(DateTimeFormatOptions, DateTimeFormatOption)
1326+
1327+ /**
1328+ * Returns a string formatted to the current locale's conventions
1329+ * regarding both date and time.
1330+ *
1331+ * @param dateTime the date and time to be formatted
1332+ * @param format category of date format to use
1333+ * @param options additional output options
1334+ *
1335+ * @return The date and time as a string
1336+ */
1337+ Q_INVOKABLE QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
1338+ DateTimeFormatOptions options = 0) const;
1339+
1340+ /**
1341+ * Use this to determine whether in dates a possessive form of month
1342+ * name is preferred ("of January" rather than "January")
1343+ *
1344+ * @return If possessive form should be used
1345+ */
1346+ bool dateMonthNamePossessive() const;
1347+
1348+ /**
1349+ *
1350+ * Format flags for readLocaleTime() and formatLocaleTime()
1351+ */
1352+ enum TimeFormatOption {
1353+ TimeDefault = 0x0, ///< Default formatting using seconds and the format
1354+ ///< as specified by the locale.
1355+ TimeWithoutSeconds = 0x1, ///< Exclude the seconds part of the time from display
1356+ TimeWithoutAmPm = 0x2, ///< Read/format time string without am/pm suffix but
1357+ ///< keep the 12/24h format as specified by locale time
1358+ ///< format, eg. "07.33.05" instead of "07.33.05 pm" for
1359+ ///< time format "%I.%M.%S %p".
1360+ TimeDuration = 0x6, ///< Read/format time string as duration. This will strip
1361+ ///< the am/pm suffix and read/format times with an hour
1362+ ///< value of 0-23 hours, eg. "19.33.05" instead of
1363+ ///< "07.33.05 pm" for time format "%I.%M.%S %p".
1364+ ///< This automatically implies @c TimeWithoutAmPm.
1365+ TimeFoldHours = 0xE ///< Read/format time string as duration. This will not
1366+ ///< not output the hours part of the duration but will
1367+ ///< add the hours (times sixty) to the number of minutes,
1368+ ///< eg. "70.23" instead of "01.10.23" for time format
1369+ ///< "%I.%M.%S %p".
1370+ };
1371+
1372+ Q_DECLARE_FLAGS(TimeFormatOptions, TimeFormatOption)
1373+
1374+ /**
1375+ *
1376+ * Returns a string formatted to the current locale's conventions
1377+ * regarding times.
1378+ *
1379+ * @param pTime the time to be formatted
1380+ * @param options format option to use when formatting the time
1381+ * @return The time as a string
1382+ */
1383+ Q_INVOKABLE QString formatLocaleTime(const QTime &pTime,
1384+ TimeFormatOptions options = Locale::TimeDefault) const;
1385+
1386+ /**
1387+ *
1388+ * Returns the identifier of the digit set used to display dates and time.
1389+ *
1390+ * @return the digit set identifier
1391+ * @see DigitSet
1392+ * @see digitSetToName
1393+ */
1394+ DigitSet dateTimeDigitSet() const;
1395+
1396+ /**
1397+ * Use this to determine if the user wants a 12 hour clock.
1398+ *
1399+ * @return If the user wants 12h clock
1400+ */
1401+ bool use12Clock() const;
1402+
1403+ /**
1404+ *
1405+ * Returns the Day Period matching the time given
1406+ *
1407+ * @param time the time to return the day period for
1408+ * @param format the format to return teh day period in
1409+ * @return the Day Period for the given time
1410+ */
1411+ Q_INVOKABLE QString dayPeriodText(const QTime &time, DateTimeComponentFormat format = DefaultComponentFormat) const;
1412+
1413+ /**
1414+ * Use this to determine which day is the first day of the week.
1415+ *
1416+ * @return an integer (Monday=1..Sunday=7)
1417+ */
1418+ int weekStartDay() const;
1419+
1420+ /**
1421+ * Use this to determine which day is the first working day of the week.
1422+ *
1423+ * @return an integer (Monday=1..Sunday=7)
1424+ */
1425+ int workingWeekStartDay() const;
1426+
1427+ /**
1428+ * Use this to determine which day is the last working day of the week.
1429+ *
1430+ * @return an integer (Monday=1..Sunday=7)
1431+ */
1432+ int workingWeekEndDay() const;
1433+
1434+ /**
1435+ * Use this to determine which day is reserved for religious observance
1436+ *
1437+ * @return day number (None = 0, Monday = 1, ..., Sunday = 7)
1438+ */
1439+ int weekDayOfPray() const;
1440+
1441+ /**
1442+ *
1443+ * Returns the type of Calendar System used in this Locale
1444+ *
1445+ * @see Locale::CalendarSystem
1446+ * @see CalendarSystem
1447+ * @return the type of Calendar System
1448+ */
1449+ Locale::CalendarSystem calendarSystem() const;
1450+
1451+ /**
1452+ *
1453+ * Sets the type of Calendar System to use in this Locale
1454+ *
1455+ * @see Locale::CalendarSystem
1456+ * @see CalendarSystem
1457+ * @param calendarSystem the Calendar System to use
1458+ */
1459+ void setCalendarSystem(Locale::CalendarSystem calendarSystem);
1460+
1461+ /**
1462+ *
1463+ * Sets the type of Week Number System to use in this Locale
1464+ *
1465+ * @see Klocale::WeekNumberSystem
1466+ * @see weekNumberSystem()
1467+ * @param weekNumberSystem the Week Number System to use
1468+ */
1469+ void setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem);
1470+
1471+ /**
1472+ *
1473+ * Returns the type of Week Number System used in this Locale
1474+ *
1475+ * @see Klocale::WeekNumberSystem
1476+ * @see setWeekNumberSystem()
1477+ * @returns the Week Number System used
1478+ */
1479+ Locale::WeekNumberSystem weekNumberSystem() const;
1480+
1481+ /**
1482+ * Converts a localized monetary string to a double.
1483+ *
1484+ * @param numStr the string we want to convert.
1485+ * @param ok the boolean that is set to false if it's not a number.
1486+ * If @p ok is 0, it will be ignored
1487+ *
1488+ * @return The string converted to a double
1489+ */
1490+ Q_INVOKABLE double readMoney(const QString &numStr) const;
1491+
1492+ /**
1493+ * Converts a localized numeric string to a double.
1494+ *
1495+ * @param numStr the string we want to convert.
1496+ * @return The string converted to a double
1497+ */
1498+ Q_INVOKABLE double readNumber(const QString &numStr) const;
1499+
1500+ /**
1501+ * Flags for readDate()
1502+ */
1503+ enum ReadDateFlags {
1504+ NormalFormat = 1, /**< Only accept a date string in
1505+ the locale LongDate format */
1506+ ShortFormat = 2, /**< Only accept a date string in
1507+ the locale ShortDate format */
1508+ IsoFormat = 4, /**< Only accept a date string in
1509+ ISO date format (YYYY-MM-DD) */
1510+ IsoWeekFormat = 8, /**< Only accept a date string in
1511+ ISO Week date format (YYYY-Www-D) */
1512+ IsoOrdinalFormat = 16 /**< Only accept a date string in
1513+ ISO Week date format (YYYY-DDD) */
1514+ };
1515+
1516+ /**
1517+ * Converts a localized date string to a QDate.
1518+ * This method is stricter than readDate(str,&ok): it will only accept
1519+ * a date in a specific format, depending on @p flags.
1520+ *
1521+ * @param str the string we want to convert.
1522+ * @param flags what format the the date string will be in
1523+ * @return The string converted to a QDate
1524+ * @see CalendarSystem::readDate()
1525+ */
1526+ Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags) const;
1527+
1528+ /**
1529+ * Converts a localized time string to a QTime.
1530+ * This method will try to parse it with seconds, then without seconds.
1531+ *
1532+ * @param str the string we want to convert.
1533+ *
1534+ * @return The string converted to a QTime
1535+ */
1536+ Q_INVOKABLE QTime readTime(const QString &str) const;
1537+
1538+ /**
1539+ * Additional processing options for readLocaleTime().
1540+ *
1541+ * @remarks This is currently used as an enum but declared as a flag
1542+ * to be extensible
1543+ */
1544+ enum TimeProcessingOption {
1545+ ProcessStrict = 0x1, ///< Process time in a strict manner, ie.
1546+ ///< a read time string has to exactly match
1547+ ///< the defined time format.
1548+ ProcessNonStrict = 0x2 ///< Process time in a lax manner, ie.
1549+ ///< allow spaces in the time-format to be
1550+ ///< left out when entering a time string.
1551+ };
1552+
1553+ Q_DECLARE_FLAGS(TimeProcessingOptions, TimeProcessingOption)
1554+
1555+ /**
1556+ *
1557+ * Converts a localized time string to a QTime.
1558+ * This method is stricter than readTime(str, &ok) in that it will either
1559+ * accept a time with seconds or a time without seconds.
1560+ *
1561+ * @param str the string we want to convert
1562+ * @param ok the boolean that is set to false if it's not a valid time.
1563+ * If @p ok is 0, it will be ignored.
1564+ * @param options format option to apply when formatting the time
1565+ * @param processing if set to @c ProcessStrict, checking will be strict
1566+ * and the read time string has to have the exact time format
1567+ * specified. If set to @c ProcessNonStrict processing the time
1568+ * is lax and spaces in the time string can be left out.
1569+ *
1570+ * @return The string converted to a QTime
1571+ */
1572+
1573+ Q_INVOKABLE QTime readLocaleTime(const QString &str,
1574+ TimeFormatOptions options = Locale::TimeDefault,
1575+ TimeProcessingOptions processing = ProcessNonStrict) const;
1576+
1577+ /**
1578+ * Returns the language code used by this object. The domain AND the
1579+ * library translation must be available in this language.
1580+ * defaultLanguage() is returned by default, if no other available.
1581+ *
1582+ * Use languageCodeToName(language) to get human readable, localized
1583+ * language name.
1584+ *
1585+ * @return the currently used language code
1586+ *
1587+ * @see languageCodeToName
1588+ */
1589+ QString language() const;
1590+
1591+ /**
1592+ * Returns the country code of the country where the user lives.
1593+ *
1594+ * The returned code complies with the ISO 3166-1 alpha-2 standard,
1595+ * except by KDE convention it is returned in lowercase whereas the
1596+ * official standard is uppercase.
1597+ * See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for details.
1598+ *
1599+ * defaultCountry() is returned by default, if no other available,
1600+ * this will always be uppercase 'C'.
1601+ *
1602+ * Use countryCodeToName(country) to get human readable, localized
1603+ * country names.
1604+ *
1605+ * @return the country code for the user
1606+ *
1607+ * @see countryCodeToName
1608+ */
1609+ QString country() const;
1610+
1611+ /**
1612+ *
1613+ * Returns the Country Division Code of the Country where the user lives.
1614+ * When no value is set, then the Country Code will be returned.
1615+ *
1616+ * The returned code complies with the ISO 3166-2 standard.
1617+ * See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
1618+ *
1619+ * Note that unlike country() this method will return the correct case,
1620+ * i.e. normally uppercase..
1621+ *
1622+ * In KDE 4.6 it is the apps responsibility to obtain a translation for the
1623+ * code, translation and other services will be priovided in KDE 4.7.
1624+ *
1625+ * @return the Country Division Code for the user
1626+ * @see setCountryDivisionCode
1627+ */
1628+ QString countryDivisionCode() const;
1629+
1630+ /**
1631+ * Returns the language codes selected by user, ordered by decreasing
1632+ * priority.
1633+ *
1634+ * Use languageCodeToName(language) to get human readable, localized
1635+ * language name.
1636+ *
1637+ * @return list of language codes
1638+ *
1639+ * @see languageCodeToName
1640+ */
1641+ QStringList languageList() const;
1642+
1643+ /**
1644+ *
1645+ * Returns the ISO Currency Codes used in the locale, ordered by decreasing
1646+ * priority.
1647+ *
1648+ * Use KCurrency::currencyCodeToName(currencyCode) to get human readable,
1649+ * localized language name.
1650+ *
1651+ * @return list of ISO Currency Codes
1652+ *
1653+ * @see currencyCodeToName
1654+ */
1655+ QStringList currencyCodeList() const;
1656+
1657+ /**
1658+ * Returns the file encoding.
1659+ *
1660+ * @return The Mib of the file encoding
1661+ *
1662+ * @see QFile::encodeName
1663+ * @see QFile::decodeName
1664+ */
1665+ int fileEncodingMib() const;
1666+
1667+ /**
1668+ * Changes the current date format.
1669+ *
1670+ * The format of the date is a string which contains variables that will
1671+ * be replaced:
1672+ * @li %Y with the whole year (e.g. "2004" for "2004")
1673+ * @li %y with the lower 2 digits of the year (e.g. "04" for "2004")
1674+ * @li %n with the month (January="1", December="12")
1675+ * @li %m with the month with two digits (January="01", December="12")
1676+ * @li %e with the day of the month (e.g. "1" on the first of march)
1677+ * @li %d with the day of the month with two digits (e.g. "01" on the first of march)
1678+ * @li %b with the short form of the month (e.g. "Jan" for January)
1679+ * @li %B with the long form of the month (e.g. "January")
1680+ * @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
1681+ * @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
1682+ *
1683+ * Everything else in the format string will be taken as is.
1684+ * For example, March 20th 1989 with the format "%y:%m:%d" results
1685+ * in "89:03:20".
1686+ *
1687+ * @param format The new date format
1688+ */
1689+ void setDateFormat(const QString & format);
1690+
1691+ /**
1692+ * Changes the current short date format.
1693+ *
1694+ * The format of the date is a string which contains variables that will
1695+ * be replaced:
1696+ * @li %Y with the whole year (e.g. "1984" for "1984")
1697+ * @li %y with the lower 2 digits of the year (e.g. "84" for "1984")
1698+ * @li %n with the month (January="1", December="12")
1699+ * @li %m with the month with two digits (January="01", December="12")
1700+ * @li %e with the day of the month (e.g. "1" on the first of march)
1701+ * @li %d with the day of the month with two digits(e.g. "01" on the first of march)
1702+ * @li %b with the short form of the month (e.g. "Jan" for January)
1703+ * @li %B with the long form of the month (e.g. "January")
1704+ * @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
1705+ * @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
1706+ *
1707+ * Everything else in the format string will be taken as is.
1708+ * For example, March 20th 1989 with the format "%y:%m:%d" results
1709+ * in "89:03:20".
1710+ *
1711+ * @param format The new short date format
1712+ */
1713+ void setDateFormatShort(const QString & format);
1714+
1715+ /**
1716+ * Changes the form of month name used in dates.
1717+ *
1718+ * @param possessive True if possessive forms should be used
1719+ */
1720+ void setDateMonthNamePossessive(bool possessive);
1721+
1722+ /**
1723+ * Changes the current time format.
1724+ *
1725+ * The format of the time is string a which contains variables that will
1726+ * be replaced:
1727+ * @li %H with the hour in 24h format and 2 digits (e.g. 5pm is "17", 5am is "05")
1728+ * @li %k with the hour in 24h format and one digits (e.g. 5pm is "17", 5am is "5")
1729+ * @li %I with the hour in 12h format and 2 digits (e.g. 5pm is "05", 5am is "05")
1730+ * @li %l with the hour in 12h format and one digits (e.g. 5pm is "5", 5am is "5")
1731+ * @li %M with the minute with 2 digits (e.g. the minute of 07:02:09 is "02")
1732+ * @li %S with the seconds with 2 digits (e.g. the minute of 07:02:09 is "09")
1733+ * @li %p with pm or am (e.g. 17.00 is "pm", 05.00 is "am")
1734+ *
1735+ * Everything else in the format string will be taken as is.
1736+ * For example, 5.23pm with the format "%H:%M" results
1737+ * in "17:23".
1738+ *
1739+ * @param format The new time format
1740+ */
1741+ void setTimeFormat(const QString & format);
1742+
1743+ /**
1744+ *
1745+ * Set digit characters used to display dates and time.
1746+ *
1747+ * @param digitSet the digit set identifier
1748+ * @see DigitSet
1749+ */
1750+ void setDateTimeDigitSet(DigitSet digitSet);
1751+
1752+ /**
1753+ * Changes how KLocale defines the first day in week.
1754+ *
1755+ * @param day first day of the week (Monday=1..Sunday=7) as integer
1756+ */
1757+ void setWeekStartDay(int day);
1758+
1759+ /**
1760+ * Changes how KLocale defines the first working day in week.
1761+ *
1762+ * @param day first working day of the week (Monday=1..Sunday=7) as integer
1763+ */
1764+ void setWorkingWeekStartDay(int day);
1765+
1766+ /**
1767+ * Changes how KLocale defines the last working day in week.
1768+ *
1769+ * @param day last working day of the week (Monday=1..Sunday=7) as integer
1770+ */
1771+ void setWorkingWeekEndDay(int day);
1772+
1773+ /**
1774+ * Changes how KLocale defines the day reserved for religious observance.
1775+ *
1776+ * @param day day of the week for religious observance (None=0,Monday=1..Sunday=7) as integer
1777+ */
1778+ void setWeekDayOfPray(int day);
1779+
1780+ /**
1781+ * Returns the currently selected date format.
1782+ *
1783+ * @return Current date format.
1784+ * @see setDateFormat()
1785+ */
1786+ QString dateFormat() const;
1787+
1788+ /**
1789+ * Returns the currently selected short date format.
1790+ *
1791+ * @return Current short date format.
1792+ * @see setDateFormatShort()
1793+ */
1794+ QString dateFormatShort() const;
1795+
1796+ /**
1797+ * Returns the currently selected time format.
1798+ *
1799+ * @return Current time format.
1800+ * @see setTimeFormat()
1801+ */
1802+ QString timeFormat() const;
1803+
1804+ /**
1805+ * Changes the symbol used to identify the decimal pointer.
1806+ *
1807+ * @param symbol The new decimal symbol.
1808+ */
1809+ void setDecimalSymbol(const QString & symbol);
1810+
1811+ /**
1812+ * Changes the separator used to group digits when formating numbers.
1813+ *
1814+ * @param separator The new thousands separator.
1815+ */
1816+ void setThousandsSeparator(const QString & separator);
1817+
1818+ /**
1819+ * Changes the sign used to identify a positive number. Normally this is
1820+ * left blank.
1821+ *
1822+ * @param sign Sign used for positive numbers.
1823+ */
1824+ void setPositiveSign(const QString & sign);
1825+
1826+ /**
1827+ * Changes the sign used to identify a negative number.
1828+ *
1829+ * @param sign Sign used for negative numbers.
1830+ */
1831+ void setNegativeSign(const QString & sign);
1832+
1833+ /**
1834+ *
1835+ * Changes the set of digit characters used to display numbers.
1836+ *
1837+ * @param digitSet the digit set identifier
1838+ * @see DigitSet
1839+ */
1840+ void setDigitSet(DigitSet digitSet);
1841+
1842+ /**
1843+ * Changes the sign position used for positive monetary values.
1844+ *
1845+ * @param signpos The new sign position
1846+ */
1847+ void setPositiveMonetarySignPosition(SignPosition signpos);
1848+
1849+ /**
1850+ * Changes the sign position used for negative monetary values.
1851+ *
1852+ * @param signpos The new sign position
1853+ */
1854+ void setNegativeMonetarySignPosition(SignPosition signpos);
1855+
1856+ /**
1857+ * Changes the position where the currency symbol should be printed for
1858+ * positive monetary values.
1859+ *
1860+ * @param prefix True if the currency symbol should be prefixed instead of
1861+ * postfixed
1862+ */
1863+ void setPositivePrefixCurrencySymbol(bool prefix);
1864+
1865+ /**
1866+ * Changes the position where the currency symbol should be printed for
1867+ * negative monetary values.
1868+ *
1869+ * @param prefix True if the currency symbol should be prefixed instead of
1870+ * postfixed
1871+ */
1872+ void setNegativePrefixCurrencySymbol(bool prefix);
1873+
1874+ /**
1875+ *
1876+ * Changes the number of decimal places used when formating numbers.
1877+ *
1878+ * @param digits The default number of digits to use.
1879+ */
1880+ void setDecimalPlaces(int digits);
1881+
1882+ /**
1883+ *
1884+ * Changes the number of decimal places used when formating money.
1885+ *
1886+ * @param digits The default number of digits to use.
1887+ */
1888+ void setMonetaryDecimalPlaces(int digits);
1889+
1890+ /**
1891+ * Changes the separator used to group digits when formating monetary values.
1892+ *
1893+ * @param separator The new thousands separator.
1894+ */
1895+ void setMonetaryThousandsSeparator(const QString & separator);
1896+
1897+ /**
1898+ * Changes the symbol used to identify the decimal pointer for monetary
1899+ * values.
1900+ *
1901+ * @param symbol The new decimal symbol.
1902+ */
1903+ void setMonetaryDecimalSymbol(const QString & symbol);
1904+
1905+ /**
1906+ *
1907+ * Changes the current ISO Currency Code.
1908+ *
1909+ * @param newCurrencyCode The new Currency Code
1910+ */
1911+ void setCurrencyCode(const QString &newCurrencyCode);
1912+
1913+ /**
1914+ * Changes the current currency symbol.
1915+ *
1916+ * This symbol should be consistant with the selected Currency Code
1917+ *
1918+ * @param symbol The new currency symbol
1919+ * @see currencyCode, KCurrency::currencySymbols
1920+ */
1921+ void setCurrencySymbol(const QString & symbol);
1922+
1923+ /**
1924+ *
1925+ * Set digit characters used to display monetary values.
1926+ *
1927+ * @param digitSet the digit set identifier
1928+ * @see DigitSet
1929+ */
1930+ void setMonetaryDigitSet(DigitSet digitSet);
1931+
1932+ /**
1933+ * Returns the preferred page size for printing.
1934+ *
1935+ * @return The preferred page size, cast it to QPrinter::PageSize
1936+ */
1937+ int pageSize() const;
1938+
1939+ /**
1940+ * Changes the preferred page size when printing.
1941+ *
1942+ * @param paperFormat the new preferred page size in the format QPrinter::PageSize
1943+ */
1944+ void setPageSize(int paperFormat);
1945+
1946+ /**
1947+ * The Metric system will give you information in mm, while the
1948+ * Imperial system will give you information in inches.
1949+ */
1950+ enum MeasureSystem {
1951+ Metric, ///< Metric system (used e.g. in Europe)
1952+ Imperial ///< Imperial system (used e.g. in the United States)
1953+ };
1954+
1955+ /**
1956+ * Returns which measuring system we use.
1957+ *
1958+ * @return The preferred measuring system
1959+ */
1960+ MeasureSystem measureSystem() const;
1961+
1962+ /**
1963+ * Changes the preferred measuring system.
1964+ *
1965+ * @return value The preferred measuring system
1966+ */
1967+ void setMeasureSystem(MeasureSystem value);
1968+
1969+ /**
1970+ * Translates a message as a QTranslator is supposed to.
1971+ * The parameters are similar to i18n(), but the result
1972+ * value has other semantics (it can be QString())
1973+ */
1974+ Q_INVOKABLE QString translateQt(const char *context, const char *sourceText, const char *comment) const;
1975+
1976+ /**
1977+ * Provides list of all known language codes.
1978+ *
1979+ * Use languageCodeToName(language) to get human readable, localized
1980+ * language names.
1981+ *
1982+ * @return list of all language codes
1983+ *
1984+ * @see languageCodeToName
1985+ * @see installedLanguages
1986+ */
1987+ QStringList allLanguagesList() const;
1988+
1989+ /**
1990+ *
1991+ * Provides list of all installed KDE Language Translations.
1992+ *
1993+ * Use languageCodeToName(language) to get human readable, localized
1994+ * language names.
1995+ *
1996+ * @return list of all installed language codes
1997+ *
1998+ * @see languageCodeToName
1999+ */
2000+ QStringList installedLanguages() const;
2001+
2002+ /**
2003+ * Convert a known language code to a human readable, localized form.
2004+ * If an unknown language code is supplied, empty string is returned;
2005+ * this will never happen if the code has been obtained by one of the
2006+ * KLocale methods.
2007+ *
2008+ * @param language the language code
2009+ *
2010+ * @return the human readable and localized form if the code is known,
2011+ * empty otherwise
2012+ *
2013+ * @see language
2014+ * @see languageList
2015+ * @see allLanguagesList
2016+ * @see installedLanguages
2017+ */
2018+ Q_INVOKABLE QString languageCodeToName(const QString &language) const;
2019+
2020+ /**
2021+ * Provides list of all known country codes.
2022+ *
2023+ * Use countryCodeToName(country) to get human readable, localized
2024+ * country names.
2025+ *
2026+ * @return a list of all country codes
2027+ *
2028+ * @see countryCodeToName
2029+ */
2030+ QStringList allCountriesList() const;
2031+
2032+ /**
2033+ * Convert a known country code to a human readable, localized form.
2034+ *
2035+ * If an unknown country code is supplied, empty string is returned;
2036+ * this will never happen if the code has been obtained by one of the
2037+ * KLocale methods.
2038+ *
2039+ * @param country the country code
2040+ *
2041+ * @return the human readable and localized form of the country name
2042+ *
2043+ * @see country
2044+ * @see allCountriesList
2045+ */
2046+ Q_INVOKABLE QString countryCodeToName(const QString &country) const;
2047+
2048+ /**
2049+ * Parses locale string into distinct parts.
2050+ * The format of locale is language_COUNTRY@modifier.CHARSET
2051+ *
2052+ * @param locale the locale string to split
2053+ * @param language set to the language part of the locale
2054+ * @param country set to the country part of the locale
2055+ * @param modifier set to the modifer part of the locale
2056+ * @param charset set to the charset part of the locale
2057+ */
2058+ Q_INVOKABLE void splitLocale(const QString &locale, QString &language, QString &country,
2059+ QString &modifier, QString &charset);
2060+
2061+ /**
2062+ * Returns the name of the internal language.
2063+ *
2064+ * @return Name of the default language
2065+ */
2066+ QString defaultLanguage();
2067+
2068+ /**
2069+ * Returns the code of the default country, i.e. "C"
2070+ *
2071+ * This function will not provide a sensible value to use in your app,
2072+ * please use country() instead.
2073+ *
2074+ * @see country
2075+ *
2076+ * @return Name of the default country
2077+ */
2078+ QString defaultCountry();
2079+
2080+ /**
2081+ *
2082+ * Returns the ISO Code of the default currency.
2083+ *
2084+ * @return ISO Currency Code of the default currency
2085+ */
2086+ QString defaultCurrencyCode();
2087+
2088+ /**
2089+ * Reports whether evaluation of translation scripts is enabled.
2090+ *
2091+ * @return true if script evaluation is enabled, false otherwise.
2092+ */
2093+ bool useTranscript() const;
2094+
2095+ /**
2096+ * Checks whether or not the active catalog is found for the given language.
2097+ *
2098+ * @param language language to check
2099+ */
2100+ Q_INVOKABLE bool isApplicationTranslatedInto(const QString & language);
2101+
2102+ /**
2103+ *
2104+ * Sets the Country Division Code of the Country where the user lives.
2105+ *
2106+ * The code must comply with the ISO 3166-2 standard.
2107+ * See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
2108+ *
2109+ * In KDE 4.6 it is the apps responsibility to validate the input,
2110+ * full validation and other services will be provided in KDE 4.7.
2111+ *
2112+ * @param countryDivision the Country Division Code for the user
2113+ * @return @c true on success, @c false on failure
2114+ * @see countryDivisionCode
2115+ */
2116+ bool setCountryDivisionCode(const QString & countryDivision);
2117+
2118+ /**
2119+ *
2120+ * Removes accelerator marker from a UI text label.
2121+ *
2122+ * Accelerator marker is not always a plain ampersand (&),
2123+ * so it is not enough to just remove it by @c QString::remove().
2124+ * The label may contain escaped markers ("&&") which must be resolved
2125+ * and skipped, as well as CJK-style markers ("Foo (&F)") where
2126+ * the whole parenthesis construct should be removed.
2127+ * Therefore always use this function to remove accelerator marker
2128+ * from UI labels.
2129+ *
2130+ * @param label UI label which may contain an accelerator marker
2131+ * @return label without the accelerator marker
2132+ */
2133+ Q_INVOKABLE QString removeAcceleratorMarker(const QString &label) const;
2134+
2135+ /**
2136+ *
2137+ * Convert all digits in the string to the given digit set.
2138+ *
2139+ * Conversion is normally not performed if the given digit set
2140+ * is not appropriate in the current locale and language context.
2141+ * Unconditional conversion may be requested by setting
2142+ * @p ignoreContext to @c true.
2143+ *
2144+ * @param str the string to convert
2145+ * @param digitSet the digit set identifier
2146+ * @param ignoreContext unconditional conversion if @c true
2147+ *
2148+ * @return string with converted digits
2149+ *
2150+ * @see DigitSet
2151+ */
2152+ Q_INVOKABLE QString convertDigits(const QString &str, DigitSet digitSet,
2153+ bool ignoreContext = false) const;
2154+
2155+ /**
2156+ *
2157+ * Reparse locale configuration files for the current selected
2158+ * language.
2159+ */
2160+ Q_INVOKABLE void reparseConfiguration();
2161+
2162+private:
2163+ KLocale *m_locale;
2164+
2165+Q_SIGNALS:
2166+ void binaryUnitDialectChanged();
2167+ void calendarSystemChanged();
2168+ void countryDivisionCodeChanged();
2169+ void currencyCodeChanged();
2170+ void decimalSymbolChanged();
2171+ void currencySymbolChanged();
2172+ void dateFormatChanged();
2173+ void dateFormatShortChanged();
2174+ void dateMonthNamePossessiveChanged();
2175+ void dateTimeDigitSetChanged();
2176+ void decimalPlacesChanged();
2177+ void digitSetChanged();
2178+ void measureSystemChanged();
2179+ void monetaryDecimalPlacesChanged();
2180+ void monetaryDecimalSymbolChanged();
2181+ void monetaryDigitSetChanged();
2182+ void monetaryThousandsSeparatorChanged();
2183+ void negativeMonetarySignPositionChanged();
2184+ void negativePrefixCurrencySymbolChanged();
2185+ void negativeSignChanged();
2186+ void pageSizeChanged();
2187+ void positiveMonetarySignPositionChanged();
2188+ void positivePrefixCurrencySymbolChanged();
2189+ void positiveSignChanged();
2190+ void thousandsSeparatorChanged();
2191+ void timeFormatChanged();
2192+ void weekDayOfPrayChanged();
2193+ void WeekNumberSystemChanged();
2194+ void weekStartDayChanged();
2195+ void workingWeekEndDayChanged();
2196+ void workingWeekStartDayChanged();
2197+};
2198+
2199+#endif
2200diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/localebindingsplugin.cpp kde-runtime-4.9.0/plasma/declarativeimports/locale/localebindingsplugin.cpp
2201--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/localebindingsplugin.cpp 2012-05-23 01:59:52.000000000 +0200
2202+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/localebindingsplugin.cpp 2012-07-29 10:43:56.072917751 +0200
2203@@ -20,7 +20,7 @@
2204
2205 #include "localebindingsplugin.h"
2206 #include <QtDeclarative/qdeclarative.h>
2207-#include "locale.h"
2208+#include "kdelocale.h"
2209 #include "calendarsystem.h"
2210
2211 void LocaleBindingsPlugin::registerTypes(const char *uri)
2212diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/locale.cpp kde-runtime-4.9.0/plasma/declarativeimports/locale/locale.cpp
2213--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/locale.cpp 2012-05-23 01:59:52.000000000 +0200
2214+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/locale.cpp 1970-01-01 01:00:00.000000000 +0100
2215@@ -1,582 +0,0 @@
2216-/* This file is part of the KDE libraries
2217- Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
2218- Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
2219-
2220- This library is free software; you can redistribute it and/or
2221- modify it under the terms of the GNU Library General Public
2222- License as published by the Free Software Foundation; either
2223- version 2 of the License, or (at your option) any later version.
2224-
2225- This library is distributed in the hope that it will be useful,
2226- but WITHOUT ANY WARRANTY; without even the implied warranty of
2227- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2228- Library General Public License for more details.
2229-
2230- You should have received a copy of the GNU Library General Public License
2231- along with this library; see the file COPYING.LIB. If not, write to
2232- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2233- Boston, MA 02110-1301, USA.
2234-*/
2235-
2236-//own
2237-#include "locale.h"
2238-
2239-//KDE
2240-#include <KGlobal>
2241-
2242-Locale::Locale(QObject* parent)
2243- : QObject(parent)
2244-{
2245- m_locale = KGlobal::locale();
2246-}
2247-
2248-bool Locale::setCountryDivisionCode(const QString &countryDivisionCode)
2249-{
2250- bool ok = m_locale->setCountryDivisionCode(countryDivisionCode);
2251- emit countryDivisionCodeChanged();
2252- return ok;
2253-}
2254-
2255-void Locale::setCurrencyCode(const QString &newCurrencyCode)
2256-{
2257- m_locale->setCurrencyCode(newCurrencyCode);
2258- emit currencyCodeChanged();
2259-}
2260-
2261-bool Locale::isApplicationTranslatedInto(const QString &lang)
2262-{
2263- return m_locale->isApplicationTranslatedInto(lang);
2264-}
2265-
2266-void Locale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier,
2267- QString &charset)
2268-{
2269- Locale::splitLocale(locale, language, country, modifier, charset);
2270-}
2271-
2272-QString Locale::language() const
2273-{
2274- return m_locale->language();
2275-}
2276-
2277-QString Locale::country() const
2278-{
2279- return m_locale->country();
2280-}
2281-
2282-QString Locale::countryDivisionCode() const
2283-{
2284- return m_locale->countryDivisionCode();
2285-}
2286-
2287-QString Locale::currencyCode() const
2288-{
2289- return m_locale->currencyCode();
2290-}
2291-
2292-QString Locale::translateQt(const char *context, const char *sourceText, const char *comment) const
2293-{
2294- return m_locale->translateQt(context, sourceText, comment);
2295-}
2296-
2297-QList<int> Locale::allDigitSetsList() const
2298-{
2299- QList<int> digitList;
2300-
2301- foreach(KLocale::DigitSet digit, m_locale->allDigitSetsList()) {
2302- digitList.append((int)digit);
2303- }
2304-
2305- return digitList;
2306-}
2307-
2308-QString Locale::digitSetToName(Locale::DigitSet digitSet, bool withDigits) const
2309-{
2310- return m_locale->digitSetToName((KLocale::DigitSet)digitSet, withDigits);
2311-}
2312-
2313-QString Locale::convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext) const
2314-{
2315- return m_locale->convertDigits(str, (KLocale::DigitSet)digitSet, ignoreContext);
2316-}
2317-
2318-bool Locale::dateMonthNamePossessive() const
2319-{
2320- return m_locale->dateMonthNamePossessive();
2321-}
2322-
2323-int Locale::weekStartDay() const
2324-{
2325- return m_locale->weekStartDay();
2326-}
2327-
2328-int Locale::workingWeekStartDay() const
2329-{
2330- return m_locale->workingWeekStartDay();
2331-}
2332-
2333-int Locale::workingWeekEndDay() const
2334-{
2335- return m_locale->workingWeekEndDay();
2336-}
2337-
2338-int Locale::weekDayOfPray() const
2339-{
2340- return m_locale->weekDayOfPray();
2341-}
2342-
2343-int Locale::decimalPlaces() const
2344-{
2345- return m_locale->decimalPlaces();
2346-}
2347-
2348-QString Locale::decimalSymbol() const
2349-{
2350- return m_locale->decimalSymbol();
2351-}
2352-
2353-QString Locale::thousandsSeparator() const
2354-{
2355- return m_locale->thousandsSeparator();
2356-}
2357-
2358-QString Locale::currencySymbol() const
2359-{
2360- return m_locale->currencySymbol();
2361-}
2362-
2363-QString Locale::monetaryDecimalSymbol() const
2364-{
2365- return m_locale->monetaryDecimalSymbol();
2366-}
2367-
2368-QString Locale::monetaryThousandsSeparator() const
2369-{
2370- return m_locale->monetaryThousandsSeparator();
2371-}
2372-
2373-QString Locale::positiveSign() const
2374-{
2375- return m_locale->positiveSign();
2376-}
2377-
2378-QString Locale::negativeSign() const
2379-{
2380- return m_locale->negativeSign();
2381-}
2382-
2383-int Locale::monetaryDecimalPlaces() const
2384-{
2385- return m_locale->monetaryDecimalPlaces();
2386-}
2387-
2388-bool Locale::positivePrefixCurrencySymbol() const
2389-{
2390- return m_locale->positivePrefixCurrencySymbol();
2391-}
2392-
2393-bool Locale::negativePrefixCurrencySymbol() const
2394-{
2395- return m_locale->negativePrefixCurrencySymbol();
2396-}
2397-
2398-Locale::SignPosition Locale::positiveMonetarySignPosition() const
2399-{
2400- return (Locale::SignPosition)m_locale->positiveMonetarySignPosition();
2401-}
2402-
2403-Locale::SignPosition Locale::negativeMonetarySignPosition() const
2404-{
2405- return (Locale::SignPosition)m_locale->negativeMonetarySignPosition();
2406-}
2407-
2408-QString Locale::formatMoney(double num, const QString &symbol, int precision) const
2409-{
2410- return m_locale->formatMoney(num, symbol, precision);
2411-}
2412-
2413-QString Locale::formatLong(long num) const
2414-{
2415- return m_locale->formatLong(num);
2416-}
2417-
2418-QString Locale::formatNumber(const QString &numStr, bool round, int precision) const
2419-{
2420- return m_locale->formatNumber(numStr, round, precision);
2421-}
2422-
2423-QString Locale::formatByteSize(double size, int precision, Locale::BinaryUnitDialect dialect,
2424- Locale::BinarySizeUnits specificUnit) const
2425-{
2426- return m_locale->formatByteSize(size, precision, (KLocale::BinaryUnitDialect)dialect, (KLocale::BinarySizeUnits)specificUnit);
2427-}
2428-
2429-QString Locale::formatByteSize(double size) const
2430-{
2431- return m_locale->formatByteSize(size);
2432-}
2433-
2434-Locale::BinaryUnitDialect Locale::binaryUnitDialect() const
2435-{
2436- return (Locale::BinaryUnitDialect)m_locale->binaryUnitDialect();
2437-}
2438-
2439-void Locale::setBinaryUnitDialect(Locale::BinaryUnitDialect newDialect)
2440-{
2441- m_locale->setBinaryUnitDialect((KLocale::BinaryUnitDialect)newDialect);
2442- emit binaryUnitDialectChanged();
2443-}
2444-
2445-QString Locale::formatDuration(unsigned long mSec) const
2446-{
2447- return m_locale->formatDuration(mSec);
2448-}
2449-
2450-QString Locale::prettyFormatDuration(unsigned long mSec) const
2451-{
2452- return m_locale->prettyFormatDuration(mSec);
2453-}
2454-
2455-QString Locale::formatDate(const QDate &date, Locale::DateFormat format) const
2456-{
2457- return m_locale->formatDate(date, (KLocale::DateFormat)format);
2458-}
2459-
2460-double Locale::readNumber(const QString &_str) const
2461-{
2462- bool ok;
2463- return m_locale->readNumber(_str, &ok);
2464-}
2465-
2466-double Locale::readMoney(const QString &_str) const
2467-{
2468- bool ok;
2469- return m_locale->readMoney(_str, &ok);
2470-}
2471-
2472-QDate Locale::readDate(const QString &intstr, ReadDateFlags flags) const
2473-{
2474- bool ok;
2475- return m_locale->readDate(intstr, (KLocale::ReadDateFlags)flags, &ok);
2476-}
2477-
2478-QTime Locale::readTime(const QString &intstr) const
2479-{
2480- bool ok;
2481- return m_locale->readTime(intstr, &ok);
2482-}
2483-
2484-QTime Locale::readLocaleTime(const QString &intstr, TimeFormatOptions options,
2485- TimeProcessingOptions processing) const
2486-{
2487- bool ok;
2488- return m_locale->readLocaleTime(intstr, &ok, (KLocale::TimeFormatOptions)(int)options, (KLocale::TimeProcessingOptions)(int)processing);
2489-}
2490-
2491-QString Locale::formatLocaleTime(const QTime &time, TimeFormatOptions options) const
2492-{
2493- return m_locale->formatLocaleTime(time, (KLocale::TimeFormatOptions)(int)options);
2494-}
2495-
2496-bool Locale::use12Clock() const
2497-{
2498- return m_locale->use12Clock();
2499-}
2500-
2501-QString Locale::dayPeriodText(const QTime &time, DateTimeComponentFormat format) const
2502-{
2503- return m_locale->dayPeriodText(time, (KLocale::DateTimeComponentFormat)format);
2504-}
2505-
2506-QStringList Locale::languageList() const
2507-{
2508- return m_locale->languageList();
2509-}
2510-
2511-QStringList Locale::currencyCodeList() const
2512-{
2513- return m_locale->currencyCodeList();
2514-}
2515-
2516-QString Locale::formatDateTime(const QDateTime &dateTime, Locale::DateFormat format, DateTimeFormatOptions options) const
2517-{
2518- return m_locale->formatDateTime(dateTime, (KLocale::DateFormat)format, (KLocale::DateTimeFormatOptions)(int)options);
2519-}
2520-
2521-void Locale::setDateFormat(const QString &format)
2522-{
2523- m_locale->setDateFormat(format);
2524- emit dateFormatChanged();
2525-}
2526-
2527-void Locale::setDateFormatShort(const QString &format)
2528-{
2529- m_locale->setDateFormatShort(format);
2530- emit dateFormatShortChanged();
2531-}
2532-
2533-void Locale::setDateMonthNamePossessive(bool possessive)
2534-{
2535- m_locale->setDateMonthNamePossessive(possessive);
2536- emit dateMonthNamePossessiveChanged();
2537-}
2538-
2539-void Locale::setTimeFormat(const QString &format)
2540-{
2541- m_locale->setTimeFormat(format);
2542- emit timeFormatChanged();
2543-}
2544-
2545-void Locale::setWeekStartDay(int day)
2546-{
2547- m_locale->setWeekStartDay(day);
2548- emit weekStartDayChanged();
2549-}
2550-
2551-void Locale::setWorkingWeekStartDay(int day)
2552-{
2553- m_locale->setWorkingWeekStartDay(day);
2554- emit workingWeekStartDayChanged();
2555-}
2556-
2557-void Locale::setWorkingWeekEndDay(int day)
2558-{
2559- m_locale->setWorkingWeekEndDay(day);
2560- emit workingWeekEndDayChanged();
2561-}
2562-
2563-void Locale::setWeekDayOfPray(int day)
2564-{
2565- m_locale->setWeekDayOfPray(day);
2566- emit weekDayOfPrayChanged();
2567-}
2568-
2569-QString Locale::dateFormat() const
2570-{
2571- return m_locale->dateFormat();
2572-}
2573-
2574-QString Locale::dateFormatShort() const
2575-{
2576- return m_locale->dateFormatShort();
2577-}
2578-
2579-QString Locale::timeFormat() const
2580-{
2581- return m_locale->timeFormat();
2582-}
2583-
2584-void Locale::setDecimalPlaces(int digits)
2585-{
2586- m_locale->setDecimalPlaces(digits);
2587- emit decimalPlacesChanged();
2588-}
2589-
2590-void Locale::setDecimalSymbol(const QString &symbol)
2591-{
2592- m_locale->setDecimalSymbol(symbol);
2593- emit decimalSymbolChanged();
2594-}
2595-
2596-void Locale::setThousandsSeparator(const QString &separator)
2597-{
2598- m_locale->setThousandsSeparator(separator);
2599- emit thousandsSeparatorChanged();
2600-}
2601-
2602-void Locale::setPositiveSign(const QString &sign)
2603-{
2604- m_locale->setPositiveSign(sign);
2605- emit positiveSignChanged();
2606-}
2607-
2608-void Locale::setNegativeSign(const QString &sign)
2609-{
2610- m_locale->setNegativeSign(sign);
2611- emit negativeSignChanged();
2612-}
2613-
2614-void Locale::setPositiveMonetarySignPosition(Locale::SignPosition signpos)
2615-{
2616- m_locale->setPositiveMonetarySignPosition((KLocale::SignPosition)signpos);
2617- emit positiveMonetarySignPositionChanged();
2618-}
2619-
2620-void Locale::setNegativeMonetarySignPosition(Locale::SignPosition signpos)
2621-{
2622- m_locale->setNegativeMonetarySignPosition((KLocale::SignPosition)signpos);
2623- emit negativeMonetarySignPositionChanged();
2624-}
2625-
2626-void Locale::setPositivePrefixCurrencySymbol(bool prefix)
2627-{
2628- m_locale->setPositivePrefixCurrencySymbol(prefix);
2629- emit positivePrefixCurrencySymbolChanged();
2630-}
2631-
2632-void Locale::setNegativePrefixCurrencySymbol(bool prefix)
2633-{
2634- m_locale->setNegativePrefixCurrencySymbol(prefix);
2635- emit negativePrefixCurrencySymbolChanged();
2636-}
2637-
2638-void Locale::setMonetaryDecimalPlaces(int digits)
2639-{
2640- m_locale->setMonetaryDecimalPlaces(digits);
2641- emit monetaryDecimalPlacesChanged();
2642-}
2643-
2644-void Locale::setMonetaryThousandsSeparator(const QString &separator)
2645-{
2646- m_locale->setMonetaryThousandsSeparator(separator);
2647- emit monetaryThousandsSeparatorChanged();
2648-}
2649-
2650-void Locale::setMonetaryDecimalSymbol(const QString &symbol)
2651-{
2652- m_locale->setMonetaryDecimalSymbol(symbol);
2653- emit monetaryDecimalSymbolChanged();
2654-}
2655-
2656-void Locale::setCurrencySymbol(const QString & symbol)
2657-{
2658- m_locale->setCurrencySymbol(symbol);
2659- emit currencySymbolChanged();
2660-}
2661-
2662-int Locale::pageSize() const
2663-{
2664- return m_locale->pageSize();
2665-}
2666-
2667-void Locale::setPageSize(int size)
2668-{
2669- m_locale->setPageSize(size);
2670- emit pageSizeChanged();
2671-}
2672-
2673-Locale::MeasureSystem Locale::measureSystem() const
2674-{
2675- return (Locale::MeasureSystem)m_locale->measureSystem();
2676-}
2677-
2678-void Locale::setMeasureSystem(Locale::MeasureSystem value)
2679-{
2680- m_locale->setMeasureSystem((KLocale::MeasureSystem)value);
2681- emit measureSystemChanged();
2682-}
2683-
2684-QString Locale::defaultLanguage()
2685-{
2686- return KLocale::defaultLanguage();
2687-}
2688-
2689-QString Locale::defaultCountry()
2690-{
2691- return KLocale::defaultCountry();
2692-}
2693-
2694-QString Locale::defaultCurrencyCode()
2695-{
2696- return KLocale::defaultCurrencyCode();
2697-}
2698-
2699-bool Locale::useTranscript() const
2700-{
2701- return m_locale->useTranscript();
2702-}
2703-
2704-int Locale::fileEncodingMib() const
2705-{
2706- return m_locale->fileEncodingMib();
2707-}
2708-
2709-QStringList Locale::allLanguagesList() const
2710-{
2711- return m_locale->allLanguagesList();
2712-}
2713-
2714-QStringList Locale::installedLanguages() const
2715-{
2716- return m_locale->installedLanguages();
2717-}
2718-
2719-QString Locale::languageCodeToName(const QString &language) const
2720-{
2721- return m_locale->languageCodeToName(language);
2722-}
2723-
2724-QStringList Locale::allCountriesList() const
2725-{
2726- return m_locale->allCountriesList();
2727-}
2728-
2729-QString Locale::countryCodeToName(const QString &country) const
2730-{
2731- return m_locale->countryCodeToName(country);
2732-}
2733-
2734-void Locale::setCalendarSystem(Locale::CalendarSystem calendarSystem)
2735-{
2736- m_locale->setCalendarSystem((KLocale::CalendarSystem)calendarSystem);
2737- emit calendarSystemChanged();
2738-}
2739-
2740-Locale::CalendarSystem Locale::calendarSystem() const
2741-{
2742- return (Locale::CalendarSystem)m_locale->calendarSystem();
2743-}
2744-
2745-void Locale::setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem)
2746-{
2747- m_locale->setWeekNumberSystem((KLocale::WeekNumberSystem)weekNumberSystem);
2748- emit WeekNumberSystemChanged();
2749-}
2750-
2751-Locale::WeekNumberSystem Locale::weekNumberSystem() const
2752-{
2753- return (Locale::WeekNumberSystem)m_locale->weekNumberSystem();
2754-}
2755-
2756-QString Locale::removeAcceleratorMarker(const QString &label) const
2757-{
2758- return m_locale->removeAcceleratorMarker(label);
2759-}
2760-
2761-void Locale::setDigitSet(Locale::DigitSet digitSet)
2762-{
2763- m_locale->setDigitSet((KLocale::DigitSet)digitSet);
2764- emit digitSetChanged();
2765-}
2766-
2767-Locale::DigitSet Locale::digitSet() const
2768-{
2769- return (Locale::DigitSet)m_locale->digitSet();
2770-}
2771-
2772-void Locale::setMonetaryDigitSet(Locale::DigitSet digitSet)
2773-{
2774- m_locale->setMonetaryDigitSet((KLocale::DigitSet)digitSet);
2775- emit monetaryDigitSetChanged();
2776-}
2777-
2778-Locale::DigitSet Locale::monetaryDigitSet() const
2779-{
2780- return (Locale::DigitSet)m_locale->monetaryDigitSet();
2781-}
2782-
2783-void Locale::setDateTimeDigitSet(Locale::DigitSet digitSet)
2784-{
2785- m_locale->setDateTimeDigitSet((KLocale::DigitSet)digitSet);
2786- emit dateTimeDigitSetChanged();
2787-}
2788-
2789-Locale::DigitSet Locale::dateTimeDigitSet() const
2790-{
2791- return (Locale::DigitSet)m_locale->dateTimeDigitSet();
2792-}
2793-
2794-void Locale::reparseConfiguration()
2795-{
2796- m_locale->reparseConfiguration();
2797-}
2798diff -urN kde-runtime-4.9.0.org/plasma/declarativeimports/locale/locale.h kde-runtime-4.9.0/plasma/declarativeimports/locale/locale.h
2799--- kde-runtime-4.9.0.org/plasma/declarativeimports/locale/locale.h 2012-05-23 01:59:52.000000000 +0200
2800+++ kde-runtime-4.9.0/plasma/declarativeimports/locale/locale.h 1970-01-01 01:00:00.000000000 +0100
2801@@ -1,1585 +0,0 @@
2802-/* This file is part of the KDE libraries
2803- Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
2804- Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
2805-
2806- This library is free software; you can redistribute it and/or
2807- modify it under the terms of the GNU Library General Public
2808- License as published by the Free Software Foundation; either
2809- version 2 of the License, or (at your option) any later version.
2810-
2811- This library is distributed in the hope that it will be useful,
2812- but WITHOUT ANY WARRANTY; without even the implied warranty of
2813- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2814- Library General Public License for more details.
2815-
2816- You should have received a copy of the GNU Library General Public License
2817- along with this library; see the file COPYING.LIB. If not, write to
2818- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2819- Boston, MA 02110-1301, USA.
2820-*/
2821-#ifndef LOCALE_H
2822-#define LOCALE_H
2823-
2824-//Qt
2825-#include <QObject>
2826-#include <QTime>
2827-#include <QDate>
2828-
2829-//KDE
2830-#include <KLocale>
2831-
2832-class QString;
2833-class QDate;
2834-class QTime;
2835-class QDateTime;
2836-
2837-/**
2838- * \file klocale.h
2839- */
2840-
2841-/**
2842- *
2843- * KLocale provides support for country specific stuff like
2844- * the national language.
2845- *
2846- * KLocale supports translating, as well as specifying the format
2847- * for numbers, currency, time, and date.
2848- *
2849- * Use KGlobal::locale() to get pointer to the global KLocale object,
2850- * containing the applications current locale settings.
2851- *
2852- * For example, to format the date May 17, 1995 in the current locale, use:
2853- *
2854- * \code
2855- * QString date = KGlobal::locale()->formatDate(QDate(1995,5,17));
2856- * \endcode
2857- *
2858- * @author Stephan Kulow <coolo@kde.org>, Preston Brown <pbrown@kde.org>,
2859- * Hans Petter Bieker <bieker@kde.org>, Lukas Tinkl <lukas.tinkl@suse.cz>
2860- * @short class for supporting locale settings and national language
2861- */
2862-class Locale : public QObject
2863-{
2864-Q_OBJECT
2865-
2866-//enuns
2867-Q_ENUMS(BinarySizeUnits)
2868-Q_ENUMS(BinaryUnitDialect)
2869-Q_ENUMS(CalendarSystem)
2870-Q_ENUMS(DateFormat)
2871-Q_ENUMS(DateTimeComponent)
2872-Q_ENUMS(DateTimeComponentFormat)
2873-Q_ENUMS(DateTimeFormatOption )
2874-Q_ENUMS(DigitSet)
2875-Q_ENUMS(MeasureSystem)
2876-Q_ENUMS(ReadDateFlags)
2877-Q_ENUMS(SignPosition)
2878-Q_ENUMS(TimeFormatOption)
2879-Q_ENUMS(TimeProcessingOption)
2880-Q_ENUMS(WeekNumberSystem)
2881-
2882-//properties
2883-Q_PROPERTY(BinaryUnitDialect binaryUnitDialect READ binaryUnitDialect WRITE setBinaryUnitDialect NOTIFY binaryUnitDialectChanged)
2884-Q_PROPERTY(Locale::CalendarSystem calendarSystem READ calendarSystem WRITE setCalendarSystem NOTIFY calendarSystemChanged)
2885-Q_PROPERTY(QString country READ country CONSTANT) //read-only
2886-Q_PROPERTY(QString countryDivisionCode READ countryDivisionCode WRITE setCountryDivisionCode NOTIFY countryDivisionCodeChanged)
2887-Q_PROPERTY(QString currencyCode READ currencyCode WRITE setCurrencyCode NOTIFY currencyCodeChanged)
2888-Q_PROPERTY(QString currencySymbol READ currencySymbol WRITE setCurrencySymbol NOTIFY currencySymbolChanged)
2889-Q_PROPERTY(QString dateFormat READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged)
2890-Q_PROPERTY(QString dateFormatShort READ dateFormatShort WRITE setDateFormat NOTIFY dateFormatShortChanged)
2891-Q_PROPERTY(bool dateMonthNamePossessive READ dateMonthNamePossessive WRITE setDateMonthNamePossessive NOTIFY dateMonthNamePossessiveChanged)
2892-Q_PROPERTY(DigitSet dateTimeDigitSet READ dateTimeDigitSet WRITE setDateTimeDigitSet NOTIFY dateTimeDigitSetChanged)
2893-Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces NOTIFY decimalPlacesChanged)
2894-Q_PROPERTY(QString decimalSymbol READ decimalSymbol WRITE setDecimalSymbol NOTIFY decimalSymbolChanged)
2895-Q_PROPERTY(DigitSet digitSet READ digitSet WRITE setDigitSet NOTIFY digitSetChanged)
2896-Q_PROPERTY(QString language READ language CONSTANT) //read-only
2897-Q_PROPERTY(MeasureSystem measureSystem READ measureSystem WRITE setMeasureSystem NOTIFY measureSystemChanged)
2898-Q_PROPERTY(int monetaryDecimalPlaces READ monetaryDecimalPlaces WRITE setMonetaryDecimalPlaces NOTIFY monetaryDecimalPlacesChanged)
2899-Q_PROPERTY(QString monetaryDecimalSymbol READ monetaryDecimalSymbol WRITE setMonetaryDecimalSymbol NOTIFY monetaryDecimalSymbolChanged)
2900-Q_PROPERTY(DigitSet monetaryDigitSet READ monetaryDigitSet WRITE setMonetaryDigitSet NOTIFY monetaryDigitSetChanged)
2901-Q_PROPERTY(QString monetaryThousandsSeparator READ monetaryThousandsSeparator WRITE setMonetaryThousandsSeparator NOTIFY monetaryThousandsSeparatorChanged)
2902-Q_PROPERTY(SignPosition negativeMonetarySignPosition READ negativeMonetarySignPosition WRITE setNegativeMonetarySignPosition NOTIFY negativeMonetarySignPositionChanged)
2903-Q_PROPERTY(bool negativePrefixCurrencySymbol READ negativePrefixCurrencySymbol WRITE setNegativePrefixCurrencySymbol NOTIFY negativePrefixCurrencySymbolChanged)
2904-Q_PROPERTY(QString negativeSign READ negativeSign WRITE setNegativeSign NOTIFY negativeSignChanged)
2905-Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged)
2906-Q_PROPERTY(SignPosition positiveMonetarySignPosition READ positiveMonetarySignPosition WRITE setPositiveMonetarySignPosition NOTIFY positiveMonetarySignPositionChanged)
2907-Q_PROPERTY(bool positivePrefixCurrencySymbol READ positivePrefixCurrencySymbol WRITE setPositivePrefixCurrencySymbol NOTIFY positivePrefixCurrencySymbolChanged)
2908-Q_PROPERTY(QString positiveSign READ positiveSign WRITE setPositiveSign NOTIFY positiveSignChanged)
2909-Q_PROPERTY(QString thousandsSeparator READ thousandsSeparator WRITE setThousandsSeparator NOTIFY thousandsSeparatorChanged)
2910-Q_PROPERTY(int weekDayOfPray READ weekDayOfPray WRITE setWeekDayOfPray NOTIFY weekDayOfPrayChanged)
2911-Q_PROPERTY(Locale::WeekNumberSystem weekNumberSystem READ weekNumberSystem WRITE setWeekNumberSystem NOTIFY WeekNumberSystemChanged)
2912-Q_PROPERTY(int weekStartDay READ weekStartDay WRITE setWeekStartDay NOTIFY weekStartDayChanged)
2913-Q_PROPERTY(int workingWeekEndDay READ workingWeekEndDay WRITE setWorkingWeekEndDay NOTIFY workingWeekEndDayChanged)
2914-Q_PROPERTY(int workingWeekStartDay READ workingWeekStartDay WRITE setWorkingWeekStartDay NOTIFY workingWeekStartDayChanged)
2915-Q_PROPERTY(bool use12Clock READ use12Clock CONSTANT)
2916-Q_PROPERTY(QString defaultLanguage READ defaultLanguage CONSTANT)//read-only
2917-Q_PROPERTY(QString defaultCountry READ defaultCountry CONSTANT)//read-only
2918-Q_PROPERTY(QString defaultCurrencyCode READ defaultCurrencyCode CONSTANT)//read-only
2919-Q_PROPERTY(bool useTranscript READ useTranscript CONSTANT) //read-only
2920-Q_PROPERTY(int fileEncodingMib READ fileEncodingMib CONSTANT) //read-only
2921-Q_PROPERTY(QStringList languageList READ languageList CONSTANT) //read-only
2922-Q_PROPERTY(QStringList currencyCodeList READ currencyCodeList CONSTANT) //read-only
2923-Q_PROPERTY(QStringList allLanguagesList READ allLanguagesList CONSTANT) //read-only
2924-Q_PROPERTY(QStringList installedLanguages READ installedLanguages CONSTANT) //read-only
2925-Q_PROPERTY(QStringList allCountriesList READ allCountriesList CONSTANT) //read-only
2926-Q_PROPERTY(QList<int> allDigitSetsList READ allDigitSetsList CONSTANT) //read-only
2927-
2928-public:
2929- /**
2930- * ctor
2931- */
2932- Locale(QObject *parent = 0);
2933-
2934- /**
2935- * Various positions for where to place the positive or negative
2936- * sign when they are related to a monetary value.
2937- */
2938- enum SignPosition {
2939- /**
2940- * Put parantheses around the quantity, e.g. "$ (217)"
2941- */
2942- ParensAround = 0,
2943- /**
2944- * Prefix the quantity with the sign, e.g. "$ -217"
2945- */
2946- BeforeQuantityMoney = 1,
2947- /**
2948- * Suffix the quanitity with the sign, e.g. "$ 217-"
2949- */
2950- AfterQuantityMoney = 2,
2951- /**
2952- * Prefix the currency symbol with the sign, e.g. "-$ 217"
2953- */
2954- BeforeMoney = 3,
2955- /**
2956- * Suffix the currency symbol with the sign, e.g. "$- 217"
2957- */
2958- AfterMoney = 4
2959- };
2960-
2961- /**
2962- *
2963- * The set of digit characters used to display and enter numbers.
2964- */
2965- enum DigitSet {
2966- ArabicDigits, /**< 0123456789 (European and some Asian
2967- languages and western Arabic dialects) */
2968- ArabicIndicDigits, /**< Ù ÙĄÙąÙŁÙ€Ù„ÙŠÙ§ÙšÙ© (eastern Arabic dialects) */
2969- EasternArabicIndicDigits, /**< Û°Û±ÛČÛłÛŽÛ”Û¶Û·ÛžÛč (Persian and Urdu) */
2970- DevenagariDigits, /**< à„Šà„§à„šà„©à„Șà„«à„Źà„­à„źà„Ż (Hindi) */
2971- BengaliDigits, /**< ৊১৚৩à§Șà§«à§Źà§­à§źà§Ż (Bengali and Assamese) */
2972- GujaratiDigits, /**< ૊૧૚૩à«Șà««à«Źà«­à«źà«Ż (Gujarati) */
2973- GurmukhiDigits, /**< ੊੧ਗ਼੩à©Șà©«à©Źà©­à©źà©Ż (Punjabi) */
2974- KannadaDigits, /**< àłŠàł§àłšàł©àłȘàł«àłŹàł­àłźàłŻ (Kannada) */
2975- KhmerDigits, /**< áŸ áŸĄáŸąáŸŁáŸ€áŸ„áŸŠáŸ§áŸšáŸ© (Khmer) */
2976- MalayalamDigits, /**< à”Šà”§à”šà”©à”Șà”«à”Źà”­à”źà”Ż (Malayalam) */
2977- OriyaDigits, /**< ୊୧୚୩à­Șà­«à­Źà­­à­źà­Ż (Oriya) */
2978- TamilDigits, /**< àŻŠàŻ§àŻšàŻ©àŻȘàŻ«àŻŹàŻ­àŻź (Tamil) */
2979- TeluguDigits, /**< ొ౧ౚ౩à±Șà±«à±Źà±­à±Ż (Telugu) */
2980- ThaiDigits /**< àčàč‘àč’àč“àč”àč•àč–àč—àč˜àč™ (Thai) */
2981- // The following Decimal Digit Sets are defined in Unicode but the associated
2982- // languages are not yet translated in KDE, so are not yet enabled.
2983- // The script names are taken from the Unicode standard, the associated
2984- // languages from Wikipedia.
2985- // BalineseDigits, /**< ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙ (Balinese) */
2986- // ChamDigits, /**< ꩐꩑꩒꩓꩔꩕꩖꩗꩘꩙ (Cham) */
2987- // JavaneseDigits, /**< ꧐꧑꧒꧓꧔꧕꧖꧗꧘꧙ (Javanese) */
2988- // KayahLiDigits, /**< ꀀꀁꀂꀃꀄꀅꀆꀇꀈꀉ (Kayah) */
2989- // LaoDigits, /**< ໐໑໒໓໔໕໖໗໘໙ (Lao) */
2990- // LepchaDigits, /**< ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉ (Lepcha) */
2991- // LimbuDigits, /**< ᄆᄇᄈᄉᄊᄋᄌᄍᄎᄏ (Limbu) */
2992- // MeeteiMayekDigits, /**< êŻ°êŻ±êŻČêŻłêŻŽêŻ”êŻ¶êŻ·êŻžêŻč (Meitei) */
2993- // MongolianDigits, /**< ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙ (Mongolian) */
2994- // MyanmarDigits, /**< ၀၁၂၃၄၅၆၇၈၉ (Myanmar/Burmese ) */
2995- // MyanmarShanDigits, /**< ႐႑႒႓႔႕႖႗႘႙ (Shan) */
2996- // NewTaiLueDigits, /**< ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙ (Tai LĂŒ) */
2997- // NKoDigits, /**< ߀߁߂߃߄߅߆߇߈߉ (Mande and N'Ko) */
2998- // OlChikiDigits, /**< ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙ (Santali) */
2999- // OsmanyaDigits, /**< Ò ÒĄÒąÒŁÒ€Ò„ÒŠÒ§ÒšÒ© (Somali) */
3000- // SaurashtraDigits, /**< êŁêŁ‘êŁ’êŁ“êŁ”êŁ•êŁ–êŁ—êŁ˜êŁ™ (Saurashtra) */
3001- // SundaneseDigits, /**< áź°áź±áźČ៳៎។៶៷៞áźč (Sundanese) */
3002- // TaiThamDigits, /**< áȘáȘ‘áȘ’áȘ“áȘ”áȘ•áȘ–áȘ—áȘ˜áȘ™ (Tai LĂŒ) */
3003- // TibetanDigits, /**< àŒ àŒĄàŒąàŒŁàŒ€àŒ„àŒŠàŒ§àŒšàŒ© (Tibetan) */
3004- // VaiDigits, /**< ê˜ ê˜Ąê˜ąê˜Łê˜€ê˜„ê˜Šê˜§ê˜šê˜© (Vai) */
3005- };
3006-
3007- /**
3008- *
3009- * Convert a digit set identifier to a human readable, localized name.
3010- *
3011- * @param digitSet the digit set identifier
3012- * @param withDigits whether to add the digits themselves to the name
3013- *
3014- * @return the human readable and localized name of the digit set
3015- *
3016- * @see DigitSet
3017- */
3018- QString digitSetToName(DigitSet digitSet, bool withDigits = false) const;
3019-
3020- /**
3021- *
3022- * Provides list of all known digit set identifiers.
3023- *
3024- * @return list of all digit set identifiers
3025- * @see DigitSet
3026- * @see digitSetToName
3027- */
3028- QList<int> allDigitSetsList() const;
3029-
3030- /**
3031- * Returns what a decimal point should look like ("." or "," etc.)
3032- * according to the current locale or user settings.
3033- *
3034- * @return The decimal symbol used by locale.
3035- */
3036- QString decimalSymbol() const;
3037-
3038- /**
3039- * Returns what the thousands separator should look
3040- * like ("," or "." etc.)
3041- * according to the current locale or user settings.
3042- *
3043- * @return The thousands separator used by locale.
3044- */
3045- QString thousandsSeparator() const;
3046-
3047- /**
3048- *
3049- * Returns the identifier of the digit set used to display numbers.
3050- *
3051- * @return the digit set identifier
3052- * @see DigitSet
3053- * @see digitSetToName
3054- */
3055- DigitSet digitSet() const;
3056-
3057- /**
3058- *
3059- * Returns the ISO 4217 Currency Code for the current locale
3060- *
3061- * @return The default ISO Currency Code used by locale.
3062- */
3063- QString currencyCode() const;
3064-
3065- /**
3066- * Returns what the symbol denoting currency in the current locale
3067- * as as defined by user settings should look like.
3068- *
3069- * @return The default currency symbol used by locale.
3070- */
3071- QString currencySymbol() const;
3072-
3073- /**
3074- * Returns what a decimal point should look like ("." or "," etc.)
3075- * for monetary values, according to the current locale or user
3076- * settings.
3077- *
3078- * @return The monetary decimal symbol used by locale.
3079- */
3080- QString monetaryDecimalSymbol() const;
3081-
3082- /**
3083- * Returns what a thousands separator for monetary values should
3084- * look like ("," or " " etc.) according to the current locale or
3085- * user settings.
3086- *
3087- * @return The monetary thousands separator used by locale.
3088- */
3089- QString monetaryThousandsSeparator() const;
3090-
3091- /**
3092- * Returns what a positive sign should look like ("+", " ", etc.)
3093- * according to the current locale or user settings.
3094- *
3095- * @return The positive sign used by locale.
3096- */
3097- QString positiveSign() const;
3098-
3099- /**
3100- * Returns what a negative sign should look like ("-", etc.)
3101- * according to the current locale or user settings.
3102- *
3103- * @return The negative sign used by locale.
3104- */
3105- QString negativeSign() const;
3106-
3107- /**
3108- *
3109- * The number of decimal places to include in numeric values (usually 2).
3110- *
3111- * @return Default number of numeric decimal places used by locale.
3112- */
3113- int decimalPlaces() const;
3114-
3115- /**
3116- *
3117- * The number of decimal places to include in monetary values (usually 2).
3118- *
3119- * @return Default number of monetary decimal places used by locale.
3120- */
3121- int monetaryDecimalPlaces() const;
3122-
3123- /**
3124- * If and only if the currency symbol precedes a positive value,
3125- * this will be true.
3126- *
3127- * @return Where to print the currency symbol for positive numbers.
3128- */
3129- bool positivePrefixCurrencySymbol() const;
3130-
3131- /**
3132- * If and only if the currency symbol precedes a negative value,
3133- * this will be true.
3134- *
3135- * @return True if the currency symbol precedes negative numbers.
3136- */
3137- bool negativePrefixCurrencySymbol() const;
3138-
3139- /**
3140- * Returns the position of a positive sign in relation to a
3141- * monetary value.
3142- *
3143- * @return Where/how to print the positive sign.
3144- * @see SignPosition
3145- */
3146- SignPosition positiveMonetarySignPosition() const;
3147-
3148- /**
3149- * Denotes where to place a negative sign in relation to a
3150- * monetary value.
3151- *
3152- * @return Where/how to print the negative sign.
3153- * @see SignPosition
3154- */
3155- SignPosition negativeMonetarySignPosition() const;
3156-
3157- /**
3158- *
3159- * Retuns the digit set used to display monetary values.
3160- *
3161- * @return the digit set identifier
3162- * @see DigitSet
3163- * @see digitSetToName
3164- */
3165- DigitSet monetaryDigitSet() const;
3166-
3167- /**
3168- * Given a double, converts that to a numeric string containing
3169- * the localized monetary equivalent.
3170- *
3171- * e.g. given 123456, return "$ 123,456.00".
3172- *
3173- * If precision isn't specified or is < 0, then the default monetaryDecimalPlaces() is used.
3174- *
3175- * @param num The number we want to format
3176- * @param currency The currency symbol you want.
3177- * @param precision Number of decimal places displayed
3178- *
3179- * @return The number of money as a localized string
3180- * @see monetaryDecimalPlaces()
3181- */
3182- Q_INVOKABLE QString formatMoney(double num, const QString &currency = QString(), int precision = -1) const;
3183-
3184- /**
3185- * Given a string representing a number, converts that to a numeric
3186- * string containing the localized numeric equivalent.
3187- *
3188- * e.g. given 123456.78F, return "123,456.78" (for some European country).
3189- *
3190- * If precision isn't specified or is < 0, then the default decimalPlaces() is used.
3191- *
3192- * @param numStr The number to format, as a string.
3193- * @param round Round fractional digits. (default true)
3194- * @param precision Number of fractional digits used for rounding. Unused if round=false.
3195- *
3196- * @return The number as a localized string
3197- */
3198- Q_INVOKABLE QString formatNumber(const QString &numStr, bool round = true, int precision = -1) const;
3199-
3200- /**
3201- * Given an integer, converts that to a numeric string containing
3202- * the localized numeric equivalent.
3203- *
3204- * e.g. given 123456L, return "123,456" (for some European country).
3205- *
3206- * @param num The number to convert
3207- *
3208- * @return The number as a localized string
3209- */
3210- Q_INVOKABLE QString formatLong(long num) const;
3211-
3212- /**
3213- * These binary units are used in KDE by the formatByteSize()
3214- * functions.
3215- *
3216- * NOTE: There are several different units standards:
3217- * 1) SI (i.e. metric), powers-of-10.
3218- * 2) IEC, powers-of-2, with specific units KiB, MiB, etc.
3219- * 3) JEDEC, powers-of-2, used for solid state memory sizing which
3220- * is why you see flash cards labels as e.g. 4GB. These (ab)use
3221- * the metric units. Although JEDEC only defines KB, MB, GB, if
3222- * JEDEC is selected all units will be powers-of-2 with metric
3223- * prefixes for clarity in the event of sizes larger than 1024 GB.
3224- *
3225- * Although 3 different dialects are possible this enum only uses
3226- * metric names since adding all 3 different names of essentially the same
3227- * unit would be pointless. Use BinaryUnitDialect to control the exact
3228- * units returned.
3229- *
3230- * @see binaryUnitDialect
3231- */
3232- enum BinarySizeUnits {
3233- /// Auto-choose a unit such that the result is in the range [0, 1000 or 1024)
3234- DefaultBinaryUnits = 1000,
3235-
3236- // The first real unit must be 0 for the current implementation!
3237- UnitByte = 0, ///< B 1 byte
3238- UnitKiloByte, ///< KiB/KB/kB 1024/1000 bytes.
3239- UnitMegaByte, ///< MiB/MB/MB 2^20/10^06 bytes.
3240- UnitGigaByte, ///< GiB/GB/GB 2^30/10^09 bytes.
3241- UnitTeraByte, ///< TiB/TB/TB 2^40/10^12 bytes.
3242- UnitPetaByte, ///< PiB/PB/PB 2^50/10^15 bytes.
3243- UnitExaByte, ///< EiB/EB/EB 2^60/10^18 bytes.
3244- UnitZettaByte, ///< ZiB/ZB/ZB 2^70/10^21 bytes.
3245- UnitYottaByte, ///< YiB/YB/YB 2^80/10^24 bytes.
3246- UnitLastUnit = UnitYottaByte
3247- };
3248-
3249- /**
3250- * This enum chooses what dialect is used for binary units.
3251- *
3252- * Note: Although JEDEC abuses the metric prefixes and can therefore be
3253- * confusing, it has been used to describe *memory* sizes for quite some time
3254- * and programs should therefore use either Default, JEDEC, or IEC 60027-2
3255- * for memory sizes.
3256- *
3257- * On the other hand network transmission rates are typically in metric so
3258- * Default, Metric, or IEC (which is unambiguous) should be chosen.
3259- *
3260- * Normally choosing DefaultBinaryUnits is the best option as that uses
3261- * the user's selection for units.
3262- *
3263- * @see binaryUnitDialect
3264- * @see setBinaryUnitDialect
3265- */
3266- enum BinaryUnitDialect {
3267- DefaultBinaryDialect = 1000, ///< Used if no specific preference
3268- IECBinaryDialect = 0, ///< KDE Default, KiB, MiB, etc. 2^(10*n)
3269- JEDECBinaryDialect, ///< KDE 3.5 default, KB, MB, etc. 2^(10*n)
3270- MetricBinaryDialect, ///< SI Units, kB, MB, etc. 10^(3*n)
3271- LastBinaryDialect = MetricBinaryDialect
3272- };
3273-
3274- /**
3275- * Converts @p size from bytes to the string representation using the
3276- * user's default binary unit dialect. The default unit dialect is
3277- * IEC 60027-2.
3278- *
3279- * Example:
3280- * formatByteSize(1024) returns "1.0 KiB" by default.
3281- *
3282- * @param size size in bytes
3283- * @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
3284- * @see BinaryUnitDialect
3285- * @todo KDE 5: Remove in favor of overload added in KDE 4.4.
3286- */
3287- Q_INVOKABLE QString formatByteSize(double size) const;
3288-
3289- /**
3290- *
3291- * Converts @p size from bytes to the appropriate string representation
3292- * using the binary unit dialect @p dialect and the specific units @p specificUnit.
3293- *
3294- * Example:
3295- * formatByteSize(1000, unit, Locale::BinaryUnitKilo) returns:
3296- * for Locale::MetricBinaryUnits, "1.0 kB",
3297- * for Locale::IECBinaryUnits, "0.9 KiB",
3298- * for Locale::JEDECBinaryUnits, "0.9 KB".
3299- *
3300- * @param size size in bytes
3301- * @param precision number of places after the decimal point to use. KDE uses
3302- * 1 by default so when in doubt use 1.
3303- * @param dialect binary unit standard to use. Use DefaultBinaryUnits to
3304- * use the localized user selection unless you need to use a specific
3305- * unit type (such as displaying a flash memory size in JEDEC).
3306- * @param specificUnit specific unit size to use in result. Use
3307- * DefaultBinarySize to automatically select a unit that will return
3308- * a sanely-sized number.
3309- * @return converted size as a translated string including the units.
3310- * E.g. "1.23 KiB", "2 GB" (JEDEC), "4.2 kB" (Metric).
3311- * @see BinaryUnitDialect
3312- */
3313- QString formatByteSize(double size, int precision,
3314- BinaryUnitDialect dialect = Locale::DefaultBinaryDialect,
3315- BinarySizeUnits specificUnit = Locale::DefaultBinaryUnits) const;
3316-
3317- /**
3318- * Returns the user's configured binary unit dialect.
3319- * e.g. if MetricBinaryDialect is returned then the values
3320- * configured for how much a set of bytes are worth would
3321- * be 10^(3*n) and KB (1000 bytes == 1 KB), in this case.
3322- *
3323- * Will never return DefaultBinaryDialect.
3324- *
3325- * @return User's configured binary unit dialect
3326- * @see BinaryUnitDialect
3327- */
3328- BinaryUnitDialect binaryUnitDialect() const;
3329-
3330- /**
3331- * Sets @p newDialect to be the default dialect for this locale (and only
3332- * this locale). Newly created KLocale objects will continue to default
3333- * to the user's choice.
3334- *
3335- * @param newDialect the new dialect to set as default for this locale object.
3336- */
3337- void setBinaryUnitDialect(BinaryUnitDialect newDialect);
3338-
3339- /**
3340- * Given a number of milliseconds, converts that to a string containing
3341- * the localized equivalent
3342- *
3343- * e.g. given formatDuration(60000), returns "1.0 minutes"
3344- *
3345- * @param mSec Time duration in milliseconds
3346- * @return converted duration as a string - e.g. "5.5 seconds" "23.0 minutes"
3347- */
3348- Q_INVOKABLE QString formatDuration(unsigned long mSec) const;
3349-
3350- /**
3351- * Given a number of milliseconds, converts that to a pretty string containing
3352- * the localized equivalent.
3353- *
3354- * e.g. given prettyFormatDuration(60001) returns "1 minute"
3355- * given prettyFormatDuration(62005) returns "1 minute and 2 seconds"
3356- * given prettyFormatDuration(90060000) returns "1 day and 1 hour"
3357- *
3358- * @param mSec Time duration in milliseconds
3359- * @return converted duration as a string.
3360- * Units not interesting to the user, for example seconds or minutes when the first
3361- * unit is day, are not returned because they are irrelevant. The same applies for
3362- * seconds when the first unit is hour.
3363- */
3364- Q_INVOKABLE QString prettyFormatDuration(unsigned long mSec) const;
3365-
3366- /**
3367- *
3368- * Available Calendar Systems
3369- *
3370- * @see setCalendarSystem()
3371- * @see calendarSystem()
3372- */
3373- enum CalendarSystem {
3374- QDateCalendar = 1, /**< KDE Default, hybrid of Gregorian and Julian as used by QDate */
3375- //BahaiCalendar = 2, /**< Baha'i Calendar */
3376- //BuddhistLunarCalendar = 3, /**< Buddhist Lunar Calendar*/
3377- //ChineseCalendar = 4, /**< Chinese Calendar */
3378- CopticCalendar = 5, /**< Coptic Calendar as used Coptic Church and some parts of Egypt */
3379- EthiopianCalendar = 6, /**< Ethiopian Calendar, aka Ethiopic Calendar */
3380- //EthiopianAmeteAlemCalendar = 7, /**< Ethiopian Amete Alem version, aka Ethiopic Amete Alem */
3381- GregorianCalendar = 8, /**< Gregorian Calendar, pure proleptic implementation */
3382- HebrewCalendar = 9, /**< Hebrew Calendar, aka Jewish Calendar */
3383- //HinduCalendar = 10, /**< Hindu Lunar Calendar */
3384- //IslamicLunarCalendar = 11, /**< Islamic Lunar Calendar */
3385- IslamicCivilCalendar = 12, /**< Islamic Civil Calendar, aka Hijri, not the Lunar Calendar */
3386- //IslamicUmAlQuraCalendar = 13, /**< Islamic Lunar Calendar, Um Al Qura varient used in Saudi Arabia */
3387- IndianNationalCalendar = 14, /**< Indian National Calendar, not the Lunar Calendar */
3388- //Iso8601Calendar = 15, /**< ISO 8601 Standard Calendar */
3389- JalaliCalendar = 16, /**< Jalali Calendar, aka Persian or Iranian, also used in Afghanistan */
3390- //JalaliBirashkCalendar = 17, /**< Jalali Calendar, Birashk Algorythm variant */
3391- //Jalali33YearCalendar = 18, /**< Jalali Calendar, 33 Year cycle variant */
3392- JapaneseCalendar= 19, /**< Japanese Calendar, Gregorian calculation using Japanese Era (NengĂŽ) */
3393- //JucheCalendar = 20, /**< Juche Calendar, used in North Korea */
3394- JulianCalendar = 21, /**< Julian Calendar, as used in Orthodox Churches */
3395- MinguoCalendar= 22, /**< Minguo Calendar, aka ROC, Republic of China or Taiwanese */
3396- ThaiCalendar = 23 /**< Thai Calendar, aka Buddhist or Thai Buddhist */
3397- };
3398-
3399- /**
3400- *
3401- * System used for Week Numbers
3402- *
3403- * @see setWeekNumberSystem()
3404- * @see weekNumberSystem()
3405- */
3406- enum WeekNumberSystem {
3407- DefaultWeekNumber = 1000, /**< The system locale default */
3408- IsoWeekNumber = 0, /**< ISO Week Number */
3409- FirstFullWeek = 1, /**< Week 1 starts on the first Week Start Day in year ends after 7 days */
3410- FirstPartialWeek = 2, /**< Week 1 starts Jan 1st ends day before first Week Start Day in year */
3411- SimpleWeek = 3 /**< Week 1 starts Jan 1st ends after 7 days */
3412- };
3413-
3414- /**
3415- *
3416- * The various Components that make up a Date / Time
3417- * In the future the Components may be combined as flags for dynamic
3418- * generation of Date Formats.
3419- *
3420- * @see CalendarSystem
3421- * @see KLocalizedDate
3422- * @see DateTimeComponentFormat
3423- */
3424- enum DateTimeComponent {
3425- Year = 0x1, /**< The Year portion of a date, may be number or name */
3426- YearName = 0x2, /**< The Year Name portion of a date */
3427- Month = 0x4, /**< The Month portion of a date, may be number or name */
3428- MonthName = 0x8, /**< The Month Name portion of a date */
3429- Day = 0x10, /**< The Day portion of a date, may be number or name */
3430- DayName = 0x20, /**< The Day Name portion of a date */
3431- JulianDay = 0x40, /**< The Julian Day of a date */
3432- EraName = 0x80, /**< The Era Name portion of a date */
3433- EraYear = 0x100, /**< The Era and Year portion of a date */
3434- YearInEra = 0x200, /**< The Year In Era portion of a date */
3435- DayOfYear = 0x400, /**< The Day Of Year portion of a date, may be number or name */
3436- DayOfYearName = 0x800, /**< The Day Of Year Name portion of a date */
3437- DayOfWeek = 0x1000, /**< The Day Of Week / Weekday portion of a date, may be number or name */
3438- DayOfWeekName = 0x2000, /**< The Day Of Week Name / Weekday Name portion of a date */
3439- Week = 0x4000, /**< The Week Number portion of a date */
3440- WeekYear = 0x8000, /**< The Week Year portion of a date */
3441- MonthsInYear = 0x10000, /**< The Months In Year portion of a date */
3442- WeeksInYear = 0x20000, /**< The Weeks In Year portion of a date */
3443- DaysInYear = 0x40000, /**< The Days In Year portion of a date */
3444- DaysInMonth = 0x80000, /**< The Days In Month portion of a date */
3445- DaysInWeek = 0x100000, /**< The Days In Week portion of a date */
3446- Hour = 0x200000, /**< The Hours portion of a date */
3447- Minute = 0x400000, /**< The Minutes portion of a date */
3448- Second = 0x800000, /**< The Seconds portion of a date */
3449- Millisecond = 0x1000000, /**< The Milliseconds portion of a date */
3450- DayPeriod = 0x2000000, /**< The Day Period portion of a date, e.g. AM/PM */
3451- DayPeriodHour = 0x4000000, /**< The Day Period Hour portion of a date */
3452- Timezone = 0x8000000, /**< The Time Zone portion of a date, may be offset or name */
3453- TimezoneName = 0x10000000, /**< The Time Zone Name portion of a date */
3454- UnixTime = 0x20000000 /**< The UNIX Time portion of a date */
3455- };
3456-
3457- /**
3458- *
3459- * Format used for individual Date/Time Components when converted to/from a string
3460- * Largely equivalent to the UNICODE CLDR format width definitions 1..5
3461- *
3462- * @see DateTimeComponentFormat
3463- */
3464- enum DateTimeComponentFormat {
3465- DefaultComponentFormat = 1000, /**< The system locale default for the componant */
3466- ShortNumber = 0, /**< Number at its natural width, e.g. 2 for the 2nd*/
3467- LongNumber, /**< Number padded to a required width, e.g. 02 for the 2nd*/
3468- //OrdinalNumber /**< Ordinal number format, e.g. "2nd" for the 2nd */
3469- NarrowName = 3, /**< Narrow text format, may not be unique, e.g. M for Monday */
3470- ShortName, /**< Short text format, e.g. Mon for Monday */
3471- LongName /**< Long text format, e.g. Monday for Monday */
3472- };
3473-
3474- Q_DECLARE_FLAGS(DateTimeComponents, DateTimeComponent)
3475-
3476- /**
3477- * Format for date string.
3478- */
3479- enum DateFormat {
3480- ShortDate, /**< Locale Short date format, e.g. 08-04-2007 */
3481- LongDate, /**< Locale Long date format, e.g. Sunday 08 April 2007 */
3482- FancyShortDate, /**< Same as ShortDate for dates a week or more ago. For more
3483- recent dates, it is represented as Today, Yesterday, or
3484- the weekday name. */
3485- FancyLongDate, /**< Same as LongDate for dates a week or more ago. For more
3486- recent dates, it is represented as Today, Yesterday, or
3487- the weekday name. */
3488- IsoDate, /**< ISO-8601 Date format YYYY-MM-DD, e.g. 2009-12-31 */
3489- IsoWeekDate, /**< ISO-8601 Week Date format YYYY-Www-D, e.g. 2009-W01-1 */
3490- IsoOrdinalDate /**< ISO-8601 Ordinal Date format YYYY-DDD, e.g. 2009-001 */
3491- };
3492-
3493- /**
3494- * Returns a string formatted to the current locale's conventions
3495- * regarding dates.
3496- *
3497- * @param date the date to be formatted
3498- * @param format category of date format to use
3499- *
3500- * @return the date as a string
3501- */
3502- Q_INVOKABLE QString formatDate(const QDate &date, DateFormat format = LongDate) const;
3503-
3504- /**
3505- * Options for formatting date-time values.
3506- */
3507- enum DateTimeFormatOption {
3508- TimeZone = 0x01, /**< Include a time zone string */
3509- Seconds = 0x02 /**< Include the seconds value */
3510- };
3511-
3512- Q_DECLARE_FLAGS(DateTimeFormatOptions, DateTimeFormatOption)
3513-
3514- /**
3515- * Returns a string formatted to the current locale's conventions
3516- * regarding both date and time.
3517- *
3518- * @param dateTime the date and time to be formatted
3519- * @param format category of date format to use
3520- * @param options additional output options
3521- *
3522- * @return The date and time as a string
3523- */
3524- Q_INVOKABLE QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
3525- DateTimeFormatOptions options = 0) const;
3526-
3527- /**
3528- * Use this to determine whether in dates a possessive form of month
3529- * name is preferred ("of January" rather than "January")
3530- *
3531- * @return If possessive form should be used
3532- */
3533- bool dateMonthNamePossessive() const;
3534-
3535- /**
3536- *
3537- * Format flags for readLocaleTime() and formatLocaleTime()
3538- */
3539- enum TimeFormatOption {
3540- TimeDefault = 0x0, ///< Default formatting using seconds and the format
3541- ///< as specified by the locale.
3542- TimeWithoutSeconds = 0x1, ///< Exclude the seconds part of the time from display
3543- TimeWithoutAmPm = 0x2, ///< Read/format time string without am/pm suffix but
3544- ///< keep the 12/24h format as specified by locale time
3545- ///< format, eg. "07.33.05" instead of "07.33.05 pm" for
3546- ///< time format "%I.%M.%S %p".
3547- TimeDuration = 0x6, ///< Read/format time string as duration. This will strip
3548- ///< the am/pm suffix and read/format times with an hour
3549- ///< value of 0-23 hours, eg. "19.33.05" instead of
3550- ///< "07.33.05 pm" for time format "%I.%M.%S %p".
3551- ///< This automatically implies @c TimeWithoutAmPm.
3552- TimeFoldHours = 0xE ///< Read/format time string as duration. This will not
3553- ///< not output the hours part of the duration but will
3554- ///< add the hours (times sixty) to the number of minutes,
3555- ///< eg. "70.23" instead of "01.10.23" for time format
3556- ///< "%I.%M.%S %p".
3557- };
3558-
3559- Q_DECLARE_FLAGS(TimeFormatOptions, TimeFormatOption)
3560-
3561- /**
3562- *
3563- * Returns a string formatted to the current locale's conventions
3564- * regarding times.
3565- *
3566- * @param pTime the time to be formatted
3567- * @param options format option to use when formatting the time
3568- * @return The time as a string
3569- */
3570- Q_INVOKABLE QString formatLocaleTime(const QTime &pTime,
3571- TimeFormatOptions options = Locale::TimeDefault) const;
3572-
3573- /**
3574- *
3575- * Returns the identifier of the digit set used to display dates and time.
3576- *
3577- * @return the digit set identifier
3578- * @see DigitSet
3579- * @see digitSetToName
3580- */
3581- DigitSet dateTimeDigitSet() const;
3582-
3583- /**
3584- * Use this to determine if the user wants a 12 hour clock.
3585- *
3586- * @return If the user wants 12h clock
3587- */
3588- bool use12Clock() const;
3589-
3590- /**
3591- *
3592- * Returns the Day Period matching the time given
3593- *
3594- * @param time the time to return the day period for
3595- * @param format the format to return teh day period in
3596- * @return the Day Period for the given time
3597- */
3598- Q_INVOKABLE QString dayPeriodText(const QTime &time, DateTimeComponentFormat format = DefaultComponentFormat) const;
3599-
3600- /**
3601- * Use this to determine which day is the first day of the week.
3602- *
3603- * @return an integer (Monday=1..Sunday=7)
3604- */
3605- int weekStartDay() const;
3606-
3607- /**
3608- * Use this to determine which day is the first working day of the week.
3609- *
3610- * @return an integer (Monday=1..Sunday=7)
3611- */
3612- int workingWeekStartDay() const;
3613-
3614- /**
3615- * Use this to determine which day is the last working day of the week.
3616- *
3617- * @return an integer (Monday=1..Sunday=7)
3618- */
3619- int workingWeekEndDay() const;
3620-
3621- /**
3622- * Use this to determine which day is reserved for religious observance
3623- *
3624- * @return day number (None = 0, Monday = 1, ..., Sunday = 7)
3625- */
3626- int weekDayOfPray() const;
3627-
3628- /**
3629- *
3630- * Returns the type of Calendar System used in this Locale
3631- *
3632- * @see Locale::CalendarSystem
3633- * @see CalendarSystem
3634- * @return the type of Calendar System
3635- */
3636- Locale::CalendarSystem calendarSystem() const;
3637-
3638- /**
3639- *
3640- * Sets the type of Calendar System to use in this Locale
3641- *
3642- * @see Locale::CalendarSystem
3643- * @see CalendarSystem
3644- * @param calendarSystem the Calendar System to use
3645- */
3646- void setCalendarSystem(Locale::CalendarSystem calendarSystem);
3647-
3648- /**
3649- *
3650- * Sets the type of Week Number System to use in this Locale
3651- *
3652- * @see Klocale::WeekNumberSystem
3653- * @see weekNumberSystem()
3654- * @param weekNumberSystem the Week Number System to use
3655- */
3656- void setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem);
3657-
3658- /**
3659- *
3660- * Returns the type of Week Number System used in this Locale
3661- *
3662- * @see Klocale::WeekNumberSystem
3663- * @see setWeekNumberSystem()
3664- * @returns the Week Number System used
3665- */
3666- Locale::WeekNumberSystem weekNumberSystem() const;
3667-
3668- /**
3669- * Converts a localized monetary string to a double.
3670- *
3671- * @param numStr the string we want to convert.
3672- * @param ok the boolean that is set to false if it's not a number.
3673- * If @p ok is 0, it will be ignored
3674- *
3675- * @return The string converted to a double
3676- */
3677- Q_INVOKABLE double readMoney(const QString &numStr) const;
3678-
3679- /**
3680- * Converts a localized numeric string to a double.
3681- *
3682- * @param numStr the string we want to convert.
3683- * @return The string converted to a double
3684- */
3685- Q_INVOKABLE double readNumber(const QString &numStr) const;
3686-
3687- /**
3688- * Flags for readDate()
3689- */
3690- enum ReadDateFlags {
3691- NormalFormat = 1, /**< Only accept a date string in
3692- the locale LongDate format */
3693- ShortFormat = 2, /**< Only accept a date string in
3694- the locale ShortDate format */
3695- IsoFormat = 4, /**< Only accept a date string in
3696- ISO date format (YYYY-MM-DD) */
3697- IsoWeekFormat = 8, /**< Only accept a date string in
3698- ISO Week date format (YYYY-Www-D) */
3699- IsoOrdinalFormat = 16 /**< Only accept a date string in
3700- ISO Week date format (YYYY-DDD) */
3701- };
3702-
3703- /**
3704- * Converts a localized date string to a QDate.
3705- * This method is stricter than readDate(str,&ok): it will only accept
3706- * a date in a specific format, depending on @p flags.
3707- *
3708- * @param str the string we want to convert.
3709- * @param flags what format the the date string will be in
3710- * @return The string converted to a QDate
3711- * @see CalendarSystem::readDate()
3712- */
3713- Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags) const;
3714-
3715- /**
3716- * Converts a localized time string to a QTime.
3717- * This method will try to parse it with seconds, then without seconds.
3718- *
3719- * @param str the string we want to convert.
3720- *
3721- * @return The string converted to a QTime
3722- */
3723- Q_INVOKABLE QTime readTime(const QString &str) const;
3724-
3725- /**
3726- * Additional processing options for readLocaleTime().
3727- *
3728- * @remarks This is currently used as an enum but declared as a flag
3729- * to be extensible
3730- */
3731- enum TimeProcessingOption {
3732- ProcessStrict = 0x1, ///< Process time in a strict manner, ie.
3733- ///< a read time string has to exactly match
3734- ///< the defined time format.
3735- ProcessNonStrict = 0x2 ///< Process time in a lax manner, ie.
3736- ///< allow spaces in the time-format to be
3737- ///< left out when entering a time string.
3738- };
3739-
3740- Q_DECLARE_FLAGS(TimeProcessingOptions, TimeProcessingOption)
3741-
3742- /**
3743- *
3744- * Converts a localized time string to a QTime.
3745- * This method is stricter than readTime(str, &ok) in that it will either
3746- * accept a time with seconds or a time without seconds.
3747- *
3748- * @param str the string we want to convert
3749- * @param ok the boolean that is set to false if it's not a valid time.
3750- * If @p ok is 0, it will be ignored.
3751- * @param options format option to apply when formatting the time
3752- * @param processing if set to @c ProcessStrict, checking will be strict
3753- * and the read time string has to have the exact time format
3754- * specified. If set to @c ProcessNonStrict processing the time
3755- * is lax and spaces in the time string can be left out.
3756- *
3757- * @return The string converted to a QTime
3758- */
3759-
3760- Q_INVOKABLE QTime readLocaleTime(const QString &str,
3761- TimeFormatOptions options = Locale::TimeDefault,
3762- TimeProcessingOptions processing = ProcessNonStrict) const;
3763-
3764- /**
3765- * Returns the language code used by this object. The domain AND the
3766- * library translation must be available in this language.
3767- * defaultLanguage() is returned by default, if no other available.
3768- *
3769- * Use languageCodeToName(language) to get human readable, localized
3770- * language name.
3771- *
3772- * @return the currently used language code
3773- *
3774- * @see languageCodeToName
3775- */
3776- QString language() const;
3777-
3778- /**
3779- * Returns the country code of the country where the user lives.
3780- *
3781- * The returned code complies with the ISO 3166-1 alpha-2 standard,
3782- * except by KDE convention it is returned in lowercase whereas the
3783- * official standard is uppercase.
3784- * See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for details.
3785- *
3786- * defaultCountry() is returned by default, if no other available,
3787- * this will always be uppercase 'C'.
3788- *
3789- * Use countryCodeToName(country) to get human readable, localized
3790- * country names.
3791- *
3792- * @return the country code for the user
3793- *
3794- * @see countryCodeToName
3795- */
3796- QString country() const;
3797-
3798- /**
3799- *
3800- * Returns the Country Division Code of the Country where the user lives.
3801- * When no value is set, then the Country Code will be returned.
3802- *
3803- * The returned code complies with the ISO 3166-2 standard.
3804- * See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
3805- *
3806- * Note that unlike country() this method will return the correct case,
3807- * i.e. normally uppercase..
3808- *
3809- * In KDE 4.6 it is the apps responsibility to obtain a translation for the
3810- * code, translation and other services will be priovided in KDE 4.7.
3811- *
3812- * @return the Country Division Code for the user
3813- * @see setCountryDivisionCode
3814- */
3815- QString countryDivisionCode() const;
3816-
3817- /**
3818- * Returns the language codes selected by user, ordered by decreasing
3819- * priority.
3820- *
3821- * Use languageCodeToName(language) to get human readable, localized
3822- * language name.
3823- *
3824- * @return list of language codes
3825- *
3826- * @see languageCodeToName
3827- */
3828- QStringList languageList() const;
3829-
3830- /**
3831- *
3832- * Returns the ISO Currency Codes used in the locale, ordered by decreasing
3833- * priority.
3834- *
3835- * Use KCurrency::currencyCodeToName(currencyCode) to get human readable,
3836- * localized language name.
3837- *
3838- * @return list of ISO Currency Codes
3839- *
3840- * @see currencyCodeToName
3841- */
3842- QStringList currencyCodeList() const;
3843-
3844- /**
3845- * Returns the file encoding.
3846- *
3847- * @return The Mib of the file encoding
3848- *
3849- * @see QFile::encodeName
3850- * @see QFile::decodeName
3851- */
3852- int fileEncodingMib() const;
3853-
3854- /**
3855- * Changes the current date format.
3856- *
3857- * The format of the date is a string which contains variables that will
3858- * be replaced:
3859- * @li %Y with the whole year (e.g. "2004" for "2004")
3860- * @li %y with the lower 2 digits of the year (e.g. "04" for "2004")
3861- * @li %n with the month (January="1", December="12")
3862- * @li %m with the month with two digits (January="01", December="12")
3863- * @li %e with the day of the month (e.g. "1" on the first of march)
3864- * @li %d with the day of the month with two digits (e.g. "01" on the first of march)
3865- * @li %b with the short form of the month (e.g. "Jan" for January)
3866- * @li %B with the long form of the month (e.g. "January")
3867- * @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
3868- * @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
3869- *
3870- * Everything else in the format string will be taken as is.
3871- * For example, March 20th 1989 with the format "%y:%m:%d" results
3872- * in "89:03:20".
3873- *
3874- * @param format The new date format
3875- */
3876- void setDateFormat(const QString & format);
3877-
3878- /**
3879- * Changes the current short date format.
3880- *
3881- * The format of the date is a string which contains variables that will
3882- * be replaced:
3883- * @li %Y with the whole year (e.g. "1984" for "1984")
3884- * @li %y with the lower 2 digits of the year (e.g. "84" for "1984")
3885- * @li %n with the month (January="1", December="12")
3886- * @li %m with the month with two digits (January="01", December="12")
3887- * @li %e with the day of the month (e.g. "1" on the first of march)
3888- * @li %d with the day of the month with two digits(e.g. "01" on the first of march)
3889- * @li %b with the short form of the month (e.g. "Jan" for January)
3890- * @li %B with the long form of the month (e.g. "January")
3891- * @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
3892- * @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
3893- *
3894- * Everything else in the format string will be taken as is.
3895- * For example, March 20th 1989 with the format "%y:%m:%d" results
3896- * in "89:03:20".
3897- *
3898- * @param format The new short date format
3899- */
3900- void setDateFormatShort(const QString & format);
3901-
3902- /**
3903- * Changes the form of month name used in dates.
3904- *
3905- * @param possessive True if possessive forms should be used
3906- */
3907- void setDateMonthNamePossessive(bool possessive);
3908-
3909- /**
3910- * Changes the current time format.
3911- *
3912- * The format of the time is string a which contains variables that will
3913- * be replaced:
3914- * @li %H with the hour in 24h format and 2 digits (e.g. 5pm is "17", 5am is "05")
3915- * @li %k with the hour in 24h format and one digits (e.g. 5pm is "17", 5am is "5")
3916- * @li %I with the hour in 12h format and 2 digits (e.g. 5pm is "05", 5am is "05")
3917- * @li %l with the hour in 12h format and one digits (e.g. 5pm is "5", 5am is "5")
3918- * @li %M with the minute with 2 digits (e.g. the minute of 07:02:09 is "02")
3919- * @li %S with the seconds with 2 digits (e.g. the minute of 07:02:09 is "09")
3920- * @li %p with pm or am (e.g. 17.00 is "pm", 05.00 is "am")
3921- *
3922- * Everything else in the format string will be taken as is.
3923- * For example, 5.23pm with the format "%H:%M" results
3924- * in "17:23".
3925- *
3926- * @param format The new time format
3927- */
3928- void setTimeFormat(const QString & format);
3929-
3930- /**
3931- *
3932- * Set digit characters used to display dates and time.
3933- *
3934- * @param digitSet the digit set identifier
3935- * @see DigitSet
3936- */
3937- void setDateTimeDigitSet(DigitSet digitSet);
3938-
3939- /**
3940- * Changes how KLocale defines the first day in week.
3941- *
3942- * @param day first day of the week (Monday=1..Sunday=7) as integer
3943- */
3944- void setWeekStartDay(int day);
3945-
3946- /**
3947- * Changes how KLocale defines the first working day in week.
3948- *
3949- * @param day first working day of the week (Monday=1..Sunday=7) as integer
3950- */
3951- void setWorkingWeekStartDay(int day);
3952-
3953- /**
3954- * Changes how KLocale defines the last working day in week.
3955- *
3956- * @param day last working day of the week (Monday=1..Sunday=7) as integer
3957- */
3958- void setWorkingWeekEndDay(int day);
3959-
3960- /**
3961- * Changes how KLocale defines the day reserved for religious observance.
3962- *
3963- * @param day day of the week for religious observance (None=0,Monday=1..Sunday=7) as integer
3964- */
3965- void setWeekDayOfPray(int day);
3966-
3967- /**
3968- * Returns the currently selected date format.
3969- *
3970- * @return Current date format.
3971- * @see setDateFormat()
3972- */
3973- QString dateFormat() const;
3974-
3975- /**
3976- * Returns the currently selected short date format.
3977- *
3978- * @return Current short date format.
3979- * @see setDateFormatShort()
3980- */
3981- QString dateFormatShort() const;
3982-
3983- /**
3984- * Returns the currently selected time format.
3985- *
3986- * @return Current time format.
3987- * @see setTimeFormat()
3988- */
3989- QString timeFormat() const;
3990-
3991- /**
3992- * Changes the symbol used to identify the decimal pointer.
3993- *
3994- * @param symbol The new decimal symbol.
3995- */
3996- void setDecimalSymbol(const QString & symbol);
3997-
3998- /**
3999- * Changes the separator used to group digits when formating numbers.
4000- *
4001- * @param separator The new thousands separator.
4002- */
4003- void setThousandsSeparator(const QString & separator);
4004-
4005- /**
4006- * Changes the sign used to identify a positive number. Normally this is
4007- * left blank.
4008- *
4009- * @param sign Sign used for positive numbers.
4010- */
4011- void setPositiveSign(const QString & sign);
4012-
4013- /**
4014- * Changes the sign used to identify a negative number.
4015- *
4016- * @param sign Sign used for negative numbers.
4017- */
4018- void setNegativeSign(const QString & sign);
4019-
4020- /**
4021- *
4022- * Changes the set of digit characters used to display numbers.
4023- *
4024- * @param digitSet the digit set identifier
4025- * @see DigitSet
4026- */
4027- void setDigitSet(DigitSet digitSet);
4028-
4029- /**
4030- * Changes the sign position used for positive monetary values.
4031- *
4032- * @param signpos The new sign position
4033- */
4034- void setPositiveMonetarySignPosition(SignPosition signpos);
4035-
4036- /**
4037- * Changes the sign position used for negative monetary values.
4038- *
4039- * @param signpos The new sign position
4040- */
4041- void setNegativeMonetarySignPosition(SignPosition signpos);
4042-
4043- /**
4044- * Changes the position where the currency symbol should be printed for
4045- * positive monetary values.
4046- *
4047- * @param prefix True if the currency symbol should be prefixed instead of
4048- * postfixed
4049- */
4050- void setPositivePrefixCurrencySymbol(bool prefix);
4051-
4052- /**
4053- * Changes the position where the currency symbol should be printed for
4054- * negative monetary values.
4055- *
4056- * @param prefix True if the currency symbol should be prefixed instead of
4057- * postfixed
4058- */
4059- void setNegativePrefixCurrencySymbol(bool prefix);
4060-
4061- /**
4062- *
4063- * Changes the number of decimal places used when formating numbers.
4064- *
4065- * @param digits The default number of digits to use.
4066- */
4067- void setDecimalPlaces(int digits);
4068-
4069- /**
4070- *
4071- * Changes the number of decimal places used when formating money.
4072- *
4073- * @param digits The default number of digits to use.
4074- */
4075- void setMonetaryDecimalPlaces(int digits);
4076-
4077- /**
4078- * Changes the separator used to group digits when formating monetary values.
4079- *
4080- * @param separator The new thousands separator.
4081- */
4082- void setMonetaryThousandsSeparator(const QString & separator);
4083-
4084- /**
4085- * Changes the symbol used to identify the decimal pointer for monetary
4086- * values.
4087- *
4088- * @param symbol The new decimal symbol.
4089- */
4090- void setMonetaryDecimalSymbol(const QString & symbol);
4091-
4092- /**
4093- *
4094- * Changes the current ISO Currency Code.
4095- *
4096- * @param newCurrencyCode The new Currency Code
4097- */
4098- void setCurrencyCode(const QString &newCurrencyCode);
4099-
4100- /**
4101- * Changes the current currency symbol.
4102- *
4103- * This symbol should be consistant with the selected Currency Code
4104- *
4105- * @param symbol The new currency symbol
4106- * @see currencyCode, KCurrency::currencySymbols
4107- */
4108- void setCurrencySymbol(const QString & symbol);
4109-
4110- /**
4111- *
4112- * Set digit characters used to display monetary values.
4113- *
4114- * @param digitSet the digit set identifier
4115- * @see DigitSet
4116- */
4117- void setMonetaryDigitSet(DigitSet digitSet);
4118-
4119- /**
4120- * Returns the preferred page size for printing.
4121- *
4122- * @return The preferred page size, cast it to QPrinter::PageSize
4123- */
4124- int pageSize() const;
4125-
4126- /**
4127- * Changes the preferred page size when printing.
4128- *
4129- * @param paperFormat the new preferred page size in the format QPrinter::PageSize
4130- */
4131- void setPageSize(int paperFormat);
4132-
4133- /**
4134- * The Metric system will give you information in mm, while the
4135- * Imperial system will give you information in inches.
4136- */
4137- enum MeasureSystem {
4138- Metric, ///< Metric system (used e.g. in Europe)
4139- Imperial ///< Imperial system (used e.g. in the United States)
4140- };
4141-
4142- /**
4143- * Returns which measuring system we use.
4144- *
4145- * @return The preferred measuring system
4146- */
4147- MeasureSystem measureSystem() const;
4148-
4149- /**
4150- * Changes the preferred measuring system.
4151- *
4152- * @return value The preferred measuring system
4153- */
4154- void setMeasureSystem(MeasureSystem value);
4155-
4156- /**
4157- * Translates a message as a QTranslator is supposed to.
4158- * The parameters are similar to i18n(), but the result
4159- * value has other semantics (it can be QString())
4160- */
4161- Q_INVOKABLE QString translateQt(const char *context, const char *sourceText, const char *comment) const;
4162-
4163- /**
4164- * Provides list of all known language codes.
4165- *
4166- * Use languageCodeToName(language) to get human readable, localized
4167- * language names.
4168- *
4169- * @return list of all language codes
4170- *
4171- * @see languageCodeToName
4172- * @see installedLanguages
4173- */
4174- QStringList allLanguagesList() const;
4175-
4176- /**
4177- *
4178- * Provides list of all installed KDE Language Translations.
4179- *
4180- * Use languageCodeToName(language) to get human readable, localized
4181- * language names.
4182- *
4183- * @return list of all installed language codes
4184- *
4185- * @see languageCodeToName
4186- */
4187- QStringList installedLanguages() const;
4188-
4189- /**
4190- * Convert a known language code to a human readable, localized form.
4191- * If an unknown language code is supplied, empty string is returned;
4192- * this will never happen if the code has been obtained by one of the
4193- * KLocale methods.
4194- *
4195- * @param language the language code
4196- *
4197- * @return the human readable and localized form if the code is known,
4198- * empty otherwise
4199- *
4200- * @see language
4201- * @see languageList
4202- * @see allLanguagesList
4203- * @see installedLanguages
4204- */
4205- Q_INVOKABLE QString languageCodeToName(const QString &language) const;
4206-
4207- /**
4208- * Provides list of all known country codes.
4209- *
4210- * Use countryCodeToName(country) to get human readable, localized
4211- * country names.
4212- *
4213- * @return a list of all country codes
4214- *
4215- * @see countryCodeToName
4216- */
4217- QStringList allCountriesList() const;
4218-
4219- /**
4220- * Convert a known country code to a human readable, localized form.
4221- *
4222- * If an unknown country code is supplied, empty string is returned;
4223- * this will never happen if the code has been obtained by one of the
4224- * KLocale methods.
4225- *
4226- * @param country the country code
4227- *
4228- * @return the human readable and localized form of the country name
4229- *
4230- * @see country
4231- * @see allCountriesList
4232- */
4233- Q_INVOKABLE QString countryCodeToName(const QString &country) const;
4234-
4235- /**
4236- * Parses locale string into distinct parts.
4237- * The format of locale is language_COUNTRY@modifier.CHARSET
4238- *
4239- * @param locale the locale string to split
4240- * @param language set to the language part of the locale
4241- * @param country set to the country part of the locale
4242- * @param modifier set to the modifer part of the locale
4243- * @param charset set to the charset part of the locale
4244- */
4245- Q_INVOKABLE void splitLocale(const QString &locale, QString &language, QString &country,
4246- QString &modifier, QString &charset);
4247-
4248- /**
4249- * Returns the name of the internal language.
4250- *
4251- * @return Name of the default language
4252- */
4253- QString defaultLanguage();
4254-
4255- /**
4256- * Returns the code of the default country, i.e. "C"
4257- *
4258- * This function will not provide a sensible value to use in your app,
4259- * please use country() instead.
4260- *
4261- * @see country
4262- *
4263- * @return Name of the default country
4264- */
4265- QString defaultCountry();
4266-
4267- /**
4268- *
4269- * Returns the ISO Code of the default currency.
4270- *
4271- * @return ISO Currency Code of the default currency
4272- */
4273- QString defaultCurrencyCode();
4274-
4275- /**
4276- * Reports whether evaluation of translation scripts is enabled.
4277- *
4278- * @return true if script evaluation is enabled, false otherwise.
4279- */
4280- bool useTranscript() const;
4281-
4282- /**
4283- * Checks whether or not the active catalog is found for the given language.
4284- *
4285- * @param language language to check
4286- */
4287- Q_INVOKABLE bool isApplicationTranslatedInto(const QString & language);
4288-
4289- /**
4290- *
4291- * Sets the Country Division Code of the Country where the user lives.
4292- *
4293- * The code must comply with the ISO 3166-2 standard.
4294- * See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
4295- *
4296- * In KDE 4.6 it is the apps responsibility to validate the input,
4297- * full validation and other services will be provided in KDE 4.7.
4298- *
4299- * @param countryDivision the Country Division Code for the user
4300- * @return @c true on success, @c false on failure
4301- * @see countryDivisionCode
4302- */
4303- bool setCountryDivisionCode(const QString & countryDivision);
4304-
4305- /**
4306- *
4307- * Removes accelerator marker from a UI text label.
4308- *
4309- * Accelerator marker is not always a plain ampersand (&),
4310- * so it is not enough to just remove it by @c QString::remove().
4311- * The label may contain escaped markers ("&&") which must be resolved
4312- * and skipped, as well as CJK-style markers ("Foo (&F)") where
4313- * the whole parenthesis construct should be removed.
4314- * Therefore always use this function to remove accelerator marker
4315- * from UI labels.
4316- *
4317- * @param label UI label which may contain an accelerator marker
4318- * @return label without the accelerator marker
4319- */
4320- Q_INVOKABLE QString removeAcceleratorMarker(const QString &label) const;
4321-
4322- /**
4323- *
4324- * Convert all digits in the string to the given digit set.
4325- *
4326- * Conversion is normally not performed if the given digit set
4327- * is not appropriate in the current locale and language context.
4328- * Unconditional conversion may be requested by setting
4329- * @p ignoreContext to @c true.
4330- *
4331- * @param str the string to convert
4332- * @param digitSet the digit set identifier
4333- * @param ignoreContext unconditional conversion if @c true
4334- *
4335- * @return string with converted digits
4336- *
4337- * @see DigitSet
4338- */
4339- Q_INVOKABLE QString convertDigits(const QString &str, DigitSet digitSet,
4340- bool ignoreContext = false) const;
4341-
4342- /**
4343- *
4344- * Reparse locale configuration files for the current selected
4345- * language.
4346- */
4347- Q_INVOKABLE void reparseConfiguration();
4348-
4349-private:
4350- KLocale *m_locale;
4351-
4352-Q_SIGNALS:
4353- void binaryUnitDialectChanged();
4354- void calendarSystemChanged();
4355- void countryDivisionCodeChanged();
4356- void currencyCodeChanged();
4357- void decimalSymbolChanged();
4358- void currencySymbolChanged();
4359- void dateFormatChanged();
4360- void dateFormatShortChanged();
4361- void dateMonthNamePossessiveChanged();
4362- void dateTimeDigitSetChanged();
4363- void decimalPlacesChanged();
4364- void digitSetChanged();
4365- void measureSystemChanged();
4366- void monetaryDecimalPlacesChanged();
4367- void monetaryDecimalSymbolChanged();
4368- void monetaryDigitSetChanged();
4369- void monetaryThousandsSeparatorChanged();
4370- void negativeMonetarySignPositionChanged();
4371- void negativePrefixCurrencySymbolChanged();
4372- void negativeSignChanged();
4373- void pageSizeChanged();
4374- void positiveMonetarySignPositionChanged();
4375- void positivePrefixCurrencySymbolChanged();
4376- void positiveSignChanged();
4377- void thousandsSeparatorChanged();
4378- void timeFormatChanged();
4379- void weekDayOfPrayChanged();
4380- void WeekNumberSystemChanged();
4381- void weekStartDayChanged();
4382- void workingWeekEndDayChanged();
4383- void workingWeekStartDayChanged();
4384-};
4385-
4386-#endif
This page took 0.74312 seconds and 4 git commands to generate.