diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 7a8317d4d..47c2c327f 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -402,21 +402,21 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: slot %d input request, text %s\n", curslot, convertDVBUTF8(pMmiEnquiry->enguiryText, strlen(pMmiEnquiry->enguiryText), 0).c_str()); hideHintBox(); - char cPIN[pMmiEnquiry->answerlen+1]; - cPIN[0] = 0; + char ENQAnswer[pMmiEnquiry->answerlen+1]; + ENQAnswer[0] = 0; - CPINInput* PINInput = new CPINInput((char *) convertDVBUTF8(pMmiEnquiry->enguiryText, strlen(pMmiEnquiry->enguiryText), 0).c_str(), cPIN, 4, NONEXISTANT_LOCALE); - PINInput->exec(NULL, ""); - delete PINInput; + CEnquiryInput *Inquiry = new CEnquiryInput((char *)convertDVBUTF8(pMmiEnquiry->enguiryText, strlen(pMmiEnquiry->enguiryText), 0).c_str(), ENQAnswer, pMmiEnquiry->answerlen, pMmiEnquiry->blind != 0, NONEXISTANT_LOCALE); + Inquiry->exec(NULL, ""); + delete Inquiry; - printf("CCAMMenuHandler::handleCamMsg: input=[%s]\n", cPIN); + printf("CCAMMenuHandler::handleCamMsg: input=[%s]\n", ENQAnswer); - if((int) strlen(cPIN) != pMmiEnquiry->answerlen) { + if((int) strlen(ENQAnswer) != pMmiEnquiry->answerlen) { printf("CCAMMenuHandler::handleCamMsg: wrong input len\n"); - ca->InputAnswer(SlotType, curslot, (unsigned char *) cPIN, 0); + ca->InputAnswer(SlotType, curslot, (unsigned char *)ENQAnswer, 0); return 1; //FIXME } else { - ca->InputAnswer(SlotType, curslot, (unsigned char *) cPIN, pMmiEnquiry->answerlen); + ca->InputAnswer(SlotType, curslot, (unsigned char *)ENQAnswer, pMmiEnquiry->answerlen); return 1; } } diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 276cc131c..538b9c865 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -147,7 +147,9 @@ void CStringInput::init() if (width<420) width = 420; - +#ifdef DEBUG_STRINGINPUT + printf("HEAD: %s (len: %d)\n", head, strlen(head)); +#endif int neededWidth; if(head) { neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head, true); // UTF-8 @@ -856,6 +858,14 @@ int CPINInput::exec( CMenuTarget* parent, const std::string & ) return res; } +void CEnquiryInput::paintChar(int pos) +{ + if (blind) + CStringInput::paintChar(pos, (value[pos] == ' ') ? ' ' : '*'); + else + CStringInput::paintChar(pos, value[pos]); +} + int CPLPINInput::handleOthers(neutrino_msg_t msg, neutrino_msg_data_t data) { int res = messages_return::unhandled; diff --git a/src/gui/widget/stringinput.h b/src/gui/widget/stringinput.h index 8834f3914..c3d3a4a8c 100644 --- a/src/gui/widget/stringinput.h +++ b/src/gui/widget/stringinput.h @@ -140,6 +140,21 @@ class CPINInput : public CStringInput int exec( CMenuTarget* parent, const std::string & actionKey ); }; +// For CI +class CEnquiryInput : public CPINInput +{ + private: + bool blind; + protected: + virtual void paintChar(int pos); + public: + CEnquiryInput(const neutrino_locale_t Name, char* Value, int Size, bool Blind, const neutrino_locale_t Hint_1 = NONEXISTANT_LOCALE, const neutrino_locale_t Hint_2 = NONEXISTANT_LOCALE, const char * const Valid_Chars= (const char *)"0123456789", CChangeObserver* Observ = NULL) + : CPINInput(Name, (char *)Value, Size, Hint_1, Hint_2, Valid_Chars, Observ) { blind = Blind; } + CEnquiryInput(char * Head, char* Value, int Size, bool Blind, const neutrino_locale_t Hint_1 = NONEXISTANT_LOCALE, const neutrino_locale_t Hint_2 = NONEXISTANT_LOCALE, const char * const Valid_Chars= (const char *)"0123456789", CChangeObserver* Observ = NULL) + : CPINInput(Head, (char *)Value, Size, Hint_1, Hint_2, Valid_Chars, Observ) { blind = Blind; } +}; + + class CPLPINInput : public CPINInput { protected: