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

View File

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

View File

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