Changeset 28 for trunk/Forms/UFormDatabases.pas
- Timestamp:
- Sep 10, 2022, 10:21:48 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormDatabases.pas
r26 r28 43 43 end; 44 44 45 var46 FormDatabases: TFormDatabases;47 45 48 46 implementation … … 52 50 uses 53 51 UCore, UFormConnect; 52 53 resourcestring 54 SRemoveDatabaseConnection = 'Remove database connection'; 55 SRemoveDatabaseConnectionQuery = 'Do you want to really remove database connection %s?'; 56 SNewDatabase = 'New database'; 54 57 55 58 { TFormDatabases } … … 71 74 begin 72 75 if Assigned(ListView1.Selected) then begin 73 if MessageDlg( 'Remove database connection', 'Do you want to really remove database connection ' +74 TDbConnectProfile(ListView1.Selected.Data).Name , mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin76 if MessageDlg(SRemoveDatabaseConnection, Format(SRemoveDatabaseConnectionQuery, [ 77 TDbConnectProfile(ListView1.Selected.Data).Name]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin 75 78 Core.DbManager.ConnectProfiles.Remove(ListView1.Selected.Data); 76 79 ReloadList; … … 84 87 begin 85 88 NewConnectProfile := TDbConnectProfile.Create; 86 NewConnectProfile.Name := 'New database'; 87 FormConnect.Load(NewConnectProfile); 88 if FormConnect.ShowModal = mrOk then begin 89 FormConnect.Save(NewConnectProfile); 90 Core.DbManager.ConnectProfiles.Add(NewConnectProfile); 91 ReloadList; 92 end else NewConnectProfile.Free; 89 NewConnectProfile.Name := SNewDatabase; 90 with TFormConnect.Create(nil) do 91 try 92 Load(NewConnectProfile); 93 if ShowModal = mrOk then begin 94 Save(NewConnectProfile); 95 Core.DbManager.ConnectProfiles.Add(NewConnectProfile); 96 ReloadList; 97 end else NewConnectProfile.Free; 98 finally 99 Free; 100 end; 93 101 end; 94 102 … … 96 104 begin 97 105 if Assigned(ListView1.Selected) then begin 98 FormConnect.Load(TDbConnectProfile(ListView1.Selected.Data)); 99 if FormConnect.ShowModal = mrOk then begin 100 FormConnect.Save(TDbConnectProfile(ListView1.Selected.Data)); 101 ReloadList; 106 with TFormConnect.Create(nil) do 107 try 108 Load(TDbConnectProfile(ListView1.Selected.Data)); 109 if ShowModal = mrOk then begin 110 Save(TDbConnectProfile(ListView1.Selected.Data)); 111 ReloadList; 112 end; 113 finally 114 Free; 102 115 end; 103 116 end;
Note:
See TracChangeset
for help on using the changeset viewer.