FIX: don't crash on buggy keymap xml
[vuplus_xbmc] / xbmc / GUIPassword.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
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)
10  *  any later version.
11  *
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.
16  *
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/>.
20  *
21  */
22
23 #include "utils/StdString.h"
24
25 class CFileItem;
26 class CMediaSource;
27
28 #include <vector>
29 #include <map>
30
31 typedef std::vector<CMediaSource> VECSOURCES;
32
33 typedef enum
34 {
35   LOCK_MODE_UNKNOWN            = -1,
36   LOCK_MODE_EVERYONE           =  0,
37   LOCK_MODE_NUMERIC            =  1,
38   LOCK_MODE_GAMEPAD            =  2,
39   LOCK_MODE_QWERTY             =  3,
40   LOCK_MODE_SAMBA              =  4,
41   LOCK_MODE_EEPROM_PARENTAL    =  5
42 } LockType;
43
44 class CGUIPassword
45 {
46 public:
47   CGUIPassword(void);
48   virtual ~CGUIPassword(void);
49   bool IsItemUnlocked(CFileItem* pItem, const CStdString &strType);
50   bool IsItemUnlocked(CMediaSource* pItem, const CStdString &strType);
51   bool CheckLock(LockType btnType, const CStdString& strPassword, int iHeading);
52   bool CheckLock(LockType btnType, const CStdString& strPassword, int iHeading, bool& bCanceled);
53   bool IsProfileLockUnlocked(int iProfile=-1);
54   bool IsProfileLockUnlocked(int iProfile, bool& bCanceled, bool prompt = true);
55   bool IsMasterLockUnlocked(bool bPromptUser);
56   bool IsMasterLockUnlocked(bool bPromptUser, bool& bCanceled);
57
58   void UpdateMasterLockRetryCount(bool bResetCount);
59   bool CheckStartUpLock();
60   bool CheckMenuLock(int iWindowID);
61   bool SetMasterLockMode(bool bDetails=true);
62   bool LockSource(const CStdString& strType, const CStdString& strName, bool bState);
63   void LockSources(bool lock);
64   void RemoveSourceLocks();
65   bool IsDatabasePathUnlocked(const CStdString& strPath, VECSOURCES& vecSources);
66
67   bool bMasterUser;
68   int iMasterLockRetriesLeft;
69
70 private:
71   int VerifyPassword(LockType btnType, const CStdString& strPassword, const CStdString& strHeading);
72 };
73
74 extern CGUIPassword g_passwordManager;
75
76