download wallet editor onto client

This commit is contained in:
morse%netscape.com 1999-05-12 22:40:22 +00:00
Родитель 458379ac82
Коммит 2d6f16c2da
2 изменённых файлов: 42 добавлений и 11 удалений

Просмотреть файл

@ -1197,6 +1197,16 @@ wallet_FetchSchemaConcatFromNetCenter() {
("http://people.netscape.com/morse/wallet/SchemaConcat.tbl","SchemaConcat.tbl");
}
/*
* fetch wallet editor from netcenter and put into
* local copy of file at walleted.html
*/
void
wallet_FetchWalletEditorFromNetCenter() {
wallet_FetchFromNetCenter
("http://people.netscape.com/morse/wallet/walleted.html","walleted.html");
}
/*********************************************************************/
/* The following are utility routines for the main wallet processing */
/*********************************************************************/
@ -1418,6 +1428,7 @@ wallet_Initialize() {
wallet_FetchFieldSchemaFromNetCenter();
wallet_FetchURLFieldSchemaFromNetCenter();
wallet_FetchSchemaConcatFromNetCenter();
wallet_FetchWalletEditorFromNetCenter();
wallet_ReadFromFile("FieldSchema.tbl", wallet_FieldToSchema_list, FALSE);
wallet_ReadFromURLFieldToSchemaFile("URLFieldSchema.tbl", wallet_URLFieldToSchema_list);
@ -1906,9 +1917,7 @@ wallet_RequestToPrefill(XP_List * list) {
return;
}
#define WALLET_EDITOR_URL "http://people.netscape.com/morse/wallet/walleted.html"
//#define WALLET_EDITOR_URL "http://peoplestage/morse/wallet/walleted.html"
//#define WALLET_EDITOR_URL "resource:/res/samples/walleted.html"
#define WALLET_EDITOR_NAME "walleted.html"
// bad!!! should pass the above URL as parameter to wallet_PostEdit
#define BREAK '\001'
@ -1928,8 +1937,8 @@ wallet_PostEdit() {
kINetServiceIID,
(nsISupports **)&netservice);
if ((NS_SUCCEEDED(res)) && (nsnull != netservice)) {
const nsAutoString walletEditor = nsAutoString(WALLET_EDITOR_URL);
if (!NS_FAILED(NS_NewURL(&url, walletEditor))) {
nsFileURL u = nsFileURL(Wallet_ProfileDirectory(WALLET_EDITOR_NAME));
if (!NS_FAILED(NS_NewURL(&url, (char *)u.GetURLString()))) {
res = netservice->GetCookieString(url, *nsCookie);
}
nsServiceManager::ReleaseService(kNetServiceCID, netservice);
@ -2189,8 +2198,9 @@ wallet_ClearStopwatch();
PUBLIC void
WLLT_OKToCapture(PRBool * result, PRInt32 count, char* URLName) {
char * message = Wallet_Localize("WantToCaptureForm?");
nsFileURL u = nsFileURL(Wallet_ProfileDirectory(WALLET_EDITOR_NAME));
*result =
(PL_strcmp(URLName, WALLET_EDITOR_URL)) && wallet_GetFormsCapturingPref() &&
(PL_strcmp(URLName, (char *)u.GetURLString())) && wallet_GetFormsCapturingPref() &&
(count>=3) && FE_Confirm(message);
PR_FREEIF(message);
}

Просмотреть файл

@ -69,6 +69,12 @@ static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
static NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID);
#if defined(ClientWallet) || defined(SingleSignon)
#ifdef ClientWallet
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
#endif
#include "nsIWalletService.h"
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
@ -319,13 +325,27 @@ nsBrowserAppCore::Stop()
}
#ifdef ClientWallet
//#define WALLET_EDITOR_URL "resource:/res/samples/walleted.html"
//#define WALLET_EDITOR_URL "http://peoplestage/morse/wallet/walleted.html"
#define WALLET_EDITOR_URL "http://people.netscape.com/morse/wallet/walleted.html"
#define WALLET_EDITOR_NAME "walleted.html"
#define WALLET_SAMPLES_URL "http://people.netscape.com/morse/wallet/samples/"
//#define WALLET_SAMPLES_URL "http://peoplestage/morse/wallet/samples/"
nsFileSpec ProfileDirectory(char * file) {
nsresult rv;
nsIFileLocator* locator = nsnull;
rv = nsServiceManager::GetService
(kFileLocatorCID, kIFileLocatorIID, (nsISupports**)&locator);
if (NS_FAILED(rv) || !locator)
return (nsFileSpec)NULL;
nsFileSpec dirSpec;
rv = locator->GetFileLocation
(nsSpecialFileSpec::App_UserProfileDirectory50, &dirSpec);
nsServiceManager::ReleaseService(kFileLocatorCID, locator);
if (NS_FAILED(rv))
return (nsFileSpec)NULL;
return dirSpec+file;
}
PRInt32
newWind(char* urlName) {
nsresult rv;
@ -387,16 +407,17 @@ nsBrowserAppCore::WalletEditor()
res = nsServiceManager::GetService(kWalletServiceCID,
kIWalletServiceIID,
(nsISupports **)&walletservice);
nsFileURL u = nsFileURL(ProfileDirectory(WALLET_EDITOR_NAME));
if ((NS_OK == res) && (nsnull != walletservice)) {
nsIURL * url;
if (!NS_FAILED(NS_NewURL(&url, WALLET_EDITOR_URL))) {
if (!NS_FAILED(NS_NewURL(&url, (char *)(u.GetURLString())))) {
res = walletservice->WALLET_PreEdit(url);
nsServiceManager::ReleaseService(kWalletServiceCID, walletservice);
}
}
/* bring up the wallet editor in a new window */
return newWind(WALLET_EDITOR_URL);
return newWind((char *)(u.GetURLString()));
}
NS_IMETHODIMP