# HG changeset patch # User wycc # Date 1239374761 -28800 # Node ID f3e6ac47752c3dca260fd57dac684cd0673f6fbe # Parent 7cbb364fd2731da2dde534a699854316dff0e305 Load the last opened project automatically. diff -r 7cbb364fd273 -r f3e6ac47752c inkscape/firefox/content/inkscape.js --- a/inkscape/firefox/content/inkscape.js Sun Apr 05 17:00:28 2009 +0800 +++ b/inkscape/firefox/content/inkscape.js Fri Apr 10 22:46:01 2009 +0800 @@ -886,6 +886,10 @@ prjname = $('#mbsvg').attr('value'); project_name = prjname; project_dir = getPathDirectory(prjname); + var f = system_open_write("/tmp/madbuilder.ws"); + var s = "last="+prjname; + f.write(s,s.length); + f.close(); var prj = system_read(prjname); project_parse(prj); filedialog.dialog('close'); @@ -924,21 +928,43 @@ project_parse(prj); } +function loadOldProject() +{ + var f = system_open_read("/tmp/madbuilder.ws"); + if (f == null) return -1; + var s = f.read(f.available()); + f.close(); + + var pos = s.indexOf("last="); + if (pos == -1) return -1; + var m = s.match("last=([^\s]*)"); + if (m[1]) { + var prj = system_read(m[1]); + project_dir = getPathDirectory(m[1]); + project_parse(prj); + $('#filedialog').dialog("close"); + } + return 0; + +} + 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, + if (loadOldProject()) { + filedialog = jQuery('#filedialog'); + filedialog.dialog({width:500, modal: true, autoOpen:false, title:'Please select a file'}); - filedialog.show(); - filedialog.html('Please select the project file
'); - filedialog.append(''); - filedialog.append(''); - filedialog.dialog("open"); + filedialog.show(); + filedialog.html('Please select the project file
'); + filedialog.append(''); + filedialog.append(''); + filedialog.dialog("open"); + } }); $('#frame').draggable();