/* specialview.js Registry for views that occupy the file area but are not directory listings - the trash bin is the first, and anything else that wants a sentinel path plus its own renderer registers here rather than adding another branch to listDirectory(). A view registers itself at load time: registerSpecialView("%trashbin%", { icon: "trash", //FSIcons key drawn in the path bar labelKey: "trash/title", //applocale key for the root label labelFallback: "Trash Bin", hideViewModes: true, //grid/list/details make no sense here hidePropertiesPane: true, //neither does the properties pane sidebar: true, //optional, give it a sidebar entry desktopIcon: "...", //optional, see below toolbar: ["refresh", "delete"], //which file operations work here toolbarHandlers: { //optional, how it performs them delete: function(){ ... } }, render: function(callback){ ... }, search: function(keyword, caseSensitive){ ... }, //optional drop: function(filepaths){ ... }, //optional, files dragged onto it open: function(){ ... }, //optional, how the sidebar opens it leave: function(){ ... } //optional, navigating away }); A view that leaves out "search" simply keeps whatever it last drew when the user presses Enter in the search box, since handleSearch() has nothing to hand the keyword to and the server-side search cannot see these rows. A view with a "drop" handler accepts files dragged onto its sidebar entry, and onto its icon on the desktop. It is given the vpaths of what was dropped and decides what that means - the trash bin recycles them. A view without one ignores drops rather than attempting a move into a path that does not exist. A view with a "sidebar" entry can also be put on the desktop, through the right click menu on that entry. The shortcut it writes is an ordinary .shortcut file of type "folder" whose path is the sentinel, so the desktop opens it by launching the File Manager there - the same way it opens a shortcut to any other folder. "desktopIcon" is the image written into that file; leave it out and the icon registered for the path in shared/specialpaths.js is used, which is what both the desktop and the file listing draw anyway. "toolbar" lists the data-opr names from the file operation bar that mean something in this view. Everything else is greyed out and made unclickable, in both the bar and the overflow menu - a view is not a directory, and the bar would otherwise happily offer to upload a file into the trash bin or paste a clipboard into it. Omit it (or pass false) to disable the bar entirely; a view that omits it gets nothing rather than everything, since the operations all assume a real directory underneath. Listing an operation is a promise that it works. Ones that are really navigation work as they always did. The rest need an entry in "toolbarHandlers", which runSpecialViewOperation() dispatches to from the host function. The full set of keys, which are the data-opr values in file_explorer.html. Both "toolbar" and "toolbarHandlers" use these names: Key Toolbar label Host function Defined in ------------ -------------- ----------------- -------------- open Open openViaButton() open.js openwith Open with... openWith() openwith.js copy Copy copy() clipboard.js cut Cut cut() clipboard.js paste Paste paste() clipboard.js rename Rename rename() rename.js delete Delete deleteFile() delete.js * upload Upload upload() upload.js download Download downloadFile() download.js share Share shareFile() share.js newfile New File newfile() create.js newfolder New Folder newFolder() create.js zip Create Zip zipFile() archive.js unzip Unzip Here unzipHere() archive.js refresh Refresh refreshList() listing.js + home Home openHomeDir() pathbar.js + fileinfo File Info showFileProperties() properties.js * * already has a runSpecialViewOperation() hand-off, so a handler under this key is called instead of the normal behaviour + navigation, works in any view without a handler - refreshList() comes back through listDirectory() and so through this view's render() Wiring up a key that is not yet marked * takes two lines at the top of its host function, the same shape delete.js and properties.js already use: function copy(){ if (runSpecialViewOperation("copy")){ return; } ... Then add the key to "toolbar" and its implementation to "toolbarHandlers". Listing a key WITHOUT doing that leaves the button live but running the normal directory code against rows that are not .fileObject elements, which is the failure this whole mechanism exists to prevent - so only list what is genuinely wired. listDirectory() then does the lookup and hands over, and updatePathDisplay() uses the icon and label instead of showing the raw sentinel. Part of the ArozOS File Manager. Loaded as a plain script from file_explorer.html - see the