Commit a778372e authored by benjamin%smedbergs.us's avatar benjamin%smedbergs.us
Browse files

Bug 335605 - Hook up "download dictionaries" context menu, r=brettw

parent 60190fee
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@ pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/1/%APP_ID%/%APP_VERSION%/");
pref("extensions.blocklist.detailsURL", "http://www.mozilla.com/blocklist/");

// Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/%VERSION%/dictionaries/");

// App-specific update preferences

// Whether or not app updates are enabled
+24 −6
Original line number Diff line number Diff line
@@ -5255,12 +5255,30 @@ nsContextMenu.prototype = {

    addDictionaries : function()
    {
      var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
                            .getService(Components.interfaces.nsIPromptService);
      // FIXME bug 335605: hook this up so that it takes you to the download
      // web page
      var rv = ps.alert(window, "Add Dictionaries",
          "This command hasn't been hooked up yet. Instead, go to Thunderbird's download page:\n\nhttp://www.mozilla.org/products/thunderbird/dictionaries.html\n\nThese plugins will work in Firefox as well.");
      var uri = gPrefService.getCharPref("browser.dictionaries.download.url");

      var locale = "-";
      try {
        locale = gPrefService.getComplexValue("intl.accept_languages",
                                Components.interfaces.nsIPrefLocalizedString).data;
      }
      catch (e) { }

      var version = "-";
      try {
        version = Components.classes["@mozilla.org/xre/app-info;1"]
                            .getService(Components.interfaces.nsIXULAppInfo)
                            .version;
      }
      catch (e) { }

      uri = uri.replace(/%LOCALE%/, escape(locale));
      uri = uri.replace(/%VERSION%/, version);

      var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
      var where = newWindowPref == 3 ? "tab" : "window";

      openUILinkIn(uri, where);
    }
}