Ignore:
Timestamp:
Feb 14, 2022, 6:06:33 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Edit name details in separate window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.pas

    r109 r110  
    2121    APhotoLoad: TAction;
    2222    ActionList1: TActionList;
     23    ButtonCancel: TButton;
    2324    ButtonHomeAddressShow: TButton;
    24     ButtonCancel: TButton;
    25     ButtonWorkAddressShow: TButton;
     25    ButtonNameDetails: TButton;
    2626    ButtonNext: TButton;
    2727    ButtonOk: TButton;
    2828    ButtonPrevious: TButton;
     29    ButtonWorkAddressShow: TButton;
    2930    CalendarDialog1: TCalendarDialog;
    3031    EditAim: TEdit;
     32    EditAniversary: TEdit;
     33    EditBirthday: TEdit;
    3134    EditCategories: TEdit;
    32     EditMatrix: TEdit;
     35    EditDepartment: TEdit;
     36    EditEmail: TEdit;
     37    EditFacebook: TEdit;
     38    EditFax: TEdit;
     39    EditFullName: TEdit;
    3340    EditGaduGadu: TEdit;
     41    EditGender: TEdit;
     42    EditGoogleTalk: TEdit;
    3443    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;
    5144    EditHomeAddressCity: TEdit;
    5245    EditHomeAddressCountry: TEdit;
     
    5649    EditHomeAddressStreet: TEdit;
    5750    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;
    5880    EditWorkAddressCity: TEdit;
    5981    EditWorkAddressCountry: TEdit;
     
    6385    EditWorkAddressStreet: TEdit;
    6486    EditWorkAddressStreetExtended: TEdit;
    65     EditAniversary: TEdit;
    66     EditJabber: TEdit;
    67     EditIcq: TEdit;
    6887    EditWorkEmail: TEdit;
    69     EditPager: TEdit;
    70     EditFax: TEdit;
    71     EditWeb: TEdit;
    72     EditHomeFax: TEdit;
    7388    EditWorkFax: TEdit;
    74     EditHomeMobile: TEdit;
    7589    EditWorkMobile: TEdit;
    7690    EditWorkPager: TEdit;
    77     EditHomePhone: TEdit;
    78     EditNickName: TEdit;
    79     EditHomePager: TEdit;
    80     EditHomeEmail: TEdit;
    81     EditHomeWeb: TEdit;
     91    EditWorkPhone: TEdit;
    8292    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;
    9995    GroupBox1: TGroupBox;
    10096    GroupBox2: TGroupBox;
    10197    ImagePhoto: TImage;
    102     Label1: TLabel;
    10398    Label10: TLabel;
    10499    Label11: TLabel;
     
    117112    Label23: TLabel;
    118113    Label24: TLabel;
    119     Label25: TLabel;
    120     Label26: TLabel;
    121     Label27: TLabel;
    122114    Label28: TLabel;
    123115    Label29: TLabel;
     
    144136    Label48: TLabel;
    145137    Label49: TLabel;
    146     Label5: TLabel;
    147138    Label50: TLabel;
    148139    Label51: TLabel;
     
    180171    PopupMenuPhoto: TPopupMenu;
    181172    SavePictureDialog1: TSavePictureDialog;
     173    SpeedButtonAniversary: TSpeedButton;
    182174    SpeedButtonBirthDay: TSpeedButton;
    183     SpeedButtonAniversary: TSpeedButton;
     175    SpeedButtonEmail: TSpeedButton;
    184176    SpeedButtonHomeEmail: TSpeedButton;
    185     SpeedButtonEmail: TSpeedButton;
     177    SpeedButtonHomeWeb: TSpeedButton;
     178    SpeedButtonWeb: TSpeedButton;
    186179    SpeedButtonWorkEmail: TSpeedButton;
    187180    SpeedButtonWorkWeb: TSpeedButton;
    188     SpeedButtonWeb: TSpeedButton;
    189     SpeedButtonHomeWeb: TSpeedButton;
     181    TabSheetAll: TTabSheet;
     182    TabSheetChat: TTabSheet;
     183    TabSheetGeneral: TTabSheet;
     184    TabSheetHome: TTabSheet;
     185    TabSheetOthers: TTabSheet;
    190186    TabSheetSocial: TTabSheet;
    191     TabSheetChat: TTabSheet;
    192     TabSheetOthers: TTabSheet;
    193     TabSheetHome: TTabSheet;
    194187    TabSheetWork: TTabSheet;
    195     TabSheetGeneral: TTabSheet;
    196     TabSheetAll: TTabSheet;
    197188    procedure APhotoClearExecute(Sender: TObject);
    198189    procedure APhotoLoadExecute(Sender: TObject);
     
    201192    procedure APhotoShowExecute(Sender: TObject);
    202193    procedure ButtonHomeAddressShowClick(Sender: TObject);
     194    procedure ButtonNameDetailsClick(Sender: TObject);
    203195    procedure ButtonNextClick(Sender: TObject);
    204196    procedure ButtonPreviousClick(Sender: TObject);
    205197    procedure ButtonWorkAddressShowClick(Sender: TObject);
    206198    procedure EditFullNameChange(Sender: TObject);
    207     procedure NamePartChange(Sender: TObject);
    208199    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    209200    procedure FormCreate(Sender: TObject);
     
    258249
    259250uses
    260   UCore, UCommon, UFormImage;
     251  UCore, UCommon, UFormImage, UFormNameDetails;
    261252
    262253resourcestring
     
    280271    else
    281272      Result := Result + Text[I];
     273  end;
     274end;
     275
     276procedure UpdateEditNoOnChange(Edit: TEdit; Text: string);
     277var
     278  LastHandler: TNotifyEvent;
     279begin
     280  LastHandler := Edit.OnChange;
     281  Edit.OnChange := nil;
     282  try
     283    Edit.Text := Text;
     284  finally
     285    Edit.OnChange := LastHandler;
    282286  end;
    283287end;
     
    441445begin
    442446  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;
    448447  Contact.Fields[cfNickName] := EditNickName.Text;
    449448  Contact.Fields[cfEmail] := EditEmail.Text;
     
    467466begin
    468467  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];
    474468  EditNickName.Text := Contact.Fields[cfNickName];
    475469  EditEmail.Text := Contact.Fields[cfEmail];
     
    701695end;
    702696
     697procedure TFormContact.ButtonNameDetailsClick(Sender: TObject);
     698begin
     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;
     727end;
     728
    703729procedure TFormContact.ButtonPreviousClick(Sender: TObject);
    704730begin
     
    721747end;
    722748
    723 procedure UpdateEditNoOnChange(Edit: TEdit; Text: string);
    724 var
    725   LastHandler: TNotifyEvent;
    726 begin
    727   LastHandler := Edit.OnChange;
    728   Edit.OnChange := nil;
    729   try
    730     Edit.Text := Text;
    731   finally
    732     Edit.OnChange := LastHandler;
    733   end;
    734 end;
    735 
    736749procedure TFormContact.EditFullNameChange(Sender: TObject);
    737750begin
    738751  with TNameDetails.Create do
    739752  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];
    745758    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;
    751764    UpdateInterface;
    752   finally
    753     Free;
    754   end;
    755 end;
    756 
    757 procedure TFormContact.NamePartChange(Sender: TObject);
    758 begin
    759   with TNameDetails.Create do
    760   try
    761     Prefix := EditTitleBefore.Text;
    762     First := EditFirstName.Text;
    763     Middle := EditMiddleName.Text;
    764     Last := EditLastName.Text;
    765     Suffix := EditTitleAfter.Text;
    766     UpdateEditNoOnChange(EditFullName, GetCombined);
    767765  finally
    768766    Free;
Note: See TracChangeset for help on using the changeset viewer.