~ubuntu-branches/ubuntu/quantal/kde-runtime/quantal

« back to all changes in this revision

Viewing changes to plasma/declarativeimports/locale/locale.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-06-03 21:50:00 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120603215000-vn7oarsq0ynrydj5
Tags: upstream-4.8.80
Import upstream version 4.8.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE libraries
 
2
    Copyright (C) 2012 Giorgos Tsiapaliwkas <terietor@gmail.com>
 
3
    Copyright (C) 2012 Antonis Tsiapaliokas <kok3rs@gmail.com>
 
4
 
 
5
    This library is free software; you can redistribute it and/or
 
6
    modify it under the terms of the GNU Library General Public
 
7
    License as published by the Free Software Foundation; either
 
8
    version 2 of the License, or (at your option) any later version.
 
9
 
 
10
    This library is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
    Library General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU Library General Public License
 
16
    along with this library; see the file COPYING.LIB.  If not, write to
 
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
    Boston, MA 02110-1301, USA.
 
19
*/
 
20
#ifndef LOCALE_H
 
21
#define LOCALE_H
 
22
 
 
23
//Qt
 
24
#include <QObject>
 
25
#include <QTime>
 
26
#include <QDate>
 
27
 
 
28
//KDE
 
29
#include <KLocale>
 
30
 
 
31
class QString;
 
32
class QDate;
 
33
class QTime;
 
34
class QDateTime;
 
35
 
 
36
/**
 
37
 * \file klocale.h
 
38
 */
 
39
 
 
40
/**
 
41
  *
 
42
  * KLocale provides support for country specific stuff like
 
43
  * the national language.
 
44
  *
 
45
  * KLocale supports translating, as well as specifying the format
 
46
  * for numbers, currency, time, and date.
 
47
  *
 
48
  * Use KGlobal::locale() to get pointer to the global KLocale object,
 
49
  * containing the applications current locale settings.
 
50
  *
 
51
  * For example, to format the date May 17, 1995 in the current locale, use:
 
52
  *
 
53
  * \code
 
54
  *   QString date = KGlobal::locale()->formatDate(QDate(1995,5,17));
 
55
  * \endcode
 
56
  *
 
57
  * @author Stephan Kulow <coolo@kde.org>, Preston Brown <pbrown@kde.org>,
 
58
  * Hans Petter Bieker <bieker@kde.org>, Lukas Tinkl <lukas.tinkl@suse.cz>
 
59
  * @short class for supporting locale settings and national language
 
60
  */
 
61
class Locale : public QObject
 
62
{
 
63
Q_OBJECT
 
64
 
 
65
//enuns
 
66
Q_ENUMS(BinarySizeUnits)
 
67
Q_ENUMS(BinaryUnitDialect)
 
68
Q_ENUMS(CalendarSystem)
 
69
Q_ENUMS(DateFormat)
 
70
Q_ENUMS(DateTimeComponent)
 
71
Q_ENUMS(DateTimeComponentFormat)
 
72
Q_ENUMS(DateTimeFormatOption )
 
73
Q_ENUMS(DigitSet)
 
74
Q_ENUMS(MeasureSystem)
 
75
Q_ENUMS(ReadDateFlags)
 
76
Q_ENUMS(SignPosition)
 
77
Q_ENUMS(TimeFormatOption)
 
78
Q_ENUMS(TimeProcessingOption)
 
79
Q_ENUMS(WeekNumberSystem)
 
80
 
 
81
//properties
 
82
Q_PROPERTY(BinaryUnitDialect binaryUnitDialect READ binaryUnitDialect WRITE setBinaryUnitDialect NOTIFY binaryUnitDialectChanged)
 
83
Q_PROPERTY(Locale::CalendarSystem calendarSystem READ calendarSystem WRITE setCalendarSystem NOTIFY calendarSystemChanged)
 
84
Q_PROPERTY(QString country READ country CONSTANT) //read-only
 
85
Q_PROPERTY(QString countryDivisionCode READ countryDivisionCode WRITE setCountryDivisionCode NOTIFY countryDivisionCodeChanged)
 
86
Q_PROPERTY(QString currencyCode READ currencyCode WRITE setCurrencyCode NOTIFY currencyCodeChanged)
 
87
Q_PROPERTY(QString currencySymbol READ currencySymbol WRITE setCurrencySymbol NOTIFY currencySymbolChanged)
 
88
Q_PROPERTY(QString dateFormat READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged)
 
89
Q_PROPERTY(QString dateFormatShort READ dateFormatShort WRITE setDateFormat NOTIFY dateFormatShortChanged)
 
90
Q_PROPERTY(bool dateMonthNamePossessive READ dateMonthNamePossessive WRITE setDateMonthNamePossessive NOTIFY dateMonthNamePossessiveChanged)
 
91
Q_PROPERTY(DigitSet dateTimeDigitSet READ dateTimeDigitSet WRITE setDateTimeDigitSet NOTIFY dateTimeDigitSetChanged)
 
92
Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces NOTIFY decimalPlacesChanged)
 
93
Q_PROPERTY(QString decimalSymbol READ decimalSymbol WRITE setDecimalSymbol NOTIFY decimalSymbolChanged)
 
94
Q_PROPERTY(DigitSet digitSet READ digitSet WRITE setDigitSet NOTIFY digitSetChanged)
 
95
Q_PROPERTY(QString language READ language CONSTANT) //read-only
 
96
Q_PROPERTY(MeasureSystem measureSystem READ measureSystem WRITE setMeasureSystem NOTIFY measureSystemChanged)
 
97
Q_PROPERTY(int monetaryDecimalPlaces READ monetaryDecimalPlaces WRITE setMonetaryDecimalPlaces NOTIFY monetaryDecimalPlacesChanged)
 
98
Q_PROPERTY(QString monetaryDecimalSymbol READ monetaryDecimalSymbol WRITE setMonetaryDecimalSymbol NOTIFY monetaryDecimalSymbolChanged)
 
99
Q_PROPERTY(DigitSet monetaryDigitSet READ monetaryDigitSet WRITE setMonetaryDigitSet NOTIFY monetaryDigitSetChanged)
 
100
Q_PROPERTY(QString monetaryThousandsSeparator READ monetaryThousandsSeparator WRITE setMonetaryThousandsSeparator NOTIFY monetaryThousandsSeparatorChanged)
 
101
Q_PROPERTY(SignPosition negativeMonetarySignPosition READ negativeMonetarySignPosition WRITE setNegativeMonetarySignPosition NOTIFY negativeMonetarySignPositionChanged)
 
102
Q_PROPERTY(bool negativePrefixCurrencySymbol READ negativePrefixCurrencySymbol WRITE setNegativePrefixCurrencySymbol NOTIFY negativePrefixCurrencySymbolChanged)
 
103
Q_PROPERTY(QString negativeSign READ negativeSign WRITE setNegativeSign NOTIFY negativeSignChanged)
 
104
Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize NOTIFY pageSizeChanged)
 
105
Q_PROPERTY(SignPosition positiveMonetarySignPosition READ positiveMonetarySignPosition WRITE setPositiveMonetarySignPosition NOTIFY positiveMonetarySignPositionChanged)
 
106
Q_PROPERTY(bool positivePrefixCurrencySymbol READ positivePrefixCurrencySymbol WRITE setPositivePrefixCurrencySymbol NOTIFY positivePrefixCurrencySymbolChanged)
 
107
Q_PROPERTY(QString positiveSign READ positiveSign WRITE setPositiveSign NOTIFY positiveSignChanged)
 
108
Q_PROPERTY(QString thousandsSeparator READ thousandsSeparator WRITE setThousandsSeparator NOTIFY thousandsSeparatorChanged)
 
109
Q_PROPERTY(int weekDayOfPray READ weekDayOfPray WRITE setWeekDayOfPray NOTIFY weekDayOfPrayChanged)
 
110
Q_PROPERTY(Locale::WeekNumberSystem weekNumberSystem READ weekNumberSystem WRITE setWeekNumberSystem NOTIFY WeekNumberSystemChanged)
 
111
Q_PROPERTY(int weekStartDay READ weekStartDay WRITE setWeekStartDay NOTIFY weekStartDayChanged)
 
112
Q_PROPERTY(int workingWeekEndDay READ workingWeekEndDay WRITE setWorkingWeekEndDay NOTIFY workingWeekEndDayChanged)
 
113
Q_PROPERTY(int workingWeekStartDay READ workingWeekStartDay WRITE setWorkingWeekStartDay NOTIFY workingWeekStartDayChanged)
 
114
Q_PROPERTY(bool use12Clock READ use12Clock CONSTANT)
 
115
Q_PROPERTY(QString defaultLanguage READ defaultLanguage CONSTANT)//read-only
 
116
Q_PROPERTY(QString defaultCountry READ defaultCountry CONSTANT)//read-only
 
117
Q_PROPERTY(QString defaultCurrencyCode READ defaultCurrencyCode CONSTANT)//read-only
 
118
Q_PROPERTY(bool useTranscript READ useTranscript CONSTANT) //read-only
 
119
Q_PROPERTY(int fileEncodingMib READ fileEncodingMib CONSTANT) //read-only
 
120
Q_PROPERTY(QStringList languageList READ languageList CONSTANT) //read-only
 
121
Q_PROPERTY(QStringList currencyCodeList READ currencyCodeList CONSTANT) //read-only
 
122
Q_PROPERTY(QStringList allLanguagesList READ allLanguagesList CONSTANT) //read-only
 
