Ignore:
Timestamp:
Mar 9, 2012, 1:09:52 PM (13 years ago)
Author:
chronos
Message:
  • Fixed: Selection of available protocols in profile manager.
  • Modified: Initialization of persistent data structures rewrited to more native structures.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r42 r43  
    99  StdCtrls, ActnList, Menus, ExtCtrls, USqlDatabase, DOM, XMLRead, XMLWrite,
    1010  UPersistentForm, UTreeState, SpecializedList, SpecializedDictionary,
    11   URegistry, USystem, UFormItemList;
     11  URegistry, UCoolTranslator, USystem, UFormItemList;
    1212
    1313type
     
    112112  UFormItemView, UFormItemEdit, UFormItemAdd, UFormLogin, UFormSetting, UApplicationInfo,
    113113  UCore, UFormImportStructure, UFormAbout, UFormLoginProfile, UChronisClientDirect,
    114   UChronisClient;
     114  UChronisClient, UChronisClientMySQL, UChronisClientXMLRPC;
    115115
    116116{$R *.lfm}
     
    155155procedure TMainForm.UpdateInterface;
    156156begin
    157   ADisconnect.Enabled := Core.System.Client.Connected;
    158   AConnect.Enabled := not Core.System.Client.Connected;
    159   AImportStructure.Enabled := Core.System.Client.Connected;
     157  ADisconnect.Enabled := Assigned(Core.Client) and Core.Client.Connected;
     158  AConnect.Enabled := Assigned(Core.Client) and not Core.Client.Connected;
     159  AImportStructure.Enabled := Assigned(Core.Client) and Core.Client.Connected;
    160160  if Assigned(MainPanelForm) then
    161161    Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name
    162     else Caption :=  ApplicationInfo.Name;
     162    else Caption := ApplicationInfo.Name;
    163163  Application.Title := Caption;
    164   if Assigned(Core.System.Client) then
    165   with Core.System.Client do
     164  if Assigned(Core.Client) then
     165  with Core.Client do
    166166    StatusBar1.Panels[0].Text := User + '@' + Host + ':' + IntToStr(Port) + '/' + Schema;
    167167end;
     
    258258procedure TMainForm.AImportStructureExecute(Sender: TObject);
    259259begin
    260   ImportStructureForm.ShowModal;
     260  try
     261    ImportStructureForm := TImportStructureForm.Create(MainForm);
     262    ImportStructureForm.ShowModal;
     263  finally
     264    ImportStructureForm.Free;
     265  end;
    261266end;
    262267
     
    268273  if LoginForm.ShowModal = mrOK then begin
    269274    with TConnectProfile(Core.Profiles[Core.LastProfile]) do begin
     275      FreeAndNil(Core.Client);
     276      if Protocol = cpMySQL then Core.Client := TChronisClientMySQL.Create
     277        else if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create
     278        else if Protocol = cpXMLRPC then Core.Client := TChronisClientXMLRPC.Create;
     279      Core.System.Client := Core.Client;
    270280      Core.System.Client.Host := HostName;
    271281      Core.System.Client.Schema := Database;
     
    273283      Core.System.Client.Password := Core.LastPassword;
    274284      Core.System.Client.Port := Port;
    275       if Protocol = cpDirect then Core.Client := TChronisClientDirect.Create;
    276285    end;
    277286    try
     
    292301procedure TMainForm.ADisconnectExecute(Sender: TObject);
    293302begin
     303  if Assigned(Core.System.Client) then
    294304  if Core.System.Client.Connected then begin
    295305    Core.System.Client.Disconnect;
Note: See TracChangeset for help on using the changeset viewer.