diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderbird.js index cd91287f01..bc3771a263 100644 --- a/mail/app/profile/all-thunderbird.js +++ b/mail/app/profile/all-thunderbird.js @@ -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 diff --git a/mail/base/content/msgMail3PaneWindow.js b/mail/base/content/msgMail3PaneWindow.js index 7041ccbed9..af12e41e66 100644 --- a/mail/base/content/msgMail3PaneWindow.js +++ b/mail/base/content/msgMail3PaneWindow.js @@ -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,23 @@ 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 + // We'll get a null SearchIntegration if we don't have one + Components.utils.import("resource://app/modules/SearchIntegration.js"); + + // 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)) || + (SearchIntegration && !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 +762,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(); diff --git a/mail/base/content/defaultClientDialog.js b/mail/base/content/systemIntegrationDialog.js similarity index 74% rename from mail/base/content/defaultClientDialog.js rename to mail/base/content/systemIntegrationDialog.js index dc097bea57..6ee0b241fa 100644 --- a/mail/base/content/defaultClientDialog.js +++ b/mail/base/content/systemIntegrationDialog.js @@ -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,41 @@ 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; + Components.utils.import("resource://app/modules/SearchIntegration.js"); + if (SearchIntegration) + { + if (SearchIntegration.osVersionTooLow) + hideSearchUI = true; + else if (SearchIntegration.osComponentsNotRunning) + disableSearchUI = true; + } + else + { + 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 +117,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; + } } }; diff --git a/mail/base/content/defaultClientDialog.xul b/mail/base/content/systemIntegrationDialog.xul similarity index 71% rename from mail/base/content/defaultClientDialog.xul rename to mail/base/content/systemIntegrationDialog.xul index f56f126e04..1d602f7ac4 100644 --- a/mail/base/content/defaultClientDialog.xul +++ b/mail/base/content/systemIntegrationDialog.xul @@ -42,19 +42,31 @@ %brandDTD; - - %defaultClientDTD; + + %systemIntegrationDTD; +#ifdef XP_WIN + + %searchIntegrationWinDTD; +#else +#ifdef XP_MACOSX + + %searchIntegrationMacDTD; +#else + + %searchIntegrationDefaultDTD; +#endif +#endif ]> + onload="gSystemIntegrationDialog.onLoad();" + ondialogaccept="return gSystemIntegrationDialog.onAccept();" + title="&systemIntegration.title;"> -