Changeset 110 for trunk/Forms/UFormContact.pas
- Timestamp:
- Feb 14, 2022, 6:06:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContact.pas
r109 r110 21 21 APhotoLoad: TAction; 22 22 ActionList1: TActionList; 23 ButtonCancel: TButton; 23 24 ButtonHomeAddressShow: TButton; 24 ButtonCancel: TButton; 25 ButtonWorkAddressShow: TButton; 25 ButtonNameDetails: TButton; 26 26 ButtonNext: TButton; 27 27 ButtonOk: TButton; 28 28 ButtonPrevious: TButton; 29 ButtonWorkAddressShow: TButton; 29 30 CalendarDialog1: TCalendarDialog; 30 31 EditAim: TEdit; 32 EditAniversary: TEdit; 33 EditBirthday: TEdit; 31 34 EditCategories: TEdit; 32 EditMatrix: TEdit; 35 EditDepartment: TEdit; 36 EditEmail: TEdit; 37 EditFacebook: TEdit; 38 EditFax: TEdit; 39 EditFullName: TEdit; 33 40 EditGaduGadu: TEdit; 41 EditGender: TEdit; 42 EditGoogleTalk: TEdit; 34 43 EditGroupWise: TEdit; 35 EditYouTube: TEdit;36 EditGender: TEdit;37 EditLinkedIn: TEdit;38 EditFacebook: TEdit;39 EditInstagram: TEdit;40 EditMySpace: TEdit;41 EditTwitter: TEdit;42 EditReddit: TEdit;43 EditMastodon: TEdit;44 EditWindowsLive: TEdit;45 EditSnapchat: TEdit;46 EditYahoo: TEdit;47 EditGoogleTalk: TEdit;48 EditMsn: TEdit;49 EditIrc: TEdit;50 EditSkype: TEdit;51 44 EditHomeAddressCity: TEdit; 52 45 EditHomeAddressCountry: TEdit; … … 56 49 EditHomeAddressStreet: TEdit; 57 50 EditHomeAddressStreetExtended: TEdit; 51 EditHomeEmail: TEdit; 52 EditHomeFax: TEdit; 53 EditHomeMobile: TEdit; 54 EditHomePager: TEdit; 55 EditHomePhone: TEdit; 56 EditHomeWeb: TEdit; 57 EditIcq: TEdit; 58 EditInstagram: TEdit; 59 EditIrc: TEdit; 60 EditJabber: TEdit; 61 EditLinkedIn: TEdit; 62 EditMastodon: TEdit; 63 EditMatrix: TEdit; 64 EditMobile: TEdit; 65 EditMsn: TEdit; 66 EditMySpace: TEdit; 67 EditNickName: TEdit; 68 EditOrganization: TEdit; 69 EditPager: TEdit; 70 EditPeerTube: TEdit; 71 EditPhone: TEdit; 72 EditQq: TEdit; 73 EditReddit: TEdit; 74 EditSkype: TEdit; 75 EditSnapchat: TEdit; 76 EditTitle: TEdit; 77 EditTwitter: TEdit; 78 EditWeb: TEdit; 79 EditWindowsLive: TEdit; 58 80 EditWorkAddressCity: TEdit; 59 81 EditWorkAddressCountry: TEdit; … … 63 85 EditWorkAddressStreet: TEdit; 64 86 EditWorkAddressStreetExtended: TEdit; 65 EditAniversary: TEdit;66 EditJabber: TEdit;67 EditIcq: TEdit;68 87 EditWorkEmail: TEdit; 69 EditPager: TEdit;70 EditFax: TEdit;71 EditWeb: TEdit;72 EditHomeFax: TEdit;73 88 EditWorkFax: TEdit; 74 EditHomeMobile: TEdit;75 89 EditWorkMobile: TEdit; 76 90 EditWorkPager: TEdit; 77 EditHomePhone: TEdit; 78 EditNickName: TEdit; 79 EditHomePager: TEdit; 80 EditHomeEmail: TEdit; 81 EditHomeWeb: TEdit; 91 EditWorkPhone: TEdit; 82 92 EditWorkWeb: TEdit; 83 EditDepartment: TEdit; 84 EditFullName: TEdit; 85 EditOrganization: TEdit; 86 EditTitle: TEdit; 87 EditTitleBefore: TEdit; 88 EditMiddleName: TEdit; 89 EditTitleAfter: TEdit; 90 EditBirthday: TEdit; 91 EditLastName: TEdit; 92 EditEmail: TEdit; 93 EditPhone: TEdit; 94 EditFirstName: TEdit; 95 EditMobile: TEdit; 96 EditWorkPhone: TEdit; 97 EditQq: TEdit; 98 EditPeerTube: TEdit; 93 EditYahoo: TEdit; 94 EditYouTube: TEdit; 99 95 GroupBox1: TGroupBox; 100 96 GroupBox2: TGroupBox; 101 97 ImagePhoto: TImage; 102 Label1: TLabel;103 98 Label10: TLabel; 104 99 Label11: TLabel; … … 117 112 Label23: TLabel; 118 113 Label24: TLabel; 119 Label25: TLabel;120 Label26: TLabel;121 Label27: TLabel;122 114 Label28: TLabel; 123 115 Label29: TLabel; … … 144 136 Label48: TLabel; 145 137 Label49: TLabel; 146 Label5: TLabel;147 138 Label50: TLabel; 148 139 Label51: TLabel; … … 180 171 PopupMenuPhoto: TPopupMenu; 181 172 SavePictureDialog1: TSavePictureDialog; 173 SpeedButtonAniversary: TSpeedButton; 182 174 SpeedButtonBirthDay: TSpeedButton; 183 SpeedButton Aniversary: TSpeedButton;175 SpeedButtonEmail: TSpeedButton; 184 176 SpeedButtonHomeEmail: TSpeedButton; 185 SpeedButtonEmail: TSpeedButton; 177 SpeedButtonHomeWeb: TSpeedButton; 178 SpeedButtonWeb: TSpeedButton; 186 179 SpeedButtonWorkEmail: TSpeedButton; 187 180 SpeedButtonWorkWeb: TSpeedButton; 188 SpeedButtonWeb: TSpeedButton; 189 SpeedButtonHomeWeb: TSpeedButton; 181 TabSheetAll: TTabSheet; 182 TabSheetChat: TTabSheet; 183 TabSheetGeneral: TTabSheet; 184 TabSheetHome: TTabSheet; 185 TabSheetOthers: TTabSheet; 190 186 TabSheetSocial: TTabSheet; 191 TabSheetChat: TTabSheet;192 TabSheetOthers: TTabSheet;193 TabSheetHome: TTabSheet;194 187 TabSheetWork: TTabSheet; 195 TabSheetGeneral: TTabSheet;196 TabSheetAll: TTabSheet;197 188 procedure APhotoClearExecute(Sender: TObject); 198 189 procedure APhotoLoadExecute(Sender: TObject); … … 201 192 procedure APhotoShowExecute(Sender: TObject); 202 193 procedure ButtonHomeAddressShowClick(Sender: TObject); 194 procedure ButtonNameDetailsClick(Sender: TObject); 203 195 procedure ButtonNextClick(Sender: TObject); 204 196 procedure ButtonPreviousClick(Sender: TObject); 205 197 procedure ButtonWorkAddressShowClick(Sender: TObject); 206 198 procedure EditFullNameChange(Sender: TObject); 207 procedure NamePartChange(Sender: TObject);208 199 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 209 200 procedure FormCreate(Sender: TObject); … … 258 249 259 250 uses 260 UCore, UCommon, UFormImage ;251 UCore, UCommon, UFormImage, UFormNameDetails; 261 252 262 253 resourcestring … … 280 271 else 281 272 Result := Result + Text[I]; 273 end; 274 end; 275 276 procedure UpdateEditNoOnChange(Edit: TEdit; Text: string); 277 var 278 LastHandler: TNotifyEvent; 279 begin 280 LastHandler := Edit.OnChange; 281 Edit.OnChange := nil; 282 try 283 Edit.Text := Text; 284 finally 285 Edit.OnChange := LastHandler; 282 286 end; 283 287 end; … … 441 445 begin 442 446 Contact.Fields[cfFullName] := EditFullName.Text; 443 Contact.Fields[cfMiddleName] := EditMiddleName.Text;444 Contact.Fields[cfFirstName] := EditFirstName.Text;445 Contact.Fields[cfLastName] := EditLastName.Text;446 Contact.Fields[cfTitleAfter] := EditTitleAfter.Text;447 Contact.Fields[cfTitleBefore] := EditTitleBefore.Text;448 447 Contact.Fields[cfNickName] := EditNickName.Text; 449 448 Contact.Fields[cfEmail] := EditEmail.Text; … … 467 466 begin 468 467 EditFullName.Text := Contact.Fields[cfFullName]; 469 EditFirstName.Text := Contact.Fields[cfFirstName];470 EditLastName.Text := Contact.Fields[cfLastName];471 EditMiddleName.Text := Contact.Fields[cfMiddleName];472 EditTitleAfter.Text := Contact.Fields[cfTitleAfter];473 EditTitleBefore.Text := Contact.Fields[cfTitleBefore];474 468 EditNickName.Text := Contact.Fields[cfNickName]; 475 469 EditEmail.Text := Contact.Fields[cfEmail]; … … 701 695 end; 702 696 697 procedure TFormContact.ButtonNameDetailsClick(Sender: TObject); 698 begin 699 with TFormNameDetails.Create(nil) do 700 try 701 EditFirstName.Text := Contact.Fields[cfFirstName]; 702 EditLastName.Text := Contact.Fields[cfLastName]; 703 EditMiddleName.Text := Contact.Fields[cfMiddleName]; 704 EditTitleAfter.Text := Contact.Fields[cfTitleAfter]; 705 EditTitleBefore.Text := Contact.Fields[cfTitleBefore]; 706 if ShowModal = mrOk then begin 707 Contact.Fields[cfMiddleName] := EditMiddleName.Text; 708 Contact.Fields[cfFirstName] := EditFirstName.Text; 709 Contact.Fields[cfLastName] := EditLastName.Text; 710 Contact.Fields[cfTitleAfter] := EditTitleAfter.Text; 711 Contact.Fields[cfTitleBefore] := EditTitleBefore.Text; 712 with TNameDetails.Create do 713 try 714 Prefix := EditTitleBefore.Text; 715 First := EditFirstName.Text; 716 Middle := EditMiddleName.Text; 717 Last := EditLastName.Text; 718 Suffix := EditTitleAfter.Text; 719 UpdateEditNoOnChange(EditFullName, GetCombined); 720 finally 721 Free; 722 end; 723 end; 724 finally 725 Free; 726 end; 727 end; 728 703 729 procedure TFormContact.ButtonPreviousClick(Sender: TObject); 704 730 begin … … 721 747 end; 722 748 723 procedure UpdateEditNoOnChange(Edit: TEdit; Text: string);724 var725 LastHandler: TNotifyEvent;726 begin727 LastHandler := Edit.OnChange;728 Edit.OnChange := nil;729 try730 Edit.Text := Text;731 finally732 Edit.OnChange := LastHandler;733 end;734 end;735 736 749 procedure TFormContact.EditFullNameChange(Sender: TObject); 737 750 begin 738 751 with TNameDetails.Create do 739 752 try 740 Prefix := EditTitleBefore.Text;741 First := EditFirstName.Text;742 Middle := EditMiddleName.Text;743 Last := EditLastName.Text;744 Suffix := EditTitleAfter.Text;753 Prefix := Contact.Fields[cfTitleBefore]; 754 First := Contact.Fields[cfFirstName]; 755 Middle := Contact.Fields[cfMiddleName]; 756 Last := Contact.Fields[cfLastName]; 757 Suffix := Contact.Fields[cfTitleAfter]; 745 758 Split(EditFullName.Text); 746 UpdateEditNoOnChange(EditTitleBefore, Prefix);747 UpdateEditNoOnChange(EditFirstName, First);748 UpdateEditNoOnChange(EditMiddleName, Middle);749 UpdateEditNoOnChange(EditLastName, Last);750 UpdateEditNoOnChange(EditTitleAfter, Suffix);759 Contact.Fields[cfTitleBefore] := Prefix; 760 Contact.Fields[cfFirstName] := First; 761 Contact.Fields[cfMiddleName] := Middle; 762 Contact.Fields[cfLastName] := Last; 763 Contact.Fields[cfTitleAfter] := Suffix; 751 764 UpdateInterface; 752 finally753 Free;754 end;755 end;756 757 procedure TFormContact.NamePartChange(Sender: TObject);758 begin759 with TNameDetails.Create do760 try761 Prefix := EditTitleBefore.Text;762 First := EditFirstName.Text;763 Middle := EditMiddleName.Text;764 Last := EditLastName.Text;765 Suffix := EditTitleAfter.Text;766 UpdateEditNoOnChange(EditFullName, GetCombined);767 765 finally 768 766 Free;
Note:
See TracChangeset
for help on using the changeset viewer.