4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
26 #include "settings/lib/ISettingCallback.h"
27 #include "utils/StdString.h"
28 #include "settings/lib/Setting.h"
33 typedef std::vector<CMediaSource> VECSOURCES;
37 LOCK_MODE_UNKNOWN = -1,
38 LOCK_MODE_EVERYONE = 0,
39 LOCK_MODE_NUMERIC = 1,
40 LOCK_MODE_GAMEPAD = 2,
43 LOCK_MODE_EEPROM_PARENTAL = 5
46 namespace LOCK_LEVEL {
48 Specifies, what Settings levels are locked for the user
52 NONE, //settings are unlocked => user can access all settings levels
53 ALL, //all settings are locked => user always has to enter password, when entering the settings screen
54 STANDARD, //settings level standard and up are locked => user can still access the beginner levels
60 class CGUIPassword : public ISettingCallback
64 virtual ~CGUIPassword(void);
65 bool IsItemUnlocked(CFileItem* pItem, const CStdString &strType);
66 bool IsItemUnlocked(CMediaSource* pItem, const CStdString &strType);
67 bool CheckLock(LockType btnType, const CStdString& strPassword, int iHeading);
68 bool CheckLock(LockType btnType, const CStdString& strPassword, int iHeading, bool& bCanceled);
69 bool IsProfileLockUnlocked(int iProfile=-1);
70 bool IsProfileLockUnlocked(int iProfile, bool& bCanceled, bool prompt = true);
71 bool IsMasterLockUnlocked(bool bPromptUser);
72 bool IsMasterLockUnlocked(bool bPromptUser, bool& bCanceled);
74 void UpdateMasterLockRetryCount(bool bResetCount);
75 bool CheckStartUpLock();
76 /*! \brief Checks if the current profile is allowed to access the given settings level
77 \param level - The level to check
78 \param enforce - If false, CheckSettingLevelLock is allowed to lower the current settings level
79 to a level we're allowed to access
80 \returns true if we're allowed to access the settings
82 bool CheckSettingLevelLock(const SettingLevel& level, bool enforce = false);
83 bool CheckMenuLock(int iWindowID);
84 bool SetMasterLockMode(bool bDetails=true);
85 bool LockSource(const CStdString& strType, const CStdString& strName, bool bState);
86 void LockSources(bool lock);
87 void RemoveSourceLocks();
88 bool IsDatabasePathUnlocked(const CStdString& strPath, VECSOURCES& vecSources);
90 virtual void OnSettingAction(const CSetting *setting);
93 int iMasterLockRetriesLeft;
96 int VerifyPassword(LockType btnType, const CStdString& strPassword, const CStdString& strHeading);
99 extern CGUIPassword g_passwordManager;