add wallet samples

This commit is contained in:
morse%netscape.com 1999-03-15 00:46:22 +00:00
parent 50e0a0cb52
commit 9d6bc5a897
6 changed files with 63 additions and 0 deletions

View File

@ -12,6 +12,7 @@ interface BrowserAppCore : BaseAppCore
void walletEditor();
void walletSafeFillin();
void walletQuickFillin();
void walletSamples();
void setToolbarWindow(in Window win);
void setContentWindow(in Window win);

View File

@ -43,6 +43,7 @@ public:
NS_IMETHOD WalletEditor()=0;
NS_IMETHOD WalletSafeFillin()=0;
NS_IMETHOD WalletQuickFillin()=0;
NS_IMETHOD WalletSamples()=0;
#endif
NS_IMETHOD LoadUrl(const nsString& aUrl)=0;

View File

@ -224,6 +224,9 @@ nsBrowserAppCore::Forward()
//#define WALLET_EDITOR_URL "http://peoplestage/morse/wallet/walleted.html"
#define WALLET_EDITOR_URL "http://people.netscape.com/morse/wallet/walleted.html"
#define WALLET_SAMPLES_URL "http://people.netscape.com/morse/wallet/samples"
//#define WALLET_SAMPLES_URL "http://peoplestage/morse/wallet/samples"
PRInt32
newWindow(char* urlName) {
nsresult rv;
@ -271,6 +274,7 @@ newWindow(char* urlName) {
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow,
nsnull, nsnull, 615, 650);
NS_RELEASE(url);
done:
@ -379,6 +383,15 @@ nsBrowserAppCore::WalletQuickFillin()
return NS_OK;
}
NS_IMETHODIMP
nsBrowserAppCore::WalletSamples()
{
/* bring up the samples in a new window */
mContentAreaWebShell->LoadURL(nsString(WALLET_SAMPLES_URL), nsnull, nsnull);
return NS_OK;
}
#endif
NS_IMETHODIMP

View File

@ -66,6 +66,7 @@ class nsBrowserAppCore : public nsBaseAppCore,
NS_IMETHOD WalletEditor();
NS_IMETHOD WalletSafeFillin();
NS_IMETHOD WalletQuickFillin();
NS_IMETHOD WalletSamples();
#endif
NS_IMETHOD LoadUrl(const nsString& aUrl);

View File

@ -294,6 +294,39 @@ BrowserAppCoreWalletQuickFillin(JSContext *cx, JSObject *obj, uintN argc, jsval
return JS_TRUE;
}
//
// Native method WalletSamples
//
PR_STATIC_CALLBACK(JSBool)
BrowserAppCoreWalletSamples(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMBrowserAppCore *nativeThis = (nsIDOMBrowserAppCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 0) {
if (NS_OK != nativeThis->WalletSamples()) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function walletSamples requires 0 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
#endif
@ -701,6 +734,7 @@ static JSFunctionSpec BrowserAppCoreMethods[] =
{"walletEditor", BrowserAppCoreWalletEditor, 0},
{"walletSafeFillin", BrowserAppCoreWalletSafeFillin, 0},
{"walletQuickFillin", BrowserAppCoreWalletQuickFillin, 0},
{"walletSamples", BrowserAppCoreWalletSamples, 0},
#endif
{"loadUrl", BrowserAppCoreLoadUrl, 1},
{"setToolbarWindow", BrowserAppCoreSetToolbarWindow, 1},

View File

@ -283,6 +283,17 @@
}
}
function WalletSamples()
{
appCore = XPAppCoresManager.Find("BrowserAppCore");
if (appCore != null) {
dump("Wallet Samples\n");
appCore.walletSamples();
} else {
dump("BrowserAppCore has not been created!\n");
}
}
</html:script>
@ -443,6 +454,8 @@
<menuitem name="Wallet contents" onclick="WalletEditor();"/>
<menuitem name="Safe fillins" onclick="WalletSafeFillin();"/>
<menuitem name="Quick fillins" onclick="WalletQuickFillin();"/>
<separator />
<menuitem name="Samples" onclick="WalletSamples();"/>
</menu>
<menu name="Help">
<menuitem name="Help Contents" onclick="BrowserReload();"/>