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

Use the charset service for charset completions.

This commit is contained in:
Kris Maglione
2010-10-03 11:48:56 -04:00
parent bf715affd4
commit cbed89d8ba
2 changed files with 4 additions and 6 deletions

View File

@@ -657,15 +657,12 @@ lookup:
completion: function () {
completion.charset = function (context) {
context.anchored = false;
let bundle = services.get("stringBundle").createBundle(
"chrome://global/locale/charsetTitles.properties");
let service = services.get("charset");
context.keys = {
text: util.identity,
description: function (charset) bundle.GetStringFromName(charset.toLowerCase() + ".title")
description: function (charset) service.getCharsetTitle(charset)
};
context.generate = function () array("more1 more2 more3 more4 more5 unicode".split(" "))
.map(function (key) options.getPref("intl.charsetmenu.browser." + key).split(', '))
.flatten().uniq().array;
context.generate = function () iter(service.getDecoderList());
};
completion.directory = function directory(context, full) {

View File

@@ -22,6 +22,7 @@ const Services = Module("Services", {
this.add("bookmarks", "@mozilla.org/browser/nav-bookmarks-service;1", Ci.nsINavBookmarksService);
this.add("browserSearch", "@mozilla.org/browser/search-service;1", Ci.nsIBrowserSearchService);
this.add("cache", "@mozilla.org/network/cache-service;1", Ci.nsICacheService);
this.add("charset", "@mozilla.org/charset-converter-manager;1", Ci.nsICharsetConverterManager);
this.add("console", "@mozilla.org/consoleservice;1", Ci.nsIConsoleService);
this.add("dactyl:", "@mozilla.org/network/protocol;1?name=dactyl");
this.add("debugger", "@mozilla.org/js/jsd/debugger-service;1", Ci.jsdIDebuggerService);