зеркало из https://github.com/mozilla/gecko-dev.git
Bug 334486: Ability to restore shipped search engines after they've been removed, patch by Michael Wu <michael.wu@mozilla.com>, r=mconnor
This commit is contained in:
Родитель
6dbaaf05f4
Коммит
930cb04984
|
@ -82,6 +82,13 @@ function disableAddons() {
|
|||
prefB.clearUserPref("general.skins.selectedSkin");
|
||||
}
|
||||
|
||||
function restoreDefaultSearchEngines() {
|
||||
var searchService = Components.classes["@mozilla.org/browser/search-service;1"]
|
||||
.getService(Components.interfaces.nsIBrowserSearchService);
|
||||
|
||||
searchService.restoreDefaultEngines();
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
try {
|
||||
if (document.getElementById("resetUserPrefs").checked)
|
||||
|
@ -92,6 +99,8 @@ function onOK() {
|
|||
deleteLocalstore();
|
||||
if (document.getElementById("disableAddons").checked)
|
||||
disableAddons();
|
||||
if (document.getElementById("restoreSearch").checked)
|
||||
restoreDefaultSearchEngines();
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
|
@ -114,5 +123,6 @@ function UpdateOKButtonState() {
|
|||
!document.getElementById("resetUserPrefs").checked &&
|
||||
!document.getElementById("resetBookmarks").checked &&
|
||||
!document.getElementById("resetToolbars").checked &&
|
||||
!document.getElementById("disableAddons").checked;
|
||||
!document.getElementById("disableAddons").checked &&
|
||||
!document.getElementById("restoreSearch").checked;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
<checkbox id="resetToolbars" label="&resetToolbars.label;" accesskey="&resetToolbars.accesskey;"/>
|
||||
<checkbox id="resetBookmarks" label="&resetBookmarks.label;" accesskey="&resetBookmarks.accesskey;"/>
|
||||
<checkbox id="resetUserPrefs" label="&resetUserPrefs.label;" accesskey="&resetUserPrefs.accesskey;"/>
|
||||
<checkbox id="restoreSearch" label="&restoreSearch.label;" accesskey="&restoreSearch.accesskey;"/>
|
||||
</vbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
|
|
@ -162,7 +162,7 @@ interface nsISearchEngine : nsISupports
|
|||
|
||||
};
|
||||
|
||||
[scriptable, uuid(89a503ac-ea67-4bad-89f9-aa2b06140702)]
|
||||
[scriptable, uuid(019c7025-0e26-48d0-b2a4-97cc7e0296cf)]
|
||||
interface nsIBrowserSearchService : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -223,6 +223,12 @@ interface nsIBrowserSearchService : nsISupports
|
|||
in AString method,
|
||||
in AString url);
|
||||
|
||||
/**
|
||||
* Un-hides all engines installed in the directory corresponding to
|
||||
* the directory service's NS_APP_SEARCH_DIR key.
|
||||
*/
|
||||
void restoreDefaultEngines();
|
||||
|
||||
/**
|
||||
* Returns an engine with the specified alias.
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# Contributor(s):
|
||||
# Ben Goodger <beng@google.com> (Original author)
|
||||
# Gavin Sharp <gavin@gavinsharp.com>
|
||||
# Joe Hughes <joe@retrovirus.com
|
||||
# Joe Hughes <joe@retrovirus.com>
|
||||
# Pamela Greene <pamg.bugs@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
|
@ -2429,6 +2429,14 @@ SearchService.prototype = {
|
|||
notifyAction(engine, SEARCH_ENGINE_CHANGED);
|
||||
},
|
||||
|
||||
restoreDefaultEngines: function SRCH_SVC_resetDefaultEngines() {
|
||||
for each (var e in this._engines) {
|
||||
// Unhide all appdir-installed engines
|
||||
if (e.hidden && e._isInAppDir)
|
||||
e.hidden = false;
|
||||
}
|
||||
},
|
||||
|
||||
get defaultEngine() {
|
||||
const defPref = BROWSER_SEARCH_PREF + "defaultenginename";
|
||||
// Get the default engine - this pref should always exist, but the engine
|
||||
|
|
|
@ -54,5 +54,8 @@
|
|||
<!ENTITY resetUserPrefs.label "Reset all user preferences to &brandShortName; defaults">
|
||||
<!ENTITY resetUserPrefs.accesskey "p">
|
||||
|
||||
<!ENTITY restoreSearch.label "Restore default search engines">
|
||||
<!ENTITY restoreSearch.accesskey "s">
|
||||
|
||||
<!ENTITY changeAndRestartButton.label "Make Changes and Restart">
|
||||
<!ENTITY continueButton.label "Continue in Safe Mode">
|
||||
|
|
Загрузка…
Ссылка в новой задаче