tvplanit: Fix sqlite3 and firebird datastores crashing due to non-specified database names. Fix double-click in VpWeekView to use correct date. Fix some compilation issues of demos.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6791 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-01-15 22:14:01 +00:00
parent 5a8f764b4e
commit 5514aca70f
10 changed files with 50 additions and 56 deletions

View File

@ -6,5 +6,4 @@ Login parameters for the created database:
password: masterkey password: masterkey
NOTE: NOTE:
The project creates a new database on the fly using above-menitoned login The project creates a new database on the fly using these login parameters.
parameters.

View File

@ -8,22 +8,22 @@ object Form1: TForm1
ClientWidth = 895 ClientWidth = 895
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
LCLVersion = '1.6.0.4' LCLVersion = '2.1.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 43 Height = 33
Top = 0 Top = 0
Width = 895 Width = 895
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 43 ClientHeight = 33
ClientWidth = 895 ClientWidth = 895
TabOrder = 0 TabOrder = 0
object VpResourceCombo1: TVpResourceCombo object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
Left = 4 Left = 4
Height = 33 Height = 23
Top = 5 Top = 5
Width = 208 Width = 208
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
@ -36,9 +36,9 @@ object Form1: TForm1
AnchorSideLeft.Control = VpResourceCombo1 AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
Left = 216 Left = 216
Height = 35 Height = 25
Top = 4 Top = 4
Width = 133 Width = 98
AutoSize = True AutoSize = True
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 4 BorderSpacing.Top = 4
@ -50,10 +50,10 @@ object Form1: TForm1
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
Left = 353 Left = 318
Height = 35 Height = 25
Top = 4 Top = 4
Width = 128 Width = 94
AutoSize = True AutoSize = True
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 4 BorderSpacing.Top = 4
@ -65,8 +65,8 @@ object Form1: TForm1
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 643 Height = 653
Top = 43 Top = 33
Width = 895 Width = 895
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alClient Align = alClient
@ -74,11 +74,11 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
ClientHeight = 605 ClientHeight = 625
ClientWidth = 887 ClientWidth = 887
object VpDayView1: TVpDayView object VpDayView1: TVpDayView
Left = 0 Left = 0
Height = 605 Height = 625
Top = 0 Top = 0
Width = 283 Width = 283
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
@ -114,18 +114,18 @@ object Form1: TForm1
end end
object Panel2: TPanel object Panel2: TPanel
Left = 288 Left = 288
Height = 605 Height = 625
Top = 0 Top = 0
Width = 339 Width = 339
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'Panel2' Caption = 'Panel2'
ClientHeight = 605 ClientHeight = 625
ClientWidth = 339 ClientWidth = 339
TabOrder = 1 TabOrder = 1
object VpWeekView1: TVpWeekView object VpWeekView1: TVpWeekView
Left = 0 Left = 0
Height = 359 Height = 379
Top = 0 Top = 0
Width = 339 Width = 339
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
@ -153,7 +153,7 @@ object Form1: TForm1
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
Left = 0 Left = 0
Height = 241 Height = 241
Top = 364 Top = 384
Width = 339 Width = 339
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
@ -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
@ -184,7 +184,7 @@ object Form1: TForm1
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 359 Top = 379
Width = 339 Width = 339
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
@ -192,7 +192,7 @@ object Form1: TForm1
end end
object VpTaskList1: TVpTaskList object VpTaskList1: TVpTaskList
Left = 632 Left = 632
Height = 605 Height = 625
Top = 0 Top = 0
Width = 255 Width = 255
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
@ -220,13 +220,13 @@ object Form1: TForm1
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 627 Left = 627
Height = 605 Height = 625
Top = 0 Top = 0
Width = 5 Width = 5
end end
object Splitter3: TSplitter object Splitter3: TSplitter
Left = 283 Left = 283
Height = 605 Height = 625
Top = 0 Top = 0
Width = 5 Width = 5
end end
@ -280,7 +280,7 @@ object Form1: TForm1
top = 264 top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.05' Version = 'v1.12'
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@ -295,7 +295,6 @@ object Form1: TForm1
Active = False Active = False
Action = caCommitRetaining Action = caCommitRetaining
Database = IBConnection1 Database = IBConnection1
Options = []
left = 256 left = 256
top = 120 top = 120
end end
@ -326,7 +325,7 @@ object Form1: TForm1
PlayEventSounds = True PlayEventSounds = True
Connection = IBConnection1 Connection = IBConnection1
AutoConnect = False AutoConnect = False
AutoCreate = True AutoCreate = False
DayBuffer = 31 DayBuffer = 31
left = 136 left = 136
top = 200 top = 200
@ -334,15 +333,14 @@ object Form1: TForm1
object IBConnection1: TIBConnection object IBConnection1: TIBConnection
Connected = False Connected = False
LoginPrompt = False LoginPrompt = False
KeepConnection = True KeepConnection = False
Transaction = SQLTransaction1 Transaction = SQLTransaction1
Options = [] CheckTransactionParams = False
left = 136 left = 136
top = 120 top = 120
end end
object SQLQuery1: TSQLQuery object SQLQuery1: TSQLQuery
FieldDefs = <> FieldDefs = <>
Options = []
Params = <> Params = <>
left = 149 left = 149
top = 512 top = 512

View File

