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:
vincents 2007-07-06 20:18:38 +00:00
parent 2566bffceb
commit 671de5110e
5 changed files with 28 additions and 14 deletions

View File

@ -2613,6 +2613,7 @@ resourcestring
+'sources.%s%sIt only means: It is a bad idea to open the forms for ' +'sources.%s%sIt only means: It is a bad idea to open the forms for '
+'designing, before installing the missing packages.%s%s'; +'designing, before installing the missing packages.%s%s';
lisPackageNeedsInstallation = 'Package needs installation'; lisPackageNeedsInstallation = 'Package needs installation';
lisPkgMangSkipThisPackage = 'Skip this package';
lisPkgMangInvalidFileExtension = 'Invalid file extension'; lisPkgMangInvalidFileExtension = 'Invalid file extension';
lisPkgMangTheFileIsNotALazarusPackage = 'The file %s%s%s is not a lazarus ' lisPkgMangTheFileIsNotALazarusPackage = 'The file %s%s%s is not a lazarus '
+'package.'; +'package.';

View File

@ -2210,7 +2210,7 @@ begin
For I := 0 to OpenDialog.Files.Count-1 do For I := 0 to OpenDialog.Files.Count-1 do
Begin Begin
AFilename:=CleanAndExpandFilename(OpenDialog.Files.Strings[i]); AFilename:=CleanAndExpandFilename(OpenDialog.Files.Strings[i]);
if i<OpenDialog.Files.Count then if i<OpenDialog.Files.Count-1 then
Include(OpenFlags,ofMultiOpen) Include(OpenFlags,ofMultiOpen)
else else
Exclude(OpenFlags,ofMultiOpen); Exclude(OpenFlags,ofMultiOpen);

View File

@ -39,7 +39,8 @@ type
TPkgOpenFlag = ( TPkgOpenFlag = (
pofAddToRecent, // add file to recent files pofAddToRecent, // add file to recent files
pofRevert, // reload file if already open pofRevert, // reload file if already open
pofConvertMacros // replace macros in filename pofConvertMacros, // replace macros in filename
pofMultiOpen // set during loading multiple files
); );
TPkgOpenFlags = set of TPkgOpenFlag; TPkgOpenFlags = set of TPkgOpenFlag;

View File

@ -147,7 +147,8 @@ const
PkgOpenFlagNames: array[TPkgOpenFlag] of string = ( PkgOpenFlagNames: array[TPkgOpenFlag] of string = (
'pofAddToRecent', 'pofAddToRecent',
'pofRevert', 'pofRevert',
'pofConvertMacros' 'pofConvertMacros',
'pofMultiOpen'
); );
function PkgSaveFlagsToString(Flags: TPkgSaveFlags): string; function PkgSaveFlagsToString(Flags: TPkgSaveFlags): string;

View File

@ -350,6 +350,10 @@ begin
For I := 0 to OpenDialog.Files.Count-1 do For I := 0 to OpenDialog.Files.Count-1 do
Begin Begin
AFilename:=CleanAndExpandFilename(OpenDialog.Files.Strings[i]); 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 if DoOpenPackageFile(AFilename,OpenFlags)=mrAbort then begin
break; break;
end; end;
@ -2250,6 +2254,16 @@ var
APackage: TLazPackage; APackage: TLazPackage;
XMLConfig: TXMLConfig; XMLConfig: TXMLConfig;
AlternativePkgName: String; 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 begin
// replace macros // replace macros
if pofConvertMacros in Flags then begin if pofConvertMacros in Flags then begin
@ -2260,9 +2274,8 @@ begin
// check file extension // check file extension
if CompareFileExt(AFilename,'.lpk',false)<>0 then begin if CompareFileExt(AFilename,'.lpk',false)<>0 then begin
Result:=IDEMessageDialog(lisPkgMangInvalidFileExtension, DoQuestionDlg(lisPkgMangInvalidFileExtension,
Format(lisPkgMangTheFileIsNotALazarusPackage, ['"', AFilename, '"']), Format(lisPkgMangTheFileIsNotALazarusPackage, ['"', AFilename, '"']));
mtError,[mbCancel,mbAbort]);
RemoveFromRecentList(AFilename,EnvironmentOptions.RecentPackageFiles); RemoveFromRecentList(AFilename,EnvironmentOptions.RecentPackageFiles);
SetRecentPackagesMenu; SetRecentPackagesMenu;
exit; exit;
@ -2272,10 +2285,9 @@ begin
AlternativePkgName:=ExtractFileNameOnly(AFilename); AlternativePkgName:=ExtractFileNameOnly(AFilename);
if (AlternativePkgName='') or (not IsValidIdent(AlternativePkgName)) then if (AlternativePkgName='') or (not IsValidIdent(AlternativePkgName)) then
begin begin
Result:=IDEMessageDialog(lisPkgMangInvalidPackageFilename, DoQuestionDlg(lisPkgMangInvalidPackageFilename,
Format(lisPkgMangThePackageFileNameInIsNotAValidLazarusPackageName, ['"', Format(lisPkgMangThePackageFileNameInIsNotAValidLazarusPackageName, ['"',
AlternativePkgName, '"', #13, '"', AFilename, '"']), AlternativePkgName, '"', #13, '"', AFilename, '"']));
mtError,[mbCancel,mbAbort]);
RemoveFromRecentList(AFilename,EnvironmentOptions.RecentPackageFiles); RemoveFromRecentList(AFilename,EnvironmentOptions.RecentPackageFiles);
SetRecentPackagesMenu; SetRecentPackagesMenu;
exit; exit;
@ -2319,10 +2331,9 @@ begin
end; end;
except except
on E: Exception do begin on E: Exception do begin
Result:=IDEMessageDialog(lisPkgMangErrorReadingPackage, DoQuestionDlg(lisPkgMangErrorReadingPackage,
Format(lisPkgUnableToReadPackageFileError, ['"', AFilename, '"', Format(lisPkgUnableToReadPackageFileError, ['"', AFilename, '"',
#13, E.Message]), #13, E.Message]));
mtError,[mbAbort,mbCancel]);
exit; exit;
end; end;
end; end;