mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-11 13:28:04 +02:00
IDE: replaced the Cancel button with "Skip this package", when an error is shown during loading of multiple packages, bug(8655)
git-svn-id: trunk@11439 -
This commit is contained in:
parent
2566bffceb
commit
671de5110e
@ -2613,6 +2613,7 @@ resourcestring
|
||||
+'sources.%s%sIt only means: It is a bad idea to open the forms for '
|
||||
+'designing, before installing the missing packages.%s%s';
|
||||
lisPackageNeedsInstallation = 'Package needs installation';
|
||||
lisPkgMangSkipThisPackage = 'Skip this package';
|
||||
lisPkgMangInvalidFileExtension = 'Invalid file extension';
|
||||
lisPkgMangTheFileIsNotALazarusPackage = 'The file %s%s%s is not a lazarus '
|
||||
+'package.';
|
||||
|
@ -2210,7 +2210,7 @@ begin
|
||||
For I := 0 to OpenDialog.Files.Count-1 do
|
||||
Begin
|
||||
AFilename:=CleanAndExpandFilename(OpenDialog.Files.Strings[i]);
|
||||
if i<OpenDialog.Files.Count then
|
||||
if i<OpenDialog.Files.Count-1 then
|
||||
Include(OpenFlags,ofMultiOpen)
|
||||
else
|
||||
Exclude(OpenFlags,ofMultiOpen);
|
||||
|
@ -37,9 +37,10 @@ type
|
||||
TPkgSaveFlags = set of TPkgSaveFlag;
|
||||
|
||||
TPkgOpenFlag = (
|
||||
pofAddToRecent, // add file to recent files
|
||||
pofRevert, // reload file if already open
|
||||
pofConvertMacros // replace macros in filename
|
||||
pofAddToRecent, // add file to recent files
|
||||
pofRevert, // reload file if already open
|
||||
pofConvertMacros, // replace macros in filename
|
||||
pofMultiOpen // set during loading multiple files
|
||||
);
|
||||
TPkgOpenFlags = set of TPkgOpenFlag;
|
||||
|
||||
|
@ -147,7 +147,8 @@ const
|
||||
PkgOpenFlagNames: array[TPkgOpenFlag] of string = (
|
||||
'pofAddToRecent',
|
||||
'pofRevert',
|
||||
'pofConvertMacros'
|
||||
'pofConvertMacros',
|
||||
'pofMultiOpen'
|
||||
);
|
||||
|
||||
function PkgSaveFlagsToString(Flags: TPkgSaveFlags): string;
|
||||
|
@ -350,6 +350,10 @@ begin
|
||||
For I := 0 to OpenDialog.Files.Count-1 do
|
||||
Begin
|
||||
AFilename:=CleanAndExpandFilename(OpenDialog.Files.Strings[i]);
|
||||
if i<OpenDialog.Files.Count-1 then
|
||||
Include(OpenFlags,pofMultiOpen)
|
||||
else
|
||||
Exclude(OpenFlags,pofMultiOpen);
|
||||
if DoOpenPackageFile(AFilename,OpenFlags)=mrAbort then begin
|
||||
break;
|
||||
end;
|
||||
@ -2250,6 +2254,16 @@ var
|
||||
APackage: TLazPackage;
|
||||
XMLConfig: TXMLConfig;
|
||||
AlternativePkgName: String;
|
||||
|
||||
procedure DoQuestionDlg(const Caption, Message: string);
|
||||
begin
|
||||
if pofMultiOpen in Flags then
|
||||
Result:=IDEQuestionDialog(Caption, Message,
|
||||
mtError, [mrIgnore, lisPkgMangSkipThisPackage, mrAbort])
|
||||
else
|
||||
Result:=IDEQuestionDialog(Caption, Message,
|
||||
mtError,[mrAbort])
|
||||
end;
|
||||
begin
|
||||
// replace macros
|
||||
if pofConvertMacros in Flags then begin
|
||||
@ -2260,9 +2274,8 @@ begin
|
||||
|
||||
// check file extension
|
||||
if CompareFileExt(AFilename,'.lpk',false)<>0 then begin
|
||||
Result:=IDEMessageDialog(lisPkgMangInvalidFileExtension,
|
||||
Format(lisPkgMangTheFileIsNotALazarusPackage, ['"', AFilename, '"']),
|
||||
mtError,[mbCancel,mbAbort]);
|
||||
DoQuestionDlg(lisPkgMangInvalidFileExtension,
|
||||
Format(lisPkgMangTheFileIsNotALazarusPackage, ['"', AFilename, '"']));
|
||||
RemoveFromRecentList(AFilename,EnvironmentOptions.RecentPackageFiles);
|
||||
SetRecentPackagesMenu;
|
||||
exit;
|
||||
@ -2272,10 +2285,9 @@ begin
|
||||
AlternativePkgName:=ExtractFileNameOnly(AFilename);
|
||||
if (AlternativePkgName='') or (not IsValidIdent(AlternativePkgName)) then
|
||||
begin
|
||||
Result:=IDEMessageDialog(lisPkgMangInvalidPackageFilename,
|
||||
DoQuestionDlg(lisPkgMangInvalidPackageFilename,
|
||||
Format(lisPkgMangThePackageFileNameInIsNotAValidLazarusPackageName, ['"',
|
||||
AlternativePkgName, '"', #13, '"', AFilename, '"']),
|
||||
mtError,[mbCancel,mbAbort]);
|
||||
AlternativePkgName, '"', #13, '"', AFilename, '"']));
|
||||
RemoveFromRecentList(AFilename,EnvironmentOptions.RecentPackageFiles);
|
||||
SetRecentPackagesMenu;
|
||||
exit;
|
||||
@ -2319,10 +2331,9 @@ begin
|
||||
end;
|
||||
except
|
||||
on E: Exception do begin
|
||||
Result:=IDEMessageDialog(lisPkgMangErrorReadingPackage,
|
||||
DoQuestionDlg(lisPkgMangErrorReadingPackage,
|
||||
Format(lisPkgUnableToReadPackageFileError, ['"', AFilename, '"',
|
||||
#13, E.Message]),
|
||||
mtError,[mbAbort,mbCancel]);
|
||||
#13, E.Message]));
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user