tvplanit: Display birthdate in contact edit dialog. Fix localization file not being found if its name contains the wrong path delimiter.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4865 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-29 11:02:25 +00:00
parent 08d356fd9f
commit ae8fecb42d
9 changed files with 77 additions and 23 deletions

View File

@ -626,7 +626,7 @@ object MainForm: TMainForm
end end
object VpControlLink1: TVpControlLink object VpControlLink1: TVpControlLink
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
LocalizationFile = '../../vplocalize.xml' LocalizationFile = '../../source\vplocalize.xml'
Printer.BottomMargin = 0 Printer.BottomMargin = 0
Printer.DayStart = h_08 Printer.DayStart = h_08
Printer.DayEnd = h_05 Printer.DayEnd = h_05

View File

@ -95,6 +95,10 @@ msgstr "Ungültiges Druckformat"
msgid "Invalid trigger handle." msgid "Invalid trigger handle."
msgstr "Ungültiges Trigger-Handle" msgstr "Ungültiges Trigger-Handle"
#: vpsr.rsbirthdatelbl
msgid "Birth date:"
msgstr "Geburtsdatum:"
#: vpsr.rsbrowsererror #: vpsr.rsbrowsererror
msgid "Unable to start web browser. Make sure you have it properly setup on your system." msgid "Unable to start web browser. Make sure you have it properly setup on your system."
msgstr "Web-Browser kann nicht gestartet werden. Bitte stellen Sie sicher, dass er in Ihrem System korrekt eingerichtet ist." msgstr "Web-Browser kann nicht gestartet werden. Bitte stellen Sie sicher, dass er in Ihrem System korrekt eingerichtet ist."
@ -1377,4 +1381,3 @@ msgstr "Unbekannte Achsen-Spezifikation: %s"
#: vpsr.sxmldecnotatbeg #: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element" msgid "The XML declaration must appear before the first element"
msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen." msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen."

View File

@ -85,6 +85,10 @@ msgstr ""
msgid "Invalid trigger handle." msgid "Invalid trigger handle."
msgstr "" msgstr ""
#: vpsr.rsbirthdatelbl
msgid "Birth date:"
msgstr ""
#: vpsr.rsbrowsererror #: vpsr.rsbrowsererror
msgid "Unable to start web browser. Make sure you have it properly setup on your system." msgid "Unable to start web browser. Make sure you have it properly setup on your system."
msgstr "" msgstr ""

View File

@ -95,6 +95,10 @@ msgstr "Не верный формат печати"
msgid "Invalid trigger handle." msgid "Invalid trigger handle."
msgstr "" msgstr ""
#: vpsr.rsbirthdatelbl
msgid "Birth date:"
msgstr ""
#: vpsr.rsbrowsererror #: vpsr.rsbrowsererror
msgid "Unable to start web browser. Make sure you have it properly setup on your system." msgid "Unable to start web browser. Make sure you have it properly setup on your system."
msgstr "Ошибка запуска браузер. Убедитесь в правильности настроек вашей системы." msgstr "Ошибка запуска браузер. Убедитесь в правильности настроек вашей системы."

View File

@ -35,7 +35,7 @@ interface
uses uses
{$IFDEF LCL} {$IFDEF LCL}
LMessages, LCLProc, LCLIntf, LMessages, LCLProc, LCLIntf, LazFileUtils,
{$ELSE} {$ELSE}
Windows, Messages, Windows, Messages,
{$ENDIF} {$ENDIF}
@ -1351,16 +1351,19 @@ end;
{=====} {=====}
procedure TVpControlLink.SetLocalizationFile (const v : string); procedure TVpControlLink.SetLocalizationFile (const v : string);
var
fn: String;
begin begin
if v <> FLocalizationFile then begin if v <> FLocalizationFile then begin
FLocalizationFile := v; FLocalizationFile := v;
if (FLocalizationFile <> '') and if (FLocalizationFile <> '') and not (csDesigning in ComponentState) then
not (csDesigning in ComponentState) then begin begin
if not FileExists (v) then begin fn := ExpandFilename(v);
if not FileExists(fn) then begin
if Assigned(FOnNoLocalizationFile) then if Assigned(FOnNoLocalizationFile) then
FOnNoLocalizationFile (Self, v); FOnNoLocalizationFile(Self, fn);
end else end else
FLocalization.LoadFromFile (FLocalizationFile, False); FLocalization.LoadFromFile(fn, False);
end; end;
end; end;
end; end;

View File

