Opkman: Bug fix: Package filter is not working properly. Reported by forum user @totya.

git-svn-id: trunk@57575 -
This commit is contained in:
balazs 2018-03-29 09:12:09 +00:00
parent 10994c4ec0
commit 8c69e30eb6
2 changed files with 24 additions and 1 deletions

View File

@ -226,6 +226,7 @@ begin
PackageDownloader.OnJSONProgress := nil;
PackageDownloader.OnJSONDownloadCompleted := nil;
StopUpdates;
Application.RemoveOnDeactivateHandler(@DoDeactivate);
VisualTree.Free;
Application.HintHidePause := FHintTimeOut;
end;

View File

@ -30,7 +30,7 @@ uses
// LCL
Forms, Controls, Graphics, ExtCtrls, StdCtrls, VirtualTrees,
// OpkMan
opkman_const, opkman_serializablepackages, opkman_options;
opkman_const, opkman_serializablepackages, opkman_options, opkman_visualtree;
type
@ -63,6 +63,7 @@ type
procedure VSTCompareNodes(Sender: TBaseVirtualTree; Node1,
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
procedure VSTFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
function IsNodeVisible(const APackageName: String): Boolean;
public
procedure PopulateList(const ATyp: Integer; const AExtra: String = '');
property Count: Integer read GetCount;
@ -138,6 +139,8 @@ begin
InvCnt := 0;
for I := 0 to SerializablePackages.Count - 1 do
begin
if not IsNodeVisible(SerializablePackages.Items[I].DisplayName) then
Continue;
if ATyp = 0 then
begin
for J := 0 to SerializablePackages.Items[I].LazarusPackages.Count - 1 do
@ -296,5 +299,24 @@ begin
Finalize(Data^);
end;
function TPackageListFrm.IsNodeVisible(const APackageName: String): Boolean;
var
Node: PVirtualNode;
Data: opkman_visualtree.PData;
begin
Result := False;
Node := VisualTree.VST.GetFirst;
while Assigned(Node) do
begin
Data := VisualTree.VST.GetNodeData(Node);
if (Data^.DataType = 1) and (Data^.PackageDisplayName = APackageName) then
begin
Result := VisualTree.VST.IsVisible[Node];
Break;
end;
Node := VisualTree.VST.GetNext(Node);
end;
end;
end.