Changeset 8 for trunk/UFormMain.pas


Ignore:
Timestamp:
Apr 21, 2016, 1:12:45 PM (9 years ago)
Author:
chronos
Message:
  • Added: Also allow to edit acronym detailed description.
  • Added: Import from CSV file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r7 r8  
    136136    'Acronyms were modified. Do you want to save them to file before exit?',
    137137      mtConfirmation, [mbYes, mbNo, mbCancel], 0);
    138     if ModalResult = mrYes then AFileSave.Execute
    139     else if ModalResult = mrNo then CanClose := True
    140     else CanClose := False;
     138    if ModalResult = mrYes then begin
     139      AFileSave.Execute;
     140      CanClose := True;
     141    end
     142    else if ModalResult = mrNo then begin
     143      CanClose := True;
     144      AcronymDb.Modified := False;
     145    end else CanClose := False;
    141146  end;
    142147end;
     
    202207var
    203208  TempEntry: TAcronymEntry;
     209  Meaning: TAcronymMeaning;
    204210begin
    205211  if Assigned(ListViewAcronyms.Selected) then
     
    208214    TempEntry.Name := Acronym.Name;
    209215    TempEntry.Meaning := Name;
     216    TempEntry.Description := Description;
    210217    FormAcronym.Load(TempEntry);
    211218    if FormAcronym.ShowModal = mrOk then begin
    212219      FormAcronym.Save(TempEntry);
    213220      if (TempEntry.Name <> Acronym.Name) or
    214       (TempEntry.Meaning <> Name) then begin
     221      (TempEntry.Meaning <> Name) or
     222      (TempEntry.Description <> Description) then begin
    215223        // TODO: Update item inplace if possible
    216224        AcronymDb.RemoveAcronym(Acronym.Name, Name);
    217         AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     225        Meaning := AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     226        Meaning.Description := TempEntry.Description;
    218227        UpdateAcronymsList;
    219228        UpdateInterface;
     
    250259var
    251260  TempEntry: TAcronymEntry;
     261  Meaning: TAcronymMeaning;
    252262begin
    253263  TempEntry := TAcronymEntry.Create;
    254264  TempEntry.Name := '';
    255265  TempEntry.Meaning := '';
     266  TempEntry.Description := '';
    256267  FormAcronym.Load(TempEntry);
    257268  if FormAcronym.ShowModal = mrOk then begin
    258269    FormAcronym.Save(TempEntry);
    259     AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     270    Meaning := AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     271    Meaning.Description := TempEntry.Description;
    260272    UpdateAcronymsList;
    261273    UpdateInterface;
     
    267279  FormImport.ShowModal;
    268280  UpdateAcronymsList;
     281  UpdateInterface;
    269282end;
    270283
Note: See TracChangeset for help on using the changeset viewer.