LCL: Make ShellTreeView sorting work also when root path is empty. Issue #19571

git-svn-id: trunk@31303 -
This commit is contained in:
juha 2011-06-20 16:37:21 +00:00
parent 13d4799365
commit 3abbb28e51

View File

@ -53,6 +53,7 @@ type
FShellListView: TCustomShellListView;
FFileSortType: TFileSortType;
{ Setters and getters }
procedure SetFileSortType(const AValue: TFileSortType);
procedure SetRoot(const AValue: string);
procedure SetShellListView(const Value: TCustomShellListView);
protected
@ -78,7 +79,7 @@ type
{ Properties }
property ObjectTypes: TObjectTypes read FObjectTypes write FObjectTypes;
property ShellListView: TCustomShellListView read FShellListView write SetShellListView;
property FileSortType: TFileSortType read FFileSortType write FFileSortType;
property FileSortType: TFileSortType read FFileSortType write SetFileSortType;
property Root: string read FRoot write SetRoot;
{ Protected properties which users may want to access, see bug 15374 }
@ -329,6 +330,19 @@ begin
PopulateTreeNodeWithFiles(nil, AValue);
end;
// ToDo: Optimize, now the tree is populated in constructor, SetRoot and SetFileSortType.
// For some reason it does not show in performance really.
procedure TCustomShellTreeView.SetFileSortType(const AValue: TFileSortType);
begin
if FFileSortType=AValue then exit;
FFileSortType:=AValue;
Items.Clear;
if FRoot = '' then
PopulateWithBaseFiles()
else
PopulateTreeNodeWithFiles(nil, FRoot);
end;
function TCustomShellTreeView.CanExpand(Node: TTreeNode): Boolean;
begin
Result:=inherited CanExpand(Node);