folderpane contextmenu: allow separately for accounts, folders, etc
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement)
Tracking
(thunderbird_esr78 wontfix, thunderbird87 affected, thunderbird88 affected)
People
(Reporter: buecher, Assigned: TbSync)
References
Details
Attachments
(1 file, 5 obsolete files)
18.11 KB,
patch
|
TbSync
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; rv:73.0) Gecko/20100101 Firefox/73.0
Steps to reproduce:
I have a use scenario where an action would be applied on accounts, but not folders.
So it would make sense to allow a deeper specification where a contextmenu goes. It is clear that certain actions on accounts won't be possible in folders, so these should not appear in the contextmenu of folders in the foldertree.
ah, it seems I was not clear in the other feature proposal. Maybe it is so related that all should go here. sorry for that.
So what would help:
a) contextmenu displayed for all folders in a list (but not accounts, messages, events, tasks etc.). Same for the other entities. Like: backup/archive/whatever this folder. At the moment, the contextmenu comes up for the full folderpane, for example.
b) contextmenu for one folder/message/event/task in a list only.
Like: copy this message to CRM. Could be tied to a certain sender, would only appear on selected message(s), not on all in a messagelist. Same for folders, events, .... Or: convert to task in business calendar (if from business partners defined somewhere), convert to event in private calendar (if from private senders defined somewhere/private addressbook). So different context menu entry for different messages in the same list.
Comment 3•5 years ago
|
||
So if I'm reading this right you want your menu item to only show for some items and not others? You can do this by adding an onShown
listener: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/onShown.
thanks for pointing me there.
Some consideration: might not work if what I need to decide to display is async and too slow (MDN).
If more people/addons need it, we will have millions of listeners. I don't know whether that is of concern. So the idea was: we have some basic entities (accounts, folders, messages, events, calendars, tasks, make it separate for them (if the basic Mozilla code would even allow that?).
Assignee | ||
Comment 5•4 years ago
|
||
The requested feature is indeed possible via the onShown
event. The documentation is currently missing the two fields selectedFolder
and selectedMessages
, which are included in the info
object of the onShown
event.
I observed two things, where feedback from Geoff would help:
-
If an account is clicked on, the path of the
selectedFolder
returns as "/", which can be used to distinguish between folder and account.
-> This could be optimized to not include a path at all, as we do not want developers to rely on the structure of the path? Or will the general filesystem-like structure remain and "/" is save to be assumed as the root and developers can explicitly check forpath == "/"
? -
If Thunderbird is set to view the folders unified, the onShown/onClicked info will return a fake account id. Simple reproduction steps: I have two accounts (checked via accounts.list()), my test account and the local account. Clicking on "Trash", which contains trash of my test account (id1) and the trash of the local account (id2), will include id3 as the account id of the selected folder.
-> Should we do something about this?
Assignee | ||
Comment 6•4 years ago
|
||
Assignee | ||
Comment 7•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 8•4 years ago
|
||
I change tactics here for the future. I find errors in our documentation quite often, but having them as individual bugs in review queue (and sometimes in parallel) makes working with the code difficult. I will just keep a general documentation changeset locally and report all found issues in a single bug maybe once per month.
Feedback from Geoff on Comment 5 is appreciated.
Assignee | ||
Updated•4 years ago
|
Comment 9•4 years ago
|
||
(In reply to John Bieling (:TbSync) from comment #5)
- If an account is clicked on, the path of the
selectedFolder
returns as "/", which can be used to distinguish between folder and account.
-> This could be optimized to not include a path at all, as we do not want developers to rely on the structure of the path? Or will the general filesystem-like structure remain and "/" is save to be assumed as the root and developers can explicitly check forpath == "/"
?
Yes, that does feel a bit odd. Since it's actually representing an account perhaps we shouldn't have a selectedFolder
at all, and instead have a selectedAccount
? I'd be okay with a null path too, given that you can't do anything with the folder, because it's not real.
- If Thunderbird is set to view the folders unified, the onShown/onClicked info will return a fake account id. Simple reproduction steps: I have two accounts (checked via accounts.list()), my test account and the local account. Clicking on "Trash", which contains trash of my test account (id1) and the trash of the local account (id2), will include id3 as the account id of the selected folder.
-> Should we do something about this?
Again these folders aren't real (but in a different way) so the other API functions won't do anything with them anyway. Maybe the best thing to do here is null the accountId
property and set "virtual" as the type.
Up to now the accountId
and path
properties have always been given even when it's useless information so not giving them in some circumstances could cause a few problems with extensions.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 10•4 years ago
|
||
This patch returns selectedAccount instead of selectedFolder, if the user opened the context menu on an account entry.
I also added the schema definitions for MailAccount and MailIdentity (since I needed MailAccount), which existed only in the overlay files. Also added a few other missing entries.
I did not do anything about the virtual folder thing, as the "fake" accountId of the unified folder returns a proper MailAccount of type "none" with name "Unified Folders". So this does look ok. (We could think about renaming "none" to "virtual", but that should go into a different bug).
Assignee | ||
Updated•4 years ago
|
Comment 11•4 years ago
|
||
Assignee | ||
Comment 12•4 years ago
•
|
||
Edit: Patch was missing some descriptions in the JSON schema file.
Assignee | ||
Comment 13•4 years ago
|
||
Asking again for review because I added a test.
Comment 14•4 years ago
|
||
Assignee | ||
Comment 15•4 years ago
|
||
Updated the test as suggested.
Assignee | ||
Updated•4 years ago
|
Comment 16•4 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/b48894c4c8c5
Change menus API behavior when clicking on an account in the folder tree. r=darktrojan
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 17•4 years ago
|
||
Comment on attachment 9206651 [details] [diff] [review]
bug1625746_add_selectedAccount_property_v3.patch
[Approval Request Comment]
Regression caused by (bug #):
User impact if declined:
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky):
I am evaluating.
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Description
•