Open Bug 557467 Opened 10 years ago Updated 6 years ago

Activity Manager examples describe non-existent nsIActivityManager.registerContextDisplayHelper method

Categories

(Thunderbird :: Help Documentation, defect)

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: iagosrl, Unassigned)

References

()

Details

(Keywords: dev-doc-needed)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Build Identifier: 

I'm trying to create an Activity Process with a custom context like in: https://developer.mozilla.org/en/Extensions/Thunderbird/HowTos/Activity_Manager#Adding_an_activity_with_a_custom_context_type but when execute the next code:

let gActivityManager = Components.classes["@mozilla.org/activity-manager;1"].getService(Components.interfaces.nsIActivityManager);
gActivityManager.registerContextDisplayHelper("Autoarchive", autoarchiveContextDisplayHelper());

TB raise the Exception:
 Error: gActivityManager.registerContextDisplayHelper is not a function.

My code is like you can see in the tutorial, but the Activity Manager Interface (nsIActivityManager http://mxr.mozilla.org/comm-central/source/mail/components/activity/nsIActivityManager.idl#95) don't have a 'registerContextDisplayHelper' method.

Is the documentation wrong or my code? How I must do to create a custom context?

Thanks!

Reproducible: Always
Status: UNCONFIRMED → NEW
Component: Help Documentation → Documentation Requests
Ever confirmed: true
Product: Thunderbird → Mozilla Developer Center
QA Contact: help-documentation → doc-request
Summary: Tutorial in MDC about the Activity Manager have invalid code: method nsIActivityManager.registerContextDisplayHelper don't exists → Tutorial in MDC about the Activity Manager have invalid code: method nsIActivityManager.registerContextDisplayHelper doesn't exist
Summary: Tutorial in MDC about the Activity Manager have invalid code: method nsIActivityManager.registerContextDisplayHelper doesn't exist → Activity Manager examples describe non-existent nsIActivityManager.registerContextDisplayHelper method
Assignee: nobody → jenzed
Assignee: jenzed → nobody
Component: Documentation Requests → Help Documentation
Product: Mozilla Developer Network → Thunderbird
QA Contact: doc-request → help-documentation
Ok, so my guess is the example in devmo is based on an early version of the code.

The send later/send in background activity manager code is probably a better example:

http://mxr.mozilla.org/comm-central/source/mail/components/activity/modules/sendLater.js

You can see the effects by creating an email, selecting Send Later, and then viewing the activity manager whilst selecting Send Unsent Messages on the outbox.

So for grouping, set up your nsActProcess as you want, then set the following parameters on it:

  // This tells activity manager that we're grouping
  process.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT;

  // This is an nsIVariant which is used to group the activities by - all
  // activities with the same value here will be grouped together.
  process.contextObj = this;

  // iirc, this is just a string type - you can search for this, but its really
  // contextObj that determines the grouping
  process.contextType = "SendLater";

  // This is some text to display for the title of the group
  process.contextDisplayText = this.bundle.GetStringFromName("sendingMessages");


For standalone items, just set groupingStyle to Ci.nsIActivity.GROUPING_STYLE_STANDALONE and leave the rest alone.
Hi Mark.

Sorry the delay, I couldn't check it before.
Works fine the code you put at Comment#1, thanks.

But the page at MDN is still wrong, can somebody be assigned to rewrite the article?

Thanks again.
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.