BSOne.SFC/eCrmHE/EXE_eCrmHomeEdition/Messages/DBrowserOpt.pas

83 lines
2.2 KiB
Plaintext

unit DBrowserOpt;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
const
INI_BROWSER_SECU = 'browpolicy.ini';
type
TDlgBrowserOpt = class(TForm)
chWebSaveAs: TCheckBox;
chMouseRightClick: TCheckBox;
chCopyFromSecuWebPage: TCheckBox;
chPasteToSecuWebPage: TCheckBox;
btnOk: TButton;
btnCancel: TButton;
procedure btnOkClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DlgBrowserOpt: TDlgBrowserOpt;
implementation
uses
System.IniFiles, Tocsg.Safe;
{$R *.dfm}
procedure TDlgBrowserOpt.FormCreate(Sender: TObject);
var
sPath: String;
ini: TIniFile;
begin
sPath := 'C:\Program Files\Tocsg\eCrmHome\' + INI_BROWSER_SECU;
if FileExists(sPath) then
begin
Guard(ini, TIniFile.Create(sPath));
chWebSaveAs.Checked := ini.ReadBool('Block', 'WebSaveAs', false);
chMouseRightClick.Checked := ini.ReadBool('Block', 'MouseRightClick', false);
chCopyFromSecuWebPage.Checked := ini.ReadBool('Block', 'CopyFromSecuWebPage', false);
chPasteToSecuWebPage.Checked := ini.ReadBool('Block', 'PasteToSecuWebPage', false);
end;
end;
procedure TDlgBrowserOpt.btnOkClick(Sender: TObject);
var
sPath: String;
ini: TIniFile;
begin
if not chWebSaveAs.Checked and not chMouseRightClick.Checked and
not chCopyFromSecuWebPage.Checked and not chPasteToSecuWebPage.Checked then
begin
MessageBox(Handle, '보안 기능을 하나 이상 체크해주세요.', PChar(Caption), MB_OK + MB_ICONINFORMATION);
exit;
end;
sPath := 'C:\Program Files\Tocsg\eCrmHome\';
if not ForceDirectories(sPath) then
begin
MessageBox(Handle, '폴더 생성 실패', PChar(Caption), MB_OK + MB_ICONSTOP);
exit;
end;
Guard(ini, TIniFile.Create(sPath + INI_BROWSER_SECU));
ini.WriteBool('Block', 'WebSaveAs', chWebSaveAs.Checked);
ini.WriteBool('Block', 'MouseRightClick', chMouseRightClick.Checked);
ini.WriteBool('Block', 'CopyFromSecuWebPage', chCopyFromSecuWebPage.Checked);
ini.WriteBool('Block', 'PasteToSecuWebPage', chPasteToSecuWebPage.Checked);
ModalResult := mrOk;
end;
end.