Pi’s Blog

My blog about Thunderbird and GSoC 2008

Extra Attributes now in Card View

The extra attributes added by gContactSync (ThirdEmail, FourthEmail, (Google)TalkScreenName, YahooScreenName, MSNScreenName, ICQScreenName, JabberScreenName, OtherAddress, OtherNumber, HomeFaxNumber, and Groups) are now easily viewed and should be indistinguishable from regular attributes in the GUI, but the extra properties will not be copied/moved with the card unless you have the patch for 413260 applied.  The extra attributes will work for every card, not just cards in the one address book.

  • There is an extra tab added the to Edit Card dialog that lets you set all of the attributes (except setting the Group will have no effect).
  • You can view and sort the cards by any of the attributes in the tree view
  • All of the properties are visible when the card is selected in the card view.  The e-mail addresses are linked to mailto: URIs and the address has a MapIt link that uses Google Maps to view the address.

I had to change the name of the Google Talk ™ screenname from GoogleTalkScreenName to TalkScreenName because the card viewer showed the GeneratedName instead of the screenname.

July 21, 2008 Posted by | GSOC | , , | Leave a comment

New Extension

I made a new, simple, extension for changing the default file type for saved e-mail messages after BuBB1eS asked about it in #maildev.  You can change the type by going to the Preferences (Tools -> Add-ons -> Options under File Type Selector).  You should change it to only one of the following: txt, eml, html.  It will work if the period is included in the preference, too.  Let me know if you want to localize it; there are only two strings: “File Type Selector Preferences” and “Default extension for saved e-mail messages (ex txt, html, or eml)”. ;-)

You can read about it and download it here.

How it works

It overrides the SaveAsFile function in mail/base/content/mailCommands.js from:

function SaveAsFile(uri)
{
  if (uri) {
    var filename = null;
    try {
      var subject = messenger.messageServiceFromURI(uri)
                             .messageURIToMsgHdr(uri).mime2DecodedSubject;
      filename = GenerateValidFilename(subject, ".eml");
    }
    catch (ex) {}
    messenger.saveAs(uri, true, null, filename);
  }
}

to:

function mySaveAsFile(aUri) {
  var type;
  try {
    // get the preference for the default extension type
    var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
                               .getService(Components.interfaces.nsIPrefService)
                               .getBranch("extensions.filetypeselector.")
                               .QueryInterface(Components.interfaces.nsIPrefBranch2);
    type = prefBranch.getCharPref("defaultExtension");
    if (type.indexOf(".") == -1)
      type = "." + type;
  } catch(e) {}
  // if there isn't a type set it to the .eml default
  if (!type)
    type = ".eml";
  if (aUri) {
   var filename = null;
    try {
      var subject = messenger.messageServiceFromURI(aUri)
                             .messageURIToMsgHdr(aUri)
                             .mime2DecodedSubject;
      filename = GenerateValidFilename(subject, type);
    } catch (ex) {}
    messenger.saveAs(aUri, true, null, filename);
  }
}

It overrides the SaveAsFile function by adding an overlay to both chrome://messenger/content/messenger.xul (the main TB window) and chrome://messenger/content/messageWindow.xul (the window for viewing messages) and setting an event listener that overrides the function when the window loads:

// when the window finishes loading, override the SaveAsFile function with
// the mySaveAsFile function below
window.addEventListener("load", function(e) { SaveAsFile = mySaveAsFile; }, false);

July 21, 2008 Posted by | thunderbird | Leave a comment

   

Follow

Get every new post delivered to your Inbox.