1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 09:57:59 +01:00

Move 'encoding' option to vimperator, since PlacesUtils is supported on firefox anyway

This commit is contained in:
Martin Stubenschrott
2009-06-01 13:36:54 +02:00
parent 0c5fde8ebf
commit 7e9fcf8d05
2 changed files with 21 additions and 41 deletions

View File

@@ -149,47 +149,6 @@ function Buffer() //{{{
////////////////////// OPTIONS ///////////////////////////////////////////////// ////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
function getWebNav()
{
function call(val, fn)
{
try
{
return fn(val);
}
catch (e)
{
return val
}
}
return [
function () getBrowser().webNavigation,
function (webNav) webNav.sessionHistory.QueryInterface(Ci.nsIWebNavigation)
].reduce(call, null);
}
options.add(["encoding", "enc"],
"Sets the current buffer's character encoding",
"string", "UTF-8",
{
scope: options.OPTION_SCOPE_LOCAL,
getter: function () getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset,
setter: function (val)
{
// Stolen from browser.jar/content/browser/browser.js, more or
// less.
try
{
var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val
PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val);
getWebNav().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
catch (e) { liberator.reportError(e); }
},
completer: function (context) completion.charset(context),
validator: Option.validateCompleter
});
// FIXME: Most certainly belongs elsewhere. // FIXME: Most certainly belongs elsewhere.
options.add(["fullscreen", "fs"], options.add(["fullscreen", "fs"],
"Show the current window fullscreen", "Show the current window fullscreen",

View File

@@ -448,6 +448,27 @@ const config = { //{{{
////////////////////// OPTIONS ///////////////////////////////////////////////// ////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
options.add(["encoding", "enc"],
"Sets the current buffer's character encoding",
"string", "UTF-8",
{
scope: options.OPTION_SCOPE_LOCAL,
getter: function () getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset,
setter: function (val)
{
// Stolen from browser.jar/content/browser/browser.js, more or less.
try
{
var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val
PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val);
getWebNavigation().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
catch (e) { liberator.reportError(e); }
},
completer: function (context) completion.charset(context),
validator: Option.validateCompleter
});
options.add(["online"], options.add(["online"],
"Set the 'work offline' option", "Set the 'work offline' option",
"boolean", true, "boolean", true,