[Pkg-mozext-commits] [automatic-save-folder] 74/133: Fix : Fixed the Drag&drop on Firefox 4.* Add : Added the Drag&Drop Copy method (ie. drag+CTRL on windows)

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:54 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 88a373749a2a0ca8457d50be8229bda09b5046d2
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Sat Jul 10 15:29:03 2010 +0000

    Fix : Fixed the Drag&drop on Firefox 4.*
    Add : Added the Drag&Drop Copy method (ie. drag+CTRL on windows)
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@80 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf.js         | 66 ++++++++++++++++++++++++++++++++++++++------------
 content/common.dtd     |  2 +-
 content/options.xul    |  2 +-
 locale/en-US/about.dtd |  1 +
 locale/fr/about.dtd    |  1 +
 locale/it/about.dtd    |  1 +
 locale/ru/about.dtd    |  1 +
 skin/style.css         | 13 +++++++++-
 8 files changed, 68 insertions(+), 19 deletions(-)

diff --git a/content/asf.js b/content/asf.js
index c0b407c..9171dcd 100644
--- a/content/asf.js
+++ b/content/asf.js
@@ -656,6 +656,8 @@ var automatic_save_folder = {
 		
 		//event.dataTransfer.setData('application/x-moz-node', currentitem);  // send node data
 		event.dataTransfer.setData('user/define', idx);  // send index data as text (but to prevent drop on text field, let's use custom set)
+		event.dataTransfer.effectAllowed = "move copy";
+		event.dataTransfer.dropEffect = "move copy";
 	},
 
 
@@ -665,8 +667,28 @@ var automatic_save_folder = {
 		if (isDefine)
 		{
 			event.preventDefault();
-			event.dataTransfer.effectAllowed = "move";
-			event.dataTransfer.dropEffect = "move";
+			event.dataTransfer.effectAllowed = "move copy";
+			event.dataTransfer.dropEffect = "move copy";
+			
+			// Show target indicator
+			if (event.dataTransfer.dropEffect == "copy")
+			{
+				var treename = "asf-filterList";
+				var tree = document.getElementById(treename);
+				var targetitem_idx = tree.treeBoxObject.getRowAt(event.pageX, event.pageY);
+				var maxidx = tree.view.rowCount;
+				if (targetitem_idx == -1) targetitem_idx = maxidx-1;
+				
+				var currentitem = tree.treeBoxObject.view.getItemAtIndex(targetitem_idx);
+				var parent = currentitem.parentNode;
+				
+				for (var i = 0; i < maxidx; i++)
+				{
+					tree.view.getItemAtIndex(i).firstChild.setAttribute('properties', "FilterDragCopy_remove");
+				}
+				
+				currentitem.firstChild.setAttribute('properties', "FilterDragCopy_set");
+			}
 		}
 	},
 
