Bug 467116 - "Merge default client dialog and search integration dialog into an "OS Integration" dialog" [r=bienvenu r=david.humphrey ui-r=clarkbw]
--HG-- rename : mail/base/content/defaultClientDialog.js => mail/base/content/systemIntegrationDialog.js rename : mail/base/content/defaultClientDialog.xul => mail/base/content/systemIntegrationDialog.xul rename : mail/locales/en-US/chrome/messenger/defaultClientDialog.dtd => mail/locales/en-US/chrome/messenger/systemIntegrationDialog.dtd
This commit is contained in:
Родитель
c37f532421
Коммит
41d7652f56
|
@ -430,8 +430,14 @@ pref("mail.tabs.closeButtons", 1);
|
|||
pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
|
||||
|
||||
// OS Integrated Search and Indexing
|
||||
#ifdef XP_WIN
|
||||
pref("mail.winsearch.enable", false);
|
||||
pref("mail.winsearch.firstRunDone", false);
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
pref("mail.spotlight.enable", false);
|
||||
pref("mail.spotlight.firstRunDone", false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// -- Windows Search/Spotlight logging options
|
||||
|
|
|
@ -725,8 +725,10 @@ function LoadPostAccountWizard()
|
|||
gSearchEmailAddress = (window.arguments.length > 2) ? window.arguments[2] : null;
|
||||
}
|
||||
|
||||
function showDefaultClientDialog() {
|
||||
function completeStartup() {
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
// Check whether we need to show the default client dialog
|
||||
// First, check the shell service
|
||||
var nsIShellService = Components.interfaces.nsIShellService;
|
||||
var shellService;
|
||||
var defaultAccount;
|
||||
|
@ -735,15 +737,28 @@ function LoadPostAccountWizard()
|
|||
defaultAccount = accountManager.defaultAccount;
|
||||
} catch (ex) {}
|
||||
|
||||
// Show the default client dialog only if we have at least one account,
|
||||
// we should check for the default client, and we aren't already the default
|
||||
// for mail.
|
||||
// Next, try loading the search integration module
|
||||
let hasSearchIntegration = true;
|
||||
try {
|
||||
Components.utils.import("resource://app/modules/SearchIntegration.js");
|
||||
}
|
||||
catch (e) {
|
||||
hasSearchIntegration = false;
|
||||
}
|
||||
|
||||
// Show the default client dialog only if
|
||||
// EITHER: we have at least one account, and we aren't already the default
|
||||
// for mail,
|
||||
// OR: we have the search integration module, the OS version is suitable,
|
||||
// and the first run hasn't already been completed.
|
||||
// Needs to be shown outside the he normal load sequence so it doesn't appear
|
||||
// before any other displays, in the wrong place of the screen.
|
||||
if (shellService && defaultAccount && shellService.shouldCheckDefaultClient
|
||||
&& !shellService.isDefaultClient(true, nsIShellService.MAIL))
|
||||
window.openDialog("chrome://messenger/content/defaultClientDialog.xul",
|
||||
"DefaultClient", "modal,centerscreen,chrome,resizable=no");
|
||||
if ((shellService && defaultAccount && shellService.shouldCheckDefaultClient
|
||||
&& !shellService.isDefaultClient(true, nsIShellService.MAIL)) ||
|
||||
(hasSearchIntegration && !SearchIntegration.osVersionTooLow &&
|
||||
!SearchIntegration.osComponentsNotRunning && !SearchIntegration.firstRunDone))
|
||||
window.openDialog("chrome://messenger/content/systemIntegrationDialog.xul",
|
||||
"SystemIntegration", "modal,centerscreen,chrome,resizable=no");
|
||||
#endif
|
||||
|
||||
// All core modal dialogs are done, the user can now interact with the 3-pane window
|
||||
|
@ -752,7 +767,7 @@ function LoadPostAccountWizard()
|
|||
obs.notifyObservers(window, "mail-startup-done", null);
|
||||
}
|
||||
|
||||
setTimeout(showDefaultClientDialog, 0);
|
||||
setTimeout(completeStartup, 0);
|
||||
|
||||
// FIX ME - later we will be able to use onload from the overlay
|
||||
OnLoadMsgHeaderPane();
|
||||
|
|
|
@ -37,7 +37,10 @@
|
|||
|
||||
// this dialog can only be opened if we have a shell service
|
||||
|
||||
var gDefaultClientDialog = {
|
||||
var gSystemIntegrationDialog = {
|
||||
/// Whether the search integration checkbox is disabled or hidden
|
||||
_searchCheckboxInactive: false,
|
||||
|
||||
onLoad: function ()
|
||||
{
|
||||
var nsIShellService = Components.interfaces.nsIShellService;
|
||||
|
@ -59,7 +62,39 @@ var gDefaultClientDialog = {
|
|||
// read the raw pref value and not shellSvc.shouldCheckDefaultMail
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
document.getElementById('checkOnStartup').checked = prefs.getBoolPref("mail.shell.checkDefaultClient");
|
||||
document.getElementById('checkOnStartup').checked = prefs.getBoolPref("mail.shell.checkDefaultClient");
|
||||
|
||||
// Search integration -- check whether we should hide or disable integration
|
||||
let hideSearchUI = false;
|
||||
let disableSearchUI = false;
|
||||
try {
|
||||
Components.utils.import("resource://app/modules/SearchIntegration.js");
|
||||
if (SearchIntegration.osVersionTooLow)
|
||||
hideSearchUI = true;
|
||||
else if (SearchIntegration.osComponentsNotRunning)
|
||||
disableSearchUI = true;
|
||||
}
|
||||
catch (e) {
|
||||
hideSearchUI = true;
|
||||
}
|
||||
|
||||
let searchCheckbox = document.getElementById("searchIntegration");
|
||||
|
||||
if (hideSearchUI)
|
||||
{
|
||||
this._searchCheckboxInactive = true;
|
||||
document.getElementById("searchIntegrationContainer").hidden = true;
|
||||
}
|
||||
else if (disableSearchUI)
|
||||
{
|
||||
this._searchCheckboxInactive = true;
|
||||
searchCheckbox.checked = false;
|
||||
searchCheckbox.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
searchCheckbox.checked = SearchIntegration.prefEnabled;
|
||||
}
|
||||
},
|
||||
|
||||
onAccept: function()
|
||||
|
@ -80,5 +115,13 @@ var gDefaultClientDialog = {
|
|||
shellSvc.setDefaultClient(false, appTypes);
|
||||
|
||||
shellSvc.shouldCheckDefaultClient = document.getElementById('checkOnStartup').checked;
|
||||
|
||||
// Set the search integration pref if it's changed
|
||||
// The integration will handle the rest
|
||||
if (!this._searchCheckboxInactive)
|
||||
{
|
||||
SearchIntegration.prefEnabled = document.getElementById("searchIntegration").checked;
|
||||
SearchIntegration.firstRunDone = true;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -42,19 +42,31 @@
|
|||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % defaultClientDTD SYSTEM "chrome://messenger/locale/defaultClientDialog.dtd" >
|
||||
%defaultClientDTD;
|
||||
<!ENTITY % systemIntegrationDTD SYSTEM "chrome://messenger/locale/systemIntegrationDialog.dtd" >
|
||||
%systemIntegrationDTD;
|
||||
#ifdef XP_WIN
|
||||
<!ENTITY % searchIntegrationWinDTD SYSTEM "chrome://messenger/locale/searchIntegrationWin.dtd" >
|
||||
%searchIntegrationWinDTD;
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
<!ENTITY % searchIntegrationMacDTD SYSTEM "chrome://messenger/locale/searchIntegrationMac.dtd" >
|
||||
%searchIntegrationMacDTD;
|
||||
#else
|
||||
<!ENTITY % searchIntegrationDefaultDTD SYSTEM "chrome://messenger/locale/searchIntegrationDefault.dtd" >
|
||||
%searchIntegrationDefaultDTD;
|
||||
#endif
|
||||
#endif
|
||||
]>
|
||||
|
||||
<dialog xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="defaultClientDialog"
|
||||
id="systemIntegrationDialog"
|
||||
buttons="accept,cancel"
|
||||
onload="gDefaultClientDialog.onLoad();"
|
||||
ondialogaccept="return gDefaultClientDialog.onAccept();"
|
||||
title="&defaultClient.title;">
|
||||
onload="gSystemIntegrationDialog.onLoad();"
|
||||
ondialogaccept="return gSystemIntegrationDialog.onAccept();"
|
||||
title="&systemIntegration.title;">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/defaultClientDialog.js"/>
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/systemIntegrationDialog.js"/>
|
||||
|
||||
<label control="defaultClientList">&defaultClient.intro;</label>
|
||||
<listbox rows="3" seltype="single" id="defaultClientList">
|
||||
|
@ -63,6 +75,11 @@
|
|||
<listitem id="checkRSS" type="checkbox" label="&feeds.label;"/>
|
||||
</listbox>
|
||||
|
||||
<!-- Wrap this in a vbox to hide if there's no search integration available -->
|
||||
<vbox id="searchIntegrationContainer">
|
||||
<checkbox id="searchIntegration" label="&searchIntegration.label;" accesskey="&searchIntegration.accesskey;"/>
|
||||
</vbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
<checkbox id="checkOnStartup" label="&checkOnStartup.label;" accesskey="&checkOnStartup.accesskey;"/>
|
||||
|
|
@ -48,8 +48,8 @@ messenger.jar:
|
|||
* content/messenger/aboutDialog.xul (content/aboutDialog.xul)
|
||||
* content/messenger/aboutDialog.js (content/aboutDialog.js)
|
||||
* content/messenger/aboutRights.xhtml (content/aboutRights.xhtml)
|
||||
* content/messenger/defaultClientDialog.xul (content/defaultClientDialog.xul)
|
||||
* content/messenger/defaultClientDialog.js (content/defaultClientDialog.js)
|
||||
* content/messenger/systemIntegrationDialog.xul (content/systemIntegrationDialog.xul)
|
||||
* content/messenger/systemIntegrationDialog.js (content/systemIntegrationDialog.js)
|
||||
content/messenger/folderPane.js (content/folderPane.js)
|
||||
* content/messenger/msgSelectOffline.xul (content/msgSelectOffline.xul)
|
||||
* content/messenger/msgPrintEngine.xul (content/msgPrintEngine.xul)
|
||||
|
|
|
@ -58,6 +58,32 @@ var gAdvancedPane = {
|
|||
this.updateAutoItems();
|
||||
this.updateModeItems();
|
||||
#endif
|
||||
|
||||
// Search integration -- check whether we should hide or disable integration
|
||||
let hideSearchUI = false;
|
||||
let disableSearchUI = false;
|
||||
try {
|
||||
Components.utils.import("resource://app/modules/SearchIntegration.js");
|
||||
if (SearchIntegration.osVersionTooLow)
|
||||
hideSearchUI = true;
|
||||
else if (SearchIntegration.osComponentsNotRunning)
|
||||
disableSearchUI = true;
|
||||
}
|
||||
catch (e) {
|
||||
hideSearchUI = true;
|
||||
}
|
||||
|
||||
if (hideSearchUI)
|
||||
{
|
||||
document.getElementById("searchIntegrationContainer").hidden = true;
|
||||
}
|
||||
else if (disableSearchUI)
|
||||
{
|
||||
let searchCheckbox = document.getElementById("searchIntegration");
|
||||
searchCheckbox.checked = false;
|
||||
document.getElementById("search-enable").disabled = true;
|
||||
}
|
||||
|
||||
this.mInitialized = true;
|
||||
},
|
||||
|
||||
|
@ -106,8 +132,8 @@ var gAdvancedPane = {
|
|||
else
|
||||
{
|
||||
// otherwise, bring up the default client dialog
|
||||
window.openDialog("chrome://messenger/content/defaultClientDialog.xul",
|
||||
"Default Client",
|
||||
window.openDialog("chrome://messenger/content/systemIntegrationDialog.xul",
|
||||
"SystemIntegration",
|
||||
"modal,centerscreen,chrome,resizable=no");
|
||||
}
|
||||
},
|
||||
|
|
|
@ -42,6 +42,18 @@
|
|||
<!ENTITY % advancedDTD SYSTEM "chrome://messenger/locale/preferences/advanced.dtd">
|
||||
%brandDTD;
|
||||
%advancedDTD;
|
||||
#ifdef XP_WIN
|
||||
<!ENTITY % searchIntegrationWinDTD SYSTEM "chrome://messenger/locale/searchIntegrationWin.dtd" >
|
||||
%searchIntegrationWinDTD;
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
<!ENTITY % searchIntegrationMacDTD SYSTEM "chrome://messenger/locale/searchIntegrationMac.dtd" >
|
||||
%searchIntegrationMacDTD;
|
||||
#else
|
||||
<!ENTITY % searchIntegrationDefaultDTD SYSTEM "chrome://messenger/locale/searchIntegrationDefault.dtd" >
|
||||
%searchIntegrationDefaultDTD;
|
||||
#endif
|
||||
#endif
|
||||
]>
|
||||
|
||||
<overlay id="AdvancedPaneOverlay"
|
||||
|
@ -65,6 +77,19 @@
|
|||
name="pref.general.disable_button.default_mail"
|
||||
type="bool"/>
|
||||
#endif
|
||||
<!-- Keep one id, so that we don't have to do platform specific stuff later -->
|
||||
#ifdef XP_WIN
|
||||
<preference id="search-enable"
|
||||
name="mail.winsearch.enable"
|
||||
type="bool"/>
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
<preference id="search-enable"
|
||||
name="mail.spotlight.enable"
|
||||
type="bool"/>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
<!-- Display & Reading tab -->
|
||||
<preference id="mail.showCondensedAddresses" name="mail.showCondensedAddresses" type="bool"/>
|
||||
<preference id="mailnews.mark_message_read.auto"
|
||||
|
@ -133,8 +158,8 @@
|
|||
</hbox>
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
<groupbox id="systemDefaultsGroup" orient="horizontal">
|
||||
<caption label="&systemDefaults.label;"/>
|
||||
<groupbox id="systemDefaultsGroup" orient="vertical">
|
||||
<caption label="&systemIntegration.label;"/>
|
||||
<hbox id="checkDefaultBox" align="center" flex="1">
|
||||
<checkbox id="alwaysCheckDefault"
|
||||
preference="mail.shell.checkDefaultClient"
|
||||
|
@ -145,6 +170,12 @@
|
|||
oncommand="gAdvancedPane.checkDefaultNow();"
|
||||
preference="pref.general.disable_button.default_mail"/>
|
||||
</hbox>
|
||||
<hbox id="searchIntegrationContainer">
|
||||
<checkbox id="searchIntegration"
|
||||
preference="search-enable"
|
||||
label="&searchIntegration.label;"
|
||||
accesskey="&searchIntegration.accesskey;"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
#endif
|
||||
<groupbox>
|
||||
|
|
|
@ -55,6 +55,7 @@ endif
|
|||
ifneq (,$(filter cocoa mac, $(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_PP_JS_MODULES = \
|
||||
SpotlightIntegration.js \
|
||||
SearchIntegration.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -85,6 +86,7 @@ DIRS += public
|
|||
# Windows Search component
|
||||
EXTRA_PP_JS_MODULES = \
|
||||
WinSearchIntegration.js \
|
||||
SearchIntegration.js \
|
||||
$(NULL)
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Desktop search integration.
|
||||
*
|
||||
* The Initial Developer of the Original Code is mozilla.org code.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Siddharth Agarwal <sid.bugzilla@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SearchIntegration"];
|
||||
|
||||
#ifdef XP_WIN
|
||||
Components.utils.import("resource://app/modules/WinSearchIntegration.js");
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
Components.utils.import("resource://app/modules/SpotlightIntegration.js");
|
||||
#endif
|
||||
#endif
|
|
@ -79,6 +79,20 @@ let SearchIntegration =
|
|||
return searchPath;
|
||||
},
|
||||
|
||||
/**
|
||||
* These two functions won't do anything, as Spotlight integration is handled
|
||||
* using Info.plist files
|
||||
*/
|
||||
register: function spotlight_register()
|
||||
{
|
||||
return true;
|
||||
},
|
||||
|
||||
deregister: function spotlight_deregister()
|
||||
{
|
||||
return true;
|
||||
},
|
||||
|
||||
_init: function spotlight_init()
|
||||
{
|
||||
this._initLogging();
|
||||
|
@ -210,10 +224,4 @@ let SearchIntegration =
|
|||
}
|
||||
};
|
||||
|
||||
/* Initialize the search integration object */
|
||||
try {
|
||||
SearchIntegration._init();
|
||||
}
|
||||
catch (ex) {
|
||||
SearchIntegration._log.error("Could not initialize spotlight component");
|
||||
}
|
||||
SearchIntegration._init();
|
||||
|
|
|
@ -117,17 +117,10 @@ let SearchIntegration =
|
|||
return this.__winSearchHelper;
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether the folders are already in the crawl scope
|
||||
* We'll be optimistic here and assume that once the folders are in the scope,
|
||||
* they won't be removed from it, at least while Thunderbird is open
|
||||
*/
|
||||
__foldersInCrawlScope: false,
|
||||
/// Whether the folders are already in the crawl scope
|
||||
get _foldersInCrawlScope()
|
||||
{
|
||||
if (!this.__foldersInCrawlScope)
|
||||
this.__foldersInCrawlScope = this._winSearchHelper.foldersInCrawlScope;
|
||||
return this.__foldersInCrawlScope;
|
||||
return this._winSearchHelper.foldersInCrawlScope;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -177,18 +170,10 @@ let SearchIntegration =
|
|||
if (parseFloat(windowsVersion) < 6)
|
||||
{
|
||||
this._log.fatal("Windows version " + windowsVersion + " < 6.0");
|
||||
this.osVersionTooLow = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// enabled === undefined means that the first run hasn't occurred yet (pref
|
||||
// isn't present).
|
||||
// false or true means that the first run has occurred, and the user has
|
||||
// made a decision.
|
||||
let enabled;
|
||||
try {
|
||||
enabled = this._prefBranch.getBoolPref("enable");
|
||||
} catch (ex) {}
|
||||
|
||||
let serviceRunning = false;
|
||||
try {
|
||||
serviceRunning = this._winSearchHelper.serviceRunning;
|
||||
|
@ -198,54 +183,65 @@ let SearchIntegration =
|
|||
if (!serviceRunning)
|
||||
{
|
||||
this._log.info("Windows Search service not running");
|
||||
this.osComponentsNotRunning = true;
|
||||
this._initSupport(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled === undefined)
|
||||
// First run has to be handled after the main mail window is open
|
||||
return true;
|
||||
|
||||
let enabled = this.prefEnabled;
|
||||
|
||||
if (enabled)
|
||||
this._log.info("Initializing Windows Search integration");
|
||||
this._initSupport(enabled);
|
||||
},
|
||||
|
||||
/// Handles first run, once the main mail window has popped up.
|
||||
_firstRun: function winsearch_first_run(window)
|
||||
/**
|
||||
* Add necessary hooks to Windows
|
||||
*
|
||||
* @return false if registration did not succeed, because the elevation
|
||||
* request was denied
|
||||
*/
|
||||
register: function winsearch_register()
|
||||
{
|
||||
window.openDialog(
|
||||
"chrome://messenger/content/search/searchIntegrationDialog.xul", "",
|
||||
"chrome, dialog, resizable=no, centerscreen", this);
|
||||
// If any of the two are not present, we need to elevate.
|
||||
if (!this._foldersInCrawlScope || !this._regKeysPresent)
|
||||
{
|
||||
try {
|
||||
this._winSearchHelper.runSetup(true);
|
||||
}
|
||||
catch (e) { return false; }
|
||||
}
|
||||
|
||||
if (!this._winSearchHelper.isFileAssociationSet)
|
||||
{
|
||||
try {
|
||||
this._winSearchHelper.setFileAssociation();
|
||||
}
|
||||
catch (e) { this._log.warn("File association not set"); }
|
||||
}
|
||||
// Also set the FANCI bit to 0 for the profile directory
|
||||
let profD = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
|
||||
this._winSearchHelper.setFANCIBit(profD, false, true);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback from the first run dialog
|
||||
* Remove integration from Windows. The only thing removed is the directory
|
||||
* from the index list. This will ask for elevation.
|
||||
*
|
||||
* @param enable whether the user has chosen to enable integration
|
||||
* @return false if deregistration did not succeed, because the elevation
|
||||
* request was denied
|
||||
*/
|
||||
callback: function winsearch_first_run_callback(enable)
|
||||
deregister: function winsearch_deregister()
|
||||
{
|
||||
// If any of the two are not present, we need to elevate.
|
||||
if (enable && (!this._foldersInCrawlScope || !this._regKeysPresent))
|
||||
{
|
||||
try { this._winSearchHelper.runSetup(true); }
|
||||
catch (e) { enable = false; }
|
||||
try {
|
||||
this._winSearchHelper.runSetup(false);
|
||||
}
|
||||
if (enable)
|
||||
{
|
||||
if (!this._winSearchHelper.isFileAssociationSet)
|
||||
{
|
||||
try { this._winSearchHelper.setFileAssociation(); }
|
||||
catch (e) { this._log.warn("File association not set"); }
|
||||
}
|
||||
// Also set the FANCI bit to 0 for the profile directory
|
||||
let profD = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
|
||||
this._winSearchHelper.setFANCIBit(profD, false, true);
|
||||
}
|
||||
this._prefBranch.setBoolPref("enable", enable);
|
||||
this._initSupport(enable);
|
||||
catch (e) { return false; }
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/// The stream listener to read messages
|
||||
|
@ -350,32 +346,4 @@ let SearchIntegration =
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Observer for first run dialog
|
||||
*/
|
||||
let FirstRunObserver =
|
||||
{
|
||||
observe: function(aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "mail-startup-done")
|
||||
{
|
||||
aSubject.QueryInterface(Ci.nsIDOMWindowInternal);
|
||||
Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
|
||||
.removeObserver(this, "mail-startup-done");
|
||||
try { SearchIntegration._firstRun(aSubject); }
|
||||
catch(ex) { SearchIntegration._log.warn("First run unsuccessful"); }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Initialize the search integration object */
|
||||
try {
|
||||
if (SearchIntegration._init())
|
||||
{
|
||||
Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
|
||||
.addObserver(FirstRunObserver, "mail-startup-done", false);
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
SearchIntegration._log.error("Could not initialize winsearch component");
|
||||
}
|
||||
SearchIntegration._init();
|
||||
|
|
|
@ -105,10 +105,52 @@ let SearchSupport =
|
|||
if (!this.__prefBranch)
|
||||
this.__prefBranch = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefService)
|
||||
.getBranch(this._prefBase);
|
||||
.getBranch(this._prefBase)
|
||||
.QueryInterface(Ci.nsIPrefBranch2);
|
||||
return this.__prefBranch;
|
||||
},
|
||||
|
||||
/**
|
||||
* If this is true, we won't show any UI because the OS doesn't have the
|
||||
* support we need
|
||||
*/
|
||||
osVersionTooLow: false,
|
||||
|
||||
/**
|
||||
* If this is true, we'll show disabled UI, because while the OS does have
|
||||
* the support we need, not all the OS components we need are running
|
||||
*/
|
||||
osComponentsNotRunning: false,
|
||||
|
||||
/**
|
||||
* Whether the preference is enabled. The module might be in a state where
|
||||
* the preference is on but "enabled" is false, so take care of that.
|
||||
*/
|
||||
get prefEnabled()
|
||||
{
|
||||
// Don't cache the value
|
||||
return this._prefBranch.getBoolPref("enable");
|
||||
},
|
||||
set prefEnabled(aEnabled)
|
||||
{
|
||||
if (this.prefEnabled != aEnabled)
|
||||
this._prefBranch.setBoolPref("enable", aEnabled);
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether the first run has occurred. This will be used to determine if
|
||||
* a dialog box needs to be displayed.
|
||||
*/
|
||||
get firstRunDone()
|
||||
{
|
||||
// Don't cache this value either
|
||||
return this._prefBranch.getBoolPref("firstRunDone");
|
||||
},
|
||||
set firstRunDone()
|
||||
{
|
||||
this._prefBranch.setBoolPref("firstRunDone", true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Last global reindex time, used to check if reindexing is required.
|
||||
* Kept in sync with the pref
|
||||
|
@ -255,6 +297,9 @@ let SearchSupport =
|
|||
this._log.info("Search integration running in " +
|
||||
(enabled ? "active" : "backoff") + " mode");
|
||||
this.enabled = enabled;
|
||||
|
||||
// Set up a pref observer
|
||||
this._prefBranch.addObserver("enable", this, false);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -484,6 +529,7 @@ let SearchSupport =
|
|||
* - idle observer; starts running through folders when it receives an "idle"
|
||||
* notification, and cancels any timers when it receives a "back" notification
|
||||
* - msg displayed observer, queues the message if necessary
|
||||
* - pref observer, to see if the preference has been poked
|
||||
*/
|
||||
observe: function search_observe(aSubject, aTopic, aData)
|
||||
{
|
||||
|
@ -519,6 +565,39 @@ let SearchSupport =
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (aTopic == "nsPref:changed" && aData == "enable")
|
||||
{
|
||||
let prefEnabled = this.prefEnabled;
|
||||
// Search integration turned on
|
||||
if (prefEnabled && this.register())
|
||||
{
|
||||
this.enabled = true;
|
||||
}
|
||||
// Search integration turned off
|
||||
else if (!prefEnabled && this.deregister())
|
||||
{
|
||||
this.enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The call to register or deregister has failed.
|
||||
// This is a hack to handle this case
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.initWithCallback(function() {
|
||||
SearchIntegration._handleRegisterFailure(!prefEnabled);
|
||||
}, 200, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/// Handle failure to register or deregister
|
||||
_handleRegisterFailure: function search_handle_register_failure(enabled)
|
||||
{
|
||||
// Remove ourselves from the observer list, flip the pref,
|
||||
// and add ourselves back
|
||||
this._prefBranch.removeObserver("enable", this);
|
||||
this.prefEnabled = enabled;
|
||||
this._prefBranch.addObserver("enable", this, false);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
# -*- Mode: xml; indent-tabs-mode: nil; -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Thunderbird Default Client Dialog
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Scott MacGregor.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Scott MacGregor <mscott@mozilla.org
|
||||
# Siddharth Agarwal <sid1337@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
#ifdef XP_WIN
|
||||
<!ENTITY % searchIntegrationDTD SYSTEM "chrome://messenger/locale/search/searchIntegrationDialogWin.dtd" >
|
||||
%searchIntegrationDTD;
|
||||
#endif
|
||||
]>
|
||||
|
||||
|
||||
<dialog xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="searchIntegrationDialog"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="window.arguments[0].callback(true); return true"
|
||||
ondialogcancel="window.arguments[0].callback(false); return true"
|
||||
title="&searchIntegration.title;"
|
||||
buttonlabelaccept="&searchIntegration.accept;"
|
||||
buttonlabelcancel="&searchIntegration.cancel;">
|
||||
|
||||
<description>
|
||||
&searchIntegration.description;
|
||||
</description>
|
||||
|
||||
</dialog>
|
|
@ -34,10 +34,4 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef XP_WIN
|
||||
Components.utils.import("resource://app/modules/WinSearchIntegration.js");
|
||||
#else
|
||||
#ifdef XP_MACOSX
|
||||
Components.utils.import("resource://app/modules/SpotlightIntegration.js");
|
||||
#endif
|
||||
#endif
|
||||
Components.utils.import("resource://app/modules/SearchIntegration.js");
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
messenger.jar:
|
||||
% overlay chrome://messenger/content/messenger.xul chrome://messenger/content/search/searchOverlay.xul
|
||||
* content/messenger/search/searchIntegrationDialog.xul (content/searchIntegrationDialog.xul)
|
||||
content/messenger/search/searchOverlay.xul (content/searchOverlay.xul)
|
||||
* content/messenger/search/searchOverlay.js (content/searchOverlay.js)
|
||||
|
|
|
@ -164,7 +164,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
// This is simple, we just exclude the profile dir and override children
|
||||
std::wstring path = L"file:///";
|
||||
path.append(argv[1]);
|
||||
path.append(L"\\*\\");
|
||||
hr = crawlScopeManager->AddUserScopeRule(path.c_str(), FALSE, TRUE, TRUE);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
|
||||
<!ENTITY enableGlodaSearch.label "Enable Global Search and Indexer">
|
||||
<!ENTITY enableGlodaSearch.accesskey "E">
|
||||
<!ENTITY systemDefaults.label "System Defaults">
|
||||
<!ENTITY systemIntegration.label "System Integration">
|
||||
<!ENTITY alwaysCheckDefault.label "Always check to see if &brandShortName; is the default mail client on startup">
|
||||
<!ENTITY alwaysCheckDefault.accesskey "A">
|
||||
<!ENTITY searchIntegration.label "Allow &searchIntegration.engineName; to search messages">
|
||||
<!ENTITY searchIntegration.accesskey "S">
|
||||
<!ENTITY checkNow.label "Check Now">
|
||||
<!ENTITY checkNow.accesskey "N">
|
||||
<!ENTITY configEditDesc.label "Advanced Configuration">
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<!ENTITY searchIntegration.engineName "Windows Search">
|
||||
<!ENTITY searchIntegration.title "&searchIntegration.engineName; Integration">
|
||||
<!ENTITY searchIntegration.description "Would you like to enable &searchIntegration.engineName; to index and search through &brandShortName; mail and news messages?">
|
||||
|
||||
<!ENTITY searchIntegration.accept "Enable &searchIntegration.engineName;">
|
||||
<!ENTITY searchIntegration.cancel "Don't Enable &searchIntegration.engineName;">
|
|
@ -0,0 +1,3 @@
|
|||
<!-- LOCALIZATION NOTE: This is the search engine name for platforms that don't
|
||||
support it, and should be left blank -->
|
||||
<!ENTITY searchIntegration.engineName "">
|
|
@ -0,0 +1 @@
|
|||
<!ENTITY searchIntegration.engineName "Spotlight">
|
|
@ -0,0 +1 @@
|
|||
<!ENTITY searchIntegration.engineName "Windows Search">
|
|
@ -1,4 +1,4 @@
|
|||
<!ENTITY defaultClient.title "Default Client">
|
||||
<!ENTITY systemIntegration.title "System Integration">
|
||||
<!ENTITY defaultClient.intro "Use &brandShortName; as the default client for:">
|
||||
|
||||
<!ENTITY email.label "E-Mail">
|
||||
|
@ -7,3 +7,6 @@
|
|||
|
||||
<!ENTITY checkOnStartup.label "Always perform this check when starting &brandShortName;">
|
||||
<!ENTITY checkOnStartup.accesskey "A">
|
||||
|
||||
<!ENTITY searchIntegration.label "Allow &searchIntegration.engineName; to search messages">
|
||||
<!ENTITY searchIntegration.accesskey "S">
|
|
@ -8,7 +8,7 @@
|
|||
locale/@AB_CD@/messenger/aboutDialog.dtd (%chrome/messenger/aboutDialog.dtd)
|
||||
locale/@AB_CD@/messenger/aboutRights.dtd (%chrome/messenger/aboutRights.dtd)
|
||||
locale/@AB_CD@/messenger/aboutRights.properties (%chrome/messenger/aboutRights.properties)
|
||||
locale/@AB_CD@/messenger/defaultClientDialog.dtd (%chrome/messenger/defaultClientDialog.dtd)
|
||||
locale/@AB_CD@/messenger/systemIntegrationDialog.dtd (%chrome/messenger/systemIntegrationDialog.dtd)
|
||||
locale/@AB_CD@/messenger/virtualFolderProperties.dtd (%chrome/messenger/virtualFolderProperties.dtd)
|
||||
locale/@AB_CD@/messenger/virtualFolderListDialog.dtd (%chrome/messenger/virtualFolderListDialog.dtd)
|
||||
locale/@AB_CD@/messenger/mailOverlay.dtd (%chrome/messenger/mailOverlay.dtd)
|
||||
|
@ -131,7 +131,9 @@
|
|||
locale/@AB_CD@/messenger/preferences/preferences.properties (%chrome/messenger/preferences/preferences.properties)
|
||||
locale/@AB_CD@/messenger/migration/migration.dtd (%chrome/messenger/migration/migration.dtd)
|
||||
locale/@AB_CD@/messenger/migration/migration.properties (%chrome/messenger/migration/migration.properties)
|
||||
locale/@AB_CD@/messenger/search/searchIntegrationDialogWin.dtd (%chrome/messenger/search/searchIntegrationDialogWin.dtd)
|
||||
locale/@AB_CD@/messenger/searchIntegrationWin.dtd (%chrome/messenger/searchIntegrationWin.dtd)
|
||||
locale/@AB_CD@/messenger/searchIntegrationMac.dtd (%chrome/messenger/searchIntegrationMac.dtd)
|
||||
locale/@AB_CD@/messenger/searchIntegrationDefault.dtd (%chrome/messenger/searchIntegrationDefault.dtd)
|
||||
locale/@AB_CD@/messenger/activity.dtd (%chrome/messenger/activity.dtd)
|
||||
locale/@AB_CD@/messenger/activity.properties (%chrome/messenger/activity.properties)
|
||||
locale/@AB_CD@/messenger/downloads/settingsChange.dtd (%chrome/overrides/settingsChange.dtd)
|
||||
|
|
Загрузка…
Ссылка в новой задаче