25 February 2008

More about Clippings 3.0 features

Here are more details on the new features introduced in Clippings 3.0.

Common Clippings Data for Firefox and Thunderbird

This much-requested feature allows your Clippings data to be created, accessed and modified from both Firefox and Thunderbird. That means that a clipping created in Firefox will be visible in Thunderbird; a clipping created in Firefox that is modified in Thunderbird will be updated in Firefox, too; etc.

This feature will be enabled by default for users who have never had Clippings installed in Firefox and Thunderbird. If you are upgrading from a previous version of Clippings, you can choose to keep your Clippings data separate in Firefox and Thunderbird, or you can enable common clippings by running the Common Clippings Wizard (Clippings Manager, Options → Common Clippings) from both Firefox and Thunderbird.

Placeholders In Clippings

You can now define placeholders inside a clipping that you will be prompted to fill in when you paste the clipping. Placeholders are essentially variables that appear in the clipping text in the format $[variable_name]. Valid variable names can contain letters (lowercase or uppercase), digits (0-9) and underscores. Example clipping with placeholders:
Hello, $[YourName], I'm glad you're coming to the club meeting at $[meeting_time]. See you $[2nite]!
When you paste a clipping with placeholders, you will be prompted to fill in the value for each placeholder in the clipping. If you want the placeholders in the clipping pasted exactly as they are, with no prompting and substitution, the clipping name should be prefixed with [NOSUBST].

There are six predefined placeholders you can use in your clippings; these predefined placeholders will be automatically substituted with their expected values when you paste the clipping.
  • $[NAME] - the name of the clipping
  • $[FOLDER] - the name of the folder the clipping belongs to
  • $[DATE] - the current date, expressed in the format defined in your system's locale settings
  • $[TIME] - the current time, expressed in the format defined in your system's locale settings
  • $[HOSTAPP] - the name and version number of the host application you're pasting the clipping in
  • $[UA] - the user agent string of the host application

Default Clippings

System administrators and redistributors can bundle a default Clippings datasource file into a customized Clippings XPI to pre-populate their users' datasources when they install the customized XPI. To create a customized XPI, do the following:
  1. Download the Clippings 3.0 XPI and save it to a location on your system.
  2. Unzip the XPI using a ZIP client such as WinZip. Make sure that the directory structure in the XPI file (actually a ZIP archive with an .xpi file name extension) is intact.
  3. Copy a Clippings datasource file containing the default Clippings data to the defaults directory and rename it clippak.rdf.
  4. Re-zip the XPI archive; the directory structure and all files that were in the XPI must be preserved.
When the user installs the customized XPI, the default Clippings data will be automatically imported when starting the host application (Firefox or Thunderbird) after the installation.

Hint:
Create and organize the default clippings using Clippings Manager, then export the data to a Clippings file. A new, standalone utility is in the works that will let you view and edit Clippings files without disturbing your personal Clippings data.

Other Things You Should Know About
  • If, before migrating to the common Clippings data source, you have a large number of clippings and folders in the root Clippings folder, migrating from Firefox and Thunderbird may result in a larger number of clippings and folders in the common data source, resulting in a rather lengthy Clippings submenu in the host application's context menu. Consider organizing your clippings (deleting unneeded clippings from the root folder and moving clippings to folders) before running the migration utility.
  • Sometimes, if the common Clippings data source is enabled and you make changes to a clipping from Clippings Manager invoked from one host app and then switch to another instance of Clippings Manager from the other host app, the update from the first host app may not be reflected in Clippings Manager from the second host app. Use Options → Reload to update the display.
  • The Redo (a.k.a. "Undo Undo") function key in Clippings Manager has changed as of milestone release 2.99.3; the function key is now F2.

Clippings 3.0 Release Candidate 1

This is the first release candidate of Clippings 3.0. Barring any last-minute showstopper bugs, this release should resemble the final 3.0 release.

» Download: Clippings 3.0 RC 1 (175 KB; compatible with Firefox 2.0-3.0b3 and Thunderbird 2.0-2.0.0.*)

Supported languages: English (United States), Dutch, French, Italian, Japanese, Polish, Portuguese, Russian, Slovak.

If you already have a previous release of Clippings installed, you must uninstall it first before installing this release.

Please note that Clippings 3.0 is, and will not be, compatible with Firefox 1.5 and Thunderbird 1.5. These versions are obsolete and Mozilla Corp. is no longer supporting them.

What's New

This is a summary of all the new features introduced in the past development milestone releases. More details about some of the features are described in another post.
  • Common clippings data for Firefox and Thunderbird. This much-requested feature allows your Clippings data to be created, accessed and modified from both Firefox and Thunderbird. (More info.)
  • Shortcut keys. You can now assign a shortcut key to a clipping at the time of creation or by editing a clipping in Clippings Manager. Shortcut keys can be any letter (A-Z) or digit (0-9). To paste the clipping into a web page form field in Firefox or a new email message in Thunderbird, press CTRL+ALT+V, then the shortcut key.
  • Clipping placeholders. You can define placeholders inside a clipping that you will be prompted to fill in when you paste the clipping. Built-in placeholders for the date, time, clipping name, user agent, etc. are also available. (More info.)
  • Default clippings. System administrators and redistributors can bundle a default Clippings datasource file into a customized Clippings XPI to pre-populate their users' datasources when they install the customized XPI. (More info.)
  • Improvements to Clippings Manager's automatic save functionality, including on-the-fly updating of clipping edits/changes.
  • Double-click on a clipping in Clippings Manager to paste it into the most recent host app window
  • Numerous bug fixes.

Known Issues
  • On Firefox 3, it is not possible to adjust the width of Clippings Manager's tree list.
  • Shortcut key assignments are lost after migrating to the common data source.

Feedback Welcome


Please send bug reports to the Clippings mailing list, or file a bug report on Bugzilla (requires Bugzilla account on Mozdev). You can also leave a comment below this blog post.

13 February 2008

Panic Button 0.9.1 (beta 2 release)

This release contains some improvements to the first beta release of Panic Button.

Meant for early adopters craving the latest and greatest, this beta release is being made available for testing, and should only be installed if you are willing to tolerate a few bugs. If that scares you, then you shouldn't install it.

» Download: Panic Button 0.9.1 (16 KB; English (United States); compatible with Firefox 2.0-3.0b3)

If you already have the previous release of Panic Button installed, you must uninstall it first before installing this release.

What's New
  • The Panic Button action is configurable through the extension options dialog (Tools → Add-ons from the Firefox browser window, select Panic Button in the list of extensions and click Options). The Panic Button action options are: hide all windows (the fastest option; a Restore Session toolbar appears after all Firefox app windows close so that you can bring back the browser windows later), minimize all windows (slowest option -- but all windows, including ancillary app windows like Help, View Source, Bookmarks/Places, etc. can be restored), or quit (close all windows and quit Firefox).
  • Windowing shortcut keys (for minimize, maximize and restore commands on the browser window) and CTRL+Q (the quit key) are no longer included with Panic Button.
  • The F9 key for invoking the Panic Button action can be disabled; it is enabled by default. This is useful if you have another extension installed that uses that key.
Known Issues
  • The Panic Button action option to hide all windows doesn't work if a system native file picker dialog box (Open, Save As) is open in any of the browser windows at the time the Panic Button action is invoked (bug 18629).
  • If a dialog box (e.g. Options, About) was invoked from browser window A, clicking the Panic Button on browser window B won't hide browser window A. This is only happening on Firefox 3.0b3 if the Hide All Windows action on the Panic Button is set (bug 18637).

Things You Should Know About

Any downloads in progress will continue in the background if clicking the Panic Button to hide or minimize all windows. If Quit was selected in extension preferences as the Panic Button action, downloads in progress will be cancelled.

Help and Support

Feedback on this extension is welcome. General comments and bug reports may be submitted by going to the AE Creations home page and clicking Contact. If you have a Bugzilla account on Mozdev, you may file a bug report here (please make sure you specify Panic Button on the bug summary field).

Translations of Panic Button are not yet enabled due to the enhancements that required adding more UI strings. Panic Button will be resubmitted to Babelzilla when it is stable for final release. Thanks to the Babelzilla translation team for their efforts so far.

06 February 2008

Send Tab URLs 0.4.1 released

This minor release adds support for a few languages (made possible by the awesome translators at Babelzilla) and is compatible with Firefox 3.0 beta 2.

» Download: Send Tab URLs 0.4.1 (21.1 KB; English (United States); compatible with Firefox 2.0-3.0b2)

If you already have Send Tab URLs installed, it will be upgraded for you if automatic extension updates are enabled in Firefox. Otherwise, open Extension Manager in Firefox, then right-click on the entry for Send Tab URLs in the list of installed extensions and choose Find Update.

What's New
  • Compatible with Firefox 3.0 beta 2
  • Removed support for Firefox 1.5 series, which is no longer maintained by Mozilla Corp.
  • Added support for Catalan, Chinese (simplified), Polish and Spanish locales

Known Issues

  • On Windows, Send Tab URLs has been confirmed to work with Mozilla Thunderbird, SeaMonkey Mail, Outlook Express and MS Office Outlook. Send Tab URLs may not work with other Windows-based email programs not listed here, especially if the URLs of the individual browser tabs are long. No such limitation have been found on Linux or Mac OS X.
  • On German and Russian locales, the toolbar button caption may appear in English.

See the Contact page on the AE Creations website for details on how to report a bug or obtain support.

05 February 2008

Yahoo + Microsoft?

I remember Yahoo! as being one of the first few Web sites I visited when I walked into the library at my high school one day to work on a research assignment. There was only one computer with Internet access (through this big, noisy external 28K modem with little red blinking lights), and Netscape Navigator 3, considered the most advanced Web browser at the time, was my window to the World Wide Web.

Those early days of the Web were simpler times, and Yahoo! was a reflection of that. Its home page had only a few, grainy images, and almost all text was rendered in Times Roman font. It was merely a vast directory of links to Web sites, not a true search engine like what Google presently is. It was simple, yet elegant -- and it was the tool I used to conduct my very first Web-based research.

At the beginning of my first year of university, I was so dissatisfied with the university's email service which was accessible only through a primitive, character-based Lynx browser that I decided to open a Hotmail account (all of my classmates seemed to have a hotmail.com address, so I followed the crowd). Back then, the company behind Hotmail was bought out by Microsoft just a few months earlier, so the original Hotmail UI was still intact. But after Microsoft overhauled the Hotmail interface in their gradual efforts to make it resemble an MS Office application, I bailed out -- and looked again to Yahoo!.

By this point, Yahoo! had grown bigger. Its home page continue to retain the simple yet elegant look, but by then it had various other Web-based services such as online shopping and email. Its email service was appealing, and so I signed up for a yahoo.com email address.

As time progressed, Yahoo! had grown and changed dramatically. Eventually it did away with the spartan, text-oriented home page and it became a graphic-heavy, commercialized, advertising-driven portal, presenting users with links to news, sports, video, autos, finance, travel, relationships, movies, TV shows, celebrities, jobs, classifieds, shopping, games, instant messaging and many, many other services. Its roots as a Web directory is all but forgotten, its link buried somewhere in its massive patchwork of services. Yahoo! went on a shopping spree of its own, buying up companies like GeoCities and eGroups, and assimilated their products into its own growing collection. Meanwhile, Yahoo! Mail has been transformed into a Web 2.0 app, trying desperately hard to appear and act like a desktop application. While its message preview feature is a major benefit for me, its bloated, extraneous features have annoyed me so much that I have since defected to Gmail -- although I still use my Yahoo! email account for personal messages (I have recently switched back to Yahoo! Mail Classic because the new Yahoo! Mail won't work on Firefox 3.0 beta 2). And Yahoo! Briefcase, the only other Yahoo! service that I use occasionally, has remained fairly static in this sea of change -- probably because it's been neglected while the company focuses on its other, more profitable, online offerings.

Despite weathering the dot com bust, Yahoo! has recently fallen into hard times. Even with Jerry Yang, its co-founder, at the helm again, Yahoo! has been performing poorly in the eyes of investors and mass layoffs are imminent. Its weakened state has now left it vulnerable to a takeover bid by Microsoft, which it has been eyeing for some time in its ongoing battle to outdo Google for Internet dominance.

It's inevitable that a Microsoft takeover of Yahoo! will succeed, one way or another -- because in the end, its shareholders are only interested in making a profit, and Yahoo! executives and employees with stock options would be eager to cash in and make a few quick bucks... indeed, both are strong incentives to see the deal go through. That leaves the question of what to do with all that overlap between MSN and Yahoo!. But as far as Microsoft is concerned, it could care less about Yahoo! Mail, Briefcase or all of those other services, because its only interest is in Yahoo!'s search engine and advertising businesses.

I view this prospect with some degree of sadness. As one of the early members of the Internet generation, I practically grew up on Yahoo!, and it would be shame to see it disappear into Internet history along with other relics like Netscape. But the stark reality is that many are seeing these events as a golden opportunity to profit from the misfortune of others.

01 February 2008

Clippings milestone releases not localized

For those early adopters interested in installing Clippings 3.0 milestone releases (numbered 2.99.x) on a non-English Firefox installation, please note that these releases do not yet have any of the new UI strings localized. This is the cause of the error messages reportedly appearing below the Firefox or Thunderbird application windows.

This problem has been documented in bug 18572 which will be fixed before the Clippings 3.0 release candidate. In the meantime, the solutions that I can suggest are to either stick with Clippings 2.6, or wait until the release candidate is released.

(With thanks to the reporter of bug 18572 for the heads up.)

31 January 2008

Improvements to Panic Button

I've played with Panic Button a bit more since I released a beta version of it earlier this month. There are a few things I've observed with it; one of them is an annoyance, the other is something that seem out of place for an extension that fulfills a relatively narrow, specific purpose.

First off, minimizing all windows isn't exactly instant -- in fact, it's painfully slow, on Windows at least. When hitting the Panic Button, the windows animate one by one as they shrink themselves to the taskbar. If you have a lot of open Firefox windows, this can last a few seconds. And by then, the boss will have already noticed that, at which point he would then stop by your desk and demand to know what you're up to....

The shortcut keys for window operations (minimize, maximize, close all) don't fit in with Panic Button's sole purpose of hiding all browser windows and concealing your Web surfing. They are especially redundant when users could configure them using the handy Keyconfig extension.

What to do

The minimize window behaviour is platform-specific and cannot be changed from within the Mozilla environment. So that leaves me with the following options:
  • Leave it the way it is
  • Use the session API to save the state of each open browser window, and then close all of them. That means the browser windows will truly be hidden instead of merely being minimized to the system taskbar. Have a toolbar appear that allows the user to click on a button (after the boss walks by) to reopen the browser windows and restore the browser session.
  • Give the user the option to configure the behaviour of the Panic Button: minimize all, hide all windows (with the toolbar appearing so that they can be reopened later), or exit Firefox entirely.
The redundant shortcut keys will be eliminated -- except for F9, which is a useful alternative to the Panic Button button. Another reason for eliminating them is that some of them may already be mapped to other system functions on the user's desktop environment -- in particular, ALT+F5 and ALT+F10 are system keys in Gnome which perform the same window actions as Panic Button.

And yes, I know... the Panic Button icon is ugly and needs improvement.

26 January 2008

Clippings 2.99.5 development milestone released

This is the fifth development milestone release leading up to Clippings 3.0, intended for early adopter users who crave the latest and greatest. Users not comfortable trying out pre-release software and tolerating its many bugs should stick with Clippings 2.6 for now.

Clippings 2.99.5 is a feature-complete release. This milestone release will, for the most part, contain all the great new features that you will see in Clippings 3.0.

» Download: Clippings 2.99.5 (146 KB; English (United States); compatible with Firefox 2.0-3.0b2 and Thunderbird 2.0-2.0.0.x)

If you already have a previous release of Clippings installed, you must uninstall it first before installing this release. Because this is a development snapshot, no automatic upgrades to this release will be available to current Clippings users.

What's New
  • Removed support for Firefox 1.5 and Thunderbird 1.5. These versions are obsolete and Mozilla Corp. is no longer supporting them.
  • Added support for Firefox 3.0 beta 2.
  • Clippings' first-run initialization has been improved.
  • Bug fix: No auto reload after migration completed (bug 18197)
  • Bug fix: Common Clippings command should be hidden after migration is completed (bug 18368)
  • Bug fix: "Clippings Error" command on Clippings menu not removed after successful automatic recovery on Thunderbird
Known Issues

Regressions occurring when Clippings is installed on Firefox 3.0 beta 2:
  • In Clippings Manager, it is no longer possible to adjust the width of the tree list.
  • Export as HTML from Clippings Manager doesn't work (bug 18519)
  • Many message boxes from Clippings will have the oddly generic title bar caption "[JavaScript Application]"
Other issues outstanding:
  • Clippings Manager status bar item count isn't updated if Clippings with packaged datasource is installed on to another host application (bug 18552)
  • Shortcut key assignments are lost after migrating to the common data source.

Help and Support

Send your questions to the Clippings mailing list at clippings@mozdev.org. Enter a new bug here (Bugzilla account on Mozdev required - or you can just post your bug report to the mailing list). Remember to check the bug list first to see if an issue you want to report has already been filed.

Stay tuned for a release candidate of Clippings 3.0.

07 January 2008

Introducing Panic Button

After searching in vain for an extension that hides all browser windows to prevent the boss from snooping in on your Web browsing, I quickly put together Panic Button... a cool, useful Firefox extension that adds a toolbar button to the browser window -- literally called "Panic Button." Now you can minimize all browser windows -- as well as any open Firefox windows such as the help viewer, Bookmarks Manager, View Source, Error Console, etc. -- with just one click on a toolbar button!

You can also invoke the same action as the Panic Button, um, button, by pressing F9.

A beta version of Panic Button is now available for download. Support for languages other than English will be available soon.

» Download: Panic Button 0.9 (4.7 KB; English (United States); compatible with Firefox 2.0 - 2.0.0.*)

After installing Panic Button, add the Panic Button button to the browser toolbar by choosing View → Toolbars → Customize on the Firefox menu bar, and then dragging the Panic Button to the desired location.

What Else?

Panic Button also introduces a few additional shortcut keys for the browser window. The shortcut keys are summarized in the following table.

























ActionShortcut Key
Minimize AllF9
MinimizeALT+F9
MaximizeALT+F10
RestoreALT+F5
Close AllCTRL+Q


Note that pressing CTRL+Q will function the same as if File → Exit was selected from the browser menu bar.

You can change the shortcut key bindings using a Firefox extension called KeyConfig.

Known Issues
  • The Restore key binding (ALT+F5) conflicts with a system-wide shortcut key on KDE that displays the desktop window list (bug 18411).

Help and Support

Feedback on this extension is welcome. General comments and bug reports may be submitted by going to the AE Creations home page and clicking Contact. If you have a Bugzilla account on Mozdev, you may file a bug report here.

31 December 2007

Looking ahead to 2008

The hours and minutes are ticking as the end of 2007 approaches. There are a couple of new year's resolutions that I hope to fulfill in 2008. Here's a list.

First off, writing more frequently on this blog about projects as I work on them. I find that writing about them helps to brainstorm ideas, contemplate solutions to problems, and solicit feedback on them.

Finish up Clippings 3.0 development, and make it work in Firefox 3.

Send Tab URLs needs an update. Since its first release, there have been new localizations created for it, thanks to the translators over at Babelzilla. The new update will include the new localizations.

Develop a few extensions that I've got on my idea list:
  • Panic Button - minimizes all windows using a shortcut key or a toolbar button. Great for quickly concealing your Web surfing when the boss walks by your desk.
  • Bookmark Keys - inspired by shortcut keys for Clippings and also by a coworker's annoyance, I want to extend Clipping's shortcut key concept to work with Firefox's bookmarks. That is, pressing a shortcut key like CTRL+ALT+B, and then a letter or digit, will point the browser to the bookmarked Web page. (The name "Bookmark Keys" has already been taken by another extension that does something similar, but only for bookmarks in the Bookmarks Toolbar.)
  • Further development of XULicious, the del.icio.us tag browser. This isn't an extension - it's a stand-alone application that uses the XULRunner platform. The prototype that I introduced over a year ago is languishing, and its usefulness at present is rather trivial.
Finally, there is a Web 2.0-style application that I'm thinking about working on - but I'm still thinking about ideas on how to make it useful because as it is right now, it really isn't. Once I have my ideas clarified I'll write more about them in this blog.

Happy New Year!

29 December 2007

Clippings 2.99.4 development milestone release

This is the fourth development milestone release leading up to Clippings 3.0, intended for early adopter users who crave the latest and greatest. Users not comfortable trying out pre-release software and tolerating its many bugs should stick with Clippings 2.6 for now.

» Download: Clippings 2.99.4 (147 KB; English (United States); compatible with Firefox 1.5-2.0.0.x and Thunderbird 1.5-2.0.0.x)

If you already have a previous release of Clippings installed, you must uninstall it first before installing this release. Because this is a development snapshot, no automatic upgrades to this release will be available to current Clippings users.

What's New In This Release
  • Common Clippings Migration utility (Clippings Manager, Options → Common Clippings) to enable the common clippings feature and migrate your clippings data from the data source in the host application profile directory to the common data source. This eliminates the tedious, manual set up that was necessary in past milestone releases to enable and initialize the common clippings data source.
  • Double-click on a clipping in Clippings Manager to paste it into the most recent host app window
  • Mini-help appears when starting Clippings Manager for the first time, and when clicking What's This in the Shortcut Key field.
  • Clippings toolbar (disabled by default due to usability problems; see this post for details)
  • The Clippings button for the host application toolbar has been removed, as it is not very useful.
  • Bug fix: Clippings menu missing if clippak.rdf (the packaged data source file) is corrupted or invalid (bug 17898)
  • Bug fix: resolve confused UI state after migration to common datasource (bug 17939)
  • Bug fix: incorrect status bar count after new clipping/folder or import from other host app (bug 17871)
Known Issues

For the most up-to-date list of bugs, please see http://clippings.mozdev.org/bugs.html.
  • Common clippings is still disabled by default; however you can now enable it by running the Common Clippings Migration utility, described above.
  • Clippings Manager does not automatically reload the clippings tree after the migration is completed; workaround this by closing and then reopening Clippings Manager (bug 18197)
  • Shortcut key assignments are lost after migrating to the common data source.
Things You Should Know About
  • To migrate your clippings data to the common data source, you must run the Common Clippings Migration utility (Clippings Manager, Options → Common Clippings) from both Firefox and Thunderbird.
  • If, before migrating to the common data source, you have a large number of clippings and folders in the root Clippings folder, migrating from Firefox and Thunderbird may result in a larger number of clippings and folders in the common data source, resulting in a rather lengthy Clippings submenu in the host application's context menu. Consider organizing your clippings (deleting unneeded clippings from the root folder and moving clippings to folders) before running the migration utility.
  • Sometimes, if common clippings data source is enabled and you make changes to a clipping from Clippings Manager invoked from one host app and then switch to another instance of Clippings Manager from the other host app, the update from the first host app may not be reflected in Clippings Manager from the second host app. Use Options → Reload to update the display.
  • The Redo (a.k.a. "Undo Undo") function key in Clippings Manager has changed as of milestone release 2.99.3; the function key is now F2.
Help and Support

Send your questions to the Clippings mailing list at clippings@mozdev.org. Enter a new bug here (Bugzilla account on Mozdev required - or you can just post your bug report to the mailing list). Remember to check the bug list first to see if an issue you want to report has already been filed.

27 December 2007

The twin floating toolbar predicament

Hope everyone had a great Christmas! With the holidays winding down, and me not being in much of a mood to participate in the Boxing Day consumerism frenzy, it's time to dive back into Clippings.

Earlier, I wrote about the problem where it's impossible to determine which host application the floating toolbar palette is originating from, if both Firefox and Thunderbird are running and the toolbar was invoked from both host apps.

The ideal solution is to make the floating toolbar disappear whenever the host application window loses focus, and make it reappear, if it was hidden, when the user restores focus to the host app window. This behaviour is the same as that found in Microsoft Word. Another idea is to put an icon in the floating toolbar's title bar to indicate which host app the toolbar was invoked from. But trademark concerns would prevent me from using the official Firefox or Thunderbird logos in Clippings, and any kind of substitute would be unrecognizable by most users. Plus, the latter idea didn't address the issue of two floating toolbar windows appearing simultaneously if the toolbar was invoked from both host apps -- and that just looks silly, as the following screen shot illustrates:

The rather silly result of invoking the Clippings floating toolbar from both Firefox and Thunderbird.

The first solution was clearly the ideal, and one I tried to get it to work. The key to it is to be able to determine when the host app window loses or gains its focus so that the floating toolbar can be hidden. Unfortunately, there is no way to determine if the host app window has lost focus. The activeWindow property of the nsIWindowWatcher interface always refers to an open window -- even if that window doesn't have focus! Another approach was to hide the toolbar if the blur event on the XUL window is fired, and show the toolbar (if it was hidden) when the focus event is fired. While it is possible to handle a focus event, that isn't the case with the blur event; I tried putting an onblur event handler on the XUL window element, as well as using addEventListener() to register a blur event handler, but to no avail. A seemingly promising newsgroup discussion that I found only lead me to a dead end.

Rather than hiding the toolbar when the host app window loses focus and restoring it when the host app window regains focus, why not hide it when the user moves the mouse out of the host app window, and show it again when the mouse moves into the host app window? Seemed like a great idea... except that the mouseout and mouseover events are fired not just on the window, but on any element contained in it that can trigger mouseout and mouseover events. And when I say this, I don't just mean the XUL elements that define the host app window UI -- but the HTML elements in the Web page displayed in Firefox's browser content area, or the content area of Thunderbird's message compose window! There was no pattern that I could find to help me filter out unwanted event invocations, and at this point I knew that this wasn't going to work, either.

Sadly, the Clippings toolbar isn't ready for prime time, and having worked on this for some time with no results that's really usable, I decided that it's time to move on. The toolbar is still there, but it is now disabled by default. The boolean preference "clippings.toolbar.enabled" needs to be created and set to true in about:config to make the Clippings Toolbar command visible in the Clippings status bar icon menu in the host app.

Users itching to try it out now can do so by downloading and installing the latest experimental snapshot release from http://downloads.mozdev.org/clippings/experimental/. Look for the XPI file named clippings-2.99.3+_20071227.xpi.

15 December 2007

Creating the Clippings Toolbar

Finally I've got the Clippings toolbar to work reasonably well. It can be invoked by right-clicking on the Clippings icon on the host application's status bar and choosing the Clippings Toolbar command. It is a floating palette toolbar (or "windoid" as the Mac folks say), so it appears above all windows.


You can try it out now by going to http://downloads.mozdev.org/clippings/experimental/ and downloading and installing the XPI file named clippings-2.99.3+_20071215.xpi (there is another XPI file in the same directory with the word "toolbar" at the end of its file name; it is an older, buggy build, so ignore it). Note that it hasn't yet been tested on Firefox or Thunderbird 1.5 series, and thus it isn't guaranteed to work on those versions.

A few challenges had to be overcome in order to implement the Clippings toolbar:
  1. The features string in the window.open() call which invokes the floating toolbar window includes the unknown string "popup" - this makes the window appear as a popup window which UI elements like menus and tooltips render as. However, this results in a chromeless window, lacking the title bar and borders. I had to style my own window border and title bar, resulting in a floating toolbar window that, as you can see from the above screen shot, won't necessarily match the appearance of floating toolbar windows in the user's desktop environment.

    The toolbar was invoked in this fashion to satisfy the criteria of a floating toolbar palette -- specifically, that it floats above all windows and that a taskbar button (in Windows) should not appear for the floating toolbar. Invoking the floating toolbar as a modeless dialog would satisfy the criteria, but on the Mac it may be rendered as a dialog sheet.

  2. The toolbar needs a reference to the most recent host application window so that it will perform its operations (insert clipping, new from selection) in the context of that window. This was made possible through the very useful XPCOM interface nsIWindowMediator.

  3. Moving the floating toolbar window by dragging its title bar was painful to implement. After over a week of trying to get it to work I gave up and searched online for drag-and-drop DHTML code, hoping that I could somehow adapt it to work with dragging an XUL window to move it. In the end, I figured it out on my own.

    In a nutshell, the drag start and stop can be initiated from the onmousedown and onmouseup events, respectively, on the toolbar palette's title bar (actually an XUL <vbox> element) -- but the actual move event handling needs to be invoked from the onmousemove event from the XUL <window> element. Handling the mouse move from the title bar (the <vbox> element) works only as long as the mouse stays within that element during the move operation; if the mouse is moved at a great distance on the screen, the mouse cursor jumps out of the title bar rather than moving the floating toolbar window. I still haven't figured out exactly why, although I suspect it has something to do with the DOM event flow as explained in the W3C's DOM 3 Events specification.
There's another problem: if the Clippings toolbar is invoked from both host applications (Firefox and Thunderbird), and both are open at the same time, two Clippings toolbars appear on the screen, and it's nearly impossible to distinguish which of the two is from which host app. More about this in another post.

18 November 2007

A toolbar for Clippings

Many users have asked for a quicker, easier way to paste clippings as an alternative to right-clicking on a web page text box (or a new email message), pointing to Clippings in the context menu, and then picking from the submenu that appears. Shortcut keys, which was introduced in the first milestone release leading up to the eventual 3.0 release, is one answer to this request -- albeit for keyboard-savvy users.

There were several ideas that were suggested, all of which I considered:
  • A new sidebar UI
  • A new toolbar UI
  • Double-clicking on a clipping in Clippings Manager to paste it
  • Clippings "smart tags" -- like the Smart Tags in MS Office applications
  • Make the Clippings menu detachable
  • Placing the Clippings menu on the status bar icon. (This is actually the original placement of the Clippings menu in a very early, pre-1.0 release.)
A new sidebar UI seems like a sensible idea, but I don't like how it would narrow the viewable browser content area just so a user can paste a clipping from a list that's always visible (until the sidebar is closed). Obviously not a problem for people with large screens -- but remember that not everyone has the luxury of a large monitor (for example, I still use a 17" CRT at home). And if the user's collection of clippings in the "root" (a.k.a top level) folder is not that many, then all that empty space in the lower part of the list is just wasted screen real estate.

Smart tags are a great idea -- until you actually experience them. They can be annoying, especially when they follow you everywhere in its futile attempt to be overly helpful to you in every single use case scenario. I've turned off Smart Tags in Microsoft Word for that very reason.

While double-clicking on a clipping in the Clippings Manager tree list might seem convenient, the question is, if multiple browser windows/message compose windows are open at the same time, where does the double-clicked clipping go? Should a double-click action display a popup menu or a dialog box asking which window to paste the selected clipping into? Sure, let's suppose that by default the clipping will be pasted into the previously-focused host app window... but what if the user wanted it pasted in a different window?

That leaves the toolbar UI idea. The advantage of a toolbar is that it only needs to appear when when user wants it to, and that it can either be docked to the host app window, or floating (as a floating toolbar pallete). Not only can the user quickly access the Clippings menu with just one (left) click, but other commands (New, New From Clipboard, etc.) can be readily available. Here is what I have in mind:

Clippings toolbar, docked to the host app window.

Floating toolbar.

The toolbar idea seems to be the best option. It uses up only the screen space it needs (well, the floating toolbar at least), and the user can show or hide it as he pleases. And the floating toolbar can be moved anywhere on the screen -- where the user wants it to be -- so that its within easy reach, as opposed to a fixed sidebar UI, and without the annoyance of a "smart tag" that follows you everywhere. Now that I think about it more, is a docked toolbar really that necessary?

Edit: I just realized that my arguments against adding clipping pasting capabilities from the Clippings Manager are baseless. If one could insert a clipping into the current host app window from the toolbar, one should be able to do so from Clippings Manager, too. Silly me.

07 November 2007

Discovering the wonders of stringBundle.getFormattedString()

Localization in an XUL-based app or extension is accomplished by putting all UI strings into DTD or .properties files and bundling them into a Mozilla XPI. The latter type of file is used for storing UI strings that will be programmatically assigned to XUL elements like <label> and <description>, etc. during run-time. In this situation, one would need to define a <stringbundle> element in the XUL document and set its src attribute to the chrome URL of the .properties file containing the localized UI strings. Then to get the UI string, one would do the following in the JavaScript source:
// Get the <stringbundle> element in the XUL document
var strBundle = document.getElementsByTagName("stringbundle").item(0);

// Get the UI string
var theString = strBundle.getString("foobar");
The variable theString will then contain the localized string defined in the XUL document.

A problem for which I've discovered a solution only recently is how to embed another string within a localized string. This typically happens when the UI string contains one or more substrings that are only determined at run-time, such as file I/O error messages that gives the name of the file or folder.

Somehow I overlooked a method of the <stringbundle> object that can accomplish what I needed: getFormattedString(). The idea is that the UI string contains placeholders that will be substituted at run-time with another string that is provided in an array parameter. Each nth element in the array parameter corresponds to the nth placeholder in the string -- basically, the same idea in the C library function printf().

After reading the documentation on XULPlanet, I tried it out. I modified the UI string that defines the error message that appears if the user attempts to import an invalid Clippings file:
alertImportFailed = Cannot read file: \"%s\"\nThe selected file may not be a valid Clippings file.
Then in clippings.js, which contains Clippings Manager's UI logic, I modified the code that gets the error message as follows:
// gStrBundle is a global variable referencing the <stringbundle> element defined in clippings.xul
// path contains the full path of the file the user attempted to import
var err = gStrBundle.getFormattedString("alertImportFailed", [path]);
doAlert(err);
But it didn't work: only the first character in path was returned. So I did some searching on Google and came across the documentation on Devmo that indicated that an uppercase "S" is needed in the placeholder.
alertImportFailed = Cannot read file: \"%S\"\nThe selected file may not be a valid Clippings file.
Now it works. Armed with this knowledge, I even made the effort to point this out to a developer who had written a "bug fix" to work around the lowercase "s" problem.

And one other hint on the subject of localizing strings: to embed a non-breaking space in a UI string in a .properties file, use the hexadecimal Unicode escape character \u00A0.

18 October 2007

Musings on Thunderbird's future

Over the summer, it was announced that the Mozilla Thunderbird project would be spun off into a new, separate organizational structure. Then, earlier this month, the lead Thunderbird developer, Scott McGregor, suddenly announced his departure from the Mozilla Corporation. This unexpected announcement was then followed two days later with news from David Bienvenu, another prominent Thunderbird developer, that he too was leaving.

In their respective blog postings where they briefly announced their resignations, both have stated that they will continue working on the Thunderbird project. Nonetheless I'm skeptical of their ability to retain their focus on the continued development of the Thunderbird email client, especially since they're moving on to other endeavours. With them pursuing their new venture (according to David Ascher's open letter to the Thunderbird community), how could they possibly maintain the same level of effort on Thunderbird like they used to? Unless their new "venture" somehow involves Thunderbird, but very little has been revealed as to what they'll be pursing next.

I've read a lot about these recent events with great interest, and it's interesting to read the speculative reasons for the departures and the negative "doom and gloom"-type predictions; case in point: right now Mozilla Links has a reader survey up, asking if the two key departures signify "the end of Thunderbird." While I can't help but wonder if there is a deeper, undisclosed reason for these two developers leaving, perhaps these departures -- as well as the spin-off from the Mozilla Corp -- is an opportunity for the Thunderbird project to reinvigorate itself with fresh ideas and evolve further from what it is right now.

How? Being the open source project that it is, there are people all over the world either volunteering their time, efforts and talents into the ongoing development and testing of Thunderbird, or are paid to do so by other companies (Red Hat, Google, IBM, et. al.) that hire them to do their work. As long as there is interest and motivation in improving Thunderbird, as well as the number of end users justifying the effort at doing so, there will be people who will be passionate and dedicated enough to step forward and make it so. And with the new, separate organization focusing entirely on the email client, the unavoidable distractions that come with supporting other, non-mail projects should be eliminated.

I admit that Clippings wasn't originally intended to be compatible with Thunderbird; I had designed and coded it with Firefox in mind. As a Thunderbird user, it never struck me as the slick, polished application that Firefox is; even with version 2, I still regard Thunderbird as nothing more than the mail and news component split off from the original Mozilla 1.x suite. But compare that with Firefox... much effort has been put into making it the most user-friendly open source application thus far (although I have heard a lot of good things about Ubuntu...), and Firefox 3 promises to be another great leap forward into making Web browsing even more easier, efficient and fun -- for both end users and developers.

Hopefully we will soon see the same with Thunderbird.