- Timestamp:
- Dec 8, 2021, 4:44:21 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormProperty.lfm
r39 r56 1 1 object FormProperty: TFormProperty 2 2 Left = 760 3 Height = 5254 Top = 4695 Width = 8023 Height = 418 4 Top = 576 5 Width = 726 6 6 Caption = 'Field' 7 ClientHeight = 5258 ClientWidth = 8027 ClientHeight = 418 8 ClientWidth = 726 9 9 DesignTimePPI = 144 10 10 OnClose = FormClose … … 13 13 LCLVersion = '2.0.12.0' 14 14 object ButtonOk: TButton 15 Left = 53615 Left = 460 16 16 Height = 37 17 Top = 47217 Top = 365 18 18 Width = 119 19 19 Anchors = [akRight, akBottom] … … 25 25 end 26 26 object ButtonCancel: TButton 27 Left = 67227 Left = 596 28 28 Height = 37 29 Top = 47229 Top = 365 30 30 Width = 115 31 31 Anchors = [akRight, akBottom] … … 38 38 Left = 24 39 39 Height = 24 40 Top = 2040 Top = 80 41 41 Width = 56 42 42 Caption = 'Name:' … … 44 44 end 45 45 object EditName: TEdit 46 Left = 16 646 Left = 168 47 47 Height = 42 48 Top = 20 49 Width = 322 48 Top = 72 49 Width = 532 50 Anchors = [akTop, akLeft, akRight] 51 OnChange = EditNameChange 50 52 TabOrder = 2 51 53 end … … 53 55 Left = 24 54 56 Height = 24 55 Top = 7257 Top = 128 56 58 Width = 88 57 59 Caption = 'Attributes:' … … 59 61 end 60 62 object EditAttributes: TEdit 61 Left = 16 663 Left = 168 62 64 Height = 42 63 Top = 72 64 Width = 322 65 Top = 124 66 Width = 532 67 Anchors = [akTop, akLeft, akRight] 68 OnChange = EditAttributesChange 65 69 TabOrder = 3 66 70 end … … 68 72 Left = 24 69 73 Height = 24 70 Top = 1 2874 Top = 180 71 75 Width = 60 72 76 Caption = 'Values:' … … 74 78 end 75 79 object EditValues: TEdit 76 Left = 16 680 Left = 168 77 81 Height = 42 78 Top = 120 79 Width = 322 82 Top = 172 83 Width = 532 84 Anchors = [akTop, akLeft, akRight] 80 85 TabOrder = 4 81 86 end 87 object Label4: TLabel 88 Left = 24 89 Height = 24 90 Top = 32 91 Width = 45 92 Caption = 'Field:' 93 ParentColor = False 94 end 95 object ComboBoxField: TComboBox 96 Left = 168 97 Height = 42 98 Top = 24 99 Width = 532 100 Anchors = [akTop, akLeft, akRight] 101 ItemHeight = 0 102 OnChange = ComboBoxFieldChange 103 Style = csDropDownList 104 TabOrder = 5 105 end 82 106 end -
trunk/Forms/UFormProperty.lrj
r39 r56 5 5 {"hash":5538698,"name":"tformproperty.label1.caption","sourcebytes":[78,97,109,101,58],"value":"Name:"}, 6 6 {"hash":265557994,"name":"tformproperty.label2.caption","sourcebytes":[65,116,116,114,105,98,117,116,101,115,58],"value":"Attributes:"}, 7 {"hash":209959994,"name":"tformproperty.label3.caption","sourcebytes":[86,97,108,117,101,115,58],"value":"Values:"} 7 {"hash":209959994,"name":"tformproperty.label3.caption","sourcebytes":[86,97,108,117,101,115,58],"value":"Values:"}, 8 {"hash":80724602,"name":"tformproperty.label4.caption","sourcebytes":[70,105,101,108,100,58],"value":"Field:"} 8 9 ]} -
trunk/Forms/UFormProperty.pas
r42 r56 15 15 ButtonCancel: TButton; 16 16 ButtonOk: TButton; 17 ComboBoxField: TComboBox; 17 18 EditName: TEdit; 18 19 EditAttributes: TEdit; … … 21 22 Label2: TLabel; 22 23 Label3: TLabel; 24 Label4: TLabel; 23 25 procedure ButtonOkClick(Sender: TObject); 26 procedure ComboBoxFieldChange(Sender: TObject); 27 procedure EditAttributesChange(Sender: TObject); 28 procedure EditNameChange(Sender: TObject); 24 29 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 25 30 procedure FormCreate(Sender: TObject); … … 27 32 private 28 33 FContactProperty: TContactProperty; 34 procedure UpdateField; 29 35 procedure SetContactProperty(AValue: TContactProperty); 30 36 procedure LoadData; … … 51 57 end; 52 58 59 procedure TFormProperty.ComboBoxFieldChange(Sender: TObject); 60 var 61 Field: TContactField; 62 Attributes: TStringList; 63 I: Integer; 64 begin 65 if ComboBoxField.ItemIndex <> -1 then begin 66 Field := TContactsFile(Core.DataFile).Fields[ComboBoxField.ItemIndex]; 67 if Assigned(Field) then begin 68 EditName.Text := Field.SysName; 69 Attributes := TStringList.Create; 70 try 71 Attributes.NameValueSeparator := '='; 72 Attributes.Delimiter := ';'; 73 Attributes.StrictDelimiter := True; 74 for I := 0 to Length(Field.Groups) - 1 do 75 Attributes.Add(Field.Groups[I]); 76 EditAttributes.Text := Attributes.DelimitedText; 77 finally 78 Attributes.Free; 79 end; 80 end; 81 end; 82 end; 83 84 procedure TFormProperty.EditAttributesChange(Sender: TObject); 85 begin 86 UpdateField; 87 end; 88 89 procedure TFormProperty.EditNameChange(Sender: TObject); 90 begin 91 UpdateField; 92 end; 93 53 94 procedure TFormProperty.FormClose(Sender: TObject; var CloseAction: TCloseAction); 54 95 begin … … 61 102 Core.ThemeManager1.UseTheme(Self); 62 103 FContactProperty := nil; 104 TContactsFile(Core.DataFile).Fields.LoadToStrings(ComboBoxField.Items); 63 105 end; 64 106 … … 66 108 begin 67 109 Core.PersistentForm1.Load(Self); 110 end; 111 112 procedure TFormProperty.UpdateField; 113 var 114 Field: TContactField; 115 Groups: TStringList; 116 GroupsArray: TStringArray; 117 I: Integer; 118 begin 119 Groups := TStringList.Create; 120 try 121 Groups.NameValueSeparator := '='; 122 Groups.Delimiter := ';'; 123 Groups.StrictDelimiter := True; 124 Groups.DelimitedText := EditAttributes.Text; 125 SetLength(GroupsArray, Groups.Count); 126 for I := 0 to Groups.Count - 1 do 127 GroupsArray[I] := Groups[I]; 128 finally 129 Groups.Free; 130 end; 131 Field := TContactsFile(Core.DataFile).Fields.GetBySysNameGroups(EditName.Text, 132 GroupsArray); 133 if Assigned(Field) then 134 ComboBoxField.ItemIndex := TContactsFile(Core.DataFile).Fields.IndexOf(Field); 68 135 end; 69 136 -
trunk/Languages/vCardStudio.cs.po
r55 r56 572 572 msgstr "Hodnoty:" 573 573 574 #: tformproperty.label4.caption 575 msgid "Field:" 576 msgstr "Pole:" 577 574 578 #: tformsettings.buttoncancel.caption 575 579 msgctxt "tformsettings.buttoncancel.caption" … … 832 836 #: ucontact.sworkaddresspostofficebox 833 837 msgid "Work address post office box" 834 msgstr "Pracovní adresa číslo sch árnky"838 msgstr "Pracovní adresa číslo schránky" 835 839 836 840 #: ucontact.sworkaddressregion -
trunk/Languages/vCardStudio.po
r55 r56 560 560 msgstr "" 561 561 562 #: tformproperty.label4.caption 563 msgid "Field:" 564 msgstr "" 565 562 566 #: tformsettings.buttoncancel.caption 563 567 msgctxt "tformsettings.buttoncancel.caption" -
trunk/UContact.pas
r55 r56 30 30 cfVersion, cfAnniversary); 31 31 32 { TContactField } 33 32 34 TContactField = class 33 35 SysName: string; … … 38 40 ValueIndex: Integer; 39 41 DataType: TDataType; 42 function GroupsContain(Name: string): Boolean; 43 function Match(ASysName: string; AGroups: TStringArray): Boolean; 40 44 end; 41 45 … … 46 50 Title: string; Index: TContactFieldIndex; DataType: 47 51 TDataType; ValueIndex: Integer = -1): TContactField; 52 function GetBySysName(SysName: string): TContactField; 53 function GetBySysNameGroups(SysName: string; Groups: TStringArray): TContactField; 48 54 function GetByIndex(Index: TContactFieldIndex): TContactField; 49 55 procedure LoadToStrings(AItems: TStrings); … … 238 244 end; 239 245 246 { TContactField } 247 248 function TContactField.GroupsContain(Name: string): Boolean; 249 var 250 I: Integer; 251 begin 252 Result := False; 253 for I := 0 to Length(Groups) - 1 do 254 if Groups[I] = Name then begin 255 Result := True; 256 Break; 257 end; 258 end; 259 260 function TContactField.Match(ASysName: string; AGroups: TStringArray): Boolean; 261 var 262 I: Integer; 263 begin 264 Result := ASysName = SysName; 265 if Result then begin 266 for I := 0 to Length(AGroups) - 1 do begin 267 if not GroupsContain(AGroups[I]) then begin 268 Result := False; 269 Break; 270 end; 271 end; 272 end; 273 end; 274 240 275 { TContactProperties } 241 276 … … 491 526 Result.DataType := DataType; 492 527 Add(Result); 528 end; 529 530 function TContactFields.GetBySysName(SysName: string): TContactField; 531 var 532 I: Integer; 533 C: Integer; 534 begin 535 C := Count; 536 I := 0; 537 while (I < Count) and (Items[I].SysName <> SysName) do Inc(I); 538 if I < Count then Result := Items[I] 539 else Result := nil; 540 end; 541 542 function TContactFields.GetBySysNameGroups(SysName: string; Groups: TStringArray 543 ): TContactField; 544 var 545 I: Integer; 546 C: Integer; 547 begin 548 C := Count; 549 I := 0; 550 while (I < Count) and not Items[I].Match(SysName, Groups) do Inc(I); 551 if I < Count then Result := Items[I] 552 else Result := nil; 493 553 end; 494 554 -
trunk/UCore.pas
r53 r56 356 356 if Assigned(DataFile) then FreeAndNil(DataFile); 357 357 FileClosed := True; 358 UpdateFile; 358 359 end; 359 360 end;
Note:
See TracChangeset
for help on using the changeset viewer.