Fix openLocation dialog

This commit is contained in:
law%netscape.com 1999-06-09 19:27:18 +00:00
parent 3c09a31379
commit 90840b6f9d
3 changed files with 19 additions and 27 deletions

View File

@ -332,7 +332,12 @@
}
}
if ( core ) {
core.ShowWindowWithArgs( "resource:/res/samples/openLocation.xul", window, appCoreName );
//core.ShowWindowWithArgs( "resource:/res/samples/openLocation.xul", window, appCoreName );
var name = appCoreName.replace( /\./, /\_/ );
// Note: Use width/height one less than actual so resizing occurs.
// This bypasses bug whereby dialog contents don't appear
// till the dialog is resized.
window.openDialog( "resource:/res/samples/openLocation.xul", name+"_openLocation", "chrome,width=419,height=189", appCoreName );
} else {
dump("Error; can't create toolkitCore\n");
}

View File

@ -23,16 +23,12 @@ var browser;
var dialog;
function onLoad() {
}
function onLoadWithArgs() {
dialog = new Object;
dialog.input = document.getElementById( "dialog.input" );
dialog.ok = document.getElementById( "dialog.ok" );
dialog.cancel = document.getElementById( "dialog.cancel" );
dialog.help = document.getElementById( "dialog.help" );
dialog.ok = document.getElementById( "dialog.ok" );
dialog.cancel = document.getElementById( "dialog.cancel" );
dialog.help = document.getElementById( "dialog.help" );
dialog.newWindow = document.getElementById( "dialog.newWindow" );
dialog.args = document.getElementById( "args" );
toolkit = XPAppCoresManager.Find( "toolkitCore" );
if ( !toolkit ) {
@ -40,10 +36,10 @@ function onLoadWithArgs() {
toolkit.Init( "toolkitCore" );
}
browser = XPAppCoresManager.Find( dialog.args.getAttribute( "value" ) );
browser = XPAppCoresManager.Find( window.arguments[0] );
if ( !browser ) {
dump( "unable to get browser app core\n" );
//toolkit.CloseWindow( window );
toolkit.CloseWindow( window );
}
/* Give input field the focus. */
@ -89,25 +85,22 @@ function open() {
}
/* Close dialog. */
//toolkit.CloseWindow( window );
toolkit.CloseWindow( window );
}
function choose() {
/* Use existing browser "open" logic. */
browser.openWindow();
//toolkit.CloseWindow( window );
toolkit.CloseWindow( window );
}
function cancel() {
if ( dialog.cancel.disabled ) {
return;
}
//toolkit.CloseWindow( window );
toolkit.CloseWindow( window );
}
function help() {
if ( dialog.help.disabled ) {
return;
}
dump( "openLocation::help() not implemented\n" );
if ( dialog.help.disabled ) {
return;
}
dump( "openLocation::help() not implemented\n" );
}

View File

@ -13,12 +13,6 @@
<html:script language="javascript" src="openLocation.js">
</html:script>
<broadcaster id="args" value=""/>
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="onLoadWithArgs()"/>
<!--
<box align="vertical">
<box align="horizontal">
@ -83,7 +77,7 @@
<html:button id="dialog.ok" onclick="open()" disabled="">Open</html:button>
</html:td>
<html:td width="70">
<html:button id="dialog.cancel" onclick="cancel()" disabled="">Cancel</html:button>
<html:button id="dialog.cancel" onclick="cancel()">Cancel</html:button>
</html:td>
<html:td width="70">
<html:button id="dialog.help" onclick="help()" disabled="">Help</html:button>