Changeset 20 for trunk/Forms/UFormMain.pas
- Timestamp:
- May 4, 2016, 6:50:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r19 r20 16 16 17 17 TFormMain = class(TForm) 18 AShowImportSources: TAction; 18 19 AShowAcronyms: TAction; 19 20 AShowCategories: TAction; … … 50 51 MenuItem21: TMenuItem; 51 52 MenuItem22: TMenuItem; 53 MenuItem4: TMenuItem; 52 54 MenuItemOpenRecent: TMenuItem; 53 55 MenuItem2: TMenuItem; … … 71 73 procedure AShowCategoriesExecute(Sender: TObject); 72 74 procedure AShowExecute(Sender: TObject); 75 procedure AShowImportSourcesExecute(Sender: TObject); 73 76 procedure CheckBoxExactMathChange(Sender: TObject); 74 77 procedure EditSearchChange(Sender: TObject); … … 111 114 112 115 uses 113 UFormImport, UFormAcronym, UFormSettings, UFormCategories, UFormAcronyms; 116 UFormImport, UFormAcronym, UFormSettings, UFormCategories, UFormAcronyms, 117 UFormImportSource, UFormImportSources; 114 118 115 119 resourcestring … … 155 159 var 156 160 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; 162 begin 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; 175 183 end; 176 184 … … 245 253 procedure TFormMain.AShowCategoriesExecute(Sender: TObject); 246 254 begin 255 FormCategories.Categories := AcronymDb.Categories; 247 256 FormCategories.ShowModal; 248 257 UpdateAcronymsList; … … 253 262 begin 254 263 Show; 264 end; 265 266 procedure TFormMain.AShowImportSourcesExecute(Sender: TObject); 267 begin 268 FormImportSources.ImportSources := AcronymDb.ImportSources; 269 FormImportSources.ShowModal; 270 UpdateInterface; 255 271 end; 256 272 … … 418 434 AImport.Enabled := Assigned(AcronymDb); 419 435 AShowCategories.Enabled := Assigned(AcronymDb); 436 AShowAcronyms.Enabled := Assigned(AcronymDb); 437 AShowImportSources.Enabled := Assigned(AcronymDb); 420 438 421 439 Title := Application.Title;
Note:
See TracChangeset
for help on using the changeset viewer.