|
@@ -5,7 +5,7 @@ namespace {
|
|
|
SwkbdCallbackResult callbackUrl(void* user, const char** ppMessage, const char* text, size_t textlen)
|
|
|
{
|
|
|
cpp3ds::String strError;
|
|
|
- auto kb = reinterpret_cast<Template::KeyboardApplet*>(user);
|
|
|
+ auto kb = reinterpret_cast<Clock::KeyboardApplet*>(user);
|
|
|
|
|
|
// TODO: Add verification
|
|
|
return SWKBD_CALLBACK_OK;
|
|
@@ -19,9 +19,9 @@ SwkbdCallbackResult callbackUrl(void* user, const char** ppMessage, const char*
|
|
|
}
|
|
|
|
|
|
|
|
|
-namespace Template {
|
|
|
+namespace Clock {
|
|
|
|
|
|
-KeyboardApplet::KeyboardApplet(InputType type)
|
|
|
+KeyboardApplet::KeyboardApplet(InputType type, int maxTextLength)
|
|
|
: m_type(type)
|
|
|
, m_button(SWKBD_BUTTON_NONE)
|
|
|
, m_swkbdLearning(nullptr)
|
|
@@ -29,16 +29,21 @@ KeyboardApplet::KeyboardApplet(InputType type)
|
|
|
switch (type)
|
|
|
{
|
|
|
case URL:
|
|
|
- swkbdInit(&m_swkbdState, SWKBD_TYPE_NORMAL, 2, -1);
|
|
|
+ swkbdInit(&m_swkbdState, SWKBD_TYPE_NORMAL, 2, maxTextLength);
|
|
|
swkbdSetHintText(&m_swkbdState, "https://");
|
|
|
swkbdSetValidation(&m_swkbdState, SWKBD_NOTBLANK_NOTEMPTY, 0, 0);
|
|
|
swkbdSetFilterCallback(&m_swkbdState, callbackUrl, this);
|
|
|
swkbdSetFeatures(&m_swkbdState, SWKBD_PREDICTIVE_INPUT);
|
|
|
break;
|
|
|
+ case Number:
|
|
|
+ swkbdInit(&m_swkbdState, SWKBD_TYPE_NUMPAD, 2, maxTextLength);
|
|
|
+ swkbdSetValidation(&m_swkbdState, SWKBD_ANYTHING, 0, 0);
|
|
|
+ swkbdSetFeatures(&m_swkbdState, SWKBD_PREDICTIVE_INPUT);
|
|
|
+ break;
|
|
|
case Text:
|
|
|
// Fall through
|
|
|
default:
|
|
|
- swkbdInit(&m_swkbdState, SWKBD_TYPE_NORMAL, 2, -1);
|
|
|
+ swkbdInit(&m_swkbdState, SWKBD_TYPE_NORMAL, 2, maxTextLength);
|
|
|
swkbdSetValidation(&m_swkbdState, SWKBD_ANYTHING, 0, 0);
|
|
|
swkbdSetFeatures(&m_swkbdState, SWKBD_PREDICTIVE_INPUT);
|
|
|
}
|
|
@@ -81,4 +86,4 @@ void KeyboardApplet::addDictWord(const std::string &typedWord, const std::string
|
|
|
}
|
|
|
|
|
|
|
|
|
-} // namespace Template
|
|
|
+} // namespace Clock
|