123
Q_PROPERTY(QStringList installedLanguages READ installedLanguages CONSTANT) //read-only
 
124
Q_PROPERTY(QStringList allCountriesList READ allCountriesList CONSTANT) //read-only
 
125
Q_PROPERTY(QList<int> allDigitSetsList READ allDigitSetsList CONSTANT) //read-only
 
126
 
 
127
public:
 
128
    /**
 
129
     * ctor
 
130
     */
 
131
    Locale(QObject *parent = 0);
 
132
 
 
133
    /**
 
134
     * Various positions for where to place the positive or negative
 
135
     * sign when they are related to a monetary value.
 
136
     */
 
137
    enum SignPosition {
 
138
        /**
 
139
         * Put parantheses around the quantity, e.g. "$ (217)"
 
140
         */
 
141
        ParensAround = 0,
 
142
        /**
 
143
         * Prefix the quantity with the sign, e.g. "$ -217"
 
144
         */
 
145
        BeforeQuantityMoney = 1,
 
146
        /**
 
147
         * Suffix the quanitity with the sign, e.g. "$ 217-"
 
148
         */
 
149
        AfterQuantityMoney = 2,
 
150
        /**
 
151
         * Prefix the currency symbol with the sign, e.g. "-$ 217"
 
152
         */
 
153
        BeforeMoney = 3,
 
154
        /**
 
155
         * Suffix the currency symbol with the sign, e.g. "$- 217"
 
156
         */
 
157
        AfterMoney = 4
 
158
    };
 
159
 
 
160
    /**
 
161
     *
 
162
     * The set of digit characters used to display and enter numbers.
 
163
     */
 
164
    enum DigitSet {
 
165
        ArabicDigits,             /**< 0123456789 (European and some Asian
 
166
                                       languages and western Arabic dialects) */
 
167
        ArabicIndicDigits,        /**< ٠١٢٣٤٥٦٧٨٩ (eastern Arabic dialects) */
 
168
        EasternArabicIndicDigits, /**< ۰۱۲۳۴۵۶۷۸۹ (Persian and Urdu) */
 
169
        DevenagariDigits,         /**< ०१२३४५६७८९ (Hindi) */
 
170
        BengaliDigits,            /**< ০১২৩৪৫৬৭৮৯ (Bengali and  Assamese) */
 
171
        GujaratiDigits,           /**< ૦૧૨૩૪૫૬૭૮૯ (Gujarati) */
 
172
        GurmukhiDigits,           /**< ੦੧੨੩੪੫੬੭੮੯ (Punjabi) */
 
173
        KannadaDigits,            /**< ೦೧೨೩೪೫೬೭೮೯ (Kannada) */
 
174
        KhmerDigits,              /**< ០១២៣៤៥៦៧៨៩ (Khmer) */
 
175
        MalayalamDigits,          /**< ൦൧൨൩൪൫൬൭൮൯ (Malayalam) */
 
176
        OriyaDigits,              /**< ୦୧୨୩୪୫୬୭୮୯ (Oriya) */
 
177
        TamilDigits,              /**< ௦௧௨௩௪௫௬௭௮ (Tamil) */
 
178
        TeluguDigits,             /**< ౦౧౨౩౪౫౬౭౯ (Telugu) */
 
179
        ThaiDigits                /**< ๐๑๒๓๔๕๖๗๘๙ (Thai) */
 
180
    // The following Decimal Digit Sets are defined in Unicode but the associated
 
181
    // languages are not yet translated in KDE, so are not yet enabled.
 
182
    // The script names are taken from the Unicode standard, the associated
 
183
    // languages from Wikipedia.
 
184
    //  BalineseDigits,           /**< ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙ (Balinese) */
 
185
    //  ChamDigits,               /**< ꩐꩑꩒꩓꩔꩕꩖꩗꩘꩙ (Cham) */
 
186
    //  JavaneseDigits,           /**< ꧐꧑꧒꧓꧔꧕꧖꧗꧘꧙ (Javanese) */
 
187
    //  KayahLiDigits,            /**< ꤀꤁꤂꤃꤄꤅꤆꤇꤈꤉ (Kayah) */
 
188
    //  LaoDigits,                /**< ໐໑໒໓໔໕໖໗໘໙ (Lao) */
 
189
    //  LepchaDigits,             /**< ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉ (Lepcha) */
 
190
    //  LimbuDigits,              /**< ᥆᥇᥈᥉᥊᥋᥌᥍᥎᥏ (Limbu) */
 
191
    //  MeeteiMayekDigits,        /**< ꯰꯱꯲꯳꯴꯵꯶꯷꯸꯹ (Meitei) */
 
192
    //  MongolianDigits,          /**< ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙ (Mongolian) */
 
193
    //  MyanmarDigits,            /**< ၀၁၂၃၄၅၆၇၈၉ (Myanmar/Burmese ) */
 
194
    //  MyanmarShanDigits,        /**< ႐႑႒႓႔႕႖႗႘႙ (Shan) */
 
195
    //  NewTaiLueDigits,          /**< ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙ (Tai Lü) */
 
196
    //  NKoDigits,                /**< ߀߁߂߃߄߅߆߇߈߉ (Mande and N'Ko) */
 
197
    //  OlChikiDigits,            /**< ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙ (Santali) */
 
198
    //  OsmanyaDigits,            /**< ҠҡҢңҤҥҦҧҨҩ (Somali) */
 
199
    //  SaurashtraDigits,         /**< ꣐꣑꣒꣓꣔꣕꣖꣗꣘꣙ (Saurashtra) */
 
200
    //  SundaneseDigits,          /**< ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹ (Sundanese) */
 
201
    //  TaiThamDigits,            /**< ᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙ (Tai Lü) */
 
202
    //  TibetanDigits,            /**< ༠༡༢༣༤༥༦༧༨༩ (Tibetan) */
 
203
    //  VaiDigits,                /**< ꘠꘡꘢꘣꘤꘥꘦꘧꘨꘩ (Vai) */
 
204
    };
 
205
 
 
206
    /**
 
207
     *
 
208
     * Convert a digit set identifier to a human readable, localized name.
 
209
     *
 
210
     * @param digitSet the digit set identifier
 
211
     * @param withDigits whether to add the digits themselves to the name
 
212
     *
 
213
     * @return the human readable and localized name of the digit set
 
214
     *
 
215
     * @see DigitSet
 
216
     */
 
217
    QString digitSetToName(DigitSet digitSet, bool withDigits = false) const;
 
218
 
 
219
    /**
 
220
     *
 
221
     * Provides list of all known digit set identifiers.
 
222
     *
 
223
     * @return list of all digit set identifiers
 
224
     * @see DigitSet
 
225
     * @see digitSetToName
 
226
     */
 
227
    QList<int> allDigitSetsList() const;
 
228
 
 
229
    /**
 
230
     * Returns what a decimal point should look like ("." or "," etc.)
 
231
     * according to the current locale or user settings.
 
232
     *
 
233
     * @return The decimal symbol used by locale.
 
234
     */
 
235
    QString decimalSymbol() const;
 
236
 
 
237
    /**
 
238
     * Returns what the thousands separator should look
 
239
     * like ("," or "." etc.)
 
240
     * according to the current locale or user settings.
 
241
     *
 
242
     * @return The thousands separator used by locale.
 
243
     */
 
244
    QString thousandsSeparator() const;
 
245
 
 
246
    /**
 
247
     *
 
248
     * Returns the identifier of the digit set used to display numbers.
 
249
     *
 
250
     * @return the digit set identifier
 
251
     * @see DigitSet
 
252
     * @see digitSetToName
 
253
     */
 
254
    DigitSet digitSet() const;
 
255
 
 
256
    /**
 
257
     *
 
258
     * Returns the ISO 4217 Currency Code for the current locale
 
259
     *
 
260
     * @return The default ISO Currency Code used by locale.
 
261
    */
 
262
    QString currencyCode() const;
 
263
 
 
264
    /**
 
265
     * Returns what the symbol denoting currency in the current locale
 
266
     * as as defined by user settings should look like.
 
267
     *
 
268
     * @return The default currency symbol used by locale.
 
269
     */
 
270
    QString currencySymbol() const;
 
271
 
 
272
    /**
 
273
     * Returns what a decimal point should look like ("." or "," etc.)
 
274
     * for monetary values, according to the current locale or user
 
275
     * settings.
 
276
     *
 
277
     * @return The monetary decimal symbol used by locale.
 
278
     */
 
279
    QString monetaryDecimalSymbol() const;
 
280
 
 
281
    /**
 
282
     * Returns what a thousands separator for monetary values should
 
283
     * look like ("," or " " etc.) according to the current locale or
 
284
     * user settings.
 
285
     *
 
286
     * @return The monetary thousands separator used by locale.
 
287
     */
 
288
    QString monetaryThousandsSeparator() const;
 
289
 
 
290
    /**
 
291
     * Returns what a positive sign should look like ("+", " ", etc.)
 
292
     * according to the current locale or user settings.
 
293
     *
 
294
     * @return The positive sign used by locale.
 
295
     */
 
296
    QString positiveSign() const;
 
297
 
 
298
    /**
 
299
     * Returns what a negative sign should look like ("-", etc.)
 
300
     * according to the current locale or user settings.
 
301
     *
 
302
     * @return The negative sign used by locale.
 
303
     */
 
304
    QString negativeSign() const;
 
305
 
 
306
    /**
 
307
     *
 
308
     * The number of decimal places to include in numeric values (usually 2).
 
309
     *
 
310
     * @return Default number of numeric decimal places used by locale.
 
311
     */
 
312
    int decimalPlaces() const;
 
313
 
 
314
    /**
 
315
     *
 
316
     * The number of decimal places to include in monetary values (usually 2).
 
317
     *
 
318
     * @return Default number of monetary decimal places used by locale.
 
319
     */
 
320
    int monetaryDecimalPlaces() const;
 
321
 
 
322
    /**
 
323
     * If and only if the currency symbol precedes a positive value,
 
324
     * this will be true.
 
325
     *
 
326
     * @return Where to print the currency symbol for positive numbers.
 
327
     */
 
328
    bool positivePrefixCurrencySymbol() const;
 
329
 
 
330
    /**
 
331
     * If and only if the currency symbol precedes a negative value,
 
332
     * this will be true.
 
333
     *
 
334
     * @return True if the currency symbol precedes negative numbers.
 
335
     */
 
336
    bool negativePrefixCurrencySymbol() const;
 
337
 
 
338
    /**
 
339
     * Returns the position of a positive sign in relation to a
 
340
     * monetary value.
 
341
     *
 
342
     * @return Where/how to print the positive sign.
 
343
     * @see SignPosition
 
344
     */
 
345
    SignPosition positiveMonetarySignPosition() const;
 
346
 
 
347
    /**
 
348
     * Denotes where to place a negative sign in relation to a
 
349
     * monetary value.
 
350
     *
 
351
     * @return Where/how to print the negative sign.
 
352
     * @see SignPosition
 
353
     */
 
354
    SignPosition negativeMonetarySignPosition() const;
 
355
 
 
356
    /**
 
357
     *
 
358
     * Retuns the digit set used to display monetary values.
 
359
     *
 
360
     * @return the digit set identifier
 
361
     * @see DigitSet
 
362
     * @see digitSetToName
 
363
     */
 
364
    DigitSet monetaryDigitSet() const;
 
365
 
 
366
    /**
 
367
     * Given a double, converts that to a numeric string containing
 
368
     * the localized monetary equivalent.
 
369
     *
 
370
     * e.g. given 123456, return "$ 123,456.00".
 
371
     *
 
372
     * If precision isn't specified or is < 0, then the default monetaryDecimalPlaces() is used.
 
373
     *
 
374
     * @param num The number we want to format
 
375
     * @param currency The currency symbol you want.
 
376
     * @param precision Number of decimal places displayed
 
377
     *
 
378
     * @return The number of money as a localized string
 
379
     * @see monetaryDecimalPlaces()
 
380
     */
 
381
    Q_INVOKABLE QString formatMoney(double num, const QString &currency = QString(), int precision = -1) const;
 
382
 
 
383
    /**
 
384
     * Given a string representing a number, converts that to a numeric
 
385
     * string containing the localized numeric equivalent.
 
386
     *
 
387
     * e.g. given 123456.78F, return "123,456.78" (for some European country).
 
388
     *
 
389
     * If precision isn't specified or is < 0, then the default decimalPlaces() is used.
 
390
     *
 
391
     * @param numStr The number to format, as a string.
 
392
     * @param round Round fractional digits. (default true)
 
393
     * @param precision Number of fractional digits used for rounding. Unused if round=false.
 
394
     *
 
395
     * @return The number as a localized string
 
396
     */
 
397
    Q_INVOKABLE QString formatNumber(const QString &numStr, bool round = true, int precision = -1) const;
 
398
 
 
399
    /**
 
400
     * Given an integer, converts that to a numeric string containing
 
401
     * the localized numeric equivalent.
 
402
     *
 
403
     * e.g. given 123456L, return "123,456" (for some European country).
 
404
     *
 
405
     * @param num The number to convert
 
406
     *
 
407
     * @return The number as a localized string
 
408
     */
 
409
    Q_INVOKABLE QString formatLong(long num) const;
 
410
 
 
411
    /**
 
412
     * These binary units are used in KDE by the formatByteSize()
 
413
     * functions.
 
414
     *
 
415
     * NOTE: There are several different units standards:
 
416
     * 1) SI  (i.e. metric), powers-of-10.
 
417
     * 2) IEC, powers-of-2, with specific units KiB, MiB, etc.
 
418
     * 3) JEDEC, powers-of-2, used for solid state memory sizing which
 
419
     *    is why you see flash cards labels as e.g. 4GB.  These (ab)use
 
420
     *    the metric units.  Although JEDEC only defines KB, MB, GB, if
 
421
     *    JEDEC is selected all units will be powers-of-2 with metric
 
422
     *    prefixes for clarity in the event of sizes larger than 1024 GB.
 
423
     *
 
424
     * Although 3 different dialects are possible this enum only uses
 
425
     * metric names since adding all 3 different names of essentially the same
 
426
     * unit would be pointless.  Use BinaryUnitDialect to control the exact
 
427
     * units returned.
 
428
     *
 
429
     * @see binaryUnitDialect
 
430
     */
 
431
    enum BinarySizeUnits {
 
432
        /// Auto-choose a unit such that the result is in the range [0, 1000 or 1024)
 
433
        DefaultBinaryUnits = 1000,
 
434
 
 
435
        // The first real unit must be 0 for the current implementation!
 
436
        UnitByte = 0,      ///<  B         1 byte
 
437
        UnitKiloByte,  ///<  KiB/KB/kB 1024/1000 bytes.
 
438
        UnitMegaByte,  ///<  MiB/MB/MB 2^20/10^06 bytes.
 
439
        UnitGigaByte,  ///<  GiB/GB/GB 2^30/10^09 bytes.
 
440
        UnitTeraByte,  ///<  TiB/TB/TB 2^40/10^12 bytes.
 
441
        UnitPetaByte,  ///<  PiB/PB/PB 2^50/10^15 bytes.
 
442
        UnitExaByte,   ///<  EiB/EB/EB 2^60/10^18 bytes.
 
443
        UnitZettaByte, ///<  ZiB/ZB/ZB 2^70/10^21 bytes.
 
444
        UnitYottaByte, ///<  YiB/YB/YB 2^80/10^24 bytes.
 
445
        UnitLastUnit = UnitYottaByte
 
446
    };
 
447
 
 
448
    /**
 
449
     * This enum chooses what dialect is used for binary units.
 
450
     *
 
451
     * Note: Although JEDEC abuses the metric prefixes and can therefore be
 
452
     * confusing, it has been used to describe *memory* sizes for quite some time
 
453
     * and programs should therefore use either Default, JEDEC, or IEC 60027-2
 
454
     * for memory sizes.
 
455
     *
 
456
     * On the other hand network transmission rates are typically in metric so
 
457
     * Default, Metric, or IEC (which is unambiguous) should be chosen.
 
458
     *
 
459
     * Normally choosing DefaultBinaryUnits is the best option as that uses
 
460
     * the user's selection for units.
 
461
     *
 
462
     * @see binaryUnitDialect
 
463
     * @see setBinaryUnitDialect
 
464
     */
 
465
    enum BinaryUnitDialect {
 
466
        DefaultBinaryDialect = 1000, ///< Used if no specific preference
 
467
        IECBinaryDialect = 0,          ///< KDE Default, KiB, MiB, etc. 2^(10*n)
 
468
        JEDECBinaryDialect,        ///< KDE 3.5 default, KB, MB, etc. 2^(10*n)
 
469
        MetricBinaryDialect,       ///< SI Units, kB, MB, etc. 10^(3*n)
 
470
        LastBinaryDialect = MetricBinaryDialect
 
471
    };
 
472
 
 
473
    /**
 
474
     * Converts @p size from bytes to the string representation using the
 
475
     * user's default binary unit dialect.  The default unit dialect is
 
476
     * IEC 60027-2.
 
477
     *
 
478
     * Example:
 
479
     * formatByteSize(1024) returns "1.0 KiB" by default.
 
480
     *
 
481
     * @param  size  size in bytes
 
482
     * @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
 
483
     * @see BinaryUnitDialect
 
484
     * @todo KDE 5: Remove in favor of overload added in KDE 4.4.
 
485
     */
 
486
    Q_INVOKABLE QString formatByteSize(double size) const;
 
487
 
 
488
    /**
 
489
     *
 
490
     * Converts @p size from bytes to the appropriate string representation
 
491
     * using the binary unit dialect @p dialect and the specific units @p specificUnit.
 
492
     *
 
493
     * Example:
 
494
     * formatByteSize(1000, unit, Locale::BinaryUnitKilo) returns:
 
495
     *   for Locale::MetricBinaryUnits, "1.0 kB",
 
496
     *   for Locale::IECBinaryUnits,    "0.9 KiB",
 
497
     *   for Locale::JEDECBinaryUnits,  "0.9 KB".
 
498
     *
 
499
     * @param size size in bytes
 
500
     * @param precision number of places after the decimal point to use.  KDE uses
 
501
     *        1 by default so when in doubt use 1.
 
502
     * @param dialect binary unit standard to use.  Use DefaultBinaryUnits to
 
503
     *        use the localized user selection unless you need to use a specific
 
504
     *        unit type (such as displaying a flash memory size in JEDEC).
 
505
     * @param specificUnit specific unit size to use in result.  Use
 
506
     *        DefaultBinarySize to automatically select a unit that will return
 
507
     *        a sanely-sized number.
 
508
     * @return converted size as a translated string including the units.
 
509
     *         E.g. "1.23 KiB", "2 GB" (JEDEC), "4.2 kB" (Metric).
 
510
     * @see BinaryUnitDialect
 
511
     */
 
