1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
(*
History++ plugin for Miranda IM: the free IM client for Microsoft* Windows*
Copyright (C) 2006-2009 theMIROn, 2003-2006 Art Fedorov.
History+ parts (C) 2001 Christian Kastner
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
unit PassCheckForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Checksum, ExtCtrls,m_api, hpp_forms,
HistoryControls;
type
TfmPassCheck = class(TForm)
Label1: TLabel;
edPass: TEdit;
bnOK: TButton;
bnCancel: TButton;
Image1: TImage;
Label2: TLabel;
Label3: TLabel;
Bevel1: TBevel;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bnOKClick(Sender: TObject);
procedure bnCancelClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure edPassKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
private
procedure TranslateForm;
{ Private declarations }
public
{ Public declarations }
end;
var
fmPassCheck: TfmPassCheck;
implementation
uses hpp_options, hpp_services, hpp_global, PassForm;
{$R *.DFM}
procedure TfmPassCheck.FormDestroy(Sender: TObject);
begin
try
PassCheckFm := nil;
except
end;
end;
procedure TfmPassCheck.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfmPassCheck.bnOKClick(Sender: TObject);
begin
if CheckPassword(AnsiString(edPass.Text)) then
begin
if not Assigned(PassFm) then
begin
PassFm := TfmPass.Create(nil);
end;
PassFm.Show;
Close;
end
else
begin
{ DONE: sHure }
HppMessageBox(Handle, TranslateW('You have entered the wrong password.'),
TranslateW('History++ Password Protection'), MB_OK or MB_DEFBUTTON1 or MB_ICONSTOP);
end;
end;
procedure TfmPassCheck.bnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TfmPassCheck.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
Mask: Integer;
begin
with Sender as TWinControl do
begin
if Perform(CM_CHILDKEY, Key, LPARAM(Sender)) <> 0 then
Exit;
Mask := 0;
case Key of
VK_TAB:
Mask := DLGC_WANTTAB;
VK_RETURN, VK_EXECUTE, VK_ESCAPE, VK_CANCEL:
Mask := DLGC_WANTALLKEYS;
end;
if (Mask <> 0) and (Perform(CM_WANTSPECIALKEY, Key, 0) = 0) and
(Perform(WM_GETDLGCODE, 0, 0) and Mask = 0) and (Self.Perform(CM_DIALOGKEY, Key, 0) <> 0)
then
Exit;
end;
end;
procedure TfmPassCheck.edPassKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = Chr(VK_RETURN)) or
(Key = Chr(VK_TAB)) or
(Key = Chr(VK_ESCAPE)) then
Key := #0;
end;
procedure TfmPassCheck.TranslateForm;
begin
Caption := TranslateUnicodeString(Caption);
Label3.Caption := TranslateUnicodeString(Label3.Caption);
Label2.Caption := TranslateUnicodeString(Label2.Caption);
Label1.Caption := TranslateUnicodeString(Label1.Caption);
bnOK.Caption := TranslateUnicodeString(bnOK.Caption);
bnCancel.Caption := TranslateUnicodeString(bnCancel.Caption);
end;
procedure TfmPassCheck.FormCreate(Sender: TObject);
begin
DesktopFont := True;
MakeFontsParent(Self);
TranslateForm;
Image1.Picture.Icon.Handle := CopyIcon(hppIntIcons[0].handle);
end;
end.
|