(FILECREATED " 3-Dec-86 17:58:50" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH004.;2 5494 changes to: (VARS PMIPATCH004COMS) (FNS NC.DeleteDatabaseFile) previous date: " 3-Dec-86 17:45:37" {QV}<NOTECARDS>1.3K>NEXT>PMIPATCH004.;1) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT PMIPATCH004COMS) (RPAQQ PMIPATCH004COMS ((* * Fixes bug #221: Deleting an open NoteFile now aborts.) (* * Change to NCDATABASE) (FNS NC.DeleteDatabaseFile))) (* * Fixes bug #221: Deleting an open NoteFile now aborts.) (* * Change to NCDATABASE) (DEFINEQ (NC.DeleteDatabaseFile (LAMBDA (FileNameOrNoteFile InterestedWindow Don'tConfirmFlg QuietFlg) (* pmi: " 3-Dec-86 17:40") (* Delete file FileName) (* * rht 8/7/84: If delete happens, clear NC.DatabaseFileNameSuggestion.) (* * rht 3/17/85: Fixed for case when user specifies version number of file to delete.) (* * fkr 11/8/85: Ripped out PSA.Database check. Added check for file open.) (* * kirk 23Jan86 Changed to use NC.AskYesOrNo) (* * fgh 6/24/86 Added ability to pass down NoteFile object as well as file name. Added code to remove NF from NFs hash array and remove the menu on the screen.) (* * rht 7/2/86: No longer prints completed message with DISMISS. Now returns non-nil if successful. Accepts Don'tConfirmFlg arg.) (* * fgh 7/5/86 Added call to RemoveAccessToNoteFile.) (* * rht 7/13/86: Added QuietFlg arg.) (* * kef 8/8/86: Factored out into device specific vectors.) (* * pmi 12/3/86 Added check for open file) (DECLARE (GLOBALVARS NC.MsgDelay)) (PROG ((FileName (if (type? NoteFile FileNameOrNoteFile) then (fetch (NoteFile FullFileName) of FileNameOrNoteFile) else FileNameOrNoteFile)) FullFileName) (* Make sure no open databases) (* Get file name) (AND (NULL FileName) (NULL (SETQ FileName (NC.DatabaseFileName "Name of Notefile to be deleted:" " -- " T NIL NIL InterestedWindow))) (RETURN NIL)) (* make sure to be deleted file exists) (SETQ FullFileName (if (EQ (FILENAMEFIELD FileName (QUOTE HOST)) (QUOTE DSK)) then (if (FILENAMEFIELD FileName (QUOTE VERSION)) then (FULLNAME FileName) else (CAR (FILDIR-EARLIEST FileName))) else FileName)) (* * Don't try to delete if the NoteFile is open) (if (OPENP FullFileName) then (NC.PrintMsg InterestedWindow T "Can't delete an open notefile." (CHARACTER 13)) (DISMISS NC.MsgDelay) (NC.ClearMsg InterestedWindow T) (RETURN NIL)) (* * Can't delete a non-existent file.) (if (NULL FullFileName) then (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow) T FileName " does not exist." (CHARACTER 13) "Delete cancelled." (CHARACTER 13)) (RETURN)) (* * Ask user to confirm twice.) (OR Don'tConfirmFlg (if (NOT (NC.AskYesOrNo (CONCAT "Are you sure you want to delete " (CHARACTER 13) FullFileName "?" (CHARACTER 13)) " -- " "No" T (NC.AttachPromptWindow InterestedWindow) (NOT InterestedWindow))) then (OR QuietFlg (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow) T FullFileName " not deleted." (CHARACTER 13))) (RETURN))) (OR QuietFlg (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow) T "Deleting" FullFileName (CHARACTER 13))) (DISMISS 1000) (OR Don'tConfirmFlg (if (NOT (NC.AskYesOrNo (CONCAT "Are you still sure you want to delete " (CHARACTER 13) FullFileName "?" (CHARACTER 13)) " -- " "No" T (NC.AttachPromptWindow InterestedWindow) (NOT InterestedWindow))) then (OR QuietFlg (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow) T FullFileName " not deleted." (CHARACTER 13))) (RETURN))) (* * Delete the file) (SETQ FullFileName (APPLY* (fetch (NoteFileDevice DeleteNoteFileFn) of (GETHASH (COND ((NC.RemoteHostP FullFileName) (QUOTE REMOTEMULTIUSER)) (T (QUOTE LOCALSINGLEUSER))) NC.DeviceVectorsHashArray)) FullFileName)) (if (NULL FullFileName) then (RETURN)) (NC.RemoveAccessToNoteFile FullFileName) (SETQ NC.DatabaseFileNameSuggestion NIL) (NC.ClearMsg InterestedWindow T) (RETURN FullFileName)))) ) (PUTPROPS PMIPATCH004 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (605 5412 (NC.DeleteDatabaseFile 615 . 5410))))) STOP