Make the encoding stuff QVariant, in order to be able

to use them as properties.
This commit is contained in:
Giorgos Tsiapaliwkas 2012-02-16 13:07:03 +02:00
parent da194d9246
commit 7a94509646
2 changed files with 12 additions and 11 deletions

View File

@ -555,14 +555,14 @@ bool Locale::useTranscript() const
return m_locale->useTranscript(); 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 int Locale::fileEncodingMib() const
@ -570,9 +570,9 @@ int Locale::fileEncodingMib() const
return m_locale->fileEncodingMib(); 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(); emit encodingChanged();
} }

View File

@ -21,6 +21,8 @@
#define LOCALE_H #define LOCALE_H
#include <QObject> #include <QObject>
#include <QVariant>
#include <KLocale> #include <KLocale>
class QString; class QString;
@ -32,7 +34,6 @@ class QDateTime;
class KDateTime; //TODO will this work? class KDateTime; //TODO will this work?
class KCalendarSystem;//TODO make it calendarSystem??? class KCalendarSystem;//TODO make it calendarSystem???
class KCurrencyCode;//TODO will this work?
/** /**
* \file klocale.h * \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(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces NOTIFY decimalPlacesChanged)
Q_PROPERTY(QString decimalSymbol READ decimalSymbol WRITE setDecimalSymbol NOTIFY decimalSymbolChanged) Q_PROPERTY(QString decimalSymbol READ decimalSymbol WRITE setDecimalSymbol NOTIFY decimalSymbolChanged)
Q_PROPERTY(DigitSet digitSet READ digitSet WRITE setDigitSet NOTIFY digitSetChanged) 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(QString language READ language NOTIFY languageChanged)
Q_PROPERTY(MeasureSystem measureSystem READ measureSystem WRITE setMeasureSystem NOTIFY measureSystemChanged) Q_PROPERTY(MeasureSystem measureSystem READ measureSystem WRITE setMeasureSystem NOTIFY measureSystemChanged)
Q_PROPERTY(int monetaryDecimalPlaces READ monetaryDecimalPlaces WRITE setMonetaryDecimalPlaces NOTIFY monetaryDecimalPlacesChanged) Q_PROPERTY(int monetaryDecimalPlaces READ monetaryDecimalPlaces WRITE setMonetaryDecimalPlaces NOTIFY monetaryDecimalPlacesChanged)
@ -278,7 +279,7 @@ public:
* *
* @return True on success. * @return True on success.
*/ */
bool setEncoding(int mibEnum); bool setEncoding(QVariant mibEnum);
/** /**
* Various positions for where to place the positive or negative * Various positions for where to place the positive or negative
@ -1333,7 +1334,7 @@ public:
* @see codecForEncoding * @see codecForEncoding
* @see encodingMib * @see encodingMib
*/ */
const QByteArray encoding() const; const QVariant encoding() const;
/** /**
* Returns the user's preferred encoding. * Returns the user's preferred encoding.
@ -1343,7 +1344,7 @@ public:
* @see encoding * @see encoding
* @see codecForEncoding * @see codecForEncoding
*/ */
Q_INVOKABLE int encodingMib() const; Q_INVOKABLE QVariant encodingMib() const;
/** /**
* Returns the file encoding. * Returns the file encoding.