512
    QString formatByteSize(double size, int precision,
 
513
                           BinaryUnitDialect dialect = Locale::DefaultBinaryDialect,
 
514
                           BinarySizeUnits specificUnit = Locale::DefaultBinaryUnits) const;
 
515
 
 
516
    /**
 
517
     * Returns the user's configured binary unit dialect.
 
518
     * e.g. if MetricBinaryDialect is returned then the values
 
519
     * configured for how much a set of bytes are worth would
 
520
     * be 10^(3*n) and KB (1000 bytes == 1 KB), in this case.
 
521
     *
 
522
     * Will never return DefaultBinaryDialect.
 
523
     *
 
524
     * @return User's configured binary unit dialect
 
525
     * @see BinaryUnitDialect
 
526
     */
 
527
    BinaryUnitDialect binaryUnitDialect() const;
 
528
 
 
529
    /**
 
530
     * Sets @p newDialect to be the default dialect for this locale (and only
 
531
     * this locale).  Newly created KLocale objects will continue to default
 
532
     * to the user's choice.
 
533
     *
 
534
     * @param newDialect the new dialect to set as default for this locale object.
 
535
     */
 
536
    void setBinaryUnitDialect(BinaryUnitDialect newDialect);
 
537
 
 
538
    /**
 
539
     * Given a number of milliseconds, converts that to a string containing
 
540
     * the localized equivalent
 
541
     *
 
542
     * e.g. given formatDuration(60000), returns "1.0 minutes"
 
543
     *
 
544
     * @param mSec Time duration in milliseconds
 
545
     * @return converted duration as a string - e.g. "5.5 seconds" "23.0 minutes"
 
546
     */
 
547
    Q_INVOKABLE QString formatDuration(unsigned long mSec) const;
 
548
 
 
549
    /**
 
550
     * Given a number of milliseconds, converts that to a pretty string containing
 
551
     * the localized equivalent.
 
552
     *
 
553
     * e.g. given prettyFormatDuration(60001) returns "1 minute"
 
554
     *      given prettyFormatDuration(62005) returns "1 minute and 2 seconds"
 
555
     *      given prettyFormatDuration(90060000) returns "1 day and 1 hour"
 
556
     *
 
557
     * @param mSec Time duration in milliseconds
 
558
     * @return converted duration as a string.
 
559
     *         Units not interesting to the user, for example seconds or minutes when the first
 
560
     *         unit is day, are not returned because they are irrelevant. The same applies for
 
561
     *         seconds when the first unit is hour.
 
562
     */
 
563
    Q_INVOKABLE QString prettyFormatDuration(unsigned long mSec) const;
 
564
 
 
565
    /**
 
566
     *
 
567
     * Available Calendar Systems
 
568
     *
 
569
     * @see setCalendarSystem()
 
570
     * @see calendarSystem()
 
571
     */
 
572
    enum CalendarSystem {
 
573
        QDateCalendar = 1, /**< KDE Default, hybrid of Gregorian and Julian as used by QDate */
 
574
        //BahaiCalendar = 2, /**< Baha'i Calendar */
 
575
        //BuddhistLunarCalendar = 3, /**< Buddhist Lunar Calendar*/
 
576
        //ChineseCalendar = 4, /**< Chinese Calendar */
 
577
        CopticCalendar = 5, /**< Coptic Calendar as used Coptic Church and some parts of Egypt */
 
578
        EthiopianCalendar = 6, /**< Ethiopian Calendar, aka Ethiopic Calendar */
 
579
        //EthiopianAmeteAlemCalendar = 7, /**< Ethiopian Amete Alem version, aka Ethiopic Amete Alem */
 
580
        GregorianCalendar = 8, /**< Gregorian Calendar, pure proleptic implementation */
 
581
        HebrewCalendar = 9, /**< Hebrew Calendar, aka Jewish Calendar */
 
582
        //HinduCalendar = 10, /**< Hindu Lunar Calendar */
 
583
        //IslamicLunarCalendar = 11, /**< Islamic Lunar Calendar */
 
584
        IslamicCivilCalendar = 12, /**< Islamic Civil Calendar, aka Hijri, not the Lunar Calendar */
 
585
        //IslamicUmAlQuraCalendar = 13, /**< Islamic Lunar Calendar, Um Al Qura varient used in Saudi Arabia */
 
586
        IndianNationalCalendar = 14, /**< Indian National Calendar, not the Lunar Calendar */
 
587
        //Iso8601Calendar = 15, /**< ISO 8601 Standard Calendar */
 
588
        JalaliCalendar = 16, /**< Jalali Calendar, aka Persian or Iranian, also used in Afghanistan */
 
589
        //JalaliBirashkCalendar = 17, /**< Jalali Calendar, Birashk Algorythm variant */
 
590
        //Jalali33YearCalendar = 18, /**< Jalali Calendar, 33 Year cycle variant */
 
591
        JapaneseCalendar= 19, /**< Japanese Calendar, Gregorian calculation using Japanese Era (Nengô) */
 
592
        //JucheCalendar = 20, /**< Juche Calendar, used in North Korea */
 
593
        JulianCalendar = 21, /**< Julian Calendar, as used in Orthodox Churches */
 
594
        MinguoCalendar= 22, /**< Minguo Calendar, aka ROC, Republic of China or Taiwanese */
 
595
        ThaiCalendar = 23 /**< Thai Calendar, aka Buddhist or Thai Buddhist */
 
596
    };
 
597
 
 
598
    /**
 
599
     *
 
600
     * System used for Week Numbers
 
601
     *
 
602
     * @see setWeekNumberSystem()
 
603
     * @see weekNumberSystem()
 
604
     */
 
605
    enum WeekNumberSystem {
 
606
        DefaultWeekNumber = 1000, /**< The system locale default */
 
607
        IsoWeekNumber     =  0, /**< ISO Week Number */
 
608
        FirstFullWeek     =  1, /**< Week 1 starts on the first Week Start Day in year ends after 7 days */
 
609
        FirstPartialWeek  =  2, /**< Week 1 starts Jan 1st ends day before first Week Start Day in year */
 
610
        SimpleWeek        =  3  /**< Week 1 starts Jan 1st ends after 7 days */
 
611
    };
 
612
 
 
613
    /**
 
614
     *
 
615
     * The various Components that make up a Date / Time
 
616
     * In the future the Components may be combined as flags for dynamic
 
617
     * generation of Date Formats.
 
618
     *
 
619
     * @see CalendarSystem
 
620
     * @see KLocalizedDate
 
621
     * @see DateTimeComponentFormat
 
622
     */
 
623
    enum DateTimeComponent {
 
624
        Year          = 0x1,        /**< The Year portion of a date, may be number or name */
 
625
        YearName      = 0x2,        /**< The Year Name portion of a date */
 
626
        Month         = 0x4,        /**< The Month portion of a date, may be number or name */
 
627
        MonthName     = 0x8,        /**< The Month Name portion of a date */
 
628
        Day           = 0x10,       /**< The Day portion of a date, may be number or name */
 
629
        DayName       = 0x20,       /**< The Day Name portion of a date */
 
630
        JulianDay     = 0x40,       /**< The Julian Day of a date */
 
631
        EraName       = 0x80,       /**< The Era Name portion of a date */
 
632
        EraYear       = 0x100,      /**< The Era and Year portion of a date */
 
633
        YearInEra     = 0x200,      /**< The Year In Era portion of a date */
 
634
        DayOfYear     = 0x400,      /**< The Day Of Year portion of a date, may be number or name */
 
635
        DayOfYearName = 0x800,      /**< The Day Of Year Name portion of a date */
 
636
        DayOfWeek     = 0x1000,     /**< The Day Of Week / Weekday portion of a date, may be number or name */
 
637
        DayOfWeekName = 0x2000,     /**< The Day Of Week Name / Weekday Name portion of a date */
 
638
        Week          = 0x4000,     /**< The Week Number portion of a date */
 
639
        WeekYear      = 0x8000,     /**< The Week Year portion of a date */
 
640
        MonthsInYear  = 0x10000,    /**< The Months In Year portion of a date */
 
641
        WeeksInYear   = 0x20000,    /**< The Weeks In Year portion of a date */
 
642
        DaysInYear    = 0x40000,    /**< The Days In Year portion of a date */
 
643
        DaysInMonth   = 0x80000,    /**< The Days In Month portion of a date */
 
644
        DaysInWeek    = 0x100000,   /**< The Days In Week portion of a date */
 
645
        Hour          = 0x200000,   /**< The Hours portion of a date */
 
646
        Minute        = 0x400000,   /**< The Minutes portion of a date */
 
647
        Second        = 0x800000,   /**< The Seconds portion of a date */
 
648
        Millisecond   = 0x1000000,  /**< The Milliseconds portion of a date */
 
649
        DayPeriod     = 0x2000000,  /**< The Day Period portion of a date, e.g. AM/PM */
 
650
        DayPeriodHour = 0x4000000,  /**< The Day Period Hour portion of a date */
 
651
        Timezone      = 0x8000000,  /**< The Time Zone portion of a date, may be offset or name */
 
652
        TimezoneName  = 0x10000000, /**< The Time Zone Name portion of a date */
 
653
        UnixTime      = 0x20000000  /**< The UNIX Time portion of a date */
 
654
    };
 
655
 
 
656
    /**
 
657
     *
 
658
     * Format used for individual Date/Time Components when converted to/from a string
 
659
     * Largely equivalent to the UNICODE CLDR format width definitions 1..5
 
660
     *
 
661
     * @see DateTimeComponentFormat
 
662
     */
 
