# HG changeset patch # Parent eca0ae9a63220940f6ef4b987b922f8fd4b8de25 # User timeless@mozdev.org Test using nsIAlertService diff --git a/mail/components/activity/modules/alertHook.js b/mail/components/activity/modules/alertHook.js --- a/mail/components/activity/modules/alertHook.js +++ b/mail/components/activity/modules/alertHook.js @@ -41,47 +41,26 @@ const EXPORTED_SYMBOLS = ['alertHook']; const Cc = Components.classes; const Ci = Components.interfaces; -const nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1", - "nsIActivityWarning", "init"); - Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); // This module provides a link between the send later service and the activity // manager. let alertHook = { - get activityMgr() { - delete this.activityMgr; - return this.activityMgr = Cc["@mozilla.org/activity-manager;1"] - .getService(Ci.nsIActivityManager); - }, - QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgUserFeedbackListener]), onAlert: function (aMessage, aUrl) { - // Create a new warning. - let warning = new nsActWarning(aMessage, this.activityMgr, ""); + this.showAlertNotification("chrome://branding/content/icon48.png", + "", aMessage); - if (aUrl && aUrl.server && aUrl.server.prettyName) { - warning.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT; - warning.contextType = "incomingServer"; - warning.contextDisplayText = aUrl.server.prettyName; - warning.contextObj = aUrl.server; - } - else - warning.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE; - - this.activityMgr.addActivity(warning); - - // XXX Once activity manager is prompting the user (bug 476696), this needs - // to be flipped to true to stop the modal alerts appearing from within - // mailnews. - return false; + return true; }, init: function() { // We shouldn't need to remove the listener as we're not being held by // anyone except by the send later instance. + this.alertService = Cc["@mozilla.org/system-alerts-service;1"] + .getService(Ci.nsIAlertsService); let msgMailSession = Cc["@mozilla.org/messenger/services/session;1"] .getService(Ci.nsIMsgMailSession);