| 115 | } |
| 116 | |
| 117 | void UICCTextField::insertText(const char* text, size_t len) |
| 118 | { |
| 119 | std::string input_text = text; |
| 120 | |
| 121 | if (strcmp(text, "\n") != 0) |
| 122 | { |
| 123 | if (_maxLengthEnabled) |
| 124 | { |
| 125 | int32_t text_count = StringUtils::countUTF8Chars(getString()); |
| 126 | if (text_count >= _maxLength) |
| 127 | { |
| 128 | // password |
| 129 | if (this->isSecureTextEntry()) |
| 130 | { |
| 131 | setPasswordText(getString()); |
| 132 | } |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | int32_t input_count = StringUtils::countUTF8Chars(text); |
| 137 | int32_t total = text_count + input_count; |
| 138 | |
| 139 | if (total > _maxLength) |
| 140 | { |
| 141 | int32_t length = _maxLength - text_count; |
| 142 | |
| 143 | input_text = Helper::getSubStringOfUTF8String(input_text, 0, length); |
| 144 | len = input_text.length(); |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | TextFieldTTF::insertText(input_text.c_str(), len); |
| 149 | } |
| 150 | |
| 151 | void UICCTextField::openIME() |
| 152 | { |
no test coverage detected