From d3d4960839565861cdb3647949227b28fd72e466 Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Fri, 15 May 2009 16:10:34 +0530 Subject: [PATCH] Bug 467116 -- Merge default client dialog and search integration dialog into an "OS Integration" dialog. r=bienvenu+humph, ui-r=clarkbw, r=Standard8 for additional changes --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 --- mail/app/profile/all-thunderbird.js | 6 + mail/base/content/msgMail3PaneWindow.js | 28 ++-- ...ntDialog.js => systemIntegrationDialog.js} | 49 ++++++- ...Dialog.xul => systemIntegrationDialog.xul} | 31 ++++- mail/base/jar.mn | 4 +- mail/components/Makefile.in | 14 +- mail/components/preferences/advanced.js | 32 ++++- mail/components/preferences/advanced.xul | 35 ++++- mail/components/search/Makefile.in | 20 ++- mail/components/search/SearchIntegration.js | 49 +++++++ .../components/search/SpotlightIntegration.js | 22 +++- .../components/search/WinSearchIntegration.js | 124 +++++++----------- .../components/search/content/searchCommon.js | 81 +++++++++++- .../content/searchIntegrationDialog.xul | 67 ---------- .../search/content/searchOverlay.js | 8 +- mail/components/search/jar.mn | 1 - mail/components/search/wsenable/WSEnable.cpp | 1 - .../chrome/messenger/preferences/advanced.dtd | 4 +- .../search/searchIntegrationDialogWin.dtd | 6 - .../messenger/searchIntegrationDefault.dtd | 3 + .../chrome/messenger/searchIntegrationMac.dtd | 1 + .../chrome/messenger/searchIntegrationWin.dtd | 1 + ...Dialog.dtd => systemIntegrationDialog.dtd} | 5 +- mail/locales/jar.mn | 6 +- .../performance/common/mailnewsTestPrefs.js | 3 + 25 files changed, 388 insertions(+), 213 deletions(-) rename mail/base/content/{defaultClientDialog.js => systemIntegrationDialog.js} (74%) rename mail/base/content/{defaultClientDialog.xul => systemIntegrationDialog.xul} (71%) create mode 100644 mail/components/search/SearchIntegration.js delete mode 100644 mail/components/search/content/searchIntegrationDialog.xul delete mode 100644 mail/locales/en-US/chrome/messenger/search/searchIntegrationDialogWin.dtd create mode 100644 mail/locales/en-US/chrome/messenger/searchIntegrationDefault.dtd create mode 100644 mail/locales/en-US/chrome/messenger/searchIntegrationMac.dtd create mode 100644 mail/locales/en-US/chrome/messenger/searchIntegrationWin.dtd rename mail/locales/en-US/chrome/messenger/{defaultClientDialog.dtd => systemIntegrationDialog.dtd} (62%) 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;"> -