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
object VpControlLink1: TVpControlLink
DataStore = VpBufDSDataStore1
LocalizationFile = '../../vplocalize.xml'
LocalizationFile = '../../source\vplocalize.xml'
Printer.BottomMargin = 0
Printer.DayStart = h_08
Printer.DayEnd = h_05

View File

@ -95,6 +95,10 @@ msgstr "Ungültiges Druckformat"
msgid "Invalid trigger handle."
msgstr "Ungültiges Trigger-Handle"
#: vpsr.rsbirthdatelbl
msgid "Birth date:"
msgstr "Geburtsdatum:"
#: vpsr.rsbrowsererror
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."
@ -1377,4 +1381,3 @@ msgstr "Unbekannte Achsen-Spezifikation: %s"
#: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element"
msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen."

View File

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

View File

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

View File

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

View File

@ -1,13 +1,13 @@
object ContactEditForm: TContactEditForm
Left = 311
Height = 355
Height = 420
Top = 245
Width = 433
HorzScrollBar.Page = 432
VertScrollBar.Page = 320
ActiveControl = tsContacts
Caption = 'ContactEdit'
ClientHeight = 355
ClientHeight = 420
ClientWidth = 433
OnCreate = FormCreate
OnKeyDown = FormKeyDown
@ -16,7 +16,7 @@ object ContactEditForm: TContactEditForm
LCLVersion = '1.7'
object tsContacts: TPageControl
Left = 0
Height = 314
Height = 379
Top = 0
Width = 433
ActivePage = tabMain
@ -26,7 +26,7 @@ object ContactEditForm: TContactEditForm
OnChange = tsContactsChange
object tabMain: TTabSheet
Caption = 'RSMasterData'
ClientHeight = 286
ClientHeight = 351
ClientWidth = 425
object LastNameLbl: TLabel
Left = 8
@ -238,7 +238,7 @@ object ContactEditForm: TContactEditForm
end
object cboxCountry: TComboBox
Left = 136
Height = 21
Height = 23
Top = 175
Width = 247
ItemHeight = 15
@ -266,6 +266,32 @@ object ContactEditForm: TContactEditForm
FocusControl = FirstNameEdit
ParentColor = False
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
object tabContact: TTabSheet
Caption = 'RSContact'
@ -477,7 +503,7 @@ object ContactEditForm: TContactEditForm
object pnlBottom: TPanel
Left = 0
Height = 41
Top = 314
Top = 379
Width = 433
Align = alBottom
BevelOuter = bvNone

View File

@ -41,7 +41,7 @@ uses
SysUtils,
{$IFDEF VERSION6} Variants, {$ENDIF}
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
{ forward declarations }
@ -50,6 +50,8 @@ type
{ TContactEditForm }
TContactEditForm = class(TForm)
BirthdateEdit: TDateEdit;
BirthdateLbl: TLabel;
FirstNameEdit: TEdit;
FirstNameLbl: TLabel;
tsContacts: TPageControl;
@ -191,6 +193,7 @@ begin
CompanyLbl.Caption := RSCompanyLbl;
PositionLbl.Caption := RSPositionLbl;
CategoryLbl.Caption := RSCategoryLbl;
BirthdateLbl.Caption := RSBirthDateLbl;
EmailLbl.Caption := RSEmail;
CustomLbl1.Caption := RSCustom1;
CustomLbl2.Caption := RSCustom2;
@ -230,6 +233,7 @@ begin
Contact.Title := TitleEdit.Text;
Contact.EMail := EMailEdit.Text;
Contact.Company := CompanyEdit.Text;
Contact.Birthdate := BirthdateEdit.Date;
Contact.Phone1 := Phone1Edit.Text;
Contact.Phone2 := Phone2Edit.Text;
Contact.Phone3 := Phone3Edit.Text;
@ -298,7 +302,9 @@ begin
end;
StateEdit.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
cboxPhoneLbl1.Items.Add(PhoneLabel(pt));
@ -392,7 +398,7 @@ begin
{ Note: The resizing algorithm is dependent upon the labels having their
FocusControl property set to the corresponding edit field or combobox. }
SetLength(Labels, 11);
SetLength(Labels, 12);
Labels[0] := LastNameLbl;
Labels[1] := FirstNameLbl;
Labels[2] := TitleLbl;
@ -404,6 +410,7 @@ begin
Labels[8] := CompanyLbl;
Labels[9] := PositionLbl;
Labels[10] := CategoryLbl;
Labels[11] := BirthdateLbl;
LargestLabel := 0;
for i := Low(Labels) to High(Labels) do
@ -449,7 +456,9 @@ begin
{ Set edit and combo widths }
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;
cboxCountry.Width := widestField;
cboxState.Width := widestField;
@ -465,7 +474,7 @@ begin
end;
{ 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;
{ Page "Contact" }

View File

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

View File

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