@@ -681,25 +703,37 @@ var automatic_save_folder = {
 			var tree = document.getElementById(treename);
 			var currentitem = tree.treeBoxObject.view.getItemAtIndex(currentitem_idx);
 			
-			try 
+			var targetitem_idx = tree.treeBoxObject.getRowAt(event.pageX, event.pageY);
+			var maxidx = tree.view.rowCount;
+			if (targetitem_idx == -1) targetitem_idx = maxidx-1;
+			var targetitem = tree.treeBoxObject.view.getItemAtIndex(targetitem_idx);
+			var parent = targetitem.parentNode;
+			
+			if (event.dataTransfer.dropEffect == "move")
 			{
-				var targetitem_idx = tree.treeBoxObject.getRowAt(event.pageX, event.pageY);
-				var targetitem = tree.treeBoxObject.view.getItemAtIndex(targetitem_idx);
-				var parent = targetitem.parentNode;		
-				
 				if (currentitem_idx > targetitem_idx) parent.insertBefore(currentitem, targetitem);
 				if (currentitem_idx < targetitem_idx) parent.insertBefore(currentitem, targetitem.nextSibling);
 				tree.view.selection.select(targetitem_idx); // reselect the moved filter
+			}
+			if (event.dataTransfer.dropEffect == "copy")
+			{
+				parent.appendChild(currentitem.cloneNode(true))
+				var last_idx = parent.childNodes.length-1; // select the last index (newly created item)
+				currentitem = tree.treeBoxObject.view.getItemAtIndex(last_idx);
 				
-				// Now check is the user has InstantApply option to save the filter's order.
-				var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
-				if (instantApply)
-				{
-					//save the filters
-					this.asf_savefilters();
-				}
+				parent.insertBefore(currentitem, targetitem);
+				tree.view.selection.select(targetitem_idx); // reselect the duplicated filter
+				
+				tree.view.getItemAtIndex(targetitem_idx+1).firstChild.setAttribute('properties', "FilterDragCopy_remove");
+			}
+			
+			// Now check is the user has InstantApply option to save the filter's order.
+			var instantApply = this.prefManager.getBoolPref("browser.preferences.instantApply");
+			if (instantApply)
+			{
+				//save the filters
+				this.asf_savefilters();
 			}
-			catch(e){} // if the user point outside of the filter tree (because using dragexit instead of dragdrop (dragdrop is not working)).
 		} 
 		event.preventDefault();
 	},
@@ -713,7 +747,7 @@ var automatic_save_folder = {
 		if (idx == -1) return false;
 		var originidx = idx;
 		var currentitem = tree.treeBoxObject.view.getItemAtIndex(idx);	
-		var parent = currentitem.parentNode;		
+		var parent = currentitem.parentNode;
 		{
 			parent.appendChild(currentitem.cloneNode(true))
 		}
diff --git a/content/common.dtd b/content/common.dtd
index b97750f..95859bf 100644
--- a/content/common.dtd
+++ b/content/common.dtd
@@ -1,2 +1,2 @@
 <!-- Current version -->
-<!ENTITY asf.version "1.0.2b Rev79">
\ No newline at end of file
+<!ENTITY asf.version "1.0.2b Rev80">
\ No newline at end of file
diff --git a/content/options.xul b/content/options.xul
index c21182f..51ac241 100644
--- a/content/options.xul
+++ b/content/options.xul
@@ -120,7 +120,7 @@
 					<treechildren 
 					ondragstart="automatic_save_folder.dragstart(event)"
 					ondragover="automatic_save_folder.dragover(event)"
-					ondragexit="automatic_save_folder.dragdrop(event)"
+					ondrop="automatic_save_folder.dragdrop(event)"
 					onclick="automatic_save_folder.save_active_state()"
 					id="asf-filterChilds" context="contextpopup" ondblclick="event.preventDefault();window.openDialog('chrome://asf/content/edit.xul','asf_addedit','chrome, centerscreen, resizable=no, dialog=no, modal=yes');"/>
 				</tree>
diff --git a/locale/en-US/about.dtd b/locale/en-US/about.dtd
index 9670378..1beb634 100644
--- a/locale/en-US/about.dtd
+++ b/locale/en-US/about.dtd
@@ -27,6 +27,7 @@
 + If DownThemAll add-on is installed, a new option's tab is available to send ASF target path to DTA.
 + Added an option to select if the filters are case sensitive or insensitive.
 + New options related to Graphical User Interface.
++ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
 ! Fixed a bug where checking the Regexp option when a filter ended by a slash didn't add a second slash.
 ! Fixed a bug where no data were returned if a download was initiated from the URL bar or from an external software which resulted in no filters in the filter's list if the preferences window was opened from the saving dialog "+ Add or edit a filter". (Thanks to MrCOLOMBO)
 ! ASF now uses the full URL instead of the domain when falling back to current website URL if no filter is found, when using single click (Right-click already used full URL).">
diff --git a/locale/fr/about.dtd b/locale/fr/about.dtd
index afdf625..cde2151 100644
--- a/locale/fr/about.dtd
+++ b/locale/fr/about.dtd
@@ -27,6 +27,7 @@
 + Si l'extension DownThemAll est installée, un nouvel onglet d'option est disponible permetant d'envoyer le dossier de destination d'ASF à DTA.
 + Ajout d'une option permettant de choisir si les filtres sont sensibles ou insensibles à la casse.
 + Nouvelles options concernant l'interface graphique.
++ Ajout de la fonction Copie lors d'un Drag&Drop (ex. drag+Ctrl sur Windows).
 ! Correction du script permettant de rajouter les slashs aux expressions régulières si le filtre contient déjà un slash aux extrémités.
 ! Correction d'un bug où les données d'un lien direct entré dans la barre d'adresse ou initialisé par un autre programme n'étaient pas lu correctement, empêchant d'afficher la liste des filtres lorsque la fenêtre de préférences était ouverte à partir du lien "+ Ajouter ou éditer un filtre" de la fenêtre d'enregistrement. (Merci à MrCOLOMBO)
 ! ASF utilise maintenant l'URL complète du site courant au lieu de son domaine lorsque qu'aucun filtre n'est trouvé. (Le clic-droit utilisait déjà l'URL complète).">
