[Pkg-mozext-commits] [automatic-save-folder] 44/133: Add : Added an option to enable or disable right-click function on all right-click menus at once (save link as, save image as, save as) Fix : Fixed a bug when sub-options were auto unchecked visually, but not saved properly when using instantApply feature because the user didn't physically click on it. Affected options were : (on option's tab) - Only if a filter is found - View the list of folders - Remove the timing delay Changes : - Few code optimization and variable's names harmonization. - Added a space character instead of an empty string over the Filter tab's buttons (up, down, add, remove) to work correctly with Babelzilla.

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch wip
in repository automatic-save-folder.

commit fc340ebec4940215e734215bbe357b34ab4bd4bc
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Fri Jan 15 23:33:24 2010 +0000

    Add :
      Added an option to enable or disable right-click function on all right-click
      menus at once (save link as, save image as, save as)
    Fix :
      Fixed a bug when sub-options were auto unchecked visually, but not saved
      properly when using instantApply feature because the user didn't physically
      click on it.
      Affected options were : (on option's tab)
        - Only if a filter is found
        - View the list of folders
        - Remove the timing delay
    Changes :
      - Few code optimization and variable's names harmonization.
      - Added a space character instead of an empty string over the Filter tab's
        buttons (up, down, add, remove) to work correctly with Babelzilla.
    
    
    I think I'll add new languages files to svn when babelzilla will be working with linefeed.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@44 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf.js              |  74 ++++++++--
 content/asf_right_click.js  | 350 ++++++++++++++++++++++----------------------
 content/options.xul         |  19 ++-
 defaults/preferences/asf.js |   3 +-
 locale/en-US/asf.dtd        |  20 +--
 locale/fr-FR/asf.dtd        |  20 +--
 6 files changed, 272 insertions(+), 214 deletions(-)

diff --git a/content/asf.js b/content/asf.js
index f126a6c..532aac7 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -211,12 +211,15 @@ var automatic_save_folder = {
 	
 	
 	toggle_options: function () {  // called whenever the Options tab is selected
+		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
 		var viewdloption = document.getElementById("asf-viewdloption");
 		var viewpathlist = document.getElementById("asf-viewpathselect");
 		var dialogaccept = document.getElementById("asf-dialogaccept");
 		var dialogacceptFiltered = document.getElementById("asf-dialogacceptFiltered");
 		var useDownloadDir = document.getElementById("asf-useDownloadDir");
-		
+		var asf_userightclick = document.getElementById("asf-userightclick");
+		var asf_rightclicktimeout = document.getElementById("asf-rightclicktimeout");
+				
 		// check if autosave is selected, if not : set the saving path to "filtered" and disable the dropdown menu.
 		if (useDownloadDir.checked == false)
 		{
@@ -260,6 +263,16 @@ var automatic_save_folder = {
 			viewpathlist.disabled = false;
 		}
 			
+		// set the sub-rightclick option to grey state
+		if (asf_userightclick.checked == false)
+		{
+			asf_rightclicktimeout.disabled = true;
+		}
+		if (asf_userightclick.checked == true)
+		{
+			asf_rightclicktimeout.disabled = false;
+		}
+			
 		// Check the right-click feature here, and prints text according to Firefox version and active addons
 		// hide all the descriptions box, and unhide the needed one 
 		document.getElementById("asf-rightclickdesc-ff2").hidden = true;     // Firefox 2, Right-click disabled message
@@ -268,37 +281,65 @@ var automatic_save_folder = {
 		
 		if (this.firefoxversion == 2)
 		{
-			document.getElementById("asf-rightclick").hidden = true;          // Hide the right-click checkbox
-			document.getElementById("asf-rightclickdesc").hidden = true;      // Hide the right-click description
+			document.getElementById("asf-userightclick").hidden = true;       // Hide the right-click checkbox
+			document.getElementById("asf-rightclicktimeout").hidden = true;   // Hide the right-click timeout checkbox
 			document.getElementById("asf-rightclickdesc-ff2").hidden = false; // Show right-click not working on Firefox 2.0
 		}
 		if (this.firefoxversion == 3)
 		{
 			if (Dsort_installed) // if Download sort is installed, display a message "right click disabled"
 			{
-				var asf_rightclick = document.getElementById("asf-rightclick");
-				asf_rightclick.disabled = true;
+
+				asf_userightclick.disabled = true;
+				asf_rightclicktimeout.disabled = true;
 				
-				document.getElementById("asf-rightclickdesc").hidden = true;
 				document.getElementById("asf-rightclickdesc-DSort").hidden = false;
 			}
 		}
 		
+		if (instantApply) // bug with sub-options status set by javascript
+		{
+			this.asf_saveoptions();
+		}
 	},
 	
 	
-	toggle_rightclick: function () {
+	toggle_userightclick: function () {
 		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
+		var asf_userightclick = document.getElementById("asf-userightclick");
+		var asf_rightclicktimeout = document.getElementById("asf-rightclicktimeout");
 		
-		if (instantApply)
+		// set the sub-rightclick option to grey state
+		if (asf_userightclick.checked == false)
 		{
-		var status = document.getElementById("asf-rightclick").checked;
-		this.prefManager.setIntPref("browser.download.saveLinkAsFilenameTimeout", status == true ? 0 : 1000 );
+			asf_rightclicktimeout.checked = false;
+			asf_rightclicktimeout.disabled = true;
+		}
+		if (asf_userightclick.checked == true)
+		{
+			asf_rightclicktimeout.disabled = false;
+			asf_rightclicktimeout.checked = true;
+		}
+		
+		if (instantApply) // bug with sub-options status set by javascript
+		{
+			this.asf_saveoptions();
 		}
 
 	},
 	
 	
+	toggle_rightclicktimeout: function () {
+		var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
+		
+		if (instantApply)
+		{
+			var asf_rightclicktimeout = document.getElementById("asf-rightclicktimeout").checked;
+			this.prefManager.setIntPref("browser.download.saveLinkAsFilenameTimeout", asf_rightclicktimeout == true ? 0 : 1000 );
+		}
+	},
+	
+	
    asf_selecttab: function(tabID) {
 	  
 	  // Use this system for tab, because css for tab is not the same color as config window color, and I don't want to force any color by default so user can use new firefox theme's colors.
@@ -650,15 +691,22 @@ var automatic_save_folder = {
 		var Dsort_installed = this.DownloadSort();		
 		if ((Dsort_installed == false) && this.firefoxversion == 3) // only for firefox 3, Firefox2 doesn't use timeout option
 		{
-			var rightclick = document.getElementById("asf-rightclick").checked;
-			this.prefManager.setIntPref("browser.download.saveLinkAsFilenameTimeout", rightclick == true ? 0 : 1000);
+			var asf_rightclicktimeout = document.getElementById("asf-rightclicktimeout").checked;
+			this.prefManager.setIntPref("browser.download.saveLinkAsFilenameTimeout", asf_rightclicktimeout == true ? 0 : 1000);
 		}
 
-		
 		//save the default folder (filters tab)
 		var default_folder = document.getElementById("asf-default-folder").value;
 		this.saveUnicodeString("extensions.asf.defaultfolder", default_folder);	
 
+		
+		// bug from both instantApply and non instantApply, when changing checked state with javascript the state is not saved
+		// so for all the sub-option, let's save manually :
+		this.prefManager.setBoolPref("extensions.asf.viewpathselect", document.getElementById("asf-viewpathselect").checked);
+		this.prefManager.setBoolPref("extensions.asf.rightclicktimeout", document.getElementById("asf-rightclicktimeout").checked);
+		this.prefManager.setBoolPref("extensions.asf.dialogacceptFiltered", document.getElementById("asf-dialogacceptFiltered").checked);
+		
+		
 	},
 	
 	
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index 1f50e09..0a9cf7e 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -42,12 +42,10 @@ var automatic_save_folder = {
 			// Right-click feature doesn't work on Firefox 2 (Can't detect installed add-on and prevent conflict with Download Sort)
 			if (this.versionChecker.compare(this.appInfo.version, "3.0") >= 0)
 			{
-				var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
-					
 				//replace original Rightclick menu with ASF Rightclick menu
 				// Not compatible with Download Sort extension (same function modification, it will conflict).
 				// Detect if Download Sort is installed and enabled, and activate ASF rightclick only if DSort is not already loaded.
-				var enabledItems = prefs.getCharPref("extensions.enabledItems");
+				var enabledItems = this.prefManager.getCharPref("extensions.enabledItems");
 				var dsort_GUUID = "{D9808C4D-1CF5-4f67-8DB2-12CF78BBA23F}";
 				var DownloadSort = enabledItems.indexOf(dsort_GUUID,0);
 				
@@ -65,17 +63,15 @@ var automatic_save_folder = {
 					// replace the ORIGinal firefox function with the custom one. (original from Firefox 3.5.4) 
 					window.getTargetFile = this.asf_getTargetFile;
 					
-					if (this.versionChecker.compare(this.appInfo.version, "3.0") >= 0)
-					{
-						// Starting from firefox 3.0 there is a timeout when downloading with right-click to read header(Content-Disposition:) to rename the file in the file_explorer suggested filename.
-						// When timeout is set to 1000 ms (default), ASF right-click filtering is not working.
-						// When timeout is set to 0ms, ASF right-click filtering is working, but header renaming is not working anymore.
-						// And when set to ~8ms, Header renaming is working but ASF is filtering on the previous filename (before the renaming).
-						
-						// Set to 0 only when the user want to use it
-						var asf_rightclick = prefs.getBoolPref("extensions.asf.rightclick");
-						prefs.setIntPref("browser.download.saveLinkAsFilenameTimeout", asf_rightclick == true ? 0 : 1000);
-					}
+					// Starting from firefox 3.0 there is a timeout when downloading with right-click to read header(Content-Disposition:) to rename the file in the file_explorer suggested filename.
+					// When timeout is set to 1000 ms (default), ASF right-click filtering is not working.
+					// When timeout is set to 0ms, ASF right-click filtering is working, but header renaming is not working anymore.
+					// And when set to ~8ms, Header renaming is working but ASF is filtering on the previous filename (before the renaming).
+					
+					// Set to 0 only when the user want to use it
+					var asf_rightclicktimeout = this.prefManager.getBoolPref("extensions.asf.rightclicktimeout");
+					this.prefManager.setIntPref("browser.download.saveLinkAsFilenameTimeout", asf_rightclicktimeout == true ? 0 : 1000);
+					
 				}
 			}
 		}
@@ -227,139 +223,161 @@ var automatic_save_folder = {
 	
 	rightclick_main: function(aFpP) {
 		
-		//alert ("debug full uri : "+aFpP.fileInfo.uri.spec);
-		//alert("ok");
-		
-		// Setting private variables usable in this function
-		var prefManager = this.prefManager;		
-		var versionChecker = this.versionChecker;
-		var appInfo = this.appInfo;
-		
-		if(this.versionChecker.compare(this.appInfo.version, "3.0") >= 0) 
+		//check if the rightclick filtering is enabled
+		var userightclick = this.prefManager.getBoolPref("extensions.asf.userightclick");
+		if (userightclick)
 		{
-			this.firefoxversion = "3";
-		}
-		else 
-		{
-			this.firefoxversion = "2";
-		}
-		
-		
-		// Check if there is any filter in list
-		var nbrfilters = 	prefManager.getIntPref("extensions.asf.filtersNumber");		
+			//alert ("debug full uri : "+aFpP.fileInfo.uri.spec);
+			//alert("ok");
 			
+			// Setting private variables usable in this function
+			var prefManager = this.prefManager;		
+			var versionChecker = this.versionChecker;
+			var appInfo = this.appInfo;
 			
-		// load the domain and the filename of the saved file (copy the data from the firefox saving window)
-		// var domain = 		document.getElementById("source").value ;
-		// var filename = 		document.getElementById("location").value ;
-		
-		try 
-		{
-			var domain = aFpP.fileInfo.uri.scheme+"://"+aFpP.fileInfo.uri.host ;
-		}
-		catch(e) // If the saved data is not from an URL, use the current website URL (example : Abduction! add-on screenshot function saving the current page into image)
-		{ 
-			var domain = document.getElementById("urlbar").value; 
-			domain = domain.match(/^(.*?:\/\/)?.*?[^\/]+/);
-			domain = domain[0];
-		} 
-		var filename = aFpP.fileInfo.fileName
-		
-		// For Ctrl+S, if pagename.ext is not on the URL document.title is used as filename, add .htm to the filename
-		var page_title = document.title.replace(" - Mozilla Firefox", "");
-		if (filename == page_title) filename = filename+".htm";
-		
-		
-		// load prefmanager data
-		var savetype = 			prefManager.getIntPref("extensions.asf.savetype");	
-		var lastdir = 			prefManager.getBoolPref("extensions.asf.lastdir");	
-		var defaultfolder = 	this.loadUnicodeString("extensions.asf.defaultfolder");		
-		var keeptemp = 			prefManager.getBoolPref("extensions.asf.keeptemp");
-		var tempdomain = 		this.loadUnicodeString("extensions.asf.tempdomain");
-		var variable_mode = 	prefManager.getBoolPref("extensions.asf.variablemode");
-		var dialogaccept = 		prefManager.getBoolPref("extensions.asf.dialogaccept");	
-		var use_currentURL = 	prefManager.getBoolPref("extensions.asf.usecurrenturl");	
-		
-		// If variable/Dynamic folders mode is ON, let's check the variables and replace to create the new defaultfolder
-		if (variable_mode == true) 
-		{
-			defaultfolder = this.createfolder(aFpP, defaultfolder);
-		}
-		
-		// set the last folder path used into asf.lastpath
-		if (this.firefoxversion == "3")   // take the download.lastDir if it's FF3
-		{
-			var folder = this.loadUnicodeString("browser.download.lastDir");
-		}
-		else // else if it's not FF3 (it's 1.5 or 2), read Download.dir
-		{
-			var folder = this.loadUnicodeString("browser.download.dir");
-		}
-		this.saveUnicodeString("extensions.asf.lastpath", folder); // And set it to asf.lastpath to be compared later with the new path the filters will set to lastDir (or dir)
+			if(this.versionChecker.compare(this.appInfo.version, "3.0") >= 0) 
+			{
+				this.firefoxversion = "3";
+			}
+			else 
+			{
+				this.firefoxversion = "2";
+			}
+			
+			
+			// Check if there is any filter in list
+			var nbrfilters = 	prefManager.getIntPref("extensions.asf.filtersNumber");		
+				
+				
+			// load the domain and the filename of the saved file (copy the data from the firefox saving window)
+			// var domain = 		document.getElementById("source").value ;
+			// var filename = 		document.getElementById("location").value ;
+			
+			try 
+			{
+				var domain = aFpP.fileInfo.uri.scheme+"://"+aFpP.fileInfo.uri.host ;
+			}
+			catch(e) // If the saved data is not from an URL, use the current website URL (example : Abduction! add-on screenshot function saving the current page into image)
+			{ 
+				var domain = document.getElementById("urlbar").value; 
+				domain = domain.match(/^(.*?:\/\/)?.*?[^\/]+/);
+				domain = domain[0];
+			} 
+			var filename = aFpP.fileInfo.fileName
+			
+			// For Ctrl+S, if pagename.ext is not on the URL document.title is used as filename, add .htm to the filename
+			var page_title = document.title.replace(" - Mozilla Firefox", "");
+			if (filename == page_title) filename = filename+".htm";
+			
+			
+			// load prefmanager data
+			var savetype = 			prefManager.getIntPref("extensions.asf.savetype");	
+			var lastdir = 			prefManager.getBoolPref("extensions.asf.lastdir");	
+			var defaultfolder = 	this.loadUnicodeString("extensions.asf.defaultfolder");		
+			var keeptemp = 			prefManager.getBoolPref("extensions.asf.keeptemp");
+			var tempdomain = 		this.loadUnicodeString("extensions.asf.tempdomain");
+			var variable_mode = 	prefManager.getBoolPref("extensions.asf.variablemode");
+			var dialogaccept = 		prefManager.getBoolPref("extensions.asf.dialogaccept");	
+			var use_currentURL = 	prefManager.getBoolPref("extensions.asf.usecurrenturl");	
+			
+			// If variable/Dynamic folders mode is ON, let's check the variables and replace to create the new defaultfolder
+			if (variable_mode == true) 
+			{
+				defaultfolder = this.createfolder(aFpP, defaultfolder);
+			}
+			
+			// set the last folder path used into asf.lastpath
+			if (this.firefoxversion == "3")   // take the download.lastDir if it's FF3
+			{
+				var folder = this.loadUnicodeString("browser.download.lastDir");
+			}
+			else // else if it's not FF3 (it's 1.5 or 2), read Download.dir
+			{
+				var folder = this.loadUnicodeString("browser.download.dir");
+			}
+			this.saveUnicodeString("extensions.asf.lastpath", folder); // And set it to asf.lastpath to be compared later with the new path the filters will set to lastDir (or dir)
 
-		
-		// load filters data from prefmanager into filters[]
-		// filters[filternumber][label]		
-		var filters = new Array();
-		for ( var i = 0 ; i < nbrfilters ; i++)
-		{
-			var dom = this.loadUnicodeString("extensions.asf.filters"+ i +".domain");
-			var fil = this.loadUnicodeString("extensions.asf.filters"+ i +".filename");		
-			var fol = this.loadUnicodeString("extensions.asf.filters"+ i +".folder");		
-			var act = prefManager.getBoolPref("extensions.asf.filters"+ i +".active");	
-			filters[i] = [dom, fil, fol, act];
-		}	
-		
-		
-		// 
-		// Start checking the filters with the downloaded file
-		//
-		var idx = -1 ;
-		var dom_regexp = false;
-		var file_regexp = false;
-		for ( var i = 0 ; i < filters.length ; i++)
-		{		
-			if (filters[i][3] == true)  // if not temporary deactivated
+			
+			// load filters data from prefmanager into filters[]
+			// filters[filternumber][label]		
+			var filters = new Array();
+			for ( var i = 0 ; i < nbrfilters ; i++)
+			{
+				var dom = this.loadUnicodeString("extensions.asf.filters"+ i +".domain");
+				var fil = this.loadUnicodeString("extensions.asf.filters"+ i +".filename");		
+				var fol = this.loadUnicodeString("extensions.asf.filters"+ i +".folder");		
+				var act = prefManager.getBoolPref("extensions.asf.filters"+ i +".active");	
+				filters[i] = [dom, fil, fol, act];
+			}	
+			
+			
+			// 
+			// Start checking the filters with the downloaded file
+			//
+			var idx = -1 ;
+			var dom_regexp = false;
+			var file_regexp = false;
+			for ( var i = 0 ; i < filters.length ; i++)
 			{		
-				dom_regexp = false ; // reset the matching string for the "for" loop
-				file_regexp = false ; // same as above
-			// Check the domain	
-				dom_regexp = this.test_regexp(filters[i][0], domain);  // hosted Domain
-				
-			// Check the current website URL if hosted domain checking returned false.
-				if (!dom_regexp && use_currentURL)
-				{
+				if (filters[i][3] == true)  // if not temporary deactivated
+				{		
+					dom_regexp = false ; // reset the matching string for the "for" loop
+					file_regexp = false ; // same as above
+				// Check the domain	
+					dom_regexp = this.test_regexp(filters[i][0], domain);  // hosted Domain
 					
-					try
+				// Check the current website URL if hosted domain checking returned false.
+					if (!dom_regexp && use_currentURL)
 					{
-						var currentURL = document.getElementById("urlbar").value;
-						dom_regexp = this.test_regexp(filters[i][0], currentURL); // check the filter domain with the current website URL only if the hosted domain doesn't match
+						
+						try
+						{
+							var currentURL = document.getElementById("urlbar").value;
+							dom_regexp = this.test_regexp(filters[i][0], currentURL); // check the filter domain with the current website URL only if the hosted domain doesn't match
+						}
+						catch (e) { } // if there is no location.host data (tab is closed or script redirection), use the default folder as there are no filter's domain or current URL domain. 
 					}
-					catch (e) { } // if there is no location.host data (tab is closed or script redirection), use the default folder as there are no filter's domain or current URL domain. 
+					
+				// Check the filename	
+					file_regexp = this.test_regexp(filters[i][1], filename); // Filename
+					
+					// debug
+					// alert ("i = "+i+"\n domain match = "+dom_regexp+"\n file match = "+file_regexp);
+					if (dom_regexp && file_regexp)
+					{
+						var idx = i;
+						break;
+					}			
 				}
-				
-			// Check the filename	
-				file_regexp = this.test_regexp(filters[i][1], filename); // Filename
-				
-				// debug
-				// alert ("i = "+i+"\n domain match = "+dom_regexp+"\n file match = "+file_regexp);
-				if (dom_regexp && file_regexp)
-				{
-					var idx = i;
-					break;
-				}			
-			}
-		} // end filters loop
-		
-		if (idx < 0) // if no filters matched
-		{
-			if(savetype == 1)  // and folder is set to user choice
+			} // end filters loop
+			
+			if (idx < 0) // if no filters matched
 			{
-				if ( (keeptemp == false) || ((keeptemp == true) && ( tempdomain != domain )) ) // and, if [same domain not checked] OR [ if same domain (keeptemp) is checked and domain not same as previous one]
-				{	// then change the destination folder to user choice
-					this.set_savepath(defaultfolder);
-				}	
-				else  // else, if domain is the same as the last, and the user checked "use the same folder if same domain"
+				if(savetype == 1)  // and folder is set to user choice
+				{
+					if ( (keeptemp == false) || ((keeptemp == true) && ( tempdomain != domain )) ) // and, if [same domain not checked] OR [ if same domain (keeptemp) is checked and domain not same as previous one]
+					{	// then change the destination folder to user choice
+						this.set_savepath(defaultfolder);
+					}	
+					else  // else, if domain is the same as the last, and the user checked "use the same folder if same domain"
+					{
+						if (this.firefoxversion == "3")
+						{
+							var lastpath = this.loadUnicodeString("browser.download.lastDir");
+						}
+						if (this.firefoxversion == "2")
+						{
+							var lastpath = this.loadUnicodeString("browser.download.dir");
+						}
+						
+						if (lastpath == "") // if no path is returned (first time using lastDir, or the user reseted the content manually in about:config)
+						{
+							lastpath = defaultfolder;
+						}
+						this.set_savepath(lastpath);
+					}
+				}
+				else // else, if savetype == 0  (folder is set to last folder)
 				{
 					if (this.firefoxversion == "3")
 					{
@@ -377,54 +395,36 @@ var automatic_save_folder = {
 					this.set_savepath(lastpath);
 				}
 			}
-			else // else, if savetype == 0  (folder is set to last folder)
+			else // if a filter is found 
 			{
-				if (this.firefoxversion == "3")
-				{
-					var lastpath = this.loadUnicodeString("browser.download.lastDir");
-				}
-				if (this.firefoxversion == "2")
-				{
-					var lastpath = this.loadUnicodeString("browser.download.dir");
-				}
+				var folder = filters[idx][2];
 				
-				if (lastpath == "") // if no path is returned (first time using lastDir, or the user reseted the content manually in about:config)
+				// If Advanced mode is ON, let's check the variables and create the folder
+				if (variable_mode == true) 
 				{
-					lastpath = defaultfolder;
+					folder = this.createfolder(aFpP, folder, idx);
 				}
-				this.set_savepath(lastpath);
+				
+				this.set_savepath(folder);
 			}
-		}
-		else // if a filter is found 
-		{
-			var folder = filters[idx][2];
 			
-			// If Advanced mode is ON, let's check the variables and create the folder
-			if (variable_mode == true) 
+			// in every case, set the new file hosted domain to tempdomain if not in private browsing
+			var inPrivateBrowsing = false;
+			if (this.firefoxversion == 3)
 			{
-				folder = this.createfolder(aFpP, folder, idx);
-			}
-			
-			this.set_savepath(folder);
-		}
-		
-		// in every case, set the new file hosted domain to tempdomain if not in private browsing
-		var inPrivateBrowsing = false;
-		if (this.firefoxversion == 3)
-		{
-			try {
-				var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
-									.getService(Components.interfaces.nsIPrivateBrowsingService);
-				inPrivateBrowsing = pbs.privateBrowsingEnabled;
+				try {
+					var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
+										.getService(Components.interfaces.nsIPrivateBrowsingService);
+					inPrivateBrowsing = pbs.privateBrowsingEnabled;
+				}
+				catch (e) { // nsIPrivateBrowsingService not working on FF2 and 3.0
+				}
 			}
-			catch (e) { // nsIPrivateBrowsingService not working on FF2 and 3.0
+			if (!inPrivateBrowsing)
+			{
+				this.saveUnicodeString("extensions.asf.tempdomain", domain);
 			}
 		}
-		if (!inPrivateBrowsing)
-		{
-			this.saveUnicodeString("extensions.asf.tempdomain", domain);
-		}
-		
 		
 	},
 	
diff --git a/content/options.xul b/content/options.xul
index 9178be1..277d49e 100644
--- a/content/options.xul
+++ b/content/options.xul
@@ -32,7 +32,8 @@
 		<preference id="asf_variablemode" name="extensions.asf.variablemode" type="bool"/>
 		<preference id="asf_dialogaccept" name="extensions.asf.dialogaccept" type="bool"/>
 		<preference id="asf_dialogacceptFiltered" name="extensions.asf.dialogacceptFiltered" type="bool"/>
-		<preference id="asf_rightclick" name="extensions.asf.rightclick" type="bool"/>
+		<preference id="asf_userightclick" name="extensions.asf.userightclick" type="bool"/>
+		<preference id="asf_rightclicktimeout" name="extensions.asf.rightclicktimeout" type="bool"/>
 		<preference id="asf_usecurrenturl" name="extensions.asf.usecurrenturl" type="bool"/>
 		<preference id="asf_useDownloadDir" name="browser.download.useDownloadDir" type="bool"/>
 		<preference id="asf_folderList" name="browser.download.folderList" type="int"/>
@@ -52,10 +53,14 @@
 	<tooltip id="tooltip_viewpathselect" style="background-color: #33DD00;" noautohide="true">
 		<description value="&asf.viewpathselect.tooltip;"/>
 	</tooltip>
-	<tooltip id="tooltip_rightclick" orient="vertical" style="background-color: #33DD00;" noautohide="true">
-		<description value="&asf.rightclick.tooltip1;"/>
-		<description value="&asf.rightclick.tooltip2;"/>
-		<description value="&asf.rightclick.tooltip3;"/>
+	<tooltip id="tooltip_userightclick" orient="vertical" style="background-color: #33DD00;" noautohide="true">
+		<description value="&asf.userightclick.tooltip;"/>
+	</tooltip>
+	<tooltip id="tooltip_rightclicktimeout" orient="vertical" style="background-color: #33DD00;" noautohide="true">
+		<description value="&asf.rightclicktimeout.tooltip1;"/>
+		<description value="&asf.rightclicktimeout.tooltip2;"/>
+		<description value="&asf.rightclicktimeout.tooltip3;"/>
+		<description value="&asf.rightclicktimeout.tooltip4;"/>
 	</tooltip>
 	<tooltip id="tooltip_variablemode" orient="vertical" style="background-color: #33DD00;" noautohide="true">
 		<description value="&asf.variablemode.tooltip1;"/>
@@ -154,8 +159,8 @@
 			<checkbox id="asf-usecurrenturl" preference="asf_usecurrenturl" label="&asf.usecurrenturl.bool;"/>
 			<checkbox id="asf-lasdir" preference="asf_lastdir" label="&asf.lastdir.bool;"/>
 			<separator class="thin"/>
-			<checkbox id="asf-rightclick" preference="asf_rightclick" label="&asf.rightclick.bool;" tooltip="tooltip_rightclick" oncommand="automatic_save_folder.toggle_rightclick();"/>
-			<description id="asf-rightclickdesc" style="margin-left:25px;white-space: pre-wrap;">&asf.rightclick.label;</description>
+			<checkbox id="asf-userightclick" preference="asf_userightclick" label="&asf.userightclick.bool;" tooltip="tooltip_userightclick" oncommand="automatic_save_folder.toggle_userightclick();"/>
+			<checkbox id="asf-rightclicktimeout" preference="asf_rightclicktimeout" label="&asf.rightclicktimeout.bool;" tooltip="tooltip_rightclicktimeout" style="margin-left:25px;" oncommand="automatic_save_folder.toggle_rightclicktimeout();"/>
 			<description id="asf-rightclickdesc-DSort" style="margin-left:25px;white-space:pre-wrap;color:red;">&asf.rightclick.DSort.label;</description>
 			<description id="asf-rightclickdesc-ff2" style="margin-left:25px;white-space:pre-wrap;color:red;">&asf.rightclick.ff2.label;</description>
 		</groupbox>
diff --git a/defaults/preferences/asf.js b/defaults/preferences/asf.js
index 4a35c45..8a6ceee 100644
--- a/defaults/preferences/asf.js
+++ b/defaults/preferences/asf.js
@@ -16,6 +16,7 @@ pref("extensions.asf at mangaheart.org.description", "chrome://asf/locale/asf.prope
  pref("browser.download.folderList", 2);
  pref("extensions.asf.dialogaccept", false);
  pref("extensions.asf.dialogacceptFiltered", false);
- pref("extensions.asf.rightclick", true);
+ pref("extensions.asf.userightclick", true);
+ pref("extensions.asf.rightclicktimeout", true);
  pref("browser.download.saveLinkAsFilenameTimeout", 0); // set the default value to userpref.js to prevent main pref.js modification and restore default value on ASF uninstall.
  pref("extensions.asf.usecurrenturl", false);
\ No newline at end of file
diff --git a/locale/en-US/asf.dtd b/locale/en-US/asf.dtd
index ec6c42e..543bcdb 100644
--- a/locale/en-US/asf.dtd
+++ b/locale/en-US/asf.dtd
@@ -13,11 +13,11 @@
 <!ENTITY asf.tree.column.filename "File name">
 <!ENTITY asf.tree.column.localfolder "Local folder">
 <!ENTITY asf.tree.column.enabled "Active">
-<!ENTITY asf.options.move.up "">
-<!ENTITY asf.options.move.down "">
+<!ENTITY asf.options.move.up " ">
+<!ENTITY asf.options.move.down " ">
 <!ENTITY asf.options.edit "Edit">
-<!ENTITY asf.options.delete "">
-<!ENTITY asf.options.add "">
+<!ENTITY asf.options.delete " ">
+<!ENTITY asf.options.add " ">
 
 <!-- Filters tab - bottom -->
 <!ENTITY asf.default.label "If the file doesn't match any filter, save to:">
@@ -48,11 +48,13 @@
 <!ENTITY asf.viewpathselect.tooltip "Activate a drop-down menu with all the filter's path.">
 <!ENTITY asf.usecurrenturl.bool "Use the current website URL to verify the filter's domain if the hosted domain doesn't match.">
 <!ENTITY asf.lastdir.bool "Affect the folder for the 'save as...' command when a filter matches">
-<!ENTITY asf.rightclick.bool "Remove the timing delay and activate the filtering on the right-click menu "Save link as..."">
-<!ENTITY asf.rightclick.label "Note: This option doesn't affect the menus "Save image as..." nor "Save as... (Ctrl+S)".">
-<!ENTITY asf.rightclick.tooltip1 "Note: Removing the timing delay prevent Firefox to read the file's target name if it is from a redirection download.">
-<!ENTITY asf.rightclick.tooltip2 "Temporarily disable this feature if you want Firefox to read the filename provided by the header.">
-<!ENTITY asf.rightclick.tooltip3 "Only files from a download script with file redirection have this problem, saving a file from a direct download using right-click is working fine.">
+<!ENTITY asf.userightclick.bool "Use the filters on the menus">
+<!ENTITY asf.userightclick.tooltip "Enable the filters on the menus "Save link as...", "Save image as..." and "Save as... (Ctrl+S)"">
+<!ENTITY asf.rightclicktimeout.bool "Remove the timing delay and activate the filtering on the right-click menu "Save link as..."">
+<!ENTITY asf.rightclicktimeout.tooltip1 "Removing the timing delay prevent Firefox to read the file's target name if it is from a redirection download, but allow Automatic Save Folder to work.">
+<!ENTITY asf.rightclicktimeout.tooltip2 "Temporarily disable this feature if you want Firefox to read the filename provided by the header (no filter available anymore).">
+<!ENTITY asf.rightclicktimeout.tooltip3 "Only download scripts with file redirection are affected.">
+<!ENTITY asf.rightclicktimeout.tooltip4 "Note: This option doesn't affect the menus "Save image as..." nor "Save as... (Ctrl+S)".">
 <!ENTITY asf.rightclick.ff2.label "The Automatic Save Folder's right-click feature is not available on Firefox 2. If you want to use the filters on your downloads using the right-click menu "Save link as", you should update your Firefox version to 3.0 minimum (recommended version 3.5 or more).">
 <!ENTITY asf.rightclick.DSort.label "Download sort extension has been detected. &#xA;Automatic Save Folder's right-click feature will not work until you disable Download Sort in your Extension manager.">
 
diff --git a/locale/fr-FR/asf.dtd b/locale/fr-FR/asf.dtd
index ba2854a..07fc395 100644
--- a/locale/fr-FR/asf.dtd
+++ b/locale/fr-FR/asf.dtd
@@ -13,11 +13,11 @@
 <!ENTITY asf.tree.column.filename "Nom de fichier">
 <!ENTITY asf.tree.column.localfolder "Dossier local">
 <!ENTITY asf.tree.column.enabled "Actif">
-<!ENTITY asf.options.move.up "">
-<!ENTITY asf.options.move.down "">
+<!ENTITY asf.options.move.up " ">
+<!ENTITY asf.options.move.down " ">
 <!ENTITY asf.options.edit "Éditer">
-<!ENTITY asf.options.delete "">
-<!ENTITY asf.options.add "">
+<!ENTITY asf.options.delete " ">
+<!ENTITY asf.options.add " ">
 
 <!-- Filters tab - bottom -->
 <!ENTITY asf.default.label "Dossier d'enregistrement lorsqu'aucun filtre n'est trouvé :">
@@ -48,11 +48,13 @@
 <!ENTITY asf.viewpathselect.tooltip "Active le menu déroulant contenant le chemin de chaque filtre.">
 <!ENTITY asf.usecurrenturl.bool "Utiliser l'adresse du site courant pour comparer le domaine du filtre si le domaine d'hébergement ne correspond pas.">
 <!ENTITY asf.lastdir.bool "Modifier aussi le dossier d'enregistrement utilisé par le menu 'Enregistrer sous... (Ctrl+S)'">
-<!ENTITY asf.rightclick.bool "Supprimer la temporisation et activer les filtres sur le menu clic-droit "Enregistrer la cible du lien sous...".">
-<!ENTITY asf.rightclick.label "Note : Cette option n'a pas d'effet sur les menus "Enregistrer l'image sous..." ni "Enregistrer sous... (Ctrl+S)".">
-<!ENTITY asf.rightclick.tooltip1 "Note : Supprimer la temporisation empêche Firefox de récupérer le nom du fichier cible lors d'un téléchargement avec redirection.">
-<!ENTITY asf.rightclick.tooltip2 "Désactivez temporairement cette option si vous souhaitez que Firefox lise correctement le nom du fichier fourni par l'entête.">
-<!ENTITY asf.rightclick.tooltip3 "Seuls les scripts de téléchargement avec redirection de fichier ont ce problème, l'enregistrement par clic-droit sur les liens directs fonctionne correctement si la case est cochée.">
+<!ENTITY asf.userightclick.bool "Activer les filtres sur les menus">
+<!ENTITY asf.userightclick.tooltip "Active le filtrage sur les menus "Enregistrer la cible du lien sous...", "Enregistrer l'image sous..." et "Enregistrer sous... (Ctrl+S)"">
+<!ENTITY asf.rightclicktimeout.bool "Supprimer la temporisation et activer les filtres sur le menu clic-droit "Enregistrer la cible du lien sous...".">
+<!ENTITY asf.rightclicktimeout.tooltip1 "Supprimer la temporisation empêche Firefox de lire le nom du fichier cible lors d'un téléchargement avec redirection, mais permet à Automatic Save Folder de fonctionner.">
+<!ENTITY asf.rightclicktimeout.tooltip2 "Désactivez temporairement cette option si vous souhaitez que Firefox lise correctement le nom du fichier fourni par l'entête (plus de filtrage possible).">
+<!ENTITY asf.rightclicktimeout.tooltip3 "Seuls les scripts de téléchargement avec redirection de fichier sont concernés.">
+<!ENTITY asf.rightclicktimeout.tooltip4 "Note : Cette option n'a pas d'effet sur les menus "Enregistrer l'image sous..." ni "Enregistrer sous... (Ctrl+S)".">
 <!ENTITY asf.rightclick.ff2.label "La fonction clic-droit d'automatic save folder n'est pas compatible avec Firefox 2. Si vous souhaitez utiliser les filtres sur les téléchargements en utilisant le menu clic-droit "Enregistrer la cible du lien sous...", vous devrez utiliser au minimum Firefox version 3.0 (Version 3.5 ou plus conseillée).">
 <!ENTITY asf.rightclick.DSort.label "L'extension Download Sort à été détectée. &#xA;La fonction clic-droit d'Automatic Save Folder est temporairement indisponible. Désactivez l'extension Download Sort dans le menu "Outils/Modules complémentaires..." afin de pouvoir utiliser le clic-droit avec Automatic Save Folder.">
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/automatic-save-folder.git



More information about the Pkg-mozext-commits mailing list