unit uViewConfiguracionGeneral;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewConfiguracionBase, StdCtrls, ExtCtrls, dxGDIPlusClasses,
  JvExControls, JvGradientHeaderPanel, Mask,  
      
     
    
    
     
   cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit,
  cxSpinEdit;

type
  TfrViewConfiguracionGeneral = class(TfrViewConfiguracionBase)
    cbEsquemaColor: TComboBox;
    Label1: TLabel;
    Panel2: TPanel;
    Label2: TLabel;
    Panel3: TPanel;
    Panel4: TPanel;
    Label4: TLabel;
    CheckBox1: TCheckBox;
    edtNumIntentos: TcxSpinEdit;
    Panel5: TPanel;
    Label5: TLabel;
    Panel6: TPanel;
    lblLongMinPass: TLabel;
    cbPassObligatoria: TCheckBox;
    edtLongMinPass: TcxSpinEdit;
    cbMostrarMenu: TCheckBox;
  private
    { Private declarations }
  public
    class function GetViewClass : TClass; override;
    class function DarEtiqueta : String; override;
    procedure CargarValores; override;
    procedure GuardarValores; override;
  end;

implementation

uses
  uFactuGES_App, uDMBase, uConfiguracionController;

{$R *.dfm}

{ TfrViewConfiguracionGeneral }

procedure TfrViewConfiguracionGeneral.CargarValores;
{var
  ASkinName : String;}
begin
  inherited;
  edtLongMinPass.Text := AppFactuGES.Configuracion.GetSettingAsString(teXML, 'MinPasswordLength', '3');
  edtNumIntentos.Text := AppFactuGES.Configuracion.GetSettingAsString(teXML, 'MaxLoginAttempts', '3');
  cbPassObligatoria.Checked := AppFactuGES.Configuracion.GetSettingAsBoolean(teXML, 'ForcePassword', True);

  cbMostrarMenu.Checked := AppFactuGES.Configuracion.GetSettingAsBoolean(teXML, 'MostrarBarraMenus', True);

  {cbEsquemaColor.Items.Add('Usar estilo nativo de Windows');
  cbEsquemaColor.Items.AddStrings(dmBase.DarListaSkins);

  ASkinName := AppFactuGES.Configuracion.GetSettingAsString('SkinName', '');
  if ASkinName = '' then
    cbEsquemaColor.ItemIndex := 0
  else
    cbEsquemaColor.ItemIndex := cbEsquemaColor.Items.IndexOf(ASkinName);}
end;

class function TfrViewConfiguracionGeneral.DarEtiqueta: String;
begin
  Result := 'General';
end;

class function TfrViewConfiguracionGeneral.GetViewClass: TClass;
begin
  Result := TfrViewConfiguracionGeneral;
end;

procedure TfrViewConfiguracionGeneral.GuardarValores;
{var
  ASkinName : String;}
begin
  inherited;
  AppFactuGES.Configuracion.SetSettingAsString(teXML, 'MinPasswordLength', edtLongMinPass.Text);
  AppFactuGES.Configuracion.SetSettingAsString(teXML, 'MaxLoginAttempts', edtNumIntentos.Text);
  AppFactuGES.Configuracion.SetSettingAsBoolean(teXML, 'ForcePassword', cbPassObligatoria.Checked);

  AppFactuGES.Configuracion.SetSettingAsBoolean(teXML, 'MostrarBarraMenus', cbMostrarMenu.Checked);

  {if cbEsquemaColor.ItemIndex = 0 then
    ASkinName := ''
  else
    ASkinName := cbEsquemaColor.Text;

  AppFactuGES.Configuracion.SetSettingAsString('SkinName', ASkinName);}
end;

end.
