1 |
(*
|
2 |
* DBLoginDlgUnit.pas
|
3 |
* Copyright (C) 2018 Tony Whyman <tony@mwasoftware.co.uk>
|
4 |
*
|
5 |
* DBAdmin is free software: you can redistribute it and/or modify it
|
6 |
* under the terms of the GNU General Public License as published by the
|
7 |
* Free Software Foundation, either version 3 of the License, or
|
8 |
* (at your option) any later version.
|
9 |
*
|
10 |
* DBAdmin is distributed in the hope that it will be useful, but
|
11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
13 |
* See the GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License along
|
16 |
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*)
|
18 |
unit DBLoginDlgUnit;
|
19 |
|
20 |
{$mode objfpc}{$H+}
|
21 |
|
22 |
interface
|
23 |
|
24 |
uses
|
25 |
{$IFDEF WINDOWS }
|
26 |
Windows,
|
27 |
{$ELSE}
|
28 |
unix,
|
29 |
{$ENDIF}
|
30 |
SysUtils, Classes, Graphics, Controls, Dialogs,
|
31 |
Forms, StdCtrls, ExtCtrls, Buttons, IB, IBDialogs;
|
32 |
|
33 |
type
|
34 |
{ TDBLoginDlg }
|
35 |
|
36 |
TDBLoginDlg = class(TForm)
|
37 |
Bevel1: TBevel;
|
38 |
Button1: TButton;
|
39 |
Button2: TButton;
|
40 |
CreateIfNotExist: TCheckBox;
|
41 |
Label1: TLabel;
|
42 |
TargetCaption: TLabel;
|
43 |
Label2: TLabel;
|
44 |
Label3: TLabel;
|
45 |
Password: TEdit;
|
46 |
UserName: TEdit;
|
47 |
DatabaseName: TEdit;
|
48 |
private
|
49 |
{ private declarations }
|
50 |
public
|
51 |
{ public declarations }
|
52 |
function ShowModal(var aDatabaseName, aUserName, aPassword: string;
|
53 |
var aCreateIfNotExist: boolean): TModalResult;
|
54 |
end;
|
55 |
|
56 |
var DBLoginDlg: TDBLoginDlg;
|
57 |
|
58 |
implementation
|
59 |
|
60 |
{$R *.lfm}
|
61 |
|
62 |
{ TDBLoginDlg }
|
63 |
|
64 |
function TDBLoginDlg.ShowModal(var aDatabaseName, aUserName, aPassword: string;
|
65 |
var aCreateIfNotExist: boolean): TModalResult;
|
66 |
begin
|
67 |
DatabaseName.Text := aDatabaseName;
|
68 |
UserName.Text := aUserName;
|
69 |
Password.Text := '';
|
70 |
CreateIfNotExist.Checked := false;
|
71 |
Result := inherited ShowModal;
|
72 |
if Result = mrOK then
|
73 |
begin
|
74 |
aDatabaseName := DatabaseName.Text;
|
75 |
aUserName := UserName.Text;
|
76 |
aPassword := Password.Text;
|
77 |
aCreateIfNotExist := CreateIfNotExist.Checked;
|
78 |
end;
|
79 |
end;
|
80 |
|
81 |
|
82 |
end.
|