diff --git a/xbmc/dialogs/GUIDialogNumeric.cpp b/xbmc/dialogs/GUIDialogNumeric.cpp index c02408afa8774..8a6b0cee5605a 100644 --- a/xbmc/dialogs/GUIDialogNumeric.cpp +++ b/xbmc/dialogs/GUIDialogNumeric.cpp @@ -533,13 +533,16 @@ bool CGUIDialogNumeric::ShowAndGetIPAddress(std::string &IPAddress, const std::s return true; } -bool CGUIDialogNumeric::ShowAndGetNumber(std::string& strInput, const std::string &strHeading, unsigned int iAutoCloseTimeoutMs /* = 0 */) +bool CGUIDialogNumeric::ShowAndGetNumber(std::string& strInput, const std::string &strHeading, unsigned int iAutoCloseTimeoutMs /* = 0 */, bool bSetHidden /* = false */) { // Prompt user for password input CGUIDialogNumeric *pDialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_DIALOG_NUMERIC); pDialog->SetHeading( strHeading ); - pDialog->SetMode(INPUT_NUMBER, strInput); + if (bSetHidden) + pDialog->SetMode(INPUT_PASSWORD, strInput); + else + pDialog->SetMode(INPUT_NUMBER, strInput); if (iAutoCloseTimeoutMs) pDialog->SetAutoClose(iAutoCloseTimeoutMs); diff --git a/xbmc/dialogs/GUIDialogNumeric.h b/xbmc/dialogs/GUIDialogNumeric.h index fc563aa9a2574..2fa2344c73abc 100644 --- a/xbmc/dialogs/GUIDialogNumeric.h +++ b/xbmc/dialogs/GUIDialogNumeric.h @@ -49,7 +49,7 @@ class CGUIDialogNumeric : static bool ShowAndGetTime(KODI::TIME::SystemTime& time, const std::string& heading); static bool ShowAndGetDate(KODI::TIME::SystemTime& date, const std::string& heading); static bool ShowAndGetIPAddress(std::string &IPAddress, const std::string &heading); - static bool ShowAndGetNumber(std::string& strInput, const std::string &strHeading, unsigned int iAutoCloseTimeoutMs = 0); + static bool ShowAndGetNumber(std::string& strInput, const std::string &strHeading, unsigned int iAutoCloseTimeoutMs = 0, bool bSetHidden = false); static bool ShowAndGetSeconds(std::string& timeString, const std::string &heading); protected: diff --git a/xbmc/interfaces/legacy/Control.h b/xbmc/interfaces/legacy/Control.h index 616e2879f80f8..8ea89852e8c53 100644 --- a/xbmc/interfaces/legacy/Control.h +++ b/xbmc/interfaces/legacy/Control.h @@ -1069,22 +1069,24 @@ namespace XBMCAddon /// Sets the type of this edit control. /// /// @param type integer - type of the edit control. - /// | Param | Definition | - /// |----------------------------------|:--------------------------------------------| - /// | xbmcgui.INPUT_TYPE_TEXT | (standard keyboard) - /// | xbmcgui.INPUT_TYPE_NUMBER | (format: #) - /// | xbmcgui.INPUT_TYPE_DATE | (format: DD/MM/YYYY) - /// | xbmcgui.INPUT_TYPE_TIME | (format: HH:MM) - /// | xbmcgui.INPUT_TYPE_IPADDRESS | (format: #.#.#.#) - /// | xbmcgui.INPUT_TYPE_PASSWORD | (input is masked) - /// | xbmcgui.INPUT_TYPE_PASSWORD_MD5 | (input is masked, return md5 hash of input) - /// | xbmcgui.INPUT_TYPE_SECONDS | (format: SS or MM:SS or HH:MM:SS or MM min) + /// | Param | Definition | + /// |-----------------------------------------------|:--------------------------------------------| + /// | xbmcgui.INPUT_TYPE_TEXT | (standard keyboard) + /// | xbmcgui.INPUT_TYPE_NUMBER | (format: #) + /// | xbmcgui.INPUT_TYPE_DATE | (format: DD/MM/YYYY) + /// | xbmcgui.INPUT_TYPE_TIME | (format: HH:MM) + /// | xbmcgui.INPUT_TYPE_IPADDRESS | (format: #.#.#.#) + /// | xbmcgui.INPUT_TYPE_PASSWORD | (input is masked) + /// | xbmcgui.INPUT_TYPE_PASSWORD_MD5 | (input is masked, return md5 hash of input) + /// | xbmcgui.INPUT_TYPE_SECONDS | (format: SS or MM:SS or HH:MM:SS or MM min) + /// | xbmcgui.INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW | (numeric input is masked) /// @param heading string or unicode - heading that will be used for to numeric or /// keyboard dialog when the edit control is clicked. /// /// ///----------------------------------------------------------------------- /// @python_v18 New function added. + /// @python_v19 New option added to mask numeric input. /// /// **Example:** /// ~~~~~~~~~~~~~{.py} diff --git a/xbmc/interfaces/legacy/Dialog.cpp b/xbmc/interfaces/legacy/Dialog.cpp index 3f76b0f55b053..760e57566271a 100644 --- a/xbmc/interfaces/legacy/Dialog.cpp +++ b/xbmc/interfaces/legacy/Dialog.cpp @@ -277,7 +277,7 @@ namespace XBMCAddon return valuelist; } - String Dialog::numeric(int inputtype, const String& heading, const String& defaultt) + String Dialog::numeric(int inputtype, const String& heading, const String& defaultt, bool bHiddenInput) { DelayedCallGuard dcguard(languageHook); std::string value; @@ -319,10 +319,16 @@ namespace XBMCAddon if (!CGUIDialogNumeric::ShowAndGetIPAddress(value, heading)) return emptyString; } + else if (inputtype == 4) + { + value = defaultt; + if (!CGUIDialogNumeric::ShowAndVerifyNewPassword(value)) + return emptyString; + } else { value = defaultt; - if (!CGUIDialogNumeric::ShowAndGetNumber(value, heading)) + if (!CGUIDialogNumeric::ShowAndGetNumber(value, heading, 0, bHiddenInput)) return emptyString; } } diff --git a/xbmc/interfaces/legacy/Dialog.h b/xbmc/interfaces/legacy/Dialog.h index 4b4ae4f320643..7fdfc94d0b691 100644 --- a/xbmc/interfaces/legacy/Dialog.h +++ b/xbmc/interfaces/legacy/Dialog.h @@ -485,7 +485,7 @@ constexpr int ALPHANUM_HIDE_INPUT{2}; #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_Dialog - /// \python_func{ xbmcgui.Dialog().numeric(type, heading[, defaultt]) } + /// \python_func{ xbmcgui.Dialog().numeric(type, heading[, defaultt, bHiddenInput]) } ///------------------------------------------------------------------------ /// /// **Numeric dialog** @@ -494,19 +494,23 @@ constexpr int ALPHANUM_HIDE_INPUT{2}; /// of a numeric keyboard around an input. /// /// @param type integer - the type of numeric dialog. - /// | Param | Name | Format | - /// |:-----:|:--------------------|:-----------------------------| - /// | 0 | ShowAndGetNumber | (default format: #) - /// | 1 | ShowAndGetDate | (default format: DD/MM/YYYY) - /// | 2 | ShowAndGetTime | (default format: HH:MM) - /// | 3 | ShowAndGetIPAddress | (default format: #.#.#.#) - /// @param heading string or unicode - dialog heading. + /// | Param | Name | Format | + /// |:-----:|:-------------------------|:-----------------------------| + /// | 0 | ShowAndGetNumber | (default format: #) + /// | 1 | ShowAndGetDate | (default format: DD/MM/YYYY) + /// | 2 | ShowAndGetTime | (default format: HH:MM) + /// | 3 | ShowAndGetIPAddress | (default format: #.#.#.#) + /// | 4 | ShowAndVerifyNewPassword | (default format: *) + /// @param heading string or unicode - dialog heading (will be ignored for type 4). /// @param defaultt [opt] string - default value. + /// @param bHiddenInput [opt] bool - mask input (available for type 0). /// @return Returns the entered data as a string. /// Returns the default value if dialog was canceled. /// /// ///------------------------------------------------------------------------ + /// @python_v19 New option added ShowAndVerifyNewPassword. + /// @python_v19 Added new option **bHiddenInput**. /// /// **Example:** /// ~~~~~~~~~~~~~{.py} @@ -518,7 +522,7 @@ constexpr int ALPHANUM_HIDE_INPUT{2}; /// numeric(...); #else - String numeric(int type, const String& heading, const String& defaultt = emptyString); + String numeric(int type, const String& heading, const String& defaultt = emptyString, bool bHiddenInput = false); #endif #ifdef DOXYGEN_SHOULD_USE_THIS diff --git a/xbmc/interfaces/legacy/ModuleXbmcgui.h b/xbmc/interfaces/legacy/ModuleXbmcgui.h index 3cdfa862b94aa..ce7efd851d4e8 100644 --- a/xbmc/interfaces/legacy/ModuleXbmcgui.h +++ b/xbmc/interfaces/legacy/ModuleXbmcgui.h @@ -127,6 +127,7 @@ namespace XBMCAddon SWIG_CONSTANT2(int, INPUT_TYPE_PASSWORD, CGUIEditControl::INPUT_TYPE_PASSWORD); SWIG_CONSTANT2(int, INPUT_TYPE_PASSWORD_MD5, CGUIEditControl::INPUT_TYPE_PASSWORD_MD5); SWIG_CONSTANT2(int, INPUT_TYPE_SECONDS, CGUIEditControl::INPUT_TYPE_SECONDS); + SWIG_CONSTANT2(int, INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW, CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW); SWIG_CONSTANT_FROM_GETTER(const char*, NOTIFICATION_INFO); SWIG_CONSTANT_FROM_GETTER(const char*, NOTIFICATION_WARNING);