Ignore:
Timestamp:
Jun 29, 2024, 7:58:36 AM (3 months ago)
Author:
chronos
Message:
  • Modified: Removed U prefix from units names.
  • Modified: Use TFormEx for all forms.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormDatabases.pas

    r31 r32  
    1 unit UFormDatabases;
     1unit FormDatabases;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    7   Menus, ActnList, UDatabase;
     7  Menus, ActnList, DbEngine, FormEx;
    88
    99type
     
    1111  { TFormDatabases }
    1212
    13   TFormDatabases = class(TForm)
     13  TFormDatabases = class(TFormEx)
    1414    AAdd: TAction;
    1515    AOpen: TAction;
     
    3939  public
    4040    SelectedProfile: TDbConnectProfile;
     41    DbManager: TDbManager;
    4142    procedure ReloadList;
    4243    procedure UpdateInterface;
     
    4950
    5051uses
    51   UCore, UFormConnect;
     52  FormConnect;
    5253
    5354resourcestring
     
    7677    if MessageDlg(SRemoveDatabaseConnection, Format(SRemoveDatabaseConnectionQuery, [
    7778    TDbConnectProfile(ListView1.Selected.Data).Name]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
    78       Core.DbManager.ConnectProfiles.Remove(ListView1.Selected.Data);
     79      DbManager.ConnectProfiles.Remove(ListView1.Selected.Data);
    7980      ReloadList;
    8081    end;
     
    9091  with TFormConnect.Create(nil) do
    9192  try
     93    DbManager := Self.DbManager;
    9294    Load(NewConnectProfile);
    9395    if ShowModal = mrOk then begin
    9496      Save(NewConnectProfile);
    95       Core.DbManager.ConnectProfiles.Add(NewConnectProfile);
     97      DbManager.ConnectProfiles.Add(NewConnectProfile);
    9698      ReloadList;
    9799    end else NewConnectProfile.Free;
     
    104106begin
    105107  if Assigned(ListView1.Selected) then begin
     108    DbManager := Self.DbManager;
    106109    with TFormConnect.Create(nil) do
    107110    try
     111      DbManager := Self.DbManager;
    108112      Load(TDbConnectProfile(ListView1.Selected.Data));
    109113      if ShowModal = mrOk then begin
     
    128132procedure TFormDatabases.ListView1Data(Sender: TObject; Item: TListItem);
    129133begin
    130   if (Item.Index >= 0) and (Item.Index < Core.DbManager.ConnectProfiles.Count) then
    131   with TDbConnectProfile(Core.DbManager.ConnectProfiles[Item.Index]) do begin
     134  if (Item.Index >= 0) and (Item.Index < DbManager.ConnectProfiles.Count) then
     135  with TDbConnectProfile(DbManager.ConnectProfiles[Item.Index]) do begin
    132136    Item.Caption := Name;
    133137    Item.SubItems.Add(ClientType.Name);
    134138    Item.SubItems.Add(Params.ConnectionString);
    135     Item.Data := Core.DbManager.ConnectProfiles[Item.Index];
     139    Item.Data := DbManager.ConnectProfiles[Item.Index];
    136140  end
    137141end;
     
    145149procedure TFormDatabases.ReloadList;
    146150begin
    147   ListView1.Items.Count := Core.DbManager.ConnectProfiles.Count;
     151  ListView1.Items.Count := DbManager.ConnectProfiles.Count;
    148152  ListView1.Repaint;
    149153  UpdateInterface;
Note: See TracChangeset for help on using the changeset viewer.