Changeset 77


Ignore:
Timestamp:
Dec 15, 2021, 9:03:17 PM (2 years ago)
Author:
chronos
Message:
  • Modified: More preparation for future Previous and Next buttons in Contact window.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r73 r77  
    429429        Anchors = [akTop, akLeft, akRight]
    430430        Caption = 'Address'
    431         ClientHeight = 212
    432         ClientWidth = 918
     431        ClientHeight = 215
     432        ClientWidth = 920
    433433        TabOrder = 6
    434434        object Label36: TLabel
     
    573573    object TabSheetWork: TTabSheet
    574574      Caption = 'Work'
    575       ClientHeight = 630
    576       ClientWidth = 961
     575      ClientHeight = 628
     576      ClientWidth = 959
    577577      OnHide = TabSheetWorkHide
    578578      OnShow = TabSheetWorkShow
    579579      object EditOrganization: TEdit
    580580        Left = 173
    581         Height = 33
     581        Height = 42
    582582        Top = 64
    583583        Width = 254
     
    587587      object LabelOrganization: TLabel
    588588        Left = 10
    589         Height = 25
     589        Height = 24
    590590        Top = 70
    591         Width = 106
     591        Width = 114
    592592        Caption = 'Organization:'
    593593        ParentColor = False
     
    596596      object LabelOrganization1: TLabel
    597597        Left = 451
    598         Height = 25
     598        Height = 24
    599599        Top = 24
    600         Width = 99
     600        Width = 106
    601601        Caption = 'Department:'
    602602        ParentColor = False
     
    605605      object EditDepartment: TEdit
    606606        Left = 608
    607         Height = 33
     607        Height = 42
    608608        Top = 20
    609609        Width = 254
     
    613613      object Label18: TLabel
    614614        Left = 10
    615         Height = 25
     615        Height = 24
    616616        Top = 20
    617         Width = 36
     617        Width = 41
    618618        Caption = 'Title:'
    619619        ParentColor = False
     
    622622      object EditTitle: TEdit
    623623        Left = 173
    624         Height = 33
     624        Height = 42
    625625        Top = 16
    626626        Width = 254
     
    630630      object EditWorkWeb: TEdit
    631631        Left = 173
    632         Height = 33
     632        Height = 42
    633633        Top = 256
    634634        Width = 683
     
    638638      object Label32: TLabel
    639639        Left = 10
    640         Height = 25
     640        Height = 24
    641641        Top = 264
    642         Width = 107
     642        Width = 114
    643643        Caption = 'Web address:'
    644644        ParentColor = False
     
    651651        Width = 911
    652652        Caption = 'Address'
    653         ClientHeight = 217
    654         ClientWidth = 907
     653        ClientHeight = 220
     654        ClientWidth = 909
    655655        TabOrder = 4
    656656        object Label31: TLabel
    657657          Left = 10
    658           Height = 25
     658          Height = 24
    659659          Top = 160
    660           Width = 67
     660          Width = 71
    661661          Caption = 'Country:'
    662662          ParentColor = False
     
    665665        object EditAddressWorkCountry: TEdit
    666666          Left = 173
    667           Height = 33
     667          Height = 42
    668668          Top = 160
    669669          Width = 254
     
    673673        object EditAddressWorkRegion: TEdit
    674674          Left = 173
    675           Height = 33
     675          Height = 42
    676676          Top = 112
    677677          Width = 254
     
    681681        object Label30: TLabel
    682682          Left = 10
    683           Height = 25
     683          Height = 24
    684684          Top = 112
    685           Width = 59
     685          Width = 64
    686686          Caption = 'Region:'
    687687          ParentColor = False
     
    690690        object Label35: TLabel
    691691          Left = 10
    692           Height = 25
     692          Height = 24
    693693          Top = 66
    694           Width = 126
     694          Width = 137
    695695          Caption = 'Extended street:'
    696696          ParentColor = False
     
    699699        object EditAddressWorkStreetExtended: TEdit
    700700          Left = 173
    701           Height = 33
     701          Height = 42
    702702          Top = 64
    703703          Width = 254
     
    707707        object Label28: TLabel
    708708          Left = 10
    709           Height = 25
     709          Height = 24
    710710          Top = 18
    711           Width = 49
     711          Width = 54
    712712          Caption = 'Street:'
    713713          ParentColor = False
     
    716716        object EditAddressWorkStreet: TEdit
    717717          Left = 173
    718           Height = 33
     718          Height = 42
    719719          Top = 8
    720720          Width = 254
     
    724724        object Label34: TLabel
    725725          Left = 451
    726           Height = 25
     726          Height = 24
    727727          Top = 18
    728           Width = 122
     728          Width = 131
    729729          Caption = 'Post office box:'
    730730          ParentColor = False
     
    733733        object EditAddressWorkPostOfficeBox: TEdit
    734734          Left = 608
    735           Height = 33
     735          Height = 42
    736736          Top = 8
    737737          Width = 254
     
    741741        object EditAddressWorkCity: TEdit
    742742          Left = 608
    743           Height = 33
     743          Height = 42
    744744          Top = 56
    745745          Width = 254
     
    749749        object Label29: TLabel
    750750          Left = 451
    751           Height = 25
     751          Height = 24
    752752          Top = 64
    753           Width = 34
     753          Width = 36
    754754          Caption = 'City:'
    755755          ParentColor = False
     
    758758        object EditAddressWorkPostalCode: TEdit
    759759          Left = 608
    760           Height = 33
     760          Height = 42
    761761          Top = 142
    762762          Width = 254
     
    766766        object Label33: TLabel
    767767          Left = 451
    768           Height = 25
     768          Height = 24
    769769          Top = 150
    770           Width = 95
     770          Width = 103
    771771          Caption = 'Postal code:'
    772772          ParentColor = False
     
    776776      object Label15: TLabel
    777777        Left = 10
    778         Height = 25
     778        Height = 24
    779779        Top = 116
    780         Width = 54
     780        Width = 59
    781781        Caption = 'Phone:'
    782782        ParentColor = False
     
    785785      object EditWorkPhone: TEdit
    786786        Left = 173
    787         Height = 33
     787        Height = 42
    788788        Top = 112
    789789        Width = 254
     
    793793      object Label16: TLabel
    794794        Left = 451
    795         Height = 25
     795        Height = 24
    796796        Top = 112
    797         Width = 29
     797        Width = 34
    798798        Caption = 'Fax:'
    799799        ParentColor = False
     
    802802      object EditWorkFax: TEdit
    803803        Left = 608
    804         Height = 33
     804        Height = 42
    805805        Top = 112
    806806        Width = 254
     
    810810      object EditWorkPager: TEdit
    811811        Left = 608
    812         Height = 33
     812        Height = 42
    813813        Top = 156
    814814        Width = 254
     
    818818      object Label17: TLabel
    819819        Left = 448
    820         Height = 25
     820        Height = 24
    821821        Top = 160
    822         Width = 48
     822        Width = 54
    823823        Caption = 'Pager:'
    824824        ParentColor = False
     
    827827      object EditWorkMobile: TEdit
    828828        Left = 173
    829         Height = 33
     829        Height = 42
    830830        Top = 160
    831831        Width = 254
     
    835835      object Label19: TLabel
    836836        Left = 10
    837         Height = 25
     837        Height = 24
    838838        Top = 160
    839         Width = 59
     839        Width = 63
    840840        Caption = 'Mobile:'
    841841        ParentColor = False
     
    844844      object Label8: TLabel
    845845        Left = 10
    846         Height = 25
     846        Height = 24
    847847        Top = 210
    848         Width = 53
     848        Width = 58
    849849        Caption = 'E-mail:'
    850850        ParentColor = False
     
    853853      object EditWorkEmail: TEdit
    854854        Left = 173
    855         Height = 33
     855        Height = 42
    856856        Top = 210
    857857        Width = 254
     
    13351335    Left = 144
    13361336    Height = 37
    1337     Top = 686
     1337    Top = 688
    13381338    Width = 115
    13391339    Anchors = [akLeft, akBottom]
  • trunk/Forms/UFormContact.pas

    r71 r77  
    206206  private
    207207    FContact: TContact;
    208     FOnNext: TNotifyEvent;
    209     FOnPrevious: TNotifyEvent;
     208    FOnGetNext: TGetContactEvent;
     209    FOnGetPrevious: TGetContactEvent;
    210210    FormProperties: TFormProperties;
    211211    procedure SetContact(AValue: TContact);
     
    216216    procedure UpdateInterface;
    217217    property Contact: TContact read FContact write SetContact;
    218     property OnPrevious: TNotifyEvent read FOnPrevious write FOnPrevious;
    219     property OnNext: TNotifyEvent read FOnNext write FOnNext;
     218    property OnGetPrevious: TGetContactEvent read FOnGetPrevious write FOnGetPrevious;
     219    property OnGetNext: TGetContactEvent read FOnGetNext write FOnGetNext;
    220220  end;
    221221
     
    654654procedure TFormContact.ButtonNextClick(Sender: TObject);
    655655begin
    656   if Assigned(FOnNext) then FOnNext(Self);
     656  if Assigned(FOnGetNext) then
     657     Contact := FOnGetNext(Contact);
    657658end;
    658659
     
    679680procedure TFormContact.ButtonPreviousClick(Sender: TObject);
    680681begin
    681   if Assigned(FOnPrevious) then FOnPrevious(Self);
     682  if Assigned(FOnGetPrevious) then
     683    Contact := FOnGetPrevious(Contact);
    682684end;
    683685
     
    699701  APhotoSave.Enabled := ProfilePhotoActive;
    700702  APhotoClear.Enabled := ProfilePhotoActive;
     703  //ButtonNext.Enabled := Assigned(FOnGetNext) and Assigned(FOnGetNext(Contact));
     704  //ButtonPrevious.Enabled := Assigned(FOnGetPrevious) and Assigned(FOnGetPrevious(Contact));
    701705end;
    702706
  • trunk/Forms/UFormContacts.pas

    r76 r77  
    8080    procedure FilterList(List: TFPGObjectList<TObject>);
    8181    procedure SetContacts(AValue: TContacts);
    82     procedure FormContactPrevious(Sender: TObject);
    83     procedure FormContactNext(Sender: TObject);
     82    function GetPreviousContact(Contact: TContact): TContact;
     83    function GetNextContact(Contact: TContact): TContact;
    8484    procedure DoUpdateInterface;
    8585    procedure UpdateColumns;
     
    234234end;
    235235
    236 procedure TFormContacts.FormContactPrevious(Sender: TObject);
    237 var
    238   I: Integer;
    239 begin
    240   I := ListViewSort1.List.IndexOf(TFormContact(Sender).Contact);
     236function TFormContacts.GetPreviousContact(Contact: TContact): TContact;
     237var
     238  I: Integer;
     239begin
     240  I := ListViewSort1.List.IndexOf(Contact);
    241241  if (I <> -1) and (I > 0) then
    242     TFormContact(Sender).Contact := TContact(ListViewSort1.List[I - 1]);
    243 end;
    244 
    245 procedure TFormContacts.FormContactNext(Sender: TObject);
    246 var
    247   I: Integer;
    248 begin
    249   I := ListViewSort1.List.IndexOf(TFormContact(Sender).Contact);
     242    Result := TContact(ListViewSort1.List[I - 1])
     243    else Result := nil;
     244end;
     245
     246function TFormContacts.GetNextContact(Contact: TContact): TContact;
     247var
     248  I: Integer;
     249begin
     250  I := ListViewSort1.List.IndexOf(Contact);
    250251  if (I <> -1) and (I < ListViewSort1.List.Count - 1) then
    251     TFormContact(Sender).Contact := TContact(ListViewSort1.List[I + 1]);
     252    Result := TContact(ListViewSort1.List[I + 1])
     253    else Result := nil;
    252254end;
    253255
     
    312314      Contact.Parent := Contacts.ContactsFile;
    313315      FormContact.Contact := Contact;
    314       FormContact.OnPrevious := FormContactPrevious;
    315       FormContact.OnNext := FormContactNext;
     316      FormContact.OnGetPrevious := GetPreviousContact;
     317      FormContact.OnGetNext := GetNextContact;
    316318      if FormContact.ShowModal = mrOK then begin
    317319        Contacts.Add(Contact);
     
    342344      Contact.Assign(TContact(ListView1.Selected.Data));
    343345      FormContact.Contact := Contact;
    344       FormContact.OnPrevious := FormContactPrevious;
    345       FormContact.OnNext := FormContactNext;
     346      FormContact.OnGetPrevious := GetPreviousContact;
     347      FormContact.OnGetNext := GetNextContact;
    346348      if FormContact.ShowModal = mrOK then begin
    347349        Contacts.Add(Contact);
     
    443445      Contact.Assign(TContact(ListView1.Selected.Data));
    444446      FormContact.Contact := Contact;
    445       FormContact.OnPrevious := FormContactPrevious;
    446       FormContact.OnNext := FormContactNext;
     447      FormContact.OnGetPrevious := GetPreviousContact;
     448      FormContact.OnGetNext := GetNextContact;
    447449      if FormContact.ShowModal = mrOK then begin
    448450        TContact(ListView1.Selected.Data).Assign(Contact);
  • trunk/Languages/vCardStudio.cs.po

    r76 r77  
    12491249msgid "Invalid line length for encoded text"
    12501250msgstr "Neplatná délka řádky kódovaného textu"
     1251
  • trunk/UContact.pas

    r76 r77  
    119119  TContact = class
    120120  private
     121    FModified: Boolean;
     122    FOnModify: TNotifyEvent;
    121123    function GetField(Index: TContactFieldIndex): string;
    122124    procedure SetField(Index: TContactFieldIndex; AValue: string);
     125    procedure SetModified(AValue: Boolean);
     126    procedure DoOnModify;
    123127  public
    124128    Properties: TContactProperties;
     
    137141    procedure LoadFromFile(FileName: string);
    138142    property Fields[Index: TContactFieldIndex]: string read GetField write SetField;
    139   end;
     143    property Modified: Boolean read FModified write SetModified;
     144    property OnModify: TNotifyEvent read FOnModify write FOnModify;
     145  end;
     146
     147  TGetContactEvent = function (Contact: TContact): TContact of object;
    140148
    141149  { TContacts }
     
    850858      end;
    851859    end;
     860    Modified := True;
    852861  end else raise Exception.Create(SFieldIndexNotDefined);
     862end;
     863
     864procedure TContact.SetModified(AValue: Boolean);
     865begin
     866  if FModified = AValue then Exit;
     867  FModified := AValue;
     868  DoOnModify;
     869end;
     870
     871procedure TContact.DoOnModify;
     872begin
     873  if Assigned(FOnModify) then FOnModify(Self);
    853874end;
    854875
     
    903924begin
    904925  Properties.Assign(Source.Properties);
     926  FModified := Source.FModified;
    905927end;
    906928
Note: See TracChangeset for help on using the changeset viewer.