backport r34271
authorspiff_ <spiff_@svn>
Thu, 30 Sep 2010 10:09:44 +0000 (10:09 +0000)
committerspiff_ <spiff_@svn>
Thu, 30 Sep 2010 10:09:44 +0000 (10:09 +0000)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@34318 568bbfeb-2a22-0410-94d2-cc84cf5bfa90

xbmc/GUIPassword.cpp
xbmc/GUIPassword.h
xbmc/utils/Builtins.cpp

index 42e9bbf..ea32c83 100644 (file)
@@ -191,10 +191,10 @@ bool CGUIPassword::SetMasterLockMode(bool bDetails)
 bool CGUIPassword::IsProfileLockUnlocked(int iProfile)
 {
   bool bDummy;
-  return IsProfileLockUnlocked(iProfile,bDummy);
+  return IsProfileLockUnlocked(iProfile,bDummy,true);
 }
 
-bool CGUIPassword::IsProfileLockUnlocked(int iProfile, bool& bCanceled)
+bool CGUIPassword::IsProfileLockUnlocked(int iProfile, bool& bCanceled, bool prompt)
 {
   if (g_passwordManager.bMasterUser)
     return true;
@@ -202,12 +202,16 @@ bool CGUIPassword::IsProfileLockUnlocked(int iProfile, bool& bCanceled)
   if (iProfile == -1)
     iProfileToCheck = g_settings.GetCurrentProfileIndex();
   if (iProfileToCheck == 0)
-    return IsMasterLockUnlocked(true,bCanceled);
+    return IsMasterLockUnlocked(prompt,bCanceled);
   else
   {
     CProfile *profile = g_settings.GetProfile(iProfileToCheck);
     if (!profile)
       return false;
+
+    if (!prompt)
+      return (profile->getLockMode() == LOCK_MODE_EVERYONE);
+
     if (profile->getDate().IsEmpty() &&
        (g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE ||
         profile->getLockMode() == LOCK_MODE_EVERYONE))
index 46fac0b..946d83f 100644 (file)
@@ -52,7 +52,7 @@ public:
   bool CheckLock(LockType btnType, const CStdString& strPassword, int iHeading);
   bool CheckLock(LockType btnType, const CStdString& strPassword, int iHeading, bool& bCanceled);
   bool IsProfileLockUnlocked(int iProfile=-1);
-  bool IsProfileLockUnlocked(int iProfile, bool& bCanceled);
+  bool IsProfileLockUnlocked(int iProfile, bool& bCanceled, bool prompt = true);
   bool IsMasterLockUnlocked(bool bPromptUser);
   bool IsMasterLockUnlocked(bool bPromptUser, bool& bCanceled);
 
index f6d13d8..691faaa 100644 (file)
@@ -263,11 +263,18 @@ int CBuiltins::Execute(const CStdString& execString)
   {
     g_application.getApplicationMessenger().Minimize();
   }
-  else if (execute.Equals("loadprofile") && g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE)
+  else if (execute.Equals("loadprofile"))
   {
     int index = g_settings.GetProfileIndex(parameter);
-    if (index >= 0)
+    bool prompt = (params.size() == 2 && params[1].Equals("prompt"));
+    bool bCanceled;
+    if (index >= 0
+        && (g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE
+            || g_passwordManager.IsProfileLockUnlocked(index,bCanceled,prompt)))
+    {
+
       CGUIWindowLoginScreen::LoadProfile(index);
+    }
   }
   else if (execute.Equals("mastermode"))
   {