663
    enum DateTimeComponentFormat {
 
664
        DefaultComponentFormat = 1000, /**< The system locale default for the componant */
 
665
        ShortNumber = 0,             /**< Number at its natural width, e.g. 2 for the 2nd*/
 
666
        LongNumber,                  /**< Number padded to a required width, e.g. 02 for the 2nd*/
 
667
        //OrdinalNumber                /**< Ordinal number format, e.g. "2nd" for the 2nd */
 
668
        NarrowName = 3,              /**< Narrow text format, may not be unique, e.g. M for Monday */
 
669
        ShortName,                   /**< Short text format, e.g. Mon for Monday */
 
670
        LongName                     /**< Long text format, e.g. Monday for Monday */
 
671
    };
 
672
 
 
673
    Q_DECLARE_FLAGS(DateTimeComponents, DateTimeComponent)
 
674
 
 
675
    /**
 
676
     * Format for date string.
 
677
     */
 
678
    enum DateFormat {
 
679
        ShortDate,        /**< Locale Short date format, e.g. 08-04-2007 */
 
680
        LongDate,         /**< Locale Long date format, e.g. Sunday 08 April 2007 */
 
681
        FancyShortDate,   /**< Same as ShortDate for dates a week or more ago. For more
 
682
                               recent dates, it is represented as Today, Yesterday, or
 
683
                               the weekday name. */
 
684
        FancyLongDate,    /**< Same as LongDate for dates a week or more ago. For more
 
685
                               recent dates, it is represented as Today, Yesterday, or
 
686
                               the weekday name. */
 
687
        IsoDate,          /**< ISO-8601 Date format YYYY-MM-DD, e.g. 2009-12-31 */
 
688
        IsoWeekDate,      /**< ISO-8601 Week Date format YYYY-Www-D, e.g. 2009-W01-1 */
 
689
        IsoOrdinalDate    /**< ISO-8601 Ordinal Date format YYYY-DDD, e.g. 2009-001 */
 
690
    };
 
691
 
 
692
    /**
 
693
     * Returns a string formatted to the current locale's conventions
 
694
     * regarding dates.
 
695
     *
 
696
     * @param date the date to be formatted
 
697
     * @param format category of date format to use
 
698
     *
 
699
     * @return the date as a string
 
700
     */
 
701
    Q_INVOKABLE QString formatDate(const QDate &date, DateFormat format = LongDate) const;
 
702
 
 
703
    /**
 
704
     * Options for formatting date-time values.
 
705
     */
 
706
    enum DateTimeFormatOption {
 
707
        TimeZone = 0x01,    /**< Include a time zone string */
 
708
        Seconds  = 0x02     /**< Include the seconds value */
 
709
    };
 
710
 
 
711
    Q_DECLARE_FLAGS(DateTimeFormatOptions, DateTimeFormatOption)
 
712
 
 
713
    /**
 
714
     * Returns a string formatted to the current locale's conventions
 
715
     * regarding both date and time.
 
716
     *
 
717
     * @param dateTime the date and time to be formatted
 
718
     * @param format category of date format to use
 
719
     * @param options additional output options
 
720
     *
 
721
     * @return The date and time as a string
 
722
     */
 
723
    Q_INVOKABLE QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
 
724
                           DateTimeFormatOptions options = 0) const;
 
725
 
 
726
    /**
 
727
     * Use this to determine whether in dates a possessive form of month
 
728
     * name is preferred ("of January" rather than "January")
 
729
     *
 
730
     * @return If possessive form should be used
 
731
    */
 
732
    bool dateMonthNamePossessive() const;
 
733
 
 
734
    /**
 
735
     *
 
736
     * Format flags for readLocaleTime() and formatLocaleTime()
 
737
     */
 
738
    enum TimeFormatOption {
 
739
        TimeDefault        = 0x0,   ///< Default formatting using seconds and the format
 
740
                                    ///< as specified by the locale.
 
741
        TimeWithoutSeconds = 0x1,   ///< Exclude the seconds part of the time from display
 
742
        TimeWithoutAmPm    = 0x2,   ///< Read/format time string without am/pm suffix but
 
743
                                    ///< keep the 12/24h format as specified by locale time
 
744
                                    ///< format, eg. "07.33.05" instead of "07.33.05 pm" for
 
745
                                    ///< time format "%I.%M.%S %p".
 
746
        TimeDuration       = 0x6,   ///< Read/format time string as duration. This will strip
 
747
                                    ///< the am/pm suffix and read/format times with an hour
 
748
                                    ///< value of 0-23 hours, eg. "19.33.05" instead of
 
749
                                    ///< "07.33.05 pm" for time format "%I.%M.%S %p".
 
750
                                    ///< This automatically implies @c TimeWithoutAmPm.
 
751
        TimeFoldHours      = 0xE    ///< Read/format time string as duration. This will not
 
752
                                    ///< not output the hours part of the duration but will
 
753
                                    ///< add the hours (times sixty) to the number of minutes,
 
754
                                    ///< eg. "70.23" instead of "01.10.23" for time format
 
755
                                    ///< "%I.%M.%S %p".
 
756
    };
 
757
 
 
758
    Q_DECLARE_FLAGS(TimeFormatOptions, TimeFormatOption)
 
759
 
 
760
    /**
 
761
     *
 
762
     * Returns a string formatted to the current locale's conventions
 
763
     * regarding times.
 
764
     *
 
765
     * @param pTime the time to be formatted
 
766
     * @param options format option to use when formatting the time
 
767
     * @return The time as a string
 
768
     */
 
769
    Q_INVOKABLE QString formatLocaleTime(const QTime &pTime,
 
770
                             TimeFormatOptions options = Locale::TimeDefault) const;
 
771
 
 
772
    /**
 
773
     *
 
774
     * Returns the identifier of the digit set used to display dates and time.
 
775
     *
 
776
     * @return the digit set identifier
 
777
     * @see DigitSet
 
778
     * @see digitSetToName
 
779
     */
 
780
    DigitSet dateTimeDigitSet() const;
 
781
 
 
782
    /**
 
783
     * Use this to determine if the user wants a 12 hour clock.
 
784
     *
 
785
     * @return If the user wants 12h clock
 
786
     */
 
787
    bool use12Clock() const;
 
788
 
 
789
    /**
 
790
     *
 
791
     * Returns the Day Period matching the time given
 
792
     *
 
793
     * @param time the time to return the day period for
 
794
     * @param format the format to return teh day period in
 
795
     * @return the Day Period for the given time
 
796
     */
 
797
    Q_INVOKABLE QString dayPeriodText(const QTime &time, DateTimeComponentFormat format = DefaultComponentFormat) const;
 
798
 
 
799
    /**
 
800
     * Use this to determine which day is the first day of the week.
 
801
     *
 
802
     * @return an integer (Monday=1..Sunday=7)
 
803
     */
 
804
    int weekStartDay() const;
 
805
 
 
806
    /**
 
807
     * Use this to determine which day is the first working day of the week.
 
808
     *
 
809
     * @return an integer (Monday=1..Sunday=7)
 
810
     */
 
811
    int workingWeekStartDay() const;
 
812
 
 
813
    /**
 
814
     * Use this to determine which day is the last working day of the week.
 
815
     *
 
816
     * @return an integer (Monday=1..Sunday=7)
 
817
     */
 
818
    int workingWeekEndDay() const;
 
819
 
 
820
    /**
 
821
     * Use this to determine which day is reserved for religious observance
 
822
     *
 
823
     * @return day number (None = 0, Monday = 1, ..., Sunday = 7)
 
824
     */
 
825
    int weekDayOfPray() const;
 
826
 
 
827
    /**
 
828
     *
 
829
     * Returns the type of Calendar System used in this Locale
 
830
     *
 
831
     * @see Locale::CalendarSystem
 
832
     * @see CalendarSystem
 
833
     * @return the type of Calendar System
 
834
     */
 
835
    Locale::CalendarSystem calendarSystem() const;
 
836
 
 
837
    /**
 
838
     *
 
839
     * Sets the type of Calendar System to use in this Locale
 
840
     *
 
841
     * @see Locale::CalendarSystem
 
842
     * @see CalendarSystem
 
843
     * @param calendarSystem the Calendar System to use
 
844
     */
 
845
    void setCalendarSystem(Locale::CalendarSystem calendarSystem);
 
846
 
 
847
    /**
 
848
     *
 
849
     * Sets the type of Week Number System to use in this Locale
 
850
     *
 
851
     * @see Klocale::WeekNumberSystem
 
852
     * @see weekNumberSystem()
 
853
     * @param weekNumberSystem the Week Number System to use
 
854
     */
 
855
    void setWeekNumberSystem(Locale::WeekNumberSystem weekNumberSystem);
 
856
 
 
857
    /**
 
858
     *
 
859
     * Returns the type of Week Number System used in this Locale
 
860
     *
 
861
     * @see Klocale::WeekNumberSystem
 
862
     * @see setWeekNumberSystem()
 
863
     * @returns the Week Number System used
 
864
     */
 
865
    Locale::WeekNumberSystem weekNumberSystem() const;
 
866
 
 
867
    /**
 
868
     * Converts a localized monetary string to a double.
 
869
     *
 
870
     * @param numStr the string we want to convert.
 
871
     * @param ok the boolean that is set to false if it's not a number.
 
872
     *           If @p ok is 0, it will be ignored
 
873
     *
 
874
     * @return The string converted to a double
 
875
     */
 
876
    Q_INVOKABLE double readMoney(const QString &numStr) const;
 