@ -576,7 +576,6 @@ object Form1: TForm1
DeleteSQL.Strings = ( DeleteSQL.Strings = (
'' ''
) )
Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit]
Params = <> Params = <>
left = 136 left = 136
top = 428 top = 428
@ -771,7 +770,6 @@ object Form1: TForm1
DeleteSQL.Strings = ( DeleteSQL.Strings = (
'' ''
) )
Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit]
Params = <> Params = <>
left = 136 left = 136
top = 496 top = 496
@ -879,7 +877,6 @@ object Form1: TForm1
DeleteSQL.Strings = ( DeleteSQL.Strings = (
'' ''
) )
Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit]
Params = <> Params = <>
left = 136 left = 136
top = 560 top = 560
@ -950,7 +947,6 @@ object Form1: TForm1
DeleteSQL.Strings = ( DeleteSQL.Strings = (
'' ''
) )
Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit]
Params = <> Params = <>
left = 136 left = 136
top = 621 top = 621

View File

@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '2.1.0.0' LCLVersion = '2.0.0.3'
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 = TabSheet2 ActivePage = TabSheet1
Align = alClient Align = alClient
TabIndex = 1 TabIndex = 0
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
@ -283,17 +283,13 @@ object Form1: TForm1
end end
object VpControlLink1: TVpControlLink object VpControlLink1: TVpControlLink
DataStore = VpXmlDatastore1 DataStore = VpXmlDatastore1
Printer.BottomMargin = 0
Printer.DayStart = h_08 Printer.DayStart = h_08
Printer.DayEnd = h_05 Printer.DayEnd = h_05
Printer.Granularity = gr30Min Printer.Granularity = gr30Min
Printer.LeftMargin = 0
Printer.MarginUnits = imAbsolutePixel Printer.MarginUnits = imAbsolutePixel
Printer.PrintFormats = <> Printer.PrintFormats = <>
Printer.RightMargin = 0 Left = 136
Printer.TopMargin = 0 Top = 264
left = 136
top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.12'
@ -304,12 +300,12 @@ object Form1: TForm1
Placement.Left = 10 Placement.Left = 10
Placement.Height = 250 Placement.Height = 250
Placement.Width = 400 Placement.Width = 400
left = 136 Left = 136
top = 335 Top = 335
end end
object PopupMenu1: TPopupMenu object PopupMenu1: TPopupMenu
left = 129 Left = 129
top = 527 Top = 527
end end
object VpXmlDatastore1: TVpXmlDatastore object VpXmlDatastore1: TVpXmlDatastore
CategoryColorMap.Category0.Color = clNavy CategoryColorMap.Category0.Color = clNavy
@ -338,7 +334,7 @@ object Form1: TForm1
PlayEventSounds = True PlayEventSounds = True
AutoConnect = True AutoConnect = True
FileName = 'data.xml' FileName = 'data.xml'
left = 136 Left = 136
top = 202 Top = 202
end end
end end

View File

@ -143,7 +143,7 @@ implementation
uses uses
PropEditUtils, IDEWindowIntf, StrUtils, ImgList, PropEditUtils, IDEWindowIntf, StrUtils, ImgList,
VpConst, VpMisc; {%H-}VpConst, VpMisc;
const const
ITEMS_MARGIN = 2; ITEMS_MARGIN = 2;

View File

@ -285,10 +285,10 @@ type
procedure RefreshTasks; virtual; procedure RefreshTasks; virtual;
procedure RefreshResource; virtual; procedure RefreshResource; virtual;
procedure PurgeResource(Res: TVpResource); virtual; {abstract;} procedure PurgeResource(Res: TVpResource); virtual;
procedure PurgeEvents(Res: TVpResource); virtual; {abstract;} procedure PurgeEvents(Res: TVpResource); virtual;
procedure PurgeContacts(Res: TVpResource); virtual; {abstract;} procedure PurgeContacts(Res: TVpResource); virtual;
procedure PurgeTasks(Res: TVpResource); virtual; {abstract;} procedure PurgeTasks(Res: TVpResource); virtual;
procedure PostEvents; virtual; abstract; procedure PostEvents; virtual; abstract;
procedure PostContacts; virtual; abstract; procedure PostContacts; virtual; abstract;

View File

@ -580,6 +580,8 @@ procedure TVpFirebirdDatastore.SetConnected(const AValue: Boolean);
begin begin
if (AValue = Connected) or (FConnection = nil) or (FConnectLock > 0) then if (AValue = Connected) or (FConnection = nil) or (FConnectLock > 0) then
exit; exit;
if (FConnection.DatabaseName = '') then
exit;
inc(FConnectLock); inc(FConnectLock);
if AValue and AutoCreate then if AValue and AutoCreate then

View File

@ -566,6 +566,9 @@ begin
if (FConnection = nil) or (FConnection.Transaction = nil) then if (FConnection = nil) or (FConnection.Transaction = nil) then
exit; exit;
if FConnection.DatabaseName = '' then
exit;
if AValue = FConnection.Connected then if AValue = FConnection.Connected then
exit; exit;

View File

@ -111,7 +111,7 @@ implementation
uses uses
StrUtils, DateUtils, StrUtils, DateUtils,
VPBase, VpMisc; VpMisc;
const const
ITEMS_DELIMITER = ';'; ITEMS_DELIMITER = ';';

View File

@ -1038,7 +1038,7 @@ begin
else else
if (DataStore.Resource <> nil) then begin if (DataStore.Resource <> nil) then begin
{ otherwise, we must want to create a new event } { otherwise, we must want to create a new event }
StartTime := NextFullHour(Now()); StartTime := NextFullHour(FActiveDate + Time());
// StartTime := trunc(Date) + 0.5; { default to 12:00 noon } // StartTime := trunc(Date) + 0.5; { default to 12:00 noon }
EndTime := StartTime + 30 / MinutesInDay; { StartTime + 30 minutes } EndTime := StartTime + 30 / MinutesInDay; { StartTime + 30 minutes }
ActiveEvent := DataStore.Resource.Schedule.AddEvent( ActiveEvent := DataStore.Resource.Schedule.AddEvent(