@ -1,13 +1,13 @@
object ContactEditForm: TContactEditForm object ContactEditForm: TContactEditForm
Left = 311 Left = 311
Height = 355 Height = 420
Top = 245 Top = 245
Width = 433 Width = 433
HorzScrollBar.Page = 432 HorzScrollBar.Page = 432
VertScrollBar.Page = 320 VertScrollBar.Page = 320
ActiveControl = tsContacts ActiveControl = tsContacts
Caption = 'ContactEdit' Caption = 'ContactEdit'
ClientHeight = 355 ClientHeight = 420
ClientWidth = 433 ClientWidth = 433
OnCreate = FormCreate OnCreate = FormCreate
OnKeyDown = FormKeyDown OnKeyDown = FormKeyDown
@ -16,7 +16,7 @@ object ContactEditForm: TContactEditForm
LCLVersion = '1.7' LCLVersion = '1.7'
object tsContacts: TPageControl object tsContacts: TPageControl
Left = 0 Left = 0
Height = 314 Height = 379
Top = 0 Top = 0
Width = 433 Width = 433
ActivePage = tabMain ActivePage = tabMain
@ -26,7 +26,7 @@ object ContactEditForm: TContactEditForm
OnChange = tsContactsChange OnChange = tsContactsChange
object tabMain: TTabSheet object tabMain: TTabSheet
Caption = 'RSMasterData' Caption = 'RSMasterData'
ClientHeight = 286 ClientHeight = 351
ClientWidth = 425 ClientWidth = 425
object LastNameLbl: TLabel object LastNameLbl: TLabel
Left = 8 Left = 8
@ -238,7 +238,7 @@ object ContactEditForm: TContactEditForm
end end
object cboxCountry: TComboBox object cboxCountry: TComboBox
Left = 136 Left = 136
Height = 21 Height = 23
Top = 175 Top = 175
Width = 247 Width = 247
ItemHeight = 15 ItemHeight = 15
@ -266,6 +266,32 @@ object ContactEditForm: TContactEditForm
FocusControl = FirstNameEdit FocusControl = FirstNameEdit
ParentColor = False ParentColor = False
end end
object BirthdateEdit: TDateEdit
Left = 136
Height = 23
Top = 280
Width = 120
CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
OKCaption = 'OK'
CancelCaption = 'Cancel'
DateOrder = doNone
ButtonWidth = 23
NumGlyphs = 1
MaxLength = 0
TabOrder = 13
Text = 'BirthdateEdit'
end
object BirthdateLbl: TLabel
Left = 8
Height = 16
Top = 284
Width = 127
Alignment = taRightJustify
AutoSize = False
Caption = 'Birth date'
FocusControl = BirthdateEdit
ParentColor = False
end
end end
object tabContact: TTabSheet object tabContact: TTabSheet
Caption = 'RSContact' Caption = 'RSContact'
@ -477,7 +503,7 @@ object ContactEditForm: TContactEditForm
object pnlBottom: TPanel object pnlBottom: TPanel
Left = 0 Left = 0
Height = 41 Height = 41
Top = 314 Top = 379
Width = 433 Width = 433
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone

View File

