Browse Source

kmPrefs 1.1.2 for k-meleon 1.1. Initial check-in.

kmeleon11_branch
kkohler 15 years ago
parent
commit
122a96fb6f
  1. 17
      k-meleon/chrome/kmprefs/content/contents.rdf
  2. 28
      k-meleon/chrome/kmprefs/content/firefox/actionsshared.js
  3. 219
      k-meleon/chrome/kmprefs/content/firefox/changeaction.js
  4. 91
      k-meleon/chrome/kmprefs/content/firefox/changeaction.xul
  5. 826
      k-meleon/chrome/kmprefs/content/firefox/downloadactions.js
  6. 33
      k-meleon/chrome/kmprefs/content/firefox/license.txt
  7. 4
      k-meleon/chrome/kmprefs/content/firefox/preferences.css
  8. 80
      k-meleon/chrome/kmprefs/content/firefox/preferences.xml
  9. 54
      k-meleon/chrome/kmprefs/content/kmprefs/dlg-gestures.xul
  10. 54
      k-meleon/chrome/kmprefs/content/kmprefs/dlg-webfind.xul
  11. 87
      k-meleon/chrome/kmprefs/content/kmprefs/ovrl-history.xul
  12. 21
      k-meleon/chrome/kmprefs/content/kmprefs/ovrl-javascript.xul
  13. 39
      k-meleon/chrome/kmprefs/content/kmprefs/ovrl-popups.xul
  14. 43
      k-meleon/chrome/kmprefs/content/kmprefs/ovrl-referrer.xul
  15. 49
      k-meleon/chrome/kmprefs/content/kmprefs/ovrl-urlbar.xul
  16. 99
      k-meleon/chrome/kmprefs/content/kmprefs/xml.js
  17. 124
      k-meleon/chrome/kmprefs/content/kplugins/booklistmanager.xul
  18. 109
      k-meleon/chrome/kmprefs/content/kplugins/bookmarksbar.xul
  19. 224
      k-meleon/chrome/kmprefs/content/kplugins/favoritesbar.xul
  20. 68
      k-meleon/chrome/kmprefs/content/kplugins/fullscreen.xul
  21. 78
      k-meleon/chrome/kmprefs/content/kplugins/gestures.xml
  22. 90
      k-meleon/chrome/kmprefs/content/kplugins/hotlistbar.xul
  23. 41
      k-meleon/chrome/kmprefs/content/kplugins/jsbridge.js
  24. 135
      k-meleon/chrome/kmprefs/content/kplugins/layers.xul
  25. 145
      k-meleon/chrome/kmprefs/content/kplugins/layersbar.xul
  26. 340
      k-meleon/chrome/kmprefs/content/pref-appearance.xul
  27. 213
      k-meleon/chrome/kmprefs/content/pref-browsing.xul
  28. 131
      k-meleon/chrome/kmprefs/content/pref-display.xul
  29. 200
      k-meleon/chrome/kmprefs/content/pref-encryption.xul
  30. 139
      k-meleon/chrome/kmprefs/content/pref-filetypes.xul
  31. 58
      k-meleon/chrome/kmprefs/content/pref-filters.xul
  32. 18
      k-meleon/chrome/kmprefs/content/pref-history.xul
  33. 103
      k-meleon/chrome/kmprefs/content/pref-hotlinks.xul
  34. 63
      k-meleon/chrome/kmprefs/content/pref-javascript.xul
  35. 225
      k-meleon/chrome/kmprefs/content/pref-kbookmarks.xul
  36. 283
      k-meleon/chrome/kmprefs/content/pref-kfavorites.xul
  37. 374
      k-meleon/chrome/kmprefs/content/pref-kgestures.xul
  38. 294
      k-meleon/chrome/kmprefs/content/pref-khotlist.xul
  39. 35
      k-meleon/chrome/kmprefs/content/pref-klayers.xul
  40. 144
      k-meleon/chrome/kmprefs/content/pref-kmacros.xul
  41. 50
      k-meleon/chrome/kmprefs/content/pref-kplugins.xul
  42. 125
      k-meleon/chrome/kmprefs/content/pref-privacy.xul
  43. 115
      k-meleon/chrome/kmprefs/content/pref-toolbars.xul
  44. 437
      k-meleon/chrome/kmprefs/content/pref-webfind.xul
  45. 375
      k-meleon/chrome/kmprefs/content/pref.js
  46. 244
      k-meleon/chrome/kmprefs/content/pref.xul
  47. 37
      k-meleon/chrome/kmprefs/license.txt
  48. 17
      k-meleon/chrome/kmprefs/locale/en-US/contents.rdf
  49. 24
      k-meleon/chrome/kmprefs/locale/en-US/firefox/changeaction.dtd
  50. 28
      k-meleon/chrome/kmprefs/locale/en-US/firefox/downloadactions.dtd
  51. 33
      k-meleon/chrome/kmprefs/locale/en-US/firefox/license.txt
  52. 22
      k-meleon/chrome/kmprefs/locale/en-US/firefox/preferences.properties
  53. 15
      k-meleon/chrome/kmprefs/locale/en-US/kmprefs/ovrl-history.dtd
  54. 11
      k-meleon/chrome/kmprefs/locale/en-US/kmprefs/ovrl-javascript.dtd
  55. 18
      k-meleon/chrome/kmprefs/locale/en-US/kmprefs/ovrl-popups.dtd
  56. 7
      k-meleon/chrome/kmprefs/locale/en-US/kmprefs/ovrl-referrer.dtd
  57. 3
      k-meleon/chrome/kmprefs/locale/en-US/kmprefs/ovrl-urlbar.dtd
  58. 2
      k-meleon/chrome/kmprefs/locale/en-US/kmprefs/xml.properties
  59. 7
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/bookmarksbar.dtd
  60. 10
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/favoritesbar.dtd
  61. 5
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/fullscreen.dtd
  62. 3
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/fullscreen.properties
  63. 56
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/gestures.dtd
  64. 3
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/gestures.properties
  65. 5
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/hotlistbar.dtd
  66. 18
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/kplugins.dtd
  67. 16
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/kplugins.properties
  68. 14
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/layers.dtd
  69. 9
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/layersbar.dtd
  70. 25
      k-meleon/chrome/kmprefs/locale/en-US/kplugins/macros.properties
  71. 12
      k-meleon/chrome/kmprefs/locale/en-US/pref-appearance.dtd
  72. 18
      k-meleon/chrome/kmprefs/locale/en-US/pref-browsing.dtd
  73. 4
      k-meleon/chrome/kmprefs/locale/en-US/pref-browsing.properties
  74. 26
      k-meleon/chrome/kmprefs/locale/en-US/pref-display.dtd
  75. 3
      k-meleon/chrome/kmprefs/locale/en-US/pref-display.properties
  76. 26
      k-meleon/chrome/kmprefs/locale/en-US/pref-encryption.dtd
  77. 3
      k-meleon/chrome/kmprefs/locale/en-US/pref-filetypes.dtd
  78. 16
      k-meleon/chrome/kmprefs/locale/en-US/pref-filters.dtd
  79. 1
      k-meleon/chrome/kmprefs/locale/en-US/pref-history.dtd
  80. 14
      k-meleon/chrome/kmprefs/locale/en-US/pref-hotlinks.dtd
  81. 3
      k-meleon/chrome/kmprefs/locale/en-US/pref-javascript.dtd
  82. 8
      k-meleon/chrome/kmprefs/locale/en-US/pref-kbookmarks.dtd
  83. 7
      k-meleon/chrome/kmprefs/locale/en-US/pref-kfavorites.dtd
  84. 15
      k-meleon/chrome/kmprefs/locale/en-US/pref-kgestures.dtd
  85. 9
      k-meleon/chrome/kmprefs/locale/en-US/pref-khotlist.dtd
  86. 2
      k-meleon/chrome/kmprefs/locale/en-US/pref-klayers.dtd
  87. 7
      k-meleon/chrome/kmprefs/locale/en-US/pref-kmacros.dtd
  88. 9
      k-meleon/chrome/kmprefs/locale/en-US/pref-kplugins.dtd
  89. 18
      k-meleon/chrome/kmprefs/locale/en-US/pref-privacy.dtd
  90. 7
      k-meleon/chrome/kmprefs/locale/en-US/pref-toolbars.dtd
  91. 32
      k-meleon/chrome/kmprefs/locale/en-US/pref-webfind.dtd
  92. 68
      k-meleon/chrome/kmprefs/locale/en-US/pref.dtd
  93. 12
      k-meleon/chrome/kmprefs/locale/en-US/pref.properties
  94. 17
      k-meleon/chrome/kmprefs/skin/contents.rdf
  95. 145
      k-meleon/chrome/kmprefs/skin/firefox/preferences.css
  96. BIN
      k-meleon/chrome/kmprefs/skin/gestures/LR.gif
  97. BIN
      k-meleon/chrome/kmprefs/skin/gestures/RL.gif
  98. BIN
      k-meleon/chrome/kmprefs/skin/gestures/down.gif
  99. BIN
      k-meleon/chrome/kmprefs/skin/gestures/downleft.gif
  100. BIN
      k-meleon/chrome/kmprefs/skin/gestures/downright.gif
  101. Some files were not shown because too many files have changed in this diff Show More

17
k-meleon/chrome/kmprefs/content/contents.rdf

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:kmprefs"/>
</RDF:Seq>
<RDF:Description about="urn:mozilla:package:kmprefs"
chrome:displayName="kmPrefs 1.1.2"
chrome:author="Klaus Kohler"
chrome:name="kmprefs"
chrome:extension="true"
chrome:description="Advanced Preferences Panel for K-Meleon 1.1">
</RDF:Description>
</RDF:RDF>

28
k-meleon/chrome/kmprefs/content/firefox/actionsshared.js

@ -0,0 +1,28 @@
//@line 38 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/toolkit/mozapps/preferences/actionsshared.js"
const FILEACTION_SAVE_TO_DISK = 1;
const FILEACTION_OPEN_INTERNALLY = 2;
const FILEACTION_OPEN_DEFAULT = 3;
const FILEACTION_OPEN_CUSTOM = 4;
const FILEACTION_OPEN_PLUGIN = 5;
function FileAction ()
{
}
FileAction.prototype = {
type : "",
extension : "",
hasExtension: true,
editable : true,
smallIcon : "",
bigIcon : "",
typeName : "",
action : "",
mimeInfo : null,
customHandler : "",
handleMode : false,
pluginAvailable : false,
pluginEnabled : false,
handledOnlyByPlugin : false
};

219
k-meleon/chrome/kmprefs/content/firefox/changeaction.js

@ -0,0 +1,219 @@
//@line 38 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/components/preferences/changeaction.js"
var gChangeActionDialog = {
_item : null,
_bundle : null,
_lastSelectedMode : null,
_lastSelectedSave : null,
init: function ()
{
this._item = window.arguments[0];
this._bundle = document.getElementById("bundlePreferences");
dump("*** ir = " + this._item.toSource() + "\n");
var typeField = document.getElementById("typeField");
typeField.value = this._item.typeName;
var extensionField = document.getElementById("extensionField");
var ext = "." + this._item.extension.toLowerCase();
var contentType = this._item.type;
extensionField.value = this._bundle.getFormattedString("extensionStringFormat", [ext, contentType]);
var typeIcon = document.getElementById("typeIcon");
typeIcon.src = this._item.bigIcon;
// Custom App Handler Path - this must be set before we set the selected
// radio button because the selection event handler for the radio group
// requires the extapp handler field to be non-empty for the extapp radio
// button to be selected.
var customApp = document.getElementById("customApp");
if (this._item.customHandler)
customApp.file = this._item.customHandler;
else
customApp.file = null;
var defaultApp = document.getElementById("defaultApp");
var defaultAppIcon = null;
var fallbackIconURL = "moz-icon://goat?contentType=" + this._item.type + "&size=16";
if (this._item.mimeInfo instanceof Components.interfaces.nsIPropertyBag) {
try {
defaultAppIcon = this._item.mimeInfo.getProperty("defaultApplicationIconURL");
}
catch (e) { }
if (defaultAppIcon)
defaultAppIcon += "?size=16";
}
defaultApp.image = defaultAppIcon || fallbackIconURL;
defaultApp.label = this._item.mimeInfo.defaultDescription;
var pluginName = document.getElementById("pluginName");
var foundPlugin = false;
for (var i = 0; i < navigator.plugins.length; ++i) {
var plugin = navigator.plugins[i];
for (var j = 0; j < plugin.length; ++j) {
if (contentType == plugin[j].type) {
pluginName.label = plugin.name;
pluginName.image = "moz-icon://goat.goat?contentType=" + contentType + "&size=16";
foundPlugin = true;
}
}
}
if (!foundPlugin) {
pluginName.label = this._bundle.getString("pluginHelperNoneAvailable");
document.getElementById("plugin").disabled = true;
}
// Selected Action Radiogroup
var handlerGroup = document.getElementById("handlerGroup");
if (this._item.handleMode == FILEACTION_OPEN_PLUGIN && this._item.pluginEnabled)
handlerGroup.selectedItem = document.getElementById("plugin");
else {
if (this._item.handleMode == FILEACTION_OPEN_DEFAULT)
handlerGroup.selectedItem = document.getElementById("openDefault");
else if (this._item.handleMode == FILEACTION_SAVE_TO_DISK)
handlerGroup.selectedItem = document.getElementById("saveToDisk");
else
handlerGroup.selectedItem = document.getElementById("openApplication");
}
this._lastSelectedMode = handlerGroup.selectedItem;
// Figure out the last selected Save As mode
var saveToOptions = document.getElementById("saveToOptions");
this._lastSelectedSave = saveToOptions.selectedItem;
// We don't let users open .exe files or random binary data directly
// from the browser at the moment because of security concerns.
var mimeType = this._item.mimeInfo.MIMEType;
if (mimeType == "application/object-stream" ||
mimeType == "application/x-msdownload") {
document.getElementById("openApplication").disabled = true;
document.getElementById("openDefault").disabled = true;
handlerGroup.selectedItem = document.getElementById("saveToDisk");
}
},
onAccept: function ()
{
var contentType = this._item.mimeInfo.MIMEType;
var handlerGroup = document.getElementById("handlerGroup");
switch (handlerGroup.selectedItem.value) {
case "plugin":
this._item.handleMode = FILEACTION_OPEN_PLUGIN;
var pluginName = document.getElementById("pluginName");
this._item.action = this._bundle.getFormattedString("openWith", [pluginName.label]);
this._item.pluginEnabled = true;
break;
case "system":
this._item.handledOnlyByPlugin = false;
this._item.handleMode = FILEACTION_OPEN_DEFAULT;
var defaultDescr = this._item.mimeInfo.defaultDescription;
this._item.action = this._bundle.getFormattedString("openWith", [defaultDescr]);
break;
case "app":
this._item.handledOnlyByPlugin = false;
this._item.handleMode = FILEACTION_OPEN_CUSTOM;
var customApp = document.getElementById("customApp");
this._item.action = this._bundle.getFormattedString("openWith", [customApp.label]);
break;
case "save":
this._item.handledOnlyByPlugin = false;
this._item.handleMode = FILEACTION_SAVE_TO_DISK;
this._item.action = this._bundle.getString("saveToDisk");
break;
}
// The opener uses the modifications to the FileAction item to update the
// datasource.
return true;
},
doEnabling: function (aSelectedItem)
{
var defaultApp = document.getElementById("defaultApp");
var saveToDefault = document.getElementById("saveToDefault");
var saveToCustom = document.getElementById("saveToCustom");
var customDownloadFolder = document.getElementById("customDownloadFolder");
var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
var saveToAskMe = document.getElementById("saveToAskMe");
var pluginName = document.getElementById("pluginName");
var changeApp = document.getElementById("changeApp");
var customApp = document.getElementById("customApp");
switch (aSelectedItem.id) {
case "openDefault":
changeApp.disabled = customApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
defaultApp.disabled = false;
break;
case "openApplication":
defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
changeApp.disabled = customApp.disabled = false;
if (!customApp.file && !this.changeApp()) {
this._lastSelectedMode.click();
return;
}
break;
case "saveToDisk":
changeApp.disabled = customApp.disabled = defaultApp.disabled = pluginName.disabled = true;
var saveToOptions = document.getElementById("saveToOptions");
customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = !(saveToOptions.selectedItem.id == "saveToCustom");
saveToDefault.disabled = saveToCustom.disabled = saveToAskMe.disabled = false;
break;
case "plugin":
changeApp.disabled = customApp.disabled = defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = true;
pluginName.disabled = false;
break;
}
this._lastSelectedMode = aSelectedItem;
},
doSaveToDiskEnabling: function (aSelectedItem)
{
var isSaveToCustom = aSelectedItem.id == "saveToCustom";
var customDownloadFolder = document.getElementById("customDownloadFolder");
var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
chooseCustomDownloadFolder.disabled = customDownloadFolder.disabled = !isSaveToCustom;
if (isSaveToCustom &&
!customDownloadFolder.file && !this.changeCustomFolder()) {
this._lastSelectedSave.click();
return;
}
this._lastSelectedSave = aSelectedItem;
},
changeApp: function ()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
var winTitle = this._bundle.getString("fpTitleChooseApp");
fp.init(window, winTitle, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
var customApp = document.getElementById("customApp");
customApp.file = fp.file;
this._item.customHandler = fp.file;
return true;
}
return false;
},
changeCustomFolder: function ()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
// extract the window title
var winTitle = this._bundle.getString("fpTitleChooseDL");
fp.init(window, winTitle, nsIFilePicker.modeGetFolder);
if (fp.show() == nsIFilePicker.returnOK && fp.file) {
var customDownloadFolder = document.getElementById("customDownloadFolder");
customDownloadFolder.file = fp.file;
customDownloadFolder.label = fp.file.path;
return true;
}
return false;
}
};

91
k-meleon/chrome/kmprefs/content/firefox/changeaction.xul

@ -0,0 +1,91 @@
<?xml version="1.0"?>
<!--
The original code is Firefox 2.0 (browser.jar!/content/browser/preferences/changeaction.xul)
-->
<?xml-stylesheet href="chrome://global/skin/"?>
<!--?xml-stylesheet href="chrome://mozapps/content/preferences/preferences.css" type="text/css"?-->
<?xml-stylesheet href="chrome://kmprefs/content/firefox/preferences.css" type="text/css"?>
<!--?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?-->
<?xml-stylesheet href="chrome://kmprefs/skin/firefox/preferences.css" type="text/css"?>
<!--DOCTYPE window SYSTEM "chrome://browser/locale/preferences/changeaction.dtd"-->
<!DOCTYPE window SYSTEM "chrome://kmprefs/locale/firefox/changeaction.dtd">
<!--dialog id="ChangeActionDialog" title="&changeAction.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="gChangeActionDialog.init();"
buttons="accept,cancel,help"
ondialogaccept="return gChangeActionDialog.onAccept();"
ondialoghelp="openHelp('prefs-file-types', 'chrome://browser/locale/help/help.rdf');"
xmlns:aaa="http://www.w3.org/2005/07/aaa"
style="width: &window.width;;"
persist="screenX screenY"-->
<dialog id="ChangeActionDialog" title="&changeAction.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="gChangeActionDialog.init();"
buttons="accept,cancel"
ondialogaccept="return gChangeActionDialog.onAccept();"
xmlns:aaa="http://www.w3.org/2005/07/aaa"
style="width: &window.width;;"
persist="screenX screenY">
<!--script type="application/x-javascript" src="chrome://mozapps/content/preferences/actionsshared.js"/-->
<script type="application/x-javascript" src="chrome://kmprefs/content/firefox/actionsshared.js"/>
<!--script type="application/x-javascript" src="chrome://browser/content/preferences/changeaction.js"/-->
<script type="application/x-javascript" src="chrome://kmprefs/content/firefox/changeaction.js"/>
<!--script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/-->
<!--stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/-->
<stringbundle id="bundlePreferences" src="chrome://kmprefs/locale/firefox/preferences.properties"/>
<hbox id="changeActionHeader" align="center" class="indent">
<image id="typeIcon"/>
<vbox flex="1">
<label id="typeField" crop="right"/>
<label id="extensionField" crop="right"/>
</vbox>
</hbox>
<vbox id="changeActionContent" flex="1">
<label control="handlerGroup">&whenDownloading.label;</label>
<radiogroup id="handlerGroup" onselect="gChangeActionDialog.doEnabling(this.selectedItem);"
flex="1" aaa:describedby="changeActionHeader">
<separator class="thin"/>
<radio id="openDefault" value="system"
label="&openDefault.label;" accesskey="&openDefault.accesskey;"
aaa:labelledby="openDefault defaultApp"/>
<filefield class="indent" id="defaultApp" disabled="true"/>
<separator class="thin"/>
<radio id="openApplication" value="app"
label="&openApplication.label;" accesskey="&openApplication.accesskey;"
aaa:labelledby="openApplication customApp"/>
<hbox align="center">
<filefield id="customApp" class="indent" flex="1" disabled="true"/>
<button id="changeApp" oncommand="gChangeActionDialog.changeApp();"
label="&changeApp.label;" accesskey="&changeApp.accesskey;"
disabled="true"/>
</hbox>
<separator class="thin"/>
<radio id="saveToDisk" value="save"
label="&saveToDisk.label;" accesskey="&saveToDisk.accesskey;"/>
<radiogroup id="saveToOptions" class="indent" onselect="gChangeActionDialog.doSaveToDiskEnabling(this.selectedItem);"
hidden="true">
<radio id="saveToDefault" value="default" selected="true"
label="&saveToDefaultFolder.label;" accesskey="&saveToDefaultFolder.accesskey;"/>
<radio id="saveToCustom" value="custom"
label="&saveToThisFolder.label;" accesskey="&saveToThisFolder.accesskey;"
aaa:labelledby="saveToCustom customDownloadFolder"/>
<hbox align="center" class="indent">
<filefield id="customDownloadFolder" flex="1"/>
<button id="chooseCustomDownloadFolder" oncommand="gChangeActionDialog.changeCustomFolder();"
label="&chooseFolder.label;" accesskey="&chooseFolder.accesskey;"/>
</hbox>
<radio id="saveToAskMe" value="ask"
label="&saveToAskMe.label;" accesskey="&saveToAskMe.accesskey;"/>
</radiogroup>
<radio id="plugin" value="plugin"
label="&usePlugin.label;" accesskey="&usePlugin.accesskey;"
aaa:labelledby="plugin pluginName"/>
<filefield class="indent" id="pluginName" disabled="true"/>
</radiogroup>
</vbox>
</dialog>

826
k-meleon/chrome/kmprefs/content/firefox/downloadactions.js

@ -0,0 +1,826 @@
//@line 38 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/components/preferences/downloadactions.js"
const kPluginHandlerContractID = "@mozilla.org/content/plugin/document-loader-factory;1";
const kDisabledPluginTypesPref = "plugin.disable_full_page_plugin_for_types";
const kShowPluginsInList = "browser.download.show_plugins_in_list";
const kHideTypesWithoutExtensions = "browser.download.hide_plugins_without_extensions";
const kRootTypePrefix = "urn:mimetype:";
///////////////////////////////////////////////////////////////////////////////
// MIME Types Datasource RDF Utils
function NC_URI(aProperty)
{
return "http://home.netscape.com/NC-rdf#" + aProperty;
}
function MIME_URI(aType)
{
return "urn:mimetype:" + aType;
}
function HANDLER_URI(aHandler)
{
return "urn:mimetype:handler:" + aHandler;
}
function APP_URI(aType)
{
return "urn:mimetype:externalApplication:" + aType;
}
var gDownloadActionsWindow = {
_tree : null,
_editButton : null,
_removeButton : null,
_actions : [],
_plugins : {},
_bundle : null,
_pref : Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch),
_mimeSvc : Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
.getService(Components.interfaces.nsIMIMEService),
_excludingPlugins : false,
_excludingMissingExtensions : false,
init: function ()
{
(this._editButton = document.getElementById("editFileHandler")).disabled = true;
(this._removeButton = document.getElementById("removeFileHandler")).disabled = true;
if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
this._pref.addObserver(kShowPluginsInList, this, false);
this._pref.addObserver(kHideTypesWithoutExtensions, this, false);
}
// Initialize the File Type list
this._bundle = document.getElementById("bundlePreferences");
this._tree = document.getElementById("fileHandlersList");
this._loadView();
// Determine any exclusions being applied - e.g. don't show types for which
// only a plugin handler exists, don't show types lacking extensions, etc.
this._view._rowCount = this._updateExclusions();
this._tree.treeBoxObject.view = this._view;
var indexToSelect = parseInt(this._tree.getAttribute("lastSelected"));
if (indexToSelect < this._tree.view.rowCount)
this._tree.view.selection.select(indexToSelect);
this._tree.focus();
},
_loadView: function ()
{
// Reset ALL the collections and state flags, because we can call this after
// the window has initially displayed by resetting the filter.
this._actions = [];
this._plugins = {};
this._view._filtered = false;
this._view._filterSet = [];
this._view._usingExclusionSet = false;
this._view._exclusionSet = [];
this._view._filterValue = "";
this._loadPluginData();
this._loadMIMERegistryData();
},
_updateRowCount: function (aNewRowCount)
{
var oldCount = this._view._rowCount;
this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -oldCount);
this._view._rowCount = aNewRowCount;
this._tree.treeBoxObject.rowCountChanged(0, aNewRowCount);
},
uninit: function ()
{
if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
this._pref.removeObserver(kShowPluginsInList, this);
this._pref.removeObserver(kHideTypesWithoutExtensions, this);
}
},
observe: function (aSubject, aTopic, aData)
{
if (aTopic == "nsPref:changed" &&
(aData == kShowPluginsInList || aData == kHideTypesWithoutExtensions))
this._updateRowCount(this._updateExclusions());
},
_updateExclusions: function ()
{
this._excludingPlugins = !this._pref.getBoolPref(kShowPluginsInList);
this._excludingMissingExtensions = this._pref.getBoolPref(kHideTypesWithoutExtensions);
this._view._exclusionSet = [].concat(this._actions);
if (this._excludingMissingExtensions) {
this._view._usingExclusionSet = true;
for (var i = 0; i < this._view._exclusionSet.length;) {
if (!this._view._exclusionSet[i].hasExtension)
this._view._exclusionSet.splice(i, 1);
else
++i;
}
}
if (this._excludingPlugins) {
this._view._usingExclusionSet = true;
for (i = 0; i < this._view._exclusionSet.length;) {
if (this._view._exclusionSet[i].handledOnlyByPlugin)
this._view._exclusionSet.splice(i, 1);
else
++i
}
}
return this._view._usingExclusionSet ? this._view._exclusionSet.length
: this._view._filtered ? this._view._filterSet.length
: this._actions.length;
},
_loadPluginData: function ()
{
// Read enabled plugin type information from the category manager
var disabled = "";
if (this._pref.prefHasUserValue(kDisabledPluginTypesPref))
disabled = this._pref.getCharPref(kDisabledPluginTypesPref);
for (var i = 0; i < navigator.plugins.length; ++i) {
var plugin = navigator.plugins[i];
for (var j = 0; j < plugin.length; ++j) {
var actionName = this._bundle.getFormattedString("openWith", [plugin.name])
var type = plugin[j].type;
this._createAction(type, actionName, true, FILEACTION_OPEN_PLUGIN,
null, true, disabled.indexOf(type) == -1, true);
}
}
},
_createAction: function (aMIMEType, aActionName,
aIsEditable, aHandleMode, aCustomHandler,
aPluginAvailable, aPluginEnabled,
aHandledOnlyByPlugin)
{
var newAction = !(aMIMEType in this._plugins);
var action = newAction ? new FileAction() : this._plugins[aMIMEType];
action.type = aMIMEType;
var info = this._mimeSvc.getFromTypeAndExtension(action.type, null);
// File Extension
try {
action.extension = info.primaryExtension;
}
catch (e) {
action.extension = this._bundle.getString("extensionNone");
action.hasExtension = false;
}
// Large and Small Icon
try {
action.smallIcon = "moz-icon://goat." + info.primaryExtension + "?size=16";
action.bigIcon = "moz-icon://goat." + info.primaryExtension + "?size=32";
}
catch (e) {
action.smallIcon = "moz-icon://goat?size=16&contentType=" + info.MIMEType;
action.bigIcon = "moz-icon://goat?contentType=" + info.MIMEType + "&size=32";
}
// Pretty Type Name
if (info.description == "") {
try {
action.typeName = this._bundle.getFormattedString("fileEnding", [info.primaryExtension.toUpperCase()]);
}
catch (e) {
// Wow, this sucks, just show the MIME type as a last ditch effort to display
// the type of file that this is.
action.typeName = info.MIMEType;
}
}
else
action.typeName = info.description;
// Pretty Action Name
if (aActionName)
action.action = aActionName;
action.pluginAvailable = aPluginAvailable;
action.pluginEnabled = aPluginEnabled;
action.editable = aIsEditable;
action.handleMode = aHandleMode;
action.customHandler = aCustomHandler;
action.mimeInfo = info;
action.handledOnlyByPlugin = aHandledOnlyByPlugin
if (newAction && !(action.handledOnlyByPlugin && !action.pluginEnabled)) {
this._actions.push(action);
this._plugins[action.type] = action;
}
return action;
},
_loadMIMEDS: function ()
{
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = fileLocator.get("UMimTyp", Components.interfaces.nsIFile);
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fileHandler = ioService.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
this._mimeDS = this._rdf.GetDataSourceBlocking(fileHandler.getURLSpecFromFile(file));
},
_getLiteralValue: function (aResource, aProperty)
{
var property = this._rdf.GetResource(NC_URI(aProperty));
var value = this._mimeDS.GetTarget(aResource, property, true);
if (value)
return value.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
return "";
},
_getChildResource: function (aResource, aProperty)
{
var property = this._rdf.GetResource(NC_URI(aProperty));
return this._mimeDS.GetTarget(aResource, property, true);
},
_getDisplayNameForFile: function (aFile)
{
//@line 286 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/components/preferences/downloadactions.js"
if (aFile instanceof Components.interfaces.nsILocalFileWin) {
try {
return aFile.getVersionInfoField("FileDescription");
}
catch (e) {
// fall through to the filename
}
}
//@line 304 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/components/preferences/downloadactions.js"
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
return url.fileName;
},
_loadMIMERegistryData: function ()
{
this._rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
this._loadMIMEDS();
var root = this._rdf.GetResource("urn:mimetypes:root");
var container = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
container.Init(this._mimeDS, root);
var elements = container.GetElements();
while (elements.hasMoreElements()) {
var type = elements.getNext();
if (!(type instanceof Components.interfaces.nsIRDFResource))
break;
var editable = this._getLiteralValue(type, "editable") == "true";
if (!editable)
continue;
var handler = this._getChildResource(type, "handlerProp");
var alwaysAsk = this._getLiteralValue(handler, "alwaysAsk") == "true";
if (alwaysAsk)
continue;
var saveToDisk = this._getLiteralValue(handler, "saveToDisk") == "true";
var useSystemDefault = this._getLiteralValue(handler, "useSystemDefault") == "true";
var editable = this._getLiteralValue(type, "editable") == "true";
var handledInternally = this._getLiteralValue(handler, "handleInternal") == "true";
var externalApp = this._getChildResource(handler, "externalApplication");
var externalAppPath = this._getLiteralValue(externalApp, "path");
try {
var customHandler = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
customHandler.initWithPath(externalAppPath);
}
catch (e) {
customHandler = null;
}
if (customHandler && !customHandler.exists())
customHandler = null;
var mimeType = this._getLiteralValue(type, "value");
var typeInfo = this._mimeSvc.getFromTypeAndExtension(mimeType, null);
// Determine the pretty name of the associated action.
var actionName = "";
var handleMode = 0;
if (saveToDisk) {
// Save the file to disk
actionName = this._bundle.getString("saveToDisk");
handleMode = FILEACTION_SAVE_TO_DISK;
}
else if (useSystemDefault) {
// Use the System Default handler
actionName = this._bundle.getFormattedString("openWith",
[typeInfo.defaultDescription]);
handleMode = FILEACTION_OPEN_DEFAULT;
}
else {
// Custom Handler
if (customHandler) {
actionName = this._bundle.getFormattedString("openWith",
[this._getDisplayNameForFile(customHandler)]);
handleMode = FILEACTION_OPEN_CUSTOM;
}
else {
// Corrupt datasource, invalid custom handler path. Revert to default.
actionName = this._bundle.getFormattedString("openWith",
[typeInfo.defaultDescription]);
handleMode = FILEACTION_OPEN_DEFAULT;
}
}
if (handledInternally)
handleMode = FILEACTION_OPEN_INTERNALLY;
var pluginAvailable = mimeType in this._plugins && this._plugins[mimeType].pluginAvailable;
var pluginEnabled = pluginAvailable && this._plugins[mimeType].pluginEnabled;
if (pluginEnabled) {
handleMode = FILEACTION_OPEN_PLUGIN;
actionName = null;
}
var action = this._createAction(mimeType, actionName, editable, handleMode,
customHandler, pluginAvailable, pluginEnabled,
false);
}
},
_view: {
_filtered : false,
_filterSet : [],
_usingExclusionSet : false,
_exclusionSet : [],
_filterValue : "",
_rowCount: 0,
get rowCount()
{
return this._rowCount;
},
get activeCollection ()
{
return this._filtered ? this._filterSet
: this._usingExclusionSet ? this._exclusionSet
: gDownloadActionsWindow._actions;
},
getItemAtIndex: function (aIndex)
{
return this.activeCollection[aIndex];
},
getCellText: function (aIndex, aColumn)
{
switch (aColumn.id) {
case "fileExtension":
return this.getItemAtIndex(aIndex).extension.toUpperCase();
case "fileType":
return this.getItemAtIndex(aIndex).typeName;
case "fileMIMEType":
return this.getItemAtIndex(aIndex).type;
case "fileHandler":
return this.getItemAtIndex(aIndex).action;
}
return "";
},
getImageSrc: function (aIndex, aColumn)
{
if (aColumn.id == "fileExtension")
return this.getItemAtIndex(aIndex).smallIcon;
return "";
},
_selection: null,
get selection () { return this._selection; },
set selection (val) { this._selection = val; return val; },
getRowProperties: function (aIndex, aProperties) {},
getCellProperties: function (aIndex, aColumn, aProperties) {},
getColumnProperties: function (aColumn, aProperties) {},
isContainer: function (aIndex) { return false; },
isContainerOpen: function (aIndex) { return false; },
isContainerEmpty: function (aIndex) { return false; },
isSeparator: function (aIndex) { return false; },
isSorted: function (aIndex) { return false; },
canDrop: function (aIndex, aOrientation) { return false; },
drop: function (aIndex, aOrientation) {},
getParentIndex: function (aIndex) { return -1; },
hasNextSibling: function (aParentIndex, aIndex) { return false; },
getLevel: function (aIndex) { return 0; },
getProgressMode: function (aIndex, aColumn) {},
getCellValue: function (aIndex, aColumn) {},
setTree: function (aTree) {},
toggleOpenState: function (aIndex) { },
cycleHeader: function (aColumn) {},
selectionChanged: function () {},
cycleCell: function (aIndex, aColumn) {},
isEditable: function (aIndex, aColumn) { return false; },
setCellValue: function (aIndex, aColumn, aValue) {},
setCellText: function (aIndex, aColumn, aValue) {},
performAction: function (aAction) {},
performActionOnRow: function (aAction, aIndex) {},
performActionOnCell: function (aAction, aindex, aColumn) {}
},
removeFileHandler: function ()
{
var selection = this._tree.view.selection;
if (selection.count < 1)
return;
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0;
flags += promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1;
var title = this._bundle.getString("removeTitle" + (selection.count > 1 ? "Multiple" : "Single"));
var message = this._bundle.getString("removeMessage" + (selection.count > 1 ? "Multiple" : "Single"));
var button = this._bundle.getString("removeButton" + (selection.count > 1 ? "Multiple" : "Single"));
var rv = promptService.confirmEx(window, title, message, flags, button,
null, null, null, { value: 0 });
if (rv != 0)
return;
var rangeCount = selection.getRangeCount();
var lastSelected = 0;
var mimeDSDirty = false;
for (var i = 0; i < rangeCount; ++i) {
var min = { }; var max = { };
selection.getRangeAt(i, min, max);
for (var j = min.value; j <= max.value; ++j) {
var item = this._view.getItemAtIndex(j);
if (!item.handledOnlyByPlugin) {
// There is data for this type in the MIME registry, so make sure we
// remove it from the MIME registry. We don't disable the plugin here because
// if we do there's currently no way through the UI to re-enable it. We may
// come up with some sort of solution for that at a later date.
var typeRes = this._rdf.GetResource(MIME_URI(item.type));
var handlerRes = this._getChildResource(typeRes, "handlerProp");
var extAppRes = this._getChildResource(handlerRes, "externalApplication");
this._cleanResource(extAppRes);
this._cleanResource(handlerRes);
this._cleanResource(typeRes);
mimeDSDirty = true;
}
lastSelected = (j + 1) >= this._view.rowCount ? j-1 : j;
}
}
if (mimeDSDirty &&
this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
this._mimeDS.Flush();
// Just reload the list to make sure deletions are respected
this._loadView();
this._updateRowCount(this._updateExclusions());
selection.select(lastSelected);
},
_cleanResource: function (aResource)
{
var labels = this._mimeDS.ArcLabelsOut(aResource);
while (labels.hasMoreElements()) {
var arc = labels.getNext();
if (!(arc instanceof Components.interfaces.nsIRDFResource))
break;
var target = this._mimeDS.GetTarget(aResource, arc, true);
this._mimeDS.Unassert(aResource, arc, target);
}
},
_disablePluginForItem: function (aItem)
{
if (aItem.pluginAvailable) {
// Since we're disabling the full page plugin for this content type,
// we must add it to the disabled list if it's not in there already.
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var disabled = aItem.type;
if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
disabled = prefs.getCharPref(kDisabledPluginTypesPref);
if (disabled.indexOf(aItem.type) == -1)
disabled += "," + aItem.type;
}
prefs.setCharPref(kDisabledPluginTypesPref, disabled);
// Also, we update the category manager so that existing browser windows
// update.
var catman = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
catman.deleteCategoryEntry("Gecko-Content-Viewers", aItem.type, false);
}
},
_enablePluginForItem: function (aItem)
{
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
// Since we're enabling the full page plugin for this content type, we must
// look at the disabled types list and ensure that this type isn't in it.
if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
var disabledList = prefs.getCharPref(kDisabledPluginTypesPref);
if (disabledList == aItem.type)
prefs.clearUserPref(kDisabledPluginTypesPref);
else {
var disabledTypes = disabledList.split(",");
var disabled = "";
for (var i = 0; i < disabledTypes.length; ++i) {
if (aItem.type != disabledTypes[i])
disabled += disabledTypes[i] + (i == disabledTypes.length - 1 ? "" : ",");
}
prefs.setCharPref(kDisabledPluginTypesPref, disabled);
}
}
// Also, we update the category manager so that existing browser windows
// update.
var catman = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
catman.addCategoryEntry("Gecko-Content-Viewers", aItem.type,
kPluginHandlerContractID, false, true);
},
_ensureMIMERegistryEntry: function (aItem)
{
var root = this._rdf.GetResource("urn:mimetypes:root");
var container = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
container.Init(this._mimeDS, root);
var itemResource = this._rdf.GetResource(MIME_URI(aItem.type));
var handlerResource = null;
if (container.IndexOf(itemResource) == -1) {
container.AppendElement(itemResource);
this._setLiteralValue(itemResource, "editable", "true");
this._setLiteralValue(itemResource, "value", aItem.type);
handlerResource = this._rdf.GetResource(HANDLER_URI(aItem.type));
this._setLiteralValue(handlerResource, "alwaysAsk", "false");
var handlerProp = this._rdf.GetResource(NC_URI("handlerProp"));
this._mimeDS.Assert(itemResource, handlerProp, handlerResource, true);
var extAppResource = this._rdf.GetResource(APP_URI(aItem.type));
this._setLiteralValue(extAppResource, "path", "");
var extAppProp = this._rdf.GetResource(NC_URI("externalApplication"));
this._mimeDS.Assert(handlerResource, extAppProp, extAppResource, true);
}
else
handlerResource = this._getChildResource(itemResource, "handlerProp");
return handlerResource;
},
_setLiteralValue: function (aResource, aProperty, aValue)
{
var property = this._rdf.GetResource(NC_URI(aProperty));
var newValue = this._rdf.GetLiteral(aValue);
var oldValue = this._mimeDS.GetTarget(aResource, property, true);
if (oldValue)
this._mimeDS.Change(aResource, property, oldValue, newValue);
else
this._mimeDS.Assert(aResource, property, newValue, true);
},
editFileHandler: function ()
{
var selection = this._tree.view.selection;
if (selection.count != 1)
return;
var item = this._view.getItemAtIndex(selection.currentIndex);
// openDialog("chrome://browser/content/preferences/changeaction.xul",
// "_blank", "modal,centerscreen", item);
openDialog("chrome://kmprefs/content/firefox/changeaction.xul",
"_blank", "modal,centerscreen", item);
// Update the database
switch (item.handleMode) {
case FILEACTION_OPEN_PLUGIN:
this._enablePluginForItem(item);
// We don't need to adjust the database because plugin settings always
// supercede whatever is in the db, leaving it untouched allows the last
// user setting(s) to be preserved if they ever revert.
break;
case FILEACTION_OPEN_DEFAULT:
this._disablePluginForItem(item);
var handlerRes = this._ensureMIMERegistryEntry(item);
this._setLiteralValue(handlerRes, "useSystemDefault", "true");
this._setLiteralValue(handlerRes, "saveToDisk", "false");
break;
case FILEACTION_OPEN_CUSTOM:
this._disablePluginForItem(item);
var handlerRes = this._ensureMIMERegistryEntry(item);
this._setLiteralValue(handlerRes, "useSystemDefault", "false");
this._setLiteralValue(handlerRes, "saveToDisk", "false");
var extAppRes = this._getChildResource(handlerRes, "externalApplication");
this._setLiteralValue(extAppRes, "path", item.customHandler.path);
break;
case FILEACTION_SAVE_TO_DISK:
this._disablePluginForItem(item);
var handlerRes = this._ensureMIMERegistryEntry(item);
this._setLiteralValue(handlerRes, "useSystemDefault", "false");
this._setLiteralValue(handlerRes, "saveToDisk", "true");
break;
}
if (this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
this._mimeDS.Flush();
// Update the view
this._tree.treeBoxObject.invalidateRow(selection.currentIndex);
},
onSelectionChanged: function ()
{
if (this._tree.view.rowCount == 0) {
this._removeButton.disabled = true;
this._editButton.disabled = true;
return;
}
var selection = this._tree.view.selection;
var selected = selection.count;
this._removeButton.disabled = selected == 0;
this._editButton.disabled = selected != 1;
var stringKey = selected > 1 ? "removeButtonMultiple" : "removeButtonSingle";
this._removeButton.label = this._bundle.getString(stringKey);
var canRemove = true;
var canEdit = true;
var rangeCount = selection.getRangeCount();
var min = { }, max = { };
var setLastSelected = false;
for (var i = 0; i < rangeCount; ++i) {
selection.getRangeAt(i, min, max);
for (var j = min.value; j <= max.value; ++j) {
if (!setLastSelected) {
// Set the last selected index to the first item in the selection
this._tree.setAttribute("lastSelected", j);
setLastSelected = true;
}
var item = this._view.getItemAtIndex(j);
if (item &&
(!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY))
canEdit = false;
if (item &&
(!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY ||
item.handledOnlyByPlugin))
canRemove = false;
}
}
if (!canRemove)
this._removeButton.disabled = true;
if (!canEdit)
this._editButton.disabled = true;
},
_lastSortProperty : "",
_lastSortAscending: false,
sort: function (aProperty)
{
var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
function sortByProperty(a, b)
{
return a[aProperty].toLowerCase().localeCompare(b[aProperty].toLowerCase());
}
function sortByExtension(a, b)
{
if (!a.hasExtension && b.hasExtension)
return 1;
if (!b.hasExtension && a.hasExtension)
return -1;
return a.extension.toLowerCase().localeCompare(b.extension.toLowerCase());
}
// Sort the Filtered List, if in Filtered mode
if (!this._view._filtered) {
this._view.activeCollection.sort(aProperty == "extension" ? sortByExtension : sortByProperty);
if (!ascending)
this._view.activeCollection.reverse();
}
this._view.selection.clearSelection();
this._view.selection.select(0);
this._tree.treeBoxObject.invalidate();
this._tree.treeBoxObject.ensureRowIsVisible(0);
this._lastSortAscending = ascending;
this._lastSortProperty = aProperty;
},
clearFilter: function ()
{
// Clear the Filter and the Tree Display
document.getElementById("filter").value = "";
this._view._filtered = false;
this._view._filterSet = [];
// Just reload the list to make sure deletions are respected
this._loadView();
this._updateRowCount(this._updateExclusions());
// Restore selection
this._view.selection.clearSelection();
for (var i = 0; i < this._lastSelectedRanges.length; ++i) {
var range = this._lastSelectedRanges[i];
this._view.selection.rangedSelect(range.min, range.max, true);
}
this._lastSelectedRanges = [];
document.getElementById("actionsIntro").value = this._bundle.getString("actionsAll");
document.getElementById("clearFilter").disabled = true;
document.getElementById("filter").focus();
},
_actionMatchesFilter: function (aAction)
{
return aAction.extension.toLowerCase().indexOf(this._view._filterValue) != -1 ||
aAction.typeName.toLowerCase().indexOf(this._view._filterValue) != -1 ||
aAction.type.toLowerCase().indexOf(this._view._filterValue) != -1 ||
aAction.action.toLowerCase().indexOf(this._view._filterValue) != -1;
},
_filterActions: function (aFilterValue)
{
this._view._filterValue = aFilterValue;
var actions = [];
var collection = this._view._usingExclusionSet ? this._view._exclusionSet : this._actions;
for (var i = 0; i < collection.length; ++i) {
var action = collection[i];
if (this._actionMatchesFilter(action))
actions.push(action);
}
return actions;
},
_lastSelectedRanges: [],
_saveState: function ()
{
// Save selection
var seln = this._view.selection;
this._lastSelectedRanges = [];
var rangeCount = seln.getRangeCount();
for (var i = 0; i < rangeCount; ++i) {
var min = {}; var max = {};
seln.getRangeAt(i, min, max);
this._lastSelectedRanges.push({ min: min.value, max: max.value });
}
},
_filterTimeout: -1,
onFilterInput: function ()
{
if (this._filterTimeout != -1)
clearTimeout(this._filterTimeout);
function filterActions()
{
var filter = document.getElementById("filter").value;
if (filter == "") {
gDownloadActionsWindow.clearFilter();
return;
}
var view = gDownloadActionsWindow._view;
view._filterSet = gDownloadActionsWindow._filterActions(filter);
if (!view._filtered) {
// Save Display Info for the Non-Filtered mode when we first
// enter Filtered mode.
gDownloadActionsWindow._saveState();
view._filtered = true;
}
// Clear the display
gDownloadActionsWindow._updateRowCount(view._filterSet.length);
// if the view is not empty then select the first item
if (view.rowCount > 0)
view.selection.select(0);
document.getElementById("actionsIntro").value = gDownloadActionsWindow._bundle.getString("actionsFiltered");
document.getElementById("clearFilter").disabled = false;
}
window.filterActions = filterActions;
this._filterTimeout = setTimeout("filterActions();", 500);
},
onFilterKeyPress: function (aEvent)
{
if (aEvent.keyCode == 27) // ESC key
this.clearFilter();
},
focusFilterBox: function ()
{
var filter = document.getElementById("filter");
filter.focus();
filter.select();
}
};

33
k-meleon/chrome/kmprefs/content/firefox/license.txt

@ -0,0 +1,33 @@
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this collection 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 the Firefox Preferences System.
The Initial Developer of the Original Code is
Ben Goodger.
Portions created by the Initial Developer are Copyright (C) 2005
the Initial Developer. All Rights Reserved.
Contributor(s):
Ben Goodger <ben@mozilla.org>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.

4
k-meleon/chrome/kmprefs/content/firefox/preferences.css

@ -0,0 +1,4 @@
filefield {
/* -moz-binding: url("chrome://mozapps/content/preferences/preferences.xml#fileField");*/
-moz-binding: url("chrome://kmprefs/content/firefox/preferences.xml#fileField");
}

80
k-meleon/chrome/kmprefs/content/firefox/preferences.xml

@ -0,0 +1,80 @@
<?xml version="1.0"?>
<bindings id="PreferencesSkinBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="fileField" extends="chrome://global/content/bindings/general.xml#control-item">
<content>
<!--xul:stringbundle anonid="bundle" src="chrome://mozapps/locale/preferences/preferences.properties"/-->
<xul:stringbundle anonid="bundle" src="chrome://kmprefs/locale/firefox/preferences.properties"/>
<xul:hbox class="fileFieldContentBox" align="center" flex="1">
<xul:image class="fileFieldIcon" xbl:inherits="src=image"/>
<xul:textbox class="fileFieldLabel" xbl:inherits="value=label,disabled,accesskey,tabindex" flex="1" readonly="true"/>
</xul:hbox>
</content>
<implementation implements="nsIDOMXULLabeledControlElement">
<property name="label" onget="return this.getAttribute('label');">
<setter>
this.setAttribute('label', val);
var elt = document.getAnonymousElementByAttribute(this, "class", "fileFieldLabel");
return (elt.value = val);
</setter>
</property>
<field name="_file">null</field>
<property name="file" onget="return this._file">
<setter>
<![CDATA[
this._file = val;
if (val) {
this.image = this._getIconURLForFile(val);
this.label = this._getDisplayNameForFile(val);
}
else {
this.removeAttribute("image");
var bundle = document.getAnonymousElementByAttribute(this, "anonid", "bundle");
this.label = bundle.getString("downloadHelperNoneSelected");
}
return val;
]]>
</setter>
</property>
<method name="_getDisplayNameForFile">
<parameter name="aFile"/>
<body>
<![CDATA[
var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
try {
return lfw.getVersionInfoField("FileDescription");
}
catch (e) {
// fall through to the filename
}
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
return url.fileName;
]]>
</body>
</method>
<method name="_getIconURLForFile">
<parameter name="aFile"/>
<body>
<![CDATA[
if (!aFile)
return "";
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fph = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var urlspec = fph.getURLSpecFromFile(aFile);
return "moz-icon://" + urlspec + "?size=16";
]]>
</body>
</method>
</implementation>
</binding>
</bindings>

54
k-meleon/chrome/kmprefs/content/kmprefs/dlg-gestures.xul

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://communicator/skin/"?>
<!DOCTYPE dialog SYSTEM "chrome://kmprefs/locale/pref-kgestures.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="findDialog" title="&gestures.dlg.titleEdit;" addtitle="&gestures.dlg.titleAdd;" onload="init()"
style="&gestures.dlg.style;" contextmenu="0"
buttons="accept,cancel"
buttonlabelaccept="&dialog.accept.label;"