Changeset 20


Ignore:
Timestamp:
May 4, 2016, 6:50:29 PM (9 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/AcronymDecoder.lpi

    r17 r20  
    9292      </Item5>
    9393    </RequiredPackages>
    94     <Units Count="9">
     94    <Units Count="11">
    9595      <Unit0>
    9696        <Filename Value="AcronymDecoder.lpr"/>
     
    146146        <ResourceBaseClass Value="Form"/>
    147147      </Unit8>
     148      <Unit9>
     149        <Filename Value="Forms\UFormImportSource.pas"/>
     150        <IsPartOfProject Value="True"/>
     151        <ComponentName Value="FormImportSource"/>
     152        <ResourceBaseClass Value="Form"/>
     153      </Unit9>
     154      <Unit10>
     155        <Filename Value="Forms\UFormImportSources.pas"/>
     156        <IsPartOfProject Value="True"/>
     157        <ComponentName Value="FormImportSources"/>
     158        <ResourceBaseClass Value="Form"/>
     159      </Unit10>
    148160    </Units>
    149161  </ProjectOptions>
  • trunk/AcronymDecoder.lpr

    r17 r20  
    1010  Forms, UAcronym, synapse, Common, SysUtils, TemplateGenerics, UFormImport,
    1111  CoolTranslator, UFormCategorySelect, UFormMain, UFormAcronym, UFormSettings,
    12   UFormCategories, UFormAcronyms
     12  UFormCategories, UFormAcronyms, UFormImportSource, UFormImportSources
    1313  { you can add units after this };
    1414
     
    3838  Application.CreateForm(TFormSettings, FormSettings);
    3939  Application.CreateForm(TFormImport, FormImport);
     40  Application.CreateForm(TFormImportSource, FormImportSource);
     41  Application.CreateForm(TFormImportSources, FormImportSources);
    4042  Application.Run;
    4143end.
  • trunk/Forms/UFormCategories.lfm

    r19 r20  
    1010  LCLVersion = '1.6.0.4'
    1111  object ListViewCategories: TListView
    12     Left = 16
     12    Left = 9
    1313    Height = 432
    1414    Top = 8
    15     Width = 760
     15    Width = 767
    1616    Anchors = [akTop, akLeft, akRight, akBottom]
    1717    Columns = <   
  • trunk/Forms/UFormCategories.pas

    r14 r20  
    3636    { private declarations }
    3737  public
     38    Categories: TAcronymCategories;
    3839    procedure UpdateList;
    3940    procedure UpdateInterface;
     
    5354  SCategory = 'Category';
    5455  SCategoryQuery = 'Enter name of category';
    55   SRemoveCategory = 'Remove category';
    56   SRemoveCategoryQuery = 'Do you really want to remove category?';
     56  SRemoveCategory = 'Remove categories';
     57  SRemoveCategoryQuery = 'Do you really want to remove selected categories?';
    5758  SCategoryAlreadyExists = 'Category %s already exists!';
    5859
     
    9596
    9697procedure TFormCategories.ARemoveExecute(Sender: TObject);
     98var
     99  I: Integer;
    97100begin
    98101  if Assigned(ListViewCategories.Selected) then begin
    99102    if MessageDlg(SRemoveCategory, SRemoveCategoryQuery,
    100103    TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin
    101       FormMain.AcronymDb.Categories.Remove(ListViewCategories.Selected.Data);
     104      for I := ListViewCategories.Items.Count - 1 downto 0 do
     105      if ListViewCategories.Items[I].Selected then
     106        Categories.Remove(ListViewCategories.Items[I].Data);
    102107      UpdateList;
    103108    end;
  • trunk/Forms/UFormMain.lfm

    r19 r20  
    11object FormMain: TFormMain
    2   Left = 393
     2  Left = 427
    33  Height = 446
    4   Top = 405
     4  Top = 423
    55  Width = 631
    66  Caption = 'Acronym Decoder'
     
    44164416      OnExecute = AShowAcronymsExecute
    44174417    end
     4418    object AShowImportSources: TAction
     4419      Caption = 'Import sources'
     4420      OnExecute = AShowImportSourcesExecute
     4421    end
    44184422  end
    44194423  object PersistentForm1: TPersistentForm
     
    44624466        Action = AShowCategories
    44634467      end
     4468      object MenuItem4: TMenuItem
     4469        Action = AShowImportSources
     4470      end
    44644471    end
    44654472    object MenuItem16: TMenuItem
  • trunk/Forms/UFormMain.lrt

    r19 r20  
    1515TFORMMAIN.ASHOWCATEGORIES.CAPTION=Categories
    1616TFORMMAIN.ASHOWACRONYMS.CAPTION=Acronyms
     17TFORMMAIN.ASHOWIMPORTSOURCES.CAPTION=Import sources
    1718TFORMMAIN.MENUITEM8.CAPTION=File
    1819TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent
  • trunk/Forms/UFormMain.pas

    r19 r20  
    1616
    1717  TFormMain = class(TForm)
     18    AShowImportSources: TAction;
    1819    AShowAcronyms: TAction;
    1920    AShowCategories: TAction;
     
    5051    MenuItem21: TMenuItem;
    5152    MenuItem22: TMenuItem;
     53    MenuItem4: TMenuItem;
    5254    MenuItemOpenRecent: TMenuItem;
    5355    MenuItem2: TMenuItem;
     
    7173    procedure AShowCategoriesExecute(Sender: TObject);
    7274    procedure AShowExecute(Sender: TObject);
     75    procedure AShowImportSourcesExecute(Sender: TObject);
    7376    procedure CheckBoxExactMathChange(Sender: TObject);
    7477    procedure EditSearchChange(Sender: TObject);
     
    111114
    112115uses
    113   UFormImport, UFormAcronym, UFormSettings, UFormCategories, UFormAcronyms;
     116  UFormImport, UFormAcronym, UFormSettings, UFormCategories, UFormAcronyms,
     117  UFormImportSource, UFormImportSources;
    114118
    115119resourcestring
     
    155159var
    156160  ModalResult: TModalResult;
    157 begin
    158   if Assigned(AcronymDb) and AcronymDb.Modified then begin
    159     ModalResult := MessageDlg(SAppExit, SAppExitQuery,
    160       mtConfirmation, [mbYes, mbNo, mbCancel], 0);
    161     if ModalResult = mrYes then begin
    162       AFileSave.Execute;
    163       FreeAndNil(AcronymDb);
    164       UpdateAcronymsList;
    165       UpdateInterface;
    166       ProjectClosed := True;
    167     end
    168     else if ModalResult = mrNo then begin
    169       FreeAndNil(AcronymDb);
    170       UpdateAcronymsList;
    171       UpdateInterface;
    172       ProjectClosed := True;
    173     end else ProjectClosed := False;
    174   end else ProjectClosed := True;
     161  DoClose: Boolean;
     162begin
     163  DoClose := False;
     164  if Assigned(AcronymDb) then begin
     165    if AcronymDb.Modified then begin
     166       ModalResult := MessageDlg(SAppExit, SAppExitQuery,
     167       mtConfirmation, [mbYes, mbNo, mbCancel], 0);
     168      if ModalResult = mrYes then begin
     169        AFileSave.Execute;
     170        DoClose := True;
     171      end
     172      else if ModalResult = mrNo then begin
     173        DoClose := True;
     174      end else ProjectClosed := False;
     175    end else DoClose := True;
     176  end;
     177  if DoClose then begin
     178    FreeAndNil(AcronymDb);
     179    UpdateAcronymsList;
     180    UpdateInterface;
     181    ProjectClosed := True;
     182  end;
    175183end;
    176184
     
    245253procedure TFormMain.AShowCategoriesExecute(Sender: TObject);
    246254begin
     255  FormCategories.Categories := AcronymDb.Categories;
    247256  FormCategories.ShowModal;
    248257  UpdateAcronymsList;
     
    253262begin
    254263  Show;
     264end;
     265
     266procedure TFormMain.AShowImportSourcesExecute(Sender: TObject);
     267begin
     268  FormImportSources.ImportSources := AcronymDb.ImportSources;
     269  FormImportSources.ShowModal;
     270  UpdateInterface;
    255271end;
    256272
     
    418434  AImport.Enabled := Assigned(AcronymDb);
    419435  AShowCategories.Enabled := Assigned(AcronymDb);
     436  AShowAcronyms.Enabled := Assigned(AcronymDb);
     437  AShowImportSources.Enabled := Assigned(AcronymDb);
    420438
    421439  Title := Application.Title;
  • trunk/Languages/AcronymDecoder.cs.po

    r19 r20  
    3737
    3838#: tformacronym.label1.caption
     39msgctxt "tformacronym.label1.caption"
    3940msgid "Name:"
    4041msgstr "Název:"
     
    159160msgstr "Formát dat:"
    160161
     162#: tformimportsource.buttoncancel.caption
     163#, fuzzy
     164msgctxt "tformimportsource.buttoncancel.caption"
     165msgid "Cancel"
     166msgstr "Zrušit"
     167
     168#: tformimportsource.buttonok.caption
     169#, fuzzy
     170msgctxt "tformimportsource.buttonok.caption"
     171msgid "Ok"
     172msgstr "Ok"
     173
     174#: tformimportsource.caption
     175msgctxt "tformimportsource.caption"
     176msgid "Import source"
     177msgstr ""
     178
     179#: tformimportsource.label1.caption
     180#, fuzzy
     181msgctxt "tformimportsource.label1.caption"
     182msgid "Name:"
     183msgstr "Název:"
     184
     185#: tformimportsource.label2.caption
     186msgid "Source URL:"
     187msgstr ""
     188
     189#: tformimportsources.aadd.caption
     190#, fuzzy
     191msgctxt "tformimportsources.aadd.caption"
     192msgid "Add"
     193msgstr "Přidat"
     194
     195#: tformimportsources.amodify.caption
     196#, fuzzy
     197msgctxt "tformimportsources.amodify.caption"
     198msgid "Modify"
     199msgstr "Upravit"
     200
     201#: tformimportsources.aremove.caption
     202#, fuzzy
     203msgctxt "tformimportsources.aremove.caption"
     204msgid "Remove"
     205msgstr "Odebrat"
     206
     207#: tformimportsources.caption
     208msgctxt "tformimportsources.caption"
     209msgid "Import sources"
     210msgstr ""
     211
     212#: tformimportsources.listview1.columns[0].caption
     213#, fuzzy
     214msgctxt "tformimportsources.listview1.columns[0].caption"
     215msgid "Name"
     216msgstr "Název"
     217
     218#: tformimportsources.listview1.columns[1].caption
     219msgid "URL"
     220msgstr ""
     221
    161222#: tformmain.aexit.caption
    162223msgid "Exit"
     
    207268msgstr "Kategorie"
    208269
     270#: tformmain.ashowimportsources.caption
     271msgctxt "tformmain.ashowimportsources.caption"
     272msgid "Import sources"
     273msgstr ""
     274
    209275#: tformmain.caption
    210276msgid "Acronym Decoder"
     
    283349
    284350#: uformacronym.sremovecategory
     351msgctxt "uformacronym.sremovecategory"
    285352msgid "Remove categories"
    286353msgstr "Odebrat kategorie"
    287354
    288355#: uformacronym.sremovecategoryquery
     356msgctxt "uformacronym.sremovecategoryquery"
    289357msgid "Do you really want to remove selected categories?"
    290358msgstr "Opravdu chcete odebrat vybrané kategorie?"
     
    328396
    329397#: uformcategories.sremovecategory
    330 msgid "Remove category"
     398#, fuzzy
     399#| msgid "Remove category"
     400msgctxt "uformcategories.sremovecategory"
     401msgid "Remove categories"
    331402msgstr "Odebrat kategorii"
    332403
    333404#: uformcategories.sremovecategoryquery
    334 msgid "Do you really want to remove category?"
     405#, fuzzy
     406#| msgid "Do you really want to remove category?"
     407msgctxt "uformcategories.sremovecategoryquery"
     408msgid "Do you really want to remove selected categories?"
    335409msgstr "Opravdu chcete odebrat kategorii?"
    336410
     
    339413msgstr "Importováno %d nových zkratek."
    340414
     415#: uformimportsources.simportsource
     416msgctxt "uformimportsources.simportsource"
     417msgid "Import source"
     418msgstr ""
     419
     420#: uformimportsources.simportsourcealreadyexists
     421msgid "Import source %s already exists!"
     422msgstr ""
     423
     424#: uformimportsources.simportsourcequery
     425msgid "Enter name of import source"
     426msgstr ""
     427
     428#: uformimportsources.sremoveimportsource
     429msgid "Remove import sources"
     430msgstr ""
     431
     432#: uformimportsources.sremoveimportsourcequery
     433msgid "Do you really want to remove selected import sources?"
     434msgstr ""
     435
    341436#: uformmain.sappexit
    342437msgid "Application exit"
  • trunk/Languages/AcronymDecoder.po

    r19 r20  
    2727
    2828#: tformacronym.label1.caption
     29msgctxt "tformacronym.label1.caption"
    2930msgid "Name:"
    3031msgstr ""
     
    144145msgstr ""
    145146
     147#: tformimportsource.buttoncancel.caption
     148msgctxt "TFORMIMPORTSOURCE.BUTTONCANCEL.CAPTION"
     149msgid "Cancel"
     150msgstr ""
     151
     152#: tformimportsource.buttonok.caption
     153msgctxt "TFORMIMPORTSOURCE.BUTTONOK.CAPTION"
     154msgid "Ok"
     155msgstr ""
     156
     157#: tformimportsource.caption
     158msgctxt "tformimportsource.caption"
     159msgid "Import source"
     160msgstr ""
     161
     162#: tformimportsource.label1.caption
     163msgctxt "TFORMIMPORTSOURCE.LABEL1.CAPTION"
     164msgid "Name:"
     165msgstr ""
     166
     167#: tformimportsource.label2.caption
     168msgid "Source URL:"
     169msgstr ""
     170
     171#: tformimportsources.aadd.caption
     172msgctxt "TFORMIMPORTSOURCES.AADD.CAPTION"
     173msgid "Add"
     174msgstr ""
     175
     176#: tformimportsources.amodify.caption
     177msgctxt "TFORMIMPORTSOURCES.AMODIFY.CAPTION"
     178msgid "Modify"
     179msgstr ""
     180
     181#: tformimportsources.aremove.caption
     182msgctxt "TFORMIMPORTSOURCES.AREMOVE.CAPTION"
     183msgid "Remove"
     184msgstr ""
     185
     186#: tformimportsources.caption
     187msgctxt "tformimportsources.caption"
     188msgid "Import sources"
     189msgstr ""
     190
     191#: tformimportsources.listview1.columns[0].caption
     192msgctxt "TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[0].CAPTION"
     193msgid "Name"
     194msgstr ""
     195
     196#: tformimportsources.listview1.columns[1].caption
     197msgid "URL"
     198msgstr ""
     199
    146200#: tformmain.aexit.caption
    147201msgid "Exit"
     
    192246msgstr ""
    193247
     248#: tformmain.ashowimportsources.caption
     249msgctxt "TFORMMAIN.ASHOWIMPORTSOURCES.CAPTION"
     250msgid "Import sources"
     251msgstr ""
     252
    194253#: tformmain.caption
    195254msgid "Acronym Decoder"
     
    268327
    269328#: uformacronym.sremovecategory
     329msgctxt "uformacronym.sremovecategory"
    270330msgid "Remove categories"
    271331msgstr ""
    272332
    273333#: uformacronym.sremovecategoryquery
     334msgctxt "uformacronym.sremovecategoryquery"
    274335msgid "Do you really want to remove selected categories?"
    275336msgstr ""
     
    309370
    310371#: uformcategories.sremovecategory
    311 msgid "Remove category"
     372msgctxt "uformcategories.sremovecategory"
     373msgid "Remove categories"
    312374msgstr ""
    313375
    314376#: uformcategories.sremovecategoryquery
    315 msgid "Do you really want to remove category?"
     377msgctxt "uformcategories.sremovecategoryquery"
     378msgid "Do you really want to remove selected categories?"
    316379msgstr ""
    317380
     
    320383msgstr ""
    321384
     385#: uformimportsources.simportsource
     386msgctxt "uformimportsources.simportsource"
     387msgid "Import source"
     388msgstr ""
     389
     390#: uformimportsources.simportsourcealreadyexists
     391msgid "Import source %s already exists!"
     392msgstr ""
     393
     394#: uformimportsources.simportsourcequery
     395msgid "Enter name of import source"
     396msgstr ""
     397
     398#: uformimportsources.sremoveimportsource
     399msgid "Remove import sources"
     400msgstr ""
     401
     402#: uformimportsources.sremoveimportsourcequery
     403msgid "Do you really want to remove selected import sources?"
     404msgstr ""
     405
    322406#: uformmain.sappexit
    323407msgid "Application exit"
  • trunk/UAcronym.pas

    r17 r20  
    1313  TAcronymMeanings = class;
    1414  TAcronymDb = class;
     15  TImportSources = class;
    1516
    1617  TAcronymSource = class
     
    107108  end;
    108109
     110  TImportPattern = record
     111    StartString: string;
     112    EndString: string;
     113    NewItem: Boolean;
     114  end;
     115
     116  { TImportFormat }
     117
     118  TImportFormat = class
     119    Id: Integer;
     120    Name: string;
     121    Acronym: TImportPattern;
     122    Meaning: TImportPattern;
     123    Description: TImportPattern;
     124    procedure SaveToNode(Node: TDOMNode);
     125    procedure LoadFromNode(Node: TDOMNode);
     126  end;
     127
     128  { TImportFormats }
     129
     130  TImportFormats = class(TObjectList)
     131    procedure UpdateIds;
     132    procedure SaveToNode(Node: TDOMNode);
     133    procedure LoadFromNode(Node: TDOMNode);
     134    function SearchById(Id: Integer): TImportFormat;
     135  end;
     136
     137  { TImportSource }
     138
     139  TImportSource = class
     140    Name: string;
     141    URL: string;
     142    Format: TImportFormat;
     143    LastTime: TDateTime;
     144    Sources: TImportSources;
     145    procedure Assign(Source: TImportSource);
     146    procedure SaveToNode(Node: TDOMNode);
     147    procedure LoadFromNode(Node: TDOMNode);
     148    constructor Create;
     149    destructor Destroy; override;
     150  end;
     151
     152  { TImportSources }
     153
     154  TImportSources = class(TObjectList)
     155    AcronymDb: TAcronymDb;
     156    function SearchByName(Name: string): TImportSource;
     157    procedure SaveToNode(Node: TDOMNode);
     158    procedure LoadFromNode(Node: TDOMNode);
     159  end;
     160
    109161  { TAcronymDb }
    110162
     
    114166    Acronyms: TAcronyms;
    115167    Categories: TAcronymCategories;
     168    ImportSources: TImportSources;
     169    ImportFormats: TImportFormats;
    116170    Modified: Boolean;
    117171    constructor Create;
     
    140194end;
    141195
     196{ TImportFormat }
     197
     198procedure TImportFormat.SaveToNode(Node: TDOMNode);
     199begin
     200  WriteInteger(Node, 'Id', Id);
     201  WriteString(Node, 'Name', Name);
     202  WriteString(Node, 'AcronymStartString', Acronym.StartString);
     203  WriteString(Node, 'AcronymEndString', Acronym.EndString);
     204  WriteString(Node, 'MeaningStartString', Meaning.StartString);
     205  WriteString(Node, 'MeaningEndString', Meaning.EndString);
     206  WriteString(Node, 'DescriptionStartString', Description.StartString);
     207  WriteString(Node, 'DescriptionEndString', Description.EndString);
     208end;
     209
     210procedure TImportFormat.LoadFromNode(Node: TDOMNode);
     211begin
     212  Id := ReadInteger(Node, 'Id', 0);
     213  Name := ReadString(Node, 'Name', '');
     214  Acronym.StartString := ReadString(Node, 'AcronymStartString', '');
     215  Acronym.EndString := ReadString(Node, 'AcronymEndString', '');
     216  Meaning.StartString := ReadString(Node, 'MeaningStartString', '');
     217  Meaning.EndString := ReadString(Node, 'MeaningEndString', '');
     218  Description.StartString := ReadString(Node, 'DescriptionStartString', '');
     219  Description.EndString := ReadString(Node, 'DescriptionEndString', '');
     220end;
     221
     222{ TImportSources }
     223
     224function TImportSources.SearchByName(Name: string): TImportSource;
     225var
     226  I: Integer;
     227begin
     228  I := 0;
     229  while (I < Count) and (TImportSource(Items[I]).Name <> Name) do Inc(I);
     230  if I < Count then Result := TImportSource(Items[I])
     231    else Result := nil;
     232end;
     233
     234procedure TImportSources.SaveToNode(Node: TDOMNode);
     235var
     236  I: Integer;
     237  NewNode2: TDOMNode;
     238begin
     239  for I := 0 to Count - 1 do
     240  with TImportSource(Items[I]) do begin
     241    NewNode2 := Node.OwnerDocument.CreateElement('ImportSource');
     242    Node.AppendChild(NewNode2);
     243    SaveToNode(NewNode2);
     244  end;
     245end;
     246
     247procedure TImportSources.LoadFromNode(Node: TDOMNode);
     248var
     249  Node2: TDOMNode;
     250  NewItem: TImportSource;
     251begin
     252  Count := 0;
     253  Node2 := Node.FirstChild;
     254  while Assigned(Node2) and (Node2.NodeName = 'ImportSource') do begin
     255    NewItem := TImportSource.Create;
     256    NewItem.Sources := Self;
     257    NewItem.LoadFromNode(Node2);
     258    Add(NewItem);
     259    Node2 := Node2.NextSibling;
     260  end;
     261end;
     262
     263{ TImportFormats }
     264
     265procedure TImportFormats.UpdateIds;
     266var
     267  LastId: Integer;
     268  I: Integer;
     269begin
     270  // Get highest used ID
     271  LastId := 0;
     272  for I := 0 to Count - 1 do begin
     273    if TImportFormat(Items[I]).Id > LastId then LastId := TImportFormat(Items[I]).Id;
     274  end;
     275  // Add ID to new items without ID
     276  for I := 0 to Count - 1 do begin
     277    if TImportFormat(Items[I]).Id = 0 then begin
     278      Inc(LastId);
     279      TImportFormat(Items[I]).Id := LastId;
     280    end;
     281  end;
     282end;
     283
     284procedure TImportFormats.SaveToNode(Node: TDOMNode);
     285var
     286  I: Integer;
     287  NewNode2: TDOMNode;
     288begin
     289  UpdateIds;
     290  for I := 0 to Count - 1 do
     291  with TImportFormat(Items[I]) do begin
     292    NewNode2 := Node.OwnerDocument.CreateElement('ImportFormat');
     293    Node.AppendChild(NewNode2);
     294    SaveToNode(NewNode2);
     295  end;
     296end;
     297
     298procedure TImportFormats.LoadFromNode(Node: TDOMNode);
     299var
     300  Node2: TDOMNode;
     301  NewItem: TImportFormat;
     302begin
     303  Count := 0;
     304  Node2 := Node.FirstChild;
     305  while Assigned(Node2) and (Node2.NodeName = 'ImportFormat') do begin
     306    NewItem := TImportFormat.Create;
     307    NewItem.LoadFromNode(Node2);
     308    Add(NewItem);
     309    Node2 := Node2.NextSibling;
     310  end;
     311  UpdateIds;
     312end;
     313
     314function TImportFormats.SearchById(Id: Integer): TImportFormat;
     315var
     316  I: Integer;
     317begin
     318  I := 0;
     319  while (I < Count) and (TImportFormat(Items[I]).Id <> Id) do Inc(I);
     320  if I < Count then Result := TImportFormat(Items[I])
     321    else Result := nil;
     322end;
     323
     324{ TImportSource }
     325
     326procedure TImportSource.Assign(Source: TImportSource);
     327begin
     328  Name := Source.Name;
     329  URL := Source.URL;
     330  Format := Source.Format;
     331end;
     332
     333procedure TImportSource.SaveToNode(Node: TDOMNode);
     334begin
     335  WriteString(Node, 'Name', Name);
     336  WriteString(Node, 'URL', URL);
     337  if Assigned(Format) then WriteInteger(Node, 'ImportFormat', Format.Id)
     338    else WriteInteger(Node, 'ImportFormat', -1);
     339end;
     340
     341procedure TImportSource.LoadFromNode(Node: TDOMNode);
     342begin
     343  Name := ReadString(Node, 'Name', '');
     344  URL := ReadString(Node, 'URL', '');
     345  Format := Sources.AcronymDb.ImportFormats.SearchById(ReadInteger(Node, 'ImportFormat', -1));
     346end;
     347
     348constructor TImportSource.Create;
     349begin
     350  Format := nil;
     351end;
     352
     353destructor TImportSource.Destroy;
     354begin
     355  inherited Destroy;
     356end;
     357
    142358{ TAcronymEntry }
    143359
     
    149365destructor TAcronymEntry.Destroy;
    150366begin
    151   Categories.Free;
     367  FreeAndNil(Categories);
    152368  inherited Destroy;
    153369end;
     
    492708  Acronyms.Db := Self;
    493709  Categories := TAcronymCategories.Create;
     710  ImportSources := TImportSources.Create;
     711  ImportSources.AcronymDb := Self;
     712  ImportFormats := TImportFormats.Create;
    494713end;
    495714
    496715destructor TAcronymDb.Destroy;
    497716begin
     717  FreeAndNil(ImportFormats);
     718  FreeAndNil(ImportSources);
    498719  FreeAndNil(Sources);
    499720  FreeAndNil(Acronyms);
     
    527748      if Assigned(NewNode) then
    528749        Acronyms.LoadFromNode(NewNode);
     750
     751      NewNode := FindNode('ImportFormats');
     752      if Assigned(NewNode) then
     753        ImportFormats.LoadFromNode(NewNode);
     754
     755      NewNode := FindNode('ImportSources');
     756      if Assigned(NewNode) then
     757        ImportSources.LoadFromNode(NewNode);
    529758    end;
    530759  finally
     
    557786      AppendChild(NewNode);
    558787      Acronyms.SaveToNode(NewNode);
     788
     789      NewNode := OwnerDocument.CreateElement('ImportFormats');
     790      AppendChild(NewNode);
     791      ImportFormats.SaveToNode(NewNode);
     792
     793      NewNode := OwnerDocument.CreateElement('ImportSources');
     794      AppendChild(NewNode);
     795      ImportSources.SaveToNode(NewNode);
    559796    end;
    560797    ForceDirectories(ExtractFileDir(FileName));
Note: See TracChangeset for help on using the changeset viewer.