Changeset 72 for trunk/Forms/UFormProperties.pas
- Timestamp:
- Dec 13, 2021, 8:47:20 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormProperties.pas
r54 r72 16 16 AAdd: TAction; 17 17 AClone: TAction; 18 ASaveValueToFile: TAction; 19 ALoadValueFromFile: TAction; 18 20 ASelectAll: TAction; 19 21 ARemove: TAction; … … 28 30 MenuItem4: TMenuItem; 29 31 MenuItem5: TMenuItem; 32 MenuItem6: TMenuItem; 33 MenuItem7: TMenuItem; 34 MenuItem8: TMenuItem; 35 OpenDialog1: TOpenDialog; 30 36 PopupMenuField: TPopupMenu; 37 SaveDialog1: TSaveDialog; 31 38 StatusBar1: TStatusBar; 32 39 ToolBar1: TToolBar; … … 35 42 ToolButton3: TToolButton; 36 43 ToolButton4: TToolButton; 44 ToolButton5: TToolButton; 45 ToolButton6: TToolButton; 46 ToolButton7: TToolButton; 37 47 procedure AAddExecute(Sender: TObject); 38 48 procedure ACloneExecute(Sender: TObject); 49 procedure ALoadValueFromFileExecute(Sender: TObject); 39 50 procedure AModifyExecute(Sender: TObject); 40 51 procedure ARemoveExecute(Sender: TObject); 52 procedure ASaveValueToFileExecute(Sender: TObject); 41 53 procedure ASelectAllExecute(Sender: TObject); 42 54 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 70 82 71 83 uses 72 UFormProperty, UCore ;84 UFormProperty, UCore, UCommon; 73 85 74 86 resourcestring … … 78 90 SFiltered = 'Filtered'; 79 91 SSelected = 'Selected'; 92 SAllFiles = 'All files'; 93 STextFiles = 'Text files'; 94 SValue = 'Value'; 95 96 const 97 TextFileExt = '.txt'; 80 98 81 99 { TFormProperties } … … 247 265 end; 248 266 267 procedure TFormProperties.ALoadValueFromFileExecute(Sender: TObject); 268 begin 269 if Assigned(ListView1.Selected) then begin 270 OpenDialog1.Filter := STextFiles + '|*' + TextFileExt + '|' + SAllFiles + '|*.*'; 271 OpenDialog1.DefaultExt := TextFileExt; 272 OpenDialog1.InitialDir := ExtractFileDir(Core.LastPropertyValueFileName); 273 OpenDialog1.FileName := ExtractFileName(Core.LastPropertyValueFileName); 274 if OpenDialog1.Execute then begin 275 TContactProperty(ListView1.Selected.Data).Value := LoadFileToStr(OpenDialog1.FileName); 276 Core.LastPropertyValueFileName := OpenDialog1.FileName; 277 ReloadList; 278 end; 279 end; 280 end; 281 249 282 procedure TFormProperties.AModifyExecute(Sender: TObject); 250 283 var … … 289 322 end; 290 323 324 procedure TFormProperties.ASaveValueToFileExecute(Sender: TObject); 325 begin 326 if Assigned(ListView1.Selected) then begin 327 SaveDialog1.Filter := STextFiles + '|*' + TextFileExt + '|' + SAllFiles + '|*.*'; 328 SaveDialog1.DefaultExt := TextFileExt; 329 SaveDialog1.InitialDir := ExtractFileDir(Core.LastPropertyValueFileName); 330 SaveDialog1.FileName := SValue + TextFileExt; 331 if SaveDialog1.Execute then begin 332 SaveStringToFile(TContactProperty(ListView1.Selected.Data).Value, SaveDialog1.FileName); 333 Core.LastPropertyValueFileName := SaveDialog1.FileName; 334 end; 335 end; 336 end; 337 291 338 procedure TFormProperties.ASelectAllExecute(Sender: TObject); 292 339 begin … … 324 371 AAdd.Enabled := Assigned(Properties); 325 372 AModify.Enabled := Assigned(Properties) and Assigned(ListView1.Selected); 373 AClone.Enabled := Assigned(Properties) and Assigned(ListView1.Selected);; 326 374 ARemove.Enabled := Assigned(Properties) and Assigned(ListView1.Selected); 375 ALoadValueFromFile.Enabled := Assigned(Properties) and Assigned(ListView1.Selected); 376 ASaveValueToFile.Enabled := Assigned(Properties) and Assigned(ListView1.Selected); 377 ASelectAll.Enabled := ListView1.Items.Count > 0; 327 378 328 379 Text := '';
Note:
See TracChangeset
for help on using the changeset viewer.