Skip to content
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.

Commit

Permalink
Changing a couple things at once, because that's *always* a good idea.
Browse files Browse the repository at this point in the history
Mostly, re: #28, pass both bookmark-menu-command parameters through to
the original.  And then, if we spot Gecko 14 or higher, use nsIFile
instead of nsILocalFile.
  • Loading branch information
paulroub committed Apr 23, 2012
1 parent 197149d commit 8619f99
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/Makefile
@@ -1,4 +1,4 @@
IEVIEW_VERSION = 1.5.0
IEVIEW_VERSION = 1.5.0.2
LOCALES := en-US da-DK de-AT de-DE fr-FR ko-KR ru-RU zh-TW es-ES it-IT pl-PL nl-NL ca-AD ja-JP pt-PT he-IL sv-SE zh-CN pt-BR cs-CZ fi-FI hu-HU sr-YU tr-TR eu-ES sl-SI bg-BG el-GR hr-HR lt-LT th-TH uk-UA km-KH nb-NO sk-SK es-AR fy-NL sr-RS vi-VN eu
PROPS := $(foreach loc, $(LOCALES), chrome/locale/$(loc)/ieview.properties)
DTDS := $(foreach loc, $(LOCALES), chrome/locale/$(loc)/ieview.dtd)
Expand All @@ -13,10 +13,9 @@ xpi: ieview.xpi
ieview.xpi: chrome.manifest install.rdf \
chrome/content/ieviewOverlay.js chrome/content/ieviewOverlay.xul chrome/content/ieviewsettings.xul \
chrome/content/reloaded.html \
defaults/preferences/ieview.js \
chrome/skin/ieview-button-16px-disabled.png chrome/skin/ieview-button-16px.png chrome/skin/ieview-button-24px-disabled.png chrome/skin/ieview-button-24px.png chrome/skin/ieview-icon.png chrome/skin/ieview-toolbar-button.css \
$(PROPS) $(DTDS)
zip -9urp ieview.xpi chrome.manifest install.rdf chrome defaults
zip -9urp ieview.xpi chrome.manifest install.rdf chrome

manis: chrome.manifest install.rdf

Expand Down
28 changes: 22 additions & 6 deletions src/chrome/content/ieviewOverlay.js
Expand Up @@ -317,14 +317,30 @@ var IeView = {
}
},

fileIFace: function()
{
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);

var platformVer = parseInt(appInfo.platformVersion);

var iface = Components.interfaces.nsILocalFile;

if (platformVer >= 14)
iface = Components.interfaces.nsIFile;

return(iface);
},

searchPath: function(path, fname)
{
var result = null;

var iface = this.fileIFace();

try
{
var f = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
var f = Components.classes['@mozilla.org/file/local;1'].createInstance(iface);

f.initWithPath(path);

Expand All @@ -349,7 +365,7 @@ var IeView = {
{
if (ent.leafName.toLowerCase() == fname.toLowerCase())
{
result = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
result = Components.classes['@mozilla.org/file/local;1'].createInstance(iface);
result.followLinks = true;
result.initWithPath(ent.path);

Expand All @@ -367,7 +383,7 @@ var IeView = {
{
if (ent.leafName.toLowerCase() == fname.toLowerCase())
{
result = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
result = Components.classes['@mozilla.org/file/local;1'].createInstance(iface);
result.initWithPath(ent.path);
break;
}
Expand Down Expand Up @@ -677,7 +693,7 @@ var IeView = {
this.saveIeLoc(natTarget);
}

var targetFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
var targetFile = Components.classes['@mozilla.org/file/local;1'].createInstance( this.fileIFace() );

try
{
Expand Down Expand Up @@ -793,7 +809,7 @@ var IeView = {
{
BookmarksEventHandler.oldBmehOnCommand = BookmarksEventHandler.onCommand;

BookmarksEventHandler.onCommand = function(bmocEvent) {
BookmarksEventHandler.onCommand = function(bmocEvent, placesView) {
var target = bmocEvent.originalTarget;

if (target.node && target.node.uri && IeView.forceIe(target.node.uri))
Expand All @@ -802,7 +818,7 @@ var IeView = {
return;
}

return( BookmarksEventHandler.oldBmehOnCommand(bmocEvent) );
return( BookmarksEventHandler.oldBmehOnCommand(bmocEvent, placesView) );
};
}
},
Expand Down

0 comments on commit 8619f99

Please sign in to comment.