diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-10-12 12:16:57 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-10-12 12:16:57 +0200 |
| commit | 928e2dc79b46a455ef0c0096ddf40682e07b4a27 (patch) | |
| tree | 85cf08ae19bdd5ac44261802b2e16972cc38e792 /vfs/UVFSCore.pas | |
| parent | c29edff595cff9d43a607c15b5af6e2ec101263a (diff) | |
| download | tuxcmd-928e2dc79b46a455ef0c0096ddf40682e07b4a27.tar.xz | |
Implement VFS question and password callbacksv0.6.53
Diffstat (limited to 'vfs/UVFSCore.pas')
| -rw-r--r-- | vfs/UVFSCore.pas | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas index 0237121..e884a09 100644 --- a/vfs/UVFSCore.pas +++ b/vfs/UVFSCore.pas @@ -67,6 +67,7 @@ type FVFSGetServices: TVFSGetServices; FVFSSetPassword: TVFSSetPassword; FVFSGetPasswordRequired: TVFSGetPasswordRequired; + FVFSSetCallbacks: TVFSSetCallbacks; public ModuleHandle: Pointer; FullPath: string; // module path @@ -95,14 +96,15 @@ type public ArchiveMode: boolean; constructor Create(SourcePlugin: TVFSPlugin); - function VFSOpenURI(OpenFile: string): boolean; + function VFSOpenURI(URI: string; AskQuestionCallback: PVFSAskQuestionCallback; AskPasswordCallback: PVFSAskPasswordCallback; CallbackData: Pointer): boolean; function VFSOpenEx(OpenFile: string): TVFSResult; function VFSClose: boolean; destructor Destroy; override; function GetListing(var List: TList; const AddDotFiles: boolean): integer; override; function GetListing(var List: TList; const AddDotFiles: boolean; APath: string): integer; override; - function ChangeDir(const NewPath: string; const ShowProgress: boolean = True): integer; override; + function ChangeDir(const NewPath: string): integer; override; + function ChangeDirEx(const NewPath: string; AskQuestionCallback: PVFSAskQuestionCallback; AskPasswordCallback: PVFSAskPasswordCallback; CallbackData: Pointer): integer; function ExplicitChDir(const NewPath: string): integer; override; function GetFileSystemSize: Int64; override; function GetFileSystemSize(const APath: string): Int64; override; @@ -223,6 +225,7 @@ begin @FVFSGetServices := dlsym(ModuleHandle, 'VFSGetServices'); @FVFSSetPassword := dlsym(ModuleHandle, 'VFSSetPassword'); @FVFSGetPasswordRequired := dlsym(ModuleHandle, 'VFSGetPasswordRequired'); + @FVFSSetCallbacks := dlsym(ModuleHandle, 'VFSSetCallbacks'); // Initialize the extensions list SetLength(Extensions, 0); SetLength(Services, 0); @@ -305,11 +308,16 @@ begin end; end; -function TVFSEngine.VFSOpenURI(OpenFile: string): boolean; +function TVFSEngine.VFSOpenURI(URI: string; AskQuestionCallback: PVFSAskQuestionCallback; AskPasswordCallback: PVFSAskPasswordCallback; CallbackData: Pointer): boolean; begin Result := False; - if (FGlobs <> nil) and (@FSourcePlugin.FVFSOpen <> nil) - then Result := FSourcePlugin.FVFSOpen(FGlobs, PChar(OpenFile)) = cVFS_OK; + if (FGlobs <> nil) and (@FSourcePlugin.FVFSOpen <> nil) then begin + if @FSourcePlugin.FVFSSetCallbacks <> nil then + FSourcePlugin.FVFSSetCallbacks(FGlobs, AskQuestionCallback, AskPasswordCallback, CallbackData); + Result := FSourcePlugin.FVFSOpen(FGlobs, PChar(URI)) = cVFS_OK; + if @FSourcePlugin.FVFSSetCallbacks <> nil then + FSourcePlugin.FVFSSetCallbacks(FGlobs, nil, nil, nil); + end; end; function TVFSEngine.VFSOpenEx(OpenFile: string): TVFSResult; @@ -489,7 +497,7 @@ begin else Result := '/'; end; -function TVFSEngine.ChangeDir(const NewPath: string; const ShowProgress: boolean = True): integer; +function TVFSEngine.ChangeDir(const NewPath: string): integer; begin DebugMsg(['^^VFS (II): ChangeDir begin']); Result := 0; @@ -502,6 +510,18 @@ begin DebugMsg(['^^VFS (II): ChangeDir end.']); end; +function TVFSEngine.ChangeDirEx(const NewPath: string; AskQuestionCallback: PVFSAskQuestionCallback; AskPasswordCallback: PVFSAskPasswordCallback; CallbackData: Pointer): integer; +begin + if (FGlobs <> nil) and (@FSourcePlugin.FVFSChangeDir <> nil) then begin + if @FSourcePlugin.FVFSSetCallbacks <> nil then + FSourcePlugin.FVFSSetCallbacks(FGlobs, AskQuestionCallback, AskPasswordCallback, CallbackData); + Result := ChangeDir(NewPath); + if @FSourcePlugin.FVFSSetCallbacks <> nil then + FSourcePlugin.FVFSSetCallbacks(FGlobs, nil, nil, nil); + end; +end; + + procedure TVFSEngine.SetPath(Value: string); begin ChangeDir(Value); |
