Solved

Custom Header Pane Button

Posted on 2011-02-19
7
624 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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 21

Author Comment

by:Julian Matz
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Undelete Lightning Calendar 7 1,018
Thunderbird/Exchange Setup 6 746
Open a specific e-mail in Thunderbird by command-line? 2 596
Disappearing emails 11 248
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now