IDE: fixed asking to save non project files

git-svn-id: trunk@35930 -
This commit is contained in:
mattias 2012-03-13 14:40:15 +00:00
parent 14360957b4
commit 5e13517a21
2 changed files with 24 additions and 12 deletions

View File

@ -5456,6 +5456,7 @@ resourcestring
lisFileFiltersInsertRow = 'Insert Row'; lisFileFiltersInsertRow = 'Insert Row';
lisFileFiltersSetDefaults = 'Set defaults'; lisFileFiltersSetDefaults = 'Set defaults';
lisMenuPkgNewPackageComponent = 'New package component'; lisMenuPkgNewPackageComponent = 'New package component';
lisSaveChangedFiles = 'Save changed files?';
implementation implementation

View File

@ -8471,19 +8471,30 @@ begin
if Result=mrNoToAll then exit(mrOk); if Result=mrNoToAll then exit(mrOk);
if Result<>mrYes then exit(mrCancel); if Result<>mrYes then exit(mrCancel);
end end
else if Project1.SessionStorage=pssNone then else if SourceEditorManager.SomethingModified(false) then
// only session data changed and session is not saved => skip begin
exit(mrOk) // some non project files were changes in the source editor
else if not SomethingOfProjectIsModified then Result:=IDEQuestionDialog(lisSaveChangedFiles,lisSaveChangedFiles,
exit(mrOk) mtConfirmation, [mrYes, mrNoToAll, lisNo, mbCancel], '');
if Result=mrNoToAll then exit(mrOk);
if Result<>mrYes then exit(mrCancel);
end
else begin else begin
// only session data changed and session is saved separately // only session data changed
if EnvironmentOptions.AskSaveSessionOnly then begin if Project1.SessionStorage=pssNone then
Result:=IDEQuestionDialog(lisProjectSessionChanged, // session is not saved => skip
Format(lisSaveSessionChangesToProject, [Project1.GetTitleOrName]), exit(mrOk)
mtConfirmation, [mrYes, mrNoToAll, lisNo, mbCancel], ''); else if not SomethingOfProjectIsModified then
if Result=mrNoToAll then exit(mrOk); exit(mrOk)
if Result<>mrYes then exit(mrCancel); else begin
// session is saved separately
if EnvironmentOptions.AskSaveSessionOnly then begin
Result:=IDEQuestionDialog(lisProjectSessionChanged,
Format(lisSaveSessionChangesToProject, [Project1.GetTitleOrName]),
mtConfirmation, [mrYes, mrNoToAll, lisNo, mbCancel], '');
if Result=mrNoToAll then exit(mrOk);
if Result<>mrYes then exit(mrCancel);
end;
end; end;
end; end;
Result:=DoSaveProject([sfCanAbort]); Result:=DoSaveProject([sfCanAbort]);