Check-in [64b934fa0b]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:
* If the program is already running, don't launch a second instance but activate the first; * If Shift is pressed during shutdown, no line '(closed)' is added.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 64b934fa0b9df2adeb323458c690e083472f3af1
User & Date: MCO 2011-05-05 09:02:45
Context
2011-05-05
12:21
Added week numbers to the date picker; also, dates that have some info are shown in bold (doesn't work after switching months, though) check-in: 17cbddfd91 user: MCO tags: trunk
09:02
* If the program is already running, don't launch a second instance but activate the first; * If Shift is pressed during shutdown, no line '(closed)' is added.
check-in: 64b934fa0b user: MCO tags: trunk
08:59
* If the program is already running, don't launch a second instance but activate the first; * If Shift is pressed during shutdown, no line '(closed)' is added. check-in: c982850919 user: MCO tags: trunk
Changes

Changes to src/F_Entry.pas.

33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
...
332
333
334
335
336
337
338
339




















340
    function  SQLDateToStr(Date: TDateTime): string;
    function  SQLDateTimeToStr(Date: TDateTime): string;
    procedure SetDate(NewDate: TDateTime);
    function  AddRow(CurrentDate: TDateTime): Integer;
    procedure SaveGrid(Date: TDateTime);
    procedure LoadGrid(Date: TDateTime);
    procedure InitializeDB;

  public
    { Public declarations }
  end;

var
  frmEntry: TfrmEntry;

implementation
uses
  DateUtils;


{$R *.dfm}

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.FormCreate(Sender: TObject);
var
  Row: Integer;
................................................................................
end;
{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
  Row: Integer;
begin
  if CanClose then begin
    if FDoneLoading then begin
      SetDate(Date);
      Row := AddRow(FActiveDate);
      Grid.Cells[1, Row] := '(overig)';
      Grid.Cells[2, Row] := 'Afgesloten';
      SaveGrid(FActiveDate);
    end;
  end;
................................................................................
  end;
end{TfrmEntry.SaveGrid};

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.LoadGrid(Date: TDateTime);
var
  Cursor: TSQLiteCursor;
  Col, Row: Integer;
begin
  // Clear the grid first
  Grid.RowCount := Grid.FixedRows + 1;
  Row := Grid.FixedRows;
  Grid.Objects[0, Row] := nil;
  for Col := 0 to Grid.ColCount - 1 do begin
    Grid.Cells[Col, Row] := '';
  end;

  // load the data for this day, and put it into the grid
  FLoadQuery.Parameters.Add(':Date', SQLDateToStr(Date));
  Cursor := FDB.GetCursor(FLoadQuery) as TSQLiteCursor;
  try
    while not Cursor.EOF do begin
      Row := AddRow(Date);
................................................................................
                             + ' ORDER BY datetime') as TSQLiteQuery;
  FClearQuery := FDB.PrepareSQL('DELETE FROM Entries'
                              + '      WHERE datetime >= julianday(:Date)'
                              + '        AND datetime < julianday(:Date, "+1 day")') as TSQLiteQuery;
  FSaveQuery := FDB.PrepareSQL('INSERT INTO Entries (datetime, project, activity)'
                             + '     SELECT julianday(:DateTime), :Project, :Activity;') as TSQLiteQuery;
end{TfrmEntry.InitializeDB};





















end.







>









|
>







 







|







 







|

|
<
<
<
<
<
<







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
273
274
275
276
277
278
279
280
281
282






283
284
285
286
287
288
289
...
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
    function  SQLDateToStr(Date: TDateTime): string;
    function  SQLDateTimeToStr(Date: TDateTime): string;
    procedure SetDate(NewDate: TDateTime);
    function  AddRow(CurrentDate: TDateTime): Integer;
    procedure SaveGrid(Date: TDateTime);
    procedure LoadGrid(Date: TDateTime);
    procedure InitializeDB;
    procedure ClearGrid;
  public
    { Public declarations }
  end;

var
  frmEntry: TfrmEntry;

implementation
uses
  DateUtils,
  L_KeysDown;

{$R *.dfm}

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.FormCreate(Sender: TObject);
var
  Row: Integer;
................................................................................
end;
{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
  Row: Integer;
begin
  if CanClose then begin
    if FDoneLoading and not isShiftDown then begin
      SetDate(Date);
      Row := AddRow(FActiveDate);
      Grid.Cells[1, Row] := '(overig)';
      Grid.Cells[2, Row] := 'Afgesloten';
      SaveGrid(FActiveDate);
    end;
  end;
................................................................................
  end;
end{TfrmEntry.SaveGrid};

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.LoadGrid(Date: TDateTime);
var
  Cursor: TSQLiteCursor;
  Row: Integer;
begin
  ClearGrid;







  // load the data for this day, and put it into the grid
  FLoadQuery.Parameters.Add(':Date', SQLDateToStr(Date));
  Cursor := FDB.GetCursor(FLoadQuery) as TSQLiteCursor;
  try
    while not Cursor.EOF do begin
      Row := AddRow(Date);
................................................................................
                             + ' ORDER BY datetime') as TSQLiteQuery;
  FClearQuery := FDB.PrepareSQL('DELETE FROM Entries'
                              + '      WHERE datetime >= julianday(:Date)'
                              + '        AND datetime < julianday(:Date, "+1 day")') as TSQLiteQuery;
  FSaveQuery := FDB.PrepareSQL('INSERT INTO Entries (datetime, project, activity)'
                             + '     SELECT julianday(:DateTime), :Project, :Activity;') as TSQLiteQuery;
end{TfrmEntry.InitializeDB};

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmEntry.ClearGrid;
var
  Row, Col: Integer;
  OldEditorMode: Boolean;
begin
  OldEditorMode := Grid.EditorMode;
  Grid.EditorMode := False;
  for Row := Grid.RowCount - 1 downto Grid.FixedRows do begin
    Grid.Rows[Row].Clear;
  end;
  Grid.RowCount := Grid.FixedRows + 1;
  Row := Grid.FixedRows;
  Grid.Objects[0, Row] := nil;
  for Col := 0 to Grid.ColCount - 1 do begin
    Grid.Cells[Col, Row] := '';
  end;
  Grid.EditorMode := OldEditorMode;
end{TfrmEntry.ClearGrid};

end.

Changes to src/prj/D2010/Olam.dpr.

1
2
3
4
5


6
7
8
9

10
11
12
13
14

15
program Olam;

uses
  Forms,
  F_Entry in '..\..\F_Entry.pas' {frmEntry};



{$R *.res}

begin

  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.Title := 'Olam';
  Application.CreateForm(TfrmEntry, frmEntry);
  Application.Run;

end.




|
>
>




>
|
|
|
|
|
>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
program Olam;

uses
  Forms,
  F_Entry in '..\..\F_Entry.pas' {frmEntry},
  L_KeysDown in '..\..\lib\L_KeysDown.pas',
  CheckPrevious in '..\..\lib\CheckPrevious.pas';

{$R *.res}

begin
  if not RestoreIfRunning(Application.Handle) then begin
    Application.Initialize;
    Application.MainFormOnTaskbar := True;
    Application.Title := 'Olam';
    Application.CreateForm(TfrmEntry, frmEntry);
    Application.Run;
  end;
end.

Changes to src/prj/D2010/Olam.dproj.

46
47
48
49
50
51
52


53
54
55
56
57
58
59
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
		<ItemGroup>
			<DelphiCompile Include="Olam.dpr">
				<MainSource>MainSource</MainSource>
			</DelphiCompile>
			<DCCReference Include="..\..\F_Entry.pas">
				<Form>frmEntry</Form>
			</DCCReference>


			<BuildConfiguration Include="Base">
				<Key>Base</Key>
			</BuildConfiguration>
			<BuildConfiguration Include="Debug">
				<Key>Cfg_2</Key>
				<CfgParent>Base</CfgParent>
			</BuildConfiguration>
................................................................................
					</Parameters>
					<VersionInfo>
						<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
						<VersionInfo Name="AutoIncBuild">True</VersionInfo>
						<VersionInfo Name="MajorVer">1</VersionInfo>
						<VersionInfo Name="MinorVer">0</VersionInfo>
						<VersionInfo Name="Release">0</VersionInfo>
						<VersionInfo Name="Build">2</VersionInfo>
						<VersionInfo Name="Debug">False</VersionInfo>
						<VersionInfo Name="PreRelease">False</VersionInfo>
						<VersionInfo Name="Special">False</VersionInfo>
						<VersionInfo Name="Private">True</VersionInfo>
						<VersionInfo Name="DLL">False</VersionInfo>
						<VersionInfo Name="Locale">1043</VersionInfo>
						<VersionInfo Name="CodePage">1252</VersionInfo>
					</VersionInfo>
					<VersionInfoKeys>
						<VersionInfoKeys Name="CompanyName">Martijn Coppoolse</VersionInfoKeys>
						<VersionInfoKeys Name="FileDescription">Olam Work registration helper</VersionInfoKeys>
						<VersionInfoKeys Name="FileVersion">1.0.0.2</VersionInfoKeys>
						<VersionInfoKeys Name="InternalName">Olam</VersionInfoKeys>
						<VersionInfoKeys Name="LegalCopyright"/>
						<VersionInfoKeys Name="LegalTrademarks"/>
						<VersionInfoKeys Name="OriginalFilename"/>
						<VersionInfoKeys Name="ProductName"/>
						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
						<VersionInfoKeys Name="Comments"/>







>
>







 







|











|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		<ItemGroup>
			<DelphiCompile Include="Olam.dpr">
				<MainSource>MainSource</MainSource>
			</DelphiCompile>
			<DCCReference Include="..\..\F_Entry.pas">
				<Form>frmEntry</Form>
			</DCCReference>
			<DCCReference Include="..\..\lib\L_KeysDown.pas"/>
			<DCCReference Include="..\..\lib\CheckPrevious.pas"/>
			<BuildConfiguration Include="Base">
				<Key>Base</Key>
			</BuildConfiguration>
			<BuildConfiguration Include="Debug">
				<Key>Cfg_2</Key>
				<CfgParent>Base</CfgParent>
			</BuildConfiguration>
................................................................................
					</Parameters>
					<VersionInfo>
						<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
						<VersionInfo Name="AutoIncBuild">True</VersionInfo>
						<VersionInfo Name="MajorVer">1</VersionInfo>
						<VersionInfo Name="MinorVer">0</VersionInfo>
						<VersionInfo Name="Release">0</VersionInfo>
						<VersionInfo Name="Build">5</VersionInfo>
						<VersionInfo Name="Debug">False</VersionInfo>
						<VersionInfo Name="PreRelease">False</VersionInfo>
						<VersionInfo Name="Special">False</VersionInfo>
						<VersionInfo Name="Private">True</VersionInfo>
						<VersionInfo Name="DLL">False</VersionInfo>
						<VersionInfo Name="Locale">1043</VersionInfo>
						<VersionInfo Name="CodePage">1252</VersionInfo>
					</VersionInfo>
					<VersionInfoKeys>
						<VersionInfoKeys Name="CompanyName">Martijn Coppoolse</VersionInfoKeys>
						<VersionInfoKeys Name="FileDescription">Olam Work registration helper</VersionInfoKeys>
						<VersionInfoKeys Name="FileVersion">1.0.0.5</VersionInfoKeys>
						<VersionInfoKeys Name="InternalName">Olam</VersionInfoKeys>
						<VersionInfoKeys Name="LegalCopyright"/>
						<VersionInfoKeys Name="LegalTrademarks"/>
						<VersionInfoKeys Name="OriginalFilename"/>
						<VersionInfoKeys Name="ProductName"/>
						<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
						<VersionInfoKeys Name="Comments"/>

Changes to src/prj/D2010/Olam.res.

cannot compute difference between binary files