Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Custom Header Pane Button

Posted on 2011-02-19
7
Medium Priority
?
644 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
  • 4
  • 3
7 Comments
 
LVL 20

Accepted Solution

by:
ElrondCT earned 2000 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Screencast - Getting to Know the Pipeline

972 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