Changeset 34 for trunk


Ignore:
Timestamp:
Nov 25, 2021, 1:51:20 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Memory allocation during files merge.
  • Fixed: Select all context menu action was not selecting all items.
  • Modified: Statusbar moved into contacts form and it is now showin total, filtered and selected number of items.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.lfm

    r32 r34  
    1414  object ListView1: TListView
    1515    Left = 0
    16     Height = 837
     16    Height = 810
    1717    Top = 0
    1818    Width = 1210
     
    5858    Left = 0
    5959    Height = 39
    60     Top = 869
     60    Top = 842
    6161    Width = 1210
    6262    Align = alBottom
     
    8383    Left = 0
    8484    Height = 32
    85     Top = 837
     85    Top = 810
    8686    Width = 1210
    8787    OnChange = ListViewFilter1Change
    8888    Align = alBottom
     89  end
     90  object StatusBar1: TStatusBar
     91    Left = 0
     92    Height = 27
     93    Top = 881
     94    Width = 1210
     95    Panels = <   
     96      item
     97        Width = 50
     98      end>
     99    SimplePanel = False
    89100  end
    90101  object PopupMenuContact: TPopupMenu
  • trunk/Forms/UFormContacts.pas

    r32 r34  
    2727    MenuItem4: TMenuItem;
    2828    PopupMenuContact: TPopupMenu;
     29    StatusBar1: TStatusBar;
    2930    ToolBar1: TToolBar;
    3031    ToolButton1: TToolButton;
     
    7071  SRemoveContacts = 'Remove contacts';
    7172  SRemoveContactsQuery = 'Do you want to remove selected contacts?';
     73  STotal = 'Total';
     74  SFiltered = 'Filtered';
     75  SSelected = 'Selected';
    7276
    7377{ TFormContacts }
     
    8387    Item.SubItems.Add(Fields[cfTelCell]);
    8488    Item.SubItems.Add(Fields[cfTelHome]);
    85     Item.Data := Contacts[Item.Index];
     89    Item.Data := ListViewSort1.List[Item.Index];
    8690  end;
    8791end;
     
    101105begin
    102106  ReloadList;
     107  UpdateInterface;
    103108end;
    104109
     
    244249begin
    245250  ListView1.SelectAll;
     251  UpdateInterface;
    246252end;
    247253
     
    263269
    264270procedure TFormContacts.UpdateInterface;
     271var
     272  Text: string;
     273  SelectedCount: Integer;
    265274begin
    266275  AAdd.Enabled := Assigned(Contacts);
    267276  AModify.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
    268277  ARemove.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
     278
     279  Text := '';
     280  if Assigned(Contacts) then begin
     281    Text := STotal + ': ' + IntToStr(Contacts.Count);
     282    if ListView1.Items.Count < Contacts.Count then
     283      Text := Text + ', ' + SFiltered + ': ' + IntToStr(ListView1.Items.Count);
     284    SelectedCount := ListView1.SelCount;
     285    if SelectedCount > 0 then
     286      Text := Text + ', ' + SSelected + ': ' + IntToStr(SelectedCount);
     287  end;
     288  StatusBar1.Panels[0].Text := Text;
    269289end;
    270290
  • trunk/Forms/UFormMain.lfm

    r21 r34  
    1414  OnDestroy = FormDestroy
    1515  OnShow = FormShow
    16   LCLVersion = '2.0.0.4'
     16  LCLVersion = '2.0.12.0'
    1717  object CoolBar1: TCoolBar
    1818    Left = 0
     
    107107    end
    108108  end
    109   object StatusBar1: TStatusBar
    110     Left = 0
    111     Height = 28
    112     Top = 734
    113     Width = 1178
    114     Panels = <   
    115       item
    116         Width = 300
    117       end>
    118     ParentFont = False
    119     SimplePanel = False
    120   end
    121109  object MainMenu1: TMainMenu
    122110    Images = Core.ImageList1
    123     left = 192
    124     top = 120
     111    Left = 192
     112    Top = 120
    125113    object MenuItemFile: TMenuItem
    126114      Caption = 'File'
     
    187175  end
    188176  object PopupMenuOpenRecent: TPopupMenu
    189     left = 420
    190     top = 120
     177    Left = 420
     178    Top = 120
    191179  end
    192180end
  • trunk/Forms/UFormMain.pas

    r21 r34  
    3737    MenuItemFile: TMenuItem;
    3838    PopupMenuOpenRecent: TPopupMenu;
    39     StatusBar1: TStatusBar;
    4039    ToolBarOther: TToolBar;
    4140    ToolBarFile: TToolBar;
     
    7170
    7271resourcestring
    73   SCount = 'Count:';
    7472  SModified = 'Modified';
    7573
     
    153151  UpdateFormTitle;
    154152  CoolBar1.Visible := MenuItemToolbar.Checked;
    155   if Assigned(Core.DataFile) then
    156     StatusBar1.Panels[0].Text := SCount + ' ' + IntToStr(TcontactsFile(Core.DataFile).Contacts.Count)
    157     else StatusBar1.Panels[0].Text := '';
    158153end;
    159154
  • trunk/Languages/vCardStudio.cs.po

    r33 r34  
    185185#: tformcontact.label5.caption
    186186msgid "Last name"
    187 msgstr "Příjmení:"
     187msgstr "Příjmení"
    188188
    189189#: tformcontact.label6.caption
     
    621621msgstr "Upravit pole"
    622622
     623#: uformcontacts.sfiltered
     624msgid "Filtered"
     625msgstr "Filtrovaných"
     626
    623627#: uformcontacts.sremovecontacts
    624628msgid "Remove contacts"
     
    629633msgstr "Opravdu chcete odstranit vybrané kontakty?"
    630634
    631 #: uformmain.scount
    632 msgctxt "uformmain.scount"
    633 msgid "Count:"
    634 msgstr "Počet:"
     635#: uformcontacts.sselected
     636msgid "Selected"
     637msgstr "Vybraných"
     638
     639#: uformcontacts.stotal
     640msgid "Total"
     641msgstr "Celkem"
    635642
    636643#: uformmain.smodified
  • trunk/Languages/vCardStudio.po

    r33 r34  
    605605msgstr ""
    606606
     607#: uformcontacts.sfiltered
     608msgid "Filtered"
     609msgstr ""
     610
    607611#: uformcontacts.sremovecontacts
    608612msgid "Remove contacts"
     
    613617msgstr ""
    614618
    615 #: uformmain.scount
    616 msgctxt "uformmain.scount"
    617 msgid "Count:"
     619#: uformcontacts.sselected
     620msgid "Selected"
     621msgstr ""
     622
     623#: uformcontacts.stotal
     624msgid "Total"
    618625msgstr ""
    619626
  • trunk/UContact.pas

    r33 r34  
    302302  I: Integer;
    303303begin
    304   List.Clear;
     304  while List.Count > Count do List.Delete(List.Count - 1);
     305  while List.Count < Count do List.Add(nil);
    305306  for I := 0 to Count - 1 do
    306     List.Add(Items[I]);
     307    List[I] := Items[I];
    307308end;
    308309
     
    425426
    426427procedure TContact.Assign(Source: TContact);
    427 begin
    428   Properties.Assign(Source.Properties);
     428var
     429  I: Integer;
     430begin
     431  while Properties.Count < Source.Properties.Count do
     432    Properties.Add(TContactProperty.Create);
     433  while Properties.Count > Source.Properties.Count do
     434    Properties.Delete(Properties.Count - 1);
     435  for I := 0 to Properties.Count - 1 do
     436    Properties[I].Assign(Source.Properties[I]);
    429437end;
    430438
  • trunk/UCore.pas

    r31 r34  
    364364      Result.Loaded := TempFile.Contacts.Count;
    365365      for I := 0 to TempFile.Contacts.Count - 1 do begin
    366         NewContact := TContactsFile(DataFile).Contacts.Search(TContact(TempFile.Contacts[I]).Fields[cfFullName]);
     366        NewContact := TContactsFile(DataFile).Contacts.Search(TempFile.Contacts[I].Fields[cfFullName]);
    367367        if not Assigned(NewContact) then begin
    368368          NewContact := TContact.Create;
    369369          NewContact.Parent := TContactsFile(DataFile);
    370           NewContact.Assign(TContact(TempFile.Contacts[I]));
     370          NewContact.Assign(TempFile.Contacts[I]);
    371371          TContactsFile(DataFile).Contacts.Add(NewContact);
    372372          Inc(Result.New);
    373373        end else begin
    374           if NewContact.UpdateFrom(TContact(TempFile.Contacts[I])) then
     374          if NewContact.UpdateFrom(TempFile.Contacts[I]) then
    375375            Inc(Result.Updated);
    376376        end;
     
    402402      else FormContacts.Contacts := nil;
    403403    FormContacts.ReloadList;
     404    FormContacts.UpdateInterface;
    404405  end;
    405406end;
Note: See TracChangeset for help on using the changeset viewer.