mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 09:19:14 +02:00
* Delete connection/datadict removes items from tree/LV, depending on view
git-svn-id: trunk@51125 -
This commit is contained in:
parent
14cc0fc3b7
commit
4b5747f9d1
@ -226,6 +226,8 @@ type
|
|||||||
function GetConnectionName(out AName: String): Boolean;
|
function GetConnectionName(out AName: String): Boolean;
|
||||||
function GetCurrentConnection: TConnectionEditor;
|
function GetCurrentConnection: TConnectionEditor;
|
||||||
function GetCurrentEditor: TDataDictEditor;
|
function GetCurrentEditor: TDataDictEditor;
|
||||||
|
function GetSelectedRecentConnection: TRecentConnection;
|
||||||
|
function GetSelectedRecentDataDict: TRecentDataDict;
|
||||||
procedure NewConnection(EngineName : String);
|
procedure NewConnection(EngineName : String);
|
||||||
procedure NewConnection;
|
procedure NewConnection;
|
||||||
procedure OpenConnection(RC: TRecentConnection);
|
procedure OpenConnection(RC: TRecentConnection);
|
||||||
@ -270,6 +272,8 @@ type
|
|||||||
procedure ShowGenerateSQL;
|
procedure ShowGenerateSQL;
|
||||||
Property CurrentEditor : TDataDictEditor Read GetCurrentEditor;
|
Property CurrentEditor : TDataDictEditor Read GetCurrentEditor;
|
||||||
Property CurrentConnection : TConnectionEditor Read GetCurrentConnection;
|
Property CurrentConnection : TConnectionEditor Read GetCurrentConnection;
|
||||||
|
Property SelectedRecentConnection : TRecentConnection Read GetSelectedRecentConnection;
|
||||||
|
Property SelectedRecentDataDict : TRecentDataDict Read GetSelectedRecentDataDict;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -606,6 +610,49 @@ begin
|
|||||||
Result:=Nil;
|
Result:=Nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainForm.GetSelectedRecentConnection: TRecentConnection;
|
||||||
|
|
||||||
|
Var
|
||||||
|
TN : TTreeNode;
|
||||||
|
LI : TListItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=Nil;
|
||||||
|
if FTreeIntf then
|
||||||
|
begin
|
||||||
|
TN:=TVAll.Selected;
|
||||||
|
if Assigned(TN) AND Assigned(TN.Data) AND TObject(TN.Data).InheritsFrom(TRecentConnection) then
|
||||||
|
Result:=TRecentConnection(TN.Data);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
LI:=LVConnections.Selected;
|
||||||
|
if (LI<>Nil) and (LI.Data<>Nil) then
|
||||||
|
Result:=TRecentConnection(LI.Data)
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainForm.GetSelectedRecentDataDict: TRecentDataDict;
|
||||||
|
Var
|
||||||
|
TN : TTreeNode;
|
||||||
|
LI : TListItem;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=Nil;
|
||||||
|
if FTreeIntf then
|
||||||
|
begin
|
||||||
|
TN:=TVAll.Selected;
|
||||||
|
if Assigned(TN) AND Assigned(TN.Data) AND TObject(TN.Data).InheritsFrom(TRecentDataDict) then
|
||||||
|
Result:=TRecentDataDict(TN.Data);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
LI:=LVDicts.Selected;
|
||||||
|
if (LI<>Nil) AND (LI.Data<>Nil) then
|
||||||
|
Result:=TRecentDataDict(LI.Data);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainForm.GetCurrentConnection: TConnectionEditor;
|
function TMainForm.GetCurrentConnection: TConnectionEditor;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -936,13 +983,12 @@ Var
|
|||||||
R : TRecentConnection;
|
R : TRecentConnection;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If (LVConnections.Selected<>Nil)
|
R:=SelectedRecentConnection;
|
||||||
and (LVConnections.Selected.Data<>Nil) then
|
If Assigned(R) then
|
||||||
begin
|
begin
|
||||||
R:=TRecentConnection(LVConnections.Selected.Data);
|
|
||||||
If (R<>Nil) then
|
|
||||||
FRecentConnections.Delete(R.Index);
|
FRecentConnections.Delete(R.Index);
|
||||||
ShowRecentConnections;
|
FindLI(LVConnections,R).Free;
|
||||||
|
FindTN(FNRecentConnections,R).Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1071,46 +1117,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveRecentConnection(Sender: TObject);
|
procedure TMainForm.HaveRecentConnection(Sender: TObject);
|
||||||
Var
|
|
||||||
TN : TTreeNode;
|
|
||||||
LI : TListItem;
|
|
||||||
doEnable: Boolean;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FTreeIntf then
|
(Sender as Taction).Enabled:=Assigned(SelectedRecentConnection);
|
||||||
begin
|
|
||||||
TN:=TVAll.Selected;
|
|
||||||
doEnable:=Assigned(TN) AND Assigned(TN.Data) AND TObject(TN.Data).InheritsFrom(TRecentConnection)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
LI:=LVConnections.Selected;
|
|
||||||
doEnable:=(LI<>Nil) and (LI.Data<>Nil);
|
|
||||||
end;
|
|
||||||
(Sender as Taction).Enabled:=doEnable;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveRecentDataDict(Sender: TObject);
|
procedure TMainForm.HaveRecentDataDict(Sender: TObject);
|
||||||
|
|
||||||
Var
|
|
||||||
TN : TTreeNode;
|
|
||||||
LI : TListItem;
|
|
||||||
doEnable: Boolean;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FTreeIntf then
|
(Sender as Taction).Enabled:=Assigned(SelectedRecentDataDict);
|
||||||
begin
|
|
||||||
TN:=TVAll.Selected;
|
|
||||||
doEnable:=Assigned(TN)
|
|
||||||
AND Assigned(TN.Data)
|
|
||||||
AND TObject(TN.Data).InheritsFrom(TRecentDataDict)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
LI:=LVDicts.Selected;
|
|
||||||
doEnable:=(LI<>Nil) AND (LI.Data<>Nil);
|
|
||||||
end;
|
|
||||||
(Sender as Taction).Enabled:=doEnable;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveTabs(Sender: TObject);
|
procedure TMainForm.HaveTabs(Sender: TObject);
|
||||||
@ -1542,12 +1557,14 @@ procedure TMainForm.DeleteRecentDataDict;
|
|||||||
|
|
||||||
Var
|
Var
|
||||||
D: TRecentDatadict;
|
D: TRecentDatadict;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If (LVDicts.Selected<>Nil) and (LVDicts.Selected.Data<>Nil) then
|
D:=SelectedRecentDataDict;
|
||||||
|
If Assigned(D) then
|
||||||
begin
|
begin
|
||||||
D:=TRecentDatadict(LVDicts.Selected.Data);
|
|
||||||
FRecentDicts.Delete(D.Index);
|
FRecentDicts.Delete(D.Index);
|
||||||
ShowRecentDictionaries;
|
FindLI(LVDicts,D).Free;
|
||||||
|
FindTN(FNRecentDictionaries,D).Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user