Namespace: kodi::gui::dialogs::Keyboard
Keyboard dialogs
The functions listed below have to be permitted by the user for the representation of a keyboard around an input.
The class supports several kinds, from an easy text choice up to the passport Word production and their confirmation for add-on.
It has the header #include <kodi/gui/dialogs/Keyboard.h> be included to enjoy it.
◆ ShowAndGetInput() [1/2]
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndGetInput |
( |
std::string & |
text, |
|
|
const std::string & |
heading, |
|
|
bool |
allowEmptyResult, |
|
|
bool |
hiddenInput = false , |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Show keyboard with initial value text
and replace with result string.
- Parameters
-
[in,out] | text | Overwritten with user input if return=true. |
[in] | heading | String shown on dialog title. |
[in] | allowEmptyResult | Whether a blank password is valid or not. |
[in] | hiddenInput | [opt] The inserted input is not shown as text. |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
Example:
#include <kodi/gui/dialogs/Keyboard.h>
std::string text = "Please change me to them want you want";
"Demonstration text entry",
true,
false,
0);
fprintf(stderr, "Written keyboard input is : '%s' and was %s\n",
text.c_str(), bRet ? "OK" : "Canceled");
bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string &text, const std::string &heading, bool allowEmptyResult, bool hiddenInput=false, unsigned int autoCloseMs=0)
Show keyboard with initial value text and replace with result string.
Definition: Keyboard.h:74
◆ ShowAndGetInput() [2/2]
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndGetInput |
( |
std::string & |
text, |
|
|
bool |
allowEmptyResult, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
The example shows the display of keyboard call dialog at Kodi from the add-on.
- Parameters
-
[out] | text | Overwritten with user input if return=true. |
[in] | allowEmptyResult | If set to true keyboard can also exited without entered text. |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
◆ ShowAndGetNewPassword() [1/2]
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndGetNewPassword |
( |
std::string & |
newPassword, |
|
|
const std::string & |
heading, |
|
|
bool |
allowEmptyResult, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Shows keyboard and prompts for a password. Differs from ShowAndVerifyNewPassword()
in that no second verification.
- Parameters
-
[in,out] | newPassword | Overwritten with user input if return=true. |
[in] | heading | String shown on dialog title. |
[in] | allowEmptyResult | Whether a blank password is valid or not. |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
◆ ShowAndGetNewPassword() [2/2]
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndGetNewPassword |
( |
std::string & |
newPassword, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Shows keyboard and prompts for a password. Differs from ShowAndVerifyNewPassword()
in that no second verification.
- Parameters
-
[in,out] | newPassword | Overwritten with user input if return=true. |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
◆ ShowAndVerifyNewPassword() [1/2]
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndVerifyNewPassword |
( |
std::string & |
newPassword, |
|
|
const std::string & |
heading, |
|
|
bool |
allowEmptyResult, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Show keyboard twice to get and confirm a user-entered password string.
- Parameters
-
[out] | newPassword | Overwritten with user input if return=true. |
[in] | heading | String shown on dialog title. |
[in] | allowEmptyResult | |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
Example:
#include <kodi/General.h>
#include <kodi/gui/dialogs/Keyboard.h>
int maxretries = 3;
std::string password;
int ret;
for (unsigned int i = 0; i < maxretries; i++)
{
if (ret == 0)
{
fprintf(stderr, "Password successfull confirmed after '%i' tries\n", i+1);
break;
}
else if (ret < 0)
{
fprintf(stderr, "Canceled editing on try '%i'\n", i+1);
break;
}
else
{
fprintf(stderr, "Wrong password entered on try '%i'\n", i+1);
}
}
int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(std::string &password, const std::string &heading, int retries, unsigned int autoCloseMs=0)
Show keyboard and verify user input against password.
Definition: Keyboard.h:314
std::string ATTRIBUTE_HIDDEN GetMD5(const std::string &text)
Get the MD5 digest of the given text.
Definition: General.h:409
◆ ShowAndVerifyNewPassword() [2/2]
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndVerifyNewPassword |
( |
std::string & |
newPassword, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Show keyboard twice to get and confirm a user-entered password string.
- Parameters
-
[out] | newPassword | Overwritten with user input if return=true. |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
◆ ShowAndVerifyPassword()
int ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndVerifyPassword |
( |
std::string & |
password, |
|
|
const std::string & |
heading, |
|
|
int |
retries, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Show keyboard and verify user input against password
.
- Parameters
-
[in,out] | password | Value to compare against user input. |
[in] | heading | String shown on dialog title. |
[in] | retries | If greater than 0, shows "Incorrect password, %d retries
left" on dialog line 2, else line 2 is blank. |
[in] | autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- 0 if successful display and user input. 1 if unsuccessful input. -1 if no user input or canceled editing.
◆ ShowAndGetFilter()
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::ShowAndGetFilter |
( |
std::string & |
text, |
|
|
bool |
searching, |
|
|
unsigned int |
autoCloseMs = 0 |
|
) |
| |
|
inline |
Shows a filter related keyboard.
- Parameters
-
[in,out] | text | Overwritten with user input if return=true. |
[in] | searching | Use dialog for search and send our search message in safe way (only the active window needs it)
- header name if true is "Enter search string"
- header name if false is "Enter value"
|
| autoCloseMs | [opt] To close the dialog after a specified time, in milliseconds, default is 0 which keeps the dialog open indefinitely. |
- Returns
- true if successful display and user input. false if unsuccessful display, no user input, or canceled editing.
◆ SendTextToActiveKeyboard()
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::SendTextToActiveKeyboard |
( |
const std::string & |
text, |
|
|
bool |
closeKeyboard = false |
|
) |
| |
|
inline |
Send a text to a visible keyboard.
- Parameters
-
[in] | text | Overwritten with user input if return=true. |
[in] | closeKeyboard | [opt] The open dialog is if also closed on 'true'. |
- Returns
- true if successful done, false if unsuccessful or keyboard not present.
◆ IsKeyboardActivated()
bool ATTRIBUTE_HIDDEN kodi::gui::dialogs::Keyboard::IsKeyboardActivated |
( |
| ) |
|
|
inline |
Check for visible keyboard on GUI.
- Returns
- true if keyboard present, false if not present