diff options
author | Arne Morten Kvarving <spiff@xbmc.org> | 2013-04-06 14:08:37 -0700 |
---|---|---|
committer | Arne Morten Kvarving <spiff@xbmc.org> | 2013-04-06 14:08:37 -0700 |
commit | 2ecbad75910413574db48c9465dd40bd504e4103 (patch) | |
tree | f1175f95eb358814e694393cd69d760f378b1939 | |
parent | 8ec86585655ee66f618aac9fa572f00ec81a2555 (diff) | |
parent | 548e229e9f4727b5f070a571c2055d9808e53e54 (diff) |
Merge pull request #1540 from leechguy/master
[Fix] Option for auto login of a specific selected user profile
-rw-r--r-- | xbmc/profiles/ProfilesManager.cpp | 11 | ||||
-rw-r--r-- | xbmc/profiles/ProfilesManager.h | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/xbmc/profiles/ProfilesManager.cpp b/xbmc/profiles/ProfilesManager.cpp index 88049789ee..10db718dc2 100644 --- a/xbmc/profiles/ProfilesManager.cpp +++ b/xbmc/profiles/ProfilesManager.cpp @@ -56,6 +56,7 @@ #define PROFILES_FILE "special://masterprofile/profiles.xml" #define XML_PROFILES "profiles" +#define XML_AUTO_LOGIN "autologin" #define XML_LAST_LOADED "lastloaded" #define XML_LOGIN_SCREEN "useloginscreen" #define XML_NEXTID "nextIdProfile" @@ -67,7 +68,7 @@ using namespace XFILE; static CProfile EmptyProfile; CProfilesManager::CProfilesManager() - : m_usingLoginScreen(false), m_lastUsedProfile(0), + : m_usingLoginScreen(false), m_autoLoginProfile(-1), m_lastUsedProfile(0), m_currentProfile(0), m_nextProfileId(0) { } @@ -137,6 +138,7 @@ bool CProfilesManager::Load(const std::string &file) { XMLUtils::GetUInt(rootElement, XML_LAST_LOADED, m_lastUsedProfile); XMLUtils::GetBoolean(rootElement, XML_LOGIN_SCREEN, m_usingLoginScreen); + XMLUtils::GetInt(rootElement, XML_AUTO_LOGIN, m_autoLoginProfile); XMLUtils::GetInt(rootElement, XML_NEXTID, m_nextProfileId); CStdString defaultDir("special://home/userdata"); @@ -178,6 +180,12 @@ bool CProfilesManager::Load(const std::string &file) m_currentProfile = m_lastUsedProfile; + // check the validity of the auto login profile index + if (m_autoLoginProfile < -1 || m_autoLoginProfile >= (int)m_profiles.size()) + m_autoLoginProfile = -1; + else if (m_autoLoginProfile >= 0) + m_currentProfile = m_autoLoginProfile; + // the login screen runs as the master profile, so if we're using this, we need to ensure // we switch to the master profile if (m_usingLoginScreen) @@ -203,6 +211,7 @@ bool CProfilesManager::Save(const std::string &file) const XMLUtils::SetInt(pRoot, XML_LAST_LOADED, m_currentProfile); XMLUtils::SetBoolean(pRoot, XML_LOGIN_SCREEN, m_usingLoginScreen); + XMLUtils::SetInt(pRoot, XML_AUTO_LOGIN, m_autoLoginProfile); XMLUtils::SetInt(pRoot, XML_NEXTID, m_nextProfileId); for (vector<CProfile>::const_iterator profile = m_profiles.begin(); profile != m_profiles.end(); profile++) diff --git a/xbmc/profiles/ProfilesManager.h b/xbmc/profiles/ProfilesManager.h index 4b64a95521..addeaf28ab 100644 --- a/xbmc/profiles/ProfilesManager.h +++ b/xbmc/profiles/ProfilesManager.h @@ -164,6 +164,7 @@ protected: private: std::vector<CProfile> m_profiles; bool m_usingLoginScreen; + int m_autoLoginProfile; uint32_t m_lastUsedProfile; uint32_t m_currentProfile; int m_nextProfileId; // for tracking the next available id to give to a new profile to ensure id's are not re-used |