diff --git a/common/maliit/namespace.h b/common/maliit/namespace.h index 13e411bc..42e5985d 100644 --- a/common/maliit/namespace.h +++ b/common/maliit/namespace.h @@ -44,6 +44,9 @@ namespace Maliit { //! only integer numbers allowed NumberContentType, + //! only numbers and formatted characters + FormattedNumberContentType, + //! allows numbers and certain other characters used in phone numbers PhoneNumberContentType, diff --git a/connection/waylandinputmethodconnection.cpp b/connection/waylandinputmethodconnection.cpp index bef77287..1f4b066f 100644 --- a/connection/waylandinputmethodconnection.cpp +++ b/connection/waylandinputmethodconnection.cpp @@ -137,8 +137,9 @@ Maliit::TextContentType contentTypeFromWayland(uint32_t purpose) case QtWayland::zwp_text_input_v2::content_purpose_normal: return Maliit::FreeTextContentType; case QtWayland::zwp_text_input_v2::content_purpose_digits: - case QtWayland::zwp_text_input_v2::content_purpose_number: return Maliit::NumberContentType; + case QtWayland::zwp_text_input_v2::content_purpose_number: + return Maliit::FormattedNumberContentType; case QtWayland::zwp_text_input_v2::content_purpose_phone: return Maliit::PhoneNumberContentType; case QtWayland::zwp_text_input_v2::content_purpose_url: diff --git a/input-context/minputcontext.cpp b/input-context/minputcontext.cpp index dfe0df96..5984d135 100644 --- a/input-context/minputcontext.cpp +++ b/input-context/minputcontext.cpp @@ -643,8 +643,10 @@ Maliit::TextContentType MInputContext::contentType(Qt::InputMethodHints hints) c Maliit::TextContentType type = Maliit::FreeTextContentType; hints &= Qt::ImhExclusiveInputMask; - if (hints == Qt::ImhFormattedNumbersOnly || hints == Qt::ImhDigitsOnly) { + if ( hints == Qt::ImhDigitsOnly) { type = Maliit::NumberContentType; + } else if (hints == Qt::ImhFormattedNumbersOnly) { + type = Maliit::FormattedNumberContentType; } else if (hints == Qt::ImhDialableCharactersOnly) { type = Maliit::PhoneNumberContentType; } else if (hints == Qt::ImhEmailCharactersOnly) { diff --git a/src/quick/maliitquick.h b/src/quick/maliitquick.h index dba8f5d2..65570e05 100644 --- a/src/quick/maliitquick.h +++ b/src/quick/maliitquick.h @@ -37,6 +37,7 @@ class MaliitQuick: public QObject enum ContentType { FreeTextContentType = Maliit::FreeTextContentType, NumberContentType = Maliit::NumberContentType, + FormattedNumberContentType = Maliit::FormattedNumberContentType; PhoneNumberContentType = Maliit::PhoneNumberContentType, EmailContentType = Maliit::EmailContentType, UrlContentType = Maliit::UrlContentType,