Compare commits
2 Commits
OUTLINER_F
...
mozilla
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a637f81f7f | ||
|
|
6cfadae5d1 |
48
mozilla/mozilla.kdevprj
Normal file
48
mozilla/mozilla.kdevprj
Normal file
@@ -0,0 +1,48 @@
|
||||
# KDE Config File
|
||||
[mozilla.lsm]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=DATA
|
||||
[Config for BinMakefileAm]
|
||||
ldflags=
|
||||
cxxflags=-O0 -g3 -Wall
|
||||
bin_program=mozilla
|
||||
[po/Makefile.am]
|
||||
sub_dirs=
|
||||
type=po
|
||||
[LFV Groups]
|
||||
Dialogs=*.kdevdlg,
|
||||
Others=*,
|
||||
Translations=*.po,
|
||||
groups=Headers,Sources,Dialogs,Translations,Others,
|
||||
Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l,
|
||||
Headers=*.h,*.hh,*.hxx,*.hpp,*.H,
|
||||
[mozilla.kdevprj]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=DATA
|
||||
[mozilla/docs/en/Makefile.am]
|
||||
sub_dirs=
|
||||
type=normal
|
||||
[mozilla/Makefile.am]
|
||||
sub_dirs=
|
||||
type=prog_main
|
||||
[General]
|
||||
makefiles=Makefile.am,mozilla/Makefile.am,mozilla/docs/Makefile.am,mozilla/docs/en/Makefile.am,po/Makefile.am,
|
||||
version_control=CVS
|
||||
author=Heikki Toivonen
|
||||
project_type=normal_empty
|
||||
sub_dir=mozilla/
|
||||
version=0.1
|
||||
project_name=Mozilla
|
||||
email=heikki@netscape.com
|
||||
kdevprj_version=1.2
|
||||
[Makefile.am]
|
||||
files=mozilla.kdevprj,mozilla.lsm,
|
||||
sub_dirs=mozilla,
|
||||
type=normal
|
||||
[mozilla/docs/Makefile.am]
|
||||
sub_dirs=
|
||||
type=normal
|
||||
14
mozilla/mozilla.lsm
Normal file
14
mozilla/mozilla.lsm
Normal file
@@ -0,0 +1,14 @@
|
||||
Begin3
|
||||
Title: Mozilla
|
||||
Version: 0.1
|
||||
Entered-date:
|
||||
Description:
|
||||
Keywords:
|
||||
Author: Heikki Toivonen <heikki@netscape.com>
|
||||
Maintained-by: Heikki Toivonen <heikki@netscape.com>
|
||||
Primary-site:
|
||||
Home-page: http://
|
||||
Original-site:
|
||||
Platforms: Linux and other Unices
|
||||
Copying-policy: GNU Public License
|
||||
End
|
||||
20
mozilla/mozilla/templates/cpp_template
Normal file
20
mozilla/mozilla/templates/cpp_template
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
20
mozilla/mozilla/templates/header_template
Normal file
20
mozilla/mozilla/templates/header_template
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Joe Hewitt (hewitt@netscape.com)
|
||||
* Brian Ryner (bryner@netscape.com)
|
||||
*/
|
||||
|
||||
/* ===== filepicker.css =================================================
|
||||
== Styles used by the File Picker dialog.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: column widths ::::: */
|
||||
|
||||
#FilenameColumn,
|
||||
#ContentLengthColumn,
|
||||
#LastModifiedDateColumn {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
/* ::::: file/directory items ::::: */
|
||||
|
||||
outlinerbody:-moz-outliner-image(FilenameColumn, directory) {
|
||||
list-style-image: url("chrome://global/skin/filepicker/dir-closed.gif");
|
||||
}
|
||||
|
||||
outlinerbody:-moz-outliner-image(FilenameColumn, file) {
|
||||
list-style-image: url("chrome://global/skin/filepicker/blank.gif");
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Joe Hewitt (hewitt@netscape.com)
|
||||
* Brian Ryner (bryner@netscape.com)
|
||||
*/
|
||||
|
||||
/* ===== filepicker.css =================================================
|
||||
== Styles used by the File Picker dialog.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: column widths ::::: */
|
||||
|
||||
#FilenameColumn,
|
||||
#ContentLengthColumn,
|
||||
#LastModifiedDateColumn {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
/* ::::: file/directory items ::::: */
|
||||
|
||||
outlinerbody:-moz-outliner-image(FilenameColumn, directory) {
|
||||
list-style-image: url("chrome://global/skin/filepicker/dir-closed.gif");
|
||||
}
|
||||
|
||||
outlinerbody:-moz-outliner-image(FilenameColumn, file) {
|
||||
list-style-image: url("chrome://global/skin/filepicker/blank.gif");
|
||||
}
|
||||
|
||||
@@ -1,463 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
* Brian Ryner <bryner@netscape.com>
|
||||
* Jan Varga <varga@utcru.sk>
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const nsIDirectoryServiceProvider = Components.interfaces.nsIDirectoryServiceProvider;
|
||||
const nsIDirectoryServiceProvider_CONTRACTID = "@mozilla.org/file/directory_service;1";
|
||||
const nsStdURL_CONTRACTID = "@mozilla.org/network/standard-url;1";
|
||||
const nsIFileURL = Components.interfaces.nsIFileURL;
|
||||
const nsIOutlinerBoxObject = Components.interfaces.nsIOutlinerBoxObject;
|
||||
|
||||
var sfile = Components.classes[nsLocalFile_CONTRACTID].createInstance(nsILocalFile);
|
||||
var retvals;
|
||||
var filePickerMode;
|
||||
var dirHistory;
|
||||
var homeDir;
|
||||
var outlinerView;
|
||||
|
||||
var textInput;
|
||||
var okButton;
|
||||
|
||||
var gFilePickerBundle;
|
||||
|
||||
function filepickerLoad() {
|
||||
gFilePickerBundle = document.getElementById("bundle_filepicker");
|
||||
|
||||
dirHistory = new Array();
|
||||
|
||||
textInput = document.getElementById("textInput");
|
||||
okButton = document.getElementById("ok");
|
||||
outlinerView = new nsFileView();
|
||||
outlinerView.selectionCallback = onSelect;
|
||||
|
||||
if (window.arguments) {
|
||||
var o = window.arguments[0];
|
||||
retvals = o.retvals; /* set this to a global var so we can set return values */
|
||||
const title = o.title;
|
||||
filePickerMode = o.mode;
|
||||
if (o.displayDirectory) {
|
||||
const directory = o.displayDirectory.unicodePath;
|
||||
}
|
||||
const initialText = o.defaultString;
|
||||
const filterTitles = o.filters.titles;
|
||||
const filterTypes = o.filters.types;
|
||||
const numFilters = filterTitles.length;
|
||||
|
||||
window.title = title;
|
||||
|
||||
if (initialText) {
|
||||
textInput.value = initialText;
|
||||
}
|
||||
}
|
||||
|
||||
if ((filePickerMode == nsIFilePicker.modeOpen) ||
|
||||
(filePickerMode == nsIFilePicker.modeSave)) {
|
||||
|
||||
window.setCursor("wait");
|
||||
outlinerView.setFilter(filterTypes[0]);
|
||||
window.setCursor("auto");
|
||||
|
||||
/* build filter popup */
|
||||
var filterPopup = document.createElement("menupopup");
|
||||
|
||||
for (var i = 0; i < numFilters; i++) {
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("label", filterTitles[i] + " (" + filterTypes[i] + ")");
|
||||
menuItem.setAttribute("filters", filterTypes[i]);
|
||||
filterPopup.appendChild(menuItem);
|
||||
}
|
||||
|
||||
var filterMenuList = document.getElementById("filterMenuList");
|
||||
filterMenuList.appendChild(filterPopup);
|
||||
if (numFilters > 0)
|
||||
filterMenuList.selectedIndex = 0;
|
||||
var filterBox = document.getElementById("filterBox");
|
||||
filterBox.removeAttribute("hidden");
|
||||
} else if (filePickerMode == nsIFilePicker.modeGetFolder) {
|
||||
outlinerView.showOnlyDirectories = true;
|
||||
}
|
||||
|
||||
// start out with a filename sort
|
||||
handleColumnClick("FilenameColumn");
|
||||
|
||||
try {
|
||||
var buttonLabel;
|
||||
switch (filePickerMode) {
|
||||
case nsIFilePicker.modeOpen:
|
||||
buttonLabel = gFilePickerBundle.getString("openButtonLabel");
|
||||
break;
|
||||
case nsIFilePicker.modeSave:
|
||||
buttonLabel = gFilePickerBundle.getString("saveButtonLabel");
|
||||
break;
|
||||
case nsIFilePicker.modeGetFolder:
|
||||
buttonLabel = gFilePickerBundle.getString("selectFolderButtonLabel");
|
||||
break;
|
||||
}
|
||||
|
||||
if (buttonLabel) {
|
||||
okButton.setAttribute("label", buttonLabel);
|
||||
}
|
||||
} catch (exception) {
|
||||
// keep it set to "OK"
|
||||
}
|
||||
|
||||
// setup the dialogOverlay.xul button handlers
|
||||
doSetOKCancel(onOK, onCancel);
|
||||
|
||||
// get the home dir
|
||||
var dirServiceProvider = Components.classes[nsIDirectoryServiceProvider_CONTRACTID]
|
||||
.getService(nsIDirectoryServiceProvider);
|
||||
var persistent = new Object();
|
||||
homeDir = dirServiceProvider.getFile("Home", persistent);
|
||||
|
||||
if (directory) {
|
||||
sfile.initWithUnicodePath(directory);
|
||||
}
|
||||
if (!directory || !(sfile.exists() && sfile.isDirectory())) {
|
||||
// Start in the user's home directory
|
||||
sfile.initWithUnicodePath(homeDir.unicodePath);
|
||||
}
|
||||
|
||||
retvals.buttonStatus = nsIFilePicker.returnCancel;
|
||||
|
||||
gotoDirectory(sfile);
|
||||
var outliner = document.getElementById("directoryOutliner");
|
||||
outliner.outlinerBoxObject.view = outlinerView;
|
||||
|
||||
doEnabling();
|
||||
textInput.focus();
|
||||
}
|
||||
|
||||
function onFilterChanged(target)
|
||||
{
|
||||
var filterTypes = target.getAttribute("filters");
|
||||
window.setCursor("wait");
|
||||
outlinerView.setFilter(filterTypes);
|
||||
window.setCursor("auto");
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
var errorTitle, errorMessage, promptService;
|
||||
var ret = nsIFilePicker.returnCancel;
|
||||
|
||||
var isDir = false;
|
||||
var isFile = false;
|
||||
|
||||
var input = textInput.value;
|
||||
if (input[0] == '~') // XXX XP?
|
||||
input = homeDir.unicodePath + input.substring(1);
|
||||
|
||||
var file = sfile.clone().QueryInterface(nsILocalFile);
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
/* XXX we need an XP way to test for an absolute path! */
|
||||
if (input[0] == '/') /* an absolute path was entered */
|
||||
file.initWithUnicodePath(input);
|
||||
else {
|
||||
try {
|
||||
file.appendRelativeUnicodePath(input);
|
||||
} catch (e) {
|
||||
dump("Can't append relative path '"+input+"':\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!file.exists() && (filePickerMode != nsIFilePicker.modeSave)) {
|
||||
errorTitle = gFilePickerBundle.getFormattedString("errorOpenFileDoesntExistTitle",
|
||||
[file.unicodePath]);
|
||||
errorMessage = gFilePickerBundle.getFormattedString("errorOpenFileDoesntExistMessage",
|
||||
[file.unicodePath]);
|
||||
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
promptService.alert(window, errorTitle, errorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.exists()) {
|
||||
isDir = file.isDirectory();
|
||||
isFile = file.isFile();
|
||||
}
|
||||
|
||||
switch(filePickerMode) {
|
||||
case nsIFilePicker.modeOpen:
|
||||
if (isFile) {
|
||||
retvals.directory = file.parent.unicodePath;
|
||||
ret = nsIFilePicker.returnOK;
|
||||
} else if (isDir) {
|
||||
if (!sfile.equals(file)) {
|
||||
gotoDirectory(file);
|
||||
}
|
||||
textInput.value = "";
|
||||
doEnabling();
|
||||
ret = nsIFilePicker.returnCancel;
|
||||
}
|
||||
break;
|
||||
case nsIFilePicker.modeSave:
|
||||
if (isFile) { // can only be true if file.exists()
|
||||
// we need to pop up a dialog asking if you want to save
|
||||
var message = gFilePickerBundle.getFormattedString("confirmFileReplacing",
|
||||
[file.unicodePath]);
|
||||
var rv = window.confirm(message);
|
||||
if (rv) {
|
||||
ret = nsIFilePicker.returnReplace;
|
||||
retvals.directory = file.parent.unicodePath;
|
||||
} else {
|
||||
ret = nsIFilePicker.returnCancel;
|
||||
}
|
||||
} else if (isDir) {
|
||||
if (!sfile.equals(file)) {
|
||||
gotoDirectory(file);
|
||||
}
|
||||
textInput.value = "";
|
||||
doEnabling();
|
||||
ret = nsIFilePicker.returnCancel;
|
||||
} else {
|
||||
var parent = file.parent;
|
||||
if (parent.exists() && parent.isDirectory()) {
|
||||
ret = nsIFilePicker.returnOK;
|
||||
retvals.directory = parent.unicodePath;
|
||||
} else {
|
||||
var oldParent = parent;
|
||||
while (!parent.exists()) {
|
||||
oldParent = parent;
|
||||
parent = parent.parent;
|
||||
}
|
||||
errorTitle = gFilePickerBundle.getFormattedString("errorSavingFileTitle",
|
||||
[file.unicodePath]);
|
||||
if (parent.isFile()) {
|
||||
errorMessage = gFilePickerBundle.getFormattedString("saveParentIsFileMessage",
|
||||
[parent.unicodePath, file.unicodePath]);
|
||||
} else {
|
||||
errorMessage = gFilePickerBundle.getFormattedString("saveParentDoesntExistMessage",
|
||||
[oldParent.unicodePath, file.unicodePath]);
|
||||
}
|
||||
promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
promptService.alert(window, errorTitle, errorMessage);
|
||||
ret = nsIFilePicker.returnCancel;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case nsIFilePicker.modeGetFolder:
|
||||
if (isDir) {
|
||||
retvals.directory = file.parent.unicodePath;
|
||||
} else { // if nothing selected, the current directory will be fine
|
||||
retvals.directory = sfile.unicodePath;
|
||||
}
|
||||
ret = nsIFilePicker.returnOK;
|
||||
break;
|
||||
}
|
||||
|
||||
retvals.file = file;
|
||||
retvals.buttonStatus = ret;
|
||||
|
||||
if (ret == nsIFilePicker.returnCancel)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
{
|
||||
// Close the window.
|
||||
retvals.buttonStatus = nsIFilePicker.returnCancel;
|
||||
retvals.file = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
function onDblClick(e) {
|
||||
var t = e.originalTarget;
|
||||
if (t.localName != "outlinerbody")
|
||||
return;
|
||||
|
||||
var file = outlinerView.getSelectedFile();
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
if (file.isSymlink()) {
|
||||
var targetFile = Components.classes[nsLocalFile_CONTRACTID].createInstance(nsILocalFile);
|
||||
targetFile.initWithUnicodePath(file.unicodeTarget);
|
||||
file = targetFile;
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
gotoDirectory(file);
|
||||
}
|
||||
else if (file.isFile()) {
|
||||
doOKButton();
|
||||
}
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
var t = e.originalTarget;
|
||||
if (t.localName == "outlinercol")
|
||||
handleColumnClick(t.id);
|
||||
}
|
||||
|
||||
function convertColumnIDtoSortType(columnID) {
|
||||
var sortKey;
|
||||
|
||||
switch (columnID) {
|
||||
case "FilenameColumn":
|
||||
sortKey = nsFileView.SORTTYPE_NAME;
|
||||
break;
|
||||
case "FileSizeColumn":
|
||||
sortKey = nsFileView.SORTTYPE_SIZE;
|
||||
break;
|
||||
case "LastModifiedColumn":
|
||||
sortKey = nsFileView.SORTTYPE_DATE;
|
||||
break;
|
||||
default:
|
||||
dump("unsupported sort column: " + columnID + "\n");
|
||||
sortKey = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return sortKey;
|
||||
}
|
||||
|
||||
function handleColumnClick(columnID) {
|
||||
var sortType = convertColumnIDtoSortType(columnID);
|
||||
var sortOrder = (outlinerView.sortType == sortType) ? !outlinerView.reverseSort : false;
|
||||
outlinerView.sort(sortType, sortOrder, false);
|
||||
|
||||
// set the sort indicator on the column we are sorted by
|
||||
var sortedColumn = document.getElementById(columnID);
|
||||
if (outlinerView.reverseSort) {
|
||||
sortedColumn.setAttribute("sortDirection", "descending");
|
||||
} else {
|
||||
sortedColumn.setAttribute("sortDirection", "ascending");
|
||||
}
|
||||
|
||||
// remove the sort indicator from the rest of the columns
|
||||
var currCol = document.getElementById("directoryOutliner").firstChild;
|
||||
while (currCol) {
|
||||
while (currCol && currCol.localName != "outlinercol")
|
||||
currCol = currCol.nextSibling;
|
||||
if (currCol) {
|
||||
if (currCol != sortedColumn) {
|
||||
currCol.removeAttribute("sortDirection");
|
||||
}
|
||||
currCol = currCol.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doSort(sortType) {
|
||||
outlinerView.sort(sortType, false);
|
||||
}
|
||||
|
||||
function onKeypress(e) {
|
||||
if (e.keyCode == 8) /* backspace */
|
||||
goUp();
|
||||
}
|
||||
|
||||
function doEnabling() {
|
||||
// Maybe add check if textInput.value would resolve to an existing
|
||||
// file or directory in .modeOpen. Too costly I think.
|
||||
var enable = (textInput.value != "");
|
||||
|
||||
okButton.disabled = !enable;
|
||||
}
|
||||
|
||||
function onSelect(file) {
|
||||
var path = file.unicodeLeafName;
|
||||
|
||||
if (path) {
|
||||
if ((filePickerMode == nsIFilePicker.modeGetFolder) || file.isFile()) {
|
||||
textInput.value = path;
|
||||
doEnabling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onDirectoryChanged(target)
|
||||
{
|
||||
var path = target.getAttribute("label");
|
||||
|
||||
var file = Components.classes[nsLocalFile_CONTRACTID].createInstance(nsILocalFile);
|
||||
file.initWithUnicodePath(path);
|
||||
|
||||
if (!sfile.equals(file)) {
|
||||
gotoDirectory(file);
|
||||
}
|
||||
}
|
||||
|
||||
function addToHistory(directoryName) {
|
||||
var found = false;
|
||||
var i = 0;
|
||||
while (!found && i<dirHistory.length) {
|
||||
if (dirHistory[i] == directoryName)
|
||||
found = true;
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (i!=0) {
|
||||
dirHistory.splice(i, 1);
|
||||
dirHistory.splice(0, 0, directoryName);
|
||||
}
|
||||
} else {
|
||||
dirHistory.splice(0, 0, directoryName);
|
||||
}
|
||||
|
||||
var menu = document.getElementById("lookInMenu");
|
||||
|
||||
var children = menu.childNodes;
|
||||
for (i=0; i < children.length; i++)
|
||||
menu.removeChild(children[i]);
|
||||
|
||||
for (i=0; i < dirHistory.length; i++) {
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("label", dirHistory[i]);
|
||||
menu.appendChild(menuItem);
|
||||
}
|
||||
|
||||
var menuList = document.getElementById("lookInMenuList");
|
||||
menuList.selectedIndex = 0;
|
||||
}
|
||||
|
||||
function goUp() {
|
||||
try {
|
||||
var parent = sfile.parent;
|
||||
} catch(ex) { dump("can't get parent directory\n"); }
|
||||
|
||||
if (parent) {
|
||||
gotoDirectory(parent);
|
||||
}
|
||||
}
|
||||
|
||||
function gotoDirectory(directory) {
|
||||
addToHistory(directory.unicodePath);
|
||||
window.setCursor("wait");
|
||||
outlinerView.setDirectory(directory.unicodePath);
|
||||
window.setCursor("auto");
|
||||
sfile = directory;
|
||||
}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
|
||||
|
||||
<!--
|
||||
- The contents of this file are subject to the Mozilla Public
|
||||
- License Version 1.1 (the "License"); you may not use this file
|
||||
- except in compliance with the License. You may obtain a copy of
|
||||
- the License at http://www.mozilla.org/MPL/
|
||||
|
||||
- Software distributed under the License is distributed on an "AS
|
||||
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
- implied. See the License for the specific language governing
|
||||
- rights and limitations under the License.
|
||||
|
||||
- The Original Code is mozilla.org code.
|
||||
|
||||
- The Initial Developer of the Original Code is Netscape
|
||||
- Communications Corporation. Portions created by Netscape are
|
||||
- Copyright (C) 2000 Netscape Communications Corporation.
|
||||
- All Rights Reserved.
|
||||
|
||||
- Contributor(s):
|
||||
- Stuart Parmenter <pavlov@netscape.com>
|
||||
- Brian Ryner <bryner@netscape.com>
|
||||
- Jan Varga <varga@utcru.sk>
|
||||
- Peter Annema <disttsc@bart.nl>
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/filepicker.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://global/locale/filepicker.dtd" >
|
||||
|
||||
<window id="main-window"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical"
|
||||
onload="filepickerLoad();"
|
||||
width="426" height="300"
|
||||
class="dialog"
|
||||
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"/>
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
<box autostretch="never">
|
||||
<text value="&lookInMenuList.label;"/>
|
||||
<menulist id="lookInMenuList" flex="1" oncommand="onDirectoryChanged(event.target);" crop="left">
|
||||
<menupopup id="lookInMenu"/>
|
||||
</menulist>
|
||||
<button label=".." oncommand="goUp();"/>
|
||||
</box>
|
||||
|
||||
<box flex="1">
|
||||
<outliner id="directoryOutliner" flex="1" onclick="onClick(event);"
|
||||
ondblclick="onDblClick(event);">
|
||||
<outlinercol id="FilenameColumn" label="&name.label;" flex="1"
|
||||
class="outlinercol-header outlinercell-inset-header sortDirectionIndicator"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<outlinercol id="FileSizeColumn" label="&size.label;" flex="1"
|
||||
class="outlinercol-header outlinercell-inset-header sortDirectionIndicator"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<outlinercol id="LastModifiedColumn" label="&lastModified.label;" flex="1"
|
||||
class="outlinercol-header outlinercell-inset-header sortDirectionIndicator"/>
|
||||
|
||||
<outlinerbody flex="1" onselect="this.parentNode.outlinerBoxObject.view.selectionChanged()"/>
|
||||
</outliner>
|
||||
</box>
|
||||
|
||||
<grid style="margin-top: 5px">
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
|
||||
<rows>
|
||||
<row>
|
||||
<text value="&textInput.label;"/>
|
||||
<textbox id="textInput" flex="1" oninput="doEnabling()"/>
|
||||
</row>
|
||||
<row id="filterBox" hidden="true">
|
||||
<text value="&filterMenuList.label;"/>
|
||||
<menulist id="filterMenuList" flex="1" oncommand="onFilterChanged(event.target);"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
</window>
|
||||
@@ -1,34 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..\..
|
||||
|
||||
CHROME_DIR = packages\widget-toolkit
|
||||
CHROME_CONTENT_DIR = global\content
|
||||
|
||||
CHROME_CONTENT = \
|
||||
.\filepicker.xul \
|
||||
.\filepicker.js \
|
||||
.\filepicker.css \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -1,469 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@netscape.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file implements an nsIOutlinerView for the filepicker */
|
||||
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsLocalFile_CONTRACTID = "@mozilla.org/file/local;1";
|
||||
const nsIFile = Components.interfaces.nsIFile;
|
||||
const nsIScriptableDateFormat = Components.interfaces.nsIScriptableDateFormat;
|
||||
const nsScriptableDateFormat_CONTRACTID = "@mozilla.org/intl/scriptabledateformat;1";
|
||||
const nsIAtomService = Components.interfaces.nsIAtomService;
|
||||
const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1";
|
||||
|
||||
var gDateService = null;
|
||||
|
||||
function numMatchingChars(str1, str2) {
|
||||
var minLength = Math.min(str1.length, str2.length);
|
||||
for (var i = 0; ((i < minLength) && (str1[i] == str2[i])); i++);
|
||||
return i;
|
||||
}
|
||||
|
||||
function sortFilename(a, b) {
|
||||
if (a.cachedName < b.cachedName) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function sortSize(a, b) {
|
||||
if (a.cachedSize < b.cachedSize) {
|
||||
return -1;
|
||||
} else if (a.cachedSize > b.cachedSize) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function sortDate(a, b) {
|
||||
if (a.cachedDate < b.cachedDate) {
|
||||
return -1;
|
||||
} else if (a.cachedDate > b.cachedDate) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function nsFileView() {
|
||||
this.mShowHiddenFiles = false;
|
||||
this.mDirectoryFilter = false;
|
||||
this.mFileList = [];
|
||||
this.mDirList = [];
|
||||
this.mFilteredFiles = [];
|
||||
this.mCurrentFilter = ".*";
|
||||
this.mSelectionCallback = null;
|
||||
this.mOutliner = null;
|
||||
this.mReverseSort = false;
|
||||
this.mSortType = 0;
|
||||
this.mTotalRows = 0;
|
||||
|
||||
if (!gDateService) {
|
||||
gDateService = Components.classes[nsScriptableDateFormat_CONTRACTID]
|
||||
.getService(nsIScriptableDateFormat);
|
||||
}
|
||||
|
||||
var atomService = Components.classes[nsAtomService_CONTRACTID]
|
||||
.getService(nsIAtomService);
|
||||
this.mDirectoryAtom = atomService.getAtom("directory");
|
||||
this.mFileAtom = atomService.getAtom("file");
|
||||
}
|
||||
|
||||
nsFileView.prototype = {
|
||||
|
||||
SORTTYPE_NAME: 1,
|
||||
SORTTYPE_SIZE: 2,
|
||||
SORTTYPE_DATE: 3,
|
||||
|
||||
/* readonly attribute long rowCount; */
|
||||
set rowCount(c) { throw "readonly property"; },
|
||||
get rowCount() { return this.mTotalRows; },
|
||||
|
||||
/* attribute nsIOutlinerSelection selection; */
|
||||
set selection(s) { this.mSelection = s; },
|
||||
get selection() { return this.mSelection; },
|
||||
|
||||
set selectionCallback(f) { this.mSelectionCallback = f; },
|
||||
get selectionCallback() { return this.mSelectionCallback; },
|
||||
|
||||
/* nsISupports methods */
|
||||
|
||||
/* void QueryInterface(in nsIIDRef uuid,
|
||||
[iid_is(uuid),retval] out nsQIResult result); */
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(nsIOutlinerView) &&
|
||||
!iid.equals(nsISupports)) {
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
/* nsIOutlinerView methods */
|
||||
|
||||
/* void getRowProperties(in long index, in nsISupportsArray properties); */
|
||||
getRowProperties: function(index, properties) { },
|
||||
|
||||
/* void getCellProperties(in long row, in wstring colID, in nsISupportsArray properties); */
|
||||
getCellProperties: function(row, colID, properties) {
|
||||
if (row < this.mDirList.length)
|
||||
properties.AppendElement(this.mDirectoryAtom);
|
||||
else if ((row - this.mDirList.length) < this.mFilteredFiles.length)
|
||||
properties.AppendElement(this.mFileAtom);
|
||||
},
|
||||
|
||||
/* void getColumnProperties(in wstring colID, in nsIDOMElement colElt,
|
||||
in nsISupportsArray properties); */
|
||||
getColumnProperties: function(colID, colElt, properties) { },
|
||||
|
||||
/* boolean isContainer(in long index); */
|
||||
isContainer: function(index) { return false; },
|
||||
|
||||
/* boolean isContainerOpen(in long index); */
|
||||
isContainerOpen: function(index) { return false;},
|
||||
|
||||
/* boolean isContainerEmpty(in long index); */
|
||||
isContainerEmpty: function(index) { return false; },
|
||||
|
||||
/* boolean isSorted (); */
|
||||
isSorted: function() { return (this.mSortType > 0); },
|
||||
|
||||
/* boolean canDropOn (in long index); */
|
||||
canDropOn: function(index) { return false; },
|
||||
|
||||
/* boolean canDropBeforeAfter (in long index, in boolean before); */
|
||||
canDropBeforeAfter: function(index, before) { return false; },
|
||||
|
||||
/* void drop (in long row, in long orientation); */
|
||||
drop: function(row, orientation) { },
|
||||
|
||||
/* long getParentIndex(in long rowIndex); */
|
||||
getParentIndex: function(rowIndex) { return -1; },
|
||||
|
||||
/* boolean hasNextSibling(in long rowIndex, in long afterIndex); */
|
||||
hasNextSibling: function(rowIndex, afterIndex) {
|
||||
return (afterIndex < (this.mTotalRows - 1));
|
||||
},
|
||||
|
||||
/* long getLevel(in long index); */
|
||||
getLevel: function(index) { return 0; },
|
||||
|
||||
/* wstring getCellText(in long row, in wstring colID); */
|
||||
getCellText: function(row, colID) {
|
||||
/* we cache the file size and last modified dates -
|
||||
this function must be very fast since it's called
|
||||
whenever the cell needs repainted */
|
||||
var file, isdir = false;
|
||||
if (row < this.mDirList.length) {
|
||||
isdir = true;
|
||||
file = this.mDirList[row];
|
||||
} else if ((row - this.mDirList.length) < this.mFilteredFiles.length) {
|
||||
file = this.mFilteredFiles[row - this.mDirList.length];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (colID == "FilenameColumn") {
|
||||
if (!("cachedName" in file)) {
|
||||
file.cachedName = file.file.unicodeLeafName;
|
||||
}
|
||||
return file.cachedName;
|
||||
} else if (colID == "LastModifiedColumn") {
|
||||
if (!("cachedDate" in file)) {
|
||||
// perhaps overkill, but lets get the right locale handling
|
||||
var modDate = new Date(file.file.lastModificationDate);
|
||||
file.cachedDate = gDateService.FormatDateTime("", gDateService.dateFormatShort,
|
||||
gDateService.timeFormatSeconds,
|
||||
modDate.getFullYear(), modDate.getMonth()+1,
|
||||
modDate.getDate(), modDate.getHours(),
|
||||
modDate.getMinutes(), modDate.getSeconds());
|
||||
}
|
||||
return file.cachedDate;
|
||||
} else if (colID == "FileSizeColumn") {
|
||||
if (isdir) {
|
||||
return "";
|
||||
} else {
|
||||
if (!("cachedSize" in file)) {
|
||||
file.cachedSize = String(file.file.fileSize);
|
||||
}
|
||||
}
|
||||
return file.cachedSize;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
|
||||
/* void setOutliner(in nsIOutlinerBoxObject outliner); */
|
||||
setOutliner: function(outliner) { this.mOutliner = outliner; },
|
||||
|
||||
/* void toggleOpenState(in long index); */
|
||||
toggleOpenState: function(index) { },
|
||||
|
||||
/* void cycleHeader(in wstring colID, in nsIDOMElement elt); */
|
||||
cycleHeader: function(colID, elt) { },
|
||||
|
||||
/* void selectionChanged(); */
|
||||
selectionChanged: function() {
|
||||
if (this.mSelectionCallback && this.mSelection.currentIndex > 0) {
|
||||
var file;
|
||||
if (this.mSelection.currentIndex < this.mDirList.length) {
|
||||
file = this.mDirList[this.mSelection.currentIndex].file;
|
||||
} else if ((this.mSelection.currentIndex - this.mDirList.length) < this.mFilteredFiles.length) {
|
||||
file = this.mFilteredFiles[this.mSelection.currentIndex - this.mDirList.length].file;
|
||||
}
|
||||
|
||||
if (file) {
|
||||
this.mSelectionCallback(file);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/* void cycleCell(in long row, in wstring colID); */
|
||||
cycleCell: function(row, colID) { },
|
||||
|
||||
/* boolean isEditable(in long row, in wstring colID); */
|
||||
isEditable: function(row, colID) { return false; },
|
||||
|
||||
/* void setCellText(in long row, in wstring colID, in wstring value); */
|
||||
setCellText: function(row, colID, value) { },
|
||||
|
||||
/* void performAction(in wstring action); */
|
||||
performAction: function(action) { },
|
||||
|
||||
/* void performActionOnRow(in wstring action, in long row); */
|
||||
performActionOnRow: function(action, row) { },
|
||||
|
||||
/* void performActionOnCell(in wstring action, in long row, in wstring colID); */
|
||||
performActionOnCell: function(action, row, colID) { },
|
||||
|
||||
/* private attributes */
|
||||
|
||||
/* attribute boolean showHiddenFiles */
|
||||
set showHiddenFiles(s) {
|
||||
this.mShowHiddenFiles = s;
|
||||
this.setDirectory(this.mDirectoryPath);
|
||||
},
|
||||
|
||||
get showHiddenFiles() { return this.mShowHiddenFiles; },
|
||||
|
||||
/* attribute boolean showOnlyDirectories */
|
||||
set showOnlyDirectories(s) {
|
||||
this.mDirectoryFilter = s;
|
||||
this.filterFiles();
|
||||
},
|
||||
|
||||
get showOnlyDirectories() { return this.mDirectoryFilter; },
|
||||
|
||||
/* readonly attribute short sortType */
|
||||
set sortType(s) { throw "readonly property"; },
|
||||
get sortType() { return this.mSortType; },
|
||||
|
||||
/* readonly attribute boolean reverseSort */
|
||||
set reverseSort(s) { throw "readonly property"; },
|
||||
get reverseSort() { return this.mReverseSort; },
|
||||
|
||||
/* private methods */
|
||||
sort: function(sortType, reverseSort, forceSort) {
|
||||
if (sortType == this.mSortType && reverseSort != this.mReverseSort && !forceSort) {
|
||||
this.mDirList.reverse();
|
||||
this.mFilteredFiles.reverse();
|
||||
} else {
|
||||
var compareFunc, i;
|
||||
|
||||
/* We pre-fetch all the data we are going to sort on, to avoid
|
||||
calling into C++ on every comparison */
|
||||
|
||||
switch (sortType) {
|
||||
case 0:
|
||||
/* no sort has been set yet */
|
||||
return;
|
||||
case nsFileView.SORTTYPE_NAME:
|
||||
for (i = 0; i < this.mDirList.length; i++) {
|
||||
this.mDirList[i].cachedName = this.mDirList[i].file.unicodeLeafName;
|
||||
}
|
||||
for (i = 0; i < this.mFilteredFiles.length; i++) {
|
||||
this.mFilteredFiles[i].cachedName = this.mFilteredFiles[i].file.unicodeLeafName;
|
||||
}
|
||||
compareFunc = sortFilename;
|
||||
break;
|
||||
case nsFileView.SORTTYPE_SIZE:
|
||||
for (i = 0; i < this.mDirList.length; i++) {
|
||||
this.mDirList[i].cachedSize = this.mDirList[i].file.fileSize;
|
||||
}
|
||||
for (i = 0; i < this.mFilteredFiles.length; i++) {
|
||||
this.mFilteredFiles[i].cachedSize = this.mFilteredFiles[i].file.fileSize;
|
||||
}
|
||||
compareFunc = sortSize;
|
||||
break;
|
||||
case nsFileView.SORTTYPE_DATE:
|
||||
for (i = 0; i < this.mDirList.length; i++) {
|
||||
this.mDirList[i].cachedDate = this.mDirList[i].file.lastModificationDate;
|
||||
}
|
||||
for (i = 0; i < this.mFilteredFiles.length; i++) {
|
||||
this.mFilteredFiles[i].cachedDate = this.mFilteredFiles[i].file.lastModificationDate;
|
||||
}
|
||||
compareFunc = sortDate;
|
||||
break;
|
||||
default:
|
||||
throw("Unsupported sort type " + sortType);
|
||||
break;
|
||||
}
|
||||
this.mDirList.sort(compareFunc);
|
||||
this.mFilteredFiles.sort(compareFunc);
|
||||
}
|
||||
|
||||
this.mSortType = sortType;
|
||||
this.mReverseSort = reverseSort;
|
||||
if (this.mOutliner) {
|
||||
this.mOutliner.invalidate();
|
||||
}
|
||||
},
|
||||
|
||||
setDirectory: function(directory) {
|
||||
this.mDirectoryPath = directory;
|
||||
this.mFileList = [];
|
||||
this.mDirList = [];
|
||||
|
||||
var dir = Components.classes[nsLocalFile_CONTRACTID].createInstance(nsILocalFile);
|
||||
dir.followLinks = false;
|
||||
dir.initWithUnicodePath(directory);
|
||||
var dirEntries = dir.QueryInterface(nsIFile).directoryEntries;
|
||||
var nextFile;
|
||||
var fileobj;
|
||||
//var time = new Date();
|
||||
|
||||
while (dirEntries.hasMoreElements()) {
|
||||
nextFile = dirEntries.getNext().QueryInterface(nsIFile);
|
||||
if (nextFile.isDirectory()) {
|
||||
if (!nextFile.isHidden() || this.mShowHiddenFiles) {
|
||||
fileobj = new Object();
|
||||
fileobj.file = nextFile;
|
||||
this.mDirList[this.mDirList.length] = fileobj;
|
||||
}
|
||||
} else if (!this.mDirectoryFilter) {
|
||||
this.mFileList[this.mFileList.length] = nextFile;
|
||||
}
|
||||
}
|
||||
|
||||
//time = new Date() - time;
|
||||
//dump("load time: " + time/1000 + " seconds\n");
|
||||
|
||||
this.mFilteredFiles = [];
|
||||
|
||||
if (this.mOutliner) {
|
||||
var oldRows = this.mTotalRows;
|
||||
this.mTotalRows = this.mDirList.length;
|
||||
if (this.mDirList.length != oldRows) {
|
||||
this.mOutliner.rowCountChanged(0, this.mDirList.length - oldRows);
|
||||
}
|
||||
this.mOutliner.invalidate();
|
||||
}
|
||||
|
||||
//time = new Date();
|
||||
|
||||
this.filterFiles();
|
||||
|
||||
//time = new Date() - time;
|
||||
//dump("filter time: " + time/1000 + " seconds\n");
|
||||
//time = new Date();
|
||||
|
||||
this.sort(this.mSortType, this.mReverseSort);
|
||||
|
||||
//time = new Date() - time;
|
||||
//dump("sort time: " + time/1000 + " seconds\n");
|
||||
},
|
||||
|
||||
setFilter: function(filter) {
|
||||
// The filter may contain several components, i.e.:
|
||||
// *.html; *.htm
|
||||
// First separate it into its components
|
||||
var filterList = filter.split(/;[ ]*/);
|
||||
|
||||
if (filterList.length == 0) {
|
||||
// this shouldn't happen
|
||||
return;
|
||||
}
|
||||
|
||||
// Transform everything in the array to a regexp
|
||||
var tmp = filterList[0].replace(/\./g, "\\.");
|
||||
filterList[0] = tmp.replace(/\*/g, ".*");
|
||||
var shortestPrefix = filterList[0];
|
||||
|
||||
for (var i = 1; i < filterList.length; i++) {
|
||||
// * becomes .*, and we escape all .'s with \
|
||||
tmp = filterList[i].replace(/\./g, "\\.");
|
||||
filterList[i] = tmp.replace(/\*/g, ".*");
|
||||
shortestPrefix = shortestPrefix.substr(0, numMatchingChars(shortestPrefix, filterList[i]));
|
||||
}
|
||||
|
||||
var filterStr = shortestPrefix+"(";
|
||||
var startpos = shortestPrefix.length;
|
||||
for (i = 0; i < filterList.length; i++) {
|
||||
filterStr += filterList[i].substr(shortestPrefix.length) + "|";
|
||||
}
|
||||
|
||||
this.mCurrentFilter = new RegExp(filterStr.substr(0, (filterStr.length) - 1) + ")");
|
||||
this.mFilteredFiles = [];
|
||||
|
||||
if (this.mOutliner) {
|
||||
var rowDiff = -(this.mTotalRows - this.mDirList.length);
|
||||
this.mTotalRows = this.mDirList.length;
|
||||
this.mOutliner.rowCountChanged(this.mDirList.length, rowDiff);
|
||||
this.mOutliner.invalidate();
|
||||
}
|
||||
this.filterFiles();
|
||||
this.sort(this.mSortType, this.mReverseSort, true);
|
||||
},
|
||||
|
||||
filterFiles: function() {
|
||||
for(var i = 0; i < this.mFileList.length; i++) {
|
||||
var file = this.mFileList[i];
|
||||
|
||||
if ((this.mShowHiddenFiles || !file.isHidden()) &&
|
||||
file.unicodeLeafName.search(this.mCurrentFilter) == 0) {
|
||||
this.mFilteredFiles[this.mFilteredFiles.length] = { file : file };
|
||||
}
|
||||
}
|
||||
|
||||
this.mTotalRows = this.mDirList.length + this.mFilteredFiles.length;
|
||||
|
||||
// Tell the outliner how many rows we just added
|
||||
if (this.mOutliner) {
|
||||
this.mOutliner.rowCountChanged(this.mDirList.length, this.mFilteredFiles.length);
|
||||
}
|
||||
},
|
||||
|
||||
getSelectedFile: function() {
|
||||
if (0 <= this.mSelection.currentIndex) {
|
||||
if (this.mSelection.currentIndex < this.mDirList.length) {
|
||||
return this.mDirList[this.mSelection.currentIndex].file;
|
||||
} else if ((this.mSelection.currentIndex - this.mDirList.length) < this.mFilteredFiles.length) {
|
||||
return this.mFilteredFiles[this.mSelection.currentIndex - this.mDirList.length].file;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
comm.jar:
|
||||
content/communicator/directory/directory.xul (directory/directory.xul)
|
||||
content/communicator/directory/directory.html (directory/directory.html)
|
||||
content/communicator/directory/directory.js (directory/directory.js)
|
||||
content/communicator/history/history.xul (history/resources/history.xul)
|
||||
content/communicator/history/historyTreeOverlay.xul (history/resources/historyTreeOverlay.xul)
|
||||
content/communicator/history/history-panel.xul (history/resources/history-panel.xul)
|
||||
content/communicator/history/history.js (history/resources/history.js)
|
||||
content/communicator/history/history-test.xul (history/resources/history-test.xul)
|
||||
content/communicator/history/history-test.js (history/resources/history-test.js)
|
||||
content/communicator/pref/pref-advanced.xul (prefwindow/resources/content/pref-advanced.xul)
|
||||
content/communicator/pref/pref-appearance.xul (prefwindow/resources/content/pref-appearance.xul)
|
||||
content/communicator/pref/pref-applications.xul (prefwindow/resources/content/pref-applications.xul)
|
||||
content/communicator/pref/pref-applications.js (prefwindow/resources/content/pref-applications.js)
|
||||
content/communicator/pref/pref-applications-edit.xul (prefwindow/resources/content/pref-applications-edit.xul)
|
||||
content/communicator/pref/pref-applications-new.xul (prefwindow/resources/content/pref-applications-new.xul)
|
||||
content/communicator/pref/pref-applications-new.js (prefwindow/resources/content/pref-applications-new.js)
|
||||
content/communicator/pref/overrideHandler.js (prefwindow/resources/content/overrideHandler.js)
|
||||
content/communicator/pref/pref-cache.js (prefwindow/resources/content/pref-cache.js)
|
||||
content/communicator/pref/pref-cache.xul (prefwindow/resources/content/pref-cache.xul)
|
||||
content/communicator/pref/pref-colors.js (prefwindow/resources/content/pref-colors.js)
|
||||
content/communicator/pref/pref-colors.xul (prefwindow/resources/content/pref-colors.xul)
|
||||
content/communicator/pref/pref-themes.xul (prefwindow/resources/content/pref-themes.xul)
|
||||
content/communicator/pref/pref-themes.js (prefwindow/resources/content/pref-themes.js)
|
||||
content/communicator/pref/pref-charset.js (prefwindow/resources/content/pref-charset.js)
|
||||
content/communicator/pref/pref-charset.xul (prefwindow/resources/content/pref-charset.xul)
|
||||
content/communicator/pref/pref-debug.xul (prefwindow/resources/content/pref-debug.xul)
|
||||
content/communicator/pref/pref-debug1.xul (prefwindow/resources/content/pref-debug1.xul)
|
||||
content/communicator/pref/pref-debug2.xul (prefwindow/resources/content/pref-debug2.xul)
|
||||
content/communicator/pref/pref-download.xul (prefwindow/resources/content/pref-download.xul)
|
||||
content/communicator/pref/pref-fonts.js (prefwindow/resources/content/pref-fonts.js)
|
||||
content/communicator/pref/pref-fonts.xul (prefwindow/resources/content/pref-fonts.xul)
|
||||
content/communicator/pref/pref-history.xul (prefwindow/resources/content/pref-history.xul)
|
||||
content/communicator/pref/pref-languages.xul (prefwindow/resources/content/pref-languages.xul)
|
||||
content/communicator/pref/pref-languages-add.xul (prefwindow/resources/content/pref-languages-add.xul)
|
||||
content/communicator/pref/pref-languages.js (prefwindow/resources/content/pref-languages.js)
|
||||
content/communicator/pref/pref-navigator.js (prefwindow/resources/content/pref-navigator.js)
|
||||
content/communicator/pref/pref-navigator.xul (prefwindow/resources/content/pref-navigator.xul)
|
||||
content/communicator/pref/pref-offline.xul (prefwindow/resources/content/pref-offline.xul)
|
||||
content/communicator/pref/pref-proxies.js (prefwindow/resources/content/pref-proxies.js)
|
||||
content/communicator/pref/pref-policies.xul (prefwindow/resources/content/pref-policies.xul)
|
||||
content/communicator/pref/pref-proxies.xul (prefwindow/resources/content/pref-proxies.xul)
|
||||
content/communicator/pref/pref-proxy-manual.xul (prefwindow/resources/content/pref-proxy-manual.xul)
|
||||
content/communicator/pref/pref-search.js (prefwindow/resources/content/pref-search.js)
|
||||
content/communicator/pref/pref-search.xul (prefwindow/resources/content/pref-search.xul)
|
||||
content/communicator/pref/pref-smart_browsing.xul (prefwindow/resources/content/pref-smart_browsing.xul)
|
||||
content/communicator/pref/pref-smartupdate.xul (prefwindow/resources/content/pref-smartupdate.xul)
|
||||
content/communicator/pref/pref.xul (prefwindow/resources/content/pref.xul)
|
||||
content/communicator/pref/nsPrefWindow.js (prefwindow/resources/content/nsPrefWindow.js)
|
||||
content/communicator/pref/preftree.xul (prefwindow/resources/content/preftree.xul)
|
||||
content/communicator/pref/pref-mousewheel.xul (prefwindow/resources/content/pref-mousewheel.xul)
|
||||
content/communicator/pref/pref-winhooks.xul (prefwindow/resources/content/pref-winhooks.xul)
|
||||
content/communicator/pref/pref-winhooks.js (prefwindow/resources/content/pref-winhooks.js)
|
||||
content/communicator/regviewer/regviewer.js (regviewer/regviewer.js)
|
||||
content/communicator/regviewer/regviewer.xul (regviewer/regviewer.xul)
|
||||
content/communicator/related/related-panel.xul (related/resources/related-panel.xul)
|
||||
content/communicator/related/related-panel.js (related/resources/related-panel.js)
|
||||
content/communicator/search/search.js (search/resources/search.js)
|
||||
content/communicator/search/search.xul (search/resources/search.xul)
|
||||
content/communicator/search/search-editor.js (search/resources/search-editor.js)
|
||||
content/communicator/search/search-editor.xul (search/resources/search-editor.xul)
|
||||
content/communicator/search/search-panel.js (search/resources/search-panel.js)
|
||||
content/communicator/search/search-panel.xul (search/resources/search-panel.xul)
|
||||
content/communicator/search/shared.js (search/resources/shared.js)
|
||||
content/communicator/search/find.js (search/resources/find.js)
|
||||
content/communicator/search/find.xul (search/resources/find.xul)
|
||||
content/communicator/search/findresults.xul (search/resources/findresults.xul)
|
||||
content/communicator/search/internet.js (search/resources/internet.js)
|
||||
content/communicator/search/internet.xul (search/resources/internet.xul)
|
||||
content/communicator/search/internetresults.js (search/resources/internetresults.js)
|
||||
content/communicator/search/internetresults.xul (search/resources/internetresults.xul)
|
||||
content/communicator/sidebar/sidebarOverlay.css (sidebar/resources/sidebarOverlay.css)
|
||||
content/communicator/sidebar/customize-panel.js (sidebar/resources/customize-panel.js)
|
||||
content/communicator/sidebar/customize-panel.xul (sidebar/resources/customize-panel.xul)
|
||||
content/communicator/sidebar/sidebarBindings.xml (sidebar/resources/sidebarBindings.xml)
|
||||
content/communicator/sidebar/customize.js (sidebar/resources/customize.js)
|
||||
content/communicator/sidebar/customize.xul (sidebar/resources/customize.xul)
|
||||
content/communicator/sidebar/preview.js (sidebar/resources/preview.js)
|
||||
content/communicator/sidebar/preview.xul (sidebar/resources/preview.xul)
|
||||
content/communicator/sidebar/sidebarOverlay.js (sidebar/resources/sidebarOverlay.js)
|
||||
content/communicator/sidebar/sidebarOverlay.xul (sidebar/resources/sidebarOverlay.xul)
|
||||
content/communicator/sidebar/local-panels.rdf (sidebar/resources/local-panels.rdf)
|
||||
content/communicator/timebomb/warn.xul (timebomb/resources/content/warn.xul)
|
||||
content/communicator/timebomb/expireText.xul (timebomb/resources/content/expireText.xul)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/communicator/directory/directory.dtd (directory/locale/en-US/directory.dtd)
|
||||
locale/en-US/communicator/history/history.dtd (history/resources/locale/en-US/history.dtd)
|
||||
locale/en-US/communicator/history/historyTreeOverlay.dtd (history/resources/locale/en-US/historyTreeOverlay.dtd)
|
||||
locale/en-US/communicator/history/history.properties (history/resources/locale/en-US/history.properties)
|
||||
locale/en-US/communicator/pref/pref-advanced.dtd (prefwindow/resources/locale/en-US/pref-advanced.dtd)
|
||||
locale/en-US/communicator/pref/pref-appearance.dtd (prefwindow/resources/locale/en-US/pref-appearance.dtd)
|
||||
locale/en-US/communicator/pref/pref-applications.dtd (prefwindow/resources/locale/en-US/pref-applications.dtd)
|
||||
locale/en-US/communicator/pref/pref-applications.properties (prefwindow/resources/locale/en-US/pref-applications.properties)
|
||||
locale/en-US/communicator/pref/pref-applications-edit.dtd (prefwindow/resources/locale/en-US/pref-applications-edit.dtd)
|
||||
locale/en-US/communicator/pref/pref-cache.dtd (prefwindow/resources/locale/en-US/pref-cache.dtd)
|
||||
locale/en-US/communicator/pref/pref-charset.dtd (prefwindow/resources/locale/en-US/pref-charset.dtd)
|
||||
locale/en-US/communicator/pref/pref-colors.dtd (prefwindow/resources/locale/en-US/pref-colors.dtd)
|
||||
locale/en-US/communicator/pref/pref-themes.dtd (prefwindow/resources/locale/en-US/pref-themes.dtd)
|
||||
locale/en-US/communicator/pref/pref-download.dtd (prefwindow/resources/locale/en-US/pref-download.dtd)
|
||||
locale/en-US/communicator/pref/pref-debug.dtd (prefwindow/resources/locale/en-US/pref-debug.dtd)
|
||||
locale/en-US/communicator/pref/pref-debug1.dtd (prefwindow/resources/locale/en-US/pref-debug1.dtd)
|
||||
locale/en-US/communicator/pref/pref-debug2.dtd (prefwindow/resources/locale/en-US/pref-debug2.dtd)
|
||||
locale/en-US/communicator/pref/pref-fonts.dtd (prefwindow/resources/locale/en-US/pref-fonts.dtd)
|
||||
locale/en-US/communicator/pref/pref-history.dtd (prefwindow/resources/locale/en-US/pref-history.dtd)
|
||||
locale/en-US/communicator/pref/pref-languages.dtd (prefwindow/resources/locale/en-US/pref-languages.dtd)
|
||||
locale/en-US/communicator/pref/pref-languages.properties (prefwindow/resources/locale/en-US/pref-languages.properties)
|
||||
locale/en-US/communicator/pref/pref-navigator.dtd (prefwindow/resources/locale/en-US/pref-navigator.dtd)
|
||||
locale/en-US/communicator/pref/pref-offline.dtd (prefwindow/resources/locale/en-US/pref-offline.dtd)
|
||||
locale/en-US/communicator/pref/pref-policies.dtd (prefwindow/resources/locale/en-US/pref-policies.dtd)
|
||||
locale/en-US/communicator/pref/pref-proxies.dtd (prefwindow/resources/locale/en-US/pref-proxies.dtd)
|
||||
locale/en-US/communicator/pref/pref-proxy-manual.dtd (prefwindow/resources/locale/en-US/pref-proxy-manual.dtd)
|
||||
locale/en-US/communicator/pref/pref-search.dtd (prefwindow/resources/locale/en-US/pref-search.dtd)
|
||||
locale/en-US/communicator/pref/pref-smart_browsing.dtd (prefwindow/resources/locale/en-US/pref-smart_browsing.dtd)
|
||||
locale/en-US/communicator/pref/pref-smartupdate.dtd (prefwindow/resources/locale/en-US/pref-smartupdate.dtd)
|
||||
locale/en-US/communicator/pref/prefutilities.properties (prefwindow/resources/locale/en-US/prefutilities.properties)
|
||||
locale/en-US/communicator/pref/preftree.dtd (prefwindow/resources/locale/en-US/preftree.dtd)
|
||||
locale/en-US/communicator/pref/pref.dtd (prefwindow/resources/locale/en-US/pref.dtd)
|
||||
locale/en-US/communicator/pref/pref-mousewheel.dtd (prefwindow/resources/locale/en-US/pref-mousewheel.dtd)
|
||||
locale/en-US/communicator/pref/pref-winhooks.dtd (prefwindow/resources/locale/en-US/pref-winhooks.dtd)
|
||||
locale/en-US/communicator/regviewer/regviewer.dtd (regviewer/locale/en-US/regviewer.dtd)
|
||||
locale/en-US/communicator/search/find.dtd (search/resources/locale/en-US/find.dtd)
|
||||
locale/en-US/communicator/search/findresults.dtd (search/resources/locale/en-US/findresults.dtd)
|
||||
locale/en-US/communicator/search/internet.dtd (search/resources/locale/en-US/internet.dtd)
|
||||
locale/en-US/communicator/search/internetresults.dtd (search/resources/locale/en-US/internetresults.dtd)
|
||||
locale/en-US/communicator/search/search.dtd (search/resources/locale/en-US/search.dtd)
|
||||
locale/en-US/communicator/search/search-editor.dtd (search/resources/locale/en-US/search-editor.dtd)
|
||||
locale/en-US/communicator/search/search-editor.properties (search/resources/locale/en-US/search-editor.properties)
|
||||
locale/en-US/communicator/search/search-panel.dtd (search/resources/locale/en-US/search-panel.dtd)
|
||||
locale/en-US/communicator/search/search-panel.properties (search/resources/locale/en-US/search-panel.properties)
|
||||
locale/en-US/communicator/search/default.htm (search/resources/locale/en-US/default.htm)
|
||||
locale/en-US/communicator/sidebar/customize.dtd (sidebar/resources/locale/en-US/customize.dtd)
|
||||
locale/en-US/communicator/sidebar/preview.dtd (sidebar/resources/locale/en-US/preview.dtd)
|
||||
locale/en-US/communicator/sidebar/local-panels.dtd (sidebar/resources/locale/en-US/local-panels.dtd)
|
||||
locale/en-US/communicator/sidebar/sidebarOverlay.dtd (sidebar/resources/locale/en-US/sidebarOverlay.dtd)
|
||||
locale/en-US/communicator/sidebar/sidebar.properties (sidebar/resources/locale/en-US/sidebar.properties)
|
||||
locale/en-US/communicator/timebomb/timebomb.dtd (timebomb/resources/locale/en-US/timebomb.dtd)
|
||||
locale/en-US/global/unknownContent.dtd (ucth/resources/locale/en-US/unknownContent.dtd)
|
||||
locale/en-US/global/unknownContent.properties (ucth/resources/locale/en-US/unknownContent.properties)
|
||||
locale/en-US/global/helperAppLauncher.dtd (ucth/resources/locale/en-US/helperAppLauncher.dtd)
|
||||
locale/en-US/global/helperAppLauncher.properties (ucth/resources/locale/en-US/helperAppLauncher.properties)
|
||||
locale/en-US/global/downloadProgress.dtd (xfer/resources/locale/en-US/downloadProgress.dtd)
|
||||
locale/en-US/global/downloadProgress.properties (xfer/resources/locale/en-US/downloadProgress.properties)
|
||||
locale/en-US/global/filepicker.dtd (filepicker/res/locale/en-US/filepicker.dtd)
|
||||
locale/en-US/global/filepicker.properties (filepicker/res/locale/en-US/filepicker.properties)
|
||||
locale/en-US/global/console.dtd (console/resources/locale/en-US/console.dtd)
|
||||
locale/en-US/global/console.properties (console/resources/locale/en-US/console.properties)
|
||||
locale/en-US/global/finddialog.dtd (find/resources/locale/en-US/finddialog.dtd)
|
||||
locale/en-US/global/finddialog.properties (find/resources/locale/en-US/finddialog.properties)
|
||||
locale/en-US/global/replacedialog.dtd (find/resources/locale/en-US/replacedialog.dtd)
|
||||
|
||||
toolkit.jar:
|
||||
content/global/console.js (console/resources/content/console.js)
|
||||
content/global/console.xul (console/resources/content/console.xul)
|
||||
content/global/console.css (console/resources/content/console.css)
|
||||
content/global/consoleBindings.xml (console/resources/content/consoleBindings.xml)
|
||||
content/global/finddialog.js (find/resources/finddialog.js)
|
||||
content/global/finddialog.xul (find/resources/finddialog.xul)
|
||||
content/global/replacedialog.js (find/resources/replacedialog.js)
|
||||
content/global/replacedialog.xul (find/resources/replacedialog.xul)
|
||||
content/global/unknownContent.xul (ucth/resources/unknownContent.xul)
|
||||
content/global/unknownContent.js (ucth/resources/unknownContent.js)
|
||||
content/global/helperAppLauncher.xul (ucth/resources/helperAppLauncher.xul)
|
||||
content/global/helperAppLauncher.js (ucth/resources/helperAppLauncher.js)
|
||||
content/global/helperAppDldProgress.js (ucth/resources/helperAppDldProgress.js)
|
||||
content/global/helperAppDldProgress.xul (ucth/resources/helperAppDldProgress.xul)
|
||||
content/global/downloadProgress.xul (xfer/resources/downloadProgress.xul)
|
||||
content/global/downloadProgress.js (xfer/resources/downloadProgress.js)
|
||||
content/global/autocomplete.xml (autocomplete/resources/content/autocomplete.xml)
|
||||
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)
|
||||
Reference in New Issue
Block a user