Turning on new C++ filepicker code (bug 82854). r=jag, sr=ben.
This commit is contained in:
Родитель
b69ed06ca6
Коммит
53c90e63b4
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
persist="screenX screenY">
|
||||
|
||||
<stringbundle id="bundle_filepicker" src="chrome://global/locale/filepicker.properties"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsFileView.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/filepicker.js"/>
|
||||
|
||||
<hbox align="center">
|
||||
|
@ -66,7 +65,7 @@
|
|||
<outlinercol id="LastModifiedColumn" label="&lastModified.label;" flex="1"
|
||||
class="outlinercol-header outlinercell-inset-header sortDirectionIndicator"/>
|
||||
|
||||
<outlinerbody flex="1" onselect="this.parentNode.outlinerBoxObject.view.selectionChanged()"/>
|
||||
<outlinerbody flex="1" onselect="onSelect(event);"/>
|
||||
</outliner>
|
||||
</hbox>
|
||||
|
||||
|
|
|
@ -27,6 +27,26 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = filepicker
|
||||
LIBRARY_NAME = fileview
|
||||
SHORT_LIBNAME = fileview
|
||||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsFileViewModule
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
layout \
|
||||
dom \
|
||||
string \
|
||||
locale \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsFileView.cpp \
|
||||
nsWildCard.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
install::
|
||||
|
|
|
@ -21,6 +21,22 @@
|
|||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
MODULE = filepicker
|
||||
REQUIRES = xpcom \
|
||||
layout \
|
||||
dom \
|
||||
string \
|
||||
locale \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
LIBRARY_NAME=fileview
|
||||
MODULE_NAME=nsFileViewModule
|
||||
|
||||
CPP_OBJS = .\$(OBJDIR)\nsFileView.obj \
|
||||
.\$(OBJDIR)\nsWildCard.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
|
|
|
@ -173,4 +173,3 @@ toolkit.jar:
|
|||
content/global/autocomplete.css (autocomplete/resources/content/autocomplete.css)
|
||||
content/global/filepicker.js (filepicker/res/content/filepicker.js)
|
||||
content/global/filepicker.xul (filepicker/res/content/filepicker.xul)
|
||||
content/global/nsFileView.js (filepicker/res/content/nsFileView.js)
|
||||
|
|
Загрузка…
Ссылка в новой задаче