<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mikes Musings &#187; firefox</title>
	<atom:link href="http://mike.kaply.com/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://mike.kaply.com</link>
	<description>Mozilla, money, microformats and more</description>
	<lastBuildDate>Thu, 02 Feb 2012 16:32:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CCK Wizard Beta for Firefox 4</title>
		<link>http://mike.kaply.com/2011/02/17/cck-wizard-beta-for-firefox-4/</link>
		<comments>http://mike.kaply.com/2011/02/17/cck-wizard-beta-for-firefox-4/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 16:43:25 +0000</pubDate>
		<dc:creator>Mike Kaply</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[cck]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://mike.kaply.com/?p=1008</guid>
		<description><![CDATA[Update: Beta 2 available to fix a bug with adding prefs Have you ever needed to customize Firefox for deployment with in your organization or even to your family? That&#8217;s what the CCK Wizard is all about. It allows you to create an add-on that customizes Firefox. You can learn more about what it does [...]]]></description>
			<content:encoded><![CDATA[<p>
Update: <a onclick="InstallTrigger.install({'Rebrand':'http://mike.kaply.com/files/cckwizard-1.3b2.xpi'});" href="#">Beta 2 available to fix a bug with adding prefs</a>
</p>
<p>
Have you ever needed to customize Firefox for deployment with in your organization or even to your family? That&#8217;s what the CCK Wizard is all about. It allows you to create an add-on that customizes Firefox. <a href="https://addons.mozilla.org/firefox/addon/cck/">You can learn more about what it does at addons.mozilla.org</a>.
</p>
<p>
I&#8217;ve recently updated the CCK Wizard for Firefox 4 and have made a beta available. <a onclick="InstallTrigger.install({'Rebrand':'http://mike.kaply.com/files/cckwizard-1.3b2.xpi'});" href="#">You can click here to install it.</a> Once everything looks good with the beta, I&#8217;ll put it on AMO.
</p>
<p>
So what&#8217;s the future of the CCK Wizard?
</p>
<p><span id="more-1008"></span></p>
<p>
The CCK Wizard has always been close to my heart because it was my first add-on. I originally had plans to do some major enhancements to it, but my plate is pretty full with other work. It&#8217;s difficult to find time to work on my free add-ons. I&#8217;ll continue to keep it current with the latest Firefox versions, but going forward, I have no plans to add additional features to the CCK Wizard.
</p>
<p>
If you&#8217;d like to see the CCK Wizard continue, please consider <a href="https://addons.mozilla.org/en-US/firefox/addon/2553/about">contributing</a> or <a href="http://code.google.com/p/ff-cckwizard/">participating in its development at Google code</a>. You could also help out on the documentation side. It would be nice to get some of the docs current and organized:</p>
<ul>
<li><a href="http://www-archive.mozilla.org/projects/cck/firefox/">Old Docs</a></li>
<li><a href="https://wiki.mozilla.org/CCK:Home_Page">Original CCK Docs</a></li>
<li><a href="https://wiki.mozilla.org/CCK">Better place for docs</a></li>
</ul>
<p>
I also want to give a shout out to Rick Alther from IBM who has worked on the code and is keeping the flame alive inside IBM</p>
]]></content:encoded>
			<wfw:commentRss>http://mike.kaply.com/2011/02/17/cck-wizard-beta-for-firefox-4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Running Add-on Code at First Run (and Upgrade)</title>
		<link>http://mike.kaply.com/2011/02/02/running-add-on-code-at-first-run-and-upgrade/</link>
		<comments>http://mike.kaply.com/2011/02/02/running-add-on-code-at-first-run-and-upgrade/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 02:13:55 +0000</pubDate>
		<dc:creator>Mike Kaply</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firstrun]]></category>

		<guid isPermaLink="false">http://mike.kaply.com/?p=937</guid>
		<description><![CDATA[Running code when your add-on is first installed or upgraded is pretty common. You might need to install a toolbar button or display a web page. I&#8217;ve seen a few different ways to do this, so I thought I&#8217;d show how I do it in my add-ons. The best way to demonstrate this is with [...]]]></description>
			<content:encoded><![CDATA[<p>
Running code when your add-on is first installed or upgraded is pretty common. You might need to install a toolbar button or display a web page. I&#8217;ve seen a few different ways to do this, so I thought I&#8217;d show how I do it in my add-ons.
</p>
<p>
The best way to demonstrate this is with some sample code. I&#8217;ll make some comments on at the end.
</p>
<p><span id="more-937"></span></p>
<pre class="brush: jscript; title: ; notranslate">
var firstrun = Services.prefs.getBoolPref(&quot;extensions.YOUREXT.firstrun&quot;);

var curVersion = &quot;0.0.0&quot;;

if (firstrun) {
  Services.prefs.setBoolPref(&quot;extensions.YOUREXT.firstrun&quot;, false);
  Services.prefs.setCharPref(&quot;extensions.YOUREXT.installedVersion&quot;, curVersion);
  /* Code related to firstrun */
} else {
  try {
    var installedVersion = Services.prefs.getCharPref(&quot;extensions.YOUREXT.installedVersion&quot;);
    if (curVersion &gt; installedVersion) {
      Services.prefs.setCharPref(&quot;extensions.YOUREXT.installedVersion&quot;, curVersion);
      /* Code related to upgrade */
    }
  } catch (ex) {
    /* Code related to a reinstall */
  }
}
</pre>
<p>Some comments on the code.</p>
<ul>
<li>I usually put this code in the JS file included in my XUL overlay. I don&#8217;t put it in a module. This makes it much easier to test it, since I can simply reset the preference and open a new window.</li>
<li>I used <a href="https://developer.mozilla.org/en/JavaScript_code_modules/Services.jsm">Services.jsm</a> in this example to make it simple. I don&#8217;t use Services.jsm, I roll my own custom Services file. I&#8217;ll show how in a future post.</li>
<li>During development, I hardcode my version to 0.0.0. In my previous add-ons, I queried the version from the extension manager, but someone pointed out to me that this was a waste of code. Now what I do is parse install.rdf to get the current version and replace 0.0.0 with that version at runtime.</li>
<li>I use a simple comparison for my versions, but if your versions are more complex (involving letters for instance), you should use n<a href="https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIVersionComparator">sIVersionComparator</a>.</li>
<li>There is no need for a try/catch around my call to get the firstrun preference because I put this line in my default preferences file.
<pre class="brush: jscript; title: ; notranslate">
pref(&quot;extensions.YOUREXT.firstrun&quot;, true);
</pre>
</li>
<li>In order to tell when a user has reinstalled my add-on, I remove the installedVersion preference when my add-on is uninstalled. I leave the firstrun preference behind.
</li>
<li>
If you&#8217;re going to display a web page at first run, here&#8217;s how you do it:</p>
<pre class="brush: jscript; title: ; notranslate">
window.setTimeout(function(){
  gBrowser.selectedTab = gBrowser.addTab(&quot;http://example.com&quot;);
}, 1000);
</pre>
<p>I found that if you don&#8217;t use a timeout, the page will intermittently not display.
</li>
</ul>
<p>Hopefully this code is useful to you. Let me know in the comments if you have any suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://mike.kaply.com/2011/02/02/running-add-on-code-at-first-run-and-upgrade/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  mike.kaply.com/tag/firefox/feed/ ) in 0.44807 seconds, on Feb 4th, 2012 at 12:38 am CST. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 4th, 2012 at 1:38 am CST -->
