mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-30 11:02:56 +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;
|
||||
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'))
|
||||
|
@ -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;
|
||||
|
@ -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'))
|
||||
|
Loading…
Reference in New Issue
Block a user