// Show keyboard with initial value (aTextString) and replace with result string. // Returns: true - successful display and input (empty result may return true or false depending on parameter) // false - unsuccessful display of the keyboard or cancelled editing bool CGUIKeyboardFactory::ShowAndGetInput(std::string& aTextString, CVariant heading, bool allowEmptyResult, bool hiddenInput /* = false */, unsigned int autoCloseMs /* = 0 */) { bool confirmed = false; CGUIKeyboard *kb = NULL; //heading can be a string or a localization id std::string headingStr; if (heading.isString()) headingStr = heading.asString(); else if (heading.isInteger() && heading.asInteger()) headingStr = g_localizeStrings.Get((uint32_t)heading.asInteger()); #if defined(TARGET_DARWIN_IOS) kb = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogKeyboardTouch>(WINDOW_DIALOG_KEYBOARD_TOUCH); #else kb = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogKeyboardGeneric>(WINDOW_DIALOG_KEYBOARD); #endif if (kb) { g_activeKeyboard = kb; kb->startAutoCloseTimer(autoCloseMs); confirmed = kb->ShowAndGetInput(keyTypedCB, aTextString, aTextString, headingStr, hiddenInput); g_activeKeyboard = NULL; } if (confirmed) { if (!allowEmptyResult && aTextString.empty()) confirmed = false; } return confirmed; }
// Show keyboard with initial value (aTextString) and replace with result string. // Returns: true - successful display and input (empty result may return true or false depending on parameter) // false - unsucessful display of the keyboard or cancelled editing bool CGUIKeyboardFactory::ShowAndGetInput(CStdString& aTextString, const CVariant &heading, bool allowEmptyResult, bool hiddenInput /* = false */, unsigned int autoCloseMs /* = 0 */) { bool confirmed = false; CGUIKeyboard *kb = NULL; bool needsFreeing = true; //heading can be a string or a localization id std::string headingStr; if (heading.isString()) headingStr = heading.asString(); else if (heading.isInteger() && heading.asInteger()) headingStr = g_localizeStrings.Get((uint32_t)heading.asInteger()); #if defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2) kb = new CIOSKeyboard(); #endif if(!kb) { kb = (CGUIDialogKeyboardGeneric*)g_windowManager.GetWindow(WINDOW_DIALOG_KEYBOARD); needsFreeing = false; } if(kb) { kb->startAutoCloseTimer(autoCloseMs); confirmed = kb->ShowAndGetInput(keyTypedCB, aTextString, aTextString, headingStr, hiddenInput); if(needsFreeing) delete kb; } if (confirmed) { if (!allowEmptyResult && aTextString.IsEmpty()) confirmed = false; } return confirmed; }