Permalink
Browse files

auto detect of ppost.jar now works the way it should

  • Loading branch information...
1 parent 7f35612 commit 30ea9b2f7ad8e27313db8155c7e4b02e1a3f1585 @jonasbits committed Feb 20, 2014
Showing with 13 additions and 7 deletions.
  1. +9 −3 chrome/content/pennyPostOptions.js
  2. +4 −4 chrome/content/ppost.js
@@ -86,13 +86,19 @@ function onTestRegEx(){
* Tries to populate the path of ppost.jar automatically
*/
function onDetectStampProgram(){
- var jarpath=getJarPath();
- if(jarpath==''){
+ getJarPath(function(data){
+ var jarpath=data;
+ dialog.ppost.value=jarpath;
+ prefs.setCharPref('extensions.ppost.path', dialog.ppost.value);
+ });
+
+ //var jarpath=getJarPath();
+ /*if(jarpath==''){
alert(gStrBundle.getString("jarpathdetectfail"));
}else{
dialog.ppost.value=jarpath;
prefs.setCharPref('extensions.ppost.path', dialog.ppost.value);
- }
+ }*/
}
/**
View
@@ -35,7 +35,7 @@ var gStampTypes={ UNKNOWN:0,
* Tries to get the path of ppost.jar relative to the extension folder
* This jar is in the lib folder of the extension folder
*/
-function getJarPath(){
+function getJarPath(callback){
try{
var eid = "{3748ced8-ae28-48ac-a954-4bff3360f72d}";
/**var ext = Components.classes["@mozilla.org/extensions/manager;1"]
@@ -49,7 +49,7 @@ function getJarPath(){
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID(eid, function(addon) {
addonLocation = addon.getResourceURI("/lib/ppost.jar").QueryInterface(Components.interfaces.nsIFileURL).file.path;
- alert("Copy this " + addonLocation);
+ callback(addonLocation);
}); //end of AddonManager async call
/*if(!ext.exists()){
throw new Error('ppost.jar not found in '+ext.path);
@@ -59,9 +59,9 @@ function getJarPath(){
}catch(ex){
Components.utils.reportError(ex);
//ignore
- return '';
+ //return '';
}
- return "Copy path from popup dialog";
+ //return "Copy path from popup dialog";
}
/**

0 comments on commit 30ea9b2

Please sign in to comment.