2
***************************************************************************
4
* This source is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This code is distributed in the hope that it will be useful, but *
10
* WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12
* General Public License for more details. *
14
* A copy of the GNU General Public License is available on the World *
15
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
16
* obtain it by writing to the Free Software Foundation, *
17
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************
21
unit MissingPkgFilesDlg;
28
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
30
PackageDefs, LazarusIDEStrConsts;
34
{ TMissingPkgFilesDialog }
36
TMissingPkgFilesDialog = class(TForm)
37
ButtonPanel1: TButtonPanel;
38
FilesTreeView: TTreeView;
39
procedure ButtonPanel1Click(Sender: TObject);
40
procedure FormCreate(Sender: TObject);
42
FLazPackage: TLazPackage;
43
procedure SetLazPackage(const AValue: TLazPackage);
44
procedure UpdateFilesList;
46
property LazPackage: TLazPackage read FLazPackage write SetLazPackage;
49
function ShowMissingPkgFilesDialog(APackage: TLazPackage): TModalResult;
53
function ShowMissingPkgFilesDialog(APackage: TLazPackage): TModalResult;
55
Dlg: TMissingPkgFilesDialog;
57
Dlg:=TMissingPkgFilesDialog.Create(nil);
59
Dlg.LazPackage:=APackage;
60
Result:=Dlg.ShowModal;
68
{ TMissingPkgFilesDialog }
70
procedure TMissingPkgFilesDialog.FormCreate(Sender: TObject);
72
ButtonPanel1.CancelButton.Caption:=lisCancel;
75
procedure TMissingPkgFilesDialog.ButtonPanel1Click(Sender: TObject);
77
if LazPackage<>nil then
78
LazPackage.RemoveNonExistingFiles;
81
procedure TMissingPkgFilesDialog.SetLazPackage(const AValue: TLazPackage);
83
if FLazPackage=AValue then exit;
85
if LazPackage<>nil then
86
Caption:=Format(lisPEMissingFilesOfPackage, [LazPackage.IDAsString]);
90
procedure TMissingPkgFilesDialog.UpdateFilesList;
98
FilesTreeView.BeginUpdate;
100
if LazPackage<>nil then begin
101
for j:=0 to LazPackage.FileCount-1 do begin
102
PkgFile:=LazPackage.Files[j];
103
RealFilename:=PkgFile.GetResolvedFilename;
104
if (RealFilename<>'') and FileExistsCached(RealFilename) then continue;
106
if FilesTreeView.Items.TopLvlCount>i then
107
FilesTreeView.Items.TopLvlItems[i].Text:=s
109
FilesTreeView.Items.Add(nil,s);
114
s:=lisPENoFilesMissingAllFilesExist;
115
if FilesTreeView.Items.TopLvlCount>i then
116
FilesTreeView.Items.TopLvlItems[i].Text:=s
118
FilesTreeView.Items.Add(nil,s);
120
while FilesTreeView.Items.TopLvlCount>i do
121
FilesTreeView.Items.TopLvlItems[FilesTreeView.Items.TopLvlCount-1].Free;
122
FilesTreeView.EndUpdate;
124
ButtonPanel1.OKButton.Caption:=lisPERemoveFiles;
126
ButtonPanel1.OKButton.Caption:=lisMenuOk;