diff options
author | howie-f <rftc@gmx.de> | 2020-02-21 09:12:17 +0100 |
---|---|---|
committer | howie-f <rftc@gmx.de> | 2020-02-25 17:45:42 +0100 |
commit | fade6af5d8df061e203cec404c5e21d15c73afaa (patch) | |
tree | 275a8b9d7ae0c4136e694e58868336aaff40d130 | |
parent | 649ee4ba49b3d9064541599f2f87e64d65fd8630 (diff) |
Introduce and refactor MediaLockState enum
-rw-r--r-- | xbmc/FileItem.cpp | 3 | ||||
-rw-r--r-- | xbmc/GUIPassword.cpp | 15 | ||||
-rw-r--r-- | xbmc/MediaSource.cpp | 3 | ||||
-rw-r--r-- | xbmc/MediaSource.h | 3 | ||||
-rw-r--r-- | xbmc/dialogs/GUIDialogContextMenu.cpp | 18 | ||||
-rw-r--r-- | xbmc/filesystem/SourcesDirectory.cpp | 4 | ||||
-rw-r--r-- | xbmc/games/windows/GUIWindowGames.cpp | 3 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/FileOperations.cpp | 3 | ||||
-rw-r--r-- | xbmc/media/CMakeLists.txt | 3 | ||||
-rw-r--r-- | xbmc/media/MediaLockState.h | 16 | ||||
-rw-r--r-- | xbmc/network/httprequesthandler/HTTPVfsHandler.cpp | 7 | ||||
-rw-r--r-- | xbmc/pictures/GUIWindowPictures.cpp | 3 | ||||
-rw-r--r-- | xbmc/playlists/PlayListXML.cpp | 5 | ||||
-rw-r--r-- | xbmc/programs/GUIWindowPrograms.cpp | 3 | ||||
-rw-r--r-- | xbmc/settings/MediaSourceSettings.cpp | 3 | ||||
-rw-r--r-- | xbmc/utils/FileUtils.cpp | 10 |
16 files changed, 71 insertions, 31 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 8438461fab..c576f13e47 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -25,6 +25,7 @@ #include "games/addons/GameClient.h" #include "games/tags/GameInfoTag.h" #include "guilib/LocalizeStrings.h" +#include "media/MediaLockState.h" #include "music/Album.h" #include "music/Artist.h" #include "music/MusicDatabase.h" @@ -493,7 +494,7 @@ void CFileItem::Initialize() m_idepth = 1; m_iLockMode = LOCK_MODE_EVERYONE; m_iBadPwdCount = 0; - m_iHasLock = 0; + m_iHasLock = LOCK_STATE_NO_LOCK; m_bCanQueue = true; m_specialSort = SortSpecialNone; m_doContentLookup = true; diff --git a/xbmc/GUIPassword.cpp b/xbmc/GUIPassword.cpp index 9b43489543..37d9a8144e 100644 --- a/xbmc/GUIPassword.cpp +++ b/xbmc/GUIPassword.cpp @@ -18,6 +18,7 @@ #include "guilib/GUIKeyboardFactory.h" #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" +#include "media/MediaLockState.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogOKHelper.h" #include "profiles/ProfileManager.h" @@ -52,7 +53,7 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const std::string &strType) if (profileManager->GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE) return true; - while (pItem->m_iHasLock > 1) + while (pItem->m_iHasLock > LOCK_STATE_LOCK_BUT_UNLOCKED) { std::string strLockCode = pItem->m_strLockCode; std::string strLabel = pItem->GetLabel(); @@ -89,7 +90,7 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const std::string &strType) { // password entry succeeded pItem->m_iBadPwdCount = 0; - pItem->m_iHasLock = 1; + pItem->m_iHasLock = LOCK_STATE_LOCK_BUT_UNLOCKED; g_passwordManager.LockSource(strType,strLabel,false); sprintf(buffer,"%i",pItem->m_iBadPwdCount); CMediaSourceSettings::GetInstance().UpdateSource(strType, strLabel, "badpwdcount", buffer); @@ -459,9 +460,9 @@ bool CGUIPassword::LockSource(const std::string& strType, const std::string& str { if (it->strName == strName) { - if (it->m_iHasLock > 0) + if (it->m_iHasLock > LOCK_STATE_NO_LOCK) { - it->m_iHasLock = bState?2:1; + it->m_iHasLock = bState ? LOCK_STATE_LOCKED : LOCK_STATE_LOCK_BUT_UNLOCKED; bResult = true; } break; @@ -482,7 +483,7 @@ void CGUIPassword::LockSources(bool lock) VECSOURCES *shares = CMediaSourceSettings::GetInstance().GetSources(strType); for (IVECSOURCES it=shares->begin();it != shares->end();++it) if (it->m_iLockMode != LOCK_MODE_EVERYONE) - it->m_iHasLock = lock ? 2 : 1; + it->m_iHasLock = lock ? LOCK_STATE_LOCKED : LOCK_STATE_LOCK_BUT_UNLOCKED; } CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES); CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg); @@ -498,7 +499,7 @@ void CGUIPassword::RemoveSourceLocks() for (IVECSOURCES it=shares->begin();it != shares->end();++it) if (it->m_iLockMode != LOCK_MODE_EVERYONE) // remove old info { - it->m_iHasLock = 0; + it->m_iHasLock = LOCK_STATE_NO_LOCK; it->m_iLockMode = LOCK_MODE_EVERYONE; CMediaSourceSettings::GetInstance().UpdateSource(strType, it->strName, "lockmode", "0"); // removes locks from xml } @@ -520,7 +521,7 @@ bool CGUIPassword::IsDatabasePathUnlocked(const std::string& strPath, VECSOURCES int iIndex = CUtil::GetMatchingSource(strPath, vecSources, bName); if (iIndex > -1 && iIndex < (int)vecSources.size()) - if (vecSources[iIndex].m_iHasLock < 2) + if (vecSources[iIndex].m_iHasLock < LOCK_STATE_LOCKED) return true; return false; diff --git a/xbmc/MediaSource.cpp b/xbmc/MediaSource.cpp index 76ddba9d90..6782ca3f1c 100644 --- a/xbmc/MediaSource.cpp +++ b/xbmc/MediaSource.cpp @@ -11,6 +11,7 @@ #include "URL.h" #include "Util.h" #include "filesystem/MultiPathDirectory.h" +#include "media/MediaLockState.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" @@ -41,7 +42,7 @@ void CMediaSource::FromNameAndPaths(const std::string &category, const std::stri m_iLockMode = LOCK_MODE_EVERYONE; m_strLockCode = "0"; m_iBadPwdCount = 0; - m_iHasLock = 0; + m_iHasLock = LOCK_STATE_NO_LOCK; m_allowSharing = true; if (URIUtils::IsMultiPath(strPath)) diff --git a/xbmc/MediaSource.h b/xbmc/MediaSource.h index 9fa72df8bf..1afbea2ac7 100644 --- a/xbmc/MediaSource.h +++ b/xbmc/MediaSource.h @@ -9,6 +9,7 @@ #pragma once #include "LockType.h" +#include "media/MediaLockState.h" #include <string> #include <vector> @@ -79,7 +80,7 @@ public: */ LockType m_iLockMode = LOCK_MODE_EVERYONE; std::string m_strLockCode; ///< Input code for Lock UI to verify, can be chosen freely. - int m_iHasLock = 0; + int m_iHasLock = LOCK_STATE_NO_LOCK; int m_iBadPwdCount = 0; ///< Number of wrong passwords user has entered since share was last unlocked std::string m_strThumbnailImage; ///< Path to a thumbnail image for the share, or blank for default diff --git a/xbmc/dialogs/GUIDialogContextMenu.cpp b/xbmc/dialogs/GUIDialogContextMenu.cpp index f12355421c..af92fc2430 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.cpp +++ b/xbmc/dialogs/GUIDialogContextMenu.cpp @@ -26,6 +26,7 @@ #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "input/Key.h" +#include "media/MediaLockState.h" #include "profiles/ProfileManager.h" #include "profiles/dialogs/GUIDialogLockSettings.h" #include "settings/MediaSourceSettings.h" @@ -249,11 +250,15 @@ void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFi } if (share && LOCK_MODE_EVERYONE != CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetMasterProfile().getLockMode()) { - if (share->m_iHasLock == 0 && (CServiceBroker::GetSettingsComponent()->GetProfileManager()->GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser)) + if (share->m_iHasLock == LOCK_STATE_NO_LOCK && (CServiceBroker::GetSettingsComponent() + ->GetProfileManager() + ->GetCurrentProfile() + .canWriteSources() || + g_passwordManager.bMasterUser)) buttons.Add(CONTEXT_BUTTON_ADD_LOCK, 12332); - else if (share->m_iHasLock == 1) + else if (share->m_iHasLock == LOCK_STATE_LOCK_BUT_UNLOCKED) buttons.Add(CONTEXT_BUTTON_REMOVE_LOCK, 12335); - else if (share->m_iHasLock == 2) + else if (share->m_iHasLock == LOCK_STATE_LOCKED) { buttons.Add(CONTEXT_BUTTON_REMOVE_LOCK, 12335); @@ -267,7 +272,7 @@ void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFi buttons.Add(CONTEXT_BUTTON_CHANGE_LOCK, 12356); } } - if (share && !g_passwordManager.bMasterUser && item->m_iHasLock == 1) + if (share && !g_passwordManager.bMasterUser && item->m_iHasLock == LOCK_STATE_LOCK_BUT_UNLOCKED) buttons.Add(CONTEXT_BUTTON_REACTIVATE_LOCK, 12353); } @@ -437,7 +442,7 @@ bool CGUIDialogContextMenu::OnContextButton(const std::string &type, const CFile if (!CGUIDialogLockSettings::ShowAndGetLock(share->m_iLockMode,strNewPassword)) return false; // password entry and re-entry succeeded, write out the lock data - share->m_iHasLock = 2; + share->m_iHasLock = LOCK_STATE_LOCKED; CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "lockcode", strNewPassword); strNewPassword = StringUtils::Format("%i", share->m_iLockMode); CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "lockmode", strNewPassword); @@ -465,10 +470,11 @@ bool CGUIDialogContextMenu::OnContextButton(const std::string &type, const CFile if (!g_passwordManager.IsMasterLockUnlocked(true)) return false; + // prompt user if they want to really remove the lock if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{12335}, CVariant{750})) return false; - share->m_iHasLock = 0; + share->m_iHasLock = LOCK_STATE_NO_LOCK; CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "lockmode", "0"); CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "lockcode", "0"); CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "badpwdcount", "0"); diff --git a/xbmc/filesystem/SourcesDirectory.cpp b/xbmc/filesystem/SourcesDirectory.cpp index fd0dcfc405..08d1c11363 100644 --- a/xbmc/filesystem/SourcesDirectory.cpp +++ b/xbmc/filesystem/SourcesDirectory.cpp @@ -14,6 +14,7 @@ #include "URL.h" #include "Util.h" #include "guilib/TextureManager.h" +#include "media/MediaLockState.h" #include "profiles/ProfileManager.h" #include "settings/MediaSourceSettings.h" #include "storage/MediaManager.h" @@ -88,7 +89,8 @@ bool CSourcesDirectory::GetDirectory(const VECSOURCES &sources, CFileItemList &i strIcon = "DefaultHardDisk.png"; pItem->SetIconImage(strIcon); - if (share.m_iHasLock == 2 && m_profileManager->GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE) + if (share.m_iHasLock == LOCK_STATE_LOCKED && + m_profileManager->GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE) pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_LOCKED); else pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_NONE); diff --git a/xbmc/games/windows/GUIWindowGames.cpp b/xbmc/games/windows/GUIWindowGames.cpp index 97fe450717..bef066dfb1 100644 --- a/xbmc/games/windows/GUIWindowGames.cpp +++ b/xbmc/games/windows/GUIWindowGames.cpp @@ -23,6 +23,7 @@ #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "guilib/WindowIDs.h" +#include "media/MediaLockState.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" @@ -292,7 +293,7 @@ std::string CGUIWindowGames::GetStartFolder(const std::string &dir) int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); if (iIndex >= 0) { - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + if (iIndex < static_cast<int>(shares.size()) && shares[iIndex].m_iHasLock == LOCK_STATE_LOCKED) { CFileItem item(shares[iIndex]); if (!g_passwordManager.IsItemUnlocked(&item, "games")) diff --git a/xbmc/interfaces/json-rpc/FileOperations.cpp b/xbmc/interfaces/json-rpc/FileOperations.cpp index 7919452155..b498211731 100644 --- a/xbmc/interfaces/json-rpc/FileOperations.cpp +++ b/xbmc/interfaces/json-rpc/FileOperations.cpp @@ -17,6 +17,7 @@ #include "VideoLibrary.h" #include "filesystem/Directory.h" #include "filesystem/File.h" +#include "media/MediaLockState.h" #include "settings/AdvancedSettings.h" #include "settings/MediaSourceSettings.h" #include "settings/SettingsComponent.h" @@ -41,7 +42,7 @@ JSONRPC_STATUS CFileOperations::GetRootDirectory(const std::string &method, ITra for (unsigned int i = 0; i < (unsigned int)sources->size(); i++) { // Do not show sources which are locked - if (sources->at(i).m_iHasLock == 2) + if (sources->at(i).m_iHasLock == LOCK_STATE_LOCKED) continue; items.Add(CFileItemPtr(new CFileItem(sources->at(i)))); diff --git a/xbmc/media/CMakeLists.txt b/xbmc/media/CMakeLists.txt index dc8f67a834..76b0737684 100644 --- a/xbmc/media/CMakeLists.txt +++ b/xbmc/media/CMakeLists.txt @@ -1,5 +1,6 @@ set(SOURCES MediaType.cpp) -set(HEADERS MediaType.h) +set(HEADERS MediaLockState.h + MediaType.h) core_add_library(media) diff --git a/xbmc/media/MediaLockState.h b/xbmc/media/MediaLockState.h new file mode 100644 index 0000000000..48c1183569 --- /dev/null +++ b/xbmc/media/MediaLockState.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2005-2020 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +typedef enum +{ + LOCK_STATE_NO_LOCK = 0, + LOCK_STATE_LOCK_BUT_UNLOCKED = 1, + LOCK_STATE_LOCKED = 2, +} MediaLockState; diff --git a/xbmc/network/httprequesthandler/HTTPVfsHandler.cpp b/xbmc/network/httprequesthandler/HTTPVfsHandler.cpp index 3bbaf8ef38..ccca1f37e6 100644 --- a/xbmc/network/httprequesthandler/HTTPVfsHandler.cpp +++ b/xbmc/network/httprequesthandler/HTTPVfsHandler.cpp @@ -11,6 +11,7 @@ #include "URL.h" #include "Util.h" #include "filesystem/File.h" +#include "media/MediaLockState.h" #include "network/WebServer.h" #include "settings/MediaSourceSettings.h" #include "storage/MediaManager.h" @@ -52,7 +53,7 @@ CHTTPVfsHandler::CHTTPVfsHandler(const HTTPRequest &request) for (VECSOURCES::const_iterator source = sources->begin(); source != sources->end() && !accessible; ++source) { // don't allow access to locked / disabled sharing sources - if (source->m_iHasLock == 2 || !source->m_allowSharing) + if (source->m_iHasLock == LOCK_STATE_LOCKED || !source->m_allowSharing) continue; for (std::vector<std::string>::const_iterator path = source->vecPaths.begin(); path != source->vecPaths.end(); ++path) @@ -74,8 +75,8 @@ CHTTPVfsHandler::CHTTPVfsHandler(const HTTPRequest &request) g_mediaManager.GetRemovableDrives(removableSources); int sourceIndex = CUtil::GetMatchingSource(realPath, removableSources, isSource); if (sourceIndex >= 0 && sourceIndex < static_cast<int>(removableSources.size()) && - removableSources.at(sourceIndex).m_iHasLock != 2 && - removableSources.at(sourceIndex).m_allowSharing) + removableSources.at(sourceIndex).m_iHasLock != LOCK_STATE_LOCKED && + removableSources.at(sourceIndex).m_allowSharing) accessible = true; } } diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp index a3e691878b..e9854f2fe9 100644 --- a/xbmc/pictures/GUIWindowPictures.cpp +++ b/xbmc/pictures/GUIWindowPictures.cpp @@ -24,6 +24,7 @@ #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "interfaces/AnnouncementManager.h" +#include "media/MediaLockState.h" #include "messaging/helpers/DialogOKHelper.h" #include "playlists/PlayList.h" #include "playlists/PlayListFactory.h" @@ -603,7 +604,7 @@ std::string CGUIWindowPictures::GetStartFolder(const std::string &dir) int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); if (iIndex > -1) { - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + if (iIndex < static_cast<int>(shares.size()) && shares[iIndex].m_iHasLock == LOCK_STATE_LOCKED) { CFileItem item(shares[iIndex]); if (!g_passwordManager.IsItemUnlocked(&item,"pictures")) diff --git a/xbmc/playlists/PlayListXML.cpp b/xbmc/playlists/PlayListXML.cpp index 61041ff298..5876ba78b3 100644 --- a/xbmc/playlists/PlayListXML.cpp +++ b/xbmc/playlists/PlayListXML.cpp @@ -10,6 +10,7 @@ #include "Util.h" #include "filesystem/File.h" +#include "media/MediaLockState.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include "utils/Variant.h" @@ -136,7 +137,7 @@ bool CPlayListXML::Load( const std::string& strFileName ) if ( !lockpass.empty() ) { newItem->m_strLockCode = lockpass; - newItem->m_iHasLock = 2; + newItem->m_iHasLock = LOCK_STATE_LOCKED; newItem->m_iLockMode = LOCK_MODE_NUMERIC; } @@ -181,7 +182,7 @@ void CPlayListXML::Save(const std::string& strFileName) const if ( !item->GetProperty("remotechannel").empty() ) write += StringUtils::Format(" <channel>%s</channel>", item->GetProperty("remotechannel").c_str() ); - if ( item->m_iHasLock > 0 ) + if (item->m_iHasLock > LOCK_STATE_NO_LOCK) write += StringUtils::Format(" <lockpassword>%s<lockpassword>", item->m_strLockCode.c_str() ); write += StringUtils::Format(" </stream>\n\n" ); diff --git a/xbmc/programs/GUIWindowPrograms.cpp b/xbmc/programs/GUIWindowPrograms.cpp index 4fff72aaeb..b0894ae9a7 100644 --- a/xbmc/programs/GUIWindowPrograms.cpp +++ b/xbmc/programs/GUIWindowPrograms.cpp @@ -18,6 +18,7 @@ #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "input/Key.h" +#include "media/MediaLockState.h" #include "settings/MediaSourceSettings.h" #include "utils/StringUtils.h" @@ -158,7 +159,7 @@ std::string CGUIWindowPrograms::GetStartFolder(const std::string &dir) int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); if (iIndex > -1) { - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + if (iIndex < static_cast<int>(shares.size()) && shares[iIndex].m_iHasLock == LOCK_STATE_LOCKED) { CFileItem item(shares[iIndex]); if (!g_passwordManager.IsItemUnlocked(&item,"programs")) diff --git a/xbmc/settings/MediaSourceSettings.cpp b/xbmc/settings/MediaSourceSettings.cpp index 34167e2157..84fde88448 100644 --- a/xbmc/settings/MediaSourceSettings.cpp +++ b/xbmc/settings/MediaSourceSettings.cpp @@ -12,6 +12,7 @@ #include "URL.h" #include "Util.h" #include "filesystem/File.h" +#include "media/MediaLockState.h" #include "network/WakeOnAccess.h" #include "profiles/ProfileManager.h" #include "settings/SettingsComponent.h" @@ -399,7 +400,7 @@ bool CMediaSourceSettings::GetSource(const std::string &category, const TiXmlNod if (pLockMode) { share.m_iLockMode = (LockType)std::strtol(pLockMode->FirstChild()->Value(), NULL, 10); - share.m_iHasLock = 2; + share.m_iHasLock = LOCK_STATE_LOCKED; } if (pLockCode && pLockCode->FirstChild()) diff --git a/xbmc/utils/FileUtils.cpp b/xbmc/utils/FileUtils.cpp index cc0455af74..a39f4f0f1b 100644 --- a/xbmc/utils/FileUtils.cpp +++ b/xbmc/utils/FileUtils.cpp @@ -20,6 +20,7 @@ #include "filesystem/StackDirectory.h" #include "guilib/GUIKeyboardFactory.h" #include "guilib/LocalizeStrings.h" +#include "media/MediaLockState.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" @@ -145,7 +146,9 @@ bool CFileUtils::RemoteAccessAllowed(const std::string &strPath) { VECSOURCES* sources = CMediaSourceSettings::GetInstance().GetSources(sourceName); int sourceIndex = CUtil::GetMatchingSource(realPath, *sources, isSource); - if (sourceIndex >= 0 && sourceIndex < (int)sources->size() && sources->at(sourceIndex).m_iHasLock != 2 && sources->at(sourceIndex).m_allowSharing) + if (sourceIndex >= 0 && sourceIndex < static_cast<int>(sources->size()) && + sources->at(sourceIndex).m_iHasLock != LOCK_STATE_LOCKED && + sources->at(sourceIndex).m_allowSharing) return true; } // Check auto-mounted sources @@ -153,8 +156,9 @@ bool CFileUtils::RemoteAccessAllowed(const std::string &strPath) g_mediaManager.GetRemovableDrives(sources); // Sources returned allways have m_allowsharing = true //! @todo Make sharing of auto-mounted sources user configurable int sourceIndex = CUtil::GetMatchingSource(realPath, sources, isSource); - if (sourceIndex >= 0 && sourceIndex < static_cast<int>(sources.size()) && - sources.at(sourceIndex).m_iHasLock != 2 && sources.at(sourceIndex).m_allowSharing) + if (sourceIndex >= 0 && sourceIndex < static_cast<int>(sources.size()) && + sources.at(sourceIndex).m_iHasLock != LOCK_STATE_LOCKED && + sources.at(sourceIndex).m_allowSharing) return true; return false; |