Thread Closed

#1
I'm the developer of Identity Chooser (https://addons.mozilla.org/en-US/thunderbird/addon/56935/), an addin that keeps users from accidentally sending an email from the wrong account.

I've got a couple of request to integrate it with MinimizeToTray. I'm willing to do it, but I need a bit support.

In particular, could you assign ids to the menuitems in the popup "extensions.mook.minimizetotray.tray" (in mailOverlay.xul)? This way, I could easily replace the "Compose New Message" menuitem with a submenu containing all identities.

Please let me know what you think.
ReportQuote
#2
Hi,

I am sorry but I am not going to be able to do that, or at least make it quite that easy. The problem being that showing an XUL popup from a minimized window has become increasingly hard (I have to use tricks to make Firefox think it is not minimized). So the long and short of it is the next version will be using a menu created using the native GTK/Win32 APIs.

You can see what the new code (bad spelling and all) starts to look like at
http://svn.codefisher.org/svn/minimizetotray/trunk/chrome/content/mailOverlay.xul
http://svn.codefisher.org/svn/minimizetotray/trunk/chrome/content/turboBrowser.xul

I could maybe wrap some of the creatMenuItem calls in another function so they could be replaced by whatever you want it to do.

Have I helped you? Do you like my add-ons?
Would you consider donating to show your appreciation for my efforts?

/images/paypal.png
ReportQuote
#3
Hi,

I think I could work with some kind of hook which gave me the possibility to modify the array of menuitems before they're created. Maybe like this:

var trayMenuItems = {
// structure:
// { "menuitem|separator", "menu-label", "access-key",
// "function", "identifier" }
{ "item", "&cmd.restore.label;", "&cmd.restore.accesskey;",
this.restoreWindow,
"extensions.mook.minimizetotray.traypopup.restore" },

{ "separator", null, null, null,
"extensions.mook.minimizetotray.traypopup.separator" },

...

{ "item", "&newMsgCmd.label;", "&newMsgCmd.accesskey;",
function () { MsgNewMessage(null); },
extensions.mook.minimizetotray.traypopup.newmessage" },

...
}

this.beforeCreateMenuItems(trayMenuItems); // Here you could call all registered hooks/callbacks

this.createMenuItems(trayMenuItems);

I have no idea, though, when the tray menu is going to be created and if this could happen before other addons had the chance to register a callback. I could imagine weird timing issues.

A mechanism similar to onpopupshowing would be great as well.
ReportQuote
#4
An array is messy. The onpopupshowing like function is trayMenuCallback, which does little other then call trayMenuCreate. There is no actual stored array of menuitems, it gets created every time the menu opens. It allows me to check things, and conditionally create menu items.

An another way might be to pass tags/ids into the (miss-named) creatMenuItem function, and in that create a before handler. And if the before hander returns true the creatMenuItem function could stop. So for example, I pass the tag "new-mail" in, you check for that, create your own, and return true stopping the default one being created. That is the cleanest way of doing it I can think of.

Have I helped you? Do you like my add-ons?
Would you consider donating to show your appreciation for my efforts?

/images/paypal.png
ReportQuote
#5
If I understand it correctly, a lot of the infrastructure to dynamically modify the menu is already in place, which is great.

Basically, what I want/need is a way to prevent the default "new-email" from being created and, instead, create n menu items, one for each user identity.

Your idea of assigning tags like "new-email" to menuitems together with a before handler for menuitem creation sounds like it could provide just that.

How do we proceed from here?

BTW: Is there a way to be notified by email when a topic gets updated?
ReportQuote
#6
Hi,

You should get notifications if you register.

I guess I would have to start making the required changes now. I might try and get back to finishing of this version on the week end.

Have I helped you? Do you like my add-ons?
Would you consider donating to show your appreciation for my efforts?

/images/paypal.png
ReportQuote
#7
Great! Let me know when you have something testable/usable. I registered and subscribed to this thread.


Janek.
ReportQuote
#8
Hallo Michael and Janek,

I am just a user of both Add-ons and it would be very helpful if both add-ons could work together in the manner described by Janek. Unfortunately, in the everyday work I have sent a lot e-mails with wrong sender's addresses what is however very frustrating.

I keep the fingers crossed that you get this together solved!

Many thanks for your efforts.

Andreas
ReportQuote
#9
@Andreas

I would hope to have my part of this done, and a version release in the new 2 weeks, so watch this space to see what happens.

Have I helped you? Do you like my add-ons?
Would you consider donating to show your appreciation for my efforts?

/images/paypal.png
ReportQuote

Thread Closed