Changeset 82 for trunk/Forms


Ignore:
Timestamp:
Dec 21, 2021, 5:16:41 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Settings option to load previously opened file wasn't working for disabled state.
  • Fixed: Disable Find action if no file is opened.
  • Modified: Move fields initialization method to TContact class and made it static so it is initialized only once.
  • Added: Allow to set default vCard version in settings dialog.
  • Modified: Add GTK2 theming support to snap package.
Location:
trunk/Forms
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.lfm

    r76 r82  
    1616  object ListView1: TListView
    1717    Left = 0
    18     Height = 801
     18    Height = 810
    1919    Top = 0
    2020    Width = 1210
     
    6868    Left = 0
    6969    Height = 39
    70     Top = 833
     70    Top = 842
    7171    Width = 1210
    7272    Align = alBottom
     
    116116    Left = 0
    117117    Height = 32
    118     Top = 801
     118    Top = 810
    119119    Width = 1210
    120120    OnChange = ListViewFilter1Change
     
    123123  object StatusBar1: TStatusBar
    124124    Left = 0
    125     Height = 36
    126     Top = 872
     125    Height = 27
     126    Top = 881
    127127    Width = 1210
    128128    Panels = <   
  • trunk/Forms/UFormContacts.pas

    r77 r82  
    203203        for J := 0 to FilterItems.Count - 1 do begin
    204204          if FilterItems[J].FieldIndex = cfNone then begin
    205             for K := 0 to TContact(List.Items[I]).Parent.Fields.Count - 1 do begin
     205            for K := 0 to TContact(List.Items[I]).GetFields.Count - 1 do begin
    206206              if Pos(UTF8LowerCase(FilterItems[J].Value),
    207                 UTF8LowerCase(TContact(List.Items[I]).Fields[TContact(List.Items[I]).Parent.Fields[K].Index])) > 0 then begin
     207                UTF8LowerCase(TContact(List.Items[I]).Fields[TContact(List.Items[I]).GetFields[K].Index])) > 0 then begin
    208208                  Inc(FoundCount);
    209209                  Break;
     
    286286  for I := 0 to ListView1.Columns.Count - 1 do begin
    287287    if Assigned(Contacts) and Assigned(Contacts.ContactsFile) then begin
    288       Field := Contacts.ContactsFile.Fields.GetByIndex(ListViewColumns[I]);
     288      Field := TContact.GetFields.GetByIndex(ListViewColumns[I]);
    289289      if Assigned(Field) then
    290290        ListView1.Columns[I].Caption := Field.Title;
     
    312312    Contact := TContact.Create;
    313313    try
    314       Contact.Parent := Contacts.ContactsFile;
     314      Contact.ContactsFile := Contacts.ContactsFile;
    315315      FormContact.Contact := Contact;
    316316      FormContact.OnGetPrevious := GetPreviousContact;
    317317      FormContact.OnGetNext := GetNextContact;
     318      Contact.Properties.AddNew('VERSION', Core.DefaultVcardVersion);
    318319      if FormContact.ShowModal = mrOK then begin
    319320        Contacts.Add(Contact);
     
    341342    Contact := TContact.Create;
    342343    try
    343       Contact.Parent := Contacts.ContactsFile;
     344      Contact.ContactsFile := Contacts.ContactsFile;
    344345      Contact.Assign(TContact(ListView1.Selected.Data));
    345346      FormContact.Contact := Contact;
     
    442443    Contact := TContact.Create;
    443444    try
    444       Contact.Parent := Contacts.ContactsFile;
     445      Contact.ContactsFile := Contacts.ContactsFile;
    445446      Contact.Assign(TContact(ListView1.Selected.Data));
    446447      FormContact.Contact := Contact;
  • trunk/Forms/UFormFind.lfm

    r76 r82  
    2727    object ComboBoxField: TComboBox
    2828      Left = 184
    29       Height = 33
     29      Height = 41
    3030      Top = 16
    3131      Width = 240
    32       ItemHeight = 25
     32      ItemHeight = 0
    3333      OnChange = ComboBoxFieldChange
    3434      ParentFont = False
     
    3838    object Label1: TLabel
    3939      Left = 13
    40       Height = 25
     40      Height = 24
    4141      Top = 19
    42       Width = 125
     42      Width = 135
    4343      Caption = 'By contact field:'
    4444      ParentColor = False
     
    4747    object EditValue: TEdit
    4848      Left = 440
    49       Height = 33
     49      Height = 42
    5050      Top = 16
    5151      Width = 208
  • trunk/Forms/UFormFind.pas

    r76 r82  
    6363    Items := TStringList.Create;
    6464    try
    65       Contacts.ContactsFile.Fields.LoadToStrings(Items);
     65      TContact.GetFields.LoadToStrings(Items);
    6666
    6767      // Remove fields which are not used in contacts
     
    7575      Items.Free;
    7676    end;
    77     ContactField := Contacts.ContactsFile.Fields.GetByIndex(ContactFieldIndex);
     77    ContactField := TContact.GetFields.GetByIndex(ContactFieldIndex);
    7878    ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(ContactField);
    7979    if (ComboBoxField.Items.Count > 0) and (ComboBoxField.ItemIndex = -1) then
  • trunk/Forms/UFormFindDuplicity.lfm

    r73 r82  
    3131      item
    3232        Caption = 'Count'
    33         Width = 136
     33        Width = 242
    3434      end>
    3535    OwnerData = True
     
    5656    object ComboBoxField: TComboBox
    5757      Left = 160
    58       Height = 33
     58      Height = 41
    5959      Top = 16
    6060      Width = 326
    61       ItemHeight = 25
     61      ItemHeight = 0
    6262      OnChange = ComboBoxFieldChange
    6363      ParentFont = False
     
    6767    object Label1: TLabel
    6868      Left = 13
    69       Height = 25
     69      Height = 24
    7070      Top = 19
    71       Width = 125
     71      Width = 135
    7272      Caption = 'By contact field:'
    7373      ParentColor = False
  • trunk/Forms/UFormFindDuplicity.pas

    r73 r82  
    119119    Items := TStringList.Create;
    120120    try
    121       Contacts.ContactsFile.Fields.LoadToStrings(Items);
     121      TContact.GetFields.LoadToStrings(Items);
    122122
    123123      // Remove fields which are not used in contacts
     
    130130      Items.Free;
    131131    end;
    132     ContactField := Contacts.ContactsFile.Fields.GetByIndex(ContactFieldIndex);
     132    ContactField := TContact.GetFields.GetByIndex(ContactFieldIndex);
    133133    ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(ContactField);
    134134    if (ComboBoxField.Items.Count > 0) and (ComboBoxField.ItemIndex = -1) then
  • trunk/Forms/UFormProperty.pas

    r68 r82  
    102102  Core.ThemeManager1.UseTheme(Self);
    103103  FContactProperty := nil;
    104   TContactsFile(Core.DataFile).Fields.LoadToStrings(ComboBoxField.Items);
     104  TContact.GetFields.LoadToStrings(ComboBoxField.Items);
    105105end;
    106106
     
    129129    Groups.Free;
    130130  end;
    131   Field := TContactsFile(Core.DataFile).Fields.GetBySysNameGroups(EditName.Text,
     131  Field := TContact.GetFields.GetBySysNameGroups(EditName.Text,
    132132    GroupsArray);
    133133  if Assigned(Field) then
  • trunk/Forms/UFormSettings.lfm

    r23 r82  
    33  Height = 360
    44  Top = 367
    5   Width = 577
     5  Width = 564
    66  Caption = 'Settings'
    77  ClientHeight = 360
    8   ClientWidth = 577
     8  ClientWidth = 564
    99  Constraints.MinHeight = 360
    1010  Constraints.MinWidth = 480
     
    1616  LCLVersion = '2.0.12.0'
    1717  object ComboBoxLanguage: TComboBox
    18     Left = 192
     18    Left = 240
    1919    Height = 41
    20     Top = 36
    21     Width = 312
     20    Top = 16
     21    Width = 264
    2222    ItemHeight = 0
    2323    ParentFont = False
     
    2828    Left = 24
    2929    Height = 24
    30     Top = 36
     30    Top = 24
    3131    Width = 88
    3232    Caption = 'Language:'
     
    3535  end
    3636  object ButtonOk: TButton
    37     Left = 451
     37    Left = 438
    3838    Height = 37
    3939    Top = 307
     
    4747  end
    4848  object ButtonCancel: TButton
    49     Left = 307
     49    Left = 294
    5050    Height = 37
    5151    Top = 307
     
    5858  end
    5959  object CheckBoxAutomaticDPI: TCheckBox
    60     Left = 19
     60    Left = 24
    6161    Height = 30
    62     Top = 125
     62    Top = 200
    6363    Width = 148
    6464    Caption = 'Automatic DPI'
     
    6969  end
    7070  object SpinEditDPI: TSpinEdit
    71     Left = 192
     71    Left = 240
    7272    Height = 42
    73     Top = 173
     73    Top = 232
    7474    Width = 145
    7575    MaxValue = 300
     
    8181  end
    8282  object LabelDPI: TLabel
    83     Left = 96
     83    Left = 56
    8484    Height = 24
    85     Top = 182
     85    Top = 240
    8686    Width = 35
    8787    Caption = 'DPI:'
     
    9191  end
    9292  object CheckBoxReopenLastFileOnStart: TCheckBox
    93     Left = 19
     93    Left = 24
    9494    Height = 30
    95     Top = 86
     95    Top = 160
    9696    Width = 226
    9797    Caption = 'Reopen last file on start'
     
    103103    Height = 2
    104104    Top = 288
    105     Width = 547
     105    Width = 534
    106106    Anchors = [akLeft, akRight, akBottom]
    107107  end
     
    109109    Left = 24
    110110    Height = 24
    111     Top = 221
     111    Top = 72
    112112    Width = 63
    113113    Caption = 'Theme:'
     
    116116  end
    117117  object ComboBoxTheme: TComboBox
    118     Left = 192
     118    Left = 240
    119119    Height = 41
    120     Top = 221
    121     Width = 312
     120    Top = 64
     121    Width = 264
    122122    ItemHeight = 0
    123123    ParentFont = False
     
    125125    TabOrder = 6
    126126  end
     127  object Label3: TLabel
     128    Left = 24
     129    Height = 24
     130    Top = 120
     131    Width = 186
     132    Caption = 'Default vCard version:'
     133    ParentColor = False
     134  end
     135  object EditDefaultVcardVersion: TEdit
     136    Left = 240
     137    Height = 42
     138    Top = 112
     139    Width = 144
     140    TabOrder = 7
     141  end
    127142end
  • trunk/Forms/UFormSettings.lrj

    r21 r82  
    77{"hash":300234,"name":"tformsettings.labeldpi.caption","sourcebytes":[68,80,73,58],"value":"DPI:"},
    88{"hash":55973348,"name":"tformsettings.checkboxreopenlastfileonstart.caption","sourcebytes":[82,101,111,112,101,110,32,108,97,115,116,32,102,105,108,101,32,111,110,32,115,116,97,114,116],"value":"Reopen last file on start"},
    9 {"hash":95339402,"name":"tformsettings.label2.caption","sourcebytes":[84,104,101,109,101,58],"value":"Theme:"}
     9{"hash":95339402,"name":"tformsettings.label2.caption","sourcebytes":[84,104,101,109,101,58],"value":"Theme:"},
     10{"hash":232157114,"name":"tformsettings.label3.caption","sourcebytes":[68,101,102,97,117,108,116,32,118,67,97,114,100,32,118,101,114,115,105,111,110,58],"value":"Default vCard version:"}
    1011]}
  • trunk/Forms/UFormSettings.pas

    r23 r82  
    2121    ComboBoxLanguage: TComboBox;
    2222    ComboBoxTheme: TComboBox;
     23    EditDefaultVcardVersion: TEdit;
    2324    Label1: TLabel;
    2425    Label2: TLabel;
     26    Label3: TLabel;
    2527    LabelDPI: TLabel;
    2628    SpinEditDPI: TSpinEdit;
     
    100102  SpinEditDPI.Value := Core.ScaleDPI1.DPI.X;
    101103  CheckBoxReopenLastFileOnStart.Checked := Core.ReopenLastFileOnStart;
     104  EditDefaultVcardVersion.Text := Core.DefaultVcardVersion;
    102105  UpdateInterface;
    103106end;
     
    108111  Core.ScaleDPI1.DPI := Point(SpinEditDPI.Value, SpinEditDPI.Value);
    109112  Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked;
     113  Core.DefaultVcardVersion := EditDefaultVcardVersion.Text;
    110114end;
    111115
Note: See TracChangeset for help on using the changeset viewer.