Bug 1481777 - Remove "Thunderbird now contains calendaring functionality..." message at startup. r=MakeMyDay
authorGeoff Lankow <geoff@darktrojan.net>
Sun, 12 Aug 2018 22:05:25 +1200
changeset 33194 8c63ea2dd66704719df0fbae5b895cb5669f9543
parent 33193 2bfc93d3de04b819cd58cb5b9c5166e27584f15c
child 33195 eaea6529063503444eae601f57800eec06f0ffee
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersMakeMyDay
bugs1481777
Bug 1481777 - Remove "Thunderbird now contains calendaring functionality..." message at startup. r=MakeMyDay
calendar/lightning/content/lightning.js
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/locales/en-US/chrome/lightning/lightning.properties
--- a/calendar/lightning/content/lightning.js
+++ b/calendar/lightning/content/lightning.js
@@ -160,11 +160,8 @@ pref("calendar.item.useNewItemUI", false
 pref("calendar.paste.intoSelectedCalendar", false);
 
 // Backend to use. false: libical, true: ical.js
 #ifdef NIGHTLY_BUILD
 pref("calendar.icaljs", true);
 #else
 pref("calendar.icaljs", false);
 #endif
-
-// Calendar integration notification
-pref("calendar.integration.notify", true);
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -404,150 +404,19 @@ function ltnOnLoad(event) {
     toolbox.customizeDone = function(aEvent) {
         MailToolboxCustomizeDone(aEvent, "CustomizeCalendarToolbar");
     };
     toolbox = document.getElementById("task-toolbox");
     toolbox.customizeDone = function(aEvent) {
         MailToolboxCustomizeDone(aEvent, "CustomizeTaskToolbar");
     };
 
-    ltnIntegrationCheck();
-
     Services.obs.notifyObservers(window, "lightning-startup-done");
 }
 
-/**
- * Displays the Lightning integration notification bar
- */
-function ltnIntegrationNotification() {
-    const kOptOut = "mail.calendar-integration.opt-out"; // default: false
-    const kNotify = "calendar.integration.notify"; // default: true
-    const kSupportUri = "https://support.mozilla.org/kb/thunderbird-calendar-integration";
-    const kLightningGuuid = "{e2fda1a4-762b-4020-b5ad-a41df1933103}";
-
-    // we fall back to messagepanebox for Seamonkey
-    let notifyBox = document.getElementById("mail-notification-box") ||
-                    document.getElementById("messagepanebox");
-
-    let appBrand = cal.l10n.getAnyString("branding", "brand", "brandShortName");
-    let ltnBrand = cal.l10n.getLtnString("brandShortName");
-    let label = cal.l10n.getLtnString("integrationLabel", [appBrand, ltnBrand]);
-
-    // call backs for doing/undoing Lightning removal
-    let cbRemoveLightning = function(aAddon) {
-        aAddon.userDisabled = true;
-    };
-    let cbUndoRemoveLightning = function(aAddon) {
-        aAddon.userDisabled = false;
-    };
-
-    // call backs for the undo opt-out bar
-    let cbRestartNow = function(aNotificationBar, aButton) {
-        Services.startup.quit(Components.interfaces.nsIAppStartup.eRestart |
-                              Components.interfaces.nsIAppStartup.eForceQuit);
-    };
-    let cbUndoOptOut = function(aNotificationBar, aButton) {
-        Preferences.set(kNotify, true);
-        Preferences.set(kOptOut, false);
-        AddonManager.getAddonByID(kLightningGuuid, cbUndoRemoveLightning);
-        // display notification bar again
-        ltnIntegrationNotification();
-    };
-
-    // call backs for the opt-out bar
-    let cbLearnMore = function(aNotificationBar, aButton) {
-        // In SeaMonkey the second parameter should be either null or an
-        // event object with a non null target.ownerDocument.
-        openUILink(kSupportUri, {
-            button: 0,
-            target: { ownerDocument: document }
-        });
-        return true;
-    };
-    let cbKeepIt = function(aNotificationBar, aButton) {
-        Preferences.set(kNotify, false);
-    };
-    let cbOptOut = function(aNotificationBar, aButton) {
-        Preferences.set(kNotify, false);
-        Preferences.set(kOptOut, true);
-        AddonManager.getAddonByID(kLightningGuuid, cbRemoveLightning);
-        // let the user know that removal will be applied after restart
-        let restartLabel = cal.l10n.getLtnString("integrationRestartLabel", [ltnBrand, appBrand]);
-        let button = [{
-            label:     cal.l10n.getLtnString("integrationUndoButton"),
-            accessKey: cal.l10n.getLtnString("integrationUndoAccessKey"),
-            popup:     null,
-            callback:  cbUndoOptOut
-        }, {
-            label:     cal.l10n.getLtnString("integrationRestartButton"),
-            accessKey: cal.l10n.getLtnString("integrationRestartAccessKey"),
-            popup:     null,
-            callback:  cbRestartNow
-        }];
-        notifyBox.appendNotification(restartLabel,
-                                     "restart-required",
-                                     null,
-                                     notifyBox.PRIORITY_INFO_MEDIUM,
-                                     button);
-    };
-
-    let buttons = [{
-        label:     cal.l10n.getLtnString("integrationLearnMoreButton"),
-        accessKey: cal.l10n.getLtnString("integrationLearnMoreAccessKey"),
-        popup:     null,
-        callback:  cbLearnMore
-    }, {
-        label:     cal.l10n.getLtnString("integrationOptOutButton"),
-        accessKey: cal.l10n.getLtnString("integrationOptOutAccessKey"),
-        popup:     null,
-        callback:  cbOptOut
-    }, {
-        label:     cal.l10n.getLtnString("integrationKeepItButton"),
-        accessKey: cal.l10n.getLtnString("integrationKeepItAccessKey"),
-        popup:     null,
-        callback:  cbKeepIt
-    }];
-
-    // we use PRIORITY_INFO_MEDIUM to overrule notifications from specialTabs.js if any
-    let notification = notifyBox.appendNotification(label,
-                                                    "calendar-integration",
-                                                    null,
-                                                    notifyBox.PRIORITY_INFO_MEDIUM,
-                                                    buttons);
-    notification.persistence = 3;
-}
-
-/**
- * Checks whether to display the opt-out notification for Lightning integration
- */
-function ltnIntegrationCheck() {
-    const kOptOut = "mail.calendar-integration.opt-out"; // default: false
-    const kNotify = "calendar.integration.notify"; // default: true
-    // don't do anything if the opt-out pref doesn't exist or is enabled by the user or the user has
-    // already decided to keep Lightning
-    if (!Preferences.get(kOptOut, true) && Preferences.get(kNotify, false)) {
-        // action is only needed, if hasn't used Lightning before, so lets check whether this looks
-        // like a default calendar setup
-        let cnt = {};
-        let calMgr = cal.getCalendarManager();
-        let cals = calMgr.getCalendars(cnt);
-        let homeCalName = cal.l10n.getCalString("homeCalendarName");
-        if (cnt.value == 1 &&
-            calMgr.getCalendarPref_(cals[0], "type") == "storage" &&
-            calMgr.getCalendarPref_(cals[0], "name") == homeCalName) {
-            // this looks like a default setup, so let's see whether the calendar contains any items
-            let pCal = cal.async.promisifyCalendar(cals[0]);
-            // we look at all items at any time, but we can stop if the first item was found
-            // if we've found no items, we call ltnIntegrationNotification to display the bar
-            pCal.getItems(Components.interfaces.calICalendar.ITEM_FILTER_ALL_ITEMS, 1, null, null)
-                .then((aItems) => { if (!aItems.length) { ltnIntegrationNotification(); } });
-        }
-    }
-}
-
 /* Called at midnight to tell us to redraw date-specific widgets.  Do NOT call
  * this for normal refresh, since it also calls scheduleMidnightRefresh.
  */
 function refreshUIBits() {
     try {
         getMinimonth().refreshDisplay();
 
         // Refresh the current view and just allow the refresh for the others
--- a/calendar/locales/en-US/chrome/lightning/lightning.properties
+++ b/calendar/locales/en-US/chrome/lightning/lightning.properties
@@ -190,32 +190,10 @@ binaryComponentKnown=The binary componen
 # %3$S - The current Lightning version
 binaryComponentUnknown=The binary component required for %1$S could not be loaded, likely because the wrong version combination is being used. You are using %2$S %3$S together with %1$S %4$S. Please check https://developer.mozilla.org/en/Calendar/Calendar_Versions for details.
 
 # LOCALIZATION_NOTE(binaryComponentTitle): The title for the dialog that
 # notifies about a version mismatch.
 # %1$S - The Lightning brand name, from the brandShortName string above.
 binaryComponentTitle=Mismatching %1$S Version
 
-# LOCALIZATION_NOTE(integrationLabel): Used by the notification bar shown when
-# Lightning is installed from the distribution folder. To trigger it, start a
-# new profile without Lightning in a previous Thunderbird version, then upgrade
-# to a Thunderbird that has Lightning packaged. See bug 1130852 for details.
-integrationLabel=%1$S now contains calendaring functionality by integrating the %2$S extension.
-integrationLearnMoreButton=Learn more
-integrationLearnMoreAccessKey=m
-integrationOptOutButton=Disable
-integrationOptOutAccessKey=D
-integrationKeepItButton=Keep
-integrationKeepItAccessKey=K
-
-# LOCALIZATION_NOTE(integrationRestartLabel): At the current time its not yet
-# clear if we will be completely uninstalling Lightning or disabling it. Please
-# translate this string in a general manner, so that it makes sense for both
-# options.
-integrationRestartLabel=%1$S will be removed the next time you restart %2$S. You can add it again at any time using the Add-ons Manager.
-integrationRestartButton=Restart now
-integrationRestartAccessKey=R
-integrationUndoButton=Undo
-integrationUndoAccessKey=U
-
 # LOCALIZATION NOTE(noIdentitySelectedNotification):
 noIdentitySelectedNotification=If you want to use this calendar to store invitations to or from other people you should assign an email identity below.