1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 14:15:49 +01:00

Merge old head.

This commit is contained in:
Kris Maglione
2009-09-26 16:55:40 -04:00
9 changed files with 50 additions and 31 deletions

View File

@@ -885,7 +885,7 @@ function Editor() //{{{
},
// TODO: clean up with 2 functions for textboxes and currentEditor?
editFieldExternally: function ()
editFieldExternally: function (forceEditing)
{
if (!options["editor"])
return false;
@@ -894,11 +894,15 @@ function Editor() //{{{
if (!(config.isComposeWindow))
textBox = liberator.focus;
if (textBox.type == "password")
if (!forceEditing && textBox && textBox.type == "password")
{
liberator.beep();
liberator.echoerr("Cannot edit password fields");
return false;
commandline.input("Editing a password field externally will reveal the password. Would you like to continue? (yes/[no]): ",
function (resp)
{
if (resp && resp.match(/^y(es)?$/i))
return editor.editFieldExternally(true);
});
return;
}
let text = ""; // XXX

View File

@@ -185,7 +185,8 @@ const liberator = (function () //{{{
styles.addSheet(true, "scrollbar", "*", class.join(", ") + " { visibility: collapse !important; }", true);
else
styles.removeSheet(true, "scrollbar");
options.safeSetPref("layout.scrollbar.side", opts.indexOf("l") >= 0 ? 3 : 2);
options.safeSetPref("layout.scrollbar.side", opts.indexOf("l") >= 0 ? 3 : 2,
"See 'guioptions' scrollbar flags.");
},
validator: function (opts) (opts.indexOf("l") < 0 || opts.indexOf("r") < 0)
},
@@ -289,7 +290,8 @@ const liberator = (function () //{{{
{
setter: function (value)
{
options.safeSetPref("accessibility.typeaheadfind.enablesound", !value);
options.safeSetPref("accessibility.typeaheadfind.enablesound", !value,
"See 'visualbell' option");
return value;
}
});

View File

@@ -448,8 +448,8 @@ function Options() //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
// TODO: migrate liberator.saved.* prefs to extensions.liberator.saved.*
const SAVED = "extensions.liberator.saved.";
const OLD_SAVED = "liberator.saved.";
const optionHash = {};
@@ -925,9 +925,7 @@ function Options() //{{{
liberator.registerObserver("load_completion", function () {
completion.setFunctionCompleter(options.get, [function () ([o.name, o.description] for (o in options))]);
completion.setFunctionCompleter([options.getPref, options.safeSetPref, options.setPref, options.resetPref, options.invertPref],
[function () services.get("pref")
.getChildList("", { value: 0 })
.map(function (pref) [pref, ""])]);
[function () options.allPrefs().map(function (pref) [pref, ""])]);
completion.option = function option(context, scope) {
context.title = ["Option"];
@@ -990,7 +988,7 @@ function Options() //{{{
context.anchored = false;
context.title = [config.hostApplication + " Preference", "Value"];
context.keys = { text: function (item) item, description: function (item) options.getPref(item) };
context.completions = services.get("pref").getChildList("", { value: 0 });
context.completions = options.allPrefs();
};
});
@@ -1095,6 +1093,14 @@ function Options() //{{{
return true;
},
/**
* Returns the names of all preferences.
*
* @param {string} branch The branch in which to search preferences.
* @default ""
*/
allPrefs: function (branch) services.get("pref").getChildList(branch || "", { value: 0 }),
/**
* Returns the option with <b>name</b> in the specified <b>scope</b>.
*
@@ -1134,7 +1140,7 @@ function Options() //{{{
if (!scope)
scope = options.OPTION_SCOPE_BOTH;
let opts = function (opt) {
function opts(opt) {
for (let opt in Iterator(options))
{
let option = {
@@ -1181,9 +1187,9 @@ function Options() //{{{
if (!filter)
filter = "";
let prefArray = services.get("pref").getChildList("", { value: 0 });
let prefArray = options.allPrefs();
prefArray.sort();
let prefs = function () {
function prefs() {
for (let [, pref] in Iterator(prefArray))
{
let userValue = services.get("pref").prefHasUserValue(pref);
@@ -1299,13 +1305,18 @@ function Options() //{{{
* @param {value} value The new preference value.
*/
// FIXME: Well it used to. I'm looking at you mst! --djk
safeSetPref: function (name, value)
safeSetPref: function (name, value, message)
{
let val = loadPreference(name, null, false);
let def = loadPreference(name, null, true);
let lib = loadPreference(SAVED + name);
if (lib == null && val != def || val != lib)
liberator.echomsg("Warning: setting preference " + name + ", but it's changed from its default value.");
{
let msg = "Warning: setting preference " + name + ", but it's changed from its default value.";
if (message)
msg += " " + message;
liberator.echomsg(msg);
}
storePreference(name, value);
storePreference(SAVED + name, value);
},
@@ -1397,6 +1408,14 @@ function Options() //{{{
}
}; //}}}
for (let [, pref] in Iterator(self.allPrefs(OLD_SAVED)))
{
let saved = SAVED + pref.substr(OLD_SAVED.length)
if (!self.getPref(saved))
self.setPref(saved, self.getPref(pref));
self.resetPref(pref);
}
self.prefObserver.register();
liberator.registerObserver("shutdown", function () {
self.prefObserver.unregister();

View File

@@ -72,7 +72,7 @@ function Sanitizer() //{{{
{
options.setPref(pref, false);
for (let [, value] in Iterator(values.split(",")))
for (let [, value] in Iterator(this.parseValues(values)))
{
if (prefToArg(pref) == value)
{
@@ -311,15 +311,8 @@ function Sanitizer() //{{{
return errors;
};
self.__defineGetter__("prefNames", function () {
let ret = [];
[self.prefDomain, self.prefDomain2].forEach(function (branch) {
ret = ret.concat(services.get("pref").getBranch(branch).getChildList("", {}).map(function (pref) branch + pref));
});
return ret;
});
self.__defineGetter__("prefNames",
function () util.Array.flatten([self.prefDomain, self.prefDomain2].map(options.allPrefs)));
//}}}
return self;

View File

@@ -183,8 +183,8 @@ function Tabs() //{{{
restriction = 2;
}
options.safeSetPref("browser.link.open_newwindow", open);
options.safeSetPref("browser.link.open_newwindow.restriction", restriction);
options.safeSetPref("browser.link.open_newwindow", open, "See 'popups' option.");
options.safeSetPref("browser.link.open_newwindow.restriction", restriction, "See 'popups' option.");
return value;
},
completer: function (context) [