[xiph-commits] r15075 - trunk/oggPusher/firefox-extension/chrome/content

nithin at svn.xiph.org nithin at svn.xiph.org
Fri Jun 27 03:42:47 PDT 2008


Author: nithin
Date: 2008-06-27 03:42:45 -0700 (Fri, 27 Jun 2008)
New Revision: 15075

Modified:
   trunk/oggPusher/firefox-extension/chrome/content/op_Window.js
   trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul
   trunk/oggPusher/firefox-extension/chrome/content/op_browser.js
Log:
Adding locate file dialogue

Modified: trunk/oggPusher/firefox-extension/chrome/content/op_Window.js
===================================================================
--- trunk/oggPusher/firefox-extension/chrome/content/op_Window.js	2008-06-27 00:54:19 UTC (rev 15074)
+++ trunk/oggPusher/firefox-extension/chrome/content/op_Window.js	2008-06-27 10:42:45 UTC (rev 15075)
@@ -1,4 +1,17 @@
-function onClose()
-{
-	window.close();
+var opwindowCommon={
+	openFileWindowDialog:function()
+        {
+                const nsIFilePicker = Components.interfaces.nsIFilePicker;
+                var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+                fp.init(window, "Choose a File", nsIFilePicker.modeOpen);
+                fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
+
+                var rv = fp.show();
+                if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
+                	var file = fp.file;
+         		var path = fp.file.path;
+			parent.document.getElementById("file-path").value = path;
+                }
+         }
 }
+

Modified: trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul
===================================================================
--- trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul	2008-06-27 00:54:19 UTC (rev 15074)
+++ trunk/oggPusher/firefox-extension/chrome/content/op_Window.xul	2008-06-27 10:42:45 UTC (rev 15075)
@@ -9,13 +9,12 @@
 <!-- Other elements go here --> 
 
 	<script type="application/x-javascript" src="chrome://oggPusher/content/op_Window.js"></script>
-
-
      <vbox>	
      	<label value="Locate Files on your computer:" control="browse-button"/>
 	<hbox>
-		<textbox id="file-path" disabled="true" style="width:200px"/>
-      		<button id="browse-button" label="Browse..."/>
+		<textbox id="file-path" control="browse-button" disabled="true" style="width:700px"/>
+      		<button id="browse-button" label="Browse..." oncommand=" opwindowCommon.openFileWindowDialog();"/>
+
 	</hbox>
      </vbox>
 

Modified: trunk/oggPusher/firefox-extension/chrome/content/op_browser.js
===================================================================
--- trunk/oggPusher/firefox-extension/chrome/content/op_browser.js	2008-06-27 00:54:19 UTC (rev 15074)
+++ trunk/oggPusher/firefox-extension/chrome/content/op_browser.js	2008-06-27 10:42:45 UTC (rev 15075)
@@ -1,3 +1,5 @@
+var fileName, filePath;
+
 var oggPusherCommon={
 	openDialog:function()
 	{
@@ -4,4 +6,37 @@
    		 window.open("chrome://oggPusher/content/op_Window.xul",
                       "oggPusher", "chrome,centerscreen,resizable=yes,toolbar=no,menubar=no");
 	}
+	/*openFileWindowDialog:function()
+	{
+		const nsIFilePicker = Components.interfaces.nsIFilePicker;
+		var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+		fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
+		fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
+
+		var rv = fp.show();
+		if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
+  		var file = fp.file;
+  		// Get the path as string. Note that you usually won't 
+		//   // need to work with the string paths.
+		var path = fp.file.path;
+		// work with returned nsILocalFile...
+		
+		//var textboxElement = document.getElementById("file-path");
+			
+  		//textboxElement.value =
+
+	       	}	
+  	}*/
 }
+
+
+
+function getMainWindow() {
+  return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                   .getInterface(Components.interfaces.nsIWebNavigation)
+                   .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+                   .rootTreeItem
+                   .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                   .getInterface(Components.interfaces.nsIDOMWindow);
+}
+



More information about the commits mailing list