mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 20:27:57 +01:00
get rid off v.options.{g,s}etFirefoxPref and renamed it to {g,s}etPref. You shouldn't save vimperator specific preferences in the about:config anyway, but store larger things like the history in the SQLITE database.
This commit is contained in:
@@ -811,7 +811,8 @@ vimperator.QuickMarks = function () //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var qmarks = {};
|
var qmarks = {};
|
||||||
var savedMarks = vimperator.options.getPref("quickmarks", "").split("\n");
|
// TODO: move to a storage module
|
||||||
|
var savedMarks = vimperator.options.getPref("vimperator.extensions.quickmarks", "").split("\n");
|
||||||
|
|
||||||
// load the saved quickmarks -- TODO: change to sqlite
|
// load the saved quickmarks -- TODO: change to sqlite
|
||||||
for (var i = 0; i < savedMarks.length - 1; i += 2)
|
for (var i = 0; i < savedMarks.length - 1; i += 2)
|
||||||
@@ -907,7 +908,7 @@ vimperator.QuickMarks = function () //{{{
|
|||||||
savedQuickMarks += qmarks[i] + "\n";
|
savedQuickMarks += qmarks[i] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
vimperator.options.setPref("quickmarks", savedQuickMarks);
|
vimperator.options.setPref("vimperator.extensions.quickmarks", savedQuickMarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ vimperator.Buffer = function () //{{{
|
|||||||
{
|
{
|
||||||
urlSecurityCheck(url, doc.nodePrincipal);
|
urlSecurityCheck(url, doc.nodePrincipal);
|
||||||
// we always want to save that link relative to the current working directory
|
// we always want to save that link relative to the current working directory
|
||||||
vimperator.options.setFirefoxPref("browser.download.lastDir", vimperator.io.getCurrentDirectory());
|
vimperator.options.setPref("browser.download.lastDir", vimperator.io.getCurrentDirectory());
|
||||||
saveURL(url, text, null, true, skipPrompt, makeURI(url, doc.characterSet));
|
saveURL(url, text, null, true, skipPrompt, makeURI(url, doc.characterSet));
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
|
|||||||
@@ -1757,7 +1757,7 @@ vimperator.Commands = function () //{{{
|
|||||||
{
|
{
|
||||||
var file = vimperator.io.getFile(args || "");
|
var file = vimperator.io.getFile(args || "");
|
||||||
// we always want to save that link relative to the current working directory
|
// we always want to save that link relative to the current working directory
|
||||||
vimperator.options.setFirefoxPref("browser.download.lastDir", vimperator.io.getCurrentDirectory());
|
vimperator.options.setPref("browser.download.lastDir", vimperator.io.getCurrentDirectory());
|
||||||
//if (args)
|
//if (args)
|
||||||
//{
|
//{
|
||||||
// saveURL(vimperator.buffer.URL, args, null, true, special, // special == skipPrompt
|
// saveURL(vimperator.buffer.URL, args, null, true, special, // special == skipPrompt
|
||||||
@@ -1776,11 +1776,11 @@ vimperator.Commands = function () //{{{
|
|||||||
{
|
{
|
||||||
if (special)
|
if (special)
|
||||||
{
|
{
|
||||||
var onlyNondefault = false;
|
var onlyNonDefault = false;
|
||||||
if (!args)
|
if (!args)
|
||||||
{
|
{
|
||||||
args = "all";
|
args = "all";
|
||||||
onlyNondefault = true;
|
onlyNonDefault = true;
|
||||||
}
|
}
|
||||||
// 1 2 3 4 5
|
// 1 2 3 4 5
|
||||||
var matches = args.match(/^\s*?([a-zA-Z0-9\.\-_{}]+)([?&!])?\s*(([+-^]?)=(.*))?\s*$/);
|
var matches = args.match(/^\s*?([a-zA-Z0-9\.\-_{}]+)([?&!])?\s*(([+-^]?)=(.*))?\s*$/);
|
||||||
@@ -1796,11 +1796,11 @@ vimperator.Commands = function () //{{{
|
|||||||
if (name == "all" && reset)
|
if (name == "all" && reset)
|
||||||
vimperator.echoerr("You can't reset all the firefox options, it could make your browser unusable.");
|
vimperator.echoerr("You can't reset all the firefox options, it could make your browser unusable.");
|
||||||
else if (name == "all")
|
else if (name == "all")
|
||||||
vimperator.options.listFirefoxPrefs(onlyNondefault, "");
|
vimperator.options.listPrefs(onlyNonDefault, "");
|
||||||
else if (reset)
|
else if (reset)
|
||||||
vimperator.options.resetFirefoxPref(name);
|
vimperator.options.resetPref(name);
|
||||||
else if (invertBoolean)
|
else if (invertBoolean)
|
||||||
vimperator.options.invertFirefoxPref(name);
|
vimperator.options.invertPref(name);
|
||||||
else if (matches[3])
|
else if (matches[3])
|
||||||
{
|
{
|
||||||
var value = matches[5];
|
var value = matches[5];
|
||||||
@@ -1820,20 +1820,20 @@ vimperator.Commands = function () //{{{
|
|||||||
if (!isNaN(valueInt))
|
if (!isNaN(valueInt))
|
||||||
value = valueInt;
|
value = valueInt;
|
||||||
}
|
}
|
||||||
vimperator.options.setFirefoxPref(name, value);
|
vimperator.options.setPref(name, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vimperator.options.listFirefoxPrefs(onlyNondefault, name);
|
vimperator.options.listPrefs(onlyNonDefault, name);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var onlyNondefault = false; // used for :set to print non-default options
|
var onlyNonDefault = false; // used for :set to print non-default options
|
||||||
if (!args)
|
if (!args)
|
||||||
{
|
{
|
||||||
args = "all";
|
args = "all";
|
||||||
onlyNondefault = true;
|
onlyNonDefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 2 3 4 5 6
|
// 1 2 3 4 5 6
|
||||||
@@ -1898,7 +1898,7 @@ vimperator.Commands = function () //{{{
|
|||||||
{
|
{
|
||||||
if (all)
|
if (all)
|
||||||
{
|
{
|
||||||
vimperator.options.list(onlyNondefault);
|
vimperator.options.list(onlyNonDefault);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -364,9 +364,9 @@ vimperator.Completion = function () //{{{
|
|||||||
|
|
||||||
if (special)
|
if (special)
|
||||||
{
|
{
|
||||||
var firefoxBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
var prefArray = firefoxBranch.getChildList("", {value: 0});
|
var prefArray = prefs.getChildList("", {value: 0});
|
||||||
prefArray.sort();
|
prefArray.sort();
|
||||||
|
|
||||||
if (filter.length > 0 && filter.lastIndexOf("=") == filter.length - 1)
|
if (filter.length > 0 && filter.lastIndexOf("=") == filter.length - 1)
|
||||||
@@ -376,7 +376,7 @@ vimperator.Completion = function () //{{{
|
|||||||
var name = prefArray[i];
|
var name = prefArray[i];
|
||||||
if (name.match("^" + filter.substr(0, filter.length - 1) + "$" ))
|
if (name.match("^" + filter.substr(0, filter.length - 1) + "$" ))
|
||||||
{
|
{
|
||||||
var value = vimperator.options.getFirefoxPref(name) + "";
|
var value = vimperator.options.getPref(name) + "";
|
||||||
return [filter.length + 1, [[value, ""]]];
|
return [filter.length + 1, [[value, ""]]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,9 +386,9 @@ vimperator.Completion = function () //{{{
|
|||||||
for (var i = 0; i < prefArray.length; i++)
|
for (var i = 0; i < prefArray.length; i++)
|
||||||
{
|
{
|
||||||
if (!filter)
|
if (!filter)
|
||||||
optionCompletions.push([prefArray[i], vimperator.options.getFirefoxPref(prefArray[i])]);
|
optionCompletions.push([prefArray[i], vimperator.options.getPref(prefArray[i])]);
|
||||||
else
|
else
|
||||||
optionCompletions.push([[prefArray[i]], vimperator.options.getFirefoxPref(prefArray[i])]);
|
optionCompletions.push([[prefArray[i]], vimperator.options.getPref(prefArray[i])]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -853,7 +853,7 @@ vimperator.Events = function () //{{{
|
|||||||
case vimperator.modes.CARET:
|
case vimperator.modes.CARET:
|
||||||
// setting this option will trigger an observer which will
|
// setting this option will trigger an observer which will
|
||||||
// care about all other details like setting the NORMAL mode
|
// care about all other details like setting the NORMAL mode
|
||||||
vimperator.options.setFirefoxPref("accessibility.browsewithcaret", false);
|
vimperator.options.setPref("accessibility.browsewithcaret", false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vimperator.modes.INSERT:
|
case vimperator.modes.INSERT:
|
||||||
@@ -1245,6 +1245,7 @@ vimperator.Events = function () //{{{
|
|||||||
onLinkIconAvailable: function () { ; }
|
onLinkIconAvailable: function () { ; }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// TODO: move to options.js?
|
||||||
prefObserver: {
|
prefObserver: {
|
||||||
register: function ()
|
register: function ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -155,9 +155,9 @@ vimperator.IO = function () //{{{
|
|||||||
var pluginDir;
|
var pluginDir;
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
pluginDir = "~/vimperator/" + directory;
|
pluginDir = "~/" + vimperator.config.name.toLowerCase() + "/" + directory;
|
||||||
else
|
else
|
||||||
pluginDir = "~/.vimperator/" + directory;
|
pluginDir = "~/." + vimperator.config.name.toLowerCase() + "/" + directory;
|
||||||
|
|
||||||
pluginDir = this.getFile(this.expandPath(pluginDir));
|
pluginDir = this.getFile(this.expandPath(pluginDir));
|
||||||
|
|
||||||
@@ -166,8 +166,8 @@ vimperator.IO = function () //{{{
|
|||||||
|
|
||||||
getRCFile: function ()
|
getRCFile: function ()
|
||||||
{
|
{
|
||||||
var rcFile1 = this.getFile("~/.vimperatorrc");
|
var rcFile1 = this.getFile("~/." + vimperator.config.name.toLowerCase() + "rc");
|
||||||
var rcFile2 = this.getFile("~/_vimperatorrc");
|
var rcFile2 = this.getFile("~/_" + vimperator.config.name.toLowerCase() + "rc");
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
[rcFile1, rcFile2] = [rcFile2, rcFile1]
|
[rcFile1, rcFile2] = [rcFile2, rcFile1]
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ vimperator.Mappings = function () //{{{
|
|||||||
{
|
{
|
||||||
// setting this option triggers an observer
|
// setting this option triggers an observer
|
||||||
// which takes care of the mode setting
|
// which takes care of the mode setting
|
||||||
vimperator.options.setFirefoxPref("accessibility.browsewithcaret", true);
|
vimperator.options.setPref("accessibility.browsewithcaret", true);
|
||||||
},
|
},
|
||||||
{ shortHelp: "Start caret mode" }
|
{ shortHelp: "Start caret mode" }
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -135,9 +135,9 @@ vimperator.modes = (function () //{{{
|
|||||||
if (newMode == vimperator.modes.NORMAL)
|
if (newMode == vimperator.modes.NORMAL)
|
||||||
{
|
{
|
||||||
// disable caret mode when we want to switch to normal mode
|
// disable caret mode when we want to switch to normal mode
|
||||||
var value = vimperator.options.getFirefoxPref("accessibility.browsewithcaret", false);
|
var value = vimperator.options.getPref("accessibility.browsewithcaret", false);
|
||||||
if (value)
|
if (value)
|
||||||
vimperator.options.setFirefoxPref("accessibility.browsewithcaret", false);
|
vimperator.options.setPref("accessibility.browsewithcaret", false);
|
||||||
|
|
||||||
vimperator.statusline.updateUrl();
|
vimperator.statusline.updateUrl();
|
||||||
vimperator.focusContent(false);
|
vimperator.focusContent(false);
|
||||||
|
|||||||
@@ -116,10 +116,10 @@ vimperator.Options = function () //{{{
|
|||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var firefoxBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
var defaultBranch = firefoxBranch.getDefaultBranch("");
|
var preferences = prefService.getDefaultBranch("");
|
||||||
var vimperatorBranch = firefoxBranch.getBranch("extensions.vimperator.");
|
|
||||||
var options = [];
|
var options = [];
|
||||||
|
|
||||||
// save if we already changed a GUI related option, used for setInitialGUI
|
// save if we already changed a GUI related option, used for setInitialGUI
|
||||||
@@ -133,33 +133,29 @@ vimperator.Options = function () //{{{
|
|||||||
throw StopIteration;
|
throw StopIteration;
|
||||||
}
|
}
|
||||||
|
|
||||||
function storePreference(name, value, branch)
|
function storePreference(name, value)
|
||||||
{
|
{
|
||||||
if (!branch)
|
var type = prefService.getPrefType(name);
|
||||||
branch = firefoxBranch;
|
|
||||||
|
|
||||||
var type = branch.getPrefType(name);
|
|
||||||
|
|
||||||
switch (typeof value)
|
switch (typeof value)
|
||||||
{
|
{
|
||||||
case "string":
|
case "string":
|
||||||
if (type == branch.PREF_INVALID || type == branch.PREF_STRING)
|
if (type == prefService.PREF_INVALID || type == prefService.PREF_STRING)
|
||||||
branch.setCharPref(name, value);
|
prefService.setCharPref(name, value);
|
||||||
else if (type == branch.PREF_INT)
|
else if (type == prefService.PREF_INT)
|
||||||
vimperator.echoerr("E521: Number required after =: " + name + "=" + value);
|
vimperator.echoerr("E521: Number required after =: " + name + "=" + value);
|
||||||
else
|
else
|
||||||
vimperator.echoerr("E474: Invalid argument: " + name + "=" + value);
|
vimperator.echoerr("E474: Invalid argument: " + name + "=" + value);
|
||||||
break;
|
break;
|
||||||
case "number":
|
case "number":
|
||||||
if (type == branch.PREF_INVALID || type == branch.PREF_INT)
|
if (type == prefService.PREF_INVALID || type == prefService.PREF_INT)
|
||||||
branch.setIntPref(name, value);
|
prefService.setIntPref(name, value);
|
||||||
else
|
else
|
||||||
vimperator.echoerr("E474: Invalid argument: " + name + "=" + value);
|
vimperator.echoerr("E474: Invalid argument: " + name + "=" + value);
|
||||||
break;
|
break;
|
||||||
case "boolean":
|
case "boolean":
|
||||||
if (type == branch.PREF_INVALID || type == branch.PREF_BOOL)
|
if (type == prefService.PREF_INVALID || type == prefService.PREF_BOOL)
|
||||||
branch.setBoolPref(name, value);
|
prefService.setBoolPref(name, value);
|
||||||
else if (type == branch.PREF_INT)
|
else if (type == prefService.PREF_INT)
|
||||||
vimperator.echoerr("E521: Number required after =: " + name + "=" + value);
|
vimperator.echoerr("E521: Number required after =: " + name + "=" + value);
|
||||||
else
|
else
|
||||||
vimperator.echoerr("E474: Invalid argument: " + name + "=" + value);
|
vimperator.echoerr("E474: Invalid argument: " + name + "=" + value);
|
||||||
@@ -169,32 +165,28 @@ vimperator.Options = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPreference(name, forcedDefault, branch)
|
function loadPreference(name, forcedDefault)
|
||||||
{
|
{
|
||||||
var defaultValue = null;
|
var defaultValue = null;
|
||||||
if (forcedDefault != null) // this argument sets defaults for non-user settable options (like comp_history)
|
if (forcedDefault != null) // this argument sets defaults for non-user settable options (like extensions.history.comp_history)
|
||||||
defaultValue = forcedDefault;
|
defaultValue = forcedDefault;
|
||||||
|
|
||||||
if (!branch)
|
var type = prefService.getPrefType(name);
|
||||||
branch = firefoxBranch;
|
|
||||||
|
|
||||||
var type = branch.getPrefType(name);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case branch.PREF_STRING:
|
case prefService.PREF_STRING:
|
||||||
var value = branch.getComplexValue(name, Components.interfaces.nsISupportsString).data;
|
var value = prefService.getComplexValue(name, Components.interfaces.nsISupportsString).data;
|
||||||
// Try in case it's a localized string (will throw an exception if not)
|
// Try in case it's a localized string (will throw an exception if not)
|
||||||
if (!branch.prefIsLocked(name) && !branch.prefHasUserValue(name) &&
|
if (!prefService.prefIsLocked(name) && !prefService.prefHasUserValue(name) &&
|
||||||
/^chrome:\/\/.+\/locale\/.+\.properties/.test(value))
|
/^chrome:\/\/.+\/locale\/.+\.properties/.test(value))
|
||||||
value = branch.getComplexValue(name, Components.interfaces.nsIPrefLocalizedString).data;
|
value = prefService.getComplexValue(name, Components.interfaces.nsIPrefLocalizedString).data;
|
||||||
return value;
|
return value;
|
||||||
case branch.PREF_INT:
|
case prefService.PREF_INT:
|
||||||
return branch.getIntPref(name);
|
return prefService.getIntPref(name);
|
||||||
case branch.PREF_BOOL:
|
case prefService.PREF_BOOL:
|
||||||
return branch.getBoolPref(name);
|
return prefService.getBoolPref(name);
|
||||||
default:
|
default:
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@@ -336,7 +328,7 @@ vimperator.Options = function () //{{{
|
|||||||
storePreference("dom.popup_allowed_events", popupAllowedEvents);
|
storePreference("dom.popup_allowed_events", popupAllowedEvents);
|
||||||
},
|
},
|
||||||
|
|
||||||
list: function (onlyNondefault)
|
list: function (onlyNonDefault)
|
||||||
{
|
{
|
||||||
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
|
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
|
||||||
"<table><tr align=\"left\" class=\"hl-Title\"><th>--- Options ---</th></tr>";
|
"<table><tr align=\"left\" class=\"hl-Title\"><th>--- Options ---</th></tr>";
|
||||||
@@ -348,7 +340,7 @@ vimperator.Options = function () //{{{
|
|||||||
value = options[i].value;
|
value = options[i].value;
|
||||||
def = options[i].defaultValue;
|
def = options[i].defaultValue;
|
||||||
|
|
||||||
if (onlyNondefault && value == def)
|
if (onlyNonDefault && value == def)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (options[i].type == "boolean")
|
if (options[i].type == "boolean")
|
||||||
@@ -377,28 +369,30 @@ vimperator.Options = function () //{{{
|
|||||||
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
||||||
},
|
},
|
||||||
|
|
||||||
listFirefoxPrefs: function (onlyNondefault, filter)
|
listPrefs: function (onlyNonDefault, filter)
|
||||||
{
|
{
|
||||||
if (!filter)
|
if (!filter)
|
||||||
filter = "";
|
filter = "";
|
||||||
var prefArray = firefoxBranch.getChildList("", {value: 0});
|
|
||||||
|
var prefArray = prefService.getChildList("", {value: 0});
|
||||||
prefArray.sort();
|
prefArray.sort();
|
||||||
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
|
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
|
||||||
"<table><tr align=\"left\" class=\"hl-Title\"><th>--- Firefox Options ---</th></tr>";
|
"<table><tr align=\"left\" class=\"hl-Title\"><th>--- " + vimperator.config.hostApplication +
|
||||||
|
" Options ---</th></tr>";
|
||||||
var name, value;
|
var name, value;
|
||||||
|
|
||||||
for (var i = 0; i < prefArray.length; i++)
|
for (var i = 0; i < prefArray.length; i++)
|
||||||
{
|
{
|
||||||
var userValue = firefoxBranch.prefHasUserValue(prefArray[i]);
|
var userValue = prefService.prefHasUserValue(prefArray[i]);
|
||||||
if ((!onlyNondefault || userValue) && prefArray[i].indexOf(filter) >= 0)
|
if ((!onlyNonDefault || userValue) && prefArray[i].indexOf(filter) >= 0)
|
||||||
{
|
{
|
||||||
name = prefArray[i];
|
name = prefArray[i];
|
||||||
value = this.getFirefoxPref(name);
|
value = this.getPref(name);
|
||||||
if (typeof value == "string")
|
if (typeof value == "string")
|
||||||
value = value.substr(0,100).replace(/\n/g, " ");
|
value = value.substr(0,100).replace(/\n/g, " ");
|
||||||
|
|
||||||
value = vimperator.util.colorize(value, false);
|
value = vimperator.util.colorize(value, false);
|
||||||
defaultValue = loadPreference(name, null, defaultBranch);
|
defaultValue = loadPreference(name, null);
|
||||||
|
|
||||||
if (defaultValue == null)
|
if (defaultValue == null)
|
||||||
defaultValue = "no default";
|
defaultValue = "no default";
|
||||||
@@ -431,38 +425,27 @@ vimperator.Options = function () //{{{
|
|||||||
this.get("showtabline").reset();
|
this.get("showtabline").reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: separate Preferences from Options? Would these utility functions
|
|
||||||
// be better placed in the 'core' vimperator namespace somewhere?
|
// be better placed in the 'core' vimperator namespace somewhere?
|
||||||
setPref: function (name, value)
|
setPref: function (name, value)
|
||||||
{
|
|
||||||
return storePreference(name, value, vimperatorBranch);
|
|
||||||
},
|
|
||||||
|
|
||||||
getPref: function (name, forcedDefault)
|
|
||||||
{
|
|
||||||
return loadPreference(name, forcedDefault, vimperatorBranch);
|
|
||||||
},
|
|
||||||
|
|
||||||
setFirefoxPref: function (name, value)
|
|
||||||
{
|
{
|
||||||
return storePreference(name, value);
|
return storePreference(name, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFirefoxPref: function (name, forcedDefault)
|
getPref: function (name, forcedDefault)
|
||||||
{
|
{
|
||||||
return loadPreference(name, forcedDefault);
|
return loadPreference(name, forcedDefault);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetFirefoxPref: function (name)
|
resetPref: function (name)
|
||||||
{
|
{
|
||||||
return firefoxBranch.clearUserPref(name);
|
return preferences.clearUserPref(name);
|
||||||
},
|
},
|
||||||
|
|
||||||
// this works only for booleans
|
// this works only for booleans
|
||||||
invertFirefoxPref: function (name)
|
invertPref: function (name)
|
||||||
{
|
{
|
||||||
if (firefoxBranch.getPrefType(name) == firefoxBranch.PREF_BOOL)
|
if (prefService.getPrefType(name) == prefService.PREF_BOOL)
|
||||||
this.setFirefoxPref(name, !this.getFirefoxPref(name));
|
this.setPref(name, !this.getPref(name));
|
||||||
else
|
else
|
||||||
vimperator.echoerr("E488: Trailing characters: " + name + "!");
|
vimperator.echoerr("E488: Trailing characters: " + name + "!");
|
||||||
}
|
}
|
||||||
@@ -712,7 +695,7 @@ vimperator.Options = function () //{{{
|
|||||||
optionManager.add(new vimperator.Option(["visualbell", "vb"], "boolean",
|
optionManager.add(new vimperator.Option(["visualbell", "vb"], "boolean",
|
||||||
{
|
{
|
||||||
shortHelp: "Use visual bell instead of beeping on errors",
|
shortHelp: "Use visual bell instead of beeping on errors",
|
||||||
setter: function (value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); },
|
setter: function (value) { vimperator.options.setPref("accessibility.typeaheadfind.enablesound", !value); },
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
@@ -737,9 +720,6 @@ vimperator.Options = function () //{{{
|
|||||||
|
|
||||||
// we start with an "empty" GUI so that no toolbars or tabbar is shown if the user
|
// we start with an "empty" GUI so that no toolbars or tabbar is shown if the user
|
||||||
// sets them to empty in the .vimperatorrc, which is sourced asynchronously
|
// sets them to empty in the .vimperatorrc, which is sourced asynchronously
|
||||||
if (vimperator.config.name != "Vimperator")
|
|
||||||
alert("mooh");
|
|
||||||
else alert("maeh");
|
|
||||||
if (vimperator.config.name != "Vimperator")
|
if (vimperator.config.name != "Vimperator")
|
||||||
return optionManager;
|
return optionManager;
|
||||||
|
|
||||||
|
|||||||
@@ -59,14 +59,15 @@ vimperator.CommandLine = function () //{{{
|
|||||||
|
|
||||||
load: function ()
|
load: function ()
|
||||||
{
|
{
|
||||||
this.cmd = vimperator.options.getPref("commandline_cmd_history", "").split("\n");
|
// TODO: move to storage module
|
||||||
this.search = vimperator.options.getPref("commandline_search_history", "").split("\n");
|
this.cmd = vimperator.options.getPref("extensions.vimperator.commandline_cmd_history", "").split("\n");
|
||||||
|
this.search = vimperator.options.getPref("extensions.vimperator.commandline_search_history", "").split("\n");
|
||||||
},
|
},
|
||||||
|
|
||||||
save: function ()
|
save: function ()
|
||||||
{
|
{
|
||||||
vimperator.options.setPref("commandline_cmd_history", this.cmd.join("\n"));
|
vimperator.options.setPref("extensions.vimperator.commandline_cmd_history", this.cmd.join("\n"));
|
||||||
vimperator.options.setPref("commandline_search_history", this.search.join("\n"));
|
vimperator.options.setPref("extensions.vimperator.commandline_search_history", this.search.join("\n"));
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function (str)
|
add: function (str)
|
||||||
|
|||||||
Reference in New Issue
Block a user