diff --git a/locale/it/about.dtd b/locale/it/about.dtd
index b2c9c03..176a3ca 100644
--- a/locale/it/about.dtd
+++ b/locale/it/about.dtd
@@ -27,6 +27,7 @@
 + If DownThemAll add-on is installed, a new option's tab is available to send ASF target path to DTA.
 + Added an option to select if the filters are case sensitive or insensitive.
 + New options related to Graphical User Interface.
++ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
 ! Fixed a bug where checking the Regexp option when a filter ended by a slash didn't add a second slash.
 ! Fixed a bug where no data were returned if a download was initiated from the URL bar or from an external software which resulted in no filters in the filter's list if the preferences window was opened from the saving dialog "+ Add or edit a filter". (Thanks to MrCOLOMBO)
 ! ASF now uses the full URL instead of the domain when falling back to current website URL if no filter is found, when using single click (Right-click already used full URL).">
diff --git a/locale/ru/about.dtd b/locale/ru/about.dtd
index 6afb0bc..30c1cbc 100644
--- a/locale/ru/about.dtd
+++ b/locale/ru/about.dtd
@@ -27,6 +27,7 @@
 + If DownThemAll add-on is installed, a new option's tab is available to send ASF target path to DTA.
 + Added an option to select if the filters are case sensitive or insensitive.
 + New options related to Graphical User Interface.
++ Added a Drag&Drop Copy method (ie. drag+Ctrl on Windows).
 ! Fixed a bug where checking the Regexp option when a filter ended by a slash didn't add a second slash.
 ! Fixed a bug where no data were returned if a download was initiated from the URL bar or from an external software which resulted in no filters in the filter's list if the preferences window was opened from the saving dialog "+ Add or edit a filter". (Thanks to MrCOLOMBO)
 ! ASF now uses the full URL instead of the domain when falling back to current website URL if no filter is found, when using single click (Right-click already used full URL).">
diff --git a/skin/style.css b/skin/style.css
index fc9310d..944820c 100644
--- a/skin/style.css
+++ b/skin/style.css
@@ -63,4 +63,15 @@ treechildren::-moz-tree-cell-text(FilterTestPassSelected)
 treechildren::-moz-tree-cell-text(FilterTestFailSelected)
 {
   color: #000000;
-}
\ No newline at end of file
+}
+
+treechildren::-moz-tree-row(FilterDragCopy_set)
+{
+  border-top: solid 1px #000000;
+}
+
+treechildren::-moz-tree-row(FilterDragCopy_remove)
+{
+  border-top: solid 0px #000000;
+}
+

-- 
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