1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-11 07:14:13 +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) [

View File

@@ -1,2 +1,3 @@
2009:
* Andreas Nerf (biggest Muttator donor so far! thanks a lot)
* Kirill Korotaev

View File

@@ -2,6 +2,7 @@ Continuous donations:
* Daniel Bainton (web hosting)
2009:
* Oliver Schaefer (2nd donation this year, and largest one in 2009! - Thanks!)
* James Davis
* Gregg Archer
* James Henderson

View File

@@ -25,7 +25,6 @@
* add [c]:verbose[c]
* add [c]:window[c] to run a command in a new window
* add ! version of [c]:delbmarks[c] to delete all bookmarks
* new "t" option for 'complete' to also switch to open tabs with :open
* add [c]:toolbaropen[c], [c]:toolbarclose[c], and [c]:toolbartoggle[c]
* make [c]:open[c] behavior match that of [c]:tabopen[c] and [c]:winopen[c]
when no argument is specified

View File

@@ -19,7 +19,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.5</em:minVersion>
<em:maxVersion>3.6a2pre</em:maxVersion>
<em:maxVersion>3.6b1pre</em:maxVersion>
</Description>
</em:targetApplication>
</Description>