# HG changeset patch # User wycc # Date 1237108626 -28800 # Node ID e21e9447f5458f7f8a717902b57eb0aa3e3b13a9 # Parent 912d05129b4f3578613cb341c6dea994a68a47b3 Add wizard. We still need to add the template files. diff -r 912d05129b4f -r e21e9447f545 inkscape/firefox/content/inkscape.js --- a/inkscape/firefox/content/inkscape.js Sat Mar 14 18:36:57 2009 +0800 +++ b/inkscape/firefox/content/inkscape.js Sun Mar 15 17:17:06 2009 +0800 @@ -624,6 +624,30 @@ } } +function system_open_read(fname) { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + } catch (e) { + alert("Permission to read file was denied."); + } + var file = Components.classes["@mozilla.org/file/local;1"] + .createInstance(Components.interfaces.nsILocalFile); + try { + file.initWithPath( fname ); + if ( file.exists() == false ) { + alert("File does not exist"); + } + var is = Components.classes["@mozilla.org/network/file-input-stream;1"] + .createInstance( Components.interfaces.nsIFileInputStream ); + is.init( file,0x01, 00004, null); + var sis = Components.classes["@mozilla.org/scriptableinputstream;1"] + .createInstance( Components.interfaces.nsIScriptableInputStream ); + sis.init( is ); + } catch(e) { + alert(fname+" does not exist"); + } + return sis; +} function system_read(fname) { try { @@ -651,6 +675,24 @@ } return output; } +function system_open_write(fname) { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + } catch (e) { + alert("Permission to read file was denied."); + } + var file = Components.classes["@mozilla.org/file/local;1"] + .createInstance(Components.interfaces.nsILocalFile); + try { + file.initWithPath( fname ); + var fostream = Components.classes["@mozilla.org/network/file-output-stream;1"] + .createInstance( Components.interfaces.nsIFileOutputStream ); + fostream.init( file,0x02|0x8|0x20, 0666,0); + } catch(e) { + alert(fname+" does not exist"); + } + return fostream; +} function system_write(fname,xml) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -704,14 +746,23 @@ } + +function onLoadProject(path) +{ + project_name = path; + var prj = system_read(project_name); + project_parse(prj); +} + var last_select = null; - +var wizard = new Wizard(); +wizard.cb = onLoadProject; $('#filedialog').dialog({ width:500}); jQuery(document).ready(function() { filedialog = jQuery('#filedialog'); filedialog.dialog({width:500, modal: true, - autopen:false, + autoOpen:false, title:'Please select a file'}); filedialog.show(); filedialog.html('Please select the project file
'); diff -r 912d05129b4f -r e21e9447f545 inkscape/firefox/content/madbuilder.html --- a/inkscape/firefox/content/madbuilder.html Sat Mar 14 18:36:57 2009 +0800 +++ b/inkscape/firefox/content/madbuilder.html Sun Mar 15 17:17:06 2009 +0800 @@ -9,7 +9,7 @@ - +