tvplanit: Improved name extraction from vcards. Some improvements in the demos.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6788 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-01-10 10:10:16 +00:00
parent cf33910bec
commit 85af6345aa
6 changed files with 38 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="10"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
@@ -17,9 +17,10 @@
<Version Value="2"/> <Version Value="2"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <FormatVersion Value="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <Mode0 Name="default"/>
</Modes>
</RunParams> </RunParams>
<RequiredPackages Count="4"> <RequiredPackages Count="4">
<Item1> <Item1>
@@ -64,11 +65,6 @@
<Debugging> <Debugging>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking> </Linking>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>

View File

@@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.6.4.0' LCLVersion = '2.1.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 33
@@ -67,9 +67,9 @@ object Form1: TForm1
Height = 653 Height = 653
Top = 33 Top = 33
Width = 980 Width = 980
ActivePage = TabSheet3 ActivePage = TabSheet2
Align = alClient Align = alClient
TabIndex = 2 TabIndex = 1
TabOrder = 1 TabOrder = 1
OnChange = PageControl1Change OnChange = PageControl1Change
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
@@ -161,7 +161,6 @@ object Form1: TForm1
Align = alBottom Align = alBottom
TabStop = True TabStop = True
TabOrder = 1 TabOrder = 1
KBNavigation = True
DateLabelFormat = 'mmmm yyyy' DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
@@ -170,6 +169,7 @@ object Form1: TForm1
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = [] EventDayStyle = []
HeadAttributes.Color = clBtnFace HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed SelectedDayColor = clRed
ShowEvents = True ShowEvents = True
@@ -233,22 +233,24 @@ object Form1: TForm1
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'Contacts' Caption = 'Contacts'
ClientHeight = 594 ClientHeight = 625
ClientWidth = 928 ClientWidth = 972
object VpContactButtonBar1: TVpContactButtonBar object VpContactButtonBar1: TVpContactButtonBar
Left = 0 Left = 0
Height = 594 Height = 625
Top = 0 Top = 0
Width = 40 Width = 40
ContactGrid = VpContactGrid1
DrawingStyle = dsFlat DrawingStyle = dsFlat
RadioStyle = False OnContactNotFound = VpContactButtonBar1ContactNotFound
RadioStyle = True
Align = alLeft Align = alLeft
end end
object VpContactGrid1: TVpContactGrid object VpContactGrid1: TVpContactGrid
Left = 40 Left = 40
Height = 594 Height = 625
Top = 0 Top = 0
Width = 888 Width = 932
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow Color = clWindow
@@ -356,7 +358,7 @@ object Form1: TForm1
top = 264 top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.05' Version = 'v1.12'
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@@ -404,7 +406,6 @@ object Form1: TForm1
LoginPrompt = False LoginPrompt = False
KeepConnection = False KeepConnection = False
Transaction = SQLTransaction1 Transaction = SQLTransaction1
Options = []
left = 136 left = 136
top = 120 top = 120
end end
@@ -412,7 +413,6 @@ object Form1: TForm1
Active = False Active = False
Action = caCommitRetaining Action = caCommitRetaining
Database = SQLite3Connection1 Database = SQLite3Connection1
Options = []
left = 256 left = 256
top = 120 top = 120
end end

View File

@@ -58,6 +58,7 @@ type
procedure QryGridAfterEdit(DataSet: TDataSet); procedure QryGridAfterEdit(DataSet: TDataSet);
procedure QryGridAfterPost(DataSet: TDataSet); procedure QryGridAfterPost(DataSet: TDataSet);
procedure TabControl1Change(Sender: TObject); procedure TabControl1Change(Sender: TObject);
procedure VpContactButtonBar1ContactNotFound(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
@@ -186,5 +187,10 @@ begin
Grid.Columns[i].Width := 100;; Grid.Columns[i].Width := 100;;
end; end;
procedure TForm1.VpContactButtonBar1ContactNotFound(Sender: TObject);
begin
MessageDlg('No matching contact found.', mtInformation, [mbOK], 0);
end;
end. end.

View File

@@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.8.4.0' LCLVersion = '2.1.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 33
@@ -67,9 +67,9 @@ object Form1: TForm1
Height = 653 Height = 653
Top = 33 Top = 33
Width = 980 Width = 980
ActivePage = TabSheet1 ActivePage = TabSheet2
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 1
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
@@ -270,7 +270,7 @@ object Form1: TForm1
Align = alClient Align = alClient
TabStop = True TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True AllowInPlaceEditing = False
BarWidth = 3 BarWidth = 3
BarColor = clSilver BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200

View File

@@ -38,7 +38,7 @@ type
FItemClass: TVpFileItemClass; FItemClass: TVpFileItemClass;
function GetValue(const AKey, Attributes: String): String; function GetValue(const AKey, Attributes: String): String;
protected protected
FItems: TObjectList; FItems: TFPObjectList;
public public
constructor Create(AClass: TVpFileItemClass); constructor Create(AClass: TVpFileItemClass);
destructor Destroy; override; destructor Destroy; override;
@@ -231,7 +231,7 @@ end;
constructor TVpFileBlock.Create(AClass: TVpFileItemClass); constructor TVpFileBlock.Create(AClass: TVpFileItemClass);
begin begin
inherited Create; inherited Create;
FItems := TObjectList.Create; FItems := TFPObjectList.Create;
FItemClass := AClass; FItemClass := AClass;
end; end;

View File

@@ -192,6 +192,7 @@ procedure TVpVCard.Analyze;
var var
i: Integer; i: Integer;
item: TVpVCardItem; item: TVpVCardItem;
fn, ln, t: String;
begin begin
inherited; inherited;
@@ -200,8 +201,13 @@ begin
case item.Key of case item.Key of
'VERSION': 'VERSION':
FVersion := item.Value; FVersion := item.Value;
'FN': 'FN', 'N':
VCardName(item.Value, FLastName, FFirstName, FTitle); begin
VCardName(item.Value, ln, fn, t);
if FLastName = '' then FLastName := ln;
if FFirstName = '' then FFirstName := fn;
if FTitle = '' then FTitle := t;
end;
'ORG': 'ORG':
FCompany := item.Value; FCompany := item.Value;
'ADR': 'ADR':