Changeset 101 for trunk/Forms/UFormContact.pas
- Timestamp:
- Feb 8, 2022, 6:07:35 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContact.pas
r100 r101 19 19 APhotoLoad: TAction; 20 20 ActionList1: TActionList; 21 ButtonHomeAddressShow: TButton; 21 22 ButtonCancel: TButton; 23 ButtonWorkAddressShow: TButton; 22 24 ButtonNext: TButton; 23 25 ButtonOk: TButton; … … 52 54 EditHomeAddressStreet: TEdit; 53 55 EditHomeAddressStreetExtended: TEdit; 54 Edit AddressWorkCity: TEdit;55 Edit AddressWorkCountry: TEdit;56 Edit AddressWorkPostalCode: TEdit;57 Edit AddressWorkPostOfficeBox: TEdit;58 Edit AddressWorkRegion: TEdit;59 Edit AddressWorkStreet: TEdit;60 Edit AddressWorkStreetExtended: TEdit;56 EditWorkAddressCity: TEdit; 57 EditWorkAddressCountry: TEdit; 58 EditWorkAddressPostalCode: TEdit; 59 EditWorkAddressPostOfficeBox: TEdit; 60 EditWorkAddressRegion: TEdit; 61 EditWorkAddressStreet: TEdit; 62 EditWorkAddressStreetExtended: TEdit; 61 63 EditAniversary: TEdit; 62 64 EditJabber: TEdit; … … 192 194 procedure APhotoLoadExecute(Sender: TObject); 193 195 procedure APhotoSaveExecute(Sender: TObject); 196 procedure ButtonHomeAddressShowClick(Sender: TObject); 194 197 procedure ButtonNextClick(Sender: TObject); 195 198 procedure ButtonPreviousClick(Sender: TObject); 199 procedure ButtonWorkAddressShowClick(Sender: TObject); 196 200 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 197 201 procedure FormCreate(Sender: TObject); … … 254 258 begin 255 259 Result := FormatDateTime('yyyy-mm-dd', Date); 260 end; 261 262 function URLEncode(Text: string): string; 263 var 264 I: Integer; 265 begin 266 Result := ''; 267 for I := 1 to Length(Text) do begin 268 if not (Text[I] in ['A'..'Z', 'a'..'z', '0'..'9', '-', '_', '~', '.', ':', '/']) then 269 Result := Result + '%' + IntToHex(Ord(Text[I]), 2) 270 else 271 Result := Result + Text[I]; 272 end; 256 273 end; 257 274 … … 677 694 Contact.Fields[cfOrganization] := EditOrganization.Text; 678 695 Contact.Fields[cfDepartment] := EditDepartment.Text; 679 Contact.Fields[cfWorkAddressPostOfficeBox] := Edit AddressWorkPostOfficeBox.Text;680 Contact.Fields[cfWorkAddressStreet] := Edit AddressWorkStreet.Text;681 Contact.Fields[cfWorkAddressStreetExtended] := Edit AddressWorkStreetExtended.Text;682 Contact.Fields[cfWorkAddressCity] := Edit AddressWorkCity.Text;683 Contact.Fields[cfWorkAddressRegion] := Edit AddressWorkRegion.Text;684 Contact.Fields[cfWorkAddressCountry] := Edit AddressWorkCountry.Text;685 Contact.Fields[cfWorkAddressPostalCode] := Edit AddressWorkPostalCode.Text;696 Contact.Fields[cfWorkAddressPostOfficeBox] := EditWorkAddressPostOfficeBox.Text; 697 Contact.Fields[cfWorkAddressStreet] := EditWorkAddressStreet.Text; 698 Contact.Fields[cfWorkAddressStreetExtended] := EditWorkAddressStreetExtended.Text; 699 Contact.Fields[cfWorkAddressCity] := EditWorkAddressCity.Text; 700 Contact.Fields[cfWorkAddressRegion] := EditWorkAddressRegion.Text; 701 Contact.Fields[cfWorkAddressCountry] := EditWorkAddressCountry.Text; 702 Contact.Fields[cfWorkAddressPostalCode] := EditWorkAddressPostalCode.Text; 686 703 Contact.Fields[cfUrlWork] := EditWorkWeb.Text; 687 704 … … 699 716 EditOrganization.Text := Contact.Fields[cfOrganization]; 700 717 EditDepartment.Text := Contact.Fields[cfDepartment]; 701 Edit AddressWorkPostOfficeBox.Text := Contact.Fields[cfWorkAddressPostOfficeBox];702 Edit AddressWorkStreet.Text := Contact.Fields[cfWorkAddressStreet];703 Edit AddressWorkStreetExtended.Text := Contact.Fields[cfWorkAddressStreetExtended];704 Edit AddressWorkCity.Text := Contact.Fields[cfWorkAddressCity];705 Edit AddressWorkRegion.Text := Contact.Fields[cfWorkAddressRegion];706 Edit AddressWorkCountry.Text := Contact.Fields[cfWorkAddressCountry];707 Edit AddressWorkPostalCode.Text := Contact.Fields[cfWorkAddressPostalCode];718 EditWorkAddressPostOfficeBox.Text := Contact.Fields[cfWorkAddressPostOfficeBox]; 719 EditWorkAddressStreet.Text := Contact.Fields[cfWorkAddressStreet]; 720 EditWorkAddressStreetExtended.Text := Contact.Fields[cfWorkAddressStreetExtended]; 721 EditWorkAddressCity.Text := Contact.Fields[cfWorkAddressCity]; 722 EditWorkAddressRegion.Text := Contact.Fields[cfWorkAddressRegion]; 723 EditWorkAddressCountry.Text := Contact.Fields[cfWorkAddressCountry]; 724 EditWorkAddressPostalCode.Text := Contact.Fields[cfWorkAddressPostalCode]; 708 725 EditWorkWeb.Text := Contact.Fields[cfUrlWork]; 709 726 end; … … 771 788 end; 772 789 790 procedure TFormContact.ButtonHomeAddressShowClick(Sender: TObject); 791 var 792 Address: string; 793 begin 794 Address := ''; 795 if EditHomeAddressStreet.Text <> '' then Address := Address + ' ' + EditHomeAddressStreet.Text; 796 if EditHomeAddressStreetExtended.Text <> '' then Address := Address + ' ' + EditHomeAddressStreetExtended.Text; 797 if EditHomeAddressPostOfficeBox.Text <> '' then Address := Address + ' ' + EditHomeAddressPostOfficeBox.Text; 798 if EditHomeAddressCity.Text <> '' then Address := Address + ' ' + EditHomeAddressCity.Text; 799 if EditHomeAddressCountry.Text <> '' then Address := Address + ' ' + EditHomeAddressCountry.Text; 800 OpenURL(Core.MapUrl + URLEncode(Trim(Address))); 801 end; 802 773 803 procedure TFormContact.ButtonPreviousClick(Sender: TObject); 774 804 begin 775 805 if Assigned(FOnGetPrevious) then 776 806 Contact := FOnGetPrevious(Contact); 807 end; 808 809 procedure TFormContact.ButtonWorkAddressShowClick(Sender: TObject); 810 var 811 Address: string; 812 begin 813 Address := ''; 814 if EditWorkAddressStreet.Text <> '' then Address := Address + ' ' + EditWorkAddressStreet.Text; 815 if EditWorkAddressStreetExtended.Text <> '' then Address := Address + ' ' + EditWorkAddressStreetExtended.Text; 816 if EditWorkAddressPostOfficeBox.Text <> '' then Address := Address + ' ' + EditWorkAddressPostOfficeBox.Text; 817 if EditWorkAddressCity.Text <> '' then Address := Address + ' ' + EditWorkAddressCity.Text; 818 if EditWorkAddressCountry.Text <> '' then Address := Address + ' ' + EditWorkAddressCountry.Text; 819 OpenURL(Core.MapUrl + URLEncode(Trim(Address))); 777 820 end; 778 821
Note:
See TracChangeset
for help on using the changeset viewer.