mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
UPD: Network connection manager
This commit is contained in:
parent
d585c51a4b
commit
d3ff7390e1
3 changed files with 39 additions and 11 deletions
|
|
@ -866,8 +866,17 @@ begin
|
|||
Result:= False;
|
||||
if Connection = #0 then
|
||||
begin
|
||||
if QuickConnection then
|
||||
Result:= True;
|
||||
if QuickConnection then
|
||||
begin
|
||||
I:= ActiveConnectionList.IndexOf(cQuickConnection);
|
||||
if I >= 0 then
|
||||
begin
|
||||
Con:= TConnection(ActiveConnectionList.Objects[I]);
|
||||
StrPLCopy(Connection, Con.Host, MaxLen);
|
||||
StrPLCopy(RemotePath, Con.Path, MaxLen);
|
||||
Result:= True;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else if FtpConnect(Connection, FtpSend) then
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -60,22 +60,32 @@ procedure TfrmConnectionManager.tvConnectionsSelectionChanged(Sender: TObject);
|
|||
var
|
||||
bEnabled: Boolean;
|
||||
begin
|
||||
bEnabled:= Assigned(tvConnections.Selected) and Assigned(tvConnections.Selected.Data);
|
||||
btnConnect.Enabled:= not bEnabled;
|
||||
btnAdd.Enabled:= bEnabled;
|
||||
btnEdit.Enabled:= not bEnabled;
|
||||
btnDelete.Enabled:= not bEnabled;
|
||||
if not Assigned(tvConnections.Selected) then
|
||||
begin
|
||||
btnConnect.Enabled:= False;
|
||||
btnAdd.Enabled:= False;
|
||||
btnEdit.Enabled:= False;
|
||||
btnDelete.Enabled:= False;
|
||||
end
|
||||
else
|
||||
begin
|
||||
bEnabled:= Assigned(tvConnections.Selected.Data);
|
||||
btnConnect.Enabled:= not bEnabled;
|
||||
btnAdd.Enabled:= bEnabled;
|
||||
btnEdit.Enabled:= not bEnabled;
|
||||
btnDelete.Enabled:= not bEnabled;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmConnectionManager.btnAddClick(Sender: TObject);
|
||||
var
|
||||
WfxModule: TWfxModule;
|
||||
WfxPluginFileSource: TWfxPluginFileSource;
|
||||
Connection: UTF8String;
|
||||
begin
|
||||
WfxModule:= TWfxModule(tvConnections.Selected.Data);
|
||||
if Assigned(WfxModule) then
|
||||
WfxPluginFileSource:= TWfxPluginFileSource(tvConnections.Selected.Data);
|
||||
if Assigned(WfxPluginFileSource) then
|
||||
begin
|
||||
if WfxModule.WfxNetworkManageConnection(Connection, FS_NM_ACTION_ADD) then
|
||||
if WfxPluginFileSource.WfxModule.WfxNetworkManageConnection(Connection, FS_NM_ACTION_ADD) then
|
||||
begin
|
||||
with tvConnections.Items.AddChild(tvConnections.Selected, Connection) do
|
||||
StateIndex:= 1;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ type
|
|||
function WfxNetworkGetConnection(Index: LongInt; var Connection: UTF8String): Boolean;
|
||||
function WfxNetworkManageConnection(var Connection: UTF8String; Action: LongInt): Boolean;
|
||||
function WfxNetworkOpenConnection(var Connection, RemotePath: UTF8String): Boolean;
|
||||
procedure WfxNetworkCloseConnection(const Connection: UTF8String);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
|
|
@ -549,6 +550,14 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TWFXModule.WfxNetworkCloseConnection(const Connection: UTF8String);
|
||||
begin
|
||||
if Assigned(FsDisconnectW) then
|
||||
FsDisconnectW(PWideChar(UTF8Decode(Connection)))
|
||||
else if Assigned(FsDisconnect) then
|
||||
FsDisconnect(PAnsiChar(UTF8ToSys(Connection)));
|
||||
end;
|
||||
|
||||
constructor TWFXModule.Create;
|
||||
begin
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue