From c46e7fa7ade320dd1960f6710c819a5f97ede4c6 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Fri, 8 Jul 2016 02:56:43 +0200 Subject: [PATCH] libman, prevent alias conflicts --- src/ce_libmaneditor.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ce_libmaneditor.pas b/src/ce_libmaneditor.pas index 53233f13..3f21ea6f 100644 --- a/src/ce_libmaneditor.pas +++ b/src/ce_libmaneditor.pas @@ -527,6 +527,7 @@ end; procedure TCELibManEditorWidget.btnEditAliasClick(Sender: TObject); var al: string; + i: integer; begin if List.Selected.isNil then exit; @@ -537,8 +538,17 @@ begin end else begin if inputQuery('library alias', '', al) then - List.Selected.Caption := al; - RowToLibrary(List.Selected); + begin + for i := 0 to LibMan.librariesCount-1 do + if (LibMan.libraryByIndex[i].libAlias = al) and + (LibMan.libraryByIndex[i] <> itemForRow(List.Selected)) then + begin + dlgOkError('This alias is already used by another library, the renaming is canceled'); + exit; + end; + List.Selected.Caption := al; + RowToLibrary(List.Selected); + end; end; end;