UPD: Restored some checks for a link to directory.

This commit is contained in:
cobines 2009-07-18 07:43:21 +00:00
commit 83511f53a3
4 changed files with 32 additions and 30 deletions

View file

@ -935,7 +935,10 @@ begin
if iRow >= dgPanel.FixedRows then
AFile := FFiles[iRow - dgPanel.FixedRows]; // substract fixed rows (header)
if Assigned(AFile) and AFile.TheFile.IsDirectory and (Y < dgPanel.GridHeight) then
if Assigned(AFile) and
(AFile.TheFile.IsDirectory or AFile.TheFile.IsLinkToDirectory) and
(Y < dgPanel.GridHeight)
then
begin
if State = dsDragLeave then
// Mouse is leaving the control or drop will occur immediately.
@ -1233,7 +1236,7 @@ begin
Exit;
end;
}
if TheFile.IsDirectory then // deeper and deeper
if TheFile.IsDirectory or TheFile.IsLinkToDirectory then // deeper and deeper
begin
cdDownLevel(TheFile);
Exit;
@ -2244,7 +2247,9 @@ debugln('panelkeydown');
begin
if IsActiveItemValid then
begin
if GetActiveItem.TheFile.IsDirectory then
if GetActiveItem.TheFile.IsDirectory or
GetActiveItem.TheFile.IsLinkToDirectory
then
CalculateSpace(False);
SelectFile(GetActiveItem);
@ -2994,7 +2999,8 @@ begin
AFile := FFiles[iRow - dgPanel.FixedRows];
// If dropped into a directory modify destination path accordingly.
if Assigned(AFile) and AFile.TheFile.IsDirectory then
if Assigned(AFile) and
(AFile.TheFile.IsDirectory or AFile.TheFile.IsLinkToDirectory) then
begin
if AFile.TheFile.Name = '..' then
// remove the last subdirectory in the path
@ -3401,7 +3407,7 @@ begin
AFile := TargetPanel.FFiles[iRow - FixedRows]; // substract fixed rows (header)
if Assigned(AFile) and
(AFile.TheFile.IsDirectory{ or fri^.bLinkIsDir}) and
(AFile.TheFile.IsDirectory or AFile.TheFile.IsLinkToDirectory) and
(ClientPoint.Y < GridHeight) then
// It is a directory or link.
begin

View file

@ -887,7 +887,7 @@ begin
Exit;
end;
if IsLink and IsDirectory then
if IsLinkToDirectory then
begin
Result := FiDirLinkIconID;
Exit;

View file

@ -841,7 +841,9 @@ begin
fsfName:
begin
// Show square brackets around directories
if gDirBrackets and AFile.IsDirectory then
if gDirBrackets and
(AFile.IsDirectory or AFile.IsLinkToDirectory)
then
Result:= '[' + AFile.Name + ']'
else
Result:= AFile.Name;
@ -852,7 +854,7 @@ begin
fsfSize:
begin
if AFile.IsDirectory and
if (AFile.IsDirectory or AFile.IsLinkToDirectory) and
((AFile.Properties[fpSize] as TFileSizeProperty).Value = 0)
then
Result := '<DIR>'
@ -878,7 +880,9 @@ begin
fsfNameNoExtension:
begin
// Show square brackets around directories
if gDirBrackets and AFile.IsDirectory then
if gDirBrackets and
(AFile.IsDirectory or AFile.IsLinkToDirectory)
then
Result:= '[' + AFile.NameNoExt + ']'
else
Result:= AFile.NameNoExt;

View file

@ -119,6 +119,8 @@ end;
function ICompareByDirectory(item1, item2: TFile; bSortNegative: Boolean):Integer;
var
IsDir1, IsDir2: Boolean;
begin
{> 0 (positive) Item1 is less than Item2
0 Item1 is equal to Item2
@ -126,30 +128,19 @@ begin
Result:=0;
{
if (not (FPS_ISDIR(item1^.iMode) or item1^.bLinkIsDir)) and
(not (FPS_ISDIR(item2^.iMode) or item2^.bLinkIsDir)) then Exit;
}
if (not item1.IsDirectory) and (not item2.IsDirectory) then
Exit;
{
if (not (FPS_ISDIR(item1^.iMode) or item1^.bLinkIsDir)) and
(FPS_ISDIR(item2^.iMode) or item2^.bLinkIsDir) then
}
if (not item1.IsDirectory) and item2.IsDirectory then
IsDir1 := item1.IsDirectory or item1.IsLinkToDirectory;
IsDir2 := item2.IsDirectory or item2.IsLinkToDirectory;
if (not IsDir1) and (not IsDir2) then
Exit
else if (not IsDir1) and IsDir2 then
begin
Result:=+1;
end
else if item1.IsDirectory and (not item2.IsDirectory) then
{
if (FPS_ISDIR(item1^.iMode) or item1^.bLinkIsDir) and
(not (FPS_ISDIR(item2^.iMode) or item2^.bLinkIsDir)) then
}
else if IsDir1 and (not IsDir2) then
begin
Result:=-1;
end
// both is directory, compare it
// if item1.fName=item2.fName then Exit;
// handle .. first
else if item1.Name='..' then
begin
@ -187,15 +178,16 @@ begin
Result := 0;
// Don't sort directories only by name.
if item1.IsDirectory or item2.IsDirectory then
if item1.IsDirectory or item1.IsLinkToDirectory or
item2.IsDirectory or item2.IsLinkToDirectory then
begin
// Sort by full name.
Result := ICompareByName(item1, item2, bSortNegative);
end
else
begin
name1 := item1.NameNoExt;// ExtractOnlyFileName(item1.Name);
name2 := item2.NameNoExt;// ExtractOnlyFileName(item2.Name);
name1 := item1.NameNoExt;
name2 := item2.NameNoExt;
if gCaseSensitiveSort then
Result := StrComp(PChar(name1), PChar(name2))