Thunderbird menu extention
-
- Posts: 15
- Joined: December 6th, 2003, 4:55 pm
- Contact:
Thunderbird menu extention
I was trying to find where I need to go to edit the menu that appears when you right click on a message. I want to be able to click "View Message Source" instead of having to go up to the toolbar, click View, and then click Message Source. It seems counter-intuitive to move the mouse around all that much and I've never been a big fan of keyboard shortcuts (Ctrl+U).
I think the file I need to edit is messenger.dtd in chrome/en-US-mail.jar, but I can't tell where I'm supposed to edit it, much less what I'm supposed to edit. Any help in this matter would be greatly appreciated.
I think the file I need to edit is messenger.dtd in chrome/en-US-mail.jar, but I can't tell where I'm supposed to edit it, much less what I'm supposed to edit. Any help in this matter would be greatly appreciated.
- !!!!cdn!
- Posts: 250
- Joined: December 7th, 2003, 2:58 pm
- Location: Latitude 53ish
- Contact:
[ 10 ]
the dtd won't help you : ) - that merely specifies things like the shortcut key 'U', or the string on the menu "View Message Source"
what you need to do is add this code
to mailWindowOverlay.xul under <popup id="messagePaneContext" ... >
[ it happens to be from further down the file : ) ]
what you need to do is add this code
Code: Select all
<menuitem id="pageSourceMenuItem" label="&pageSourceCmd.label;" key="key_viewPageSource" accesskey="&pageSourceCmd.accesskey;" observes="cmd_viewPageSource"/>
to mailWindowOverlay.xul under <popup id="messagePaneContext" ... >
[ it happens to be from further down the file : ) ]
-
- Posts: 15
- Joined: December 6th, 2003, 4:55 pm
- Contact:
-
- Posts: 15
- Joined: December 6th, 2003, 4:55 pm
- Contact:
- !!!!cdn!
- Posts: 250
- Joined: December 7th, 2003, 2:58 pm
- Location: Latitude 53ish
- Contact:
[ 12 ]
it's the "observes" part of the ui code - it was a quick 'off the top of my head' add-in
try replacing with
try replacing
Code: Select all
observes="cmd_viewPageSource"
Code: Select all
oncommand="goDoCommand('cmd_viewPageSource')"
-
- Posts: 15
- Joined: December 6th, 2003, 4:55 pm
- Contact:
- !!!!cdn!
- Posts: 250
- Joined: December 7th, 2003, 2:58 pm
- Location: Latitude 53ish
- Contact:
[ 18 ]
yes
a two file extension should do it
contents.rdf and contextSourceLink.xul zipped up as contextSourceLink.jar
that plus install.js zipped up as contextSourceLink.xpi
contents.rdf
contextSourceLink.xul
-=-=-=-
install.js
a two file extension should do it
contents.rdf and contextSourceLink.xul zipped up as contextSourceLink.jar
that plus install.js zipped up as contextSourceLink.xpi
contents.rdf
Code: Select all
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:contextsrclnk"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:contextsrclnk"
chrome:displayName="Context Source Link 0.0.1"
chrome:author="Chris Neale, Tony Dennis"
chrome:authorURL="http://cdn.mozdev.org/"
chrome:name="contextsrclnk"
chrome:description="Adds"
chrome:extension="true"
/>
<!-- overlay information -->
<RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://messenger/content/mailWindowOverlay.xul"/>
</RDF:Seq>
<RDF:Seq about="chrome://messenger/content/mailWindowOverlay.xul">
<RDF:li>chrome://contextsrclnk/content/contextSourceLink.xul</RDF:li>
</RDF:Seq>
</RDF:RDF>
contextSourceLink.xul
Code: Select all
<?xml version="1.0"?>
<!DOCTYPE overlay [
<!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd" >
%messengerDTD;
<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
%contentAreaCommandsDTD;
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
]>
<overlay id="contextSourceLinkOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<popup id="threadPaneContext">
<menuitem id="pageSourceMenuItem" label="&pageSourceCmd.label;" key="key_viewPageSource" accesskey="&pageSourceCmd.accesskey;" oncommand="goDoCommand('cmd_viewPageSource')"/>
</popup>
<popup id="messagePaneContext">
<menuitem id="pageSourceMenuItem" label="&pageSourceCmd.label;" key="key_viewPageSource" accesskey="&pageSourceCmd.accesskey;" oncommand="goDoCommand('cmd_viewPageSource')"/>
</popup>
</overlay>
-=-=-=-
install.js
Code: Select all
const APP_DISPLAY_NAME = "Context Source Link";
const APP_NAME = "contextsrclnk";
const APP_PACKAGE = "/contextSourceLink";
const APP_VERSION = "0.0.1";
const APP_JAR_FILE = "contextSourceLink.jar";
const APP_CONTENT_FOLDER = "/";
const APP_SUCCESS_MESSAGE = "You may need to restart your browser before the bookmarks will be shown.";
const INST_TO_PROFILE = "Do you wish to install "+APP_DISPLAY_NAME+" to your profile?\nThis will mean it does not need reinstalling when you update your browser.\n(Click Cancel if you want "+APP_DISPLAY_NAME+" installing to the browser directory.)";
initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);
// profile installs only work since 2003-03-06
var instToProfile = (buildID>2003030600 && confirm(INST_TO_PROFILE));
var chromef = instToProfile ? getFolder("Profile", "chrome") : getFolder("chrome");
var err = addFile(APP_PACKAGE, APP_VERSION, APP_JAR_FILE, chromef, null)
if(err == SUCCESS) {
var jar = getFolder(chromef, APP_JAR_FILE);
if(instToProfile) registerChrome(CONTENT | PROFILE_CHROME, jar, APP_CONTENT_FOLDER);
else registerChrome(CONTENT | DELAYED_CHROME, jar, APP_CONTENT_FOLDER);
err = performInstall();
if(err == SUCCESS || err == 999) {
alert(APP_DISPLAY_NAME+" "+APP_VERSION+" has been succesfully installed.\n"+APP_SUCCESS_MESSAGE);
} else {
alert("Install failed. Error code:" + err);
cancelInstall(err);
}
} else {
alert("Failed to create " +APP_JAR_FILE +"\n"
+"You probably don't have appropriate permissions \n"
+"(write access to your profile or chrome directory). \n"
+"_____________________________\nError code:" + err);
cancelInstall(err);
}
-
- Posts: 15
- Joined: December 6th, 2003, 4:55 pm
- Contact:
-
- Posts: 4
- Joined: January 14th, 2016, 11:58 am
Re: Thunderbird menu extention
I am very sorry to dig out (well, actually google did) this really, really, really, REALLY (really?) old thread, but I am looking to add the same feature to thunderbird. Unfortunately, the files and file-structure have changed. Any idea which file inside the (I assmune) chrome.jar I'd have to change now?
-
- Posts: 4
- Joined: January 14th, 2016, 11:58 am
Re: Thunderbird menu extention
ok, so I decided I'll take my chances and dive a bit into making mozilla extensions. In the end, I managed to adjust everything:
content/contextSourceLink.xul
chrome.manifest
install.rdf
Zip up all together as contextSourceLink.xpi and you're good to go!
One thing that bugs me though: this context menu also shows if I right-click in the add-ons page. I guess there needs to be some modification in some .js to trigger which menu-items to disable/enable when switching between tabs. Can anyone point me in the direction?
Cheers,
T
content/contextSourceLink.xul
Code: Select all
<?xml version="1.0"?>
<!DOCTYPE overlay [
<!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd" >
%messengerDTD;
<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
%contentAreaCommandsDTD;
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
]>
<overlay id="contextSourceLinkOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menupopup id="mailContext">
<!-- <menuseparator id="mailContext-ViewSource"/> -->
<menuitem id="pageSourceMenuItem"
label="&pageSourceCmd.label;"
accesskey="&pageSourceCmd.accesskey;"
oncommand="goDoCommand('cmd_viewPageSource');"/>
</menupopup>
</overlay>
<!-- key="key_viewPageSource" <- if you want to have the hotkey displayed-->
Code: Select all
content contextsrclnk content/
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://contextsrclnk/content/contextSourceLink.xul
Code: Select all
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>contextsrclnk@tiljes</em:id>
<em:name>Context View Source</em:name>
<em:description>Adds View Source option to context menu</em:description>
<em:version>0.2</em:version>
<em:creator>Chris Neale, Tony Dennis, tiljes</em:creator>
<em:type>2</em:type>
<!-- Mozilla Thunderbird -->
<em:targetApplication>
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>44.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
One thing that bugs me though: this context menu also shows if I right-click in the add-ons page. I guess there needs to be some modification in some .js to trigger which menu-items to disable/enable when switching between tabs. Can anyone point me in the direction?
Cheers,
T