// // Copyright 2014 Perforce Software Inc. // using Perforce.Helper; namespace Perforce.Model { public class FolderItem : ListingItem { private string _depotPath; public override string DepotPath { get { return _depotPath; } set { _depotPath = value; } } private string _clientPath; public override string ClientPath { get { return _clientPath; } set { _clientPath = value; } } private bool _isMapped; public override bool IsMapped { get { return _isMapped; } set { _isMapped = value; } } // The following is intended to be true if the folder has an entry in Client Workspace // mapping on LHS - thus has been added via right-click > Sync to Computer. private bool _isTopLevelMapping; public bool IsTopLevelMapping { get { return _isTopLevelMapping; } set { _isTopLevelMapping = value; } } private bool _isPathInClientView; public bool IsPathInClientView { get { return _isPathInClientView; } set { _isPathInClientView = value; } } public bool AllowDrop { get { var allowDrop = false; if (_isMapped || ClientPath != null) { allowDrop = true; } return allowDrop; } } public override TYPE Type { get { return TYPE.FOLDER; } } public override void Refresh() { var p4 = Utility.GetPerforceHelper(); string path = _clientPath; if (path == null) path = _depotPath; _isMapped = p4.IsDirectoryMapped(path); _isPathInClientView = p4.IsPathInClientView(path); base.Refresh(); } public override string Icon { get { return UIHelper.GetFolderIcon(selected: IsSelected, mapped: IsMapped, inClientView: IsPathInClientView, ignored: IsIgnored); } } } }