Solved

Custom Header Pane Button

Posted on 2011-02-19
7
637 Views
Last Modified: 2012-05-11
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
Comment
Question by:Julian Matz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 20

Accepted Solution

by:
ElrondCT earned 500 total points
ID: 34962145
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
 
LVL 21

Author Comment

by:Julian Matz
ID: 34963715
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
 
LVL 20

Assisted Solution

by:ElrondCT
ElrondCT earned 500 total points
ID: 34964871
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 21

Author Comment

by:Julian Matz
ID: 34965739
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
 
LVL 20

Expert Comment

by:ElrondCT
ID: 34966554
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
 
LVL 21

Author Comment

by:Julian Matz
ID: 35003178
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
 
LVL 20

Expert Comment

by:ElrondCT
ID: 35003645
Sorry I couldn't get it all resolved, but I'm glad I at least helped somewhat. It was an interesting question.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question