@ -41,7 +41,7 @@ uses
SysUtils, SysUtils,
{$IFDEF VERSION6} Variants, {$ENDIF} {$IFDEF VERSION6} Variants, {$ENDIF}
Classes, Graphics, Controls, Forms, Dialogs, VpData, ExtCtrls, StdCtrls, Classes, Graphics, Controls, Forms, Dialogs, VpData, ExtCtrls, StdCtrls,
VpException, VpMisc, VpBase, VpSR, VpDlg, VpBaseDS, ComCtrls, Types; VpException, VpMisc, VpBase, VpSR, VpDlg, VpBaseDS, ComCtrls, EditBtn, Types;
type type
{ forward declarations } { forward declarations }
@ -50,6 +50,8 @@ type
{ TContactEditForm } { TContactEditForm }
TContactEditForm = class(TForm) TContactEditForm = class(TForm)
BirthdateEdit: TDateEdit;
BirthdateLbl: TLabel;
FirstNameEdit: TEdit; FirstNameEdit: TEdit;
FirstNameLbl: TLabel; FirstNameLbl: TLabel;
tsContacts: TPageControl; tsContacts: TPageControl;
@ -191,6 +193,7 @@ begin
CompanyLbl.Caption := RSCompanyLbl; CompanyLbl.Caption := RSCompanyLbl;
PositionLbl.Caption := RSPositionLbl; PositionLbl.Caption := RSPositionLbl;
CategoryLbl.Caption := RSCategoryLbl; CategoryLbl.Caption := RSCategoryLbl;
BirthdateLbl.Caption := RSBirthDateLbl;
EmailLbl.Caption := RSEmail; EmailLbl.Caption := RSEmail;
CustomLbl1.Caption := RSCustom1; CustomLbl1.Caption := RSCustom1;
CustomLbl2.Caption := RSCustom2; CustomLbl2.Caption := RSCustom2;
@ -230,6 +233,7 @@ begin
Contact.Title := TitleEdit.Text; Contact.Title := TitleEdit.Text;
Contact.EMail := EMailEdit.Text; Contact.EMail := EMailEdit.Text;
Contact.Company := CompanyEdit.Text; Contact.Company := CompanyEdit.Text;
Contact.Birthdate := BirthdateEdit.Date;
Contact.Phone1 := Phone1Edit.Text; Contact.Phone1 := Phone1Edit.Text;
Contact.Phone2 := Phone2Edit.Text; Contact.Phone2 := Phone2Edit.Text;
Contact.Phone3 := Phone3Edit.Text; Contact.Phone3 := Phone3Edit.Text;
@ -298,7 +302,9 @@ begin
end; end;
StateEdit.Text := Contact.State; StateEdit.Text := Contact.State;
cboxState.Text := Contact.State; cboxState.Text := Contact.State;
if Contact.Birthdate = 0.0 then
BirthdateEdit.Clear else
BirthdateEdit.Date := Contact.Birthdate;
for pt := Low (TVpPhoneType) to High (TVpPhoneType) do begin for pt := Low (TVpPhoneType) to High (TVpPhoneType) do begin
cboxPhoneLbl1.Items.Add(PhoneLabel(pt)); cboxPhoneLbl1.Items.Add(PhoneLabel(pt));
@ -392,7 +398,7 @@ begin
{ Note: The resizing algorithm is dependent upon the labels having their { Note: The resizing algorithm is dependent upon the labels having their
FocusControl property set to the corresponding edit field or combobox. } FocusControl property set to the corresponding edit field or combobox. }
SetLength(Labels, 11); SetLength(Labels, 12);
Labels[0] := LastNameLbl; Labels[0] := LastNameLbl;
Labels[1] := FirstNameLbl; Labels[1] := FirstNameLbl;
Labels[2] := TitleLbl; Labels[2] := TitleLbl;
@ -404,6 +410,7 @@ begin
Labels[8] := CompanyLbl; Labels[8] := CompanyLbl;
Labels[9] := PositionLbl; Labels[9] := PositionLbl;
Labels[10] := CategoryLbl; Labels[10] := CategoryLbl;
Labels[11] := BirthdateLbl;
LargestLabel := 0; LargestLabel := 0;
for i := Low(Labels) to High(Labels) do for i := Low(Labels) to High(Labels) do
@ -449,7 +456,9 @@ begin
{ Set edit and combo widths } { Set edit and combo widths }
for i:= Low(Labels) to High(Labels) do for i:= Low(Labels) to High(Labels) do
if (Labels[i].FocusControl <> ZipCodeEdit) then if (Labels[i].FocusControl <> ZipCodeEdit) and
(Labels[i].FocusControl <> BirthdateEdit)
then
Labels[i].FocusControl.Width := widestfield; Labels[i].FocusControl.Width := widestfield;
cboxCountry.Width := widestField; cboxCountry.Width := widestField;
cboxState.Width := widestField; cboxState.Width := widestField;
@ -465,7 +474,7 @@ begin
end; end;
{ Set form height such that first tab is filled completely by controls } { Set form height such that first tab is filled completely by controls }
ClientHeight := cboxCategory.Top + cboxCategory.Height + TopField + ClientHeight := BirthdateEdit.Top + BirthdateEdit.Height + TopField +
pnlBottom.Height + tsContacts.Height - tabMain.Height; pnlBottom.Height + tsContacts.Height - tabMain.Height;
{ Page "Contact" } { Page "Contact" }

View File

@ -37,7 +37,7 @@ uses
Windows, // Needed for LCIDs Windows, // Needed for LCIDs
{$ENDIF} {$ENDIF}
{$IFDEF LCL} {$IFDEF LCL}
LCLProc, LCLType, LCLIntf, LCLProc, LCLType, LCLIntf, LazFileUtils,
{$ENDIF} {$ENDIF}
Classes, Dialogs,SysUtils, Graphics, StdCtrls, Forms, Classes, Dialogs,SysUtils, Graphics, StdCtrls, Forms,
VpBase, VpMisc, VpData, VpXParsr, VpPrtFmt; { For TVpAttributes } VpBase, VpMisc, VpData, VpXParsr, VpPrtFmt; { For TVpAttributes }
@ -596,7 +596,11 @@ begin
Parser.OnStartElement := xmlLocalizeStartElement; Parser.OnStartElement := xmlLocalizeStartElement;
Parser.OnEndElement := xmlLocalizeEndElement; Parser.OnEndElement := xmlLocalizeEndElement;
try try
{$IFDEF DELPHI}
Parser.ParseDataSource(FileName); Parser.ParseDataSource(FileName);
{$ELSE}
Parser.ParseDataSource(GetForcedPathDelims(FileName));
{$ENDIF}
finally finally
Parser.Free; Parser.Free;
end; end;

View File

@ -258,6 +258,7 @@ resourcestring
RSZipCodeLbl = 'Zip code:'; RSZipCodeLbl = 'Zip code:';
RSCompanyLbl = 'Company:'; RSCompanyLbl = 'Company:';
RSPositionLbl = 'Position:'; RSPositionLbl = 'Position:';
RSBirthDateLbl = 'Birth date:';
RSMasterData = 'Master data'; RSMasterData = 'Master data';
{ Print Preview dialog captions } { Print Preview dialog captions }