diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-29 23:30:02 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-29 23:30:02 +0100 |
| commit | d7ad13f338b1c403741ad2104247db1c175b3303 (patch) | |
| tree | 76053645d07adb9a49161f8057492691d372208d /vfs/UVFSCore.pas | |
| parent | 1579ebd8821f6501119ae35558fbe6503e2f7e74 (diff) | |
| download | tuxcmd-d7ad13f338b1c403741ad2104247db1c175b3303.tar.xz | |
Fix callback setting for non-archiving modules
Diffstat (limited to 'vfs/UVFSCore.pas')
| -rw-r--r-- | vfs/UVFSCore.pas | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas index ff5445d..3e14618 100644 --- a/vfs/UVFSCore.pas +++ b/vfs/UVFSCore.pas @@ -843,23 +843,25 @@ end; function TVFSEngine.StartCopyOperation(Sender: Pointer; ErrorFunc: TEngineErrorFunc; AskQuestionCallback: PVFSAskQuestionCallback; AskPasswordCallback: PVFSAskPasswordCallback; ProgressCallback: PVFSProgressCallback; CallbackData: Pointer): boolean; var Res: TVFSResult; begin - Result := False; + Result := not ArchiveMode; try if @FSourcePlugin.FVFSSetCallbacks <> nil then FSourcePlugin.FVFSSetCallbacks(FGlobs, AskQuestionCallback, AskPasswordCallback, ProgressCallback, CallbackData); - if @FSourcePlugin.FVFSStartCopyOperation <> nil then begin - Res := FSourcePlugin.FVFSStartCopyOperation(FGlobs); - Result := Res = cVFS_OK; - // * TODO: Port to GError - if (Res <> cVFS_OK) and Assigned(ErrorFunc) then - case Res of - cVFS_ReadErr: Result := ErrorFunc(Sender, 6, 0, 'StartCopyOperation'); - cVFS_WriteErr: Result := ErrorFunc(Sender, 7, 0, 'StartCopyOperation'); - cVFS_mallocFailed: ErrorFunc(Sender, 1, 0, 'StartCopyOperation'); - cVFS_Cancelled: ErrorFunc(Sender, 0, 0, 'StartCopyOperation'); - end; - end else - ErrorFunc(Sender, 2, 0, 'StartCopyOperation not supported'); + if ArchiveMode then begin + if @FSourcePlugin.FVFSStartCopyOperation <> nil then begin + Res := FSourcePlugin.FVFSStartCopyOperation(FGlobs); + Result := Res = cVFS_OK; + // * TODO: Port to GError + if (Res <> cVFS_OK) and Assigned(ErrorFunc) then + case Res of + cVFS_ReadErr: Result := ErrorFunc(Sender, 6, 0, 'StartCopyOperation'); + cVFS_WriteErr: Result := ErrorFunc(Sender, 7, 0, 'StartCopyOperation'); + cVFS_mallocFailed: ErrorFunc(Sender, 1, 0, 'StartCopyOperation'); + cVFS_Cancelled: ErrorFunc(Sender, 0, 0, 'StartCopyOperation'); + end; + end else + ErrorFunc(Sender, 2, 0, 'StartCopyOperation not supported'); + end; except on E: Exception do DebugMsg(['*** Exception raised in TVFSEngine.StartCopyOperation(Sender=', QWord(Sender), '): (', E.ClassName, '): ', E.Message]); end; @@ -868,23 +870,25 @@ end; function TVFSEngine.StopCopyOperation(Sender: Pointer; ErrorFunc: TEngineErrorFunc): boolean; var Res: TVFSResult; begin - Result := False; + Result := not ArchiveMode; try if @FSourcePlugin.FVFSSetCallbacks <> nil then FSourcePlugin.FVFSSetCallbacks(FGlobs, nil, nil, nil, nil); - if @FSourcePlugin.FVFSStopCopyOperation <> nil then begin - Res := FSourcePlugin.FVFSStopCopyOperation(FGlobs); - Result := Res = cVFS_OK; - // * TODO: Port to GError - if (Res <> cVFS_OK) and Assigned(ErrorFunc) then - case Res of - cVFS_ReadErr: Result := ErrorFunc(Sender, 6, 0, 'StopCopyOperation'); - cVFS_WriteErr: Result := ErrorFunc(Sender, 7, 0, 'StopCopyOperation'); - cVFS_mallocFailed: ErrorFunc(Sender, 1, 0, 'StopCopyOperation'); - cVFS_Cancelled: ErrorFunc(Sender, 0, 0, 'StopCopyOperation'); - end; - end else - ErrorFunc(Sender, 5, 0, 'StopCopyOperation not supported'); + if ArchiveMode then begin + if @FSourcePlugin.FVFSStopCopyOperation <> nil then begin + Res := FSourcePlugin.FVFSStopCopyOperation(FGlobs); + Result := Res = cVFS_OK; + // * TODO: Port to GError + if (Res <> cVFS_OK) and Assigned(ErrorFunc) then + case Res of + cVFS_ReadErr: Result := ErrorFunc(Sender, 6, 0, 'StopCopyOperation'); + cVFS_WriteErr: Result := ErrorFunc(Sender, 7, 0, 'StopCopyOperation'); + cVFS_mallocFailed: ErrorFunc(Sender, 1, 0, 'StopCopyOperation'); + cVFS_Cancelled: ErrorFunc(Sender, 0, 0, 'StopCopyOperation'); + end; + end else + ErrorFunc(Sender, 5, 0, 'StopCopyOperation not supported'); + end; except on E: Exception do DebugMsg(['*** Exception raised in TVFSEngine.StopCopyOperation(Sender=', QWord(Sender), '): (', E.ClassName, '): ', E.Message]); end; |
