Changeset 20 for trunk/Forms/UFormDatabases.pas
- Timestamp:
- Mar 23, 2018, 1:59:25 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormDatabases.pas
r15 r20 40 40 Selected: Boolean); 41 41 private 42 { private declarations }43 42 public 44 Selected Database: TDatabase;43 SelectedProfile: TDbConnectProfile; 45 44 procedure ReloadList; 46 45 procedure UpdateInterface; … … 67 66 begin 68 67 if Assigned(ListView1.Selected) then begin 69 Selected Database := TDatabase(ListView1.Selected.Data);68 SelectedProfile := TDbConnectProfile(ListView1.Selected.Data); 70 69 ModalResult := mrOk; 71 70 end; … … 76 75 if Assigned(ListView1.Selected) then begin 77 76 if MessageDlg('Remove database connection', 'Do you want to really remove database connection ' + 78 TD atabase(ListView1.Selected.Data).Name, mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin79 Core.D atabases.Remove(ListView1.Selected.Data);77 TDbConnectProfile(ListView1.Selected.Data).Name, mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin 78 Core.DbManager.ConnectProfiles.Remove(ListView1.Selected.Data); 80 79 ReloadList; 81 80 end; … … 85 84 procedure TFormDatabases.AAddExecute(Sender: TObject); 86 85 var 87 New Database: TDatabase;86 NewConnectProfile: TDbConnectProfile; 88 87 begin 89 New Database := TDatabase.Create;90 New Database.Name := 'New database';91 FormConnect.Load(New Database);88 NewConnectProfile := TDbConnectProfile.Create; 89 NewConnectProfile.Name := 'New database'; 90 FormConnect.Load(NewConnectProfile); 92 91 if FormConnect.ShowModal = mrOk then begin 93 FormConnect.Save(New Database);94 Core.D atabases.Add(NewDatabase);92 FormConnect.Save(NewConnectProfile); 93 Core.DbManager.ConnectProfiles.Add(NewConnectProfile); 95 94 ReloadList; 96 end else New Database.Free;95 end else NewConnectProfile.Free; 97 96 end; 98 97 … … 100 99 begin 101 100 if Assigned(ListView1.Selected) then begin 102 FormConnect.Load(TD atabase(ListView1.Selected.Data));101 FormConnect.Load(TDbConnectProfile(ListView1.Selected.Data)); 103 102 if FormConnect.ShowModal = mrOk then begin 104 FormConnect.Save(TD atabase(ListView1.Selected.Data));103 FormConnect.Save(TDbConnectProfile(ListView1.Selected.Data)); 105 104 ReloadList; 106 105 end; … … 119 118 procedure TFormDatabases.ListView1Data(Sender: TObject; Item: TListItem); 120 119 begin 121 if (Item.Index >= 0) and (Item.Index < Core.D atabases.Count) then122 with TD atabase(Core.Databases[Item.Index]) do begin120 if (Item.Index >= 0) and (Item.Index < Core.DbManager.ConnectProfiles.Count) then 121 with TDbConnectProfile(Core.DbManager.ConnectProfiles[Item.Index]) do begin 123 122 Item.Caption := Name; 124 Item.SubItems.Add( Engine.Name);125 Item.SubItems.Add( ConnectionString);126 Item.Data := Core.D atabases[Item.Index];123 Item.SubItems.Add(ClientType.Name); 124 Item.SubItems.Add(Params.ConnectionString); 125 Item.Data := Core.DbManager.ConnectProfiles[Item.Index]; 127 126 end 128 127 end; … … 136 135 procedure TFormDatabases.ReloadList; 137 136 begin 138 ListView1.Items.Count := Core.D atabases.Count;137 ListView1.Items.Count := Core.DbManager.ConnectProfiles.Count; 139 138 ListView1.Repaint; 140 139 UpdateInterface;
Note:
See TracChangeset
for help on using the changeset viewer.