*neutrino personalize: rework pin access

PIN access of  personalize setup now managed with an own pin management.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2105 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
thilo
2012-02-15 18:21:52 +00:00
parent 36a1030a72
commit 3e4f90c194
7 changed files with 61 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}
//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];
}

View File

@@ -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;

View File

@@ -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]);

View File

@@ -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,

View File

@@ -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",