Changeset 39 for trunk/Forms/UFormContact.pas
- Timestamp:
- Nov 29, 2021, 2:17:26 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContact.pas
r38 r39 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, ActnList, Menus, ExtCtrls, UContact, base64 ;9 ComCtrls, ActnList, Menus, ExtCtrls, UContact, base64, UFormProperties; 10 10 11 11 type … … 18 18 ButtonCancel: TButton; 19 19 ButtonOk: TButton; 20 EditAddressHomeCity: TEdit; 21 EditAddressHomeCountry: TEdit; 22 EditAddressHomePostalCode: TEdit; 23 EditAddressHomePostOfficeBox: TEdit; 24 EditAddressHomeRegion: TEdit; 25 EditAddressHomeStreetExtended: TEdit; 26 EditAddressWorkStreet: TEdit; 27 EditAddressWorkCity: TEdit; 28 EditAddressWorkRegion: TEdit; 29 EditAddressWorkCountry: TEdit; 30 EditAddressHomeStreet: TEdit; 31 EditWebWork: TEdit; 32 EditAddressWorkPostalCode: TEdit; 33 EditAddressWorkPostOfficeBox: TEdit; 34 EditAddressWorkStreetExtended: TEdit; 20 35 EditDepartment: TEdit; 21 36 EditFullName: TEdit; 37 EditOrganization: TEdit; 38 EditTitle: TEdit; 22 39 EditTitleBefore: TEdit; 23 40 EditMiddleName: TEdit; 24 41 EditTitleAfter: TEdit; 25 EditWebPage: TEdit;26 EditWebPageHome: TEdit;27 EditWebPageWork: TEdit;28 42 EditEmailHome: TEdit; 29 43 EditEmailWork: TEdit; 30 44 EditBirthday: TEdit; 31 EditTitle: TEdit;32 EditAddress: TEdit;33 EditOrganization: TEdit;34 45 EditPhoneHome: TEdit; 35 46 EditPhoneWork: TEdit; … … 45 56 EditFirstName: TEdit; 46 57 EditCellPhone: TEdit; 58 EditWebHome: TEdit; 47 59 ImagePhoto: TImage; 48 60 Label1: TLabel; … … 52 64 Label13: TLabel; 53 65 Label14: TLabel; 54 Label15: TLabel;55 Label16: TLabel;56 Label17: TLabel;57 66 Label18: TLabel; 58 Label19: TLabel;59 67 Label2: TLabel; 60 68 Label20: TLabel; … … 66 74 Label26: TLabel; 67 75 Label27: TLabel; 68 LabelOrganization: TLabel; 76 Label28: TLabel; 77 Label29: TLabel; 69 78 Label3: TLabel; 79 Label30: TLabel; 80 Label31: TLabel; 81 Label32: TLabel; 82 Label33: TLabel; 83 Label34: TLabel; 84 Label35: TLabel; 85 Label36: TLabel; 86 Label37: TLabel; 87 Label38: TLabel; 88 Label39: TLabel; 70 89 Label4: TLabel; 90 Label40: TLabel; 91 Label41: TLabel; 92 Label42: TLabel; 93 Label43: TLabel; 71 94 Label5: TLabel; 72 95 Label6: TLabel; … … 74 97 Label8: TLabel; 75 98 Label9: TLabel; 99 LabelOrganization: TLabel; 76 100 LabelOrganization1: TLabel; 77 ListView1: TListView;78 101 MemoNotes: TMemo; 79 102 MenuItem1: TMenuItem; 80 103 PageControlContact: TPageControl; 81 104 PopupMenu1: TPopupMenu; 105 TabSheetWork: TTabSheet; 82 106 TabSheetGeneral: TTabSheet; 83 TabSheet Details: TTabSheet;107 TabSheetPrivate: TTabSheet; 84 108 TabSheetAll: TTabSheet; 85 procedure AEditFieldExecute(Sender: TObject);109 procedure ButtonOkClick(Sender: TObject); 86 110 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 87 111 procedure FormCreate(Sender: TObject); 112 procedure FormDestroy(Sender: TObject); 88 113 procedure FormShow(Sender: TObject); 89 114 procedure ListView1Data(Sender: TObject; Item: TListItem); 90 115 procedure TabSheetAllShow(Sender: TObject); 116 procedure TabSheetGeneralShow(Sender: TObject); 91 117 private 92 Contact: TContact; 118 FContact: TContact; 119 FormProperties: TFormProperties; 120 procedure SetContact(AValue: TContact); 93 121 public 94 procedure ReloadFields;95 procedure LoadData(Contact: TContact);96 pro cedure SaveData(Contact: TContact);122 procedure LoadData; 123 procedure SaveData; 124 property Contact: TContact read FContact write SetContact; 97 125 end; 98 126 … … 118 146 Core.PersistentForm1.Load(Self); 119 147 PageControlContact.TabIndex := 0; 148 149 FormProperties.ManualDock(TabSheetAll, nil, alClient); 150 FormProperties.Align := alClient; 151 FormProperties.Show; 120 152 end; 121 153 … … 133 165 procedure TFormContact.TabSheetAllShow(Sender: TObject); 134 166 begin 135 ReloadFields; 136 end; 137 138 procedure TFormContact.ReloadFields; 139 begin 140 if Assigned(Contact) then begin 141 ListView1.Items.Count := Contact.Properties.Count; 142 end else ListView1.Items.Count := 0; 143 ListView1.Refresh; 167 SaveData; 168 FormProperties.ReloadList; 169 FormProperties.UpdateInterface; 170 end; 171 172 procedure TFormContact.TabSheetGeneralShow(Sender: TObject); 173 begin 174 LoadData; 175 end; 176 177 procedure TFormContact.SetContact(AValue: TContact); 178 begin 179 if FContact = AValue then Exit; 180 FContact := AValue; 181 LoadData; 144 182 end; 145 183 … … 150 188 end; 151 189 152 procedure TFormContact.AEditFieldExecute(Sender: TObject); 153 begin 154 if Assigned(ListView1.Selected) then begin 155 TContactProperty(ListView1.Selected.Data).Values.DelimitedText := 156 InputBox(SFieldEdit, SEditFieldValue, TContactProperty(ListView1.Selected.Data).Values.DelimitedText); 157 end; 190 procedure TFormContact.ButtonOkClick(Sender: TObject); 191 begin 192 SaveData; 158 193 end; 159 194 … … 162 197 Core.Translator.TranslateComponentRecursive(Self); 163 198 Core.ThemeManager1.UseTheme(Self); 164 Contact := nil; 165 end; 166 167 procedure TFormContact.LoadData(Contact: TContact); 199 FContact := nil; 200 FormProperties := TFormProperties.Create(nil); 201 end; 202 203 procedure TFormContact.FormDestroy(Sender: TObject); 204 begin 205 FreeAndNil(FormProperties); 206 end; 207 208 procedure TFormContact.LoadData; 168 209 var 169 210 Photo: string; … … 172 213 PhotoProperty: TContactProperty; 173 214 begin 174 Self.Contact := Contact; 215 FormProperties.Properties := Contact.Properties; 216 175 217 EditFullName.Text := Contact.Fields[cfFullName]; 176 218 EditFirstName.Text := Contact.Fields[cfFirstName]; … … 184 226 EditEmail.Text := Contact.Fields[cfEmail]; 185 227 MemoNotes.Lines.Text := Contact.Fields[cfNote]; 228 229 // Work 186 230 EditTitle.Text := Contact.Fields[cfTitle]; 187 231 EditOrganization.Text := Contact.Fields[cfOrganization]; 188 232 EditDepartment.Text := Contact.Fields[cfDepartment]; 189 EditAddress.Text := Contact.Fields[cfHomeAddress]; 233 EditAddressWorkPostOfficeBox.Text := Contact.Fields[cfWorkAddressPostOfficeBox]; 234 EditAddressWorkStreet.Text := Contact.Fields[cfWorkAddressStreet]; 235 EditAddressWorkStreetExtended.Text := Contact.Fields[cfWorkAddressStreetExtended]; 236 EditAddressWorkCity.Text := Contact.Fields[cfWorkAddressCity]; 237 EditAddressWorkRegion.Text := Contact.Fields[cfWorkAddressRegion]; 238 EditAddressWorkCountry.Text := Contact.Fields[cfWorkAddressCountry]; 239 EditAddressWorkPostalCode.Text := Contact.Fields[cfWorkAddressPostalCode]; 240 EditWebHome.Text := Contact.Fields[cfUrlWork]; 241 242 // Private 243 EditAddressHomePostOfficeBox.Text := Contact.Fields[cfHomeAddressPostOfficeBox]; 244 EditAddressHomeStreet.Text := Contact.Fields[cfHomeAddressStreet]; 245 EditAddressHomeStreetExtended.Text := Contact.Fields[cfHomeAddressStreetExtended]; 246 EditAddressHomeCity.Text := Contact.Fields[cfHomeAddressCity]; 247 EditAddressHomeRegion.Text := Contact.Fields[cfHomeAddressRegion]; 248 EditAddressHomeCountry.Text := Contact.Fields[cfHomeAddressCountry]; 249 EditAddressHomePostalCode.Text := Contact.Fields[cfHomeAddressPostalCode]; 250 EditWebHome.Text := Contact.Fields[cfUrlHome]; 251 EditBirthday.Text := Contact.Fields[cfDayOfBirth]; 252 190 253 EditEmailHome.Text := Contact.Fields[cfEmail]; 191 EditWebPage.Text := Contact.Fields[cfUrl];192 EditBirthday.Text := Contact.Fields[cfDayOfBirth];193 194 254 ImagePhoto.Picture.Bitmap.Clear; 195 255 PhotoProperty := Contact.GetProperty(cfPhoto); … … 226 286 end; 227 287 228 procedure TFormContact.SaveData (Contact: TContact);288 procedure TFormContact.SaveData; 229 289 begin 230 290 Contact.Fields[cfFullName] := EditFullName.Text; … … 239 299 Contact.Fields[cfEmail] := EditEmail.Text; 240 300 Contact.Fields[cfNote] := MemoNotes.Lines.Text; 301 Contact.Fields[cfEmail] := EditEmailHome.Text; 302 Contact.Fields[cfDayOfBirth] := EditBirthday.Text; 303 304 // Work 241 305 Contact.Fields[cfTitle] := EditTitle.Text; 242 306 Contact.Fields[cfOrganization] := EditOrganization.Text; 243 307 Contact.Fields[cfDepartment] := EditDepartment.Text; 244 Contact.Fields[cfHomeAddress] := EditAddress.Text; 245 Contact.Fields[cfEmail] := EditEmailHome.Text; 246 Contact.Fields[cfUrl] := EditWebPage.Text; 247 Contact.Fields[cfDayOfBirth] := EditBirthday.Text; 308 Contact.Fields[cfWorkAddressPostOfficeBox] := EditAddressWorkPostOfficeBox.Text; 309 Contact.Fields[cfWorkAddressStreet] := EditAddressWorkStreet.Text; 310 Contact.Fields[cfWorkAddressStreetExtended] := EditAddressWorkStreetExtended.Text; 311 Contact.Fields[cfWorkAddressCity] := EditAddressWorkCity.Text; 312 Contact.Fields[cfWorkAddressRegion] := EditAddressWorkRegion.Text; 313 Contact.Fields[cfWorkAddressCountry] := EditAddressWorkCountry.Text; 314 Contact.Fields[cfWorkAddressPostalCode] := EditAddressWorkPostalCode.Text; 315 Contact.Fields[cfUrlWork] := EditWebWork.Text; 316 317 // Private 318 Contact.Fields[cfHomeAddressPostOfficeBox] := EditAddressHomePostOfficeBox.Text; 319 Contact.Fields[cfHomeAddressStreet] := EditAddressHomeStreet.Text; 320 Contact.Fields[cfHomeAddressStreetExtended] := EditAddressHomeStreetExtended.Text; 321 Contact.Fields[cfHomeAddressCity] := EditAddressHomeCity.Text; 322 Contact.Fields[cfHomeAddressRegion] := EditAddressHomeRegion.Text; 323 Contact.Fields[cfHomeAddressCountry] := EditAddressHomeCountry.Text; 324 Contact.Fields[cfHomeAddressPostalCode] := EditAddressHomePostalCode.Text; 325 Contact.Fields[cfUrlHome] := EditWebHome.Text; 248 326 end; 249 327
Note:
See TracChangeset
for help on using the changeset viewer.