From 53c90e63b4389b1c3cfa67996d6d5eaefadf5f80 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Wed, 14 Nov 2001 08:19:23 +0000 Subject: [PATCH] Turning on new C++ filepicker code (bug 82854). r=jag, sr=ben. --- xpfe/components/filepicker/Makefile.in | 2 +- .../filepicker/res/content/filepicker.js | 32 +++++++++++-------- .../filepicker/res/content/filepicker.xul | 3 +- .../filepicker/res/content/makefile.win | 0 .../filepicker/res/content/nsFileView.js | 0 .../filepicker/res/locale/en-US/MANIFEST | 0 .../filepicker/res/locale/en-US/makefile.win | 0 .../filepicker/res/locale/makefile.win | 0 xpfe/components/filepicker/res/makefile.win | 0 xpfe/components/filepicker/src/Makefile.in | 20 ++++++++++++ xpfe/components/filepicker/src/makefile.win | 16 ++++++++++ xpfe/components/jar.mn | 1 - 12 files changed, 56 insertions(+), 18 deletions(-) delete mode 100644 xpfe/components/filepicker/res/content/makefile.win delete mode 100644 xpfe/components/filepicker/res/content/nsFileView.js delete mode 100644 xpfe/components/filepicker/res/locale/en-US/MANIFEST delete mode 100644 xpfe/components/filepicker/res/locale/en-US/makefile.win delete mode 100644 xpfe/components/filepicker/res/locale/makefile.win delete mode 100644 xpfe/components/filepicker/res/makefile.win diff --git a/xpfe/components/filepicker/Makefile.in b/xpfe/components/filepicker/Makefile.in index f2b0524939f..6ac5cd85872 100644 --- a/xpfe/components/filepicker/Makefile.in +++ b/xpfe/components/filepicker/Makefile.in @@ -29,7 +29,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk ifeq (,$(filter beos os2 mac,$(MOZ_WIDGET_TOOLKIT))) -DIRS = src +DIRS = public src endif include $(topsrcdir)/config/rules.mk diff --git a/xpfe/components/filepicker/res/content/filepicker.js b/xpfe/components/filepicker/res/content/filepicker.js index 50ec232d029..8382f601d31 100644 --- a/xpfe/components/filepicker/res/content/filepicker.js +++ b/xpfe/components/filepicker/res/content/filepicker.js @@ -28,6 +28,11 @@ const nsIFilePicker = Components.interfaces.nsIFilePicker; const nsIDirectoryServiceProvider = Components.interfaces.nsIDirectoryServiceProvider; const nsIDirectoryServiceProvider_CONTRACTID = "@mozilla.org/file/directory_service;1"; const nsIOutlinerBoxObject = Components.interfaces.nsIOutlinerBoxObject; +const nsIFileView = Components.interfaces.nsIFileView; +const nsFileView_CONTRACTID = "@mozilla.org/filepicker/fileview;1"; +const nsIOutlinerView = Components.interfaces.nsIOutlinerView; +const nsILocalFile = Components.interfaces.nsILocalFile; +const nsLocalFile_CONTRACTID = "@mozilla.org/file/local;1"; var sfile = Components.classes[nsLocalFile_CONTRACTID].createInstance(nsILocalFile); var retvals; @@ -45,8 +50,7 @@ function filepickerLoad() { textInput = document.getElementById("textInput"); okButton = document.documentElement.getButton("accept"); - outlinerView = new nsFileView(); - outlinerView.selectionCallback = onSelect; + outlinerView = Components.classes[nsFileView_CONTRACTID].createInstance(nsIFileView); if (window.arguments) { var o = window.arguments[0]; @@ -334,13 +338,13 @@ function convertColumnIDtoSortType(columnID) { switch (columnID) { case "FilenameColumn": - sortKey = nsFileView.SORTTYPE_NAME; + sortKey = nsIFileView.sortName; break; case "FileSizeColumn": - sortKey = nsFileView.SORTTYPE_SIZE; + sortKey = nsIFileView.sortSize; break; case "LastModifiedColumn": - sortKey = nsFileView.SORTTYPE_DATE; + sortKey = nsIFileView.sortDate; break; default: dump("unsupported sort column: " + columnID + "\n"); @@ -354,7 +358,7 @@ function convertColumnIDtoSortType(columnID) { function handleColumnClick(columnID) { var sortType = convertColumnIDtoSortType(columnID); var sortOrder = (outlinerView.sortType == sortType) ? !outlinerView.reverseSort : false; - outlinerView.sort(sortType, sortOrder, false); + outlinerView.sort(sortType, sortOrder); // set the sort indicator on the column we are sorted by var sortedColumn = document.getElementById(columnID); @@ -378,10 +382,6 @@ function handleColumnClick(columnID) { } } -function doSort(sortType) { - outlinerView.sort(sortType, false); -} - function onKeypress(e) { if (e.keyCode == 8) /* backspace */ goUp(); @@ -406,7 +406,7 @@ function doEnabling() { function onOutlinerFocus(event) { // Reset the button label and enabled/disabled state. - onSelect(outlinerView.getSelectedFile()); + onFileSelected(outlinerView.getSelectedFile()); } function getOKAction(file) { @@ -434,7 +434,11 @@ function getOKAction(file) { return buttonLabel; } -function onSelect(file) { +function onSelect(event) { + onFileSelected(outlinerView.getSelectedFile()); +} + +function onFileSelected(file) { if (file) { var path = file.unicodeLeafName; @@ -515,10 +519,10 @@ function gotoDirectory(directory) { addToHistory(directory.unicodePath); window.setCursor("wait"); - outlinerView.setDirectory(directory.unicodePath); + outlinerView.setDirectory(directory); window.setCursor("auto"); - outlinerView.selection.clearSelection(); + outlinerView.QueryInterface(nsIOutlinerView).selection.clearSelection(); textInput.focus(); sfile = directory; } diff --git a/xpfe/components/filepicker/res/content/filepicker.xul b/xpfe/components/filepicker/res/content/filepicker.xul index 34f343d02f5..473dc96cbf0 100644 --- a/xpfe/components/filepicker/res/content/filepicker.xul +++ b/xpfe/components/filepicker/res/content/filepicker.xul @@ -40,7 +40,6 @@ persist="screenX screenY"> -