mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 07:59:32 +02:00
IDE: install package dialog: double click on a package moves it to the other list
git-svn-id: trunk@14761 -
This commit is contained in:
parent
78c6aa38dd
commit
16af84f993
@ -13,6 +13,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
OnCreate = InstallPkgSetDialogCreate
|
||||
OnDestroy = InstallPkgSetDialogDestroy
|
||||
OnResize = InstallPkgSetDialogResize
|
||||
LCLVersion = '0.9.25'
|
||||
object InstallPkgGroupBox: TGroupBox
|
||||
Left = 6
|
||||
Height = 291
|
||||
@ -21,26 +22,26 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'InstallPkgGroupBox'
|
||||
ClientHeight = 272
|
||||
ClientHeight = 273
|
||||
ClientWidth = 251
|
||||
TabOrder = 0
|
||||
object InstallListBox: TListBox
|
||||
Left = 6
|
||||
Height = 167
|
||||
Height = 168
|
||||
Top = 6
|
||||
Width = 239
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
ClickOnSelChange = False
|
||||
MultiSelect = True
|
||||
OnDblClick = InstallListBoxDblClick
|
||||
OnSelectionChange = InstallListBoxSelectionChange
|
||||
TabOrder = 0
|
||||
TopIndex = -1
|
||||
end
|
||||
object UninstallButton: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 180
|
||||
Width = 239
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -51,7 +52,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object ImportButton: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 210
|
||||
Top = 211
|
||||
Width = 239
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -62,7 +63,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
object ExportButton: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 241
|
||||
Top = 242
|
||||
Width = 239
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -79,26 +80,26 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'AvailablePkgGroupBox'
|
||||
ClientHeight = 272
|
||||
ClientHeight = 273
|
||||
ClientWidth = 251
|
||||
TabOrder = 1
|
||||
object AvailableListBox: TListBox
|
||||
Left = 6
|
||||
Height = 229
|
||||
Height = 230
|
||||
Top = 6
|
||||
Width = 239
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
ClickOnSelChange = False
|
||||
MultiSelect = True
|
||||
OnDblClick = AvailableListBoxDblClick
|
||||
OnSelectionChange = AvailableListBoxSelectionChange
|
||||
TabOrder = 0
|
||||
TopIndex = -1
|
||||
end
|
||||
object AddToInstallButton: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 241
|
||||
Top = 242
|
||||
Width = 239
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 6
|
||||
@ -109,9 +110,9 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
end
|
||||
object CancelButton: TButton
|
||||
Left = 6
|
||||
Height = 29
|
||||
Top = 402
|
||||
Width = 98
|
||||
Height = 23
|
||||
Top = 408
|
||||
Width = 90
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
Cancel = True
|
||||
@ -121,10 +122,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
end
|
||||
object SaveAndRebuildButton: TButton
|
||||
AnchorSideRight.Control = SaveAndExitButton
|
||||
Left = 224
|
||||
Height = 29
|
||||
Top = 402
|
||||
Width = 157
|
||||
Left = 261
|
||||
Height = 23
|
||||
Top = 408
|
||||
Width = 137
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -133,10 +134,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
TabOrder = 3
|
||||
end
|
||||
object SaveAndExitButton: TButton
|
||||
Left = 387
|
||||
Height = 29
|
||||
Top = 402
|
||||
Width = 135
|
||||
Left = 404
|
||||
Height = 23
|
||||
Top = 408
|
||||
Width = 118
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'SaveAndExitButton'
|
||||
@ -150,11 +151,11 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
|
||||
Width = 515
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
Caption = 'PkgInfoGroupBox'
|
||||
ClientHeight = 66
|
||||
ClientHeight = 67
|
||||
ClientWidth = 511
|
||||
TabOrder = 5
|
||||
object PkgInfoMemo: TMemo
|
||||
Height = 66
|
||||
Height = 67
|
||||
Width = 511
|
||||
Align = alClient
|
||||
ReadOnly = True
|
||||
|
@ -7,47 +7,48 @@ LazarusResources.Add('TInstallPkgSetDialog','FORMDATA',[
|
||||
+'rStyle'#7#13'bsSizeToolWin'#7'Caption'#6#19'InstallPkgSetDialog'#12'ClientH'
|
||||
+'eight'#3#185#1#11'ClientWidth'#3#17#2#8'OnCreate'#7#25'InstallPkgSetDialogC'
|
||||
+'reate'#9'OnDestroy'#7#26'InstallPkgSetDialogDestroy'#8'OnResize'#7#25'Insta'
|
||||
+'llPkgSetDialogResize'#0#9'TGroupBox'#18'InstallPkgGroupBox'#4'Left'#2#6#6'H'
|
||||
+'eight'#3'#'#1#3'Top'#2#6#5'Width'#3#255#0#7'Anchors'#11#5'akTop'#6'akLeft'#8
|
||||
+'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#18'InstallPkgGroupBox'
|
||||
+#12'ClientHeight'#3#16#1#11'ClientWidth'#3#251#0#8'TabOrder'#2#0#0#8'TListBo'
|
||||
+'x'#14'InstallListBox'#4'Left'#2#6#6'Height'#3#167#0#3'Top'#2#6#5'Width'#3
|
||||
+#239#0#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#16'ClickOnSelChan'
|
||||
+'ge'#8#11'MultiSelect'#9#17'OnSelectionChange'#7#29'InstallListBoxSelectionC'
|
||||
+'hange'#8'TabOrder'#2#0#8'TopIndex'#2#255#0#0#7'TButton'#15'UninstallButton'
|
||||
+#4'Left'#2#6#6'Height'#2#25#3'Top'#3#179#0#5'Width'#3#239#0#5'Align'#7#8'alB'
|
||||
+'ottom'#20'BorderSpacing.Around'#2#6#7'Caption'#6#15'UninstallButton'#7'OnCl'
|
||||
+'ick'#7#20'UninstallButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'#12'ImportBut'
|
||||
+'ton'#4'Left'#2#6#6'Height'#2#25#3'Top'#3#210#0#5'Width'#3#239#0#5'Align'#7#8
|
||||
+'alBottom'#20'BorderSpacing.Around'#2#6#7'Caption'#6#12'ImportButton'#7'OnCl'
|
||||
+'ick'#7#17'ImportButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#12'ExportButton'
|
||||
+#4'Left'#2#6#6'Height'#2#25#3'Top'#3#241#0#5'Width'#3#239#0#5'Align'#7#8'alB'
|
||||
+'ottom'#20'BorderSpacing.Around'#2#6#7'Caption'#6#12'ExportButton'#7'OnClick'
|
||||
+#7#17'ExportButtonClick'#8'TabOrder'#2#3#0#0#0#9'TGroupBox'#20'AvailablePkgG'
|
||||
+'roupBox'#4'Left'#3#11#1#6'Height'#3'#'#1#3'Top'#2#6#5'Width'#3#255#0#7'Anch'
|
||||
+'llPkgSetDialogResize'#10'LCLVersion'#6#6'0.9.25'#0#9'TGroupBox'#18'InstallP'
|
||||
+'kgGroupBox'#4'Left'#2#6#6'Height'#3'#'#1#3'Top'#2#6#5'Width'#3#255#0#7'Anch'
|
||||
+'ors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Cap'
|
||||
+'tion'#6#20'AvailablePkgGroupBox'#12'ClientHeight'#3#16#1#11'ClientWidth'#3
|
||||
+#251#0#8'TabOrder'#2#1#0#8'TListBox'#16'AvailableListBox'#4'Left'#2#6#6'Heig'
|
||||
+'ht'#3#229#0#3'Top'#2#6#5'Width'#3#239#0#5'Align'#7#8'alClient'#20'BorderSpa'
|
||||
+'cing.Around'#2#6#16'ClickOnSelChange'#8#11'MultiSelect'#9#17'OnSelectionCha'
|
||||
+'nge'#7#31'AvailableListBoxSelectionChange'#8'TabOrder'#2#0#8'TopIndex'#2#255
|
||||
+#0#0#7'TButton'#18'AddToInstallButton'#4'Left'#2#6#6'Height'#2#25#3'Top'#3
|
||||
+#241#0#5'Width'#3#239#0#5'Align'#7#8'alBottom'#20'BorderSpacing.Around'#2#6#7
|
||||
+'Caption'#6#18'AddToInstallButton'#7'OnClick'#7#23'AddToInstallButtonClick'#8
|
||||
+'TabOrder'#2#1#0#0#0#7'TButton'#12'CancelButton'#4'Left'#2#6#6'Height'#2#29#3
|
||||
+'Top'#3#146#1#5'Width'#2'b'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'
|
||||
+#9#6'Cancel'#9#7'Caption'#6#12'CancelButton'#11'ModalResult'#2#2#8'TabOrder'
|
||||
+#2#2#0#0#7'TButton'#20'SaveAndRebuildButton'#23'AnchorSideRight.Control'#7#17
|
||||
+'SaveAndExitButton'#4'Left'#3#224#0#6'Height'#2#29#3'Top'#3#146#1#5'Width'#3
|
||||
+#157#0#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing'
|
||||
+'.Around'#2#6#7'Caption'#6#20'SaveAndRebuildButton'#7'OnClick'#7#18'InstallB'
|
||||
+'uttonClick'#8'TabOrder'#2#3#0#0#7'TButton'#17'SaveAndExitButton'#4'Left'#3
|
||||
+#131#1#6'Height'#2#29#3'Top'#3#146#1#5'Width'#3#135#0#7'Anchors'#11#7'akRigh'
|
||||
+'t'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6#17'SaveAndExitButton'#7'OnClick'
|
||||
+#7#22'SaveAndExitButtonClick'#8'TabOrder'#2#4#0#0#9'TGroupBox'#15'PkgInfoGro'
|
||||
+'upBox'#4'Left'#2#7#6'Height'#2'U'#3'Top'#3'2'#1#5'Width'#3#3#2#7'Anchors'#11
|
||||
+#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6#15'PkgInfoGroupBox'#12'Clie'
|
||||
+'ntHeight'#2'B'#11'ClientWidth'#3#255#1#8'TabOrder'#2#5#0#5'TMemo'#11'PkgInf'
|
||||
+'oMemo'#6'Height'#2'B'#5'Width'#3#255#1#5'Align'#7#8'alClient'#8'ReadOnly'#9
|
||||
+#10'ScrollBars'#7#14'ssAutoVertical'#8'TabOrder'#2#0#0#0#0#0
|
||||
+'tion'#6#18'InstallPkgGroupBox'#12'ClientHeight'#3#17#1#11'ClientWidth'#3#251
|
||||
+#0#8'TabOrder'#2#0#0#8'TListBox'#14'InstallListBox'#4'Left'#2#6#6'Height'#3
|
||||
+#168#0#3'Top'#2#6#5'Width'#3#239#0#5'Align'#7#8'alClient'#20'BorderSpacing.A'
|
||||
+'round'#2#6#16'ClickOnSelChange'#8#11'MultiSelect'#9#10'OnDblClick'#7#22'Ins'
|
||||
+'tallListBoxDblClick'#17'OnSelectionChange'#7#29'InstallListBoxSelectionChan'
|
||||
+'ge'#8'TabOrder'#2#0#0#0#7'TButton'#15'UninstallButton'#4'Left'#2#6#6'Height'
|
||||
+#2#25#3'Top'#3#180#0#5'Width'#3#239#0#5'Align'#7#8'alBottom'#20'BorderSpacin'
|
||||
+'g.Around'#2#6#7'Caption'#6#15'UninstallButton'#7'OnClick'#7#20'UninstallBut'
|
||||
+'tonClick'#8'TabOrder'#2#1#0#0#7'TButton'#12'ImportButton'#4'Left'#2#6#6'Hei'
|
||||
+'ght'#2#25#3'Top'#3#211#0#5'Width'#3#239#0#5'Align'#7#8'alBottom'#20'BorderS'
|
||||
+'pacing.Around'#2#6#7'Caption'#6#12'ImportButton'#7'OnClick'#7#17'ImportButt'
|
||||
+'onClick'#8'TabOrder'#2#2#0#0#7'TButton'#12'ExportButton'#4'Left'#2#6#6'Heig'
|
||||
+'ht'#2#25#3'Top'#3#242#0#5'Width'#3#239#0#5'Align'#7#8'alBottom'#20'BorderSp'
|
||||
+'acing.Around'#2#6#7'Caption'#6#12'ExportButton'#7'OnClick'#7#17'ExportButto'
|
||||
+'nClick'#8'TabOrder'#2#3#0#0#0#9'TGroupBox'#20'AvailablePkgGroupBox'#4'Left'
|
||||
+#3#11#1#6'Height'#3'#'#1#3'Top'#2#6#5'Width'#3#255#0#7'Anchors'#11#5'akTop'#6
|
||||
+'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#20'Availabl'
|
||||
+'ePkgGroupBox'#12'ClientHeight'#3#17#1#11'ClientWidth'#3#251#0#8'TabOrder'#2
|
||||
+#1#0#8'TListBox'#16'AvailableListBox'#4'Left'#2#6#6'Height'#3#230#0#3'Top'#2
|
||||
+#6#5'Width'#3#239#0#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#16'C'
|
||||
+'lickOnSelChange'#8#11'MultiSelect'#9#10'OnDblClick'#7#24'AvailableListBoxDb'
|
||||
+'lClick'#17'OnSelectionChange'#7#31'AvailableListBoxSelectionChange'#8'TabOr'
|
||||
+'der'#2#0#0#0#7'TButton'#18'AddToInstallButton'#4'Left'#2#6#6'Height'#2#25#3
|
||||
+'Top'#3#242#0#5'Width'#3#239#0#5'Align'#7#8'alBottom'#20'BorderSpacing.Aroun'
|
||||
+'d'#2#6#7'Caption'#6#18'AddToInstallButton'#7'OnClick'#7#23'AddToInstallButt'
|
||||
+'onClick'#8'TabOrder'#2#1#0#0#0#7'TButton'#12'CancelButton'#4'Left'#2#6#6'He'
|
||||
+'ight'#2#23#3'Top'#3#152#1#5'Width'#2'Z'#7'Anchors'#11#6'akLeft'#8'akBottom'
|
||||
+#0#8'AutoSize'#9#6'Cancel'#9#7'Caption'#6#12'CancelButton'#11'ModalResult'#2
|
||||
+#2#8'TabOrder'#2#2#0#0#7'TButton'#20'SaveAndRebuildButton'#23'AnchorSideRigh'
|
||||
+'t.Control'#7#17'SaveAndExitButton'#4'Left'#3#5#1#6'Height'#2#23#3'Top'#3#152
|
||||
+#1#5'Width'#3#137#0#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20
|
||||
+'BorderSpacing.Around'#2#6#7'Caption'#6#20'SaveAndRebuildButton'#7'OnClick'#7
|
||||
+#18'InstallButtonClick'#8'TabOrder'#2#3#0#0#7'TButton'#17'SaveAndExitButton'
|
||||
+#4'Left'#3#148#1#6'Height'#2#23#3'Top'#3#152#1#5'Width'#2'v'#7'Anchors'#11#7
|
||||
+'akRight'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6#17'SaveAndExitButton'#7'O'
|
||||
+'nClick'#7#22'SaveAndExitButtonClick'#8'TabOrder'#2#4#0#0#9'TGroupBox'#15'Pk'
|
||||
+'gInfoGroupBox'#4'Left'#2#7#6'Height'#2'U'#3'Top'#3'2'#1#5'Width'#3#3#2#7'An'
|
||||
+'chors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6#15'PkgInfoGroupBo'
|
||||
+'x'#12'ClientHeight'#2'C'#11'ClientWidth'#3#255#1#8'TabOrder'#2#5#0#5'TMemo'
|
||||
+#11'PkgInfoMemo'#6'Height'#2'C'#5'Width'#3#255#1#5'Align'#7#8'alClient'#8'Re'
|
||||
+'adOnly'#9#10'ScrollBars'#7#14'ssAutoVertical'#8'TabOrder'#2#0#0#0#0#0
|
||||
]);
|
||||
|
@ -65,10 +65,12 @@ type
|
||||
SaveAndExitButton: TButton;
|
||||
UninstallButton: TButton;
|
||||
procedure AddToInstallButtonClick(Sender: TObject);
|
||||
procedure AvailableListBoxDblClick(Sender: TObject);
|
||||
procedure AvailableListBoxSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure ExportButtonClick(Sender: TObject);
|
||||
procedure ImportButtonClick(Sender: TObject);
|
||||
procedure InstallButtonClick(Sender: TObject);
|
||||
procedure InstallListBoxDblClick(Sender: TObject);
|
||||
procedure InstallListBoxSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure InstallPkgSetDialogCreate(Sender: TObject);
|
||||
procedure InstallPkgSetDialogDestroy(Sender: TObject);
|
||||
@ -97,6 +99,8 @@ type
|
||||
function IndexOfNewInstalledPkgByName(const APackageName: string): integer;
|
||||
procedure SavePackageListToFile(const AFilename: string);
|
||||
procedure LoadPackageListFromFile(const AFilename: string);
|
||||
procedure AddToInstall;
|
||||
procedure AddToUninstall;
|
||||
public
|
||||
function GetNewInstalledPackages: TFPList;
|
||||
property OldInstalledPackages: TPkgDependency read FOldInstalledPackages
|
||||
@ -164,6 +168,11 @@ begin
|
||||
ModalResult:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.InstallListBoxDblClick(Sender: TObject);
|
||||
begin
|
||||
AddToUninstall;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.AvailableListBoxSelectionChange(Sender: TObject;
|
||||
User: boolean);
|
||||
begin
|
||||
@ -216,73 +225,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.AddToInstallButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
NewPackageID: TLazPackageID;
|
||||
j: LongInt;
|
||||
APackage: TLazPackage;
|
||||
Additions: TFPList;
|
||||
begin
|
||||
Additions:=TFPList.Create;
|
||||
NewPackageID:=TLazPackageID.Create;
|
||||
try
|
||||
for i:=0 to AvailableListBox.Items.Count-1 do begin
|
||||
if not AvailableListBox.Selected[i] then continue;
|
||||
// check string
|
||||
if not NewPackageID.StringToID(AvailableListBox.Items[i]) then begin
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
debugln('TInstallPkgSetDialog.AddToInstallButtonClick invalid ID: ',
|
||||
AvailableListBox.Items[i]);
|
||||
continue;
|
||||
end;
|
||||
// check if already in list
|
||||
if NewInstalledPackagesContains(NewPackageID) then begin
|
||||
MessageDlg('Double',
|
||||
'The package '+NewPackageID.Name+' is already in the list',mtError,
|
||||
[mbCancel],0);
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
exit;
|
||||
end;
|
||||
// check if a package with same name is already in the list
|
||||
j:=IndexOfNewInstalledPkgByName(NewPackageID.Name);
|
||||
if j>=0 then begin
|
||||
MessageDlg('Conflict',
|
||||
'There is already a package '+NewPackageID.Name+' in the list',
|
||||
mtError,[mbCancel],0);
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
exit;
|
||||
end;
|
||||
// check if package is loaded and has some attributes that prevents
|
||||
// installation in the IDE
|
||||
APackage:=PackageGraph.FindPackageWithID(NewPackageID);
|
||||
if APackage<>nil then begin
|
||||
if APackage.PackageType=lptRunTime then begin
|
||||
MessageDlg('Not a designtime package',
|
||||
'The package '+APackage.IDAsString+' is not a design time package.'
|
||||
+' It can not be installed in the IDE',mtError,
|
||||
[mbCancel],0);
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
// ok => add to list
|
||||
Additions.Add(NewPackageID);
|
||||
NewPackageID:=TLazPackageID.Create;
|
||||
end;
|
||||
AvailableListBox.ItemIndex:=-1;
|
||||
// all ok => add to list
|
||||
for i:=0 to Additions.Count-1 do
|
||||
FNewInstalledPackages.Add(Additions[i]);
|
||||
Additions.Clear;
|
||||
UpdateNewInstalledPackages;
|
||||
UpdateButtonStates;
|
||||
finally
|
||||
// clean up
|
||||
NewPackageID.Free;
|
||||
for i:=0 to Additions.Count-1 do
|
||||
TObject(Additions[i]).Free;
|
||||
Additions.Free;
|
||||
end;
|
||||
AddToInstall;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.AvailableListBoxDblClick(Sender: TObject);
|
||||
begin
|
||||
AddToInstall;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.InstallListBoxSelectionChange(Sender: TObject;
|
||||
@ -318,44 +267,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.UninstallButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
OldPackageID: TLazPackageID;
|
||||
APackage: TLazPackage;
|
||||
Deletions: TFPList;
|
||||
begin
|
||||
Deletions:=TFPList.Create;
|
||||
try
|
||||
for i:=0 to InstallListBox.Items.Count-1 do begin
|
||||
if not InstallListBox.Selected[i] then continue;
|
||||
OldPackageID:=TLazPackageID(FNewInstalledPackages[i]);
|
||||
// get package
|
||||
APackage:=PackageGraph.FindPackageWithID(OldPackageID);
|
||||
if APackage<>nil then begin
|
||||
// check if package is a base package
|
||||
if APackage.AutoCreated then begin
|
||||
InstallListBox.Selected[i]:=false;
|
||||
MessageDlg('Uninstall impossible',
|
||||
'The package '+APackage.Name+' can not be uninstalled, because it '
|
||||
+'is needed by the IDE itself.',mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
// ok => add to deletions
|
||||
Deletions.Add(OldPackageID);
|
||||
end;
|
||||
// ok => remove from list
|
||||
InstallListBox.ItemIndex:=-1;
|
||||
for i:=0 to Deletions.Count-1 do begin
|
||||
OldPackageID:=TLazPackageID(Deletions[i]);
|
||||
FNewInstalledPackages.Remove(OldPackageID);
|
||||
OldPackageID.Free;
|
||||
end;
|
||||
UpdateNewInstalledPackages;
|
||||
UpdateButtonStates;
|
||||
finally
|
||||
Deletions.Free;
|
||||
end;
|
||||
AddToUninstall;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.SetOldInstalledPackages(
|
||||
@ -685,6 +598,117 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.AddToInstall;
|
||||
var
|
||||
i: Integer;
|
||||
NewPackageID: TLazPackageID;
|
||||
j: LongInt;
|
||||
APackage: TLazPackage;
|
||||
Additions: TFPList;
|
||||
begin
|
||||
Additions:=TFPList.Create;
|
||||
NewPackageID:=TLazPackageID.Create;
|
||||
try
|
||||
for i:=0 to AvailableListBox.Items.Count-1 do begin
|
||||
if not AvailableListBox.Selected[i] then continue;
|
||||
// check string
|
||||
if not NewPackageID.StringToID(AvailableListBox.Items[i]) then begin
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
debugln('TInstallPkgSetDialog.AddToInstallButtonClick invalid ID: ',
|
||||
AvailableListBox.Items[i]);
|
||||
continue;
|
||||
end;
|
||||
// check if already in list
|
||||
if NewInstalledPackagesContains(NewPackageID) then begin
|
||||
MessageDlg('Double',
|
||||
'The package '+NewPackageID.Name+' is already in the list',mtError,
|
||||
[mbCancel],0);
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
exit;
|
||||
end;
|
||||
// check if a package with same name is already in the list
|
||||
j:=IndexOfNewInstalledPkgByName(NewPackageID.Name);
|
||||
if j>=0 then begin
|
||||
MessageDlg('Conflict',
|
||||
'There is already a package '+NewPackageID.Name+' in the list',
|
||||
mtError,[mbCancel],0);
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
exit;
|
||||
end;
|
||||
// check if package is loaded and has some attributes that prevents
|
||||
// installation in the IDE
|
||||
APackage:=PackageGraph.FindPackageWithID(NewPackageID);
|
||||
if APackage<>nil then begin
|
||||
if APackage.PackageType=lptRunTime then begin
|
||||
MessageDlg('Not a designtime package',
|
||||
'The package '+APackage.IDAsString+' is not a design time package.'
|
||||
+' It can not be installed in the IDE',mtError,
|
||||
[mbCancel],0);
|
||||
AvailableListBox.Selected[i]:=false;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
// ok => add to list
|
||||
Additions.Add(NewPackageID);
|
||||
NewPackageID:=TLazPackageID.Create;
|
||||
end;
|
||||
AvailableListBox.ItemIndex:=-1;
|
||||
// all ok => add to list
|
||||
for i:=0 to Additions.Count-1 do
|
||||
FNewInstalledPackages.Add(Additions[i]);
|
||||
Additions.Clear;
|
||||
UpdateNewInstalledPackages;
|
||||
UpdateButtonStates;
|
||||
finally
|
||||
// clean up
|
||||
NewPackageID.Free;
|
||||
for i:=0 to Additions.Count-1 do
|
||||
TObject(Additions[i]).Free;
|
||||
Additions.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TInstallPkgSetDialog.AddToUninstall;
|
||||
var
|
||||
i: Integer;
|
||||
OldPackageID: TLazPackageID;
|
||||
APackage: TLazPackage;
|
||||
Deletions: TFPList;
|
||||
begin
|
||||
Deletions:=TFPList.Create;
|
||||
try
|
||||
for i:=0 to InstallListBox.Items.Count-1 do begin
|
||||
if not InstallListBox.Selected[i] then continue;
|
||||
OldPackageID:=TLazPackageID(FNewInstalledPackages[i]);
|
||||
// get package
|
||||
APackage:=PackageGraph.FindPackageWithID(OldPackageID);
|
||||
if APackage<>nil then begin
|
||||
// check if package is a base package
|
||||
if APackage.AutoCreated then begin
|
||||
InstallListBox.Selected[i]:=false;
|
||||
MessageDlg('Uninstall impossible',
|
||||
'The package '+APackage.Name+' can not be uninstalled, because it '
|
||||
+'is needed by the IDE itself.',mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
// ok => add to deletions
|
||||
Deletions.Add(OldPackageID);
|
||||
end;
|
||||
// ok => remove from list
|
||||
InstallListBox.ItemIndex:=-1;
|
||||
for i:=0 to Deletions.Count-1 do begin
|
||||
OldPackageID:=TLazPackageID(Deletions[i]);
|
||||
FNewInstalledPackages.Remove(OldPackageID);
|
||||
OldPackageID.Free;
|
||||
end;
|
||||
UpdateNewInstalledPackages;
|
||||
UpdateButtonStates;
|
||||
finally
|
||||
Deletions.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TInstallPkgSetDialog.GetNewInstalledPackages: TFPList;
|
||||
var
|
||||
i: Integer;
|
||||
|
Loading…
Reference in New Issue
Block a user