ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBServices.pas
(Generate patch)

Comparing ibx/trunk/runtime/IBServices.pas (file contents):
Revision 29 by tony, Sat May 9 11:37:49 2015 UTC vs.
Revision 31 by tony, Tue Jul 14 15:31:25 2015 UTC

# Line 51 | Line 51 | uses
51   {$ELSE}
52    unix,
53   {$ENDIF}
54 <  SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
55 <  IBDialogs, IBHeader, IB, IBExternals;
54 >  SysUtils, Classes, IBHeader, IB, IBExternals, CustApp;
55  
56   const
57    DefaultBufferSize = 32000;
# Line 97 | Line 96 | type
96    TLoginEvent = procedure(Database: TIBCustomService;
97      LoginParams: TStrings) of object;
98  
99 +  { TIBCustomService }
100 +
101    TIBCustomService = class(TComponent)
102    private
103      FIBLoaded: Boolean;
# Line 139 | Line 140 | type
140      function Login: Boolean;
141      procedure CheckActive;
142      procedure CheckInactive;
143 +    procedure HandleException(Sender: TObject);
144      property OutputBuffer : PChar read FOutputBuffer;
145      property OutputBufferOption : TOutputBufferOption read FOutputBufferOption write FOutputBufferOption;
146      property BufferSize : Integer read FBufferSize write SetBufferSize default DefaultBufferSize;
# Line 562 | Line 564 | begin
564        Attach;
565    except
566      if csDesigning in ComponentState then
567 <      Application.HandleException(Self)
567 >       HandleException(self)
568      else
569        raise;
570    end;
# Line 585 | Line 587 | begin
587        LoginParams.Free;
588      end;
589    end
590 <  else begin
590 >  else
591 >  if assigned(IBGUIInterface)  then
592 >  begin
593      IndexOfUser := IndexOfSPBConst(SPBConstantNames[isc_spb_user_name]);
594      if IndexOfUser <> -1 then
595        Username := Copy(Params[IndexOfUser],
# Line 596 | Line 600 | begin
600        Password := Copy(Params[IndexOfPassword],
601                                           Pos('=', Params[IndexOfPassword]) + 1, {mbcs ok}
602                                           Length(Params[IndexOfPassword]));
603 <    result := ServerLoginDialog(serverName, Username, Password);
603 >    result := IBGUIInterface.ServerLoginDialog(serverName, Username, Password);
604      if result then
605      begin
606        IndexOfPassword := IndexOfSPBConst(SPBConstantNames[isc_spb_password]);
# Line 610 | Line 614 | begin
614        else
615          Params[IndexOfPassword] := SPBConstantNames[isc_spb_password] +
616                                       '=' + Password;
617 <    end;
618 <  end;
617 >    end
618 >  end
619 >  else
620 >    IBError(ibxeNoLoginDialog,[]);
621   end;
622  
623   procedure TIBCustomService.CheckActive;
# Line 628 | Line 634 | begin
634      IBError(ibxeServiceInActive, [nil]);
635   end;
636  
637 + procedure TIBCustomService.HandleException(Sender: TObject);
638 + var aParent: TComponent;
639 + begin
640 +  aParent := Owner;
641 +  while aParent <> nil do
642 +  begin
643 +    if aParent is TCustomApplication then
644 +    begin
645 +      TCustomApplication(aParent).HandleException(Sender);
646 +      Exit;
647 +    end;
648 +    aParent := aParent.Owner;
649 +  end;
650 +  SysUtils.ShowException(ExceptObject,ExceptAddr);
651 + end;
652 +
653   constructor TIBCustomService.Create(AOwner: TComponent);
654   begin
655    inherited Create(AOwner);
# Line 647 | Line 669 | begin
669    FTraceFlags := [];
670    FOutputbuffer := nil;
671    FProtocol := Local;
672 +  if (AOwner <> nil) and
673 +     (AOwner is TCustomApplication) and
674 +     TCustomApplication(AOwner).ConsoleApplication then
675 +    LoginPrompt := false;
676   end;
677  
678   destructor TIBCustomService.Destroy;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines