GSoC2010 Proposal – Add QuickLook support in Thunderbird

Personal Details

  • Name: Le Duc Khoi Nguyen (Daniel)
  • Email: GreenRecycleBin@gmail.com
  • IRC: Libras2909: on #nus, #maildev

Quick Look

Quick Look is an innovative technology shipped with Mac OSX that allows users to skim through the content of a file without actually opening it. Quick Look works even if you don’t have the application that created the document. Moreover, Quick Look is also capable of playing movies. Moreover, using Quick Look in Mail and iChat allows users to view multiple attached photos as a slideshow and add them to iPhoto library with ease.

We can find a lot of Quick Look plug-ins on http://www.qlplugins.com. Quick Look plug-ins enable Quick Look to generate preview for many different file types which are not supported by default.

Quick Look saves Mac OSX users time skimming through documents’ content. If we integrate Quick Look support successfully into Thunderbird, providing similar Quick Look’s features in Mail, more Mac OSX users might be willing to switch to using Thunderbird as their daily email client.

Proposed Idea

As mentioned above, we have already had a reasonable amount of support for Quick Look plugins on the Internet. What left to be done is to integrate Quick Look into Thunderbird.

The proposed idea is to implement Quick Look as a dynamic library (or a framework). Then the dynamic library can be loaded using ctypes feature. Following this approach, Quick Look support may be implemented in Firefox as well. For Camino, we can update the patch for bug 405358 to move from using undocumented API, which is available under Leopard only, to the new API available under Snow Leopard.

Apart from the need of portability, another reason I consider implementing Quick Look support as a dynamic library is the need of calling C-function in Javascript. Currently, the only way I know that enables calling C-compatible functions from Javascript is using ctypes. According to the ctypes API page, ctypes can handle Cocoa framework. Thus, there is a high chance that the proposed approach will work.

Detailed Implementation Approach

Showing preview of a particular attachment

Add a menu entry saying “Quick Look preview” to File → Attachments → [a specific attachment name] → Quick Look preview. The code resides in function addAttachmentToPopup()

http://mxr.mozilla.org/comm-central/source/mail/base/content/msgHdrViewOverlay.js#1838

Also add support for preview when user presses “spacebar” after selecting an attachment

Showing multiple attachments as a slideshow

Add a menu entry saying “Quick Look slideshow” to File → Attachments → Quick Look slideshow. The code resides in function addAttachmentToPopup()

http://mxr.mozilla.org/comm-central/source/mail/base/content/msgHdrViewOverlay.js#1838

Also add support for preview when user presses “spacebar” after selecting multiple attachments

Then from there, use ctypes to call C-function exported from the dynamic library.

The interface will look something like this:

AttachmentItem.h

#import <Cocoa/Cocoa.h>

@interface AttachmentItem: NSObject {

NSURL* onDiskURL;

// Other relevant attributes go here

}

–      (id) initWithURL: (NSURL*) onDiskURL; // this is exported

// Other relevant methods go here

@property(readonly) NSURL* onDiskURL;

@end

AttachmentList.h

#import <Cocoa/Cocoa.h>

@interface AttachmetList: NSObject {

NSMutableArray* attachmentList;

// Other relevant attributes go here

}

–      (id) addAttachmentItem: (AttachmentItem*) item; // this is exported

–      (id) deleteAttachmentItem: (AttachmentItem*) item; // this is exported

// Other relevant methods go here

@end

Quicklook.h

#import <Cocoa/Cocoa.h>

@interface Quicklook: NSObjectDelegate {

}

–      (IBAction) togglePreviewPanel: (id) previewPanel; // this is exported

–      (void) setAttachmentList: (AttachmentList*) list; // this is exported

–      (void) keyDown: (NSEvent*) theEvent; // this is exported to handle “spacebar”, will call tooglePreviewPanel()

Methods marked as exported will be available to the ctypes interface to be called from Javascript.

So whenever the user requests a preview by selecting from the menu, or by selecting attachment(s) and press “spacebar”, all the AttachmentItem objects are initialized and added into the list. The final result will be a pop-up Quick Look window having all the previews of all the attachments selected. When the user presses “spacebar” again, the Quick Look window is closed.

Skill set and Project Preparation

First of all, I possess the ability to read and understand foreign code in several languages. Doing research in security-related subjects, I have been reading code in many different languages (which is listed under my skill set) ranging from source code to assembly level. Therefore, I can understand code written by others well, and possibly re-use it in an effective manner.

Secondly, I have been working as a volunteer developer for Mozilla Foundation for one semester. The two products I’m working on are the famous web browser, Firefox; and Thunderbird – email client. This opportunity is offered as module CS3108 in my university, with Gary (nth10sd: on #nus, #maildev) being the instructor. Because of that, I am familiar with Mozilla development methods. I know how Mozilla community uses bug tracking system, mailing lists, wikis, IRC and blogging to collaborate. All these activities are introduced by Gary throughout the course, and they are also part of the course’s requirement. Thus, I am very much a participant in that.

Because the programming environment for this project is Mac OSX, I’ve read and tried all the examples from “The Objective-C Programming Language” book, which can be found on Apple Developers’ Network. Thanks to my exposure to many different programming languages, I have been able to pick up this new language during the last few weeks.

I have also spent a week to research about this project. I found a solution using private framework in Leopard. However, I realized that this approach doesn’t work on Snow Leopard. After discussing with Jeff (jeff: on #camino), I have started looking into the new Quick Look API which is officially supported by Apple in Snow Leopard. Taking into consideration the cross-platform design of Thunderbird (and Firefox), I decided to implement the solution as a dynamic library. I have been working on a demo of this, but due to time constraint (it is the end of the academic year here at my university), therefore I haven’t finished it yet.

Why do I want to join Mozillia community?

Mozilla is an icon and pioneer among open source organisations, and definitely an organisation I would be proud to be involved with. Having begun contributing to the community (although small) , I would like to contribute more and more to the community as time goes by. This may also serve as an example to spread more awareness about open-source spirit in my university, as CS3108 Mozilla project (and Gary) has been doing over the last 3 years. If you need any additional information, feel free to contact me at GreenRecycleBin@gmail.com or Libras2909: on #nus, #maildev.

Mentors

Blake Winton (bwinton) is my official mentor for this project. Besides, Gary (nth10sd) is my back-up mentor.

Note

The proposed idea and/or implementation details may change throughout the course of this project. Currently, I’m looking into developing a XPCOM module instead.

Advertisements

10 Comments

  1. Boris said,

    September 27, 2010 at 10:40 pm

    This is a killer feature for TB which I and i think most of Mac users are looking for as present implementation of attachments is horrible.

    So If I can help somehow, pls let me know.

    Brgrds/Boris

    • libras2909 said,

      September 28, 2010 at 12:58 pm

      Hi Boris,

      Thanks for you interest in my project. FYI, I have been working on this as part of my GSoC2010 project. The project ended already, so I won’t be working on this in the near future. (However, I’m still with Mozilla Thunderbird).

      The status of the project is very promising. If I somehow manage to test it sufficiently, then the source code will be added into trunk. Testing of this feature requires direct user interaction, which is hard (or impossible) to automate. However, it’d be great if you can help with the testing. Feel free to contact me Libras2909@#nus, irc.mozilla.org.

  2. Thomas said,

    December 10, 2010 at 10:47 pm

    Hi!

    Thanks for working on that! The Postbox guys try to sell that as a major advantage.

    Another question the Google can’t tell me: do you know if anyone is working / thinks about providing QuickLook for Thunderbird mails? I.e. I spotlight for something, find mails, and read them. So far, that’s a unique POS, so to say, of Mail.app.
    I can’t tell based on my limited knowledge whether that’s out of reach on the present form of TB databases (monolithic folders).

    Anyway, thank you – you all – for Thunderbird etc!

  3. Sandro Paolini said,

    February 28, 2011 at 2:55 am

    Found at http://polysom.verilite.de/Website/Inoffizielle_Thunderbird_Versionen_fur_Mac_OS_X_10.6.html a working “version” of Thunderbird with Quick Look support already added.

    Maybe this is helpfull?

    Ciao,
    Sandro

  4. EB said,

    March 4, 2011 at 5:28 pm

    Hi,
    How far have you gone with the QuickLook TB project?
    eb

  5. sims11 said,

    March 17, 2011 at 7:23 am

    i would love to have this capability as well. considered switching to TBird today, but may not go that route due to the lack of QuickLook :(.

    Quicklook is just so so convenient to peek into attachments.

    Thanks for taking the lead! And thanks for TBird.

  6. October 17, 2011 at 10:10 am

    Is this still alive? Was the code ever integrated into TB? Is the code somewhere available?

    • libras2909 said,

      October 17, 2011 at 10:15 am

      It’s still under development here. Nomis101 is doing most of the development right now because I’ve been busy with school. He also has some unofficial 64-bit build of Thunderbird which incorporates this feature on his website.

  7. May 20, 2013 at 12:29 am

    Exceptional post however , I was wondering if you could write a litte more on this subject?
    I’d be very grateful if you could elaborate a little bit further. Kudos!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: