From c304b78a064cd9815b0cf83ad7adc9c0d35e004b Mon Sep 17 00:00:00 2001 From: david Date: Wed, 27 Feb 2008 12:31:30 +0000 Subject: [PATCH] =?UTF-8?q?Aplicaci=C3=B3n=20cliente:=20arreglado=20fallo?= =?UTF-8?q?=20al=20minimizar=20la=20pantalla=20principal.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@159 f4e31baf-9722-1c47-927c-6f952f962d4b --- .../Usuarios/Views/uEditorLogin.pas | 2 +- Source/ApplicationBase/uFactuGES_App.pas | 17 +-- Source/Cliente/uPantallaPrincipal.dfm | 1 - Source/Cliente/uPantallaPrincipal.pas | 116 ++++++++---------- 4 files changed, 61 insertions(+), 75 deletions(-) diff --git a/Source/ApplicationBase/Usuarios/Views/uEditorLogin.pas b/Source/ApplicationBase/Usuarios/Views/uEditorLogin.pas index 0560eacc..b76e4ff7 100644 --- a/Source/ApplicationBase/Usuarios/Views/uEditorLogin.pas +++ b/Source/ApplicationBase/Usuarios/Views/uEditorLogin.pas @@ -112,7 +112,7 @@ end; procedure TfEditorLogin.FormShow(Sender: TObject); begin - Self.Caption := Self.Caption + ' - ' + AppFactuGES.AppVersion; + Self.Caption := AppFactuGES.AppFullName; JvFormStorage1.RestoreFormPlacement; // Hacer login automática si hay usuario/password y no hay más de una base diff --git a/Source/ApplicationBase/uFactuGES_App.pas b/Source/ApplicationBase/uFactuGES_App.pas index 52d88813..7a3b54f6 100644 --- a/Source/ApplicationBase/uFactuGES_App.pas +++ b/Source/ApplicationBase/uFactuGES_App.pas @@ -26,6 +26,7 @@ type function GetEmpresasController: IEmpresasController; function GetUsuariosController: IUsuariosController; function GetAppName: String; + function GetAppFullName: String; function GetAppVersion: String; function GetUsuarioActivo: IBizUsuario; function GetEmpresaActiva: IBizEmpresa; @@ -53,6 +54,7 @@ type property AppVersion : String read GetAppVersion; property AppName : String read GetAppName; + property AppFullName : String read GetAppFullName; property MainForm : TCustomForm read GetMainForm; property EmpresaActiva : IBizEmpresa read GetEmpresaActiva; property EjercicioActivo : IBizEjercicio read GetEjercicioActivo; @@ -87,6 +89,7 @@ type function GetEmpresasController: IEmpresasController; function GetUsuariosController: IUsuariosController; function GetAppName: String; + function GetAppFullName: String; function GetAppVersion: String; function GetUsuarioActivo: IBizUsuario; function GetEmpresaActiva: IBizEmpresa; @@ -124,6 +127,7 @@ type property AppVersion : String read GetAppVersion; property AppName : String read GetAppName; + property AppFullName : String read GetAppFullName; property MainForm : TCustomForm read GetMainForm; property EmpresaActiva : IBizEmpresa read GetEmpresaActiva; property EjercicioActivo : IBizEjercicio read GetEjercicioActivo; @@ -244,6 +248,11 @@ begin Result := FDoMainFormEvent; end; +function TAppFactuGES.GetAppFullName: String; +begin + Result := GetAppName + ' ' + GetAppVersion; +end; + function TAppFactuGES.GetAppName: String; begin Result := FAppInfo.ProductName; @@ -337,13 +346,7 @@ begin HideHourglassCursor; HideSplashForm; end; - - //InicializarUI; - //Application.ProcessMessages; - //Visible := True; - //AplicarPerfil; -// Application.CreateForm(); - end; + end; Application.Run; Terminate; end; diff --git a/Source/Cliente/uPantallaPrincipal.dfm b/Source/Cliente/uPantallaPrincipal.dfm index 6313970a..59acd12a 100644 --- a/Source/Cliente/uPantallaPrincipal.dfm +++ b/Source/Cliente/uPantallaPrincipal.dfm @@ -244,7 +244,6 @@ object fPantallaPrincipal: TfPantallaPrincipal Tag = -9000 Category = 'Archivo' Caption = 'Login' - OnExecute = actLoginExecute end object actAdministracion: TAction Tag = -9000 diff --git a/Source/Cliente/uPantallaPrincipal.pas b/Source/Cliente/uPantallaPrincipal.pas index c3721d45..0b92d3c0 100644 --- a/Source/Cliente/uPantallaPrincipal.pas +++ b/Source/Cliente/uPantallaPrincipal.pas @@ -94,7 +94,6 @@ type procedure FormCreate(Sender: TObject); procedure Salir1Click(Sender: TObject); procedure actSalirExecute(Sender: TObject); - procedure actLoginExecute(Sender: TObject); procedure actCambiarPassExecute(Sender: TObject); procedure actAcercaExecute(Sender: TObject); procedure actConexionExecute(Sender: TObject); @@ -125,7 +124,7 @@ type procedure InicializarUI; procedure OnThemeChange(Sender: TObject); procedure ExecuteActionMenu(Sender : TObject); - procedure WMSysCommand(var Msg: TMessage); message WM_SYSCOMMAND; + //procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND; protected function GetWorkPanel : TWinControl; public @@ -192,7 +191,7 @@ procedure TfPantallaPrincipal.RefrescarUI; var ATitulo : String; begin - ATitulo := AppFactuGES.AppName + ' ' + AppFactuGES.AppVersion; + ATitulo := AppFactuGES.GetAppFullName; if Assigned(AppFactuGES.EmpresaActiva) then ATitulo := AppFactuGES.EmpresaActiva.NOMBRE + ' - ' + ATitulo; @@ -200,7 +199,7 @@ begin Application.Title := ATitulo; Caption := Application.Title; - if dmConexion.HayConexion then + if dmConexion.HayConexion then TBXStatusBar1.Panels[0].Caption := 'Conectado a: ' + dmConexion.TargetURL else TBXStatusBar1.Panels[0].Caption := 'Desconectado'; @@ -308,71 +307,45 @@ var AListaEmpresas : IBizEmpresa; i : Integer; begin - for i := 0 to AppFactuGES.ModuleManager.ModulesCount - 1 do - MainMenuController.RegisterModule(AppFactuGES.ModuleManager.Modules[i]); - - MainMenuController.SortMenuByTag; - MainMenuController.InitMainMenu; - - for i := 0 to AppFactuGES.ModuleManager.ModulesCount - 1 do - NavPaneController.RegisterModule(AppFactuGES.ModuleManager.Modules[i]); - - NavPaneController.InitNavPane; - + ShowHourglassCursor; try - AListaEmpresas := AppFactuGES.EmpresasController.BuscarTodos; - if Assigned(AListaEmpresas) then - begin - AListaEmpresas.Active := True; - if AListaEmpresas.RecordCount = 1 then + for i := 0 to AppFactuGES.ModuleManager.ModulesCount - 1 do + MainMenuController.RegisterModule(AppFactuGES.ModuleManager.Modules[i]); + + MainMenuController.SortMenuByTag; + MainMenuController.InitMainMenu; + + for i := 0 to AppFactuGES.ModuleManager.ModulesCount - 1 do + NavPaneController.RegisterModule(AppFactuGES.ModuleManager.Modules[i]); + + NavPaneController.InitNavPane; + + try + AListaEmpresas := AppFactuGES.EmpresasController.BuscarTodos; + if Assigned(AListaEmpresas) then begin - // Oculto la página de inicio para que no parezca - // que se pueden manejar varias empresas. - JvNavigationPane.ActivePageIndex := 1; - pagInicio.PageList := NIL; - pagInicio.Visible := False; + AListaEmpresas.Active := True; + if AListaEmpresas.RecordCount = 1 then + begin + // Oculto la página de inicio para que no parezca + // que se pueden manejar varias empresas. + JvNavigationPane.ActivePageIndex := 1; + pagInicio.PageList := NIL; + pagInicio.Visible := False; + end; end; + + finally + AListaEmpresas.Close; + AListaEmpresas := NIL; end; - + RefrescarUI; finally - AListaEmpresas.Close; - AListaEmpresas := NIL; + HideHourglassCursor; end; - - RefrescarUI; end; -procedure TfPantallaPrincipal.actLoginExecute(Sender: TObject); -begin -//-- HostManager.UnloadModules; - -{-- try - if AppFactuGES.UsuariosController.StartLogin then - begin - ShowHourglassCursor; -// SplashScreen.Update; - Application.ProcessMessages; - CargarModulos; - try - InicializarUI; - Application.ProcessMessages; - Visible := True; - AplicarPerfil; - finally - HideHourglassCursor; - end; - end - else - Close; - finally -// SplashScreen.Update; -// SplashScreen.Hide; -// SplashScreen.Release; - end; ---} -end; - procedure TfPantallaPrincipal.actMenuComprasExecute(Sender: TObject); begin // @@ -468,12 +441,23 @@ begin AppFactuGES.UsuariosController.VerUsuarios end; -procedure TfPantallaPrincipal.WMSysCommand(var Msg: TMessage); -begin - // No tocar, sirve para recuperar el foco el formulario principal cuando +{procedure TfPantallaPrincipal.WMSysCommand(var Msg: TWMSysCommand); +begin} + // sirve para recuperar el foco el formulario principal cuando // tenemos varios formularios hijos abiertos a la vez. - DefaultHandler(Msg); -end; +{ case (Msg.cmdtype and $FFF0) of + SC_MINIMIZE: begin + ShowWindow(handle, SW_MINIMIZE); + Msg.result := 0; + end; + SC_RESTORE: begin + ShowWindow(handle, SW_RESTORE); + Msg.result := 0; + end; + else + DefaultHandler(Msg); + end; +end;} constructor TfPantallaPrincipal.Create(AOwner: TComponent); begin @@ -528,7 +512,7 @@ procedure TfPantallaPrincipal.actAcercaExecute(Sender: TObject); begin with TfAcercaDe.Create(NIL) do try - //--HostManager := Self.HostManager; + HostManager := AppFactuGES.ModuleManager; ShowModal; finally Free;