Ignore:
Timestamp:
May 4, 2016, 6:50:29 PM (9 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.