diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 9df964e96..f4eeca262 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1024,7 +1024,8 @@ personalize.menudisabledhint Das angeforderte Menü ist nicht aktiviert!\nNutzen personalize.notprotected nein personalize.notvisible nicht sichtbar personalize.pin PIN -personalize.pincode PIN Code +personalize.pin_in_use PIN-Zugang für Personalisierung +personalize.pincode Personalisierungs PIN personalize.pinhint Personalisierungs PIN Code eingeben personalize.pinprotect ja personalize.pinstatus mit PIN diff --git a/data/locale/english.locale b/data/locale/english.locale index 4cfbc83ab..d2b65b75d 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1024,7 +1024,8 @@ personalize.menudisabledhint The requested menu is currently disabled!\nFor acti personalize.notprotected No personalize.notvisible Not Visible personalize.pin PIN -personalize.pincode PIN Code +personalize.pin_in_use PIN access for personalize setup +personalize.pincode Personalization PIN personalize.pinhint Enter the Personalization PIN Code personalize.pinprotect Yes personalize.pinstatus Require PIN diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index 7cec2bbb7..d5890e017 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -198,7 +198,7 @@ const CMenuOptionChooser::keyval PERSONALIZE_PROTECT_MODE_OPTIONS[CPersonalizeGu -CPersonalizeGui::CPersonalizeGui() +CPersonalizeGui::CPersonalizeGui() : CPINProtection(g_settings.personalize_pincode) { width = 0; widget_count = 0; @@ -206,6 +206,7 @@ CPersonalizeGui::CPersonalizeGui() show_usermenu = false; show_pin_setup = false; user_menu_notifier = NULL; + pin_setup_notifier = NULL; fkeyMenu = NULL; plMenu = NULL; tmpW = NULL; @@ -250,8 +251,22 @@ int CPersonalizeGui::exec(CMenuTarget* parent, const string & actionKey) return menu_return::RETURN_EXIT_ALL; } - res = ShowPersonalizationMenu(); // Show main Personalization Menu - SaveAndExit(); + //also handle pin access + handleSetting(&g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS]); + + //pin protected access to personalize menu also if found any pin protected items + bool is_pin_protected = g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS]; + + if ( is_pin_protected || hasPinItems()){ + setHint(LOCALE_PERSONALIZE_PINHINT); //from CPINProtection + if (check()) + is_pin_protected = false; + } + if (!is_pin_protected){ + res = ShowPersonalizationMenu(); // Show main Personalization Menu + SaveAndExit(); + } + return res; } @@ -317,6 +332,7 @@ int CPersonalizeGui::ShowPersonalizationMenu() delete plMenu; v_userMenuSetup.clear(); delete user_menu_notifier; + delete pin_setup_notifier; return res; } @@ -325,7 +341,14 @@ int CPersonalizeGui::ShowPersonalizationMenu() void CPersonalizeGui::ShowPinSetup(CMenuWidget* p_widget, CPINChangeWidget *pin_widget) { pin_widget = new CPINChangeWidget(LOCALE_PERSONALIZE_PINCODE, g_settings.personalize_pincode, 4, LOCALE_PERSONALIZE_PINHINT); - p_widget->addItem(new CMenuForwarder(LOCALE_PERSONALIZE_PINCODE, true, g_settings.personalize_pincode, pin_widget, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); + + CMenuForwarder * fw_pin_setup = new CMenuForwarder(LOCALE_PERSONALIZE_PINCODE, true, g_settings.personalize_pincode, pin_widget, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + pin_setup_notifier = new CPinSetupNotifier(fw_pin_setup); + p_widget->addItem(new CMenuOptionChooser(LOCALE_PERSONALIZE_PIN_IN_USE, &g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, pin_setup_notifier)); + + fw_pin_setup->setActive(pin_setup_notifier->changeNotify()); + p_widget->addItem(fw_pin_setup); + p_widget->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_PERSONALIZE_MENUCONFIGURATION)); } @@ -892,3 +915,15 @@ bool CUserMenuNotifier::changeNotify(const neutrino_locale_t, void *) return true; } +//helper class to enable/disable pin setup +CPinSetupNotifier::CPinSetupNotifier( CMenuItem* item) +{ + toDisable=item; +} + +bool CPinSetupNotifier::changeNotify(const neutrino_locale_t, void *) +{ + toDisable->setActive(g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS]); + + return g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS]; +} diff --git a/src/gui/personalize.h b/src/gui/personalize.h index 6c9b79045..869216b45 100644 --- a/src/gui/personalize.h +++ b/src/gui/personalize.h @@ -74,6 +74,16 @@ class CUserMenuNotifier : public CChangeObserver bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL); }; +//helper class to enable/disable pin setup +class CPinSetupNotifier : public CChangeObserver +{ + private: + CMenuItem* toDisable; + public: + CPinSetupNotifier( CMenuItem*); + bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL); +}; + //some required typedefs typedef struct mn_widget_t @@ -122,10 +132,14 @@ typedef struct personalize_settings_t } personalize_settings_struct_t; -class CPersonalizeGui : public CMenuTarget, public CChangeObserver +class CPersonalizeGui : public CMenuTarget, public CChangeObserver, public CPINProtection { + protected: + virtual CMenuTarget* getParent() { return( NULL);}; + private: CUserMenuNotifier *user_menu_notifier; + CPinSetupNotifier *pin_setup_notifier; CMenuWidget* fkeyMenu; CMenuWidget* plMenu; CMenuWidget* tmpW; diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 03808e284..c1ae615ae 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -237,7 +237,7 @@ void CNeutrinoApp::InitMenuSettings() personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_MANAGE, true, NULL, new CSettingsManager(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN), &g_settings.personalize[SNeutrinoSettings::P_MSET_SETTINGS_MANAGER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); // personalize - personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_PERSONALIZE_HEAD, true, NULL, &personalize, NULL, CRCInput::RC_yellow , NEUTRINO_ICON_BUTTON_YELLOW), &g_settings.personalize[SNeutrinoSettings::P_MAIN_PINSTATUS], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); + personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_PERSONALIZE_HEAD, true, NULL, &personalize, NULL, CRCInput::RC_yellow , NEUTRINO_ICON_BUTTON_YELLOW, NEUTRINO_ICON_LOCK), &show, false, CPersonalizeGui::PERSONALIZE_SHOW_NO); // miscSettings personalize.addItem(MENU_SETTINGS, new CMenuForwarder(LOCALE_MAINSETTINGS_MISC, true, NULL, new CMiscMenue() , NULL, CRCInput::RC_blue , NEUTRINO_ICON_BUTTON_BLUE), &g_settings.personalize[SNeutrinoSettings::P_MSET_MISC]); diff --git a/src/system/locals.h b/src/system/locals.h index fb286e718..61b0e5a67 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1051,6 +1051,7 @@ typedef enum LOCALE_PERSONALIZE_NOTPROTECTED, LOCALE_PERSONALIZE_NOTVISIBLE, LOCALE_PERSONALIZE_PIN, + LOCALE_PERSONALIZE_PIN_IN_USE, LOCALE_PERSONALIZE_PINCODE, LOCALE_PERSONALIZE_PINHINT, LOCALE_PERSONALIZE_PINPROTECT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index a7262194a..f10851668 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1051,6 +1051,7 @@ const char * locale_real_names[] = "personalize.notprotected", "personalize.notvisible", "personalize.pin", + "personalize.pin_in_use", "personalize.pincode", "personalize.pinhint", "personalize.pinprotect",