Support copying from about:config using the browser's Edit/Copy and the Accel+C shortcut as well as the context menu b=239940 r=mats,mano

This commit is contained in:
neil%parkwaycc.co.uk 2007-02-01 13:13:51 +00:00
Родитель f7564f4c71
Коммит 0197c885eb
4 изменённых файлов: 42 добавлений и 4 удалений

Просмотреть файл

@ -363,7 +363,9 @@ function ShowPrefs()
gPrefBranch.addObserver("", gPrefListener, false);
document.getElementById("configTree").view = view;
var configTree = document.getElementById("configTree");
configTree.view = view;
configTree.controllers.insertControllerAt(0, configController);
document.getElementById("configDeck").setAttribute("selectedIndex", 1);
if (!document.getElementById("showWarningNextTime").checked)
@ -376,7 +378,9 @@ function onConfigUnload()
{
if (document.getElementById("configDeck").getAttribute("selectedIndex") == 1) {
gPrefBranch.removeObserver("", gPrefListener);
document.getElementById("configTree").view = null;
var configTree = document.getElementById("configTree");
configTree.view = null;
configTree.controllers.removeController(configController);
}
}
@ -462,6 +466,20 @@ const gSortFunctions =
valueCol: valueColSortFunction
};
const configController = {
supportsCommand: function supportsCommand(command) {
return command == "cmd_copy";
},
isCommandEnabled: function isCommandEnabled(command) {
return view.selection && view.selection.currentIndex >= 0;
},
doCommand: function doCommand(command) {
copyPref();
},
onEvent: function onEvent(event) {
}
}
function updateContextMenu()
{
var lockCol = PREF_IS_LOCKED;

Просмотреть файл

@ -101,6 +101,7 @@
</hbox>
<tree id="configTree" flex="1" class="plain focusring" seltype="single"
onselect="updateCommands('select');"
enableColumnDrag="true" context="configContext">
<treecols>
<treecol id="prefCol" label="&prefColumn.label;" flex="7"

Просмотреть файл

@ -364,7 +364,9 @@ function ShowPrefs()
gPrefBranch.addObserver("", gPrefListener, false);
document.getElementById("configTree").view = view;
var configTree = document.getElementById("configTree");
configTree.view = view;
configTree.controllers.insertControllerAt(0, configController);
document.getElementById("configDeck").setAttribute("selectedIndex", 1);
if (!document.getElementById("showWarningNextTime").checked)
@ -377,7 +379,9 @@ function onConfigUnload()
{
if (document.getElementById("configDeck").getAttribute("selectedIndex") == 1) {
gPrefBranch.removeObserver("", gPrefListener);
document.getElementById("configTree").view = null;
var configTree = document.getElementById("configTree");
configTree.view = null;
configTree.controllers.removeController(configController);
}
}
@ -463,6 +467,20 @@ const gSortFunctions =
valueCol: valueColSortFunction
};
const configController = {
supportsCommand: function supportsCommand(command) {
return command == "cmd_copy";
},
isCommandEnabled: function isCommandEnabled(command) {
return view.selection && view.selection.currentIndex >= 0;
},
doCommand: function doCommand(command) {
copyPref();
},
onEvent: function onEvent(event) {
}
}
function updateContextMenu()
{
var lockCol = PREF_IS_LOCKED;

Просмотреть файл

@ -100,6 +100,7 @@
</hbox>
<tree id="configTree" flex="1" class="plain focusring" seltype="single"
onselect="updateCommands('select');"
enableColumnDrag="true" context="configContext">
<treecols>
<treecol id="prefCol" label="&prefColumn.label;" flex="7"