877
 
 
878
    /**
 
879
     * Converts a localized numeric string to a double.
 
880
     *
 
881
     * @param numStr the string we want to convert.
 
882
     * @return The string converted to a double
 
883
     */
 
884
    Q_INVOKABLE double readNumber(const QString &numStr) const;
 
885
 
 
886
    /**
 
887
     * Flags for readDate()
 
888
     */
 
889
    enum ReadDateFlags {
 
890
        NormalFormat          =    1, /**< Only accept a date string in
 
891
                                           the locale LongDate format */
 
892
        ShortFormat           =    2, /**< Only accept a date string in
 
893
                                           the locale ShortDate format */
 
894
        IsoFormat             =    4, /**< Only accept a date string in
 
895
                                           ISO date format (YYYY-MM-DD) */
 
896
        IsoWeekFormat         =    8, /**< Only accept a date string in
 
897
                                           ISO Week date format (YYYY-Www-D) */
 
898
        IsoOrdinalFormat      =   16  /**< Only accept a date string in
 
899
                                           ISO Week date format (YYYY-DDD) */
 
900
    };
 
901
 
 
902
    /**
 
903
     * Converts a localized date string to a QDate.
 
904
     * This method is stricter than readDate(str,&ok): it will only accept
 
905
     * a date in a specific format, depending on @p flags.
 
906
     *
 
907
     * @param str the string we want to convert.
 
908
     * @param flags what format the the date string will be in
 
909
     * @return The string converted to a QDate
 
910
     * @see CalendarSystem::readDate()
 
911
     */
 
912
    Q_INVOKABLE QDate readDate(const QString &str, ReadDateFlags flags) const;
 
913
 
 
914
    /**
 
915
     * Converts a localized time string to a QTime.
 
916
     * This method will try to parse it with seconds, then without seconds.
 
917
     *
 
918
     * @param str the string we want to convert.
 
919
     *
 
920
     * @return The string converted to a QTime
 
921
     */
 
922
    Q_INVOKABLE QTime readTime(const QString &str) const;
 
923
 
 
924
    /**
 
925
     * Additional processing options for readLocaleTime().
 
926
     *
 
927
     * @remarks This is currently used as an enum but declared as a flag
 
928
     *          to be extensible
 
929
     */
 
930
    enum TimeProcessingOption {
 
931
        ProcessStrict    = 0x1,    ///< Process time in a strict manner, ie.
 
932
                                   ///< a read time string has to exactly match
 
933
                                   ///< the defined time format.
 
934
        ProcessNonStrict = 0x2     ///< Process time in a lax manner, ie.
 
935
                                   ///< allow spaces in the time-format to be
 
936
                                   ///< left out when entering a time string.
 
937
    };
 
938
 
 
939
    Q_DECLARE_FLAGS(TimeProcessingOptions, TimeProcessingOption)
 
940
 
 
941
    /**
 
942
     *
 
943
     * Converts a localized time string to a QTime.
 
944
     * This method is stricter than readTime(str, &ok) in that it will either
 
945
     * accept a time with seconds or a time without seconds.
 
946
     *
 
947
     * @param str the string we want to convert
 
948
     * @param ok the boolean that is set to false if it's not a valid time.
 
949
     *           If @p ok is 0, it will be ignored.
 
950
     * @param options format option to apply when formatting the time
 
951
     * @param processing if set to @c ProcessStrict, checking will be strict
 
952
     *               and the read time string has to have the exact time format
 
953
     *               specified. If set to @c ProcessNonStrict processing the time
 
954
     *               is lax and spaces in the time string can be left out.
 
955
     *
 
956
     * @return The string converted to a QTime
 
957
     */
 
958
 
 
959
    Q_INVOKABLE QTime readLocaleTime(const QString &str,
 
960
                         TimeFormatOptions options = Locale::TimeDefault,
 
961
                         TimeProcessingOptions processing = ProcessNonStrict) const;
 
962
 
 
963
    /**
 
964
     * Returns the language code used by this object. The domain AND the
 
965
     * library translation must be available in this language.
 
966
     * defaultLanguage() is returned by default, if no other available.
 
967
     *
 
968
     * Use languageCodeToName(language) to get human readable, localized
 
969
     * language name.
 
970
     *
 
971
     * @return the currently used language code
 
972
     *
 
973
     * @see languageCodeToName
 
974
     */
 
975
    QString language() const;
 
976
 
 
977
    /**
 
978
     * Returns the country code of the country where the user lives.
 
979
     *
 
980
     * The returned code complies with the ISO 3166-1 alpha-2 standard,
 
981
     * except by KDE convention it is returned in lowercase whereas the
 
982
     * official standard is uppercase.
 
983
     * See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for details.
 
984
     *
 
985
     * defaultCountry() is returned by default, if no other available,
 
986
     * this will always be uppercase 'C'.
 
987
     *
 
988
     * Use countryCodeToName(country) to get human readable, localized
 
989
     * country names.
 
990
     *
 
991
     * @return the country code for the user
 
992
     *
 
993
     * @see countryCodeToName
 
994
     */
 
995
    QString country() const;
 
996
 
 
997
    /**
 
998
     *
 
999
     * Returns the Country Division Code of the Country where the user lives.
 
1000
     * When no value is set, then the Country Code will be returned.
 
1001
     *
 
1002
     * The returned code complies with the ISO 3166-2 standard.
 
1003
     * See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
 
1004
     *
 
1005
     * Note that unlike country() this method will return the correct case,
 
1006
     * i.e. normally uppercase..
 
1007
     *
 
1008
     * In KDE 4.6 it is the apps responsibility to obtain a translation for the
 
1009
     * code, translation and other services will be priovided in KDE 4.7.
 
1010
     *
 
1011
     * @return the Country Division Code for the user
 
1012
     * @see setCountryDivisionCode
 
1013
     */
 
1014
    QString countryDivisionCode() const;
 
1015
 
 
1016
    /**
 
1017
     * Returns the language codes selected by user, ordered by decreasing
 
1018
     * priority.
 
1019
     *
 
1020
     * Use languageCodeToName(language) to get human readable, localized
 
1021
     * language name.
 
1022
     *
 
1023
     * @return list of language codes
 
1024
     *
 
1025
     * @see languageCodeToName
 
1026
     */
 
1027
    QStringList languageList() const;
 
1028
 
 
1029
    /**
 
1030
     *
 
1031
     * Returns the ISO Currency Codes used in the locale, ordered by decreasing
 
1032
     * priority.
 
1033
     *
 
1034
     * Use KCurrency::currencyCodeToName(currencyCode) to get human readable,
 
1035
     * localized language name.
 
1036
     *
 
1037
     * @return list of ISO Currency Codes
 
1038
     *
 
1039
     * @see currencyCodeToName
 
1040
     */
 
1041
    QStringList currencyCodeList() const;
 
1042
 
 
1043
    /**
 
1044
     * Returns the file encoding.
 
1045
     *
 
1046
     * @return The Mib of the file encoding
 
1047
     *
 
1048
     * @see QFile::encodeName
 
1049
     * @see QFile::decodeName
 
1050
     */
 
1051
    int fileEncodingMib() const;
 
1052
 
 
1053
    /**
 
1054
     * Changes the current date format.
 
1055
     *
 
1056
     * The format of the date is a string which contains variables that will
 
1057
     * be replaced:
 
1058
     * @li %Y with the whole year (e.g. "2004" for "2004")
 
1059
     * @li %y with the lower 2 digits of the year (e.g. "04" for "2004")
 
1060
     * @li %n with the month (January="1", December="12")
 
1061
     * @li %m with the month with two digits (January="01", December="12")
 
1062
     * @li %e with the day of the month (e.g. "1" on the first of march)
 
1063
     * @li %d with the day of the month with two digits (e.g. "01" on the first of march)
 
1064
     * @li %b with the short form of the month (e.g. "Jan" for January)
 
1065
     * @li %B with the long form of the month (e.g. "January")
 
1066
     * @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
 
1067
     * @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
 
1068
     *
 
1069
     * Everything else in the format string will be taken as is.
 
1070
     * For example, March 20th 1989 with the format "%y:%m:%d" results
 
1071
     * in "89:03:20".
 
1072
     *
 
1073
     * @param format The new date format
 
1074
     */
 
1075
    void setDateFormat(const QString & format);
 
1076
 
 
1077
    /**
 
1078
     * Changes the current short date format.
 
1079
     *
 
1080
     * The format of the date is a string which contains variables that will
 
1081
     * be replaced:
 
1082
     * @li %Y with the whole year (e.g. "1984" for "1984")
 
1083
     * @li %y with the lower 2 digits of the year (e.g. "84" for "1984")
 
1084
     * @li %n with the month (January="1", December="12")
 
1085
     * @li %m with the month with two digits (January="01", December="12")
 
1086
     * @li %e with the day of the month (e.g. "1" on the first of march)
 
1087
     * @li %d with the day of the month with two digits(e.g. "01" on the first of march)
 
1088
     * @li %b with the short form of the month (e.g. "Jan" for January)
 
1089
     * @li %B with the long form of the month (e.g. "January")
 
1090
     * @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
 
1091
     * @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
 
1092
     *
 
1093
     * Everything else in the format string will be taken as is.
 
1094
     * For example, March 20th 1989 with the format "%y:%m:%d" results
 
1095
     * in "89:03:20".
 
1096
     *
 
1097
     * @param format The new short date format
 
1098
     */
 
1099
    void setDateFormatShort(const QString & format);
 
