• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 653
  • Last Modified:

Custom Header Pane Button

Hi! I'd like to add a button to the header pane / message preview pane window in Thunderbird. I'd like it to move the selected message to a pre-defined IMAP folder.

I've done some research on this, but first of all my button code doesn't work, and secondly, I cannot find any information on how to add a button to the preview pane toolbar, only to the main toolbar.

The toolbar I mean is the one where you have the Reply / Forward / Archive / Junk / Delete buttons when a message is selected (the message preview pane below the thread pane).

This is the JS code I tried that didn't work:
CustomButton = {

1: function () {
  MsgMoveMessage("imap://xxx@xxx.com/Spam/defspam");	
  },

}

Open in new window

I tested this using the guide here:
https://developer.mozilla.org/en/Custom_Toolbar_Button

Any help with this would be much appreciated.


0
Julian Matz
Asked:
Julian Matz
  • 4
  • 3
2 Solutions
 
ElrondCTCommented:
I'm not an expert on this, but I just went through the instructions on the page you noted, and was able to get my button to work (though I'm using a POP3, rather than IMAP, email account). So I'd be happy to try to work with you to troubleshoot.

First off, if you use as your JS code their sample of:

alert("Just testing")      

do you get an alert box displaying on your screen? If not, the most likely scenario is that you're missing one of the files needed to get the button in place. Check their profile directory listing, and make sure you have all the files, named properly and in the correct folders.

Figuring out how to get a button into the toolbar for the message (preview) pane wasn't easy (the problem was figuring out what the palette is called, and I couldn't find a general listing), but I found the trick. In your button.xul file, include the following code:  
<!-- Thunderbird message -->
<toolbarpalette id="header-view-toolbar-palette">
  <toolbarbutton id="custom-button-1"/>
  </toolbarpalette>

Open in new window


Note that it's the same as the other toolbar references that you already have, just changing the toolbarpalette ID. If you change the name of your button from custom-button-1, alter the code given accordingly.
0
 
Julian MatzJoint ChairpersonAuthor Commented:
Yes, I managed to get the alert('testing') test working, and I also managed to create a "check for updates" test button. The only thing I failed on was the msgMoveMessage function (and getting the button into the right toolbar).

However, I did afterwards manage to get the default "Junk" button to do what I wanted.

That siad, I'm always looking for ways to make my life (I mean work) easier, so, I appreciate you finding this for me. I couldn't find the toolbar palette ID anywhere. I tested it and it worked - my test button showed up in the correct toolbar.

Perhaps the function doesn't exist in this context. Does Javascript have a method for testing if a function exists?
0
 
ElrondCTCommented:
Hmm, mine's not working either. It displays correctly on the main toolbar, a bit differently on the message pane, and nothing happens when I click either one.

With more poking around, I found part of the issue. We need a second function to do an internal conversion:

  MsgMoveMessage(GetMsgFolderFromUri("mailbox://elrondct@xxx.com/Test"))

It's still not doing anything when I click on it in the message pane. When I click on it on the main toolbar, though, I get a message: "The folder Test is full, and can't hold any more messages. To make room for more messages, delete any old or unwanted mail and compact the folder." This is spurious; I originally had no messages at all in the folder, and then copied a single small message. (Just to make sure, I did a Compact, which made no difference.)

I'll try to research this more, but thought I'd post what I have so you can look into it as well.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Julian MatzJoint ChairpersonAuthor Commented:
That's interesting. So, are you saying that the selected message moved for you when you pressed the main toolbar button but gave an error, or do you mean it didn't work at all and you just manually copied a message to the target folder for testing?

Sure, I'll test it myself too and see what I get. Thanks!
0
 
ElrondCTCommented:
From the main toolbar, I got the error message. I tried separately copying a message over, then trying again, just to make sure it wasn't an issue of not having a message in the folder. From the message pane, I got no response when I clicked.
0
 
Julian MatzJoint ChairpersonAuthor Commented:
Strange. Well, for now, my work-around is to use the default Junk button, which seems to be working fine. My other issue is that the Move to "FOLDER NAME" Again option in the context menu is disabled (greyed out). I'm not sure why, but apparently it's something that's supposed to be fixed in the next release. Not sure if the two things are related, but I'll keep testing and will update here. In the meantime, I will close this. At least now I know how to add a button to the header pane.

I appreciate your help.
0
 
ElrondCTCommented:
Sorry I couldn't get it all resolved, but I'm glad I at least helped somewhat. It was an interesting question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now