Closed Bug 906323 Opened 11 years ago Closed 11 years ago

It should be possible to update a menuitem's label

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 27

People

(Reporter: evold, Assigned: capella)

References

Details

(Whiteboard: [mentor=margaret][lang=java])

Attachments

(1 file, 2 obsolete files)

From what I can tell: http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/BrowserApp.java#1536 https://developer.mozilla.org/en-US/docs/Extensions/Mobile/API/NativeWindow/menu/update It is not possible to update a menuitem's label text. This should be possible. If you want a use case take Greasefire, which shows how many userscripts are available for the page that is being viewed. So the label is "XYZ Scripts available". Is there any platform issue with doing this? or was it just omitted for no reason?
Yeah, this sounds like it was probably just an oversight. Sriram, is that right? It seems like fixing this would be as straightforward as adding a case to update info.label in updateAddonMenuItem. We could probably also allow updating the icon as well.
Flags: needinfo?(sriram)
Whiteboard: [mentor=margaret][lang=java]
I remember that the decision was to change only the checked, checkable, enabled and visibility values. We could change title too -- not sure if we really want it. It's easy to do that though.
Flags: needinfo?(sriram)
(In reply to Sriram Ramasubramanian [:sriram] from comment #2) > I remember that the decision was to change only the checked, checkable, > enabled and visibility values. We could change title too -- not sure if we > really want it. It's easy to do that though. The reason that I'm asking for it is so that we can include the feature in our SDK menuitem implementation, if Fennec doesn't support it then we'll have to leave it out. I can't imagine why any platform would not be able to support it tho, so I think we should include the feature. The use case that I gave seems like one that would apply to Desktop as well as Mobile.
I can take this bug if everyone else is busy, I'd like to do more platform bugs anyhow.
(In reply to Erik Vold [:erikvold] [:ztatic] from comment #4) > I can take this bug if everyone else is busy, I'd like to do more platform > bugs anyhow. Go for it! Sriram and I can both help you out, and either one of us can review your patch.
Attached patch bug906323 (obsolete) — Splinter Review
Misc quickie...
Assignee: nobody → markcapella
Status: NEW → ASSIGNED
Attachment #817893 - Flags: review?(margaret.leibovic)
Comment on attachment 817893 [details] [diff] [review] bug906323 Drive-by: there is no need for try..catch. Please use optString() with a default value of "". All good :d
Attached patch bug906323 (obsolete) — Splinter Review
Ah, close! This will do what I had in mind ...
Attachment #817893 - Attachment is obsolete: true
Attachment #817893 - Flags: review?(margaret.leibovic)
Attachment #817919 - Flags: review?(margaret.leibovic)
Using the test case ... I want the last item to stay "Last Try..." gMenu01 = aWindow.NativeWindow.menu.add({ parent: gMenu00, name: "Kill Me", checkable: false, icon: gAddonData.resourceURI.spec + "lightblue2.png", callback: function() { if (gTitle == 0) { gTitle++; aWindow.NativeWindow.menu.update(gMenu01, { name: "Try Again!", checkable: true , checked: true } ); } else { if (gTitle == 1) { gTitle++; aWindow.NativeWindow.menu.update(gMenu01, { name: "", checkable: false , checked: true } ); } else { if (gTitle == 2) { gTitle++; aWindow.NativeWindow.menu.update(gMenu01, { name: "Last Try...", checkable: true, checked: false } ); } else { aWindow.NativeWindow.menu.update(gMenu01, { checked: true } ); // <========== Don't blank me } } } } });
Comment on attachment 817919 [details] [diff] [review] bug906323 Passing this review off to Sriram, since he wrote this code. However, it looks like we also need to add a similar line for cached menu items: http://hg.mozilla.org/mozilla-central/annotate/c14ca6b27b30/mobile/android/base/BrowserApp.java#l1779
Attachment #817919 - Flags: review?(margaret.leibovic) → review?(sriram)
Attachment #817919 - Flags: review?(sriram) → review+
Attached patch bug906323 v2Splinter Review
Hey sriram ... margaret caught me again ... we need this too right?
Attachment #817919 - Attachment is obsolete: true
Attachment #818070 - Flags: review?(sriram)
Attachment #818070 - Flags: review?(sriram) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: