- Timestamp:
- Dec 2, 2021, 12:18:18 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContact.lfm
r40 r42 18 18 Top = 8 19 19 Width = 939 20 ActivePage = TabSheet General20 ActivePage = TabSheetOthers 21 21 Anchors = [akTop, akLeft, akRight, akBottom] 22 22 ParentFont = False 23 TabIndex = 023 TabIndex = 3 24 24 TabOrder = 0 25 25 object TabSheetGeneral: TTabSheet … … 835 835 object MemoNotes: TMemo 836 836 Left = 16 837 Height = 167837 Height = 392 838 838 Top = 48 839 839 Width = 893 -
trunk/Forms/UFormContact.pas
r40 r42 171 171 Item.Caption := Contact.Properties[Item.Index].Name; 172 172 Item.SubItems.Add(Attributes.DelimitedText); 173 Item.SubItems.Add(Contact.Properties[Item.Index].Value s.DelimitedText);173 Item.SubItems.Add(Contact.Properties[Item.Index].Value); 174 174 Item.Data := Contact.Properties[Item.Index]; 175 175 end; -
trunk/Forms/UFormContacts.pas
r39 r42 133 133 begin 134 134 if Assigned(Contacts) then Contacts.AssignToList(ListViewSort1.List) 135 else ListViewSort1.List.Clear; 135 else begin 136 ListViewSort1.List.Clear; 137 end; 136 138 FilterList(ListViewSort1.List); 137 139 end; … … 178 180 ReloadList; 179 181 UpdateInterface; 182 ListViewFilter1.Reset; 180 183 end; 181 184 -
trunk/Forms/UFormProperties.pas
r39 r42 83 83 Item.Caption := Name; 84 84 Item.SubItems.Add(Attributes.DelimitedText); 85 Item.SubItems.Add(Value s.DelimitedText);85 Item.SubItems.Add(Value); 86 86 Item.Data := ListViewSort1.List[Item.Index]; 87 87 end; … … 118 118 0: Result := CompareString(TContactProperty(Item1).Name, TContactProperty(Item2).Name); 119 119 1: Result := CompareString(TContactProperty(Item1).Attributes.DelimitedText, TContactProperty(Item2).Attributes.DelimitedText); 120 2: Result := CompareString(TContactProperty(Item1).Value s.DelimitedText, TContactProperty(Item2).Values.DelimitedText);120 2: Result := CompareString(TContactProperty(Item1).Value, TContactProperty(Item2).Value); 121 121 end; 122 122 if ListViewSort1.Order = soDown then Result := -Result; … … 149 149 UTF8LowerCase(TContactProperty(List.Items[I]).Attributes.DelimitedText)) > 0 then Inc(FoundCount); 150 150 if Pos(UTF8LowerCase(StringGrid.Cells[2, 0]), 151 UTF8LowerCase(TContactProperty(List.Items[I]).Value s.DelimitedText)) > 0 then Inc(FoundCount);151 UTF8LowerCase(TContactProperty(List.Items[I]).Value)) > 0 then Inc(FoundCount); 152 152 if FoundCount <> EnteredCount then List.Delete(I); 153 153 end; -
trunk/Forms/UFormProperty.pas
r39 r42 80 80 EditName.Text := FContactProperty.Name; 81 81 EditAttributes.Text := FContactProperty.Attributes.DelimitedText; 82 EditValues.Text := FContactProperty.Value s.DelimitedText;82 EditValues.Text := FContactProperty.Value; 83 83 end else begin 84 84 EditName.Text := ''; … … 95 95 FContactProperty.Name := EditName.Text; 96 96 FContactProperty.Attributes.DelimitedText := EditAttributes.Text; 97 FContactProperty.Value s.DelimitedText:= EditValues.Text;97 FContactProperty.Value := EditValues.Text; 98 98 end; 99 99 -
trunk/Packages/Common/UListViewSort.pas
r22 r42 81 81 FOnChange: TNotifyEvent; 82 82 FStringGrid1: TStringGrid; 83 procedure DoOnChange; 83 84 procedure GridDoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 84 85 procedure GridDoOnResize(Sender: TObject); … … 90 91 function TextEnteredColumn(Index: Integer): Boolean; 91 92 function GetColValue(Index: Integer): string; 93 procedure Reset; 92 94 property StringGrid: TStringGrid read FStringGrid1 write FStringGrid1; 93 95 published … … 152 154 { TListViewFilter } 153 155 156 procedure TListViewFilter.DoOnChange; 157 begin 158 if Assigned(FOnChange) then FOnChange(Self); 159 end; 160 154 161 procedure TListViewFilter.GridDoOnKeyUp(Sender: TObject; var Key: Word; 155 162 Shift: TShiftState); 156 163 begin 157 if Assigned(FOnChange) then 158 FOnChange(Self); 164 DoOnChange; 159 165 end; 160 166 … … 227 233 Result := StringGrid.Cells[Index, 0] 228 234 else Result := ''; 235 end; 236 237 procedure TListViewFilter.Reset; 238 var 239 I: Integer; 240 begin 241 with StringGrid do 242 for I := 0 to ColCount - 1 do 243 Cells[I, 0] := ''; 244 DoOnChange; 229 245 end; 230 246 -
trunk/UContact.pas
r40 r42 13 13 TErrorEvent = procedure (Text: string; Line: Integer) of object; 14 14 15 TDataType = (dtString, dtInteger, dtDate, dtDateTime, dtImage );15 TDataType = (dtString, dtInteger, dtDate, dtDateTime, dtImage, dtStringList); 16 16 17 17 TContactFieldIndex = (cfFirstName, cfMiddleName, cfLastName, cfTitleBefore, … … 53 53 54 54 TContactProperty = class 55 private 56 function GetValueItem(Index: Integer): string; 57 procedure SetValueItem(Index: Integer; AValue: string); 58 public 55 59 Name: string; 56 60 Attributes: TStringList; 57 Value s: TStringList;61 Value: string; 58 62 Encoding: string; 59 63 Charset: string; … … 65 69 constructor Create; 66 70 destructor Destroy; override; 71 property ValueItem[Index: Integer]: string read GetValueItem write SetValueItem; 67 72 end; 68 73 … … 264 269 { TContactProperty } 265 270 271 function TContactProperty.GetValueItem(Index: Integer): string; 272 var 273 List: TStringList; 274 begin 275 List := TStringList.Create; 276 try 277 List.Delimiter := ';'; 278 List.NameValueSeparator := '='; 279 List.StrictDelimiter := True; 280 List.DelimitedText := Value; 281 if Index < List.Count then 282 Result := List.Strings[Index] 283 else Result := ''; 284 finally 285 List.Free; 286 end; 287 end; 288 289 procedure TContactProperty.SetValueItem(Index: Integer; AValue: string); 290 var 291 List: TStringList; 292 begin 293 List := TStringList.Create; 294 try 295 List.Delimiter := ';'; 296 List.NameValueSeparator := '='; 297 List.StrictDelimiter := True; 298 List.DelimitedText := Value; 299 300 // Extend subitems count 301 while List.Count <= Index do 302 List.Add(''); 303 304 List.Strings[Index] := AValue; 305 306 // Remove empty items 307 while (List.Count > 0) and (List.Strings[List.Count - 1] = '') do 308 List.Delete(List.Count - 1); 309 310 Value := List.DelimitedText; 311 finally 312 List.Free; 313 end; 314 end; 315 266 316 procedure TContactProperty.EvaluateAttributes; 267 317 var … … 274 324 Encoding := Attributes.Values['ENCODING']; 275 325 if (Encoding = 'QUOTED-PRINTABLE') or (Encoding = 'BASE64') then begin 276 Value s.DelimitedText:= GetDecodedValue;326 Value := GetDecodedValue; 277 327 Attributes.Delete(Attributes.IndexOfName('ENCODING')); 278 328 end; … … 292 342 function TContactProperty.GetDecodedValue: string; 293 343 begin 294 if Encoding = 'BASE64' then 295 Result := DecodeStringBase64(Values.DelimitedText) 296 else 297 if Encoding = 'QUOTED-PRINTABLE' then 298 Result := DecodeQuotedPrintable(Values.DelimitedText) 344 if Encoding = 'BASE64' then begin 345 Result := DecodeStringBase64(Value) 346 end else 347 if Encoding = 'QUOTED-PRINTABLE' then begin 348 Result := DecodeQuotedPrintable(Value) 349 end 299 350 else Result := ''; 300 351 end; … … 330 381 Name := Source.Name; 331 382 Attributes.Assign(Source.Attributes); 332 Values.Assign(Source.Values); 383 Value := Source.Value; 384 Encoding := Source.Encoding; 385 Charset := Source.Charset; 333 386 end; 334 387 … … 339 392 Attributes.NameValueSeparator := '='; 340 393 Attributes.StrictDelimiter := True; 341 Values := TStringList.Create;342 Values.Delimiter := ';';343 Values.NameValueSeparator := '=';344 Values.StrictDelimiter := True;345 394 end; 346 395 347 396 destructor TContactProperty.Destroy; 348 397 begin 349 FreeAndNil(Values);350 398 FreeAndNil(Attributes); 351 399 inherited; … … 448 496 Field := Parent.Fields.GetByIndex(Index); 449 497 if Field.ValueIndex <> -1 then begin 450 if Field.ValueIndex < Prop.Values.Count then 451 Result := Prop.Values.Strings[Field.ValueIndex] 452 else Result := ''; 453 end else Result := Prop.Values.DelimitedText; 498 Result := Prop.ValueItem[Field.ValueIndex] 499 end else Result := Prop.Value; 454 500 end else Result := ''; 455 501 end; … … 473 519 if Assigned(Prop) then begin 474 520 if Field.ValueIndex <> -1 then begin 475 // Extend subitems count 476 while Prop.Values.Count <= Field.ValueIndex do 477 Prop.Values.Add(''); 478 479 Prop.Values.Strings[Field.ValueIndex] := AValue; 480 end else Prop.Values.DelimitedText := AValue; 481 482 // Remove empty items 483 while (Prop.Values.Count > 0) and (Prop.Values.Strings[Prop.Values.Count - 1] = '') do 484 Prop.Values.Delete(Prop.Values.Count - 1); 521 Prop.ValueItem[Field.ValueIndex] := AValue; 522 end else Prop.Value := AValue; 485 523 486 524 // Remove if empty 487 if Prop.Value s.Text= '' then begin525 if Prop.Value = '' then begin 488 526 Properties.Remove(Prop); 489 527 end; … … 595 633 AddNew('X-TIMES_CONTACTED', [], [], STimesContacted, cfXTimesContacted, dtString); 596 634 AddNew('X-LAST_TIME_CONTACTED', [], [], SLastTimeContacted, cfXLastTimeContacted, dtString); 597 AddNew('PHOTO', [], [], SPhoto, cfPhoto, dt String);635 AddNew('PHOTO', [], [], SPhoto, cfPhoto, dtImage); 598 636 AddNew('X-JABBER', [], [], SJabber, cfXJabber, dtString); 599 AddNew('BDAY', [], [], SDayOfBirth, cfDayOfBirth, dt String);600 AddNew('ANNIVERSARY', [], [], SAnniversary, cfAnniversary, dt String);637 AddNew('BDAY', [], [], SDayOfBirth, cfDayOfBirth, dtDate); 638 AddNew('ANNIVERSARY', [], [], SAnniversary, cfAnniversary, dtDate); 601 639 AddNew('REV', [], [], SRevision, cfRevision, dtString); 602 640 AddNew('UID', [], [], SUniqueIdentifier, cfUid, dtString); … … 641 679 I: Integer; 642 680 J: Integer; 643 Value: string;644 681 NameText: string; 645 682 begin … … 652 689 for J := 0 to Properties.Count - 1 do 653 690 with Properties[J] do begin 654 Value := Values.DelimitedText;655 691 if Pos(LineEnding, Value) > 0 then begin 656 692 NameText := Name; … … 719 755 if (Length(Lines[I]) > 0) and (Lines[I][1] = ' ') then begin 720 756 Value := Value + Trim(Lines[I]); 757 end else 758 if (Length(Lines[I]) > 0) and (Length(Value) > 0) and (Value[Length(Value)] = '=') and 759 (Lines[I][1] = '=') then begin 760 Value := Value + Copy(Trim(Lines[I]), 2, MaxInt); 721 761 end else begin 722 762 Dec(I); … … 734 774 NewProperty.Attributes.Delete(0); 735 775 end; 736 NewProperty.Value s.DelimitedText:= Value;776 NewProperty.Value := Value; 737 777 NewProperty.EvaluateAttributes; 738 778 end else Error(SFoundPropertiesBeforeBlockStart, I + 1); -
trunk/UCore.pas
r34 r42 401 401 FormContacts.Contacts := TContactsFile(DataFile).Contacts 402 402 else FormContacts.Contacts := nil; 403 FormContacts.ReloadList;404 FormContacts.UpdateInterface;405 403 end; 406 404 end; -
trunk/UQuotedPrintable.pas
r35 r42 21 21 function DecodeQuotedPrintable(Text: string): string; 22 22 var 23 O, Count, WS: Byte;23 O, Count, WS: Integer; 24 24 I: integer; 25 25 InBuf: array[0..Pred(MaxLine)] of Byte;
Note:
See TracChangeset
for help on using the changeset viewer.