(FILECREATED "24-Jun-86 21:38:38" {QV}<NOTECARDS>1.3K>FGHPATCH076.;1 4605   

      changes to:  (VARS FGHPATCH076COMS))


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT FGHPATCH076COMS)

(RPAQQ FGHPATCH076COMS ((* * Fix to NC.DeleteDatabase to take care of deleteing menus and removing 
			     from NF hash array)
			  (FNS NC.DeleteDatabaseFile)))
(* * Fix to NC.DeleteDatabase to take care of deleteing menus and removing from NF hash array)

(DEFINEQ

(NC.DeleteDatabaseFile
  (LAMBDA (FileNameOrNoteFile InterestedWindow)              (* fgh: "24-Jun-86 21:33")
                                                             (* 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.)


    (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 (FILENAMEFIELD FileName (QUOTE VERSION))
				     then (FULLNAME FileName)
				   else (CAR (FILDIR-EARLIEST FileName))))
	    (COND
	      ((NULL FullFileName)
		(NC.PrintMsg (NC.AttachPromptWindow InterestedWindow)
			       T FileName " does not exist." (CHARACTER 13)
			       "Delete cancelled."
			       (CHARACTER 13))
		(RETURN)))

          (* * Can't delete an open file.)


	    (if (OPENP FullFileName)
		then (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow)
				      T FileName " is an open file." (CHARACTER 13)
				      "Delete cancelled."
				      (CHARACTER 13))
		       (RETURN))                           (* Ask user to confirm twice.)
	    (COND
	      ((NOT (NC.AskYesOrNo (CONCAT "Are you sure you want to delete " (CHARACTER
						   13)
						 FullFileName "?" (CHARACTER 13))
				       " -- " "No" T (NC.AttachPromptWindow InterestedWindow)
				       (NOT InterestedWindow)))
		(NC.PrintMsg (NC.AttachPromptWindow InterestedWindow)
			       T FullFileName " not deleted." (CHARACTER 13))
		(RETURN)))
	    (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow)
			   T "Deleteing " FullFileName (CHARACTER 13))
	    (DISMISS 1000)
	    (COND
	      ((NOT (NC.AskYesOrNo (CONCAT "Are you still sure you want to delete "
						 (CHARACTER 13)
						 FullFileName "?" (CHARACTER 13))
				       " -- " "No" T (NC.AttachPromptWindow InterestedWindow)
				       (NOT InterestedWindow)))
		(NC.PrintMsg (NC.AttachPromptWindow InterestedWindow)
			       T FullFileName " not deleted." (CHARACTER 13))
		(RETURN)))

          (* * Remove this NF from NoteFiles hash array. array and close down any menu)


	    (LET ((NoteFileObject (NC.NoteFileFromFileName FullFileName))
		  Menu)
	         (if NoteFileObject
		     then (PUTHASH (fetch (NoteFile UID) of NoteFileObject)
				       NIL NC.NoteFilesHashArray)
			    (SETQ Menu (fetch (NoteFile Menu) of NoteFileObject))
			    (if Menu
				then (CLOSEW (WFROMMENU Menu)))))

          (* * Delete the file)


	    (SETQ FullFileName (DELFILE FullFileName))
	    (SETQ NC.DatabaseFileNameSuggestion NIL)
	    (NC.PrintMsg (NC.AttachPromptWindow InterestedWindow)
			   T FullFileName " deleted." (CHARACTER 13))
	    (DISMISS 250)
	    (NC.ClearMsg (NC.AttachPromptWindow InterestedWindow)
			   T))))
)
(PUTPROPS FGHPATCH076 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (498 4523 (NC.DeleteDatabaseFile 508 . 4521)))))
STOP