mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 15:58:16 +02:00
LCL: TXML/IniPropStorage: do not load/save at designtime
git-svn-id: trunk@46350 -
This commit is contained in:
parent
396d19a9a0
commit
201421bcbf
@ -88,6 +88,7 @@ begin
|
|||||||
FreeStorage;
|
FreeStorage;
|
||||||
end;
|
end;
|
||||||
FReadOnly:=ReadOnly;
|
FReadOnly:=ReadOnly;
|
||||||
|
if not (csDesigning in ComponentState) then
|
||||||
FInifile:=IniFileClass.Create(GetIniFileName);
|
FInifile:=IniFileClass.Create(GetIniFileName);
|
||||||
end;
|
end;
|
||||||
Inc(FCount);
|
Inc(FCount);
|
||||||
@ -107,6 +108,8 @@ function TCustomIniPropStorage.GetIniFileName: string;
|
|||||||
begin
|
begin
|
||||||
If (FIniFileName<>'') then
|
If (FIniFileName<>'') then
|
||||||
Result:=FIniFileName
|
Result:=FIniFileName
|
||||||
|
else if csDesigning in ComponentState then
|
||||||
|
raise Exception.Create('TCustomIniPropStorage.GetIniFileName: missing Filename')
|
||||||
else
|
else
|
||||||
{$ifdef unix}
|
{$ifdef unix}
|
||||||
Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))
|
Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))
|
||||||
|
@ -521,7 +521,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomPropertyStorage.Save;
|
procedure TCustomPropertyStorage.Save;
|
||||||
begin
|
begin
|
||||||
if Active then begin
|
if Active and not (csDesigning in ComponentState) then begin
|
||||||
StorageNeeded(False);
|
StorageNeeded(False);
|
||||||
Try
|
Try
|
||||||
if Assigned(FOnSavingProperties) then
|
if Assigned(FOnSavingProperties) then
|
||||||
@ -540,7 +540,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomPropertyStorage.Restore;
|
procedure TCustomPropertyStorage.Restore;
|
||||||
begin
|
begin
|
||||||
if Active then begin
|
if Active and not (csDesigning in ComponentState) then begin
|
||||||
FSaved := False;
|
FSaved := False;
|
||||||
StorageNeeded(True);
|
StorageNeeded(True);
|
||||||
try
|
try
|
||||||
@ -577,6 +577,7 @@ begin
|
|||||||
StoreObjectsProps(Owner,AStoredList);
|
StoreObjectsProps(Owner,AStoredList);
|
||||||
except
|
except
|
||||||
// ignore any exceptions
|
// ignore any exceptions
|
||||||
|
// ToDo: Why?
|
||||||
// ToDo: warn if unable to write file
|
// ToDo: warn if unable to write file
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -610,6 +611,7 @@ begin
|
|||||||
LoadObjectsProps(Owner,L);
|
LoadObjectsProps(Owner,L);
|
||||||
except
|
except
|
||||||
{ ignore any exceptions }
|
{ ignore any exceptions }
|
||||||
|
// ToDo: Why?
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
Free;
|
Free;
|
||||||
|
@ -119,7 +119,8 @@ end;
|
|||||||
|
|
||||||
procedure TCustomXMLPropStorage.StorageNeeded(ReadOnly: Boolean);
|
procedure TCustomXMLPropStorage.StorageNeeded(ReadOnly: Boolean);
|
||||||
begin
|
begin
|
||||||
If (FXML=Nil) then begin
|
If (FXML=Nil) and not (csDesigning in ComponentState) then
|
||||||
|
begin
|
||||||
FXML:=TPropStorageXMLConfig.Create(nil);
|
FXML:=TPropStorageXMLConfig.Create(nil);
|
||||||
FXML.FileName := GetXMLFileName;
|
FXML.FileName := GetXMLFileName;
|
||||||
end;
|
end;
|
||||||
@ -142,6 +143,8 @@ function TCustomXMLPropStorage.GetXMLFileName: string;
|
|||||||
begin
|
begin
|
||||||
if (FFileName<>'') then
|
if (FFileName<>'') then
|
||||||
Result:=FFileName
|
Result:=FFileName
|
||||||
|
else if csDesigning in ComponentState then
|
||||||
|
raise Exception.Create('TCustomXMLPropStorage.GetXMLFileName: missing Filename')
|
||||||
else
|
else
|
||||||
{$ifdef unix}
|
{$ifdef unix}
|
||||||
Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))
|
Result:=IncludeTrailingPathDelimiter(GetEnvironmentVariableUTF8('HOME'))
|
||||||
|
Loading…
Reference in New Issue
Block a user