Changeset 2


Ignore:
Timestamp:
Jan 26, 2018, 11:23:26 PM (7 years ago)
Author:
chronos
Message:
  • Added: Contact edit form.
Location:
trunk
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      *.lrj
      heaptrclog.trc
      lib
      vCardStudio
      *.lps
      *.res
  • trunk/Forms

    • Property svn:ignore set to
      *.lrj
  • trunk/Forms/UFormContacts.lfm

    r1 r2  
    77  ClientHeight = 605
    88  ClientWidth = 807
     9  OnClose = FormClose
    910  OnShow = FormShow
    1011  LCLVersion = '1.8.0.4'
    1112  object ListView1: TListView
    1213    Left = 0
    13     Height = 605
     14    Height = 579
    1415    Top = 0
    1516    Width = 807
     
    2122      end>
    2223    OwnerData = True
     24    PopupMenu = PopupMenuContact
    2325    ReadOnly = True
    2426    RowSelect = True
     
    2628    ViewStyle = vsReport
    2729    OnData = ListView1Data
     30    OnDblClick = ListView1DblClick
     31    OnSelectItem = ListView1SelectItem
     32  end
     33  object ToolBar1: TToolBar
     34    Left = 0
     35    Height = 26
     36    Top = 579
     37    Width = 807
     38    Align = alBottom
     39    Caption = 'ToolBar1'
     40    Images = Core.ImageList1
     41    TabOrder = 1
     42    object ToolButton1: TToolButton
     43      Left = 1
     44      Top = 2
     45      Action = AAdd
     46    end
     47    object ToolButton2: TToolButton
     48      Left = 24
     49      Top = 2
     50      Action = AModify
     51    end
     52    object ToolButton3: TToolButton
     53      Left = 47
     54      Top = 2
     55      Action = ARemove
     56    end
     57  end
     58  object PopupMenuContact: TPopupMenu
     59    Images = Core.ImageList1
     60    left = 290
     61    top = 175
     62    object MenuItem1: TMenuItem
     63      Action = AAdd
     64    end
     65    object MenuItem2: TMenuItem
     66      Action = AModify
     67    end
     68    object MenuItem3: TMenuItem
     69      Action = ARemove
     70    end
     71  end
     72  object ActionList1: TActionList
     73    Images = Core.ImageList1
     74    left = 488
     75    top = 171
     76    object AAdd: TAction
     77      Caption = 'Add'
     78      ImageIndex = 9
     79      OnExecute = AAddExecute
     80      ShortCut = 45
     81    end
     82    object AModify: TAction
     83      Caption = 'Modify'
     84      ImageIndex = 6
     85      OnExecute = AModifyExecute
     86      ShortCut = 13
     87    end
     88    object ARemove: TAction
     89      Caption = 'Remove'
     90      ImageIndex = 10
     91      OnExecute = ARemoveExecute
     92      ShortCut = 46
     93    end
    2894  end
    2995end
  • trunk/Forms/UFormContacts.pas

    r1 r2  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, UContact;
     9  ComCtrls, Menus, ActnList, UContact;
    1010
    1111type
     
    1414
    1515  TFormContacts = class(TForm)
     16    AAdd: TAction;
     17    ARemove: TAction;
     18    AModify: TAction;
     19    ActionList1: TActionList;
    1620    ListView1: TListView;
     21    MenuItem1: TMenuItem;
     22    MenuItem2: TMenuItem;
     23    MenuItem3: TMenuItem;
     24    PopupMenuContact: TPopupMenu;
     25    ToolBar1: TToolBar;
     26    ToolButton1: TToolButton;
     27    ToolButton2: TToolButton;
     28    ToolButton3: TToolButton;
     29    procedure AAddExecute(Sender: TObject);
     30    procedure AModifyExecute(Sender: TObject);
     31    procedure ARemoveExecute(Sender: TObject);
     32    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    1733    procedure FormShow(Sender: TObject);
    1834    procedure ListView1Data(Sender: TObject; Item: TListItem);
     35    procedure ListView1DblClick(Sender: TObject);
     36    procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
     37      Selected: Boolean);
    1938  private
    2039
     
    2241    Contacts: TContacts;
    2342    procedure ReloadList;
     43    procedure UpdateInterface;
    2444  end;
    2545
     
    2747  FormContacts: TFormContacts;
    2848
     49
    2950implementation
    3051
    3152{$R *.lfm}
     53
     54uses
     55  UFormContact, UCore;
    3256
    3357{ TFormContacts }
     
    4266end;
    4367
     68procedure TFormContacts.ListView1DblClick(Sender: TObject);
     69begin
     70  AModify.Execute;
     71end;
     72
     73procedure TFormContacts.ListView1SelectItem(Sender: TObject; Item: TListItem;
     74  Selected: Boolean);
     75begin
     76  UpdateInterface;
     77end;
     78
    4479procedure TFormContacts.FormShow(Sender: TObject);
    4580begin
     81  Core.PersistentForm1.Load(Self);
    4682  ReloadList;
     83  UpdateInterface;
     84end;
     85
     86procedure TFormContacts.AAddExecute(Sender: TObject);
     87var
     88  FormContact: TFormContact;
     89begin
     90  FormContact := TFormContact.Create(nil);
     91  if FormContact.ShowModal = mrOK then begin
     92    FormContact.SaveData(TContact(ListView1.Selected.Data));
     93    ReloadList;
     94    UpdateInterface;
     95  end;
     96  FormContact.Free;
     97end;
     98
     99procedure TFormContacts.AModifyExecute(Sender: TObject);
     100var
     101  FormContact: TFormContact;
     102begin
     103  FormContact := TFormContact.Create(nil);
     104  FormContact.LoadData(TContact(ListView1.Selected.Data));
     105  if FormContact.ShowModal = mrOK then begin
     106    FormContact.SaveData(TContact(ListView1.Selected.Data));
     107    ReloadList;
     108    UpdateInterface;
     109  end;
     110  FormContact.Free;
     111end;
     112
     113procedure TFormContacts.ARemoveExecute(Sender: TObject);
     114var
     115  I: Integer;
     116begin
     117  for I := ListView1.Items.Count - 1 downto 0 do
     118    if ListView1.Items[I].Selected then begin
     119      Contacts.Delete(I);
     120    end;
     121  UpdateInterface;
     122end;
     123
     124procedure TFormContacts.FormClose(Sender: TObject; var CloseAction: TCloseAction
     125  );
     126begin
     127  Core.PersistentForm1.Save(Self);
    47128end;
    48129
     
    55136end;
    56137
     138procedure TFormContacts.UpdateInterface;
     139begin
     140  AModify.Enabled := Assigned(ListView1.Selected);
     141  ARemove.Enabled := Assigned(ListView1.Selected);
     142end;
     143
    57144end.
    58145
  • trunk/Languages/vCardStudio.po

    r1 r2  
    4444msgstr ""
    4545
     46#: tformcontact.buttoncancel.caption
     47msgctxt "tformcontact.buttoncancel.caption"
     48msgid "Cancel"
     49msgstr ""
     50
     51#: tformcontact.buttonok.caption
     52msgid "OK"
     53msgstr ""
     54
     55#: tformcontact.caption
     56msgid "Contact"
     57msgstr ""
     58
     59#: tformcontact.label1.caption
     60msgid "Name:"
     61msgstr ""
     62
     63#: tformcontact.tabsheetall.caption
     64msgid "All fields"
     65msgstr ""
     66
     67#: tformcontact.tabsheetdetails.caption
     68msgid "Details"
     69msgstr ""
     70
     71#: tformcontact.tabsheetgeneral.caption
     72msgid "General"
     73msgstr ""
     74
     75#: tformcontacts.aadd.caption
     76msgid "Add"
     77msgstr ""
     78
     79#: tformcontacts.amodify.caption
     80msgid "Modify"
     81msgstr ""
     82
     83#: tformcontacts.aremove.caption
     84msgid "Remove"
     85msgstr ""
     86
    4687#: tformcontacts.caption
    4788msgid "Contacts"
     
    5091#: tformcontacts.listview1.columns[0].caption
    5192msgid "Name"
     93msgstr ""
     94
     95#: tformcontacts.toolbar1.caption
     96msgid "ToolBar1"
    5297msgstr ""
    5398
     
    83128
    84129#: tformsettings.buttoncancel.caption
     130msgctxt "tformsettings.buttoncancel.caption"
    85131msgid "Cancel"
    86132msgstr ""
  • trunk/Packages/Common

    • Property svn:ignore set to
      lib
  • trunk/Packages/CoolTranslator

    • Property svn:ignore set to
      lib
  • trunk/Packages/TemplateGenerics

    • Property svn:ignore set to
      lib
  • trunk/UCore.lfm

    r1 r2  
    1111    top = 231
    1212    Bitmap = {
    13       4C69090000001000000010000000000000000000000000000000000000000000
     13      4C690B0000001000000010000000000000000000000000000000000000000000
    1414      0000000000000000000000000000000000000000000000000000000000000000
    1515      0000000000000000000000000000000000000000000000000000000000000000
     
    299299      28FF000000000000000000000000000000000000000000000000000000000000
    300300      0000000000003F3428FF3F3428FF3F3428FF3F3428FF00000000000000000000
     301      0000000000000000000000000000000000000000000000000000000000000000
     302      000070A970FF006400FF006200FF70A670FF0000000000000000000000000000
     303      0000000000000000000000000000000000000000000000000000000000000000
     304      0000006400FFECFFECFF8CFE8CFF006000FFD4D4D4FF00000000000000000000
     305      0000000000000000000000000000000000000000000000000000000000000000
     306      0000006400FF8CFE8CFF00E800FF005E00FFB2B2B2FF00000000000000000000
     307      0000000000000000000000000000000000000000000000000000000000000000
     308      0000006200FF8CFE8CFF00E500FF005C00FFB2B2B2FF00000000000000000000
     309      0000000000000000000000000000000000000000000000000000000000000000
     310      0000006000FF8CFE8CFF00E000FF005A00FFB2B2B2FF00000000000000000000
     311      000000000000000000000000000070A970FF006400FF006400FF006200FF0060
     312      00FF006000FF8CFE8CFF00DD00FF005800FF005600FF005400FF005300FF0050
     313      00FF709C70FF0000000000000000006400FFECFFECFF8CFE8CFF8CFE8CFF8CFE
     314      8CFF8CFE8CFF00DE00FF00D900FF00D400FF00D000FF00CC00FF00C800FF00C4
     315      00FF004A00FFD4D4D4FF00000000006200FF8CFE8CFF00EA00FF00E600FF00E2
     316      00FF00DE00FF00DA00FF00D400FF00D000FF00CC00FF00C800FF00C400FF00C2
     317      00FF004800FFB2B2B2FF0000000070A670FF005E00FF005C00FF005A00FF0058
     318      00FF005600FF00D600FF00D000FF005000FF004E00FF004C00FF004A00FF004A
     319      00FF4E764EFFB2B2B2FF0000000000000000D4D4D4FFB2B2B2FFB2B2B2FFB2B2
     320      B2FF005400FF00D200FF00CE00FF004E00FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2
     321      B2FFB2B2B2FFD4D4D4FF00000000000000000000000000000000000000000000
     322      0000005300FF00CE00FF00CA00FF004C00FFB2B2B2FF00000000000000000000
     323      0000000000000000000000000000000000000000000000000000000000000000
     324      0000005000FF00CA00FF00C600FF004A00FFB2B2B2FF00000000000000000000
     325      0000000000000000000000000000000000000000000000000000000000000000
     326      0000004E00FF00C800FF00C400FF004800FFB2B2B2FF00000000000000000000
     327      0000000000000000000000000000000000000000000000000000000000000000
     328      0000709B70FF004A00FF004800FF4E764EFFB2B2B2FF00000000000000000000
     329      0000000000000000000000000000000000000000000000000000000000000000
     330      000000000000D4D4D4FFB2B2B2FFB2B2B2FFD4D4D4FF00000000000000000000
     331      0000000000000000000000000000000000000000000000000000000000000000
     332      0000000000000000000000000000000000000000000000000000000000000000
     333      0000000000000000000000000000000000000000000000000000000000000000
     334      0000000000000000000000000000000000000000000000000000000000000000
     335      000000000000000000000000000000000000000000008C8CBBFF000088FF8C8C
     336      BBFF00000000000000000000000000000000000000008C8CBBFF000075FF8C8C
     337      BBFF000000000000000000000000000000008C8CBBFF000088FF619BFFFF0000
     338      86FF7979A8FF0000000000000000000000008C8CBBFF000075FF619BFFFF0000
     339      6EFF7979A8FF000000000000000000000000000088FF619BFFFF0057FFFF0054
     340      FFFF000082FF7979A8FF000000008C8CBBFF000075FF619BFFFF003AFFFF0035
     341      FFFF000068FFDCDCDCFF00000000000000008C8CBBFF000086FF0054FFFF0052
     342      FFFF004EFFFF00007CFF7979A8FF000075FF619BFFFF003AFFFF0035FFFF0000
     343      67FF626291FFB2B2B2FF0000000000000000000000007979A8FF000082FF004E
     344      FFFF004BFFFF0047FFFF000075FF619BFFFF003AFFFF0035FFFF000068FF6262
     345      91FFB2B2B2FFDCDCDCFF000000000000000000000000000000007979A8FF0000
     346      7CFF0047FFFF0042FFFF003EFFFF003AFFFF0035FFFF000068FF626291FFB2B2
     347      B2FFDCDCDCFF0000000000000000000000000000000000000000000000007979
     348      A8FF000075FF003EFFFF003AFFFF0035FFFF000068FF626291FFB2B2B2FFDCDC
     349      DCFF0000000000000000000000000000000000000000000000008C8CBBFF0000
     350      75FF619BFFFF003AFFFF0035FFFF0030FFFF002BFFFF000061FF7979A8FF0000
     351      000000000000000000000000000000000000000000008C8CBBFF000075FF619B
     352      FFFF003AFFFF0035FFFF000067FF002CFFFF0027FFFF0023FFFF000059FF7979
     353      A8FF000000000000000000000000000000008C8CBBFF000075FF619BFFFF003A
     354      FFFF0035FFFF000067FF626291FF000061FF0023FFFF001FFFFF001BFFFF0000
     355      54FF7979A8FF000000000000000000000000000072FF619BFFFF003AFFFF0035
     356      FFFF000067FF626291FFB2B2B2FF7979A8FF000059FF001BFFFF0018FFFF0015
     357      FFFF000050FFDCDCDCFF00000000000000008C8CBBFF00006EFF0035FFFF0000
     358      68FF626291FFB2B2B2FFDCDCDCFF000000007979A8FF000054FF0015FFFF0000
     359      50FF626291FFB2B2B2FF0000000000000000000000007979A8FF000067FF6262
     360      91FFB2B2B2FFDCDCDCFF0000000000000000000000007979A8FF000050FF6262
     361      91FFB2B2B2FFDCDCDCFF00000000000000000000000000000000DCDCDCFFB2B2
     362      B2FFDCDCDCFF0000000000000000000000000000000000000000DCDCDCFFB2B2
     363      B2FFDCDCDCFF0000000000000000000000000000000000000000000000000000
     364      0000000000000000000000000000000000000000000000000000000000000000
    301365      0000000000000000000000000000
    302366    }
  • trunk/vCardStudio.lpi

    r1 r2  
    9292      </Item4>
    9393    </RequiredPackages>
    94     <Units Count="8">
     94    <Units Count="9">
    9595      <Unit0>
    9696        <Filename Value="vCardStudio.lpr"/>
     
    137137        <IsPartOfProject Value="True"/>
    138138        <ComponentName Value="FormContacts"/>
     139        <HasResources Value="True"/>
    139140        <ResourceBaseClass Value="Form"/>
    140141      </Unit7>
     142      <Unit8>
     143        <Filename Value="Forms\UFormContact.pas"/>
     144        <IsPartOfProject Value="True"/>
     145        <ComponentName Value="FormContact"/>
     146        <ResourceBaseClass Value="Form"/>
     147      </Unit8>
    141148    </Units>
    142149  </ProjectOptions>
  • trunk/vCardStudio.lpr

    r1 r2  
    99  Interfaces, // this includes the LCL widgetset
    1010  Forms, UFormMain, UCore, Common, CoolTranslator, UDataFile,
    11   TemplateGenerics, SysUtils, UFormContacts
     11  TemplateGenerics, SysUtils, UFormContacts, UFormContact
    1212  { you can add units after this };
    1313
Note: See TracChangeset for help on using the changeset viewer.