IDE, Build profile manager dialog: ask confirmation before deleting profile

git-svn-id: trunk@28210 -
This commit is contained in:
maxim 2010-11-14 17:08:37 +00:00
parent 99235b92c9
commit 5b3e0b2f35
3 changed files with 29 additions and 21 deletions

View File

@ -41,21 +41,21 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
OnClick = MoveDownButtonClick OnClick = MoveDownButtonClick
end end
object MoveUpButton: TToolButton object MoveUpButton: TToolButton
Left = 246 Left = 201
Top = 0 Top = 0
Caption = 'MoveUpButton' Caption = 'MoveUpButton'
ImageIndex = 3 ImageIndex = 3
OnClick = MoveUpButtonClick OnClick = MoveUpButtonClick
end end
object EditButton: TToolButton object EditButton: TToolButton
Left = 171 Left = 139
Top = 0 Top = 0
Caption = 'EditButton' Caption = 'EditButton'
ImageIndex = 2 ImageIndex = 2
OnClick = EditButtonClick OnClick = EditButtonClick
end end
object RemoveButton: TToolButton object RemoveButton: TToolButton
Left = 73 Left = 60
Top = 0 Top = 0
Caption = 'RemoveButton' Caption = 'RemoveButton'
ImageIndex = 1 ImageIndex = 1
@ -69,7 +69,7 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
OnClick = AddButtonClick OnClick = AddButtonClick
end end
object tbSeparator: TToolButton object tbSeparator: TToolButton
Left = 242 Left = 197
Top = 0 Top = 0
Width = 4 Width = 4
Caption = 'tbSeparator' Caption = 'tbSeparator'
@ -78,7 +78,7 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
end end
object ProfilesListBox: TListBox object ProfilesListBox: TListBox
Left = 1 Left = 1
Height = 321 Height = 327
Top = 93 Top = 93
Width = 358 Width = 358
Align = alClient Align = alClient
@ -88,8 +88,8 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
end end
object ButtonPanel: TButtonPanel object ButtonPanel: TButtonPanel
Left = 7 Left = 7
Height = 32 Height = 26
Top = 420 Top = 426
Width = 346 Width = 346
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.Caption = '&ОК' OKButton.Caption = '&ОК'

View File

@ -888,20 +888,25 @@ begin
i := ProfilesListbox.ItemIndex; i := ProfilesListbox.ItemIndex;
if i<0 then exit; if i<0 then exit;
// Remove the item from selected list. // Remove the item from selected list.
SelI:=fProfsToManage.Selected.IndexOf(fProfsToManage[i].fName); if MessageDlg(lisLazBuildConfirmDeletion,
if SelI>-1 then lisLazBuildAreYouSureYouWantToDeleteThisBuildProfile, mtConfirmation,
fProfsToManage.Selected.Delete(SelI); [mbYes, mbNo], 0)=mrYes then
// New last item index. begin
NewI:=i; SelI:=fProfsToManage.Selected.IndexOf(fProfsToManage[i].fName);
if i=ProfilesListbox.Items.Count-1 then if SelI>-1 then
Dec(NewI); fProfsToManage.Selected.Delete(SelI);
// Update ProfsToManage collection. // New last item index.
fProfsToManage.Delete(i); NewI:=i;
fProfsToManage.fCurrentIndex:=NewI; if i=ProfilesListbox.Items.Count-1 then
// Update ListBox Dec(NewI);
ProfilesListBox.Items.Delete(i); // Update ProfsToManage collection.
ProfilesListBox.ItemIndex:=NewI; fProfsToManage.Delete(i);
EnableButtons; fProfsToManage.fCurrentIndex:=NewI;
// Update ListBox
ProfilesListBox.Items.Delete(i);
ProfilesListBox.ItemIndex:=NewI;
EnableButtons;
end;
end; end;
procedure TBuildProfileManagerForm.EditButtonClick(Sender: TObject); procedure TBuildProfileManagerForm.EditButtonClick(Sender: TObject);

View File

@ -2838,6 +2838,9 @@ resourcestring
+'ation dialog when building directly from Tools menu'; +'ation dialog when building directly from Tools menu';
lisLazBuildEditListOfDefinesWhichCanBeUsedByAnyProfile = 'Edit list of ' lisLazBuildEditListOfDefinesWhichCanBeUsedByAnyProfile = 'Edit list of '
+'defines which can be used by any profile'; +'defines which can be used by any profile';
lisLazBuildConfirmDeletion = 'Confirm deletion';
lisLazBuildAreYouSureYouWantToDeleteThisBuildProfile = 'Are you sure you '
+'want to delete this build profile?';
// compiler // compiler
lisCompilerErrorInvalidCompiler = 'Error: invalid compiler: %s'; lisCompilerErrorInvalidCompiler = 'Error: invalid compiler: %s';