1100
 
 
1101
    /**
 
1102
     * Changes the form of month name used in dates.
 
1103
     *
 
1104
     * @param possessive True if possessive forms should be used
 
1105
     */
 
1106
    void setDateMonthNamePossessive(bool possessive);
 
1107
 
 
1108
    /**
 
1109
     * Changes the current time format.
 
1110
     *
 
1111
     * The format of the time is string a which contains variables that will
 
1112
     * be replaced:
 
1113
     * @li %H with the hour in 24h format and 2 digits (e.g. 5pm is "17", 5am is "05")
 
1114
     * @li %k with the hour in 24h format and one digits (e.g. 5pm is "17", 5am is "5")
 
1115
     * @li %I with the hour in 12h format and 2 digits (e.g. 5pm is "05", 5am is "05")
 
1116
     * @li %l with the hour in 12h format and one digits (e.g. 5pm is "5", 5am is "5")
 
1117
     * @li %M with the minute with 2 digits (e.g. the minute of 07:02:09 is "02")
 
1118
     * @li %S with the seconds with 2 digits  (e.g. the minute of 07:02:09 is "09")
 
1119
     * @li %p with pm or am (e.g. 17.00 is "pm", 05.00 is "am")
 
1120
     *
 
1121
     * Everything else in the format string will be taken as is.
 
1122
     * For example, 5.23pm with the format "%H:%M" results
 
1123
     * in "17:23".
 
1124
     *
 
1125
     * @param format The new time format
 
1126
     */
 
1127
    void setTimeFormat(const QString & format);
 
1128
 
 
1129
    /**
 
1130
     *
 
1131
     * Set digit characters used to display dates and time.
 
1132
     *
 
1133
     * @param digitSet the digit set identifier
 
1134
     * @see DigitSet
 
1135
     */
 
1136
    void setDateTimeDigitSet(DigitSet digitSet);
 
1137
 
 
1138
    /**
 
1139
     * Changes how KLocale defines the first day in week.
 
1140
     *
 
1141
     * @param day first day of the week (Monday=1..Sunday=7) as integer
 
1142
     */
 
1143
    void setWeekStartDay(int day);
 
1144
 
 
1145
    /**
 
1146
     * Changes how KLocale defines the first working day in week.
 
1147
     *
 
1148
     * @param day first working day of the week (Monday=1..Sunday=7) as integer
 
1149
     */
 
1150
    void setWorkingWeekStartDay(int day);
 
1151
 
 
1152
    /**
 
1153
     * Changes how KLocale defines the last working day in week.
 
1154
     *
 
1155
     * @param day last working day of the week (Monday=1..Sunday=7) as integer
 
1156
     */
 
1157
    void setWorkingWeekEndDay(int day);
 
1158
 
 
1159
    /**
 
1160
     * Changes how KLocale defines the day reserved for religious observance.
 
1161
     *
 
1162
     * @param day day of the week for religious observance (None=0,Monday=1..Sunday=7) as integer
 
1163
     */
 
1164
    void setWeekDayOfPray(int day);
 
1165
 
 
1166
    /**
 
1167
     * Returns the currently selected date format.
 
1168
     *
 
1169
     * @return Current date format.
 
1170
     * @see setDateFormat()
 
1171
     */
 
1172
    QString dateFormat() const;
 
1173
 
 
1174
    /**
 
1175
     * Returns the currently selected short date format.
 
1176
     *
 
1177
     * @return Current short date format.
 
1178
     * @see setDateFormatShort()
 
1179
     */
 
1180
    QString dateFormatShort() const;
 
1181
 
 
1182
    /**
 
1183
     * Returns the currently selected time format.
 
1184
     *
 
1185
     * @return Current time format.
 
1186
     * @see setTimeFormat()
 
1187
     */
 
1188
    QString timeFormat() const;
 
1189
 
 
1190
    /**
 
1191
     * Changes the symbol used to identify the decimal pointer.
 
1192
     *
 
1193
     * @param symbol The new decimal symbol.
 
1194
     */
 
1195
    void setDecimalSymbol(const QString & symbol);
 
1196
 
 
1197
    /**
 
1198
     * Changes the separator used to group digits when formating numbers.
 
1199
     *
 
1200
     * @param separator The new thousands separator.
 
1201
     */
 
1202
    void setThousandsSeparator(const QString & separator);
 
1203
 
 
1204
    /**
 
1205
     * Changes the sign used to identify a positive number. Normally this is
 
1206
     * left blank.
 
1207
     *
 
1208
     * @param sign Sign used for positive numbers.
 
1209
     */
 
1210
    void setPositiveSign(const QString & sign);
 
1211
 
 
1212
    /**
 
1213
     * Changes the sign used to identify a negative number.
 
1214
     *
 
1215
     * @param sign Sign used for negative numbers.
 
1216
     */
 
1217
    void setNegativeSign(const QString & sign);
 
1218
 
 
1219
    /**
 
1220
     *
 
1221
     * Changes the set of digit characters used to display numbers.
 
1222
     *
 
1223
     * @param digitSet the digit set identifier
 
1224
     * @see DigitSet
 
1225
     */
 
1226
    void setDigitSet(DigitSet digitSet);
 
1227
 
 
1228
    /**
 
1229
     * Changes the sign position used for positive monetary values.
 
1230
     *
 
1231
     * @param signpos The new sign position
 
1232
     */
 
1233
    void setPositiveMonetarySignPosition(SignPosition signpos);
 
1234
 
 
1235
    /**
 
1236
     * Changes the sign position used for negative monetary values.
 
1237
     *
 
1238
     * @param signpos The new sign position
 
1239
     */
 
1240
    void setNegativeMonetarySignPosition(SignPosition signpos);
 
1241
 
 
1242
    /**
 
1243
     * Changes the position where the currency symbol should be printed for
 
1244
     * positive monetary values.
 
1245
     *
 
1246
     * @param prefix True if the currency symbol should be prefixed instead of
 
1247
     * postfixed
 
1248
     */
 
1249
    void setPositivePrefixCurrencySymbol(bool prefix);
 
1250
 
 
1251
    /**
 
1252
     * Changes the position where the currency symbol should be printed for
 
1253
     * negative monetary values.
 
1254
     *
 
1255
     * @param prefix True if the currency symbol should be prefixed instead of
 
1256
     * postfixed
 
1257
     */
 
1258
    void setNegativePrefixCurrencySymbol(bool prefix);
 
1259
 
 
1260
    /**
 
1261
     *
 
1262
     * Changes the number of decimal places used when formating numbers.
 
1263
     *
 
1264
     * @param digits The default number of digits to use.
 
1265
     */
 
1266
    void setDecimalPlaces(int digits);
 
1267
 
 
1268
    /**
 
1269
     *
 
1270
     * Changes the number of decimal places used when formating money.
 
1271
     *
 
1272
     * @param digits The default number of digits to use.
 
1273
     */
 
1274
    void setMonetaryDecimalPlaces(int digits);
 
1275
 
 
1276
    /**
 
1277
     * Changes the separator used to group digits when formating monetary values.
 
1278
     *
 
1279
     * @param separator The new thousands separator.
 
1280
     */
 
1281
    void setMonetaryThousandsSeparator(const QString & separator);
 
1282
 
 
1283
    /**
 
1284
     * Changes the symbol used to identify the decimal pointer for monetary
 
1285
     * values.
 
1286
     *
 
1287
     * @param symbol The new decimal symbol.
 
1288
     */
 
1289
    void setMonetaryDecimalSymbol(const QString & symbol);
 
1290
 
 
1291
    /**
 
1292
     *
 
1293
     * Changes the current ISO Currency Code.
 
1294
     *
 
1295
     * @param newCurrencyCode The new Currency Code
 
1296
     */
 
1297
    void setCurrencyCode(const QString &newCurrencyCode);
 
1298
 
 
1299
    /**
 
1300
     * Changes the current currency symbol.
 
1301
     *
 
1302
     * This symbol should be consistant with the selected Currency Code
 
1303
     *
 
1304
     * @param symbol The new currency symbol
 
1305
     * @see currencyCode, KCurrency::currencySymbols
 
1306
     */
 
1307
    void setCurrencySymbol(const QString & symbol);
 
1308
 
 
1309
    /**
 
1310
     *
 
1311
     * Set digit characters used to display monetary values.
 
1312
     *
 
1313
     * @param digitSet the digit set identifier
 
1314
     * @see DigitSet
 
1315
     */
 
1316
    void setMonetaryDigitSet(DigitSet digitSet);
 
1317
 
 
1318
    /**
 
1319
     * Returns the preferred page size for printing.
 
1320
     *
 
1321
     * @return The preferred page size, cast it to QPrinter::PageSize
 
1322
     */
 
1323
    int pageSize() const;
 
1324
 
 
1325
    /**
 
1326
     * Changes the preferred page size when printing.
 
1327
     *
 
1328
     * @param paperFormat the new preferred page size in the format QPrinter::PageSize
 
1329
     */
 
1330
    void setPageSize(int paperFormat);
 
1331
 
 
1332
    /**
 
1333
     * The Metric system will give you information in mm, while the
 
1334
     * Imperial system will give you information in inches.
 
1335
     */
 
1336
    enum MeasureSystem {
 
1337
        Metric,    ///< Metric system (used e.g. in Europe)
 
1338
        Imperial   ///< Imperial system (used e.g. in the United States)
 
1339
    };
 
1340
 
 
1341
    /**
 
1342
     * Returns which measuring system we use.
 
1343
     *
 
1344
     * @return The preferred measuring system
 
1345
     */
 
1346
    MeasureSystem measureSystem() const;
 
