Changeset 53 for trunk/Forms
- Timestamp:
- Dec 8, 2021, 2:02:17 PM (3 years ago)
- Location:
- trunk/Forms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContacts.lfm
r52 r53 14 14 object ListView1: TListView 15 15 Left = 0 16 Height = 8 1016 Height = 801 17 17 Top = 0 18 18 Width = 1210 … … 58 58 Left = 0 59 59 Height = 39 60 Top = 8 4260 Top = 833 61 61 Width = 1210 62 62 Align = alBottom … … 86 86 Action = AClone 87 87 end 88 object ToolButton5: TToolButton 89 Left = 141 90 Height = 33 91 Top = 2 92 Style = tbsSeparator 93 end 94 object ToolButton6: TToolButton 95 Left = 149 96 Top = 2 97 Action = ALoadFromFile 98 end 99 object ToolButton7: TToolButton 100 Left = 184 101 Top = 2 102 Action = ASaveToFile 103 end 88 104 end 89 105 object ListViewFilter1: TListViewFilter 90 106 Left = 0 91 107 Height = 32 92 Top = 8 10108 Top = 801 93 109 Width = 1210 94 110 OnChange = ListViewFilter1Change … … 97 113 object StatusBar1: TStatusBar 98 114 Left = 0 99 Height = 27100 Top = 8 81115 Height = 36 116 Top = 872 101 117 Width = 1210 102 118 Panels = < … … 124 140 object MenuItem4: TMenuItem 125 141 Action = ASelectAll 142 end 143 object MenuItem6: TMenuItem 144 Caption = '-' 145 end 146 object MenuItem7: TMenuItem 147 Action = ALoadFromFile 148 end 149 object MenuItem8: TMenuItem 150 Action = ASaveToFile 126 151 end 127 152 end … … 158 183 OnExecute = ACloneExecute 159 184 end 185 object ALoadFromFile: TAction 186 Caption = 'Load from file...' 187 ImageIndex = 5 188 OnExecute = ALoadFromFileExecute 189 end 190 object ASaveToFile: TAction 191 Caption = 'Save to file...' 192 ImageIndex = 7 193 OnExecute = ASaveToFileExecute 194 end 160 195 end 161 196 object ListViewSort1: TListViewSort … … 169 204 Top = 428 170 205 end 206 object SaveDialog1: TSaveDialog 207 Left = 720 208 Top = 408 209 end 210 object OpenDialog1: TOpenDialog 211 Left = 720 212 Top = 480 213 end 171 214 end -
trunk/Forms/UFormContacts.lrj
r52 r53 11 11 {"hash":93079237,"name":"tformcontacts.aremove.caption","sourcebytes":[82,101,109,111,118,101],"value":"Remove"}, 12 12 {"hash":195296268,"name":"tformcontacts.aselectall.caption","sourcebytes":[83,101,108,101,99,116,32,97,108,108],"value":"Select all"}, 13 {"hash":4863557,"name":"tformcontacts.aclone.caption","sourcebytes":[67,108,111,110,101],"value":"Clone"} 13 {"hash":4863557,"name":"tformcontacts.aclone.caption","sourcebytes":[67,108,111,110,101],"value":"Clone"}, 14 {"hash":177113358,"name":"tformcontacts.aloadfromfile.caption","sourcebytes":[76,111,97,100,32,102,114,111,109,32,102,105,108,101,46,46,46],"value":"Load from file..."}, 15 {"hash":10127854,"name":"tformcontacts.asavetofile.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101,46,46,46],"value":"Save to file..."} 14 16 ]} -
trunk/Forms/UFormContacts.pas
r52 r53 16 16 AAdd: TAction; 17 17 AClone: TAction; 18 ALoadFromFile: TAction; 19 ASaveToFile: 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 PopupMenuContact: 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 ALoadFromFileExecute(Sender: TObject); 39 50 procedure AModifyExecute(Sender: TObject); 40 51 procedure ARemoveExecute(Sender: TObject); 52 procedure ASaveToFileExecute(Sender: TObject); 41 53 procedure ASelectAllExecute(Sender: TObject); 42 54 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 314 326 end; 315 327 328 procedure TFormContacts.ALoadFromFileExecute(Sender: TObject); 329 var 330 TempFile: TContactsFile; 331 begin 332 if Assigned(ListView1.Selected) then begin 333 TempFile := TContactsFile.Create; 334 try 335 OpenDialog1.Filter := TempFile.GetFileFilter; 336 OpenDialog1.DefaultExt := TempFile.GetFileExt; 337 finally 338 TempFile.Free; 339 end; 340 OpenDialog1.InitialDir := ExtractFileDir(Core.LastContactFileName); 341 OpenDialog1.FileName := ExtractFileName(Core.LastContactFileName); 342 if OpenDialog1.Execute then begin 343 TContact(ListView1.Selected.Data).LoadFromFile(OpenDialog1.FileName); 344 Core.LastContactFileName := OpenDialog1.FileName; 345 ReloadList; 346 end; 347 end; 348 end; 349 316 350 procedure TFormContacts.AModifyExecute(Sender: TObject); 317 351 var … … 359 393 end; 360 394 395 procedure TFormContacts.ASaveToFileExecute(Sender: TObject); 396 var 397 TempFile: TContactsFile; 398 begin 399 if Assigned(ListView1.Selected) then begin 400 TempFile := TContactsFile.Create; 401 try 402 SaveDialog1.Filter := TempFile.GetFileFilter; 403 SaveDialog1.DefaultExt := TempFile.GetFileExt; 404 finally 405 TempFile.Free; 406 end; 407 SaveDialog1.InitialDir := ExtractFileDir(Core.LastContactFileName); 408 SaveDialog1.FileName := TContact(ListView1.Selected.Data).Fields[cfFullName] + 409 VCardFileExt; 410 if SaveDialog1.Execute then begin 411 TContact(ListView1.Selected.Data).SaveToFile(SaveDialog1.FileName); 412 Core.LastContactFileName := SaveDialog1.FileName; 413 end; 414 end; 415 end; 416 361 417 procedure TFormContacts.ASelectAllExecute(Sender: TObject); 362 418 var … … 409 465 begin 410 466 if FUpdateCount = 0 then DoUpdateInterface; 467 ALoadFromFile.Enabled := Assigned(ListView1.Selected); 468 ASaveToFile.Enabled := Assigned(ListView1.Selected); 469 AModify.Enabled := Assigned(ListView1.Selected); 470 AClone.Enabled := Assigned(ListView1.Selected); 471 ARemove.Enabled := Assigned(ListView1.Selected); 472 ASelectAll.Enabled := ListView1.Items.Count > 0; 411 473 end; 412 474
Note:
See TracChangeset
for help on using the changeset viewer.