183 lines
5.4 KiB
ObjectPascal
183 lines
5.4 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2005. Rodax Software.
|
|
===============================================================================
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
|
|
bajo el que se suministra.
|
|
-----------------------------------------------------------------------------
|
|
Web: www.rodax-software.com
|
|
===============================================================================
|
|
Fecha primera versión: 17-05-2005
|
|
Versión actual: 1.0.0
|
|
Fecha versión actual: 17-05-2005
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
===============================================================================
|
|
}
|
|
|
|
unit uActualizacion;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, JvComponent, JvAppStorage,
|
|
JvAppRegistryStorage, JvFormPlacement, JvProgramVersionCheck, JvPropertyStore,
|
|
JvBaseDlg, JvBrowseFolder, ActnList, JvComponentBase, Buttons, uInfoProjectUtils;
|
|
|
|
type
|
|
TfActualizacion = class(TForm)
|
|
Panel2: TPanel;
|
|
OKBtn: TButton;
|
|
CancelBtn: TButton;
|
|
PageControl1: TPageControl;
|
|
TabSheet1: TTabSheet;
|
|
GroupBox1: TGroupBox;
|
|
Label2: TLabel;
|
|
edUsuario: TEdit;
|
|
Label3: TLabel;
|
|
edPassword: TEdit;
|
|
Label4: TLabel;
|
|
JvAppRegistryStorage1: TJvAppRegistryStorage;
|
|
JvFormStorage1: TJvFormStorage;
|
|
edRutaLan: TEdit;
|
|
bDirectorio: TSpeedButton;
|
|
rbInternet: TRadioButton;
|
|
rbLan: TRadioButton;
|
|
ActionList1: TActionList;
|
|
Action1: TAction;
|
|
Action2: TAction;
|
|
TabSheet2: TTabSheet;
|
|
GroupBox2: TGroupBox;
|
|
Label1: TLabel;
|
|
Label5: TLabel;
|
|
edFicheroConfig: TEdit;
|
|
JvBrowseForFolderDialog1: TJvBrowseForFolderDialog;
|
|
JvProgramVersionCheck1: TJvProgramVersionCheck;
|
|
JvProgramVersionNetworkLocation1: TJvProgramVersionNetworkLocation;
|
|
Label6: TLabel;
|
|
edLocation: TEdit;
|
|
Label7: TLabel;
|
|
procedure bDirectorioClick(Sender: TObject);
|
|
procedure Action1Update(Sender: TObject);
|
|
procedure FormActivate(Sender: TObject);
|
|
procedure OKBtnClick(Sender: TObject);
|
|
procedure JvFormStorage1StoredValues0Save(Sender: TJvStoredValue;
|
|
var AValue: Variant);
|
|
private
|
|
InfoProject : TInfoProject;
|
|
public
|
|
{ Public declarations }
|
|
function HayConfiguracion: Boolean;
|
|
procedure Actualizar;
|
|
function darVersion: String;
|
|
end;
|
|
|
|
var
|
|
fActualizacion: TfActualizacion;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses
|
|
JclFileUtils;
|
|
|
|
procedure TfActualizacion.bDirectorioClick(Sender: TObject);
|
|
begin
|
|
if Length(edRutaLan.Text) > 0 then
|
|
JvBrowseForFolderDialog1.Directory := edRutaLan.Text;
|
|
JvBrowseForFolderDialog1.Execute;
|
|
if DirectoryExists(JvBrowseForFolderDialog1.Directory) then
|
|
edRutaLan.Text := JvBrowseForFolderDialog1.Directory + '\'
|
|
else begin
|
|
ShowMessage('Directorio no válido');
|
|
bDirectorio.Click;
|
|
end;
|
|
end;
|
|
|
|
procedure TfActualizacion.Action1Update(Sender: TObject);
|
|
begin
|
|
edRutaLan.Enabled := rbLan.Checked;
|
|
bDirectorio.Enabled := rbLan.Checked;
|
|
edLocation.Enabled := rbInternet.Checked;
|
|
edUsuario.Enabled := rbInternet.Checked;
|
|
edPassword.Enabled := rbInternet.Checked;
|
|
end;
|
|
|
|
procedure TfActualizacion.FormActivate(Sender: TObject);
|
|
begin
|
|
JvFormStorage1.RestoreFormPlacement;
|
|
PageControl1.TabIndex := 0;
|
|
end;
|
|
|
|
procedure TfActualizacion.OKBtnClick(Sender: TObject);
|
|
begin
|
|
JvFormStorage1.SaveFormPlacement;
|
|
end;
|
|
|
|
procedure TfActualizacion.Actualizar;
|
|
begin
|
|
JvFormStorage1.RestoreFormPlacement;
|
|
|
|
if rbLan.Checked then
|
|
begin
|
|
JvProgramVersionCheck1.LocationType := pvltNetwork;
|
|
with JvProgramVersionNetworkLocation1 do
|
|
begin
|
|
VersionInfoLocationPathList.Clear;
|
|
VersionInfoLocationPathList.Add(edRutaLan.Text);
|
|
VersionInfoFileName := edFicheroConfig.Text;
|
|
end;
|
|
end
|
|
else begin
|
|
{JvProgramVersionCheck1.LocationType := pvltHTTP;
|
|
with JvProgramVersionHTTPLocationIndy1 do
|
|
begin
|
|
VersionInfoFileName := edFicheroConfig.Text;
|
|
VersionInfoLocationPathList.Clear;
|
|
VersionInfoLocationPathList.Add(edLocation.Text);
|
|
UserName := edUsuario.Text;
|
|
Password := edPassword.Text;
|
|
end;}
|
|
end;
|
|
|
|
JvProgramVersionCheck1.LocalVersionInfoFileName := 'versionlocal.ini';//edFicheroConfig.Text;
|
|
JvProgramVersionCheck1.Execute;
|
|
end;
|
|
|
|
procedure TfActualizacion.JvFormStorage1StoredValues0Save(
|
|
Sender: TJvStoredValue; var AValue: Variant);
|
|
begin
|
|
if rbInternet.Checked then
|
|
AValue := 'INTERNET'
|
|
else
|
|
AValue := 'LAN';
|
|
end;
|
|
|
|
function TfActualizacion.darVersion: String;
|
|
begin
|
|
InfoProject := TInfoProject.Create(Self);
|
|
try
|
|
Result := InfoProject.FileVersion;
|
|
finally
|
|
FreeAndNil(InfoProject);
|
|
end;
|
|
end;
|
|
|
|
function TfActualizacion.HayConfiguracion: Boolean;
|
|
begin
|
|
// Cargar la configuración desde el registro.
|
|
JvFormStorage1.RestoreFormPlacement;
|
|
|
|
Result := (rbLan.Checked) or (rbInternet.Checked);
|
|
end;
|
|
|
|
end.
|