LCL: TXML/IniPropStorage: do not load/save at designtime

git-svn-id: trunk@46350 -
This commit is contained in:
mattias 2014-09-29 18:53:52 +00:00
parent 396d19a9a0
commit 201421bcbf
3 changed files with 13 additions and 5 deletions

View File

@ -88,6 +88,7 @@ begin
FreeStorage;
end;
FReadOnly:=ReadOnly;
if not (csDesigning in ComponentState) then
FInifile:=IniFileClass.Create(GetIniFileName);
end;
Inc(FCount);
@ -107,6 +108,8 @@ function TCustomIniPropStorage.GetIniFileName: string;
begin
If (FIniFileName<>'') then
Result:=FIniFileName
else if csDesigning in ComponentState then
raise Exception.Create('TCustomIniPropStorage.GetIniFileName: missing Filename')
else
{$ifdef unix}
Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))

View File

@ -521,7 +521,7 @@ end;
procedure TCustomPropertyStorage.Save;
begin
if Active then begin
if Active and not (csDesigning in ComponentState) then begin
StorageNeeded(False);
Try
if Assigned(FOnSavingProperties) then
@ -540,7 +540,7 @@ end;
procedure TCustomPropertyStorage.Restore;
begin
if Active then begin
if Active and not (csDesigning in ComponentState) then begin
FSaved := False;
StorageNeeded(True);
try
@ -577,6 +577,7 @@ begin
StoreObjectsProps(Owner,AStoredList);
except
// ignore any exceptions
// ToDo: Why?
// ToDo: warn if unable to write file
end;
finally
@ -610,6 +611,7 @@ begin
LoadObjectsProps(Owner,L);
except
{ ignore any exceptions }
// ToDo: Why?
end;
finally
Free;

View File

@ -119,7 +119,8 @@ end;
procedure TCustomXMLPropStorage.StorageNeeded(ReadOnly: Boolean);
begin
If (FXML=Nil) then begin
If (FXML=Nil) and not (csDesigning in ComponentState) then
begin
FXML:=TPropStorageXMLConfig.Create(nil);
FXML.FileName := GetXMLFileName;
end;
@ -142,6 +143,8 @@ function TCustomXMLPropStorage.GetXMLFileName: string;
begin
if (FFileName<>'') then
Result:=FFileName
else if csDesigning in ComponentState then
raise Exception.Create('TCustomXMLPropStorage.GetXMLFileName: missing Filename')
else
{$ifdef unix}
Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))