You've already forked lazarus-ccr
tvplanit: New TVpControlLink property CityStateZip defining the country-dependant order and structure of the city-state-zip part of the address.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4866 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -358,11 +358,13 @@ type
|
||||
FLocalization : TVpLocalization;
|
||||
FLocalizationFile : string;
|
||||
FDefaultCountry : string;
|
||||
FCityStateZipFormat: String;
|
||||
protected{private}
|
||||
DependentList: TList;
|
||||
procedure Attach (Sender : TComponent);
|
||||
procedure Detach (Sender : TComponent);
|
||||
procedure ReleaseDependents;
|
||||
procedure SetCityStateZipFormat(const Value: String);
|
||||
procedure SetDataStore (const Value : TVpCustomDataStore);
|
||||
procedure SetDefaultCountry (const v : string);
|
||||
procedure SetLocalizationFile (const v : string);
|
||||
@ -378,6 +380,8 @@ type
|
||||
procedure TriggerOnPageStart (Sender: TObject; PageNum: Integer; ADate: TDateTime);
|
||||
property Localization : TVpLocalization read FLocalization write FLocalization;
|
||||
published
|
||||
property CityStateZipFormat: String read FCityStateZipFormat write SetCityStateZipFormat;
|
||||
// Use symbols @CITY, @STATE, @ZIP to define the order of these strings
|
||||
property DataStore: TVpCustomDataStore read FDataStore write SetDataStore;
|
||||
property DefaultCountry : string read FDefaultCountry write SetDefaultCountry;
|
||||
property LocalizationFile : string read FLocalizationFile write SetLocalizationFile;
|
||||
@ -1336,6 +1340,12 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpControlLink.SetCityStateZipFormat(const Value: String);
|
||||
begin
|
||||
if FCityStateZipFormat <> Value then
|
||||
FCityStateZipFormat := Value
|
||||
end;
|
||||
|
||||
procedure TVpControlLink.SetDataStore(const Value: TVpCustomDataStore);
|
||||
begin
|
||||
if FDataStore <> Value then
|
||||
|
@ -216,6 +216,7 @@ type
|
||||
procedure LoadLanguage;
|
||||
procedure LinkHandler(Sender: TComponent;
|
||||
NotificationType: TVpNotificationType; const Value: Variant); override;
|
||||
function GetCityStateZipFormat: String;
|
||||
function GetControlType : TVpItemType; override;
|
||||
procedure DeleteActiveContact(Verify: Boolean);
|
||||
procedure PaintToCanvas (ACanvas: TCanvas; ARect: TRect; Angle: TVpRotationAngle);
|
||||
@ -518,6 +519,13 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TVpContactGrid.GetCityStateZipFormat: String;
|
||||
begin
|
||||
if ControlLink <> nil then
|
||||
Result := ControlLink.CityStateZipFormat else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function TVpContactGrid.GetControlType : TVpItemType;
|
||||
begin
|
||||
Result := itContacts;
|
||||
|
@ -46,6 +46,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
StrUtils,
|
||||
VpCanvasUtils, VpMisc, VpSR;
|
||||
|
||||
type
|
||||
@ -415,15 +416,24 @@ begin
|
||||
DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect);
|
||||
|
||||
{ do City, State, Zip }
|
||||
Str := TmpCon.City;
|
||||
if Str <> '' then
|
||||
Str := Str + ', ' + TmpCon.State
|
||||
else
|
||||
Str := TmpCon.State;
|
||||
if Str <> '' then
|
||||
Str := Str + ' ' + TmpCon.Zip
|
||||
else
|
||||
Str := TmpCon.Zip;
|
||||
str := FContactGrid.GetCityStateZipFormat;
|
||||
if str = '' then
|
||||
begin
|
||||
str := TmpCon.City;
|
||||
if (str <> '') and (TmpCon.State <> '') then
|
||||
Str := Str + ', ' + TmpCon.State;
|
||||
if (str <> '') and (TmpCon.Zip <> '') then
|
||||
Str := Str + ' ' + TmpCon.Zip;
|
||||
end else
|
||||
begin
|
||||
Str := ReplaceStr(Str, '@CITY', TmpCon.City);
|
||||
Str := ReplaceStr(Str, '@STATE', TmpCon.State);
|
||||
Str := ReplaceStr(Str, '@ZIP', TmpCon.Zip);
|
||||
while (Length(Str) > 0) and (Str[1] in [' ', ',', '.']) do
|
||||
Delete(Str, 1, 1);
|
||||
while (Length(Str) > 0) and (Str[Length(Str)] in [' ', ',', '.']) do
|
||||
Delete(Str, Length(Str), 1);
|
||||
end;
|
||||
DrawContactLine(TmpBmp, Str, '', WholeRect, CSZRect);
|
||||
|
||||
{ do Phone1 }
|
||||
|
Reference in New Issue
Block a user