From 7a945096466f17e962716a2178dc6d2c570cd51c Mon Sep 17 00:00:00 2001 From: Giorgos Tsiapaliwkas Date: Thu, 16 Feb 2012 13:07:03 +0200 Subject: [PATCH] Make the encoding stuff QVariant, in order to be able to use them as properties. --- declarativeimports/locale/locale.cpp | 12 ++++++------ declarativeimports/locale/locale.h | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/declarativeimports/locale/locale.cpp b/declarativeimports/locale/locale.cpp index 8e79449e5..10d9f2425 100644 --- a/declarativeimports/locale/locale.cpp +++ b/declarativeimports/locale/locale.cpp @@ -555,14 +555,14 @@ bool Locale::useTranscript() const return m_locale->useTranscript(); } -const QByteArray Locale::encoding() const +const QVariant Locale::encoding() const { - return m_locale->encoding(); + return QVariant(m_locale->encoding()); } -int Locale::encodingMib() const +QVariant Locale::encodingMib() const { - return m_locale->encodingMib(); + return QVariant(m_locale->encodingMib()); } int Locale::fileEncodingMib() const @@ -570,9 +570,9 @@ int Locale::fileEncodingMib() const return m_locale->fileEncodingMib(); } -bool Locale::setEncoding(int mibEnum) +bool Locale::setEncoding(QVariant mibEnum) { - return m_locale->setEncoding(mibEnum); + return m_locale->setEncoding(mibEnum.toInt()); emit encodingChanged(); } diff --git a/declarativeimports/locale/locale.h b/declarativeimports/locale/locale.h index 5fa8fd78d..b79f8e8e1 100644 --- a/declarativeimports/locale/locale.h +++ b/declarativeimports/locale/locale.h @@ -21,6 +21,8 @@ #define LOCALE_H #include +#include + #include class QString; @@ -32,7 +34,6 @@ class QDateTime; class KDateTime; //TODO will this work? class KCalendarSystem;//TODO make it calendarSystem??? -class KCurrencyCode;//TODO will this work? /** * \file klocale.h @@ -96,7 +97,7 @@ Q_PROPERTY(DigitSet dateTimeDigitSet READ dateTimeDigitSet WRITE setDateTimeDigi Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces NOTIFY decimalPlacesChanged) Q_PROPERTY(QString decimalSymbol READ decimalSymbol WRITE setDecimalSymbol NOTIFY decimalSymbolChanged) Q_PROPERTY(DigitSet digitSet READ digitSet WRITE setDigitSet NOTIFY digitSetChanged) -Q_PROPERTY(QByteArray encoding READ encoding WRITE setEncoding NOTIFY encodingChanged) +Q_PROPERTY(QVariant encoding READ encoding WRITE setEncoding NOTIFY encodingChanged) Q_PROPERTY(QString language READ language NOTIFY languageChanged) Q_PROPERTY(MeasureSystem measureSystem READ measureSystem WRITE setMeasureSystem NOTIFY measureSystemChanged) Q_PROPERTY(int monetaryDecimalPlaces READ monetaryDecimalPlaces WRITE setMonetaryDecimalPlaces NOTIFY monetaryDecimalPlacesChanged) @@ -278,7 +279,7 @@ public: * * @return True on success. */ - bool setEncoding(int mibEnum); + bool setEncoding(QVariant mibEnum); /** * Various positions for where to place the positive or negative @@ -1333,7 +1334,7 @@ public: * @see codecForEncoding * @see encodingMib */ - const QByteArray encoding() const; + const QVariant encoding() const; /** * Returns the user's preferred encoding. @@ -1343,7 +1344,7 @@ public: * @see encoding * @see codecForEncoding */ - Q_INVOKABLE int encodingMib() const; + Q_INVOKABLE QVariant encodingMib() const; /** * Returns the file encoding.