1347
 
 
1348
    /**
 
1349
     * Changes the preferred measuring system.
 
1350
     *
 
1351
     * @return value The preferred measuring system
 
1352
     */
 
1353
    void setMeasureSystem(MeasureSystem value);
 
1354
 
 
1355
    /**
 
1356
     * Translates a message as a QTranslator is supposed to.
 
1357
     * The parameters are similar to i18n(), but the result
 
1358
     * value has other semantics (it can be QString())
 
1359
     */
 
1360
    Q_INVOKABLE QString translateQt(const char *context, const char *sourceText, const char *comment) const;
 
1361
 
 
1362
    /**
 
1363
     * Provides list of all known language codes.
 
1364
     *
 
1365
     * Use languageCodeToName(language) to get human readable, localized
 
1366
     * language names.
 
1367
     *
 
1368
     * @return list of all language codes
 
1369
     *
 
1370
     * @see languageCodeToName
 
1371
     * @see installedLanguages
 
1372
     */
 
1373
    QStringList allLanguagesList() const;
 
1374
 
 
1375
    /**
 
1376
     *
 
1377
     * Provides list of all installed KDE Language Translations.
 
1378
     *
 
1379
     * Use languageCodeToName(language) to get human readable, localized
 
1380
     * language names.
 
1381
     *
 
1382
     * @return list of all installed language codes
 
1383
     *
 
1384
     * @see languageCodeToName
 
1385
     */
 
1386
    QStringList installedLanguages() const;
 
1387
 
 
1388
    /**
 
1389
     * Convert a known language code to a human readable, localized form.
 
1390
     * If an unknown language code is supplied, empty string is returned;
 
1391
     * this will never happen if the code has been obtained by one of the
 
1392
     * KLocale methods.
 
1393
     *
 
1394
     * @param language the language code
 
1395
     *
 
1396
     * @return the human readable and localized form if the code is known,
 
1397
     *         empty otherwise
 
1398
     *
 
1399
     * @see language
 
1400
     * @see languageList
 
1401
     * @see allLanguagesList
 
1402
     * @see installedLanguages
 
1403
     */
 
1404
    Q_INVOKABLE QString languageCodeToName(const QString &language) const;
 
1405
 
 
1406
    /**
 
1407
     * Provides list of all known country codes.
 
1408
     *
 
1409
     * Use countryCodeToName(country) to get human readable, localized
 
1410
     * country names.
 
1411
     *
 
1412
     * @return a list of all country codes
 
1413
     *
 
1414
     * @see countryCodeToName
 
1415
     */
 
1416
    QStringList allCountriesList() const;
 
1417
 
 
1418
    /**
 
1419
     * Convert a known country code to a human readable, localized form.
 
1420
     *
 
1421
     * If an unknown country code is supplied, empty string is returned;
 
1422
     * this will never happen if the code has been obtained by one of the
 
1423
     * KLocale methods.
 
1424
     *
 
1425
     * @param country the country code
 
1426
     *
 
1427
     * @return the human readable and localized form of the country name
 
1428
     *
 
1429
     * @see country
 
1430
     * @see allCountriesList
 
1431
     */
 
1432
    Q_INVOKABLE QString countryCodeToName(const QString &country) const;
 
1433
 
 
1434
    /**
 
1435
     * Parses locale string into distinct parts.
 
1436
     * The format of locale is language_COUNTRY@modifier.CHARSET
 
1437
     *
 
1438
     * @param locale the locale string to split
 
1439
     * @param language set to the language part of the locale
 
1440
     * @param country set to the country part of the locale
 
1441
     * @param modifier set to the modifer part of the locale
 
1442
     * @param charset set to the charset part of the locale
 
1443
     */
 
1444
    Q_INVOKABLE void splitLocale(const QString &locale, QString &language, QString &country,
 
1445
                            QString &modifier, QString &charset);
 
1446
 
 
1447
    /**
 
1448
     * Returns the name of the internal language.
 
1449
     *
 
1450
     * @return Name of the default language
 
1451
     */
 
1452
    QString defaultLanguage();
 
1453
 
 
1454
    /**
 
1455
     * Returns the code of the default country, i.e. "C"
 
1456
     *
 
1457
     * This function will not provide a sensible value to use in your app,
 
1458
     * please use country() instead.
 
1459
     *
 
1460
     * @see country
 
1461
     *
 
1462
     * @return Name of the default country
 
1463
     */
 
1464
    QString defaultCountry();
 
1465
 
 
1466
    /**
 
1467
     *
 
1468
     * Returns the ISO Code of the default currency.
 
1469
     *
 
1470
     * @return ISO Currency Code of the default currency
 
1471
     */
 
1472
    QString defaultCurrencyCode();
 
1473
 
 
1474
    /**
 
1475
     * Reports whether evaluation of translation scripts is enabled.
 
1476
     *
 
1477
     * @return true if script evaluation is enabled, false otherwise.
 
1478
     */
 
1479
    bool useTranscript() const;
 
1480
 
 
1481
    /**
 
1482
     * Checks whether or not the active catalog is found for the given language.
 
1483
     *
 
1484
     * @param language language to check
 
1485
     */
 
1486
    Q_INVOKABLE bool isApplicationTranslatedInto(const QString & language);
 
1487
 
 
1488
    /**
 
1489
     *
 
1490
     * Sets the Country Division Code of the Country where the user lives.
 
1491
     *
 
1492
     * The code must comply with the ISO 3166-2 standard.
 
1493
     * See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
 
1494
     *
 
1495
     * In KDE 4.6 it is the apps responsibility to validate the input,
 
1496
     * full validation and other services will be provided in KDE 4.7.
 
1497
     *
 
1498
     * @param countryDivision the Country Division Code for the user
 
1499
     * @return @c true on success, @c false on failure
 
1500
     * @see countryDivisionCode
 
1501
     */
 
1502
    bool setCountryDivisionCode(const QString & countryDivision);
 
1503
 
 
1504
    /**
 
1505
     *
 
1506
     * Removes accelerator marker from a UI text label.
 
1507
     *
 
1508
     * Accelerator marker is not always a plain ampersand (&),
 
1509
     * so it is not enough to just remove it by @c QString::remove().
 
1510
     * The label may contain escaped markers ("&&") which must be resolved
 
1511
     * and skipped, as well as CJK-style markers ("Foo (&F)") where
 
1512
     * the whole parenthesis construct should be removed.
 
1513
     * Therefore always use this function to remove accelerator marker
 
1514
     * from UI labels.
 
1515
     *
 
1516
     * @param label UI label which may contain an accelerator marker
 
1517
     * @return label without the accelerator marker
 
1518
     */
 
1519
    Q_INVOKABLE QString removeAcceleratorMarker(const QString &label) const;
 
1520
 
 
1521
    /**
 
1522
     *
 
1523
     * Convert all digits in the string to the given digit set.
 
1524
     *
 
1525
     * Conversion is normally not performed if the given digit set
 
1526
     * is not appropriate in the current locale and language context.
 
1527
     * Unconditional conversion may be requested by setting
 
1528
     * @p ignoreContext to @c true.
 
1529
     *
 
1530
     * @param str the string to convert
 
1531
     * @param digitSet the digit set identifier
 
1532
     * @param ignoreContext unconditional conversion if @c true
 
1533
     *
 
1534
     * @return string with converted digits
 
1535
     *
 
1536
     * @see DigitSet
 
1537
     */
 
1538
    Q_INVOKABLE QString convertDigits(const QString &str, DigitSet digitSet,
 
1539
                          bool ignoreContext = false) const;
 
1540
 
 
1541
    /**
 
1542
     *
 
1543
     * Reparse locale configuration files for the current selected
 
1544
     * language.
 
1545
     */
 
1546
    Q_INVOKABLE void reparseConfiguration();
 
1547
 
 
1548
private:
 
1549
    KLocale *m_locale;
 
1550
 
 
1551
Q_SIGNALS:
 
1552
    void binaryUnitDialectChanged();
 
1553
    void calendarSystemChanged();
 
1554
    void countryDivisionCodeChanged();
 
1555
    void currencyCodeChanged();
 
1556
    void decimalSymbolChanged();
 
1557
    void currencySymbolChanged();
 
1558
    void dateFormatChanged();
 
1559
    void dateFormatShortChanged();
 
1560
    void dateMonthNamePossessiveChanged();
 
1561
    void dateTimeDigitSetChanged();
 
1562
    void decimalPlacesChanged();
 
1563
    void digitSetChanged();
 
1564
    void measureSystemChanged();
 
1565
    void monetaryDecimalPlacesChanged();
 
1566
    void monetaryDecimalSymbolChanged();
 
1567
    void monetaryDigitSetChanged();
 
1568
    void monetaryThousandsSeparatorChanged();
 
1569
    void negativeMonetarySignPositionChanged();
 
1570
    void negativePrefixCurrencySymbolChanged();
 
1571
    void negativeSignChanged();
 
1572
    void pageSizeChanged();
 
1573
    void positiveMonetarySignPositionChanged();
 
1574
    void positivePrefixCurrencySymbolChanged();
 
1575
    void positiveSignChanged();
 
1576
    void thousandsSeparatorChanged();
 
1577
    void timeFormatChanged();
 
1578
    void weekDayOfPrayChanged();
 
1579
    void WeekNumberSystemChanged();
 
1580
    void weekStartDayChanged();
 
1581
    void workingWeekEndDayChanged();
 
1582
    void workingWeekStartDayChanged();
 
1583
};
 
1584
 
 
1585
#endif