mirror of
https://invent.kde.org/graphics/okular
synced 2024-06-30 22:54:24 +00:00
Moved m_locale to pimpl. Now recording the format stored after AFNumber_Format is called
This commit is contained in:
parent
262e2faadd
commit
19fdf818cc
|
@ -171,6 +171,9 @@ void FormFieldButton::setIcon(Okular::FormField *)
|
|||
|
||||
class Okular::FormFieldTextPrivate : public Okular::FormFieldPrivate
|
||||
{
|
||||
private:
|
||||
QString m_locale;
|
||||
|
||||
public:
|
||||
FormFieldTextPrivate()
|
||||
: FormFieldPrivate(FormField::FormText)
|
||||
|
@ -222,12 +225,14 @@ int FormFieldText::maximumLength() const
|
|||
|
||||
void FormFieldText::setTextLocale(const QString &locale)
|
||||
{
|
||||
m_locale = locale;
|
||||
Q_D(FormFieldText);
|
||||
d->m_locale = locale;
|
||||
}
|
||||
|
||||
const QString FormFieldText::textLocale() const
|
||||
{
|
||||
return m_locale;
|
||||
Q_D(const FormFieldText);
|
||||
return d->m_locale;
|
||||
}
|
||||
|
||||
Qt::Alignment FormFieldText::textAlignment() const
|
||||
|
|
|
@ -345,8 +345,6 @@ protected:
|
|||
private:
|
||||
Q_DECLARE_PRIVATE(FormFieldText)
|
||||
Q_DISABLE_COPY(FormFieldText)
|
||||
|
||||
QString m_locale;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,7 +113,7 @@ function AFNumber_Format( nDec, sepStyle, negStyle, currStyle, strCurrency, bCur
|
|||
{
|
||||
// Use de_DE as the locale for the dot separator format
|
||||
ret = util.numberToString( localized, "f", nDec, 'de_DE' );
|
||||
|
||||
event.target.locale = 'de_DE';
|
||||
if ( sepStyle === 3 )
|
||||
{
|
||||
// No thousands separators. Remove all dots from the DE format.
|
||||
|
@ -124,6 +124,7 @@ function AFNumber_Format( nDec, sepStyle, negStyle, currStyle, strCurrency, bCur
|
|||
{
|
||||
// Otherwise US
|
||||
ret = util.numberToString( localized, "f", nDec, 'en_US' );
|
||||
event.target.locale = 'en_US';
|
||||
|
||||
if ( sepStyle === 1 )
|
||||
{
|
||||
|
|
|
@ -224,6 +224,20 @@ void JSField::setHidden(bool hidden)
|
|||
updateField(m_field);
|
||||
}
|
||||
|
||||
// Field.locale (getter)
|
||||
QString JSField::locale() const
|
||||
{
|
||||
FormFieldText *fft = dynamic_cast<FormFieldText *>(m_field);
|
||||
return fft->textLocale();
|
||||
}
|
||||
|
||||
// Field.locale (setter)
|
||||
void JSField::setLocale(const QString &locale)
|
||||
{
|
||||
FormFieldText *fft = dynamic_cast<FormFieldText *>(m_field);
|
||||
fft->setTextLocale(locale);
|
||||
}
|
||||
|
||||
// Field.display (getter)
|
||||
int JSField::display() const
|
||||
{
|
||||
|
|
|
@ -23,10 +23,11 @@ class JSField : public QObject
|
|||
Q_PROPERTY(QString name READ name CONSTANT)
|
||||
Q_PROPERTY(bool readonly READ readonly WRITE setReadonly) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(QString type READ type CONSTANT)
|
||||
Q_PROPERTY(QJSValue value READ value WRITE setValue) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(QJSValue valueAsString READ valueAsString) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(bool hidden READ hidden WRITE setHidden) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(int display READ display WRITE setDisplay) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(QJSValue value READ value WRITE setValue) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(QJSValue valueAsString READ valueAsString) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(bool hidden READ hidden WRITE setHidden) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(int display READ display WRITE setDisplay) // clazy:exclude=qproperty-without-notify
|
||||
Q_PROPERTY(QString locale READ locale WRITE setLocale) // clazy:exclude=qproperty-without-notify
|
||||
|
||||
public:
|
||||
explicit JSField(FormField *field, QObject *parent = nullptr);
|
||||
|
@ -47,6 +48,8 @@ public:
|
|||
QJSValue valueAsString() const;
|
||||
bool hidden() const;
|
||||
void setHidden(bool hidden);
|
||||
QString locale() const;
|
||||
void setLocale(const QString &locale);
|
||||
|
||||
Q_INVOKABLE QJSValue buttonGetIcon(int nFace = 0) const;
|
||||
Q_INVOKABLE void buttonSetIcon(const QJSValue &oIcon, int nFace = 0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user